Merge branch 'master' of github.com:xternal7/ultrawidify

This commit is contained in:
Tamius Han 2018-09-27 22:30:30 +02:00
commit 128e311bb5
8 changed files with 44 additions and 11 deletions

View File

@ -1,10 +1,10 @@
// Set prod to true when releasing
_prod = true;
// _prod = false;
//_prod = true;
_prod = false;
Debug = {
init: true,
debug: false,
debug: true,
keyboard: true,
debugResizer: true,
debugArDetect: true,

View File

@ -24,7 +24,9 @@ class CommsClient {
destroy() {
this.pageInfo = null;
this.settings = null;
this.port.onMessage.removeListener(this._listener);
if (!BrowserDetect.edge) { // edge is a very special browser made by outright morons.
this.port.onMessage.removeListener(this._listener);
}
}
setPageInfo(pageInfo){
@ -37,7 +39,9 @@ class CommsClient {
var ths = this;
this._listener = m => ths.processReceivedMessage(m);
this.port.onMessage.removeListener(this._listener);
if (!BrowserDetect.edge) {
this.port.onMessage.removeListener(this._listener);
}
this.port.onMessage.addListener(this._listener);
}

View File

@ -103,8 +103,8 @@ class Settings {
}
async get() {
if (BrowserDetect.firefox || BrowserDetect.edge) {
const ret = this.useSync ? await browser.storage.sync.get('uwSettings') : await browser.storage.local.get('uwSettings');
if (BrowserDetect.firefox) {
const ret = await browser.storage.local.get('uwSettings');
try {
return JSON.parse(ret.uwSettings);
} catch(e) {
@ -115,6 +115,11 @@ class Settings {
chrome.storage.sync.get('uwSettings', (res) => resolve(res));
});
return ret['uwSettings'];
} else if (BrowserDetect.edge) {
const ret = new Promise( (resolve, reject) => {
browser.storage.sync.get('uwSettings', (res) => resolve(res));
});
return ret['uwSettings'];
}
}

View File

@ -106,8 +106,6 @@ class PageInfo {
}
this.removeDestroyed();
// console.log("Rescan complete. Total videos?", this.videos.length)
}catch(e){
console.log("rescan error:",e)
}

View File

@ -12,6 +12,9 @@ if(Debug.debug){
}
}
if (BrowserDetect.edge) {
HTMLCollection.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator];
}
class UW {
constructor(){

Binary file not shown.

View File

@ -146,6 +146,22 @@ strike {
background-color: #222 !important;
}
/* BROWSER-SPECIFIC DISABLE */
.disabled-edge {
pointer-events: none !important;
filter: contrast(50%) brightness(40%) grayscale(100%) !important;
content: "NOT SUPPORTED IN THIS BROWSER";
}
.disabled-edge::after {
background-color: #333272;
color: #d8d9e6;
display: inline-block;
font-size: .75em;
font-variant: small-caps;
padding-left: 5px;
padding-right: 5px;
margin-left: 10px;
}
/* BUTTONS AND INPUTS */

View File

@ -494,7 +494,9 @@ function validateAutoArTimeout(){
}
document.addEventListener("click", (e) => {
if(Debug.debug) {
console.log("[popup.js] something clicked. event:", e, JSON.stringify(e));
}
function getcmd(e){
var command = {};
@ -791,7 +793,12 @@ document.addEventListener("click", (e) => {
//#endregion
}
var command = getcmd(e);
var command = getcmd(e);
if(Debug.debug) {
console.log("[popup.js] Got command (can be undefined):", command, JSON.stringify(command))
}
if(command)
port.postMessage(command);