Release v2.1.0 (sans readme)
This commit is contained in:
parent
b13eff44e3
commit
2c0f0ed607
@ -1,6 +1,6 @@
|
|||||||
// Set prod to true when releasing
|
// Set prod to true when releasing
|
||||||
// _prod = true;
|
_prod = true;
|
||||||
_prod = false;
|
// _prod = false;
|
||||||
|
|
||||||
Debug = {
|
Debug = {
|
||||||
debug: true,
|
debug: true,
|
||||||
|
@ -54,6 +54,14 @@ var _se_reload = function(){
|
|||||||
this.init(true);
|
this.init(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _se_isBlacklisted = function(site){
|
||||||
|
return this.blacklist.indexOf(site) > -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
var _se_isWhitelisted = function(site){
|
||||||
|
return this.whitelist.indexOf(site) > -1;
|
||||||
|
}
|
||||||
|
|
||||||
var Settings = {
|
var Settings = {
|
||||||
arDetect: {
|
arDetect: {
|
||||||
enabled: "global", // thats my csgo rank kappa
|
enabled: "global", // thats my csgo rank kappa
|
||||||
@ -81,6 +89,8 @@ var Settings = {
|
|||||||
},
|
},
|
||||||
whitelist: [],
|
whitelist: [],
|
||||||
blacklist: ["vimeo.com"],
|
blacklist: ["vimeo.com"],
|
||||||
|
isBlacklisted: _se_isBlacklisted,
|
||||||
|
isWhitelisted: _se_isWhitelisted,
|
||||||
init: _se_init,
|
init: _se_init,
|
||||||
save: _se_save,
|
save: _se_save,
|
||||||
reload: _se_reload,
|
reload: _se_reload,
|
||||||
|
@ -40,7 +40,12 @@ var _pd_getPlayerDimensions = function(element){
|
|||||||
height: screen.height
|
height: screen.height
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
if(element == null){
|
||||||
|
if(Debug.debug)
|
||||||
|
console.log("[PlayerDetect::_pd_getPlayerDimensions] element is not valid, doing nothing.", element)
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
var playerCandidateNode = element;
|
var playerCandidateNode = element;
|
||||||
|
|
||||||
// in case our <video> is bigger than player in one dimension but smaller in the other
|
// in case our <video> is bigger than player in one dimension but smaller in the other
|
||||||
|
@ -115,7 +115,19 @@ var _res_setAr = function(ar, playerDimensions){
|
|||||||
GlobalVars.lastAr = {type: "static", ar: ar};
|
GlobalVars.lastAr = {type: "static", ar: ar};
|
||||||
|
|
||||||
var vid = GlobalVars.video;
|
var vid = GlobalVars.video;
|
||||||
|
if(vid == null || vid==undefined || vid.videoWidth == 0 || vid.videoHeight == 0){
|
||||||
|
vid = document.getElementsByTagName("video")[0];
|
||||||
|
GlobalVars.video = vid;
|
||||||
|
|
||||||
|
if(vid == null || vid==undefined || vid.videoWidth == 0 || vid.videoHeight == 0){
|
||||||
|
if(Debug.debug)
|
||||||
|
console.log("[Resizer::_res_setAr] You thought there is a video, didn't you? Tricked you. Never would be.", vid);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Debug.debug)
|
||||||
|
console.log("[Resizer::_res_setAr] video:",vid,"width:", vid.videoWidth, "height:", vid.videoHeight);
|
||||||
|
|
||||||
// Dejansko razmerje stranic datoteke/<video> značke
|
// Dejansko razmerje stranic datoteke/<video> značke
|
||||||
// Actual aspect ratio of the file/<video> tag
|
// Actual aspect ratio of the file/<video> tag
|
||||||
@ -123,10 +135,10 @@ var _res_setAr = function(ar, playerDimensions){
|
|||||||
|
|
||||||
if(ar == "default")
|
if(ar == "default")
|
||||||
ar = fileAr;
|
ar = fileAr;
|
||||||
|
|
||||||
|
|
||||||
if(Debug.debug)
|
if(Debug.debug)
|
||||||
console.log("[Resizer::_res_setAr] ar is " ,ar, ", playerDimensions are ", playerDimensions);
|
console.log("[Resizer::_res_setAr] ar is " ,ar, ", file ar is", fileAr, ", playerDimensions are ", playerDimensions);
|
||||||
|
|
||||||
var videoDimensions = {
|
var videoDimensions = {
|
||||||
width: 0,
|
width: 0,
|
||||||
@ -157,13 +169,13 @@ var _res_setAr = function(ar, playerDimensions){
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(Debug.debug){
|
if(Debug.debug){
|
||||||
console.log("[Resizer::_res_setArFs] Video dimensions: ",videoDimensions, "playerDimensions:",playerDimensions);
|
console.log("[Resizer::_res_setAr] Video dimensions: ",videoDimensions, "playerDimensions:",playerDimensions);
|
||||||
}
|
}
|
||||||
|
|
||||||
var cssValues = _res_computeOffsets(videoDimensions, playerDimensions);
|
var cssValues = _res_computeOffsets(videoDimensions, playerDimensions);
|
||||||
|
|
||||||
if(Debug.debug){
|
if(Debug.debug){
|
||||||
console.log("[Resizer::_res_setArFs] Offsets for css are: ",cssValues);
|
console.log("[Resizer::_res_setAr] Offsets for css are: ",cssValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
_res_applyCss(cssValues);
|
_res_applyCss(cssValues);
|
||||||
|
16
js/uw-bg.js
16
js/uw-bg.js
@ -77,6 +77,22 @@ async function _uwbg_onTabSwitched(activeInfo){
|
|||||||
// todo: change extension icon depending on whether there's a video on the page or not
|
// todo: change extension icon depending on whether there's a video on the page or not
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function _uwbg_check4videos(){
|
||||||
|
if(BgVars.hasVideos)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var videoFrameList = Comms.sendToEach({"cmd":"has-videos"});
|
||||||
|
|
||||||
|
if(Debug.debug)
|
||||||
|
console.log("[uw-bg::check4videos] got updated list of frames and whether they have videos", videoFrameList);
|
||||||
|
|
||||||
|
var hasVideos = false;
|
||||||
|
for(frame of videoFrameList){
|
||||||
|
hasVideos |= frame.response.hasVideos;
|
||||||
|
}
|
||||||
|
|
||||||
|
BgVars.hasVideos = hasVideos;
|
||||||
|
}
|
||||||
|
|
||||||
async function _uwbg_registerVideo(tabId){
|
async function _uwbg_registerVideo(tabId){
|
||||||
var tabs = await Comms.getActiveTab();
|
var tabs = await Comms.getActiveTab();
|
||||||
|
32
js/uw.js
32
js/uw.js
@ -48,32 +48,17 @@ async function main(){
|
|||||||
if(Debug.debug)
|
if(Debug.debug)
|
||||||
console.log("uw::document.ready | document is ready. Starting ar script ...");
|
console.log("uw::document.ready | document is ready. Starting ar script ...");
|
||||||
|
|
||||||
if(SitesConf.getMode(window.location.hostname) == "blacklist" ){
|
if(Settings.isBlacklisted(window.location.hostname)){
|
||||||
if(Debug.debug)
|
if(Debug.debug)
|
||||||
console.log("uw::document.ready | site", window.location.hostname, "is blacklisted.");
|
console.log("uw::document.ready | site", window.location.hostname, "is blacklisted.");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ExtensionConf.mode == "none" ){
|
|
||||||
if(Debug.debug)
|
|
||||||
console.log("uw::document.ready | Extension is soft-disabled via popup");
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if( ExtensionConf.mode == "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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(Settings.arDetect.enabled == "global"){
|
if(Settings.arDetect.enabled == "global"){
|
||||||
if(Debug.debug)
|
if(Debug.debug)
|
||||||
console.log("[uw::main] Aspect ratio detection is enabled. Starting ArDetect");
|
console.log("[uw::main] Aspect ratio detection is enabled. Starting ArDetect");
|
||||||
// ArDetect.arSetup();
|
ArDetect.arSetup();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if(Debug.debug)
|
if(Debug.debug)
|
||||||
@ -98,9 +83,16 @@ function ghettoOnChange(){
|
|||||||
if(_video_recheck_counter++ > _video_recheck_period){
|
if(_video_recheck_counter++ > _video_recheck_period){
|
||||||
_video_recheck_counter = 0;
|
_video_recheck_counter = 0;
|
||||||
|
|
||||||
if(GlobalVars.video === null){
|
if ( GlobalVars.video == null ||
|
||||||
|
GlobalVars.video == undefined ||
|
||||||
|
GlobalVars.video.videoWidth == 0 ||
|
||||||
|
GlobalVars.video.videoHeight == 0 ){
|
||||||
|
|
||||||
var video = document.getElementsByTagName("video")[0];
|
var video = document.getElementsByTagName("video")[0];
|
||||||
if(video !== undefined){
|
if ( video !== undefined &&
|
||||||
|
video !== null &&
|
||||||
|
video.videoWidth > 0 &&
|
||||||
|
video.videoHeight > 0 ){
|
||||||
GlobalVars.video = video;
|
GlobalVars.video = video;
|
||||||
Comms.sendToBackgroundScript({"cmd":"register-video"});
|
Comms.sendToBackgroundScript({"cmd":"register-video"});
|
||||||
}
|
}
|
||||||
|
@ -229,10 +229,8 @@ function openMenu(menu){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(menu != "noVideo"){
|
selectedMenu = menu;
|
||||||
// selectedMenu = menu;
|
MenuTab[menu].classList.add("selected");
|
||||||
// MenuTab[menu].classList.add("selected");
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function _arctl_onclick(command){
|
function _arctl_onclick(command){
|
||||||
@ -422,7 +420,7 @@ document.addEventListener("click", (e) => {
|
|||||||
|
|
||||||
var command = getcmd(e);
|
var command = getcmd(e);
|
||||||
if(command)
|
if(command)
|
||||||
sendMessage(command);
|
Comms.sendToAll(command);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
@ -160,7 +160,7 @@
|
|||||||
Settings for this site
|
Settings for this site
|
||||||
</div>
|
</div>
|
||||||
<div id="_menu_aspectratio" class="menu-item selected _menu_aspectratio">
|
<div id="_menu_aspectratio" class="menu-item selected _menu_aspectratio">
|
||||||
Aspect ratio and alignment
|
Letterbox removal and alignment
|
||||||
</div>
|
</div>
|
||||||
<div id="_menu_csshacks" class="menu-item disabled hidden _menu_hacks">
|
<div id="_menu_csshacks" class="menu-item disabled hidden _menu_hacks">
|
||||||
CSS hacks for this site
|
CSS hacks for this site
|
||||||
@ -204,7 +204,7 @@
|
|||||||
|
|
||||||
<div id="no-videos-warning" class="warning">No videos were detected on this page. The buttons may not work at all. Check that this site is not blacklisted and reload the page.</div>
|
<div id="no-videos-warning" class="warning">No videos were detected on this page. The buttons may not work at all. Check that this site is not blacklisted and reload the page.</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<span class="label">Force aspect ratio:</span>
|
<span class="label">Cropping mode:</span>
|
||||||
<div class="button-row">
|
<div class="button-row">
|
||||||
<a class="button _changeAr _ar_auto w24">Auto-detect<br/><span id="_b_changeAr_autoar_key" class="smallcaps small darker"></span></a>
|
<a class="button _changeAr _ar_auto w24">Auto-detect<br/><span id="_b_changeAr_autoar_key" class="smallcaps small darker"></span></a>
|
||||||
<a class="button _changeAr _ar_reset w24">Reset<br/><span id="_b_changeAr_reset_key" class="smallcaps small darker"></span></a>
|
<a class="button _changeAr _ar_reset w24">Reset<br/><span id="_b_changeAr_reset_key" class="smallcaps small darker"></span></a>
|
||||||
|
Loading…
Reference in New Issue
Block a user