diff --git a/build/minify_pdfjs.sh b/build/minify_pdfjs.sh index c4c8449a0..01c486f2e 100755 --- a/build/minify_pdfjs.sh +++ b/build/minify_pdfjs.sh @@ -11,8 +11,6 @@ java -jar build/closure-compiler-v20161201.jar --rewrite_polyfills false --langu java -jar build/closure-compiler-v20161201.jar --rewrite_polyfills false --language_out ECMASCRIPT5 --js src/third-party/doc/$DOC_STATIC_ASSETS_VERSION/pdf.worker.js --js_output_file src/third-party/doc/$DOC_STATIC_ASSETS_VERSION/pdf.worker.min.js java -jar build/closure-compiler-v20161201.jar --rewrite_polyfills false --language_out ECMASCRIPT5 --js src/third-party/doc/$DOC_STATIC_ASSETS_VERSION/pdf_viewer.js --js_output_file src/third-party/doc/$DOC_STATIC_ASSETS_VERSION/pdf_viewer.min.js - -java -jar build/closure-compiler-v20161201.jar --rewrite_polyfills false --language_out ECMASCRIPT5 --js src/third-party/doc/$DOC_STATIC_ASSETS_VERSION/compatibility.js --js_output_file src/third-party/doc/$DOC_STATIC_ASSETS_VERSION/compatibility.min.js echo "-----------------------------------------------------------------------------------" echo "Minifying pdf.js CSS with cssnano" echo "-----------------------------------------------------------------------------------" diff --git a/build/upgrade_pdfjs.sh b/build/upgrade_pdfjs.sh index 853342ea6..ff2884de8 100755 --- a/build/upgrade_pdfjs.sh +++ b/build/upgrade_pdfjs.sh @@ -16,7 +16,6 @@ git clone https://github.com/mozilla/pdfjs-dist.git echo "-----------------------------------------------------------------------------------" echo "Copying relevant files to Preview third-party dir..." -echo "Note that we are NOT copying compatibility.js - that needs to be manually updated" echo "-----------------------------------------------------------------------------------" cp pdfjs-dist/build/pdf.js src/third-party/doc/$DOC_STATIC_ASSETS_VERSION/ cp pdfjs-dist/build/pdf.worker.js src/third-party/doc/$DOC_STATIC_ASSETS_VERSION/ diff --git a/src/lib/viewers/doc/docAssets.js b/src/lib/viewers/doc/docAssets.js index ad36f022e..b03586cd8 100644 --- a/src/lib/viewers/doc/docAssets.js +++ b/src/lib/viewers/doc/docAssets.js @@ -2,7 +2,6 @@ import { DOC_STATIC_ASSETS_VERSION } from '../../constants'; const STATIC_URI = `third-party/doc/${DOC_STATIC_ASSETS_VERSION}/`; export const JS = [ - `${STATIC_URI}compatibility.min.js`, `${STATIC_URI}pdf.min.js`, `${STATIC_URI}pdf_viewer.min.js`, `${STATIC_URI}pdf.worker.min.js`, diff --git a/src/third-party/doc/0.118.0/compatibility.js b/src/third-party/doc/0.118.0/compatibility.js deleted file mode 100644 index bf9bb8032..000000000 --- a/src/third-party/doc/0.118.0/compatibility.js +++ /dev/null @@ -1,105 +0,0 @@ -/* Copyright 2012 Mozilla Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* eslint strict: ["error", "function"] */ -/* eslint-disable no-extend-native */ -/* globals VBArray, PDFJS */ - -(function compatibilityWrapper() { - 'use strict'; - -var userAgent = navigator.userAgent; - -var isAndroid = /Android/.test(userAgent); -var isIE = userAgent.indexOf('Trident') >= 0; -var isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent); -var isSafari = /Safari\//.test(userAgent) && - !/(Chrome\/|Android\s)/.test(userAgent); - -// Initializing PDFJS global object here, it case if we need to change/disable -// some PDF.js features, e.g. range requests -if (typeof PDFJS === 'undefined') { - (typeof window !== 'undefined' ? window : this).PDFJS = {}; -} - -// Checks if possible to use URL.createObjectURL() -// Support: IE -(function checkOnBlobSupport() { - // sometimes IE loosing the data created with createObjectURL(), see #3977 - if (isIE) { - PDFJS.disableCreateObjectURL = true; - } -})(); - -// Checks if navigator.language is supported -(function checkNavigatorLanguage() { - if ('language' in navigator) { - return; - } - PDFJS.locale = navigator.userLanguage || 'en-US'; -})(); - -// Support: IE<10, Android<4.0, iOS -(function checkRequestAnimationFrame() { - function fakeRequestAnimationFrame(callback) { - window.setTimeout(callback, 20); - } - - if (isIOS) { - // requestAnimationFrame on iOS is broken, replacing with fake one. - window.requestAnimationFrame = fakeRequestAnimationFrame; - return; - } - if ('requestAnimationFrame' in window) { - return; - } - window.requestAnimationFrame = - window.mozRequestAnimationFrame || - window.webkitRequestAnimationFrame || - fakeRequestAnimationFrame; -})(); - -// Support: Android, iOS -(function checkCanvasSizeLimitation() { - if (isIOS || isAndroid) { - // 5MP - PDFJS.maxCanvasPixels = 5242880; - } -})(); - -// Disable fullscreen support for certain problematic configurations. -// Support: IE11+ (when embedded). -(function checkFullscreenSupport() { - if (isIE && window.parent !== window) { - PDFJS.disableFullscreen = true; - } -})(); - -// Provides document.currentScript support -// Support: IE, Chrome<29. -(function checkCurrentScript() { - if ('currentScript' in document) { - return; - } - Object.defineProperty(document, 'currentScript', { - get: function () { - var scripts = document.getElementsByTagName('script'); - return scripts[scripts.length - 1]; - }, - enumerable: true, - configurable: true - }); -})(); - -}).call((typeof window === 'undefined') ? this : window); \ No newline at end of file diff --git a/src/third-party/doc/0.118.0/compatibility.min.js b/src/third-party/doc/0.118.0/compatibility.min.js deleted file mode 100644 index 97b11c8e3..000000000 --- a/src/third-party/doc/0.118.0/compatibility.min.js +++ /dev/null @@ -1,2 +0,0 @@ -(function(){var a=navigator.userAgent,d=/Android/.test(a),b=0<=a.indexOf("Trident"),c=/\b(iPad|iPhone|iPod)(?=;)/.test(a);/Safari\//.test(a)&&/(Chrome\/|Android\s)/.test(a);"undefined"===typeof PDFJS&&(("undefined"!==typeof window?window:this).PDFJS={});b&&(PDFJS.disableCreateObjectURL=!0);"language"in navigator||(PDFJS.locale=navigator.userLanguage||"en-US");(function(){function a(a){window.setTimeout(a,20)}c?window.requestAnimationFrame=a:"requestAnimationFrame"in window||(window.requestAnimationFrame= -window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||a)})();if(c||d)PDFJS.maxCanvasPixels=5242880;b&&window.parent!==window&&(PDFJS.disableFullscreen=!0);(function(){"currentScript"in document||Object.defineProperty(document,"currentScript",{get:function(){var a=document.getElementsByTagName("script");return a[a.length-1]},enumerable:!0,configurable:!0})})()}).call("undefined"===typeof window?this:window);