summaryrefslogtreecommitdiff
path: root/addons/website_slides/static/lib/pdfjs/worker_loader.js
diff options
context:
space:
mode:
authorMantavya Gajjar <mga@openerp.com>2014-08-21 17:46:21 +0530
committerThibault Delavallée <tde@openerp.com>2015-01-16 16:01:59 +0100
commit51be5bbfb38db784cb3406877cc0e8806b1bf55a (patch)
tree350f81248ccd5a7d1cfc00521333ef8642847dda /addons/website_slides/static/lib/pdfjs/worker_loader.js
parentcec43b93d24429385af3de73ff05b2a5ebf4e122 (diff)
[ADD] website_slides: new website module to handle presentations, documents,
videos, infographics. Some kind of slideshare clone, to summarize. Featuring : - channel management: classify slides (presentations, videos, documents, ...) and tune their access rights for visibility, uploading and downloading - full branding new shiny website module ! - automatic fetch of youtube and google docs information based on URL - statistics: views, likes, interfaced with messaging, ... - embed mechanism to embed slides in other websites Courtesy of RD India, notably Mantavya Gajjar, Ravi Gadhia, Vijay Patel, Pariket Trivedi Courtesy of Use Merge Team, notably Jerome Maes and Richard Mathot Let us not forget our usability testing teams that tested it quite a lot of time. Special thanks to Martin Trigaux that did nothing.
Diffstat (limited to 'addons/website_slides/static/lib/pdfjs/worker_loader.js')
-rw-r--r--addons/website_slides/static/lib/pdfjs/worker_loader.js81
1 files changed, 81 insertions, 0 deletions
diff --git a/addons/website_slides/static/lib/pdfjs/worker_loader.js b/addons/website_slides/static/lib/pdfjs/worker_loader.js
new file mode 100644
index 00000000000..21f05bd1963
--- /dev/null
+++ b/addons/website_slides/static/lib/pdfjs/worker_loader.js
@@ -0,0 +1,81 @@
+/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
+/* 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.
+ */
+ /* globals PDFJS, Util */
+
+'use strict';
+
+// List of shared files to include;
+var sharedFiles = [
+ 'shared/util.js'
+];
+
+// List of other files to include;
+var otherFiles = [
+ 'core/network.js',
+ 'core/chunked_stream.js',
+ 'core/pdf_manager.js',
+ 'core/core.js',
+ 'core/obj.js',
+ 'core/charsets.js',
+ 'core/annotation.js',
+ 'core/function.js',
+ 'core/colorspace.js',
+ 'core/crypto.js',
+ 'core/pattern.js',
+ 'core/evaluator.js',
+ 'core/cmap.js',
+ 'core/fonts.js',
+ 'core/font_renderer.js',
+ 'core/glyphlist.js',
+ 'core/image.js',
+ 'core/metrics.js',
+ 'core/parser.js',
+ 'core/ps_parser.js',
+ 'core/stream.js',
+ 'core/worker.js',
+ 'core/arithmetic_decoder.js',
+ 'core/jpg.js',
+ 'core/jpx.js',
+ 'core/jbig2.js',
+ 'core/bidi.js',
+ 'core/murmurhash3.js'
+];
+
+function loadInOrder(index, path, files) {
+ if (index >= files.length) {
+ PDFJS.fakeWorkerFilesLoadedCapability.resolve();
+ return;
+ }
+ PDFJS.Util.loadScript(path + files[index],
+ loadInOrder.bind(null, ++index, path, files));
+}
+
+// Load all the files.
+if (typeof PDFJS === 'undefined' || !PDFJS.fakeWorkerFilesLoadedCapability) {
+ var files = sharedFiles.concat(otherFiles);
+ for (var i = 0; i < files.length; i++) {
+ importScripts(files[i]);
+ }
+} else {
+ var src = PDFJS.workerSrc;
+ var path = src.substr(0, src.indexOf('worker_loader.js'));
+ // If Util is available, we assume that shared files are already loaded. Can
+ // happen that they are not if PDF.js is bundled inside a special namespace.
+ var skipShared = typeof Util !== 'undefined';
+ var files = skipShared ? otherFiles : sharedFiles.concat(otherFiles);
+ loadInOrder(0, path, files);
+}