Skip to content

Commit

Permalink
Merge pull request #544 from yoshiishunichi/master
Browse files Browse the repository at this point in the history
Add disableFindHotKey checkbox
  • Loading branch information
dimdenGD authored Sep 18, 2023
2 parents 0526500 + a8f077e commit dfab185
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,7 @@
"favorited_by": { "message": "Favorited by" },
"disable_retweet_hotkey": { "message": "Disable retweet hotkey (T)" },
"disable_like_hotkey": { "message": "Disable like hotkey (L)" },
"disable_find_hotkey": { "message": "Disable find hotkey (F)" },
"enable_extension_compatibility": { "message": "Enable extension compatibility mode (only enable if you want to make some extension work with OldTwitter, if it still doesn't work (and most likely won't) disable this again, because this option can make page buggy/laggy)" },
"enter_custom_font_name": {"message": "Enter a custom font name" },
"disable_data_saver": { "message": "Disable data saver for cellular connection", "description": "This option only appears on mobile" },
Expand Down
2 changes: 2 additions & 0 deletions layouts/header/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -3093,6 +3093,8 @@ setInterval(() => {
if(e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA' || e.target.tagName === 'EMOJI-PICKER') return;

if(!e.altKey && !e.ctrlKey && e.keyCode === 70) { // F
if(vars.disableFindHotkey) return;

// focus search bar
searchInput.focus();
e.preventDefault();
Expand Down
3 changes: 3 additions & 0 deletions layouts/settings/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ <h2>__MSG_accessibility__</h2><br>
<div class="setting">
<input type="checkbox" id="disable-like-hotkey"> <label for="disable-like-hotkey">__MSG_disable_like_hotkey__</label>
</div>
<div class="setting">
<input type="checkbox" id="disable-find-hotkey"> <label for="disable-find-hotkey">__MSG_disable_find_hotkey__</label>
</div>
<div class="setting">
<input type="checkbox" id="disable-hotkeys"> <label for="disable-hotkeys">__MSG_disable_hotkeys__</label>
</div>
Expand Down
7 changes: 7 additions & 0 deletions layouts/settings/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ setTimeout(async () => {
let disableHotkeys = document.getElementById('disable-hotkeys');
let disableRetweetHotkey = document.getElementById('disable-retweet-hotkey');
let disableLikeHotkey = document.getElementById('disable-like-hotkey');
let disableFindHotkey = document.getElementById('disable-find-hotkey');
let customCSS = document.getElementById('custom-css');
let customCSSSave = document.getElementById('custom-css-save');
let savePreferredQuality = document.getElementById('save-preferred-quality');
Expand Down Expand Up @@ -492,6 +493,11 @@ setTimeout(async () => {
disableLikeHotkey: disableLikeHotkey.checked
}, () => { });
});
disableFindHotkey.addEventListener('change', () => {
chrome.storage.sync.set({
disableFindHotkey: disableFindHotkey.checked
}, () => { });
});
savePreferredQuality.addEventListener('change', () => {
chrome.storage.sync.set({
savePreferredQuality: savePreferredQuality.checked
Expand Down Expand Up @@ -834,6 +840,7 @@ setTimeout(async () => {
disableHotkeys.checked = !!vars.disableHotkeys;
disableRetweetHotkey.checked = !!vars.disableRetweetHotkey;
disableLikeHotkey.checked = !!vars.disableLikeHotkey;
disableFindHotkey.checked = !!vars.disableFindHotkey;
noBigFont.checked = !!vars.noBigFont;
autoplayVideos.checked = !!vars.autoplayVideos;
displaySensitiveContent.checked = !!vars.displaySensitiveContent;
Expand Down
2 changes: 1 addition & 1 deletion scripts/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ async function loadVars() {
'enableAd', 'acknowledgedCssAccess', 'disableProfileCustomizations', 'openNotifsAsModal', 'enableIframeNavigation',
'acknowledgedCustomizationButton', 'modernUI', 'showExactValues', 'hideTimelineTypes', 'autotranslateLanguages',
'autotranslationMode', 'muteVideos', 'dontPauseVideos', 'showUserPreviewsOnMobile', 'systemDarkMode', 'localizeDigit',
'disableRetweetHotkey', 'disableLikeHotkey', 'extensionCompatibilityMode', 'disableDataSaver', 'disableAcceptType',
'disableRetweetHotkey', 'disableLikeHotkey', 'disableFindHotkey', 'extensionCompatibilityMode', 'disableDataSaver', 'disableAcceptType',
'showUserFollowerCountsInLists', 'showQuoteCount'
], data => {
// default variables
Expand Down

0 comments on commit dfab185

Please sign in to comment.