mirror of
https://github.com/SoPat712/videospeed.git
synced 2025-08-21 18:08:46 -04:00
Merge branch 'master' of github.com:igrigorik/videospeed into apple-tv-plus
This commit is contained in:
@@ -297,7 +297,16 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (match.startsWith('/')) {
|
||||||
|
try {
|
||||||
|
var regexp = new RegExp(match);
|
||||||
|
} catch(err) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
var regexp = new RegExp(escapeStringRegExp(match));
|
var regexp = new RegExp(escapeStringRegExp(match));
|
||||||
|
}
|
||||||
|
|
||||||
if (regexp.test(location.href)) {
|
if (regexp.test(location.href)) {
|
||||||
blacklisted = true;
|
blacklisted = true;
|
||||||
return;
|
return;
|
||||||
|
@@ -109,7 +109,12 @@
|
|||||||
<input id="controllerOpacity" type="text" value="">
|
<input id="controllerOpacity" type="text" value="">
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<label for="blacklist">Blacklisted sites on which extension is disabled<br/>(one per line)</label>
|
<label for="blacklist">Blacklisted sites on which extension is disabled<br/>
|
||||||
|
(one per line)<br/>
|
||||||
|
<br/>
|
||||||
|
<em><a href="https://www.regexpal.com/">Regex</a> is supported. Be sure it is in "//g" format.<br/>
|
||||||
|
ie: /(.+)youtube\.com(\/*)$/gi</em>
|
||||||
|
</label>
|
||||||
<textarea id="blacklist" rows="10" cols="50"></textarea>
|
<textarea id="blacklist" rows="10" cols="50"></textarea>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
23
options.js
23
options.js
@@ -163,8 +163,31 @@ function createKeyBindings(item) {
|
|||||||
keyBindings.push({action: action, key: key, value: value, force: force, predefined: predefined});
|
keyBindings.push({action: action, key: key, value: value, force: force, predefined: predefined});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Validates settings before saving
|
||||||
|
function validate() {
|
||||||
|
var valid = true;
|
||||||
|
var status = document.getElementById('status');
|
||||||
|
document.getElementById('blacklist').value.split("\n").forEach(match => {
|
||||||
|
match = match.replace(regStrip,'')
|
||||||
|
if (match.startsWith('/')) {
|
||||||
|
try {
|
||||||
|
var regexp = new RegExp(match);
|
||||||
|
} catch(err) {
|
||||||
|
status.textContent = 'Error: Invalid Regex: ' + match
|
||||||
|
+ '. Unable to save';
|
||||||
|
valid = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return valid;
|
||||||
|
}
|
||||||
|
|
||||||
// Saves options to chrome.storage
|
// Saves options to chrome.storage
|
||||||
function save_options() {
|
function save_options() {
|
||||||
|
if (validate() === false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
keyBindings = [];
|
keyBindings = [];
|
||||||
Array.from(document.querySelectorAll(".customs")).forEach(item => createKeyBindings(item)); // Remove added shortcuts
|
Array.from(document.querySelectorAll(".customs")).forEach(item => createKeyBindings(item)); // Remove added shortcuts
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user