2011-10-26 10:18:22 +09:00
|
|
|
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
|
2012-09-01 07:48:21 +09:00
|
|
|
/* 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.
|
|
|
|
*/
|
2013-08-13 02:48:06 +09:00
|
|
|
/* globals PDFJS, Util */
|
2011-10-26 10:18:22 +09:00
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
2011-12-22 23:40:00 +09:00
|
|
|
// List of files to include;
|
|
|
|
var files = [
|
2013-08-13 02:48:06 +09:00
|
|
|
'shared/util.js',
|
|
|
|
'shared/colorspace.js',
|
|
|
|
'shared/pattern.js',
|
|
|
|
'shared/function.js',
|
|
|
|
'shared/annotation.js',
|
|
|
|
'core/network.js',
|
|
|
|
'core/chunked_stream.js',
|
|
|
|
'core/pdf_manager.js',
|
|
|
|
'core/core.js',
|
|
|
|
'core/obj.js',
|
|
|
|
'core/charsets.js',
|
|
|
|
'core/cidmaps.js',
|
|
|
|
'core/crypto.js',
|
|
|
|
'core/evaluator.js',
|
2013-09-26 02:32:04 +09:00
|
|
|
'core/cmap.js',
|
2013-08-13 02:48:06 +09:00
|
|
|
'core/fonts.js',
|
2013-08-20 08:33:20 +09:00
|
|
|
'core/font_renderer.js',
|
2013-08-13 02:48:06 +09:00
|
|
|
'core/glyphlist.js',
|
|
|
|
'core/image.js',
|
|
|
|
'core/metrics.js',
|
|
|
|
'core/parser.js',
|
|
|
|
'core/stream.js',
|
|
|
|
'core/worker.js',
|
|
|
|
'core/jpx.js',
|
|
|
|
'core/jbig2.js',
|
|
|
|
'core/bidi.js',
|
2012-04-26 20:28:38 +09:00
|
|
|
'../external/jpgjs/jpg.js'
|
2011-12-22 23:40:00 +09:00
|
|
|
];
|
|
|
|
|
2013-08-13 02:48:06 +09:00
|
|
|
function loadInOrder(index, path, files) {
|
|
|
|
if (index >= files.length) {
|
|
|
|
PDFJS.fakeWorkerFilesLoadedPromise.resolve();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// Skip shared files since they will already be loaded.
|
|
|
|
if (files[index].indexOf('shared/') >= 0) {
|
|
|
|
loadInOrder(++index, path, files);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Util.loadScript(path + files[index],
|
|
|
|
loadInOrder.bind(null, ++index, path, files));
|
|
|
|
}
|
|
|
|
|
2011-12-22 23:40:00 +09:00
|
|
|
// Load all the files.
|
2013-08-13 02:48:06 +09:00
|
|
|
if (typeof PDFJS === 'undefined' || !PDFJS.fakeWorkerFilesLoadedPromise) {
|
|
|
|
for (var i = 0; i < files.length; i++) {
|
|
|
|
importScripts(files[i]);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
var src = PDFJS.workerSrc;
|
|
|
|
loadInOrder(0, src.substr(0, src.indexOf('worker_loader.js')), files);
|
2011-11-03 07:00:08 +09:00
|
|
|
}
|