???
This commit is contained in:
parent
6fe906f166
commit
3740f2c487
@ -6,7 +6,7 @@ var _pd_isFullScreen = function(){
|
||||
}
|
||||
|
||||
|
||||
/* sprejme <video> tag (element
|
||||
/* sprejme <video> tag (element) in seznam imen, ki se lahko pojavijo v razredih oz. id staršev.
|
||||
// vrne dimenzije predvajalnika (širina, višina)
|
||||
//
|
||||
// Na youtube v theater mode je razširitev rahlo pokvarjena. Video tag ostane večji od predvajalnika, ko se zapusti
|
||||
@ -15,10 +15,11 @@ var _pd_isFullScreen = function(){
|
||||
// Funkcija izkorišča lastnost, da bi načeloma moral biti vsak zunanji element večji od notranjega. Najmanjši element od
|
||||
// <video> značke pa do korena drevesa bi tako moral biti predvajalnik.
|
||||
//
|
||||
// Če je podan seznam imen, potem funkcija vrne dimenzije prvega elementa, ki v id oz. razredu vsebuje katerokoli ime iz seznama
|
||||
//
|
||||
// | EN |
|
||||
//
|
||||
// accepts <video> tag (element)
|
||||
// accepts <video> tag (element) and list of names that can appear in id or class
|
||||
// returns player dimensions (width, height)
|
||||
//
|
||||
// Theater mode is mildly broken on youtube. <video> tag remains bigger than the player after leaving the fullscreen mode, and
|
||||
@ -27,13 +28,15 @@ var _pd_isFullScreen = function(){
|
||||
//
|
||||
// In general, an outer tag should be bigger than the inner tag. Therefore the smallest element between <video> tag and the document
|
||||
// root should be the player.
|
||||
//
|
||||
// If list of names is provided, the function returns dimensions of the first element that contains any name from the list in either
|
||||
// id or class.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
var _pd_getPlayerDimensions = function(startElement){
|
||||
|
||||
var _pd_getPlayerDimensions = function(startElement, elementNames){
|
||||
var element = startElement;
|
||||
|
||||
if(element == null || element == undefined){
|
||||
@ -124,6 +127,8 @@ var _pd_getPlayerDimensions = function(startElement){
|
||||
// returns 'true' if there was a change.
|
||||
var _pd_checkPlayerSizeChange = function(){
|
||||
|
||||
// console.log("Player:", GlobalVars.playerDimensions, "Node:", GlobalVars.playerDimensions.element)
|
||||
|
||||
if(Debug.debug){
|
||||
if(GlobalVars.playerDimensions.element == undefined)
|
||||
console.log("[PlayerDetect] player size changed. reason: player element undefined");
|
||||
@ -142,9 +147,9 @@ var _pd_checkPlayerSizeChange = function(){
|
||||
if(GlobalVars.playerDimensions.element == undefined)
|
||||
return true;
|
||||
|
||||
if(GlobalVars.playerDimensions.fullscreen){
|
||||
return ! _pd_isFullScreen();
|
||||
}
|
||||
// if(GlobalVars.playerDimensions.fullscreen){
|
||||
// return ! _pd_isFullScreen();
|
||||
// }
|
||||
|
||||
if(GlobalVars.playerDimensions.width != GlobalVars.playerDimensions.element.offsetWidth || GlobalVars.playerDimensions.height != GlobalVars.playerDimensions.element.offsetHeight ){
|
||||
return true;
|
||||
|
@ -558,7 +558,65 @@ var _ard_vdraw_but_for_reals = function() {
|
||||
delete image;
|
||||
}
|
||||
|
||||
var getBlackRatioEstimate = function(image){
|
||||
var blackbarTreshold, upper, lower;
|
||||
|
||||
blackbarTreshold = GlobalVars.arDetect.blackLevel + ExtensionConf.arDetect.blackbarTreshold;
|
||||
|
||||
var sampleRows = 5;
|
||||
var sampleCols = 10; // has 1 more than actually
|
||||
|
||||
var spread = 0.4; // how far from middle the samples go
|
||||
|
||||
var rowOffset = ~~(GlobalVars.canvas.height / (spread >> 1));
|
||||
var rowSpacing = ~~(GlobalVars.canvas.height * spread / sampleRows);
|
||||
var colSpacing = ~~(GlobalVars.canvas.width / sampleCols) >> 2;
|
||||
var colOffset = colSpacing >> 1;
|
||||
|
||||
var rowStart;
|
||||
|
||||
var blackCount = 0, blackRatio, totalSamples = sampleCols * (sampleCols - 1);
|
||||
|
||||
for(var i = 0; i < sampleRows; i++){
|
||||
rowStart = ((rowOffset * GlobalVars.canvas.width) << 2) + colOffset;
|
||||
colOffset = rowStart;
|
||||
|
||||
for(var j = 1; j < sampleCols; j++){
|
||||
if(image[colOffset] > blackbarTreshold || image[colOffset+1] > blackbarTreshold || image[colOffset+2] > blackbarTreshold){
|
||||
blackCount++
|
||||
}
|
||||
|
||||
colOffset += colSpacing;
|
||||
}
|
||||
|
||||
rowOffset += rowSpacing;
|
||||
}
|
||||
|
||||
|
||||
rowStart = ((edge_upper * GlobalVars.canvas.width) << 2) + offset;
|
||||
rowEnd = rowStart + ( GlobalVars.canvas.width << 2 ) - (offset * 2);
|
||||
|
||||
for(var i = rowStart; i < rowEnd; i+=4){
|
||||
|
||||
// we track sections that go over what's supposed to be a black line, so we can suggest more
|
||||
// columns to sample
|
||||
if(image[i] > blackbarTreshold || image[i+1] > blackbarTreshold || image[i+2] > blackbarTreshold){
|
||||
if(firstOffender < 0){
|
||||
firstOffender = (i * 0.25) - rowStart;
|
||||
offenderCount++;
|
||||
offenders.push({x: firstOffender, width: 1})
|
||||
}
|
||||
else{
|
||||
offenders[offenderCount].width++
|
||||
}
|
||||
}
|
||||
else{
|
||||
// is that a black pixel again? Let's reset the 'first offender'
|
||||
firstOffender = -1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var _ard_guardLineCheck = function(image, fallbackMode){
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"manifest_version": 2,
|
||||
"name": "Ultrawidify",
|
||||
"version": "2.2.3.1",
|
||||
"version": "2.2.4a",
|
||||
|
||||
"icons": {
|
||||
"32":"res/icons/uw-32.png",
|
||||
|
Loading…
Reference in New Issue
Block a user