Reshaped popup
This commit is contained in:
parent
e64f21d427
commit
66cc44ab6d
@ -1,56 +1,56 @@
|
||||
// Yeah hi /r/badcode.
|
||||
// Anyway, because nazi localstorage flat out refuses to store arrays:
|
||||
|
||||
var DEFAULT_KEYBINDINGS = {
|
||||
0:{ action: "fitw",
|
||||
var DEFAULT_KEYBINDINGS = [
|
||||
{ action: "fitw",
|
||||
key: 'w',
|
||||
modifiers: []
|
||||
},
|
||||
1:{
|
||||
{
|
||||
action: "fith",
|
||||
key: 'e',
|
||||
modifiers: []
|
||||
},
|
||||
2: {
|
||||
{
|
||||
action: "reset",
|
||||
key: 'r',
|
||||
modifiers: []
|
||||
},
|
||||
3: {
|
||||
{
|
||||
action: "zoom",
|
||||
key: "z",
|
||||
modifiers: []
|
||||
},
|
||||
4: {
|
||||
{
|
||||
action: "unzoom",
|
||||
key: "u",
|
||||
modifiers: []
|
||||
},
|
||||
5: {
|
||||
{
|
||||
action: "char",
|
||||
targetAR: (21/9),
|
||||
key: "d",
|
||||
modifiers: []
|
||||
},
|
||||
6: {
|
||||
{
|
||||
action: "char",
|
||||
targetAR: (16/9),
|
||||
key: "s",
|
||||
modifiers: []
|
||||
},
|
||||
7: {
|
||||
{
|
||||
action: "char",
|
||||
targetAR: (16/10),
|
||||
key: "x",
|
||||
modifiers: []
|
||||
},
|
||||
8: {
|
||||
{
|
||||
action: "char",
|
||||
targetAR: (4/3),
|
||||
key: "c",
|
||||
modifiers: []
|
||||
},
|
||||
9: {
|
||||
{
|
||||
action: "autoar",
|
||||
key: "a",
|
||||
modifiers: []
|
||||
@ -60,15 +60,22 @@ var DEFAULT_KEYBINDINGS = {
|
||||
|
||||
// functions
|
||||
|
||||
var _kbd_setup = function() {
|
||||
StorageManager.getopt("keybinds");
|
||||
var _kbd_callback = function(keys) {
|
||||
if (keys === null || keys === {} || keys === [] || keys == ""){
|
||||
StorageManager.setopt( {"keybinds": DEFAULT_KEYBINDINGS} );
|
||||
keys = DEFAULT_KEYBINDINGS;
|
||||
}
|
||||
|
||||
_kbd_setup_apply(keys);
|
||||
}
|
||||
|
||||
var _kbd_setup_init = function() {
|
||||
StorageManager.getopt("keybinds", _kbd_callback);
|
||||
}
|
||||
|
||||
|
||||
|
||||
var _kbd_setup_stage2 = function(){
|
||||
// todo: dont do that
|
||||
var KEYBINDS = DEFAULT_KEYBINDINGS;
|
||||
var _kbd_setup_apply = function(var keybinds){
|
||||
|
||||
if(Debug.debug || Debug.keyboard)
|
||||
console.log("uw::keydownSetup | starting keybord shortcut setup");
|
||||
@ -87,7 +94,7 @@ var _kbd_setup_stage2 = function(){
|
||||
}
|
||||
|
||||
if(Debug.debug || Debug.keyboard ){
|
||||
// console.log(KEYBINDS);
|
||||
// console.log(keybinds);
|
||||
console.log("we pressed a key: ", event.key , " | keydown: ", event.keydown);
|
||||
if(event.key == 'p'){
|
||||
console.log("uw/keydown: attempting to send message")
|
||||
@ -101,43 +108,43 @@ var _kbd_setup_stage2 = function(){
|
||||
}
|
||||
}
|
||||
|
||||
for(i in KEYBINDS){
|
||||
for(i in keybinds){
|
||||
if(Debug.debug || Debug.keyboard)
|
||||
console.log("i: ", i, "keybinds[i]:", KEYBINDS[i]);
|
||||
console.log("i: ", i, "keybinds[i]:", keybinds[i]);
|
||||
|
||||
if(event.key == KEYBINDS[i].key){
|
||||
if(event.key == keybinds[i].key){
|
||||
if(Debug.debug || Debug.keyboard)
|
||||
console.log("Key matches!");
|
||||
//Tipka se ujema. Preverimo še modifierje:
|
||||
//Key matches. Let's check if modifiers match, too:
|
||||
var mods = true;
|
||||
for(var j = 0; j < KEYBINDS[i].modifiers.length; j++){
|
||||
if(KEYBINDS[i].modifiers[j] == "ctrl")
|
||||
for(var j = 0; j < keybinds[i].modifiers.length; j++){
|
||||
if(keybinds[i].modifiers[j] == "ctrl")
|
||||
mods &= event.ctrlKey ;
|
||||
else if(KEYBINDS[i].modifiers[j] == "alt")
|
||||
else if(keybinds[i].modifiers[j] == "alt")
|
||||
mods &= event.altKey ;
|
||||
else if(KEYBINDS[i].modifiers[j] == "shift")
|
||||
else if(keybinds[i].modifiers[j] == "shift")
|
||||
mods &= event.shiftKey ;
|
||||
}
|
||||
if(Debug.debug || Debug.keyboard)
|
||||
console.log("we pressed a key: ", event.key , " | mods match?", mods, "keybinding: ", KEYBINDS[i]);
|
||||
console.log("we pressed a key: ", event.key , " | mods match?", mods, "keybinding: ", keybinds[i]);
|
||||
if(mods){
|
||||
event.stopPropagation();
|
||||
|
||||
console.log("uw::keydown | keys match. Taking action.");
|
||||
if(KEYBINDS[i].action == "char"){
|
||||
if(keybinds[i].action == "char"){
|
||||
Status.arStrat = "fixed";
|
||||
Status["lastAr"] = KEYBINDS[i].targetAR;
|
||||
Resizer.setAr(KEYBINDS[i].targetAR);
|
||||
Status["lastAr"] = keybinds[i].targetAR;
|
||||
Resizer.setAr(keybinds[i].targetAR);
|
||||
return;
|
||||
}
|
||||
if(KEYBINDS[i].action == "autoar"){
|
||||
if(keybinds[i].action == "autoar"){
|
||||
Status.arStrat = "auto";
|
||||
return;
|
||||
}
|
||||
// changeCSS("anything goes", KEYBINDS[i].action);
|
||||
Status.arStrat = KEYBINDS[i].action;
|
||||
Resizer.legacyAr(KEYBINDS[i].action);
|
||||
// changeCSS("anything goes", keybinds[i].action);
|
||||
Status.arStrat = keybinds[i].action;
|
||||
Resizer.legacyAr(keybinds[i].action);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -150,4 +157,10 @@ var _kbd_setup_stage2 = function(){
|
||||
// inFullScreen ? onFullscreenOn() : onFullscreenOff();
|
||||
// });
|
||||
}
|
||||
_kbd_setup_stage2();
|
||||
// _kbd_setup_stage2();
|
||||
// _kbd_setup_init();
|
||||
|
||||
var Keybinds = {
|
||||
init: _kbd_setup_init(),
|
||||
apply: _kbd_setup_apply()
|
||||
}
|
||||
|
@ -32,13 +32,35 @@ var _sc_getPlayerTag = function(){
|
||||
var _sc_prepareNonfsPlayer = function(){
|
||||
var hostname = window.location.hostname;
|
||||
|
||||
if( _sc_SITES[hostname] === undefined)
|
||||
if( SITES[hostname] === undefined)
|
||||
return;
|
||||
|
||||
if( _sc_SITES[hostname].autoAr.nonfsPlayerMod === undefined )
|
||||
if( SITES[hostname].autoAr.nonfsPlayerMod === undefined )
|
||||
return;
|
||||
|
||||
_sc_SITES[hostname].autoAr.nonfsPlayerMod();
|
||||
SITES[hostname].autoAr.nonfsPlayerMod();
|
||||
}
|
||||
|
||||
var _sc_getMode = function(site){
|
||||
if(! SITES[site] )
|
||||
return "global";
|
||||
|
||||
return SITES[site].enabled;
|
||||
}
|
||||
|
||||
|
||||
|
||||
var _sc_callback = function(conf) {
|
||||
if (conf === null || conf === {} || conf === [] || conf == ""){
|
||||
StorageManager.setopt( {"sitesconf": _sc_SITES} );
|
||||
SITES = _sc_SITES;
|
||||
}
|
||||
|
||||
SITES = conf;
|
||||
}
|
||||
|
||||
var _sc_init = function() {
|
||||
StorageManager.getopt("sitesconf", _kbd_callback);
|
||||
}
|
||||
|
||||
|
||||
@ -49,7 +71,7 @@ var _sc_prepareNonfsPlayer = function(){
|
||||
* Config for a given page
|
||||
*
|
||||
* <location.hostname>: {
|
||||
* enabled: bool, // ali to stran omogočimo? Legacy, se bo odstranilo | do we do stuff on this page?
|
||||
* enabled: string, // whitelist, blacklist, global
|
||||
* type: string,
|
||||
* 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
|
||||
@ -66,7 +88,7 @@ var _sc_prepareNonfsPlayer = function(){
|
||||
|
||||
var _sc_SITES = {
|
||||
"DEFAULT": {
|
||||
enabled: true,
|
||||
enabled: "global",
|
||||
type: "nonofficial",
|
||||
autoAr: {
|
||||
active: true,
|
||||
@ -75,7 +97,7 @@ var _sc_SITES = {
|
||||
}
|
||||
},
|
||||
"www.youtube.com" : {
|
||||
enabled: true,
|
||||
enabled: "global",
|
||||
type: "official",
|
||||
autoAr: {
|
||||
active: true,
|
||||
@ -84,7 +106,7 @@ var _sc_SITES = {
|
||||
}
|
||||
},
|
||||
"vimeo.com" : {
|
||||
enabled: true,
|
||||
enabled: "global",
|
||||
type: "official",
|
||||
autoAr: {
|
||||
active: true,
|
||||
@ -107,103 +129,22 @@ var _sc_SITES = {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var UW_SITES = {
|
||||
youtube: {
|
||||
enabled: true,
|
||||
"vid.me": {
|
||||
enabled: "global",
|
||||
type: "official",
|
||||
urlRules: ["youtu"],
|
||||
player: {
|
||||
name: "movie_player",
|
||||
isClass: false,
|
||||
},
|
||||
iframe: {
|
||||
name: "player",
|
||||
isClass: false
|
||||
},
|
||||
ui: {
|
||||
uiMode: "native",
|
||||
uiconf: {
|
||||
sampleButton: {
|
||||
class: "ytp-button ytp-settings-button",
|
||||
index: 0,
|
||||
buttonSizeBase: "x",
|
||||
},
|
||||
uiParent: {
|
||||
name: "ytp-right-controls",
|
||||
isClass: true,
|
||||
insertStrat: "prepend",
|
||||
},
|
||||
uiOffset: {
|
||||
offsetBy: "10vh",
|
||||
offsetType: "css"
|
||||
}
|
||||
}
|
||||
},
|
||||
autoar_imdb:{
|
||||
enabled: false
|
||||
}
|
||||
},
|
||||
netflix: {
|
||||
enabled: true,
|
||||
type: "official",
|
||||
urlRules: ["netflix"],
|
||||
player: {
|
||||
name: "placeholder",
|
||||
isClass: true,
|
||||
},
|
||||
ui: {
|
||||
uiMode: "native",
|
||||
uiconf: {
|
||||
sampleButton: {
|
||||
class: "ytp-button ytp-settings-button",
|
||||
index: 0,
|
||||
buttonSizeBase: "x",
|
||||
},
|
||||
uiParent: {
|
||||
name: "player-controls-wrapper",
|
||||
isClass: true,
|
||||
insertStrat: "append"
|
||||
},
|
||||
uiOffset: {
|
||||
offsetBy: "0px",
|
||||
offsetType: "css"
|
||||
}
|
||||
}
|
||||
},
|
||||
autoar_imdb:{
|
||||
enabled: true,
|
||||
title: "player-status-main-title",
|
||||
isClass: true
|
||||
}
|
||||
},
|
||||
dummy: {
|
||||
type: "add new site",
|
||||
urlRules: [""],
|
||||
player: {
|
||||
name: "",
|
||||
isClass: false,
|
||||
},
|
||||
sampleButton: {
|
||||
class: "ytp-button ytp-settings-button",
|
||||
index: 0,
|
||||
buttonSizeBase: "x",
|
||||
},
|
||||
uiParent: {
|
||||
name: "",
|
||||
isClass: false,
|
||||
insertStrat: "prepend",
|
||||
},
|
||||
autoar_imdb:{
|
||||
enabled: false
|
||||
autoAr: {
|
||||
passive: false;
|
||||
active: true;
|
||||
nonfs: true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_sc_init();
|
||||
|
||||
var SitesConf = {
|
||||
nonfsArDetectEnabled: _sc_nonfsAutoar,
|
||||
getPlayerTag: _sc_getPlayerTag,
|
||||
prepareNonfsPlayer: _sc_prepareNonfsPlayer
|
||||
prepareNonfsPlayer: _sc_prepareNonfsPlayer,
|
||||
getMode: _sc_getMode
|
||||
}
|
||||
|
@ -630,36 +630,49 @@ function _res_applyCss(dimensions){
|
||||
dimensions.width = "width: " + Math.round(dimensions.width) + "px !important";
|
||||
dimensions.height = "height: " + Math.round(dimensions.height) + "px !important";
|
||||
|
||||
// misc.
|
||||
dimensions.position = "position: absolute !important";
|
||||
dimensions.objectFit = "object-fit: cover !important";
|
||||
|
||||
console.log("trying to apply css. dimensions: ", dimensions);
|
||||
|
||||
var vid = $("video")[0];
|
||||
var styleArrayStr = vid.getAttribute('style');
|
||||
|
||||
var styleArray = vid.getAttribute('style').split("; ");
|
||||
|
||||
for(var i in styleArray){
|
||||
if (styleArrayStr !== null && styleArrayStr !== undefined){
|
||||
|
||||
styleArray[i] = styleArray[i].trim();
|
||||
|
||||
if (styleArray[i].startsWith("top:")){
|
||||
styleArray[i] = dimensions.top;
|
||||
delete dimensions.top;
|
||||
}
|
||||
else if(styleArray[i].startsWith("left:")){
|
||||
styleArray[i] = dimensions.left;
|
||||
delete dimensions.left;
|
||||
}
|
||||
else if(styleArray[i].startsWith("width:")){
|
||||
styleArray[i] = dimensions.width;
|
||||
delete dimensions.width;
|
||||
}
|
||||
else if(styleArray[i].startsWith("height:")){
|
||||
styleArray[i] = dimensions.height;
|
||||
delete dimensions.height;
|
||||
}
|
||||
else if(styleArray[i].startsWith("position:")){
|
||||
styleArray[i] = "position: absolute";
|
||||
var styleArray = styleArrayStr.split("; ");
|
||||
for(var i in styleArray){
|
||||
|
||||
styleArray[i] = styleArray[i].trim();
|
||||
|
||||
if (styleArray[i].startsWith("top:")){
|
||||
styleArray[i] = dimensions.top;
|
||||
delete dimensions.top;
|
||||
}
|
||||
else if(styleArray[i].startsWith("left:")){
|
||||
styleArray[i] = dimensions.left;
|
||||
delete dimensions.left;
|
||||
}
|
||||
else if(styleArray[i].startsWith("width:")){
|
||||
styleArray[i] = dimensions.width;
|
||||
delete dimensions.width;
|
||||
}
|
||||
else if(styleArray[i].startsWith("height:")){
|
||||
styleArray[i] = dimensions.height;
|
||||
delete dimensions.height;
|
||||
}
|
||||
else if(styleArray[i].startsWith("position:")){
|
||||
styleArray[i] = dimensions.position;
|
||||
}
|
||||
else if(styleArray[i].startsWith("object-fit:")){
|
||||
styleArray[i] = dimensions.objectFit;
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
var styleArray = [];
|
||||
}
|
||||
|
||||
// add remaining elements
|
||||
for(var key in dimensions)
|
||||
|
@ -1,181 +0,0 @@
|
||||
var browser_autodetect = true;
|
||||
var usebrowser = "chrome";
|
||||
|
||||
debugmsg = false;
|
||||
debugmsg_imdb = false;
|
||||
url_changed = false;
|
||||
if(debugmsg){
|
||||
console.log(". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ");
|
||||
console.log("\nLoading ultrawidify background script (uw-bg)\nIf you can see this, extension at least tried to load\n\nRandom number: ",Math.floor(Math.random() * 20) + 1,"\n");
|
||||
console.log(". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ");
|
||||
}
|
||||
|
||||
if(browser_autodetect){
|
||||
if(typeof browser === "undefined"){ // This means we're probably not on Firefox, but on nazi chrome
|
||||
if(chrome){
|
||||
browser = chrome;
|
||||
usebrowser = "chrome";
|
||||
}
|
||||
}
|
||||
else
|
||||
usebrowser = "firefox";
|
||||
}
|
||||
else{
|
||||
if(usebrowser == "chrome")
|
||||
browser = chrome;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/********************************************
|
||||
**** script-related stuff starts here ****
|
||||
********************************************/
|
||||
|
||||
function gibActiveTab(){
|
||||
return browser.tabs.query({active: true, currentWindow: true});
|
||||
}
|
||||
|
||||
var page_change_msg_count = 0;
|
||||
|
||||
function notifyChange(){
|
||||
|
||||
if(debugmsg)
|
||||
console.log("uw-bg::tab updated. seq:", page_change_msg_count++);
|
||||
|
||||
browser.tabs.query({active: true, currentWindow: true}, function(tabs){
|
||||
browser.tabs.sendMessage(tabs[0].id, {message: "page-change"});
|
||||
});
|
||||
}
|
||||
|
||||
browser.tabs.onUpdated.addListener(notifyChange);
|
||||
|
||||
//BEGIN Goldberg machine that gets aspect ratio data off imdb
|
||||
|
||||
function getAspectRatio(title, sender_tab){
|
||||
// presledki morajo biti zamenjani s +
|
||||
// spaces need to be replaced with +
|
||||
var rektitle = title.replace(/ /g, '+');
|
||||
|
||||
// Zdaj lahko pošljemo zahtevek na omdbapi
|
||||
// now we can send a request to omdbapi
|
||||
httpGET("http://www.omdbapi.com/?t=" + rektitle,
|
||||
function(response, sender_tab) {
|
||||
if(debugmsg || debugmsg_imdb)
|
||||
console.log("uw-bg::getAspectRatio | omdbapi gave us this: ", response);
|
||||
|
||||
var info = JSON.parse(response);
|
||||
|
||||
if(!info || !info.Title)
|
||||
return;
|
||||
|
||||
if(debugmsg || debugmsg_imdb){
|
||||
console.log("uw-bg::getAspectRatio | movie title: »»", info.Title, "«« | imdb ID:", info.imdbID,"\nTrying to get technical specs off IMDB");
|
||||
}
|
||||
httpGET("https://www.imdb.com/title/" + info.imdbID + "/technical",
|
||||
function(response, sender_tab){
|
||||
if(!response)
|
||||
return;
|
||||
var lines = response.split('\n');
|
||||
if(debugmsg || debugmsg_imdb){
|
||||
console.log("uw-bg::getAspectRatio | we just got something off IMDB, it's",lines.length,"long. Here's what we got:\n",response);
|
||||
}
|
||||
|
||||
// IMDB nam zraven da veliko nepotrebnega sranja. Na testni strani je bil relevanten podatek
|
||||
// 700+ (!) vrstic globoko. Stvar, ki nam jo da IMDB ima 1500+ vrstic. Iskanje bomo zato začeli
|
||||
// od sredine
|
||||
//
|
||||
// IMDB gives us a lot of unnecessary shit along with the data we want. On our test page the
|
||||
// relevant data was buried 700+ lines deep (1500+ lines total). Because we don't want to
|
||||
// pointlessly search half the page, the best place to start seems to be the middle.
|
||||
|
||||
var lines_nr = lines.length;
|
||||
if(lines_nr % 2 == 1)
|
||||
++lines_nr;
|
||||
var i = lines_nr / 2;
|
||||
var j = i;
|
||||
var ar_found = 0;
|
||||
|
||||
while(i > 400 && j < lines_nr){
|
||||
|
||||
if(lines[i].indexOf("Aspect Ratio") != -1){
|
||||
if(debugmsg || debugmsg_imdb)
|
||||
console.log("uw-bg::getAspectRatio | »Aspect Ratio« has been found on line",i," — searching for aspect ratio ...");
|
||||
|
||||
ar_found = i;
|
||||
break;
|
||||
}
|
||||
if(lines[j].indexOf("Aspect Ratio") != -1){
|
||||
if(debugmsg || debugmsg_imdb)
|
||||
console.log("uw-bg::getAspectRatio | »Aspect Ratio« has been found on line",j," — searching for aspect ratio ...");
|
||||
|
||||
ar_found = j;
|
||||
break;
|
||||
}
|
||||
--i;
|
||||
++j;
|
||||
}
|
||||
|
||||
|
||||
if(ar_found){
|
||||
var ar_limit = ar_found + 5;
|
||||
for(var i = ar_found; i < ar_limit; ++i){
|
||||
if(debugmsg || debugmsg_imdb)
|
||||
console.log("uw-bg::getAspectRatio | scanning lines for aspect ratio number. Line:",lines[i],"has ar:", lines[i].indexOf(":"));
|
||||
if(lines[i].indexOf(":") != -1){
|
||||
// To pomeni, da smo našli razmerje stranic. gg ez
|
||||
// This means we found our aspect ratio, gg ez
|
||||
|
||||
var ar = lines[i].trim().split(":");
|
||||
ar[0] = ar[0].trim();
|
||||
ar[1] = ar[1].trim();
|
||||
|
||||
if(debugmsg || debugmsg_imdb)
|
||||
console.log("uw-bg::getAspectRatio | Aspect ratio found:",ar[0],":",ar[1]);
|
||||
|
||||
// Pa povejmo to naši strani:
|
||||
// Let's break the news:
|
||||
browser.tabs.sendMessage(sender_tab.id, {type:"arInfo", arx:ar[0], ary:ar[1]});
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if(debugmsg || debugmsg_imdb)
|
||||
console.log("uw-bg::getAspectRatio | Aspect ratio hasn't been found");
|
||||
|
||||
},
|
||||
sender_tab
|
||||
); //httpGET end
|
||||
},
|
||||
sender_tab
|
||||
); //httpGET end
|
||||
}
|
||||
|
||||
function httpGET(url, callback, callback_args){
|
||||
var rek = new XMLHttpRequest();
|
||||
rek.onreadystatechange = function(){
|
||||
if(rek.readyState == 4 && rek.status == 200){
|
||||
callback(rek.responseText, callback_args);
|
||||
}
|
||||
}
|
||||
rek.open("GET", url, true);
|
||||
rek.send(null);
|
||||
}
|
||||
//END 3rd party snooping for aspect ratios
|
||||
browser.runtime.onMessage.addListener(function(request, sender, sendResponse) {
|
||||
|
||||
//Stvari delamo samo, če ima naše sporočilce tip
|
||||
//We only do stuff if our message has a type
|
||||
if(request.type){
|
||||
if(request.type == "debug"){
|
||||
console.log("uw-bg::onMessage | got a message. It was a debugging message. Here's the full message:",request);
|
||||
}
|
||||
if(request.type == "gibAspectRatio"){
|
||||
if(debugmsg || debugmsg_imdb)
|
||||
console.log("uw-bg::onMessage | got a message, we want to set aspect ratio. message:",request,"sender:",sender);
|
||||
var result = getAspectRatio(request.title, sender.tab);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
23
js/uw.js
23
js/uw.js
@ -1,14 +1,37 @@
|
||||
if(Debug.debug)
|
||||
console.log("\n\n\n\n\n\n ——— Sᴛλʀᴛɪɴɢ Uʟᴛʀᴀᴡɪᴅɪꜰʏ ———\n << ʟᴏᴀᴅɪɴɢ ᴍᴀɪɴ ꜰɪʟᴇ >>\n\n\n\n");
|
||||
|
||||
// load all settings from localStorage:
|
||||
|
||||
|
||||
// start autoar and setup everything
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
if(Debug.debug)
|
||||
console.log("uw::document.ready | document is ready. Starting ar script ...");
|
||||
//
|
||||
|
||||
if(SitesConf.getMode(window.location.hostname) == "blacklist" ){
|
||||
if(Debug.debug)
|
||||
console.log("uw::document.ready | site", window.location.hostname, "is blacklisted.");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if( ExtensionConf.getMode() == "none" ){
|
||||
if(Debug.debug)
|
||||
console.log("uw::document.ready | Extension is soft-disabled via popup");
|
||||
|
||||
return;
|
||||
}
|
||||
if( ExtensionConf.getMode() == "whitelist" && SitesConf.getMode(window.location.hostname) != "whitelist"){
|
||||
if(Debug.debug)
|
||||
console.log("uw::document.ready | extension is set to run on whitelisted sites only, but site ", window.location.hostname, "is not on whitelist.");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
ArDetect.arSetup();
|
||||
|
||||
|
||||
|
67
manifest-chrome.json
Normal file
67
manifest-chrome.json
Normal file
@ -0,0 +1,67 @@
|
||||
{
|
||||
"manifest_version": 2,
|
||||
"name": "Ultrawidify-git",
|
||||
"version": "0.01",
|
||||
|
||||
"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/conf/Debug.js",
|
||||
"js/conf/Settings.js",
|
||||
"js/conf/SitesConf.js",
|
||||
"js/conf/Status.js",
|
||||
|
||||
"js/lib/FullScreenDetect.js",
|
||||
|
||||
"js/modules/ArDetect.js",
|
||||
"js/modules/Resizer.js",
|
||||
"js/conf/Keybinds.js",
|
||||
|
||||
"js/uw.js" ],
|
||||
"all_frames": true
|
||||
}],
|
||||
|
||||
"permissions": [
|
||||
"tabs", "storage", "activeTab", "<all_urls>", "*://*.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": "Uʟᴛʀᴀᴡɪᴅɪꜰʏ"
|
||||
},
|
||||
|
||||
"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.html",
|
||||
"open_in_tab": true
|
||||
}
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 317 B After Width: | Height: | Size: 1.3 KiB |
1
res/popup/js/popup.js
Normal file
1
res/popup/js/popup.js
Normal file
@ -0,0 +1 @@
|
||||
|
@ -4,14 +4,17 @@
|
||||
<meta charset="utf-8">
|
||||
<style>
|
||||
html, body {
|
||||
width: 100%;
|
||||
width: 780px !important;
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
/* width: 100%; */
|
||||
color: #f1f1f1;
|
||||
background-color: #1f1f1f;
|
||||
font-family: "Overpass";
|
||||
}
|
||||
|
||||
.hidden: {
|
||||
display: none;
|
||||
.hidden {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
small{
|
||||
@ -23,39 +26,104 @@
|
||||
font-variant: small-caps;
|
||||
}
|
||||
|
||||
.selected{
|
||||
color: #090909;
|
||||
background-color: #fa6607;
|
||||
}
|
||||
|
||||
.header {
|
||||
background-color: #7f1416;
|
||||
color: #fff;
|
||||
margin: 0px;
|
||||
margin-top: 0px;
|
||||
padding-top: 8px;
|
||||
padding-left: 15px;
|
||||
padding-bottom: 1px;
|
||||
font-size: 2.7em;
|
||||
}
|
||||
|
||||
.left-side {
|
||||
display: inline-block;
|
||||
width: 39%;
|
||||
float: left;
|
||||
font-size: 1.6em;
|
||||
}
|
||||
|
||||
.right-side {
|
||||
display: inline-block;
|
||||
width: 60%;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.menu-item {
|
||||
padding-left: 15px;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
.suboption {
|
||||
padding-left: 15px;
|
||||
padding-top: 5px;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>U<span class="smallcaps">ltrawidify</span>: <small>Quick settings</small></h1>
|
||||
<div class="left—side">
|
||||
<h2>Extension mode:</h1>
|
||||
<form action="">
|
||||
<input type="radio" name="mode" value="white"> Enable everywhere except blacklist<br/>
|
||||
<input type="radio" name="mode" value="black"> Enable only on whitelisted sites<br/>
|
||||
<input type="radio" name="mode" value="block"> Disable extension on all sites
|
||||
</form>
|
||||
<h2>Settings for this site</h1>
|
||||
<form action="">
|
||||
<input type="radio" name="mode" value="default"> Follow global rules<br/>
|
||||
<input type="radio" name="mode" value="black"> Always block<br/>
|
||||
<input type="radio" name="mode" value="white"> Always allow
|
||||
</form>
|
||||
<div class="header">
|
||||
U<span class="smallcaps">ltrawidify</span>: <small>Quick settings</small>
|
||||
</div>
|
||||
<div>
|
||||
<h2>Autodetection</h1>
|
||||
<div class="left-side">
|
||||
<div class="menu-item selected">
|
||||
General settings
|
||||
</div>
|
||||
<div class="menu-item">
|
||||
Aspect ratio and alignment
|
||||
</div>
|
||||
<div class="menu-item">
|
||||
CSS hacks for this site
|
||||
</div>
|
||||
</div>
|
||||
<div class="right-side">
|
||||
<div id="extension-mode" class="suboption">
|
||||
<p>How should extension work in general?<br/><small>NOTE: settings will be applied when page is reloaded.</small></p>
|
||||
|
||||
<form action="">
|
||||
<input type="radio" name="mode" value="white"> Enable everywhere except blacklist<br/>
|
||||
<input type="radio" name="mode" value="black"> Enable only on whitelisted sites<br/>
|
||||
<input type="radio" name="mode" value="block"> Disable extension on all sites
|
||||
</form>
|
||||
|
||||
<p>How should extension work on this site?<br><small class="important">NOTE: this doesn't apply to embedded videos!<br/>NOTE: settings will be applied when page is reloaded.</small></p>
|
||||
<form action="">
|
||||
<input type="radio" name="mode" value="default"> Follow global rules<br/>
|
||||
<input type="radio" name="mode" value="black"> Always block (blacklist)<br/>
|
||||
<input type="radio" name="mode" value="white"> Always allow (whitelist)
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div id="aspect-ratio-settings" class="suboption hidden">
|
||||
<input type="checkbox" id="arDetectEnabled"><label for="arDetectEnabled">Enable active aspect ratio autodetection</label>
|
||||
<div>TODO: add controls for how aggressive autodetection is</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="css-hacks-settings" class="suboption hidden">
|
||||
<p>If zoomed in video doesn't align properly, try enabling or disabling certain CSS rules below:</p>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h2>Force aspect ratio:</h2>
|
||||
Todo:
|
||||
Options: default, auto, fit width, fit height, 16:9, 16:10, 21:9
|
||||
</div>
|
||||
<div>
|
||||
<h2>Video alignment</h2>
|
||||
Todo: Left, center, right
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- load all scripts. ordering is important! -->
|
||||
|
||||
<script src="../../js/dep/jquery-3.1.1.js" ></script>
|
||||
|
||||
<!-- the following scripts aren't included yet. if they're needed, they need to be added in this order -->
|
||||
<!-- "js/conf/Debug.js",
|
||||
"js/conf/Settings.js",
|
||||
"js/conf/SitesConf.js",
|
||||
"js/conf/Status.js",-->
|
||||
|
||||
<script src="../../js/lib/StorageManager.js"></script>
|
||||
<script src="./settings.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user