Keyboard shortcuts get loaded in popup, fixed 'reset' button in popup.
This commit is contained in:
parent
7e848332ce
commit
174c987690
@ -9,7 +9,7 @@ Debug = {
|
||||
debugArDetect: false,
|
||||
debugStorage: true,
|
||||
showArDetectCanvas: false,
|
||||
flushStoredSettings: true
|
||||
flushStoredSettings: false
|
||||
}
|
||||
|
||||
if(_prod){
|
||||
|
@ -79,7 +79,6 @@ var _kbd_process = function (event) { // Tukaj ugotovimo, katero tipko
|
||||
ArDetect.stop();
|
||||
|
||||
if(conf.action == "char"){
|
||||
// Status.arStat = "fixed";
|
||||
Resizer.setAr(conf.targetAr);
|
||||
}
|
||||
else{
|
||||
@ -136,6 +135,8 @@ var _kbd_fetch = async function(){
|
||||
return _kbd_keybinds;
|
||||
}
|
||||
|
||||
|
||||
|
||||
var _kbd_getKeybinds = function(){
|
||||
return _kbd_keybinds;
|
||||
}
|
||||
@ -144,5 +145,6 @@ var Keybinds = {
|
||||
init: _kbd_setup,
|
||||
fetch: _kbd_fetch,
|
||||
mods: _kbd_ModKeys,
|
||||
getKeybinds: _kbd_getKeybinds
|
||||
getKeybinds: _kbd_getKeybinds,
|
||||
keybinds: _kbd_keybinds
|
||||
}
|
||||
|
@ -6,8 +6,8 @@ if(Debug.debug)
|
||||
|
||||
var _se_init = async function(neverFlushStored){
|
||||
|
||||
if(Debug.flushStoredSettings && neverFlushStored === false)
|
||||
StorageManager.delopt("uw-settings");
|
||||
// if(Debug.flushStoredSettings && neverFlushStored === false)
|
||||
// StorageManager.delopt("uw-settings");
|
||||
|
||||
if(Debug.debug)
|
||||
console.log("[Settings::_se_init()] -------- starting init! ---------");
|
||||
@ -15,10 +15,10 @@ var _se_init = async function(neverFlushStored){
|
||||
|
||||
var newSettings = await StorageManager.getopt_async("uw-settings");
|
||||
if (Debug.debug)
|
||||
console.log("[Settings::_se_init()] settings saved in localstorage are ", (newSettings === {} ? ("nonexistent (", newSettings, ")") : newSettings ));
|
||||
console.log("[Settings::_se_init()] settings saved in localstorage are:", newSettings, " - if that's empty, it's gonna be replaced by this:", JSON.stringify(this), ")");
|
||||
|
||||
if (newSettings === {}){
|
||||
StorageManager.setopt({"uw-settings": this});
|
||||
if ((Object.keys(newSettings).length === 0 && newSettings.constructor === Object)){
|
||||
StorageManager.setopt({"uw-settings": JSON.stringify(this)});
|
||||
}
|
||||
else{
|
||||
for (var k in newSettings)
|
||||
@ -30,9 +30,18 @@ var _se_init = async function(neverFlushStored){
|
||||
|
||||
}
|
||||
|
||||
var _se_save = function(){
|
||||
var _se_save = function(settings){
|
||||
StorageManager.delopt("uw-settings");
|
||||
StorageManager.setopt({"uw-settings": this});
|
||||
|
||||
if(settings !== undefined){
|
||||
StorageManager.setopt({"uw-settings": JSON.stringify(settings)});
|
||||
}
|
||||
else{
|
||||
StorageManager.setopt({"uw-settings": JSON.stringify(this)});
|
||||
}
|
||||
|
||||
if (Debug.debug)
|
||||
console.log("[Settings::_se_save()] saving settings:", JSON.stringify(settings));
|
||||
}
|
||||
|
||||
var _se_reload = function(){
|
||||
@ -64,6 +73,8 @@ var Settings = {
|
||||
colors:{
|
||||
// criticalFail: "background: #fa2; color: #000"
|
||||
},
|
||||
whitelist: [],
|
||||
blacklist: ["vimeo.com"],
|
||||
init: _se_init,
|
||||
save: _se_save,
|
||||
reload: _se_reload,
|
||||
|
@ -73,10 +73,12 @@ var _sc_init = function() {
|
||||
* <location.hostname>: {
|
||||
* enabled: string, // whitelist, blacklist, global
|
||||
* type: string,
|
||||
* autoAr: { // konfiguracija za samodejno zaznavanje razmerja stranic | conf for aspect ratio autodetection
|
||||
* autoAr: { // konfiguracija za samodejno zaznavanje razmerja stranic | conf for aspect ratio autodetection
|
||||
* active: bool // aktivno zaznavanje — zaznavamo letterbox na sliki | active detection: scan the image
|
||||
* passive: bool // pasivno zaznavanje — za ar vprašamo imdb in ostale | passive detection: query imdb for aspect ratio
|
||||
* nonfs: bool // zaznavanje razmerja stranic izven celozaslonskega načina | detect ar if not in fullscreen?
|
||||
* passive: bool // pasivno zaznavanje — za ar vprašamo imdb in ostale | passive detection: query imdb
|
||||
* // for aspect ratio [DEPRECATED]
|
||||
* nonfs: bool // zaznavanje razmerja stranic izven celozaslonskega načina | detect ar if not in
|
||||
* // fullscreen? [DEPRECATED]
|
||||
* playerIdentificationString: string
|
||||
* playerIdentificationType: string // "className" | "id"
|
||||
* nonfsExtra: function // non-fs hacks are generally site-specific, which means we need to write site-specific code
|
||||
|
@ -108,52 +108,68 @@ var _com_sendToEachFrame = async function(message, tabId) {
|
||||
if(Debug.debug)
|
||||
console.log("[Comms::_com_sendToEveryFrame] sending message to every frames of currenntly active tab");
|
||||
|
||||
// try{
|
||||
if(tabId === undefined){
|
||||
var tabs = await browser.tabs.query({currentWindow: true, active: true});
|
||||
tabId = tabs[0].id;
|
||||
}
|
||||
var frames = await browser.webNavigation.getAllFrames({tabId: tabId});
|
||||
if(tabId === undefined){
|
||||
var tabs = await browser.tabs.query({currentWindow: true, active: true});
|
||||
tabId = tabs[0].id;
|
||||
}
|
||||
var frames = await browser.webNavigation.getAllFrames({tabId: tabId});
|
||||
|
||||
if(Debug.debug)
|
||||
console.log("[Comms::_com_sendToEveryFrame] we have this many frames:", frames.length, "||| tabId:", tabId ,"frames:",frames);
|
||||
if(Debug.debug)
|
||||
console.log("[Comms::_com_sendToEveryFrame] we have this many frames:", frames.length, "||| tabId:", tabId ,"frames:",frames);
|
||||
|
||||
|
||||
// pošlji sporočilce vsakemu okvirju, potisni obljubo v tabelo
|
||||
// send message to every frame, push promise to array
|
||||
var promises = [];
|
||||
for(var frame of frames){
|
||||
// pošlji sporočilce vsakemu okvirju, potisni obljubo v tabelo
|
||||
// send message to every frame, push promise to array
|
||||
var promises = [];
|
||||
for(var frame of frames){
|
||||
if(Debug.debug)
|
||||
console.log("[Comms:_com_sendToEachFrame] we sending message to tab with id", tabId, ", frame with id", frame.frameId);
|
||||
try{
|
||||
promises.push(browser.tabs.sendMessage(tabId, message, {frameId: frame.frameId}));
|
||||
}
|
||||
catch(e){
|
||||
if(Debug.debug)
|
||||
console.log("[Comms:_com_sendToEachFrame] we sending message to tab with id", tabId, ", frame with id", frame.frameId);
|
||||
try{
|
||||
promises.push(browser.tabs.sendMessage(tabId, message, {frameId: frame.frameId}));
|
||||
}
|
||||
catch(e){
|
||||
if(Debug.debug)
|
||||
console.log("[Comms:_com_sendToEachFrame] we sending message to tab with id", tabId, ", frame with id", frame.frameId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// počakajmo, da so obljube izpolnjene.
|
||||
// wait for all promises to be kept
|
||||
// počakajmo, da so obljube izpolnjene.
|
||||
// wait for all promises to be kept
|
||||
|
||||
var responses = [];
|
||||
var responses = [];
|
||||
|
||||
for(var promise of promises){
|
||||
var response = await promise;
|
||||
if(response !== undefined)
|
||||
responses.push(response);
|
||||
}
|
||||
for(var promise of promises){
|
||||
var response = await promise;
|
||||
if(response !== undefined)
|
||||
responses.push(response);
|
||||
}
|
||||
|
||||
if(Debug.debug)
|
||||
console.log("[Comms::_com_sendToEveryFrame] we received responses from all frames", responses);
|
||||
if(Debug.debug)
|
||||
console.log("[Comms::_com_sendToEveryFrame] we received responses from all frames", responses);
|
||||
|
||||
return responses;
|
||||
// }
|
||||
// catch(e){
|
||||
// console.log("[Comms::_com_sendToEveryFrame] something went wrong when getting frames. this is error:", e);
|
||||
// return Promise.reject();
|
||||
// }
|
||||
return responses;
|
||||
}
|
||||
|
||||
var _com_sendToMainFrame = async function(message, tabId){
|
||||
if(Debug.debug)
|
||||
console.log("[Comms::_com_sendToMainFrame] sending message to every frames of currenntly active tab");
|
||||
|
||||
if(tabId === undefined){
|
||||
var tabs = await browser.tabs.query({currentWindow: true, active: true});
|
||||
tabId = tabs[0].id;
|
||||
}
|
||||
|
||||
// pošlji sporočilce glavnemu okvirju. Glavni okvir ima id=0
|
||||
// send message to the main frame. Main frame has id=0
|
||||
try{
|
||||
var response = await browser.tabs.sendMessage(tabId, message, {frameId: 0});
|
||||
console.log("[Comms::_com_sendToMainFrame] response is this:",response);
|
||||
|
||||
}
|
||||
catch(e){
|
||||
console.log("[Comms:_com_sendToEachFrame] failed sending message to tab with id", tabId, ", frame with id", 0, "\nerror:",e);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
var Comms = {
|
||||
@ -164,4 +180,5 @@ var Comms = {
|
||||
sendMessageRuntime: _com_sendMessageRuntime,
|
||||
sendToEach: _com_sendToEachFrame,
|
||||
sendToAll: _com_sendToAllFrames,
|
||||
sendToMain: _com_sendToMainFrame,
|
||||
}
|
||||
|
@ -88,6 +88,7 @@ var _res_legacyAr = function(action){
|
||||
var fileAr = vid.videoWidth / vid.videoHeight;
|
||||
GlobalVars.lastAr = {type: "legacy", action: action};
|
||||
|
||||
|
||||
if(action == "fitw"){
|
||||
_res_setAr( ar > fileAr ? ar : fileAr);
|
||||
return;
|
||||
@ -101,7 +102,7 @@ var _res_legacyAr = function(action){
|
||||
_res_setAr(fileAr);
|
||||
return;
|
||||
}
|
||||
if(action == "autoar"){
|
||||
if(action == "autoar" || action == "auto"){
|
||||
GlobalVars.lastAr = {type: "auto"};
|
||||
ArDetect.init();
|
||||
}
|
||||
|
37
js/uw-bg.js
37
js/uw-bg.js
@ -10,6 +10,8 @@ async function main(){
|
||||
|
||||
await Settings.init();
|
||||
await Keybinds.init();
|
||||
Keybinds.keybinds = await Keybinds.fetch();
|
||||
|
||||
|
||||
// Poslušalci za dogodke | event listeners here
|
||||
// {===]///[-------------------------------------]\\\[===}
|
||||
@ -95,9 +97,9 @@ function _uwbg_rcvmsg(message, sender, sendResponse){
|
||||
config.arConf.enabled_global = Settings.arDetect.enabled == "global";
|
||||
|
||||
if(Debug.debug)
|
||||
console.log("[uw-bg::_uwbg_rcvmsg] Keybinds.fetch returned this:", keybinds);
|
||||
console.log("[uw-bg::_uwbg_rcvmsg] Keybinds.getKeybinds() returned this:", Keybinds.getKeybinds());
|
||||
|
||||
config.keyboardShortcuts = BgVars.keyboardShortcuts;
|
||||
config.keyboardShortcuts = Keybinds.getKeybinds();
|
||||
|
||||
|
||||
// predvidevajmo, da je enako. Če je drugače, bomo popravili ko dobimo odgovor
|
||||
@ -123,37 +125,6 @@ function _uwbg_rcvmsg(message, sender, sendResponse){
|
||||
|
||||
_uwbg_registerVideo(sender.tab.id);
|
||||
}
|
||||
// else if(message.cmd == "force-ar"){
|
||||
// sendMessage(message); // args: {cmd: string, newAr: number/"auto"}
|
||||
// }
|
||||
// else if(message.cmd == "stop-autoar"){
|
||||
// sendMessage(message);
|
||||
// }
|
||||
// else if(message.cmd == "force-video-float"){
|
||||
// if(message.global){
|
||||
// Settings.miscFullscreenSettings.videoFloat = message.newFloat;
|
||||
// sendMessage(message);
|
||||
// }
|
||||
// else{
|
||||
// sendMessage(message);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// else if(message.cmd == "disable-autoar"){
|
||||
// Settings.arDetect.enabled = "no";
|
||||
// Settings.save();
|
||||
// sendMessage("reload-settings");
|
||||
// }
|
||||
// else if(message.cmd == "disable-autoar-whitelist-only"){
|
||||
// Settings.arDetect.enabled = "whitelist";
|
||||
// Settings.save();
|
||||
// sendMessage("reload-settings");
|
||||
// }
|
||||
// else if(message.cmd == "enable-autoar"){
|
||||
// Settings.arDetect.enabled = "global";
|
||||
// Settings.save();
|
||||
// sendMessage("reload-settings");
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
104
js/uw.js
104
js/uw.js
@ -132,54 +132,13 @@ function ghettoOnChange(){
|
||||
}
|
||||
|
||||
|
||||
var _main_fscheck_tries = 3;
|
||||
|
||||
// function fullScreenCheck(count) {
|
||||
// if(count >= _main_fscheck_tries){
|
||||
// if(Debug.debug){
|
||||
// console.log("[uw::fullScreenCheck] ok really, I guess.");
|
||||
// }
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// var fsnow = FullScreenDetect.isFullScreen();
|
||||
//
|
||||
// // we restore, always — esp. now that we also do things in non-fullscreen
|
||||
//
|
||||
// // if(fsnow){
|
||||
// // full screen is on
|
||||
// // Resizer.restore();
|
||||
// // }
|
||||
// // else{
|
||||
// // Resizer.reset();
|
||||
// // }
|
||||
//
|
||||
// // kaj pa, če je FullScreenDetect vrnil narobno vrednost?
|
||||
// // what if FullScreenDetect was not right? Let's verify; if it was wrong we re-trigger it in about 100 ms.
|
||||
//
|
||||
// if(fsnow != _main_last_fullscreen){
|
||||
//
|
||||
// // posodobimo vrednost / update value
|
||||
// _main_last_fullscreen = fsnow;
|
||||
//
|
||||
// // če je to res, count pa je večji kot 0, potem smo imeli prav.
|
||||
// // if that's the case and count is greater than 0, then we were right at some point.
|
||||
// if(Debug.debug && count > 0){
|
||||
// console.log("[uw::fullScreenCheck] fucking knew it")
|
||||
// }
|
||||
// return;
|
||||
// }
|
||||
// else{
|
||||
// // dobili smo event za spremembo celozaslonskega stanja. Stanje se ni spremenilo. Hmmm.
|
||||
// // we got an event for fullscreen state change. State is unchanged. Hmmm.
|
||||
// if(Debug.debug){
|
||||
// console.log("[uw::fullScreenCheck] oh _really_? 🤔🤔🤔 -- fullscreen state", FullScreenDetect.isFullScreen());
|
||||
// }
|
||||
// count++;
|
||||
// setTimeout(fullScreenCheck, 200, count);
|
||||
// }
|
||||
// console.log("-------------------------------");
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// comms
|
||||
function receiveMessage(message, sender, sendResponse) {
|
||||
@ -234,14 +193,12 @@ function receiveMessage(message, sender, sendResponse) {
|
||||
if(Debug.debug)
|
||||
console.log("[uw::receiveMessage] we're being commanded to change aspect ratio to", message.newAr);
|
||||
|
||||
if(message.newAr == "auto"){
|
||||
ArDetect.stop(); // just in case
|
||||
ArDetect.arSetup();
|
||||
if(message.arType == "legacy"){
|
||||
ArDetect.stop();
|
||||
Resizer.legacyAr(message.newAr);
|
||||
}
|
||||
else{
|
||||
ArDetect.stop();
|
||||
|
||||
// we aren't in full screen, but we will want aspect ratio to be fixed when we go to
|
||||
Resizer.setAr(message.newAr);
|
||||
}
|
||||
}
|
||||
@ -258,6 +215,49 @@ function receiveMessage(message, sender, sendResponse) {
|
||||
else if(message.cmd == "reload-settings"){
|
||||
Settings.reload();
|
||||
}
|
||||
else if(message.cmd == "uw-enabled-for-site"){
|
||||
var site = window.location.hostname;
|
||||
var wlindex = Settings.whitelist.indexOf(site);
|
||||
var blindex = Settings.blacklist.indexOf(site);
|
||||
|
||||
var mode = "default";
|
||||
if(wlindex > -1)
|
||||
mode = "whitelist";
|
||||
if(blindex > -1)
|
||||
mode = "blacklist";
|
||||
|
||||
if(Debug.debug){
|
||||
console.log("[uw::receiveMessage] is this site whitelisted or blacklisted? whitelist:", (wlindex > -1), "; blacklist:", (blindex > -1), "; mode (return value):", mode, "\nwhitelist:",Settings.whitelist,"\nblacklist:",Settings.blacklist);
|
||||
|
||||
}
|
||||
|
||||
if(BrowserDetect.usebrowser == "firefox")
|
||||
return Promise.resolve({response: mode});
|
||||
|
||||
try{
|
||||
sendResponse({response: mode});
|
||||
}
|
||||
catch(chromeIsShitError){};
|
||||
|
||||
return true;
|
||||
}
|
||||
else if(message.cmd == "enable-for-site"){
|
||||
var site = window.location.hostname;
|
||||
var wlindex = Settings.whitelist.indexOf(site);
|
||||
var blindex = Settings.blacklist.indexOf(site);
|
||||
|
||||
if(wlindex > -1)
|
||||
Settings.whitelist.splice(site, 1);
|
||||
if(blindex > -1)
|
||||
Settings.blacklist.splice(site, 1);
|
||||
|
||||
if(message.option == "whitelist")
|
||||
Settings.whitelist.push(site);
|
||||
if(message.option == "blacklist")
|
||||
Settings.blacklist.push(site);
|
||||
|
||||
Settings.save(Settings);
|
||||
}
|
||||
|
||||
if(message.cmd == "testing"){
|
||||
if(Browserdetect.usebrowser = "firefox")
|
||||
|
@ -6,12 +6,14 @@ document.getElementById("uw-version").textContent = browser.runtime.getManifest(
|
||||
var Menu = {};
|
||||
Menu.noVideo = document.getElementById("no-videos-display");
|
||||
Menu.general = document.getElementById("extension-mode");
|
||||
Menu.thisSite = document.getElementById("settings-for-current-site");
|
||||
Menu.arSettings = document.getElementById("aspect-ratio-settings");
|
||||
Menu.cssHacks = document.getElementById("css-hacks-settings");
|
||||
Menu.about = document.getElementById("panel-about");
|
||||
|
||||
var MenuTab = {};
|
||||
MenuTab.general = document.getElementById("_menu_general");
|
||||
MenuTab.thisSite = document.getElementById("_menu_this_site");
|
||||
MenuTab.arSettings = document.getElementById("_menu_aspectratio");
|
||||
MenuTab.cssHacks = document.getElementById("_menu_hacks");
|
||||
MenuTab.about = document.getElementById("_menu_about");
|
||||
@ -86,7 +88,7 @@ function check4videos(){
|
||||
|
||||
function check4conf(){
|
||||
|
||||
sendToBackgroundScript({cmd: "get-config"})
|
||||
Comms.sendToBackgroundScript({cmd: "get-config"})
|
||||
.then(response => {
|
||||
if(Debug.debug)
|
||||
console.log("[popup.js::check4conf] received response:",response, response.response);
|
||||
@ -101,6 +103,22 @@ function check4conf(){
|
||||
});
|
||||
}
|
||||
|
||||
function check4siteStatus(){
|
||||
Comms.sendToMain({cmd: "uw-enabled-for-site"})
|
||||
.then(response => {
|
||||
if(Debug.debug)
|
||||
console.log("[popup::check4siteStatus] received response:", response);
|
||||
|
||||
document.extensionEnabledOnCurrentSite.mode.value = response.response;
|
||||
})
|
||||
.catch(error => {
|
||||
if(Debug.debug)
|
||||
console.log("%c[popup.js::check4siteStatus] sending message failed with error", "color: #f00", error, "%c retrying in 1s ...", "color: #f00");
|
||||
|
||||
// setTimeout(check4siteStatus, 1000);
|
||||
});
|
||||
}
|
||||
|
||||
function stringToKeyCombo(key_in){
|
||||
var keys_in = key_in.split("_");
|
||||
var keys_out = "";
|
||||
@ -232,30 +250,37 @@ function showArctlButtons(){
|
||||
if(! _config)
|
||||
return;
|
||||
|
||||
if(_config.arConf){
|
||||
if(! _config.arConf.enabled_global){
|
||||
ArPanel.autoar.disable.classList.add("hidden");
|
||||
ArPanel.autoar.enable.classList.remove("hidden");
|
||||
// if(_config.arConf){
|
||||
// if(! _config.arConf.enabled_global){
|
||||
// ArPanel.autoar.disable.classList.add("hidden");
|
||||
// ArPanel.autoar.enable.classList.remove("hidden");
|
||||
//
|
||||
// ArPanel.autoar.enable_tmp.textContent = "Temporarily enable";
|
||||
// ArPanel.autoar.disable_tmp.textContent = "Temporarily disable";
|
||||
// }
|
||||
// else{
|
||||
// ArPanel.autoar.disable.classList.remove("hidden");
|
||||
// ArPanel.autoar.enable.classList.add("hidden");
|
||||
//
|
||||
// ArPanel.autoar.enable_tmp.textContent = "Re-enable";
|
||||
// ArPanel.autoar.disable_tmp.textContent = "Temporarily disable";
|
||||
// }
|
||||
// if(! _config.arConf.enabled_current){
|
||||
// ArPanel.autoar.disable_tmp.classList.add("hidden");
|
||||
// ArPanel.autoar.enable_tmp.classList.remove("hidden");
|
||||
// }
|
||||
// else{
|
||||
// ArPanel.autoar.disable_tmp.classList.remove("hidden");
|
||||
// ArPanel.autoar.enable_tmp.classList.add("hidden");
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
ArPanel.autoar.enable_tmp.textContent = "Temporarily enable";
|
||||
ArPanel.autoar.disable_tmp.textContent = "Temporarily disable";
|
||||
}
|
||||
else{
|
||||
ArPanel.autoar.disable.classList.remove("hidden");
|
||||
ArPanel.autoar.enable.classList.add("hidden");
|
||||
function toggleSite(option){
|
||||
if(Debug.debug)
|
||||
console.log("[popup::toggleSite] toggling extension 'should I work' status to", option, "on current site");
|
||||
|
||||
ArPanel.autoar.enable_tmp.textContent = "Re-enable";
|
||||
ArPanel.autoar.disable_tmp.textContent = "Temporarily disable";
|
||||
}
|
||||
if(! _config.arConf.enabled_current){
|
||||
ArPanel.autoar.disable_tmp.classList.add("hidden");
|
||||
ArPanel.autoar.enable_tmp.classList.remove("hidden");
|
||||
}
|
||||
else{
|
||||
ArPanel.autoar.disable_tmp.classList.remove("hidden");
|
||||
ArPanel.autoar.enable_tmp.classList.add("hidden");
|
||||
}
|
||||
}
|
||||
Comms.sendToMain({cmd:"enable-for-site", option:option});
|
||||
}
|
||||
|
||||
document.addEventListener("click", (e) => {
|
||||
@ -274,6 +299,9 @@ document.addEventListener("click", (e) => {
|
||||
if(e.target.classList.contains("_menu_general")){
|
||||
openMenu("general");
|
||||
}
|
||||
if(e.target.classList.contains("_menu_this_site")){
|
||||
openMenu("thisSite");
|
||||
}
|
||||
else if(e.target.classList.contains("_menu_aspectratio")){
|
||||
openMenu("arSettings");
|
||||
}
|
||||
@ -292,31 +320,49 @@ document.addEventListener("click", (e) => {
|
||||
if(e.target.classList.contains("_ar_auto")){
|
||||
command.cmd = "force-ar";
|
||||
command.newAr = "auto";
|
||||
command.arType = "legacy";
|
||||
return command;
|
||||
}
|
||||
if(e.target.classList.contains("_ar_reset")){
|
||||
command.cmd = "force-ar";
|
||||
command.newAr = "reset";
|
||||
command.arType = "legacy";
|
||||
return command;
|
||||
}
|
||||
if(e.target.classList.contains("_ar_fitw")){
|
||||
command.cmd = "force-ar";
|
||||
command.newAr = "fitw";
|
||||
command.arType = "legacy";
|
||||
return command;
|
||||
}
|
||||
if(e.target.classList.contains("_ar_fitw")){
|
||||
command.cmd = "force-ar";
|
||||
command.newAr = "fith";
|
||||
command.arType = "legacy";
|
||||
return command;
|
||||
}
|
||||
if(e.target.classList.contains("_ar_219")){
|
||||
command.cmd = "force-ar";
|
||||
command.newAr = 2.39;
|
||||
command.arType = "static";
|
||||
return command;
|
||||
}
|
||||
if(e.target.classList.contains("_ar_189")){
|
||||
command.cmd = "force-ar";
|
||||
command.newAr = 2.0;
|
||||
command.arType = "static";
|
||||
return command;
|
||||
}
|
||||
if(e.target.classList.contains("_ar_169")){
|
||||
command.cmd = "force-ar";
|
||||
command.newAr = 1.78;
|
||||
command.arType = "static";
|
||||
return command;
|
||||
}
|
||||
if(e.target.classList.contains("_ar_1610")){
|
||||
command.cmd = "force-ar";
|
||||
command.newAr = 1.6;
|
||||
command.arType = "static";
|
||||
return command;
|
||||
}
|
||||
}
|
||||
@ -362,6 +408,11 @@ document.addEventListener("click", (e) => {
|
||||
return command;
|
||||
}
|
||||
}
|
||||
|
||||
if(e.target.classList.contains("extensionEnabledOnCurrentSite")){
|
||||
toggleSite(document.extensionEnabledOnCurrentSite.mode.value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var command = getcmd(e);
|
||||
@ -374,3 +425,4 @@ document.addEventListener("click", (e) => {
|
||||
|
||||
check4videos();
|
||||
check4conf();
|
||||
check4siteStatus();
|
||||
|
@ -139,8 +139,8 @@
|
||||
U<span class="smallcaps">ltrawidify</span>: <small>Quick settings</small>
|
||||
</div>
|
||||
<div class="left-side">
|
||||
<div id="_menu_general" class="menu-item disabled _menu_general">
|
||||
General settings
|
||||
<div id="_menu_this_site" class="menu-item _menu_this_site">
|
||||
Settings for this site
|
||||
</div>
|
||||
<div id="_menu_aspectratio" class="menu-item selected _menu_aspectratio">
|
||||
Aspect ratio and alignment
|
||||
@ -178,6 +178,17 @@
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div id="settings-for-current-site" class="suboption hidden">
|
||||
<p>Allow this extension to run on this site?</p>
|
||||
<form action="" name="extensionEnabledOnCurrentSite">
|
||||
<input type="radio" class="extensionEnabledOnCurrentSite" name="mode" value="default" > Follow global rules<br/>
|
||||
<input type="radio" class="extensionEnabledOnCurrentSite" name="mode" value="whitelist" > Always (whitelist)<br/>
|
||||
<input type="radio" class="extensionEnabledOnCurrentSite" name="mode" value="blacklist" > Never (blacklist)<br/>
|
||||
</form>
|
||||
<small>NOTE: this settings <b>don't</b> apply to videos embedded from other sites.</small>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="aspect-ratio-settings" class="suboption hidden">
|
||||
<div class="row">
|
||||
<span class="label">Force aspect ratio:</span>
|
||||
@ -189,7 +200,7 @@
|
||||
<a class="button _changeAr _ar_169 w24">16:9<br/><span id="_b_changeAr_169_key" class="smallcaps small darker"></span></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<!--<div class="row">
|
||||
<span class="label">Automatic aspect ratio autodetection:</span>
|
||||
<div class="button-row">
|
||||
<a id="_autoar_disable_tmp" class="button _autoar _autoar_temp-disable">Temporarily disable</a>
|
||||
@ -197,7 +208,7 @@
|
||||
<a id="_autoar_disable" class="button _autoar _autoar_disable">Disable</a>
|
||||
<a id="_autoar_enable" class="button _autoar _autoar_enable hidden">Enable</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>-->
|
||||
<div class="row">
|
||||
<span class="label">Video alignment:</span>
|
||||
<div class="button-row">
|
||||
|
Loading…
Reference in New Issue
Block a user