mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-06 03:50:04 +02:00
npm update
This commit is contained in:
parent
0cdd3e9fee
commit
4696ba952f
1437 changed files with 32727 additions and 1248226 deletions
143
node_modules/videojs-contrib-ads/dist/videojs.ads.js
generated
vendored
143
node_modules/videojs-contrib-ads/dist/videojs.ads.js
generated
vendored
|
@ -1,4 +1,4 @@
|
|||
/*! @name videojs-contrib-ads @version 7.2.0 @license Apache-2.0 */
|
||||
/*! @name videojs-contrib-ads @version 7.3.2 @license Apache-2.0 */
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('video.js'), require('global/window'), require('global/document')) :
|
||||
typeof define === 'function' && define.amd ? define(['video.js', 'global/window', 'global/document'], factory) :
|
||||
|
@ -9,7 +9,7 @@
|
|||
window = window && window.hasOwnProperty('default') ? window['default'] : window;
|
||||
document = document && document.hasOwnProperty('default') ? document['default'] : document;
|
||||
|
||||
var version = "7.2.0";
|
||||
var version = "7.3.2";
|
||||
|
||||
/*
|
||||
* Implements the public API available in `player.ads` as well as application state.
|
||||
|
@ -528,6 +528,82 @@
|
|||
}
|
||||
};
|
||||
|
||||
var findUspApiLocatorWindow = function findUspApiLocatorWindow(windowObj) {
|
||||
var targetWindow = windowObj.parent;
|
||||
while (targetWindow !== windowObj.top) {
|
||||
try {
|
||||
if (targetWindow.frames && targetWindow.frames.__uspapiLocator) {
|
||||
return targetWindow;
|
||||
}
|
||||
} catch (ignore) {
|
||||
// do nothing
|
||||
}
|
||||
targetWindow = targetWindow.parent;
|
||||
}
|
||||
|
||||
// Check for the __uspapiLocator frame in the top window
|
||||
try {
|
||||
if (windowObj.top.frames && windowObj.top.frames.__uspapiLocator) {
|
||||
return windowObj.top;
|
||||
}
|
||||
} catch (ignore) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
// Return null if no __uspapiLocator frame is found in any window
|
||||
return null;
|
||||
};
|
||||
var uspString = '';
|
||||
var getCurrentUspString = function getCurrentUspString() {
|
||||
return uspString;
|
||||
};
|
||||
|
||||
// Call the USP API to get the US Privacy String, either by invoking it directly or via postMessage() if inside an iframe.
|
||||
// In the former case the callback is synchronous, if the latter it is asynchronous, so to be safe it should always be
|
||||
// assumed to be asynchronous.
|
||||
// The window is passable as an argument for ease of testing
|
||||
var obtainUsPrivacyString = function obtainUsPrivacyString(callback, windowObj) {
|
||||
if (windowObj === void 0) {
|
||||
windowObj = window;
|
||||
}
|
||||
if (windowObj.__uspapi) {
|
||||
windowObj.__uspapi('getUSPData', 1, function (uspData, success) {
|
||||
var privacyString = success ? uspData.uspString : null;
|
||||
uspString = privacyString;
|
||||
callback(privacyString);
|
||||
});
|
||||
} else {
|
||||
var targetWindow = findUspApiLocatorWindow(windowObj);
|
||||
|
||||
// If no __uspapiLocator frame is found, execute the callback with a null privacy string
|
||||
if (!targetWindow) {
|
||||
callback(null);
|
||||
return;
|
||||
}
|
||||
var uniqueId = Math.random().toString(36).substring(2);
|
||||
var message = {
|
||||
__uspapiCall: {
|
||||
command: 'getUSPData',
|
||||
version: 1,
|
||||
callId: uniqueId
|
||||
}
|
||||
};
|
||||
var handleMessageEvent = function handleMessageEvent(event) {
|
||||
if (event && event.data && event.data.__uspapiReturn && event.data.__uspapiReturn.callId === uniqueId) {
|
||||
windowObj.removeEventListener('message', handleMessageEvent, false);
|
||||
var _event$data$__uspapiR = event.data.__uspapiReturn,
|
||||
returnValue = _event$data$__uspapiR.returnValue,
|
||||
success = _event$data$__uspapiR.success;
|
||||
var privacyString = success ? returnValue.uspString : null;
|
||||
uspString = privacyString;
|
||||
callback(privacyString);
|
||||
}
|
||||
};
|
||||
windowObj.addEventListener('message', handleMessageEvent, false);
|
||||
targetWindow.postMessage(message, '*');
|
||||
}
|
||||
};
|
||||
|
||||
var uriEncodeIfNeeded = function uriEncodeIfNeeded(value, uriEncode) {
|
||||
return uriEncode ? encodeURIComponent(value) : value;
|
||||
};
|
||||
|
@ -571,20 +647,6 @@
|
|||
modifiedString: modifiedString
|
||||
};
|
||||
};
|
||||
var processMacroNameOverrides = function processMacroNameOverrides(string, macroNameOverrides) {
|
||||
var foundOverrides = {};
|
||||
for (var defaultMacro in macroNameOverrides) {
|
||||
var customMacro = macroNameOverrides[defaultMacro];
|
||||
if (string.includes(customMacro)) {
|
||||
foundOverrides[defaultMacro] = customMacro;
|
||||
string = string.replace(new RegExp(customMacro, 'g'), defaultMacro);
|
||||
}
|
||||
}
|
||||
return {
|
||||
string: string,
|
||||
foundOverrides: foundOverrides
|
||||
};
|
||||
};
|
||||
var getStaticMacros = function getStaticMacros(player) {
|
||||
return {
|
||||
'{player.id}': player.options_['data-player'] || player.id_,
|
||||
|
@ -618,9 +680,24 @@
|
|||
tcfMacros['{tcf.gdprAppliesInt}'] = tcDataObj.gdprApplies ? 1 : 0;
|
||||
return tcfMacros;
|
||||
};
|
||||
var getPageVariableMacros = function getPageVariableMacros(string, defaults) {
|
||||
var pageVariables = string.match(/{pageVariable\.([^}]+)}/g);
|
||||
var getUspMacros = function getUspMacros() {
|
||||
return {
|
||||
'{usp.uspString}': getCurrentUspString()
|
||||
};
|
||||
};
|
||||
|
||||
// This extracts and evaluates variables from the `window` object for macro replacement. While replaceMacros() handles generic macro name
|
||||
// overriding for other macro types, this function also needs to reference the overrides in order to map custom macro names in the string
|
||||
// to their corresponding default pageVariable names, so they can be evaluated on the `window` and stored for later replacement in replaceMacros().
|
||||
var getPageVariableMacros = function getPageVariableMacros(string, defaults, macroNameOverrides) {
|
||||
var pageVarRegex = new RegExp('{pageVariable\\.([^}]+)}', 'g');
|
||||
var pageVariablesMacros = {};
|
||||
|
||||
// Aggregate any default pageVariable macros found in the string with any pageVariable macros that have custom names specified in
|
||||
// macroNameOverrides.
|
||||
var pageVariables = (string.match(pageVarRegex) || []).concat(Object.keys(macroNameOverrides).filter(function (macroName) {
|
||||
return pageVarRegex.test(macroName) && string.includes(macroNameOverrides[macroName]);
|
||||
}));
|
||||
if (!pageVariables) {
|
||||
return;
|
||||
}
|
||||
|
@ -669,8 +746,18 @@
|
|||
overrides = {};
|
||||
}
|
||||
for (var macroName in macros) {
|
||||
// The resolvedMacroName is the macro as it is expected to appear in the actual string, or regex if it has been provided.
|
||||
var resolvedMacroName = overrides.hasOwnProperty(macroName) ? overrides[macroName] : macroName;
|
||||
string = string.split(resolvedMacroName).join(uriEncodeIfNeeded(macros[macroName], uriEncode));
|
||||
if (resolvedMacroName.startsWith('r:')) {
|
||||
try {
|
||||
var regex = new RegExp(resolvedMacroName.slice(2), 'g');
|
||||
string = string.replace(regex, uriEncodeIfNeeded(macros[macroName], uriEncode));
|
||||
} catch (error) {
|
||||
videojs.log.warn("Unable to replace macro with regex \"" + resolvedMacroName + "\". The provided regex may be invalid.");
|
||||
}
|
||||
} else {
|
||||
string = string.split(resolvedMacroName).join(uriEncodeIfNeeded(macros[macroName], uriEncode));
|
||||
}
|
||||
}
|
||||
return string;
|
||||
};
|
||||
|
@ -706,12 +793,8 @@
|
|||
delete customMacros.disableDefaultMacros;
|
||||
delete customMacros.macroNameOverrides;
|
||||
var macros = customMacros;
|
||||
var _processMacroNameOver = processMacroNameOverrides(string, macroNameOverrides),
|
||||
updatedString = _processMacroNameOver.string,
|
||||
macrosToOverride = _processMacroNameOver.macrosToOverride;
|
||||
string = updatedString;
|
||||
if (disableDefaultMacros) {
|
||||
return replaceMacros(string, macros, uriEncode, macrosToOverride);
|
||||
return replaceMacros(string, macros, uriEncode, macroNameOverrides);
|
||||
}
|
||||
|
||||
// Get macros with defaults e.g. {x=y}, store the values in `defaults` and replace with standard macros in the string
|
||||
|
@ -721,10 +804,10 @@
|
|||
string = modifiedString;
|
||||
|
||||
// Get all macro values
|
||||
_extends(macros, getStaticMacros(this), getMediaInfoMacros(this.mediainfo, defaults), getTcfMacros(tcData), getPageVariableMacros(string, defaults));
|
||||
_extends(macros, getStaticMacros(this), getMediaInfoMacros(this.mediainfo, defaults), getTcfMacros(tcData), getUspMacros(), getPageVariableMacros(string, defaults, macroNameOverrides));
|
||||
|
||||
// Perform macro replacement
|
||||
string = replaceMacros(string, macros, uriEncode, macrosToOverride);
|
||||
string = replaceMacros(string, macros, uriEncode, macroNameOverrides);
|
||||
|
||||
// Replace any remaining default values that have not already been replaced. This includes mediainfo custom fields.
|
||||
for (var macro in defaults) {
|
||||
|
@ -2694,8 +2777,16 @@
|
|||
// Listen to TCF changes
|
||||
listenToTcf();
|
||||
|
||||
// Initialize the US Privacy string
|
||||
obtainUsPrivacyString(function () {});
|
||||
|
||||
// Can be called for testing, or if the TCF CMP has loaded late
|
||||
player.ads.listenToTcf = listenToTcf;
|
||||
|
||||
// Expose so the US privacy string can be updated as needed
|
||||
player.ads.updateUsPrivacyString = function (callback) {
|
||||
return obtainUsPrivacyString(callback);
|
||||
};
|
||||
};
|
||||
|
||||
// Expose the contrib-ads version before it is initialized. Will be replaced
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue