diff --git a/js/lib/BrowserDetect.js b/js/lib/BrowserDetect.js index a016f7c..bd39c58 100644 --- a/js/lib/BrowserDetect.js +++ b/js/lib/BrowserDetect.js @@ -1,12 +1,30 @@ var _bd_usebrowser = "firefox"; -if(typeof browser === "undefined"){ // This means we're probably not on Firefox. +var _bd_isFirefox = false; +var _bd_isChrome = false; +var _bd_isEdge = true; // we'll see if FF + +try{ + // this will fail in Edge + + var promise = browser.runtime.getBrowserInfo(); + _bd_isFirefox = true; + _bd_isEdge = false; +} +catch (e) {}; + +if(typeof browser === "undefined"){ // This is a good sign we're in chrome or chromium-based browsers if(chrome){ browser = chrome; - _bd_usebrowser = "chrome"; + _bd_usebrowser = "chrome; + _bd_isChrome = true; + _bd_isEdge = false; } } var BrowserDetect = { - usebrowser: _bd_usebrowser + usebrowser: _bd_usebrowser, + firefox: _bd_isFirefox, + chrome: _bd_isChrome, + edge: _bd_isEdge } diff --git a/js/lib/Comms.js b/js/lib/Comms.js index 21e12cb..00e98ef 100644 --- a/js/lib/Comms.js +++ b/js/lib/Comms.js @@ -11,7 +11,7 @@ var _com_chrome_tabquery_wrapper = async function(tabInfo){ var _com_queryTabs = async function(tabInfo){ - if(BrowserDetect.usebrowser == "chrome"){ + if(BrowserDetect.usebrowser != "firefox"){ return await _com_chrome_tabquery_wrapper(tabInfo); } else{ @@ -39,7 +39,7 @@ var _com_chrome_tabs_sendmsg_wrapper = async function(tab, message, options){ } var _com_sendMessage = async function(tab, message, options){ - if(BrowserDetect.usebrowser == "chrome"){ + if(BrowserDetect.usebrowser != "firefox"){ var r = await _com_chrome_tabs_sendmsg_wrapper(tab, message, options); console.log("TESTING what is this owo? (should be a promise)", r); return r; @@ -67,7 +67,7 @@ var _com_chrome_tabs_sendmsgrt_wrapper = async function(message){ } var _com_sendMessageRuntime = async function(message){ - if(BrowserDetect.usebrowser == "chrome"){ + if(BrowserDetect.usebrowser != "firefox"){ return _com_chrome_tabs_sendmsgrt_wrapper(message); } else{ diff --git a/manifest-chrome.json b/manifest-chrome.json new file mode 100644 index 0000000..0d35db9 --- /dev/null +++ b/manifest-chrome.json @@ -0,0 +1,73 @@ +{ + "manifest_version": 2, + "name": "Ultrawidify", + "version": "2.0.2", + + "icons": { + "32":"res/icons/uw-32.png", + "64":"res/icons/uw-64.png" + }, + + "description": "Aspect ratio fixer for youtube that works around some people's disability to properly encode 21:9 (and sometimes, 16:9) videos.", + + "content_scripts": [{ + "matches": ["*://*/*"], + "js": [ + "js/dep/jquery-3.1.1.js", + "js/dep/chrome/chrome-extension-async.js", + + "js/lib/BrowserDetect.js", + "js/lib/StorageManager.js", + "js/lib/Comms.js", + + "js/conf/Debug.js", + "js/conf/Settings.js", + "js/conf/SitesConf.js", + "js/conf/Status.js", + "js/conf/ExtensionConf.js", + + "js/lib/FullScreenDetect.js", + + "js/modules/PageInfo.js", + "js/modules/ArDetect.js", + "js/modules/Resizer.js", + + "js/conf/Keybinds.js", + + "js/uw.js" ], + "all_frames": true + }], + + "permissions": [ + "tabs", "storage", "activeTab", "", "*://*.youtube.com/*", "*://youtube.com/*", "*://imdb.com/*", "*://*.imdb.com/*" + ], + + "browser_action": { + "default_icon": "res/icons/uw-32.png", + "default_popup": "res/popup/popup.html", + "default_title": "Ultrawidify" + }, + + "web_accessible_resources": [ + "js/*", + + "res/img/ytplayer-icons/zoom.png", + "res/img/ytplayer-icons/unzoom.png", + "res/img/ytplayer-icons/fitw.png", + "res/img/ytplayer-icons/fith.png", + "res/img/ytplayer-icons/reset.png", + "res/img/ytplayer-icons/settings.png", + + "res/img/settings/about-bg.png", + + "res/css/uw_common.css", + "res/css/uw_yt.css", + "res/css/uw_netflix.css", + "res/css/uw_settings.css" + ], + + "options_ui" : { + "page": "res/settings/settings.html", + "open_in_tab": true + } +} diff --git a/res/icons/uw-128.png b/res/icons/uw-128.png new file mode 100644 index 0000000..e6bbe7c Binary files /dev/null and b/res/icons/uw-128.png differ diff --git a/res/icons/uw-webstore-icon.png b/res/icons/uw-webstore-icon.png new file mode 100644 index 0000000..b9eefe4 Binary files /dev/null and b/res/icons/uw-webstore-icon.png differ diff --git a/test/TEST_VIDEOS.md b/test/TEST_VIDEOS.md index d1130ba..caa9292 100644 --- a/test/TEST_VIDEOS.md +++ b/test/TEST_VIDEOS.md @@ -17,3 +17,7 @@ https://www.youtube.com/watch?v=L_u97PqWX6g (also dark at the start) ### Dark or triggering minor AR corrections https://www.youtube.com/watch?v=NaTGwlfRB_c (dark, triggers minor corrections) + +### Watermark stopping AR + +https://www.youtube.com/watch?v=tXTFdDrd7pA