diff --git a/bower.json b/bower.json index dc20bcc..c58111e 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "pdfobject", "description": "An open-source standards-friendly JavaScript utility for embedding PDF files into HTML documents", - "version": "2.2.10", + "version": "2.2.11", "main": "pdfobject.js", "moduleType": [ "globals", diff --git a/package-lock.json b/package-lock.json index 52a7f8d..90d60f9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "pdfobject", - "version": "2.2.10", + "version": "2.2.11", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "pdfobject", - "version": "2.2.10", + "version": "2.2.11", "license": "MIT", "devDependencies": { "uglify-es": "^3.3.9" diff --git a/package.json b/package.json index ad2882d..6a38359 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pdfobject", - "version": "2.2.10", + "version": "2.2.11", "description": "An open-source standards-friendly JavaScript utility for embedding PDF files into HTML documents", "main": "pdfobject.js", "scripts": { diff --git a/pdfobject.js b/pdfobject.js index fad3471..943b9e3 100644 --- a/pdfobject.js +++ b/pdfobject.js @@ -1,5 +1,5 @@ /** - * PDFObject v2.2.10 + * PDFObject v2.2.11 * https://github.com/pipwerks/PDFObject * @license * Copyright (c) 2008-2023 Philip Hutchison @@ -35,7 +35,7 @@ return false; } - let pdfobjectversion = "2.2.8"; + let pdfobjectversion = "2.2.11"; let nav = window.navigator; let ua = window.navigator.userAgent; diff --git a/pdfobject.min.js b/pdfobject.min.js index 517426a..0fe20d1 100644 --- a/pdfobject.min.js +++ b/pdfobject.min.js @@ -1,9 +1,9 @@ /** - * PDFObject v2.2.10 + * PDFObject v2.2.11 * https://github.com/pipwerks/PDFObject * @license * Copyright (c) 2008-2023 Philip Hutchison * MIT-style license: http://pipwerks.mit-license.org/ * UMD module pattern from https://github.com/umdjs/umd/blob/master/templates/returnExports.js */ -!function(root,factory){"function"==typeof define&&define.amd?define([],factory):"object"==typeof module&&module.exports?module.exports=factory():root.PDFObject=factory()}(this,function(){"use strict";if("undefined"==typeof window||void 0===window.navigator||void 0===window.navigator.userAgent||void 0===window.navigator.mimeTypes)return!1;let nav=window.navigator,ua=window.navigator.userAgent,isIE="ActiveXObject"in window,isModernBrowser=void 0!==window.Promise,supportsPdfMimeType=void 0!==nav.mimeTypes["application/pdf"],isMobileDevice=void 0!==nav.platform&&"MacIntel"===nav.platform&&void 0!==nav.maxTouchPoints&&nav.maxTouchPoints>1||/Mobi|Tablet|Android|iPad|iPhone/.test(ua),isSafariDesktop=!isMobileDevice&&void 0!==nav.vendor&&/Apple/.test(nav.vendor)&&/Safari/.test(ua),isFirefoxWithPDFJS=!!(!isMobileDevice&&/irefox/.test(ua)&&ua.split("rv:").length>1)&&parseInt(ua.split("rv:")[1].split(".")[0],10)>18,createAXO=function(type){var ax;try{ax=new ActiveXObject(type)}catch(e){ax=null}return ax},supportsPDFs=!isMobileDevice&&(isModernBrowser||isFirefoxWithPDFJS||supportsPdfMimeType||isIE&&!(!createAXO("AcroPDF.PDF")&&!createAXO("PDF.PdfCtrl"))),embedError=function(msg,suppressConsole){return suppressConsole||console.log("[PDFObject] "+msg),!1},generatePDFObjectMarkup=function(embedType,targetNode,url,pdfOpenFragment,width,height,id,title,omitInlineStyles,customAttribute,PDFJS_URL){!function(node){for(;node.firstChild;)node.removeChild(node.firstChild)}(targetNode);let source=url;if("pdfjs"===embedType){source=PDFJS_URL+(-1!==PDFJS_URL.indexOf("?")?"&":"?")+"file="+encodeURIComponent(url)+pdfOpenFragment}else source+=pdfOpenFragment;let el_type="pdfjs"===embedType||"iframe"===embedType?"iframe":"embed",el=document.createElement(el_type);if(el.className="pdfobject",el.type="application/pdf",el.title=title,el.src=source,id&&(el.id=id),"iframe"===el_type&&(el.allow="fullscreen",el.frameborder="0"),!omitInlineStyles){let style="embed"===el_type?"overflow: auto;":"border: none;";targetNode!==document.body?style+="width: "+width+"; height: "+height+";":style+="position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%;",el.style.cssText=style}return customAttribute&&customAttribute.key&&["className","type","title","src","style","id","allow","frameborder"].every(token=>!customAttribute.key.includes(token))&&el.setAttribute(customAttribute.key,void 0!==customAttribute.value?customAttribute.value:""),targetNode.classList.add("pdfobject-container"),targetNode.appendChild(el),targetNode.getElementsByTagName(el_type)[0]},embed=function(url,targetSelector,options){let selector=targetSelector||!1,opt=options||{},id="string"==typeof opt.id?opt.id:"",page=opt.page||!1,pdfOpenParams=opt.pdfOpenParams||{},fallbackLink="string"!=typeof opt.fallbackLink&&"boolean"!=typeof opt.fallbackLink||opt.fallbackLink,width=opt.width||"100%",height=opt.height||"100%",title=opt.title||"Embedded PDF",assumptionMode="boolean"!=typeof opt.assumptionMode||opt.assumptionMode,forcePDFJS="boolean"==typeof opt.forcePDFJS&&opt.forcePDFJS,supportRedirect="boolean"==typeof opt.supportRedirect&&opt.supportRedirect,omitInlineStyles="boolean"==typeof opt.omitInlineStyles&&opt.omitInlineStyles,suppressConsole="boolean"==typeof opt.suppressConsole&&opt.suppressConsole,forceIframe="boolean"==typeof opt.forceIframe&&opt.forceIframe,PDFJS_URL=opt.PDFJS_URL||!1,targetNode=function(targetSelector){let targetNode=document.body;return"string"==typeof targetSelector?targetNode=document.querySelector(targetSelector):void 0!==window.jQuery&&targetSelector instanceof jQuery&&targetSelector.length?targetNode=targetSelector.get(0):void 0!==targetSelector.nodeType&&1===targetSelector.nodeType&&(targetNode=targetSelector),targetNode}(selector),fallbackHTML="",pdfOpenFragment="",customAttribute=opt.customAttribute||{};if("string"!=typeof url)return embedError("URL is not valid",suppressConsole);if(!targetNode)return embedError("Target element cannot be determined",suppressConsole);if(page&&(pdfOpenParams.page=page),pdfOpenFragment=function(pdfParams){let prop,string="";if(pdfParams){for(prop in pdfParams)pdfParams.hasOwnProperty(prop)&&(string+=encodeURIComponent(prop)+"="+encodeURIComponent(pdfParams[prop])+"&");string&&(string=(string="#"+string).slice(0,string.length-1))}return string}(pdfOpenParams),forcePDFJS&&PDFJS_URL)return generatePDFObjectMarkup("pdfjs",targetNode,url,pdfOpenFragment,width,height,id,title,omitInlineStyles,customAttribute,PDFJS_URL);if(supportsPDFs||assumptionMode&&!isMobileDevice){return generatePDFObjectMarkup(forceIframe||supportRedirect||isSafariDesktop?"iframe":"embed",targetNode,url,pdfOpenFragment,width,height,id,title,omitInlineStyles,customAttribute)}return PDFJS_URL?generatePDFObjectMarkup("pdfjs",targetNode,url,pdfOpenFragment,width,height,id,title,omitInlineStyles,customAttribute,PDFJS_URL):(fallbackLink&&(fallbackHTML="string"==typeof fallbackLink?fallbackLink:"

This browser does not support inline PDFs. Please download the PDF to view it: Download PDF

",targetNode.innerHTML=fallbackHTML.replace(/\[url\]/g,url)),embedError("This browser does not support embedded PDFs",suppressConsole))};return{embed:function(a,b,c){return embed(a,b,c)},pdfobjectversion:"2.2.8",supportsPDFs:supportsPDFs}}); \ No newline at end of file +!function(root,factory){"function"==typeof define&&define.amd?define([],factory):"object"==typeof module&&module.exports?module.exports=factory():root.PDFObject=factory()}(this,function(){"use strict";if("undefined"==typeof window||void 0===window.navigator||void 0===window.navigator.userAgent||void 0===window.navigator.mimeTypes)return!1;let nav=window.navigator,ua=window.navigator.userAgent,isIE="ActiveXObject"in window,isModernBrowser=void 0!==window.Promise,supportsPdfMimeType=void 0!==nav.mimeTypes["application/pdf"],isMobileDevice=void 0!==nav.platform&&"MacIntel"===nav.platform&&void 0!==nav.maxTouchPoints&&nav.maxTouchPoints>1||/Mobi|Tablet|Android|iPad|iPhone/.test(ua),isSafariDesktop=!isMobileDevice&&void 0!==nav.vendor&&/Apple/.test(nav.vendor)&&/Safari/.test(ua),isFirefoxWithPDFJS=!!(!isMobileDevice&&/irefox/.test(ua)&&ua.split("rv:").length>1)&&parseInt(ua.split("rv:")[1].split(".")[0],10)>18,createAXO=function(type){var ax;try{ax=new ActiveXObject(type)}catch(e){ax=null}return ax},supportsPDFs=!isMobileDevice&&(isModernBrowser||isFirefoxWithPDFJS||supportsPdfMimeType||isIE&&!(!createAXO("AcroPDF.PDF")&&!createAXO("PDF.PdfCtrl"))),embedError=function(msg,suppressConsole){return suppressConsole||console.log("[PDFObject] "+msg),!1},generatePDFObjectMarkup=function(embedType,targetNode,url,pdfOpenFragment,width,height,id,title,omitInlineStyles,customAttribute,PDFJS_URL){!function(node){for(;node.firstChild;)node.removeChild(node.firstChild)}(targetNode);let source=url;if("pdfjs"===embedType){source=PDFJS_URL+(-1!==PDFJS_URL.indexOf("?")?"&":"?")+"file="+encodeURIComponent(url)+pdfOpenFragment}else source+=pdfOpenFragment;let el_type="pdfjs"===embedType||"iframe"===embedType?"iframe":"embed",el=document.createElement(el_type);if(el.className="pdfobject",el.type="application/pdf",el.title=title,el.src=source,id&&(el.id=id),"iframe"===el_type&&(el.allow="fullscreen",el.frameborder="0"),!omitInlineStyles){let style="embed"===el_type?"overflow: auto;":"border: none;";targetNode!==document.body?style+="width: "+width+"; height: "+height+";":style+="position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%;",el.style.cssText=style}return customAttribute&&customAttribute.key&&["className","type","title","src","style","id","allow","frameborder"].every(token=>!customAttribute.key.includes(token))&&el.setAttribute(customAttribute.key,void 0!==customAttribute.value?customAttribute.value:""),targetNode.classList.add("pdfobject-container"),targetNode.appendChild(el),targetNode.getElementsByTagName(el_type)[0]},embed=function(url,targetSelector,options){let selector=targetSelector||!1,opt=options||{},id="string"==typeof opt.id?opt.id:"",page=opt.page||!1,pdfOpenParams=opt.pdfOpenParams||{},fallbackLink="string"!=typeof opt.fallbackLink&&"boolean"!=typeof opt.fallbackLink||opt.fallbackLink,width=opt.width||"100%",height=opt.height||"100%",title=opt.title||"Embedded PDF",assumptionMode="boolean"!=typeof opt.assumptionMode||opt.assumptionMode,forcePDFJS="boolean"==typeof opt.forcePDFJS&&opt.forcePDFJS,supportRedirect="boolean"==typeof opt.supportRedirect&&opt.supportRedirect,omitInlineStyles="boolean"==typeof opt.omitInlineStyles&&opt.omitInlineStyles,suppressConsole="boolean"==typeof opt.suppressConsole&&opt.suppressConsole,forceIframe="boolean"==typeof opt.forceIframe&&opt.forceIframe,PDFJS_URL=opt.PDFJS_URL||!1,targetNode=function(targetSelector){let targetNode=document.body;return"string"==typeof targetSelector?targetNode=document.querySelector(targetSelector):void 0!==window.jQuery&&targetSelector instanceof jQuery&&targetSelector.length?targetNode=targetSelector.get(0):void 0!==targetSelector.nodeType&&1===targetSelector.nodeType&&(targetNode=targetSelector),targetNode}(selector),fallbackHTML="",pdfOpenFragment="",customAttribute=opt.customAttribute||{};if("string"!=typeof url)return embedError("URL is not valid",suppressConsole);if(!targetNode)return embedError("Target element cannot be determined",suppressConsole);if(page&&(pdfOpenParams.page=page),pdfOpenFragment=function(pdfParams){let prop,string="";if(pdfParams){for(prop in pdfParams)pdfParams.hasOwnProperty(prop)&&(string+=encodeURIComponent(prop)+"="+encodeURIComponent(pdfParams[prop])+"&");string&&(string=(string="#"+string).slice(0,string.length-1))}return string}(pdfOpenParams),forcePDFJS&&PDFJS_URL)return generatePDFObjectMarkup("pdfjs",targetNode,url,pdfOpenFragment,width,height,id,title,omitInlineStyles,customAttribute,PDFJS_URL);if(supportsPDFs||assumptionMode&&!isMobileDevice){return generatePDFObjectMarkup(forceIframe||supportRedirect||isSafariDesktop?"iframe":"embed",targetNode,url,pdfOpenFragment,width,height,id,title,omitInlineStyles,customAttribute)}return PDFJS_URL?generatePDFObjectMarkup("pdfjs",targetNode,url,pdfOpenFragment,width,height,id,title,omitInlineStyles,customAttribute,PDFJS_URL):(fallbackLink&&(fallbackHTML="string"==typeof fallbackLink?fallbackLink:"

This browser does not support inline PDFs. Please download the PDF to view it: Download PDF

",targetNode.innerHTML=fallbackHTML.replace(/\[url\]/g,url)),embedError("This browser does not support embedded PDFs",suppressConsole))};return{embed:function(a,b,c){return embed(a,b,c)},pdfobjectversion:"2.2.11",supportsPDFs:supportsPDFs}}); \ No newline at end of file diff --git a/readme.md b/readme.md index b3693cb..63519e9 100644 --- a/readme.md +++ b/readme.md @@ -11,6 +11,9 @@ MIT-style license: http://pipwerks.mit-license.org/ ## Changelog +### 2.2.11, May 2023 +Typo in version number within PDFObject code. Yup, I'm a bit rusty. + ### 2.2.10, May 2023 Version bump for cleaning up docs and aligning on NPM. I'm a bit rusty.