Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/embedpre.../assets/js
File: pdfobject.min.js
/**
[0] Fix | Delete
* PDFObject v2.2.6
[1] Fix | Delete
* https://github.com/pipwerks/PDFObject
[2] Fix | Delete
* @license
[3] Fix | Delete
* Copyright (c) 2008-2021 Philip Hutchison
[4] Fix | Delete
* MIT-style license: http://pipwerks.mit-license.org/
[5] Fix | Delete
* UMD module pattern from https://github.com/umdjs/umd/blob/master/templates/returnExports.js
[6] Fix | Delete
*/
[7] Fix | Delete
[8] Fix | Delete
(function (root, factory) {
[9] Fix | Delete
if (typeof define === "function" && define.amd) {
[10] Fix | Delete
// AMD. Register as an anonymous module.
[11] Fix | Delete
define([], factory);
[12] Fix | Delete
} else if (typeof module === "object" && module.exports) {
[13] Fix | Delete
// Node. Does not work with strict CommonJS, but
[14] Fix | Delete
// only CommonJS-like environments that support module.exports,
[15] Fix | Delete
// like Node.
[16] Fix | Delete
module.exports = factory();
[17] Fix | Delete
} else {
[18] Fix | Delete
// Browser globals (root is window)
[19] Fix | Delete
root.PDFObject = factory();
[20] Fix | Delete
}
[21] Fix | Delete
}(this, function () {
[22] Fix | Delete
[23] Fix | Delete
"use strict";
[24] Fix | Delete
[25] Fix | Delete
//PDFObject is designed for client-side (browsers), not server-side (node)
[26] Fix | Delete
//Will choke on undefined navigator and window vars when run on server
[27] Fix | Delete
//Return boolean false and exit function when running server-side
[28] Fix | Delete
[29] Fix | Delete
if( typeof window === "undefined" ||
[30] Fix | Delete
window.navigator === undefined ||
[31] Fix | Delete
window.navigator.userAgent === undefined ||
[32] Fix | Delete
window.navigator.mimeTypes === undefined){
[33] Fix | Delete
return false;
[34] Fix | Delete
}
[35] Fix | Delete
[36] Fix | Delete
let pdfobjectversion = "2.2.6";
[37] Fix | Delete
let nav = window.navigator;
[38] Fix | Delete
let ua = window.navigator.userAgent;
[39] Fix | Delete
[40] Fix | Delete
//Time to jump through hoops -- browser vendors do not make it easy to detect PDF support.
[41] Fix | Delete
[42] Fix | Delete
/*
[43] Fix | Delete
IE11 still uses ActiveX for Adobe Reader, but IE 11 doesn't expose window.ActiveXObject the same way
[44] Fix | Delete
previous versions of IE did. window.ActiveXObject will evaluate to false in IE 11, but "ActiveXObject"
[45] Fix | Delete
in window evaluates to true.
[46] Fix | Delete
[47] Fix | Delete
MS Edge does not support ActiveX so this test will evaluate false
[48] Fix | Delete
*/
[49] Fix | Delete
let isIE = ("ActiveXObject" in window);
[50] Fix | Delete
[51] Fix | Delete
/*
[52] Fix | Delete
There is a coincidental correlation between implementation of window.promises and native PDF support in desktop browsers
[53] Fix | Delete
We use this to assume if the browser supports promises it supports embedded PDFs
[54] Fix | Delete
Is this fragile? Sort of. But browser vendors removed mimetype detection, so we're left to improvise
[55] Fix | Delete
*/
[56] Fix | Delete
let isModernBrowser = (window.Promise !== undefined);
[57] Fix | Delete
[58] Fix | Delete
//Older browsers still expose the mimeType
[59] Fix | Delete
let supportsPdfMimeType = (nav.mimeTypes["application/pdf"] !== undefined);
[60] Fix | Delete
[61] Fix | Delete
//Safari on iPadOS doesn't report as 'mobile' when requesting desktop site, yet still fails to embed PDFs
[62] Fix | Delete
let isSafariIOSDesktopMode = ( nav.platform !== undefined &&
[63] Fix | Delete
nav.platform === "MacIntel" &&
[64] Fix | Delete
nav.maxTouchPoints !== undefined &&
[65] Fix | Delete
nav.maxTouchPoints > 1 );
[66] Fix | Delete
[67] Fix | Delete
//Quick test for mobile devices.
[68] Fix | Delete
let isMobileDevice = (isSafariIOSDesktopMode || /Mobi|Tablet|Android|iPad|iPhone/.test(ua));
[69] Fix | Delete
[70] Fix | Delete
//Safari desktop requires special handling
[71] Fix | Delete
let isSafariDesktop = ( !isMobileDevice &&
[72] Fix | Delete
nav.vendor !== undefined &&
[73] Fix | Delete
/Apple/.test(nav.vendor) &&
[74] Fix | Delete
/Safari/.test(ua) );
[75] Fix | Delete
[76] Fix | Delete
//Firefox started shipping PDF.js in Firefox 19. If this is Firefox 19 or greater, assume PDF.js is available
[77] Fix | Delete
let isFirefoxWithPDFJS = (!isMobileDevice && /irefox/.test(ua) && ua.split("rv:").length > 1) ? (parseInt(ua.split("rv:")[1].split(".")[0], 10) > 18) : false;
[78] Fix | Delete
[79] Fix | Delete
[80] Fix | Delete
/* ----------------------------------------------------
[81] Fix | Delete
Supporting functions
[82] Fix | Delete
---------------------------------------------------- */
[83] Fix | Delete
[84] Fix | Delete
let createAXO = function (type){
[85] Fix | Delete
var ax;
[86] Fix | Delete
try {
[87] Fix | Delete
ax = new ActiveXObject(type);
[88] Fix | Delete
} catch (e) {
[89] Fix | Delete
ax = null; //ensure ax remains null
[90] Fix | Delete
}
[91] Fix | Delete
return ax;
[92] Fix | Delete
};
[93] Fix | Delete
[94] Fix | Delete
//If either ActiveX support for "AcroPDF.PDF" or "PDF.PdfCtrl" are found, return true
[95] Fix | Delete
//Constructed as a method (not a prop) to avoid unneccesarry overhead -- will only be evaluated if needed
[96] Fix | Delete
let supportsPdfActiveX = function (){ return !!(createAXO("AcroPDF.PDF") || createAXO("PDF.PdfCtrl")); };
[97] Fix | Delete
[98] Fix | Delete
//Determines whether PDF support is available
[99] Fix | Delete
let supportsPDFs = (
[100] Fix | Delete
//As of Sept 2020 no mobile browsers properly support PDF embeds
[101] Fix | Delete
!isMobileDevice && (
[102] Fix | Delete
//We're moving into the age of MIME-less browsers. They mostly all support PDF rendering without plugins.
[103] Fix | Delete
isModernBrowser ||
[104] Fix | Delete
//Modern versions of Firefox come bundled with PDFJS
[105] Fix | Delete
isFirefoxWithPDFJS ||
[106] Fix | Delete
//Browsers that still support the original MIME type check
[107] Fix | Delete
supportsPdfMimeType ||
[108] Fix | Delete
//Pity the poor souls still using IE
[109] Fix | Delete
(isIE && supportsPdfActiveX())
[110] Fix | Delete
)
[111] Fix | Delete
);
[112] Fix | Delete
[113] Fix | Delete
//Create a fragment identifier for using PDF Open parameters when embedding PDF
[114] Fix | Delete
let buildURLFragmentString = function(pdfParams){
[115] Fix | Delete
[116] Fix | Delete
let string = "";
[117] Fix | Delete
let prop;
[118] Fix | Delete
[119] Fix | Delete
if(pdfParams){
[120] Fix | Delete
[121] Fix | Delete
for (prop in pdfParams) {
[122] Fix | Delete
if (pdfParams.hasOwnProperty(prop)) {
[123] Fix | Delete
string += encodeURIComponent(prop) + "=" + encodeURIComponent(pdfParams[prop]) + "&";
[124] Fix | Delete
}
[125] Fix | Delete
}
[126] Fix | Delete
[127] Fix | Delete
//The string will be empty if no PDF Params found
[128] Fix | Delete
if(string){
[129] Fix | Delete
[130] Fix | Delete
string = "#" + string;
[131] Fix | Delete
[132] Fix | Delete
//Remove last ampersand
[133] Fix | Delete
string = string.slice(0, string.length - 1);
[134] Fix | Delete
[135] Fix | Delete
}
[136] Fix | Delete
[137] Fix | Delete
}
[138] Fix | Delete
[139] Fix | Delete
return string;
[140] Fix | Delete
[141] Fix | Delete
};
[142] Fix | Delete
[143] Fix | Delete
let embedError = function (msg, suppressConsole){
[144] Fix | Delete
if(!suppressConsole){
[145] Fix | Delete
// console.log("[PDFObject] " + msg); //added by EP developer
[146] Fix | Delete
}
[147] Fix | Delete
return false;
[148] Fix | Delete
};
[149] Fix | Delete
[150] Fix | Delete
let emptyNodeContents = function (node){
[151] Fix | Delete
while(node.firstChild){
[152] Fix | Delete
node.removeChild(node.firstChild);
[153] Fix | Delete
}
[154] Fix | Delete
};
[155] Fix | Delete
[156] Fix | Delete
let getTargetElement = function (targetSelector){
[157] Fix | Delete
[158] Fix | Delete
//Default to body for full-browser PDF
[159] Fix | Delete
let targetNode = document.body;
[160] Fix | Delete
[161] Fix | Delete
//If a targetSelector is specified, check to see whether
[162] Fix | Delete
//it's passing a selector, jQuery object, or an HTML element
[163] Fix | Delete
[164] Fix | Delete
if(typeof targetSelector === "string"){
[165] Fix | Delete
[166] Fix | Delete
//Is CSS selector
[167] Fix | Delete
targetNode = document.querySelector(targetSelector);
[168] Fix | Delete
[169] Fix | Delete
} else if (window.jQuery !== undefined && targetSelector instanceof jQuery && targetSelector.length) {
[170] Fix | Delete
[171] Fix | Delete
//Is jQuery element. Extract HTML node
[172] Fix | Delete
targetNode = targetSelector.get(0);
[173] Fix | Delete
[174] Fix | Delete
} else if (targetSelector.nodeType !== undefined && targetSelector.nodeType === 1){
[175] Fix | Delete
[176] Fix | Delete
//Is HTML element
[177] Fix | Delete
targetNode = targetSelector;
[178] Fix | Delete
[179] Fix | Delete
}
[180] Fix | Delete
[181] Fix | Delete
return targetNode;
[182] Fix | Delete
[183] Fix | Delete
};
[184] Fix | Delete
[185] Fix | Delete
let generatePDFJSMarkup = function (targetNode, url, pdfOpenFragment, PDFJS_URL, id, omitInlineStyles){
[186] Fix | Delete
[187] Fix | Delete
//Ensure target element is empty first
[188] Fix | Delete
emptyNodeContents(targetNode);
[189] Fix | Delete
[190] Fix | Delete
let fullURL = PDFJS_URL + "?file=" + encodeURIComponent(url) + pdfOpenFragment;
[191] Fix | Delete
let div = document.createElement("div");
[192] Fix | Delete
let iframe = document.createElement("iframe");
[193] Fix | Delete
[194] Fix | Delete
iframe.src = fullURL;
[195] Fix | Delete
iframe.className = "pdfobject";
[196] Fix | Delete
iframe.type = "application/pdf";
[197] Fix | Delete
iframe.frameborder = "0";
[198] Fix | Delete
iframe.allow = "fullscreen";
[199] Fix | Delete
[200] Fix | Delete
if(id){
[201] Fix | Delete
iframe.id = id;
[202] Fix | Delete
}
[203] Fix | Delete
[204] Fix | Delete
if(!omitInlineStyles){
[205] Fix | Delete
div.style.cssText = "position: absolute; top: 0; right: 0; bottom: 0; left: 0;";
[206] Fix | Delete
iframe.style.cssText = "border: none; width: 100%; height: 100%;";
[207] Fix | Delete
targetNode.style.position = "relative";
[208] Fix | Delete
targetNode.style.overflow = "auto";
[209] Fix | Delete
}
[210] Fix | Delete
[211] Fix | Delete
div.appendChild(iframe);
[212] Fix | Delete
targetNode.appendChild(div);
[213] Fix | Delete
targetNode.classList.add("pdfobject-container");
[214] Fix | Delete
[215] Fix | Delete
return targetNode.getElementsByTagName("iframe")[0];
[216] Fix | Delete
[217] Fix | Delete
};
[218] Fix | Delete
[219] Fix | Delete
let generatePDFObjectMarkup = function (embedType, targetNode, targetSelector, url, pdfOpenFragment, width, height, id, title, omitInlineStyles){
[220] Fix | Delete
[221] Fix | Delete
//Ensure target element is empty first
[222] Fix | Delete
emptyNodeContents(targetNode);
[223] Fix | Delete
[224] Fix | Delete
let embed = document.createElement(embedType);
[225] Fix | Delete
if ('object' === embedType ) {
[226] Fix | Delete
embed.data = url + pdfOpenFragment;
[227] Fix | Delete
}else{
[228] Fix | Delete
embed.src = url + pdfOpenFragment;
[229] Fix | Delete
}
[230] Fix | Delete
embed.className = "pdfobject";
[231] Fix | Delete
embed.type = "application/pdf";
[232] Fix | Delete
embed.title = title;
[233] Fix | Delete
[234] Fix | Delete
if(id){
[235] Fix | Delete
embed.id = id;
[236] Fix | Delete
}
[237] Fix | Delete
[238] Fix | Delete
if(embedType === "iframe"){
[239] Fix | Delete
embed.allow = "fullscreen";
[240] Fix | Delete
}
[241] Fix | Delete
[242] Fix | Delete
if(!omitInlineStyles){
[243] Fix | Delete
[244] Fix | Delete
let style = (embedType === "embed") ? "overflow: auto;" : "border: none;";
[245] Fix | Delete
[246] Fix | Delete
if(targetSelector && targetSelector !== document.body){
[247] Fix | Delete
style += "width: " + width + "; height: " + height + ";";
[248] Fix | Delete
} else {
[249] Fix | Delete
style += "position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%;";
[250] Fix | Delete
}
[251] Fix | Delete
[252] Fix | Delete
embed.style.cssText = style;
[253] Fix | Delete
[254] Fix | Delete
}
[255] Fix | Delete
[256] Fix | Delete
targetNode.classList.add("pdfobject-container");
[257] Fix | Delete
targetNode.appendChild(embed);
[258] Fix | Delete
[259] Fix | Delete
return targetNode.getElementsByTagName(embedType)[0];
[260] Fix | Delete
[261] Fix | Delete
};
[262] Fix | Delete
[263] Fix | Delete
let embed = function(url, targetSelector, options){
[264] Fix | Delete
[265] Fix | Delete
//If targetSelector is not defined, convert to boolean
[266] Fix | Delete
let selector = targetSelector || false;
[267] Fix | Delete
[268] Fix | Delete
//Ensure options object is not undefined -- enables easier error checking below
[269] Fix | Delete
let opt = options || {};
[270] Fix | Delete
[271] Fix | Delete
//Get passed options, or set reasonable defaults
[272] Fix | Delete
let id = (typeof opt.id === "string") ? opt.id : "";
[273] Fix | Delete
let page = opt.page || false;
[274] Fix | Delete
let pdfOpenParams = opt.pdfOpenParams || {};
[275] Fix | Delete
let fallbackLink = opt.fallbackLink || true;
[276] Fix | Delete
let width = opt.width || "100%";
[277] Fix | Delete
let height = opt.height || "100%";
[278] Fix | Delete
let title = opt.title || "Embedded PDF";
[279] Fix | Delete
let assumptionMode = (typeof opt.assumptionMode === "boolean") ? opt.assumptionMode : true;
[280] Fix | Delete
let forcePDFJS = (typeof opt.forcePDFJS === "boolean") ? opt.forcePDFJS : false;
[281] Fix | Delete
let supportRedirect = (typeof opt.supportRedirect === "boolean") ? opt.supportRedirect : false;
[282] Fix | Delete
let omitInlineStyles = (typeof opt.omitInlineStyles === "boolean") ? opt.omitInlineStyles : false;
[283] Fix | Delete
let suppressConsole = (typeof opt.suppressConsole === "boolean") ? opt.suppressConsole : false;
[284] Fix | Delete
let forceIframe = (typeof opt.forceIframe === "boolean") ? opt.forceIframe : false;
[285] Fix | Delete
let forceObject = (typeof opt.forceObject === "boolean") ? opt.forceObject : false;
[286] Fix | Delete
let PDFJS_URL = opt.PDFJS_URL || false;
[287] Fix | Delete
let targetNode = getTargetElement(selector);
[288] Fix | Delete
let fallbackHTML = "";
[289] Fix | Delete
let pdfOpenFragment = "";
[290] Fix | Delete
let fallbackHTML_default = "<p>This browser does not support inline PDFs. Please download the PDF to view it: <a href='[url]'>Download PDF</a></p>";
[291] Fix | Delete
[292] Fix | Delete
//Ensure URL is available. If not, exit now.
[293] Fix | Delete
if(typeof url !== "string"){ return embedError("URL is not valid", suppressConsole); }
[294] Fix | Delete
[295] Fix | Delete
//If target element is specified but is not valid, exit without doing anything
[296] Fix | Delete
if(!targetNode){ return embedError("Target element cannot be determined", suppressConsole); }
[297] Fix | Delete
[298] Fix | Delete
//page option overrides pdfOpenParams, if found
[299] Fix | Delete
if(page){ pdfOpenParams.page = page; }
[300] Fix | Delete
[301] Fix | Delete
//Stringify optional Adobe params for opening document (as fragment identifier)
[302] Fix | Delete
pdfOpenFragment = buildURLFragmentString(pdfOpenParams);
[303] Fix | Delete
[304] Fix | Delete
[305] Fix | Delete
// --== Do the dance: Embed attempt #1 ==--
[306] Fix | Delete
[307] Fix | Delete
//If the forcePDFJS option is invoked, skip everything else and embed as directed
[308] Fix | Delete
if(forcePDFJS && PDFJS_URL){
[309] Fix | Delete
return generatePDFJSMarkup(targetNode, url, pdfOpenFragment, PDFJS_URL, id, omitInlineStyles);
[310] Fix | Delete
}
[311] Fix | Delete
[312] Fix | Delete
// --== Embed attempt #2 ==--
[313] Fix | Delete
[314] Fix | Delete
//Embed PDF if traditional support is provided, or if this developer is willing to roll with assumption
[315] Fix | Delete
//that modern desktop (not mobile) browsers natively support PDFs
[316] Fix | Delete
if(supportsPDFs || (assumptionMode && !isMobileDevice)){
[317] Fix | Delete
[318] Fix | Delete
//Should we use <embed> or <iframe>? In most cases <embed>.
[319] Fix | Delete
//Allow developer to force <iframe>, if desired
[320] Fix | Delete
//There is an edge case where Safari does not respect 302 redirect requests for PDF files when using <embed> element.
[321] Fix | Delete
//Redirect appears to work fine when using <iframe> instead of <embed> (Addresses issue #210)
[322] Fix | Delete
//Forcing Safari desktop to use iframe due to freezing bug in macOS 11 (Big Sur)
[323] Fix | Delete
let embedtype = (forceIframe || supportRedirect || isSafariDesktop) ? "iframe" : (forceObject ? "object" : "embed");
[324] Fix | Delete
return generatePDFObjectMarkup(embedtype, targetNode, targetSelector, url, pdfOpenFragment, width, height, id, title, omitInlineStyles);
[325] Fix | Delete
[326] Fix | Delete
}
[327] Fix | Delete
[328] Fix | Delete
// --== Embed attempt #3 ==--
[329] Fix | Delete
[330] Fix | Delete
//If everything else has failed and a PDFJS fallback is provided, try to use it
[331] Fix | Delete
if(PDFJS_URL){
[332] Fix | Delete
return generatePDFJSMarkup(targetNode, url, pdfOpenFragment, PDFJS_URL, id, omitInlineStyles);
[333] Fix | Delete
}
[334] Fix | Delete
[335] Fix | Delete
// --== PDF embed not supported! Use fallback ==--
[336] Fix | Delete
[337] Fix | Delete
//Display the fallback link if available
[338] Fix | Delete
if(fallbackLink){
[339] Fix | Delete
[340] Fix | Delete
fallbackHTML = (typeof fallbackLink === "string") ? fallbackLink : fallbackHTML_default;
[341] Fix | Delete
targetNode.innerHTML = fallbackHTML.replace(/\[url\]/g, url);
[342] Fix | Delete
[343] Fix | Delete
}
[344] Fix | Delete
[345] Fix | Delete
return embedError("This browser does not support embedded PDFs", suppressConsole);
[346] Fix | Delete
[347] Fix | Delete
};
[348] Fix | Delete
[349] Fix | Delete
return {
[350] Fix | Delete
embed: function (a,b,c){ return embed(a,b,c); },
[351] Fix | Delete
pdfobjectversion: (function () { return pdfobjectversion; })(),
[352] Fix | Delete
supportsPDFs: (function (){ return supportsPDFs; })()
[353] Fix | Delete
};
[354] Fix | Delete
[355] Fix | Delete
}));
[356] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function