1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 09:49:28 +02:00

Improving the get restream credentials

This commit is contained in:
DanieL 2022-05-20 16:22:54 -03:00
parent 654dda115a
commit 56cb1fd5cb
6058 changed files with 1166166 additions and 1430809 deletions

View file

@ -1,102 +1,102 @@
// status
( function( window, factory ) {
// universal module definition
if ( typeof module == 'object' && module.exports ) {
// CommonJS
module.exports = factory(
window,
require('./core'),
require('fizzy-ui-utils'),
);
} else {
// browser global
factory(
window,
window.InfiniteScroll,
window.fizzyUIUtils,
);
}
}( window, function factory( window, InfiniteScroll, utils ) {
let proto = InfiniteScroll.prototype;
// InfiniteScroll.defaults.status = null;
InfiniteScroll.create.status = function() {
let statusElem = utils.getQueryElement( this.options.status );
if ( !statusElem ) return;
// elements
this.statusElement = statusElem;
this.statusEventElements = {
request: statusElem.querySelector('.infinite-scroll-request'),
error: statusElem.querySelector('.infinite-scroll-error'),
last: statusElem.querySelector('.infinite-scroll-last'),
};
// events
this.on( 'request', this.showRequestStatus );
this.on( 'error', this.showErrorStatus );
this.on( 'last', this.showLastStatus );
this.bindHideStatus('on');
};
proto.bindHideStatus = function( bindMethod ) {
let hideEvent = this.options.append ? 'append' : 'load';
this[ bindMethod ]( hideEvent, this.hideAllStatus );
};
proto.showRequestStatus = function() {
this.showStatus('request');
};
proto.showErrorStatus = function() {
this.showStatus('error');
};
proto.showLastStatus = function() {
this.showStatus('last');
// prevent last then append event race condition from showing last status #706
this.bindHideStatus('off');
};
proto.showStatus = function( eventName ) {
show( this.statusElement );
this.hideStatusEventElements();
let eventElem = this.statusEventElements[ eventName ];
show( eventElem );
};
proto.hideAllStatus = function() {
hide( this.statusElement );
this.hideStatusEventElements();
};
proto.hideStatusEventElements = function() {
for ( let type in this.statusEventElements ) {
let eventElem = this.statusEventElements[ type ];
hide( eventElem );
}
};
// -------------------------- -------------------------- //
function hide( elem ) {
setDisplay( elem, 'none' );
}
function show( elem ) {
setDisplay( elem, 'block' );
}
function setDisplay( elem, value ) {
if ( elem ) {
elem.style.display = value;
}
}
// -------------------------- -------------------------- //
return InfiniteScroll;
} ) );
// status
( function( window, factory ) {
// universal module definition
if ( typeof module == 'object' && module.exports ) {
// CommonJS
module.exports = factory(
window,
require('./core'),
require('fizzy-ui-utils'),
);
} else {
// browser global
factory(
window,
window.InfiniteScroll,
window.fizzyUIUtils,
);
}
}( window, function factory( window, InfiniteScroll, utils ) {
let proto = InfiniteScroll.prototype;
// InfiniteScroll.defaults.status = null;
InfiniteScroll.create.status = function() {
let statusElem = utils.getQueryElement( this.options.status );
if ( !statusElem ) return;
// elements
this.statusElement = statusElem;
this.statusEventElements = {
request: statusElem.querySelector('.infinite-scroll-request'),
error: statusElem.querySelector('.infinite-scroll-error'),
last: statusElem.querySelector('.infinite-scroll-last'),
};
// events
this.on( 'request', this.showRequestStatus );
this.on( 'error', this.showErrorStatus );
this.on( 'last', this.showLastStatus );
this.bindHideStatus('on');
};
proto.bindHideStatus = function( bindMethod ) {
let hideEvent = this.options.append ? 'append' : 'load';
this[ bindMethod ]( hideEvent, this.hideAllStatus );
};
proto.showRequestStatus = function() {
this.showStatus('request');
};
proto.showErrorStatus = function() {
this.showStatus('error');
};
proto.showLastStatus = function() {
this.showStatus('last');
// prevent last then append event race condition from showing last status #706
this.bindHideStatus('off');
};
proto.showStatus = function( eventName ) {
show( this.statusElement );
this.hideStatusEventElements();
let eventElem = this.statusEventElements[ eventName ];
show( eventElem );
};
proto.hideAllStatus = function() {
hide( this.statusElement );
this.hideStatusEventElements();
};
proto.hideStatusEventElements = function() {
for ( let type in this.statusEventElements ) {
let eventElem = this.statusEventElements[ type ];
hide( eventElem );
}
};
// -------------------------- -------------------------- //
function hide( elem ) {
setDisplay( elem, 'none' );
}
function show( elem ) {
setDisplay( elem, 'block' );
}
function setDisplay( elem, value ) {
if ( elem ) {
elem.style.display = value;
}
}
// -------------------------- -------------------------- //
return InfiniteScroll;
} ) );