2016-04-02 00:29:44 +09:00
|
|
|
/* Copyright 2016 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.
|
|
|
|
*/
|
2016-04-09 02:34:27 +09:00
|
|
|
/*globals require, chrome */
|
2016-04-02 00:29:44 +09:00
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var DEFAULT_URL = 'compressed.tracemonkey-pldi-09.pdf';
|
|
|
|
|
2016-04-09 02:34:27 +09:00
|
|
|
var pdfjsWebLibs = {};
|
|
|
|
(function () {
|
|
|
|
//#expand __BUNDLE__
|
|
|
|
}).call(pdfjsWebLibs);
|
|
|
|
|
|
|
|
//#if FIREFOX || MOZCENTRAL
|
|
|
|
//// FIXME the l10n.js file in the Firefox extension needs global FirefoxCom.
|
|
|
|
//window.FirefoxCom = pdfjsWebLibs.pdfjsWebFirefoxCom.FirefoxCom;
|
|
|
|
//#endif
|
2016-04-02 00:29:44 +09:00
|
|
|
|
|
|
|
//#if CHROME
|
|
|
|
//(function rewriteUrlClosure() {
|
|
|
|
// // Run this code outside DOMContentLoaded to make sure that the URL
|
|
|
|
// // is rewritten as soon as possible.
|
|
|
|
// var queryString = document.location.search.slice(1);
|
2016-04-09 02:34:27 +09:00
|
|
|
// var m = /(^|&)file=([^&]*)/.exec(queryString);
|
|
|
|
// DEFAULT_URL = m ? decodeURIComponent(m[2]) : '';
|
2016-04-02 00:29:44 +09:00
|
|
|
//
|
|
|
|
// // Example: chrome-extension://.../http://example.com/file.pdf
|
|
|
|
// var humanReadableUrl = '/' + DEFAULT_URL + location.hash;
|
|
|
|
// history.replaceState(history.state, '', humanReadableUrl);
|
|
|
|
// if (top === window) {
|
|
|
|
// chrome.runtime.sendMessage('showPageAction');
|
|
|
|
// }
|
|
|
|
//})();
|
|
|
|
//#endif
|
|
|
|
|
|
|
|
function webViewerLoad() {
|
|
|
|
//#if !PRODUCTION
|
2016-04-09 02:34:27 +09:00
|
|
|
require.config({paths: {'pdfjs': '../src', 'pdfjs-web': '.'}});
|
|
|
|
require(['pdfjs/main_loader', 'pdfjs-web/app'], function (loader, web) {
|
2016-03-29 06:44:27 +09:00
|
|
|
window.pdfjsLib = loader;
|
2016-04-09 02:34:27 +09:00
|
|
|
window.PDFViewerApplication = web.PDFViewerApplication;
|
|
|
|
web.PDFViewerApplication.run();
|
2016-04-02 00:29:44 +09:00
|
|
|
});
|
|
|
|
//#else
|
2016-03-29 06:44:27 +09:00
|
|
|
//window.pdfjsLib = window.pdfjsDistBuildPdf;
|
2016-04-09 02:34:27 +09:00
|
|
|
//window.PDFViewerApplication = pdfjsWebLibs.pdfjsWebApp.PDFViewerApplication;
|
|
|
|
//pdfjsWebLibs.pdfjsWebApp.PDFViewerApplication.run();
|
2016-04-02 00:29:44 +09:00
|
|
|
//#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
document.addEventListener('DOMContentLoaded', webViewerLoad, true);
|