Skip to content

Commit

Permalink
Crunchyroll disabled the Numpad
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamlinerm committed Aug 24, 2024
1 parent c3bec9b commit 50b76f7
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 19 deletions.
6 changes: 6 additions & 0 deletions firefox/_locales/de/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -299,5 +299,11 @@
},
"BigPlayerDescription": {
"message": "Erweitert die größe des Videos zum gesamten Browserfenster ohne Vollbild."
},
"DisableNumpadSwitch": {
"message": "Ziffernblock deaktivieren:"
},
"DisableNumpadDescription": {
"message": "Deaktivieren Sie die Zifferntasten, damit nicht versehentlich die aktuelle Videozeit /-position geändert wird."
}
}
6 changes: 6 additions & 0 deletions firefox/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -299,5 +299,11 @@
},
"BigPlayerDescription": {
"message": "Extends the video size to the entire browser window without full screen."
},
"DisableNumpadSwitch": {
"message": "Disable numpad:"
},
"DisableNumpadDescription": {
"message": "Disable the numpad keys so you don't accidentally change the current video time/position."
}
}
8 changes: 4 additions & 4 deletions firefox/_locales/mk/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,10 @@
"message": "Дома",
"description": "Disney Homepage button"
},
"BigPlayerSwitch": {
"message": "Видео поголемо:"
"DisableNumpadSwitch": {
"message": "Оневозможи numpad:"
},
"BigPlayerDescription": {
"message": "Ја проширува големината на видеото на целиот прозорец на прелистувачот без цел екран."
"DisableNumpadDescription": {
"message": "Оневозможете ги копчињата со нумпод за случајно да не го промените тековното време/положба на видеото."
}
}
6 changes: 6 additions & 0 deletions firefox/_locales/pt_BR/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -296,5 +296,11 @@
},
"BigPlayerDescription": {
"message": "Estende o tamanho do vídeo para toda a janela do navegador sem tela cheia."
},
"DisableNumpadSwitch": {
"message": "Desativar o teclado numérico:"
},
"DisableNumpadDescription": {
"message": "Desative as teclas do teclado numérico para não alterar acidentalmente o tempo/posição do vídeo atual."
}
}
10 changes: 9 additions & 1 deletion firefox/badge.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,15 @@ if (isMobile) {
showRating: true,
},
Disney: { skipIntro: true, skipCredits: true, watchCredits: false, speedSlider: true, showRating: true, selfAd: true },
Crunchyroll: { skipIntro: true, speedSlider: true, releaseCalendar: true, dubLanguage: null, profile: true, bigPlayer: true },
Crunchyroll: {
skipIntro: true,
speedSlider: true,
releaseCalendar: true,
dubLanguage: null,
profile: true,
bigPlayer: true,
disableNumpad: true,
},
HBO: { skipIntro: true, skipCredits: true, watchCredits: false, speedSlider: true, showRating: true },
Video: { playOnFullScreen: true, epilepsy: false, userAgent: true },
Statistics: { AmazonAdTimeSkipped: 0, NetflixAdTimeSkipped: 0, IntroTimeSkipped: 0, RecapTimeSkipped: 0, SegmentsSkipped: 0 },
Expand Down
34 changes: 23 additions & 11 deletions firefox/cr.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,15 @@ const defaultSettings = {
showRating: true,
},
Disney: { skipIntro: true, skipCredits: true, watchCredits: false, speedSlider: true, showRating: true, selfAd: true },
Crunchyroll: { skipIntro: true, speedSlider: true, releaseCalendar: true, dubLanguage: null, profile: true, bigPlayer: true },
Crunchyroll: {
skipIntro: true,
speedSlider: true,
releaseCalendar: true,
dubLanguage: null,
profile: true,
bigPlayer: true,
disableNumpad: true,
},
HBO: { skipIntro: true, skipCredits: true, watchCredits: false, speedSlider: true, showRating: true },
Video: { playOnFullScreen: true, epilepsy: false, userAgent: true },
Statistics: { AmazonAdTimeSkipped: 0, NetflixAdTimeSkipped: 0, IntroTimeSkipped: 0, RecapTimeSkipped: 0, SegmentsSkipped: 0 },
Expand All @@ -55,16 +63,7 @@ const defaultSettings = {
},
};
let settings = { ...defaultSettings.settings };
const version = "1.1.29";
browser.storage.sync.get("settings", function (result) {
console.log(
"%cNetflix%c/%cPrime%c Auto-Skip",
"color: #e60010;font-size: 2em;",
"color: white;font-size: 2em;",
"color: #00aeef;font-size: 2em;",
"color: white;font-size: 2em;"
);
console.log("version:", version);
// overwrite default settings with user settings
// List of keys to merge individually
settings.Amazon = { ...defaultSettings.settings.Amazon, ...result?.settings?.Amazon };
Expand All @@ -75,7 +74,7 @@ browser.storage.sync.get("settings", function (result) {
settings.Video = { ...defaultSettings.settings.Video, ...result?.settings?.Video };
settings.Statistics = { ...defaultSettings.settings.Statistics, ...result?.settings?.Statistics };
settings.General = { ...defaultSettings.settings.General, ...result?.settings?.General };

if (settings?.Crunchyroll?.disableNumpad) Crunchyroll_disableNumpad();
CrunchyrollObserver.observe(document, config);
if (settings?.Video?.playOnFullScreen) startPlayOnFullScreen();
});
Expand Down Expand Up @@ -273,6 +272,19 @@ async function Crunchyroll_SpeedSlider(video) {
}
}
}
async function Crunchyroll_disableNumpad() {
document.addEventListener(
"keydown",
async function (event) {
if (event.location === 3) {
console.log("key blocked: " + event.key);
event.stopPropagation();
increaseBadge();
}
},
true
);
}
// Badge Functions
function increaseBadge() {
settings.Statistics.SegmentsSkipped++;
Expand Down
7 changes: 7 additions & 0 deletions firefox/popup/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,13 @@ <h2 data-i18n style="color: #f78b24">PageSpecificTitle;Crunchyroll</h2>
<span class="slider round"></span>
</label>
</div>
<div class="line flex">
<p data-i18n>DisableNumpadSwitch</p>
<label class="switch">
<input type="checkbox" id="CrunchyrollDisableNumpad">
<span class="slider round"></span>
</label>
</div>
<p id="MenuVideo" class="button" data-i18n>OpenSharedSettings</p>
</div>
<div class="hidden" id="StatisticsSettings">
Expand Down
12 changes: 11 additions & 1 deletion firefox/popup/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -638,15 +638,24 @@ <h2 data-i18n>PageSpecificTitle;Crunchyroll</h2>
</label>
</div>
<p class="description" data-i18n>ProfileSwitchDescription</p>
<hr>
<div class="line flex">
<p data-i18n>BigPlayerSwitch</p>
<label class="switch">
<input type="checkbox" id="CrunchyrollBigPlayer">
<span class="slider round"></span>
</label>
</div>
<hr>
<p class="description" data-i18n>BigPlayerDescription</p>
<hr>
<div class="line flex">
<p data-i18n>DisableNumpadSwitch</p>
<label class="switch">
<input type="checkbox" id="CrunchyrollDisableNumpad">
<span class="slider round"></span>
</label>
</div>
<p class="description" data-i18n>DisableNumpadDescription</p>
</div>
<div id="StatisticsSettings" class="hidden">
<h2 data-i18n>SkippedTime</h2>
Expand Down Expand Up @@ -700,6 +709,7 @@ <h2>Changelog</h2>
<h2>1.1.30</h2>
<ul>
<li>Added Crunchyroll big video player mod.</li>
<li>Disable the numpad on Crunchyroll.</li>
</ul>
</div>
<div class="line flex">
Expand Down
10 changes: 9 additions & 1 deletion firefox/popup/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,15 @@ const defaultSettings = {
showRating: true,
},
Disney: { skipIntro: true, skipCredits: true, watchCredits: false, speedSlider: true, showRating: true, selfAd: true },
Crunchyroll: { skipIntro: true, speedSlider: true, releaseCalendar: true, dubLanguage: null, profile: true, bigPlayer: true },
Crunchyroll: {
skipIntro: true,
speedSlider: true,
releaseCalendar: true,
dubLanguage: null,
profile: true,
bigPlayer: true,
disableNumpad: true,
},
HBO: { skipIntro: true, skipCredits: true, watchCredits: false, speedSlider: true, showRating: true },
Video: { playOnFullScreen: true, epilepsy: false, userAgent: true },
Statistics: { AmazonAdTimeSkipped: 0, NetflixAdTimeSkipped: 0, IntroTimeSkipped: 0, RecapTimeSkipped: 0, SegmentsSkipped: 0 },
Expand Down
10 changes: 9 additions & 1 deletion firefox/skipper.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,15 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO
showRating: true,
},
Disney: { skipIntro: true, skipCredits: true, watchCredits: false, speedSlider: true, showRating: true, selfAd: true },
Crunchyroll: { skipIntro: true, speedSlider: true, releaseCalendar: true, dubLanguage: null, profile: true, bigPlayer: true },
Crunchyroll: {
skipIntro: true,
speedSlider: true,
releaseCalendar: true,
dubLanguage: null,
profile: true,
bigPlayer: true,
disableNumpad: true,
},
HBO: { skipIntro: true, skipCredits: true, watchCredits: false, speedSlider: true, showRating: true },
Video: { playOnFullScreen: true, epilepsy: false, userAgent: true },
Statistics: { AmazonAdTimeSkipped: 0, NetflixAdTimeSkipped: 0, IntroTimeSkipped: 0, RecapTimeSkipped: 0, SegmentsSkipped: 0 },
Expand Down

0 comments on commit 50b76f7

Please sign in to comment.