[
  {
    "path": ".gitignore",
    "content": "bin/\nnode_modules/\nbower_components/\ndemo/node_modules/\ndemo/bower_components/\n"
  },
  {
    "path": "Gruntfile.js",
    "content": "module.exports = function (grunt) {\n  'use strict';\n\n  var escapeContent = function(content, quoteChar) {\n    var bsRegexp = new RegExp('\\\\\\\\', 'g');\n    var quoteRegexp = new RegExp('\\\\' + quoteChar, 'g');\n    var trimRegexp = new RegExp('\\\\s*\\\\+\\\\s*\\\\n' + quoteChar + '$');\n    var nlReplace = '\\\\n' + quoteChar + ' +\\n' + quoteChar;\n    return '\\'' + content.replace(bsRegexp, '\\\\\\\\').replace(quoteRegexp, '\\\\' + quoteChar).replace(/\\r?\\n/g, nlReplace).replace(trimRegexp, '') + '\\'';\n  };\n\n  // Project configuration.\n  grunt.initConfig({\n    replace: {\n      dist: {\n        options: {\n          patterns: [\n            {\n              match: /templateUrl:.*/,\n              replacement: function () {\n              \tvar content = grunt.file.read('vendor/pdf.js-viewer/viewer.html');\n              \treturn 'template: ' + escapeContent(content, '\\'') + ',';\n              }\n            },\n            {\n              match: /=== get current script file ===[\\w\\W]+======/,\n              replacement: ''\n            }\n          ]\n        },\n        files: [\n          {expand: true, flatten: true, src: ['src/angular-pdfjs-viewer.js'], dest: 'dist/'}\n        ]\n      }\n    }\n  });\n\n  /** \n   * Load required Grunt tasks. These are installed based on the versions listed\n   * in `package.json` when you do `npm install` in this directory.\n   */\n  grunt.loadNpmTasks('grunt-replace');\n\n  // Default task(s).\n  grunt.registerTask('default', ['replace']);\n};\n"
  },
  {
    "path": "LICENSE",
    "content": "Copyright (c) LegalThings <info@legalthings.io>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is furnished\nto do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "# PDF.js viewer Angular directive\n\nEmbed Mozilla's [PDF.js](https://mozilla.github.io/pdf.js/) viewer into your angular application, maintaining that look and feel\nof pdf's we all love. The directive embeds the [full viewer](https://mozilla.github.io/pdf.js/web/viewer.html), which\nallows you to scroll through the pdf.\n\n## Low maintenance\nWe're no longer using this library ourselves. We'll merge pull requests and create new releases, but not actively solve\nissues.\n\n![viewer-example](https://cloud.githubusercontent.com/assets/5793511/24605022/6dd5abee-1867-11e7-881a-0d68dc7c77f3.png)\n\n## Installation\n     npm install angular-pdfjs-viewer --save\n\n### Browser supperort\nChrome, FireFox, Safari and Egde.\n\n## Usage\nBelow you will find a basic example of how the directive can be used.\nNote that the order of the scripts matters. Stick to the order of dependencies as shown in the example below.\nAlso note that images, translations and such are being loaded from the `web` folder.\n\n### View\n```html\n<!DOCTYPE html>\n<html ng-app=\"app\" ng-controller=\"AppCtrl\">\n    <head>\n        <title>Angular PDF.js demo</title>\n        <script src=\"bower_components/pdf.js-viewer/pdf.js\"></script>\n        <link rel=\"stylesheet\" href=\"bower_components/pdf.js-viewer/viewer.css\">\n\n        <script src=\"bower_components/angular/angular.js\"></script>\n        <script src=\"bower_components/angular-pdfjs-viewer/dist/angular-pdfjs-viewer.js\"></script>\n        <script src=\"app.js\"></script>\n\n        <style>\n          html, body { height: 100%; width: 100%; margin: 0; padding: 0; }\n          .some-pdf-container { width: 100%; height: 100%; }\n        </style>\n    </head>\n    <body>\n        <div class=\"some-pdf-container\">\n            <pdfjs-viewer src=\"{{ pdf.src }}\"></pdfjs-viewer>\n        </div>\n    </body>\n</html>\n```\n\n### Controller\n```js\nangular.module('app', ['pdfjsViewer']);\n\nangular.module('app').controller('AppCtrl', function($scope) {\n    $scope.pdf = {\n        src: 'example.pdf',\n    };\n});\n```\n\n## Directive options\nThe `<pdfjs-viewer>` directive takes the following attributes.\n\n\n#### `src`\nThe source should point to the URL of a publicly available pdf.\nNote that the `src` must be passed in as an interpolation string.\n\n```html\n<pdfjs-viewer src=\"{{ pdf.src }}\"></pdfjs-viewer>\n```\n\n```javascript\n$scope.pdf.src = \"http://example.com/file.pdf\";\n```\n---\n\n#### `data`\nIn the case that you cannot simply use the URL of the pdf, you can pass in raw data as\na [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) object.\nThe `data` attribute takes a scope variable as its argument.\n\n```html\n<pdfjs-viewer data=\"pdf.data\"></pdfjs-viewer>\n```\n\n```javascript\n$scope.data = null; // this is loaded async\n\n$http.get(\"http://example.com/file.pdf\", {\n    responseType: 'arraybuffer'\n}).then(function (response) {\n    $scope.pdf.data = new Uint8Array(response.data);\n});\n```\n---\n\n#### `scale`\nThe `scale` attribute can be used to obtain the current scale (zoom level) of the PDF.\nThe value will be stored in the variable specified. **This is read only**.\n\n```html\n<pdfjs-viewer scale=\"scale\"></pdfjs-viewer>\n```\n---\n\n#### `download, print, open`\nThese buttons are by default all visible in the toolbar and can be hidden.\n\n```html\n<pdfjs-viewer download=\"false\" print=\"false\" ... ></pdfjs-viewer>\n```\n---\n\n#### `on-init`\nThe `on-init` function is called when PDF.JS is fully loaded.\n\n```html\n<pdfjs-viewer on-init=\"onInit()\"></pdfjs-viewer>\n```\n\n```javascript\n$scope.onInit = function () {\n  // pdf.js is initialized\n}\n```\n---\n\n#### `on-page-load`\nThe `on-page-load` function is each time a page is loaded and will pass the page number.\nWhen the scale changes all pages are unloaded, so `on-page-load` will be called again for each page.\n_If `onPageLoad()` returns `false`, the page will not be marked as loaded and `onPageLoad` will be called again for that page on the next (200ms) interval._\n\n```html\n<pdfjs-viewer on-page-load=\"onPageLoad(page)\"></pdfjs-viewer>\n```\n\n```javascript\n$scope.onPageLoad = function (page) {\n    // page is loaded\n};\n```\n---\n\n## Styling\nThe `<pdfjs-viewer>` directive automatically expands to the height and width of its first immediate parent, in the case of the example `.some-pdf-container`.\nIf no parent container is given the html `body` will be used. Height and width are required to properly display the contents of the pdf.\n\n## Demo\nYou can test out a [demo](https://github.com/legalthings/angular-pdfjs-viewer/tree/master/demo) of this directive.\nYou must run the node server first due to CORS. First make sure the dependencies are installed.\n\n    cd demo\n    npm install\n    bower install\n\nAfterwards run the server like so.\n\n    node server.js\n\nThe server will be running on localhost:8080\n\n## Advanced configuration\nBy default the location of PDF.js assets are automatically determined. However if you place them on alternative\nlocations they may not be found. If so, you can configure these locations.\n\nYou may disable using the [Web Workers API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API).\nThis is useful if you want to add pdf.worker.js to your concatenated JavaScript file. However this will have a\nnegative effect on the runtime performance.\n\nAs part of your build process you might include all your library scripts within a concatenated Javascript file whilst excluding the pdf.worker.js file.  Use setWorkerSrc() to point to the pdf.worker.js script. \n\n    angular.module('app').config(function(pdfjsViewerConfigProvider) {\n      pdfjsViewerConfigProvider.setWorkerSrc(\"/assets/pdf.js-viewer/pdf.worker.js\");\n      pdfjsViewerConfigProvider.setCmapDir(\"/assets/pdf.js-viewer/cmaps\");\n      pdfjsViewerConfigProvider.setImageDir(\"/assets/pdf.js-viewer/images\");\n      \n      pdfjsViewerConfigProvider.disableWorker();\n      pdfjsViewerConfigProvider.setVerbosity(\"infos\");  // \"errors\", \"warnings\" or \"infos\"\n    });\n\nNote that a number of images used in the PDF.js viewer are loaded by the `viewer.css`. You can't configure these\nthrough JavaScript. Instead you need to compile the `viewer.less` file as\n\n    lessc --global-var='pdfjsImagePath=/assets/pdf.js-viewer/images' viewer.less viewer.css\n"
  },
  {
    "path": "demo/app.js",
    "content": "angular.module('app', ['pdfjsViewer']);\n\nangular.module('app').controller('AppCtrl', function ($scope, $http, $timeout) {\n    var url = 'example.pdf';\n\n    $scope.pdf = {\n        src: url,  // get pdf source from a URL that points to a pdf\n        data: null // get pdf source from raw data of a pdf\n    };\n\n    getPdfAsArrayBuffer(url).then(function (response) {\n        $scope.pdf.data = new Uint8Array(response.data);\n    }, function (err) {\n        console.log('failed to get pdf as binary:', err);\n    });\n\n    function getPdfAsArrayBuffer (url) {\n        return $http.get(url, {\n            responseType: 'arraybuffer',\n            headers: {\n                'foo': 'bar'\n            }\n        });\n    }\n});\n"
  },
  {
    "path": "demo/bower.json",
    "content": "{\n  \"name\": \"angular-pdfjs-demo\",\n  \"description\": \"Angular PDF.js demo\",\n  \"license\": \"MIT\",\n  \"private\": \"true\",\n  \"dependencies\": {\n    \"angular\": \"^1.5.8\",\n    \"pdf.js-viewer\": \"~1.6.211\"\n  }\n}\n"
  },
  {
    "path": "demo/index.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\" data-ng-app=\"app\" ng-controller=\"AppCtrl\">\n    <head>\n        <meta charset=\"utf-8\"/>\n        <title>Angular PDF.js demo</title>\n        <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n\n        <script src=\"bower_components/pdf.js-viewer/pdf.js\"></script>\n        <link rel=\"stylesheet\" href=\"bower_components/pdf.js-viewer/viewer.css\">\n\n        <script src=\"/bower_components/angular/angular.js\"></script>\n        <script src=\"/angular-pdfjs-viewer.js\"></script>\n        <script src=\"app.js\"></script>\n\n        <style>\n          html, body {\n            height: 100%;\n            width: 100%;\n            margin: 0;\n            padding: 0;\n          }\n\n          .some-pdf-container {\n            width: 100%;\n            height: 100%;\n          }\n        </style>\n    </head>\n    <body>\n        <div class='some-pdf-container'>\n            <!-- Example of loading pdf from URL string. Note that this must be an interpolation string -->\n            <pdfjs-viewer src=\"{{ pdf.src }}\"></pdfjs-viewer>\n\n            <!-- \n                Example of loading pdf from raw binary data. Note that this must be a scope variable.\n                Comment upper viewer out if you use this viewer (because multi pdf viewers are currently not supported)\n            -->\n            <!-- <pdfjs-viewer data=\"pdf.data\"></pdfjs-viewer> -->\n        </div>\n    </body>\n</html>\n"
  },
  {
    "path": "demo/package.json",
    "content": "{\n  \"name\": \"angular-pdfjs\",\n  \"description\": \"Embed PDF.js into your angular application\",\n  \"version\": \"1.0.0\",\n  \"dependencies\": {\n    \"bower\": \"^1.5.2\",\n    \"cors\": \"^2.7.1\",\n    \"express\": \"^4.13.3\"\n  },\n  \"scripts\": {\n    \"postinstall\": \"bower install\"\n  },\n  \"license\": \"proprietary\"\n}\n"
  },
  {
    "path": "demo/server.js",
    "content": "var express = require('express');\nvar cors = require('cors');\nvar app = express();\nvar server = require('http').Server(app);\nvar path = require('path');\n\napp.use(cors());\napp.use(express.static(__dirname));\n\napp.get('/angular-pdfjs-viewer.js', function(req, res) {\n    res.sendFile(path.resolve(__dirname + '/../dist/angular-pdfjs-viewer.js'));\n});\n\napp.get('/', function (req, res) {\n    res.sendFile(__dirname + '/index.html');\n});\n\nserver.listen(8080, function () {\n    console.log('Server is listening on localhost:8080');\n});\n\n"
  },
  {
    "path": "dist/angular-pdfjs-viewer.js",
    "content": "/**\n * angular-pdfjs\n * https://github.com/legalthings/angular-pdfjs\n * Copyright (c) 2015 ; Licensed MIT\n */\n\n+function () {\n    'use strict';\n\n    var module = angular.module('pdfjsViewer', []);\n    \n    module.provider('pdfjsViewerConfig', function() {\n        var config = {\n            workerSrc: null,\n            cmapDir: null,\n            imageResourcesPath: null,\n            disableWorker: false,\n            verbosity: null\n        };\n        \n        this.setWorkerSrc = function(src) {\n            config.workerSrc = src;\n        };\n        \n        this.setCmapDir = function(dir) {\n            config.cmapDir = dir;\n        };\n        \n        this.setImageDir = function(dir) {\n            config.imageDir = dir;\n        };\n        \n        this.disableWorker = function(value) {\n            if (typeof value === 'undefined') value = true;\n            config.disableWorker = value;\n        };\n        \n        this.setVerbosity = function(level) {\n            config.verbosity = level;\n        };\n        \n        this.$get = function() {\n            return config;\n        }\n    });\n    \n    module.run(['pdfjsViewerConfig', function(pdfjsViewerConfig) {\n        if (pdfjsViewerConfig.workerSrc) {\n            PDFJS.workerSrc = pdfjsViewerConfig.workerSrc;\n        }\n\n        if (pdfjsViewerConfig.cmapDir) {\n            PDFJS.cMapUrl = pdfjsViewerConfig.cmapDir;\n        }\n\n        if (pdfjsViewerConfig.imageDir) {\n            PDFJS.imageResourcesPath = pdfjsViewerConfig.imageDir;\n        }\n        \n        if (pdfjsViewerConfig.disableWorker) {\n            PDFJS.disableWorker = true;\n        }\n\n        if (pdfjsViewerConfig.verbosity !== null) {\n            var level = pdfjsViewerConfig.verbosity;\n            if (typeof level === 'string') level = PDFJS.VERBOSITY_LEVELS[level];\n            PDFJS.verbosity = pdfjsViewerConfig.verbosity;\n        }\n    }]);\n    \n    module.directive('pdfjsViewer', ['$interval', function ($interval) {\n        return {\n            template: '<pdfjs-wrapper>\\n' +\n'    <div id=\"outerContainer\">\\n' +\n'\\n' +\n'      <div id=\"sidebarContainer\">\\n' +\n'        <div id=\"toolbarSidebar\">\\n' +\n'          <div class=\"splitToolbarButton toggled\">\\n' +\n'            <button id=\"viewThumbnail\" class=\"toolbarButton group toggled\" title=\"Show Thumbnails\" tabindex=\"2\" data-l10n-id=\"thumbs\">\\n' +\n'               <span data-l10n-id=\"thumbs_label\">Thumbnails</span>\\n' +\n'            </button>\\n' +\n'            <button id=\"viewOutline\" class=\"toolbarButton group\" title=\"Show Document Outline (double-click to expand/collapse all items)\" tabindex=\"3\" data-l10n-id=\"document_outline\">\\n' +\n'               <span data-l10n-id=\"document_outline_label\">Document Outline</span>\\n' +\n'            </button>\\n' +\n'            <button id=\"viewAttachments\" class=\"toolbarButton group\" title=\"Show Attachments\" tabindex=\"4\" data-l10n-id=\"attachments\">\\n' +\n'               <span data-l10n-id=\"attachments_label\">Attachments</span>\\n' +\n'            </button>\\n' +\n'          </div>\\n' +\n'        </div>\\n' +\n'        <div id=\"sidebarContent\">\\n' +\n'          <div id=\"thumbnailView\">\\n' +\n'          </div>\\n' +\n'          <div id=\"outlineView\" class=\"hidden\">\\n' +\n'          </div>\\n' +\n'          <div id=\"attachmentsView\" class=\"hidden\">\\n' +\n'          </div>\\n' +\n'        </div>\\n' +\n'      </div>  <!-- sidebarContainer -->\\n' +\n'\\n' +\n'      <div id=\"mainContainer\">\\n' +\n'        <div class=\"findbar hidden doorHanger hiddenSmallView\" id=\"findbar\">\\n' +\n'          <label for=\"findInput\" class=\"toolbarLabel\" data-l10n-id=\"find_label\">Find:</label>\\n' +\n'          <input id=\"findInput\" class=\"toolbarField\" tabindex=\"91\">\\n' +\n'          <div class=\"splitToolbarButton\">\\n' +\n'            <button class=\"toolbarButton findPrevious\" title=\"\" id=\"findPrevious\" tabindex=\"92\" data-l10n-id=\"find_previous\">\\n' +\n'              <span data-l10n-id=\"find_previous_label\">Previous</span>\\n' +\n'            </button>\\n' +\n'            <div class=\"splitToolbarButtonSeparator\"></div>\\n' +\n'            <button class=\"toolbarButton findNext\" title=\"\" id=\"findNext\" tabindex=\"93\" data-l10n-id=\"find_next\">\\n' +\n'              <span data-l10n-id=\"find_next_label\">Next</span>\\n' +\n'            </button>\\n' +\n'          </div>\\n' +\n'          <input type=\"checkbox\" id=\"findHighlightAll\" class=\"toolbarField\" tabindex=\"94\">\\n' +\n'          <label for=\"findHighlightAll\" class=\"toolbarLabel\" data-l10n-id=\"find_highlight\">Highlight all</label>\\n' +\n'          <input type=\"checkbox\" id=\"findMatchCase\" class=\"toolbarField\" tabindex=\"95\">\\n' +\n'          <label for=\"findMatchCase\" class=\"toolbarLabel\" data-l10n-id=\"find_match_case_label\">Match case</label>\\n' +\n'          <span id=\"findResultsCount\" class=\"toolbarLabel hidden\"></span>\\n' +\n'          <span id=\"findMsg\" class=\"toolbarLabel\"></span>\\n' +\n'        </div>  <!-- findbar -->\\n' +\n'\\n' +\n'        <div id=\"secondaryToolbar\" class=\"secondaryToolbar hidden doorHangerRight\">\\n' +\n'          <div id=\"secondaryToolbarButtonContainer\">\\n' +\n'            <button id=\"secondaryPresentationMode\" class=\"secondaryToolbarButton presentationMode visibleLargeView\" title=\"Switch to Presentation Mode\" tabindex=\"51\" data-l10n-id=\"presentation_mode\">\\n' +\n'              <span data-l10n-id=\"presentation_mode_label\">Presentation Mode</span>\\n' +\n'            </button>\\n' +\n'\\n' +\n'            <button id=\"secondaryOpenFile\" class=\"secondaryToolbarButton openFile visibleLargeView\" title=\"Open File\" tabindex=\"52\" data-l10n-id=\"open_file\">\\n' +\n'              <span data-l10n-id=\"open_file_label\">Open</span>\\n' +\n'            </button>\\n' +\n'\\n' +\n'            <button id=\"secondaryPrint\" class=\"secondaryToolbarButton print visibleMediumView\" title=\"Print\" tabindex=\"53\" data-l10n-id=\"print\">\\n' +\n'              <span data-l10n-id=\"print_label\">Print</span>\\n' +\n'            </button>\\n' +\n'\\n' +\n'            <button id=\"secondaryDownload\" class=\"secondaryToolbarButton download visibleMediumView\" title=\"Download\" tabindex=\"54\" data-l10n-id=\"download\">\\n' +\n'              <span data-l10n-id=\"download_label\">Download</span>\\n' +\n'            </button>\\n' +\n'\\n' +\n'            <a href=\"#\" id=\"secondaryViewBookmark\" class=\"secondaryToolbarButton bookmark visibleSmallView\" title=\"Current view (copy or open in new window)\" tabindex=\"55\" data-l10n-id=\"bookmark\">\\n' +\n'              <span data-l10n-id=\"bookmark_label\">Current View</span>\\n' +\n'            </a>\\n' +\n'\\n' +\n'            <div class=\"horizontalToolbarSeparator visibleLargeView\"></div>\\n' +\n'\\n' +\n'            <button id=\"firstPage\" class=\"secondaryToolbarButton firstPage\" title=\"Go to First Page\" tabindex=\"56\" data-l10n-id=\"first_page\">\\n' +\n'              <span data-l10n-id=\"first_page_label\">Go to First Page</span>\\n' +\n'            </button>\\n' +\n'            <button id=\"lastPage\" class=\"secondaryToolbarButton lastPage\" title=\"Go to Last Page\" tabindex=\"57\" data-l10n-id=\"last_page\">\\n' +\n'              <span data-l10n-id=\"last_page_label\">Go to Last Page</span>\\n' +\n'            </button>\\n' +\n'\\n' +\n'            <div class=\"horizontalToolbarSeparator\"></div>\\n' +\n'\\n' +\n'            <button id=\"pageRotateCw\" class=\"secondaryToolbarButton rotateCw\" title=\"Rotate Clockwise\" tabindex=\"58\" data-l10n-id=\"page_rotate_cw\">\\n' +\n'              <span data-l10n-id=\"page_rotate_cw_label\">Rotate Clockwise</span>\\n' +\n'            </button>\\n' +\n'            <button id=\"pageRotateCcw\" class=\"secondaryToolbarButton rotateCcw\" title=\"Rotate Counterclockwise\" tabindex=\"59\" data-l10n-id=\"page_rotate_ccw\">\\n' +\n'              <span data-l10n-id=\"page_rotate_ccw_label\">Rotate Counterclockwise</span>\\n' +\n'            </button>\\n' +\n'\\n' +\n'            <div class=\"horizontalToolbarSeparator\"></div>\\n' +\n'\\n' +\n'            <button id=\"toggleHandTool\" class=\"secondaryToolbarButton handTool\" title=\"Enable hand tool\" tabindex=\"60\" data-l10n-id=\"hand_tool_enable\">\\n' +\n'              <span data-l10n-id=\"hand_tool_enable_label\">Enable hand tool</span>\\n' +\n'            </button>\\n' +\n'\\n' +\n'            <div class=\"horizontalToolbarSeparator\"></div>\\n' +\n'\\n' +\n'            <button id=\"documentProperties\" class=\"secondaryToolbarButton documentProperties\" title=\"Document Properties…\" tabindex=\"61\" data-l10n-id=\"document_properties\">\\n' +\n'              <span data-l10n-id=\"document_properties_label\">Document Properties…</span>\\n' +\n'            </button>\\n' +\n'          </div>\\n' +\n'        </div>  <!-- secondaryToolbar -->\\n' +\n'\\n' +\n'        <div class=\"toolbar\">\\n' +\n'          <div id=\"toolbarContainer\">\\n' +\n'            <div id=\"toolbarViewer\">\\n' +\n'              <div id=\"toolbarViewerLeft\">\\n' +\n'                <button id=\"sidebarToggle\" class=\"toolbarButton\" title=\"Toggle Sidebar\" tabindex=\"11\" data-l10n-id=\"toggle_sidebar\">\\n' +\n'                  <span data-l10n-id=\"toggle_sidebar_label\">Toggle Sidebar</span>\\n' +\n'                </button>\\n' +\n'                <div class=\"toolbarButtonSpacer\"></div>\\n' +\n'                <button id=\"viewFind\" class=\"toolbarButton group hiddenSmallView\" title=\"Find in Document\" tabindex=\"12\" data-l10n-id=\"findbar\">\\n' +\n'                   <span data-l10n-id=\"findbar_label\">Find</span>\\n' +\n'                </button>\\n' +\n'                <div class=\"splitToolbarButton\">\\n' +\n'                  <button class=\"toolbarButton pageUp\" title=\"Previous Page\" id=\"previous\" tabindex=\"13\" data-l10n-id=\"previous\">\\n' +\n'                    <span data-l10n-id=\"previous_label\">Previous</span>\\n' +\n'                  </button>\\n' +\n'                  <div class=\"splitToolbarButtonSeparator\"></div>\\n' +\n'                  <button class=\"toolbarButton pageDown\" title=\"Next Page\" id=\"next\" tabindex=\"14\" data-l10n-id=\"next\">\\n' +\n'                    <span data-l10n-id=\"next_label\">Next</span>\\n' +\n'                  </button>\\n' +\n'                </div>\\n' +\n'                <input type=\"number\" id=\"pageNumber\" class=\"toolbarField pageNumber\" title=\"Page\" value=\"1\" size=\"4\" min=\"1\" tabindex=\"15\" data-l10n-id=\"page\">\\n' +\n'                <span id=\"numPages\" class=\"toolbarLabel\"></span>\\n' +\n'              </div>\\n' +\n'              <div id=\"toolbarViewerRight\">\\n' +\n'                <button id=\"presentationMode\" class=\"toolbarButton presentationMode hiddenLargeView\" title=\"Switch to Presentation Mode\" tabindex=\"31\" data-l10n-id=\"presentation_mode\">\\n' +\n'                  <span data-l10n-id=\"presentation_mode_label\">Presentation Mode</span>\\n' +\n'                </button>\\n' +\n'\\n' +\n'                <button id=\"openFile\" class=\"toolbarButton openFile hiddenLargeView\" title=\"Open File\" tabindex=\"32\" data-l10n-id=\"open_file\">\\n' +\n'                  <span data-l10n-id=\"open_file_label\">Open</span>\\n' +\n'                </button>\\n' +\n'\\n' +\n'                <button id=\"print\" class=\"toolbarButton print hiddenMediumView\" title=\"Print\" tabindex=\"33\" data-l10n-id=\"print\">\\n' +\n'                  <span data-l10n-id=\"print_label\">Print</span>\\n' +\n'                </button>\\n' +\n'\\n' +\n'                <button id=\"download\" class=\"toolbarButton download hiddenMediumView\" title=\"Download\" tabindex=\"34\" data-l10n-id=\"download\">\\n' +\n'                  <span data-l10n-id=\"download_label\">Download</span>\\n' +\n'                </button>\\n' +\n'                <a href=\"#\" id=\"viewBookmark\" class=\"toolbarButton bookmark hiddenSmallView\" title=\"Current view (copy or open in new window)\" tabindex=\"35\" data-l10n-id=\"bookmark\">\\n' +\n'                  <span data-l10n-id=\"bookmark_label\">Current View</span>\\n' +\n'                </a>\\n' +\n'\\n' +\n'                <div class=\"verticalToolbarSeparator hiddenSmallView\"></div>\\n' +\n'\\n' +\n'                <button id=\"secondaryToolbarToggle\" class=\"toolbarButton\" title=\"Tools\" tabindex=\"36\" data-l10n-id=\"tools\">\\n' +\n'                  <span data-l10n-id=\"tools_label\">Tools</span>\\n' +\n'                </button>\\n' +\n'              </div>\\n' +\n'              <div id=\"toolbarViewerMiddle\">\\n' +\n'                <div class=\"splitToolbarButton\">\\n' +\n'                  <button id=\"zoomOut\" class=\"toolbarButton zoomOut\" title=\"Zoom Out\" tabindex=\"21\" data-l10n-id=\"zoom_out\">\\n' +\n'                    <span data-l10n-id=\"zoom_out_label\">Zoom Out</span>\\n' +\n'                  </button>\\n' +\n'                  <div class=\"splitToolbarButtonSeparator\"></div>\\n' +\n'                  <button id=\"zoomIn\" class=\"toolbarButton zoomIn\" title=\"Zoom In\" tabindex=\"22\" data-l10n-id=\"zoom_in\">\\n' +\n'                    <span data-l10n-id=\"zoom_in_label\">Zoom In</span>\\n' +\n'                   </button>\\n' +\n'                </div>\\n' +\n'                <span id=\"scaleSelectContainer\" class=\"dropdownToolbarButton\">\\n' +\n'                  <select id=\"scaleSelect\" title=\"Zoom\" tabindex=\"23\" data-l10n-id=\"zoom\">\\n' +\n'                    <option id=\"pageAutoOption\" title=\"\" value=\"auto\" selected=\"selected\" data-l10n-id=\"page_scale_auto\">Automatic Zoom</option>\\n' +\n'                    <option id=\"pageActualOption\" title=\"\" value=\"page-actual\" data-l10n-id=\"page_scale_actual\">Actual Size</option>\\n' +\n'                    <option id=\"pageFitOption\" title=\"\" value=\"page-fit\" data-l10n-id=\"page_scale_fit\">Fit Page</option>\\n' +\n'                    <option id=\"pageWidthOption\" title=\"\" value=\"page-width\" data-l10n-id=\"page_scale_width\">Full Width</option>\\n' +\n'                    <option id=\"customScaleOption\" title=\"\" value=\"custom\" disabled=\"disabled\" hidden=\"true\"></option>\\n' +\n'                    <option title=\"\" value=\"0.5\" data-l10n-id=\"page_scale_percent\" data-l10n-args=\\'{ \"scale\": 50 }\\'>50%</option>\\n' +\n'                    <option title=\"\" value=\"0.75\" data-l10n-id=\"page_scale_percent\" data-l10n-args=\\'{ \"scale\": 75 }\\'>75%</option>\\n' +\n'                    <option title=\"\" value=\"1\" data-l10n-id=\"page_scale_percent\" data-l10n-args=\\'{ \"scale\": 100 }\\'>100%</option>\\n' +\n'                    <option title=\"\" value=\"1.25\" data-l10n-id=\"page_scale_percent\" data-l10n-args=\\'{ \"scale\": 125 }\\'>125%</option>\\n' +\n'                    <option title=\"\" value=\"1.5\" data-l10n-id=\"page_scale_percent\" data-l10n-args=\\'{ \"scale\": 150 }\\'>150%</option>\\n' +\n'                    <option title=\"\" value=\"2\" data-l10n-id=\"page_scale_percent\" data-l10n-args=\\'{ \"scale\": 200 }\\'>200%</option>\\n' +\n'                    <option title=\"\" value=\"3\" data-l10n-id=\"page_scale_percent\" data-l10n-args=\\'{ \"scale\": 300 }\\'>300%</option>\\n' +\n'                    <option title=\"\" value=\"4\" data-l10n-id=\"page_scale_percent\" data-l10n-args=\\'{ \"scale\": 400 }\\'>400%</option>\\n' +\n'                  </select>\\n' +\n'                </span>\\n' +\n'              </div>\\n' +\n'            </div>\\n' +\n'            <div id=\"loadingBar\">\\n' +\n'              <div class=\"progress\">\\n' +\n'                <div class=\"glimmer\">\\n' +\n'                </div>\\n' +\n'              </div>\\n' +\n'            </div>\\n' +\n'          </div>\\n' +\n'        </div>\\n' +\n'\\n' +\n'        <menu type=\"context\" id=\"viewerContextMenu\">\\n' +\n'          <menuitem id=\"contextFirstPage\" label=\"First Page\"\\n' +\n'                    data-l10n-id=\"first_page\"></menuitem>\\n' +\n'          <menuitem id=\"contextLastPage\" label=\"Last Page\"\\n' +\n'                    data-l10n-id=\"last_page\"></menuitem>\\n' +\n'          <menuitem id=\"contextPageRotateCw\" label=\"Rotate Clockwise\"\\n' +\n'                    data-l10n-id=\"page_rotate_cw\"></menuitem>\\n' +\n'          <menuitem id=\"contextPageRotateCcw\" label=\"Rotate Counter-Clockwise\"\\n' +\n'                    data-l10n-id=\"page_rotate_ccw\"></menuitem>\\n' +\n'        </menu>\\n' +\n'\\n' +\n'        <div id=\"viewerContainer\" tabindex=\"0\">\\n' +\n'          <div id=\"viewer\" class=\"pdfViewer\"></div>\\n' +\n'        </div>\\n' +\n'\\n' +\n'        <div id=\"errorWrapper\" hidden=\\'true\\'>\\n' +\n'          <div id=\"errorMessageLeft\">\\n' +\n'            <span id=\"errorMessage\"></span>\\n' +\n'            <button id=\"errorShowMore\" data-l10n-id=\"error_more_info\">\\n' +\n'              More Information\\n' +\n'            </button>\\n' +\n'            <button id=\"errorShowLess\" data-l10n-id=\"error_less_info\" hidden=\\'true\\'>\\n' +\n'              Less Information\\n' +\n'            </button>\\n' +\n'          </div>\\n' +\n'          <div id=\"errorMessageRight\">\\n' +\n'            <button id=\"errorClose\" data-l10n-id=\"error_close\">\\n' +\n'              Close\\n' +\n'            </button>\\n' +\n'          </div>\\n' +\n'          <div class=\"clearBoth\"></div>\\n' +\n'          <textarea id=\"errorMoreInfo\" hidden=\\'true\\' readonly=\"readonly\"></textarea>\\n' +\n'        </div>\\n' +\n'      </div> <!-- mainContainer -->\\n' +\n'\\n' +\n'      <div id=\"overlayContainer\" class=\"hidden\">\\n' +\n'        <div id=\"passwordOverlay\" class=\"container hidden\">\\n' +\n'          <div class=\"dialog\">\\n' +\n'            <div class=\"row\">\\n' +\n'              <p id=\"passwordText\" data-l10n-id=\"password_label\">Enter the password to open this PDF file:</p>\\n' +\n'            </div>\\n' +\n'            <div class=\"row\">\\n' +\n'              <!-- The type=\"password\" attribute is set via script, to prevent warnings in Firefox for all http:// documents. -->\\n' +\n'              <input id=\"password\" class=\"toolbarField\">\\n' +\n'            </div>\\n' +\n'            <div class=\"buttonRow\">\\n' +\n'              <button id=\"passwordCancel\" class=\"overlayButton\"><span data-l10n-id=\"password_cancel\">Cancel</span></button>\\n' +\n'              <button id=\"passwordSubmit\" class=\"overlayButton\"><span data-l10n-id=\"password_ok\">OK</span></button>\\n' +\n'            </div>\\n' +\n'          </div>\\n' +\n'        </div>\\n' +\n'        <div id=\"documentPropertiesOverlay\" class=\"container hidden\">\\n' +\n'          <div class=\"dialog\">\\n' +\n'            <div class=\"row\">\\n' +\n'              <span data-l10n-id=\"document_properties_file_name\">File name:</span> <p id=\"fileNameField\">-</p>\\n' +\n'            </div>\\n' +\n'            <div class=\"row\">\\n' +\n'              <span data-l10n-id=\"document_properties_file_size\">File size:</span> <p id=\"fileSizeField\">-</p>\\n' +\n'            </div>\\n' +\n'            <div class=\"separator\"></div>\\n' +\n'            <div class=\"row\">\\n' +\n'              <span data-l10n-id=\"document_properties_title\">Title:</span> <p id=\"titleField\">-</p>\\n' +\n'            </div>\\n' +\n'            <div class=\"row\">\\n' +\n'              <span data-l10n-id=\"document_properties_author\">Author:</span> <p id=\"authorField\">-</p>\\n' +\n'            </div>\\n' +\n'            <div class=\"row\">\\n' +\n'              <span data-l10n-id=\"document_properties_subject\">Subject:</span> <p id=\"subjectField\">-</p>\\n' +\n'            </div>\\n' +\n'            <div class=\"row\">\\n' +\n'              <span data-l10n-id=\"document_properties_keywords\">Keywords:</span> <p id=\"keywordsField\">-</p>\\n' +\n'            </div>\\n' +\n'            <div class=\"row\">\\n' +\n'              <span data-l10n-id=\"document_properties_creation_date\">Creation Date:</span> <p id=\"creationDateField\">-</p>\\n' +\n'            </div>\\n' +\n'            <div class=\"row\">\\n' +\n'              <span data-l10n-id=\"document_properties_modification_date\">Modification Date:</span> <p id=\"modificationDateField\">-</p>\\n' +\n'            </div>\\n' +\n'            <div class=\"row\">\\n' +\n'              <span data-l10n-id=\"document_properties_creator\">Creator:</span> <p id=\"creatorField\">-</p>\\n' +\n'            </div>\\n' +\n'            <div class=\"separator\"></div>\\n' +\n'            <div class=\"row\">\\n' +\n'              <span data-l10n-id=\"document_properties_producer\">PDF Producer:</span> <p id=\"producerField\">-</p>\\n' +\n'            </div>\\n' +\n'            <div class=\"row\">\\n' +\n'              <span data-l10n-id=\"document_properties_version\">PDF Version:</span> <p id=\"versionField\">-</p>\\n' +\n'            </div>\\n' +\n'            <div class=\"row\">\\n' +\n'              <span data-l10n-id=\"document_properties_page_count\">Page Count:</span> <p id=\"pageCountField\">-</p>\\n' +\n'            </div>\\n' +\n'            <div class=\"buttonRow\">\\n' +\n'              <button id=\"documentPropertiesClose\" class=\"overlayButton\"><span data-l10n-id=\"document_properties_close\">Close</span></button>\\n' +\n'            </div>\\n' +\n'          </div>\\n' +\n'        </div>\\n' +\n'        <div id=\"printServiceOverlay\" class=\"container hidden\">\\n' +\n'          <div class=\"dialog\">\\n' +\n'            <div class=\"row\">\\n' +\n'              <span data-l10n-id=\"print_progress_message\">Preparing document for printing…</span>\\n' +\n'            </div>\\n' +\n'            <div class=\"row\">\\n' +\n'              <progress value=\"0\" max=\"100\"></progress>\\n' +\n'              <span data-l10n-id=\"print_progress_percent\" data-l10n-args=\\'{ \"progress\": 0 }\\' class=\"relative-progress\">0%</span>\\n' +\n'            </div>\\n' +\n'            <div class=\"buttonRow\">\\n' +\n'              <button id=\"printCancel\" class=\"overlayButton\"><span data-l10n-id=\"print_progress_close\">Cancel</span></button>\\n' +\n'            </div>\\n' +\n'          </div>\\n' +\n'        </div>\\n' +\n'      </div>  <!-- overlayContainer -->\\n' +\n'\\n' +\n'    </div> <!-- outerContainer -->\\n' +\n'    <div id=\"printContainer\"></div>\\n' +\n'  </pdfjs-wrapper>',\n            restrict: 'E',\n            scope: {\n                onInit: '&',\n                onPageLoad: '&',\n                scale: '=?',\n                src: '@?',\n                data: '=?'\n            },\n            link: function ($scope, $element, $attrs) {\n                $element.children().wrap('<div class=\"pdfjs\" style=\"width: 100%; height: 100%;\"></div>');\n                \n                var initialised = false;\n                var loaded = {};\n                var numLoaded = 0;\n\n                if (!window.PDFJS) {\n                    return console.warn(\"PDFJS is not set! Make sure that pdf.js is loaded before angular-pdfjs-viewer.js is loaded.\");\n                }\n\n                // initialize the pdf viewer with (with empty source)\n                window.PDFJS.webViewerLoad(\"\");\n\n                function onPdfInit() {\n                    initialised = true;\n                    \n                    if ($attrs.removeMouseListeners === \"true\") {\n                        window.removeEventListener('DOMMouseScroll', handleMouseWheel);\n                        window.removeEventListener('mousewheel', handleMouseWheel);\n                        \n                        var pages = document.querySelectorAll('.page');\n                        angular.forEach(pages, function (page) {\n                            angular.element(page).children().css('pointer-events', 'none');\n                        });\n                    }\n                    if ($scope.onInit) $scope.onInit();\n                }\n                \n                var poller = $interval(function () {\n                    if (!window.PDFViewerApplication) {\n                        return;\n                    }\n\n                    var pdfViewer = window.PDFViewerApplication.pdfViewer;\n                    \n                    if (pdfViewer) {\n                        if ($scope.scale !== pdfViewer.currentScale) {\n                            loaded = {};\n                            numLoaded = 0;\n                            $scope.scale = pdfViewer.currentScale;\n                        }\n                    } else {\n                        console.warn(\"PDFViewerApplication.pdfViewer is not set\");\n                    }\n\n                    var pages = document.querySelectorAll('.page');\n                    angular.forEach(pages, function (page) {\n                        var element = angular.element(page);\n                        var pageNum = element.attr('data-page-number');\n                        \n                        if (!element.attr('data-loaded')) {\n                            delete loaded[pageNum];\n                            return;\n                        }\n                        \n                        if (pageNum in loaded) return;\n\n                        if (!initialised) onPdfInit();\n                        \n                        if ($scope.onPageLoad) {\n                            if ($scope.onPageLoad({page: pageNum}) === false) return;\n                        }\n                        \n                        loaded[pageNum] = true;\n                        numLoaded++;\n                    });\n                }, 200);\n\n                $element.on('$destroy', function() {\n                    $interval.cancel(poller);\n                });\n\n                // watch pdf source\n                $scope.$watchGroup([\n                    function () { return $scope.src; },\n                    function () { return $scope.data; }\n                ], function (values) {\n                    var src = values[0];\n                    var data = values[1];\n\n                    if (!src && !data) {\n                        return;\n                    }\n\n                    window.PDFViewerApplication.open(src || data);\n                });\n\n                // watch other attributes\n                $scope.$watch(function () {\n                    return $attrs;\n                }, function () {\n                    if ($attrs.open === 'false') {\n                        document.getElementById('openFile').setAttribute('hidden', 'true');\n                        document.getElementById('secondaryOpenFile').setAttribute('hidden', 'true');\n                    }\n\n                    if ($attrs.download === 'false') {\n                        document.getElementById('download').setAttribute('hidden', 'true');\n                        document.getElementById('secondaryDownload').setAttribute('hidden', 'true');\n                    }\n\n                    if ($attrs.print === 'false') {\n                        document.getElementById('print').setAttribute('hidden', 'true');\n                        document.getElementById('secondaryPrint').setAttribute('hidden', 'true');\n                    }\n\n                    if ($attrs.width) {\n                        document.getElementById('outerContainer').style.width = $attrs.width;\n                    }\n\n                    if ($attrs.height) {\n                        document.getElementById('outerContainer').style.height = $attrs.height;\n                    }\n                });\n            }\n        };\n    }]);\n}();\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"angular-pdfjs-viewer\",\n  \"description\": \"Embed PDF.js viewer into your angular application\",\n  \"homepage\": \"http://github.com/legalthings/angular-pdfjs-viewer\",\n  \"license\": \"MIT\",\n  \"version\": \"1.0.0\",\n  \"contributors\": [\n    \"LegalThings <info@legalthings.net>\",\n    \"Moesjarraf <moesjarraf@gmail.com>\",\n    \"Arnold Daniels <arnold@jasny.net>\"\n  ],\n  \"dependencies\": {\n    \"angular\": \"^1.5.8\",\n    \"pdf.js-viewer\": \"~1.6.211\"\n  },\n  \"license\": \"MIT\",\n  \"main\": \"dist/angular-pdfjs-viewer.js\",\n  \"devDependencies\": {\n    \"grunt\": \"^0.4.5\",\n    \"grunt-replace\": \"^0.10.2\"\n  }\n}\n"
  },
  {
    "path": "src/angular-pdfjs-viewer.js",
    "content": "/**\n * angular-pdfjs\n * https://github.com/legalthings/angular-pdfjs\n * Copyright (c) 2015 ; Licensed MIT\n */\n\n+function () {\n    'use strict';\n\n    var module = angular.module('pdfjsViewer', []);\n    \n    module.provider('pdfjsViewerConfig', function() {\n        var config = {\n            workerSrc: null,\n            cmapDir: null,\n            imageResourcesPath: null,\n            disableWorker: false,\n            verbosity: null\n        };\n        \n        this.setWorkerSrc = function(src) {\n            config.workerSrc = src;\n        };\n        \n        this.setCmapDir = function(dir) {\n            config.cmapDir = dir;\n        };\n        \n        this.setImageDir = function(dir) {\n            config.imageDir = dir;\n        };\n        \n        this.disableWorker = function(value) {\n            if (typeof value === 'undefined') value = true;\n            config.disableWorker = value;\n        };\n        \n        this.setVerbosity = function(level) {\n            config.verbosity = level;\n        };\n        \n        this.$get = function() {\n            return config;\n        }\n    });\n    \n    module.run(['pdfjsViewerConfig', function(pdfjsViewerConfig) {\n        if (pdfjsViewerConfig.workerSrc) {\n            PDFJS.workerSrc = pdfjsViewerConfig.workerSrc;\n        }\n\n        if (pdfjsViewerConfig.cmapDir) {\n            PDFJS.cMapUrl = pdfjsViewerConfig.cmapDir;\n        }\n\n        if (pdfjsViewerConfig.imageDir) {\n            PDFJS.imageResourcesPath = pdfjsViewerConfig.imageDir;\n        }\n        \n        if (pdfjsViewerConfig.disableWorker) {\n            PDFJS.disableWorker = true;\n        }\n\n        if (pdfjsViewerConfig.verbosity !== null) {\n            var level = pdfjsViewerConfig.verbosity;\n            if (typeof level === 'string') level = PDFJS.VERBOSITY_LEVELS[level];\n            PDFJS.verbosity = pdfjsViewerConfig.verbosity;\n        }\n    }]);\n    \n    module.directive('pdfjsViewer', ['$interval', function ($interval) {\n        return {\n            templateUrl: file.folder + '../../pdf.js-viewer/viewer.html',\n            restrict: 'E',\n            scope: {\n                onInit: '&',\n                onPageLoad: '&',\n                scale: '=?',\n                src: '@?',\n                data: '=?'\n            },\n            link: function ($scope, $element, $attrs) {\n                $element.children().wrap('<div class=\"pdfjs\" style=\"width: 100%; height: 100%;\"></div>');\n                \n                var initialised = false;\n                var loaded = {};\n                var numLoaded = 0;\n\n                if (!window.PDFJS) {\n                    return console.warn(\"PDFJS is not set! Make sure that pdf.js is loaded before angular-pdfjs-viewer.js is loaded.\");\n                }\n\n                // initialize the pdf viewer with (with empty source)\n                window.PDFJS.webViewerLoad(\"\");\n\n                function onPdfInit() {\n                    initialised = true;\n                    \n                    if ($attrs.removeMouseListeners === \"true\") {\n                        window.removeEventListener('DOMMouseScroll', handleMouseWheel);\n                        window.removeEventListener('mousewheel', handleMouseWheel);\n                        \n                        var pages = document.querySelectorAll('.page');\n                        angular.forEach(pages, function (page) {\n                            angular.element(page).children().css('pointer-events', 'none');\n                        });\n                    }\n                    if ($scope.onInit) $scope.onInit();\n                }\n                \n                var poller = $interval(function () {\n                    if (!window.PDFViewerApplication) {\n                        return;\n                    }\n\n                    var pdfViewer = window.PDFViewerApplication.pdfViewer;\n                    \n                    if (pdfViewer) {\n                        if ($scope.scale !== pdfViewer.currentScale) {\n                            loaded = {};\n                            numLoaded = 0;\n                            $scope.scale = pdfViewer.currentScale;\n                        }\n                    } else {\n                        console.warn(\"PDFViewerApplication.pdfViewer is not set\");\n                    }\n\n                    var pages = document.querySelectorAll('.page');\n                    angular.forEach(pages, function (page) {\n                        var element = angular.element(page);\n                        var pageNum = element.attr('data-page-number');\n                        \n                        if (!element.attr('data-loaded')) {\n                            delete loaded[pageNum];\n                            return;\n                        }\n                        \n                        if (pageNum in loaded) return;\n\n                        if (!initialised) onPdfInit();\n                        \n                        if ($scope.onPageLoad) {\n                            if ($scope.onPageLoad({page: pageNum}) === false) return;\n                        }\n                        \n                        loaded[pageNum] = true;\n                        numLoaded++;\n                    });\n                }, 200);\n\n                $element.on('$destroy', function() {\n                    $interval.cancel(poller);\n                });\n\n                // watch pdf source\n                $scope.$watchGroup([\n                    function () { return $scope.src; },\n                    function () { return $scope.data; }\n                ], function (values) {\n                    var src = values[0];\n                    var data = values[1];\n\n                    if (!src && !data) {\n                        return;\n                    }\n\n                    window.PDFViewerApplication.open(src || data);\n                });\n\n                // watch other attributes\n                $scope.$watch(function () {\n                    return $attrs;\n                }, function () {\n                    if ($attrs.open === 'false') {\n                        document.getElementById('openFile').setAttribute('hidden', 'true');\n                        document.getElementById('secondaryOpenFile').setAttribute('hidden', 'true');\n                    }\n\n                    if ($attrs.download === 'false') {\n                        document.getElementById('download').setAttribute('hidden', 'true');\n                        document.getElementById('secondaryDownload').setAttribute('hidden', 'true');\n                    }\n\n                    if ($attrs.print === 'false') {\n                        document.getElementById('print').setAttribute('hidden', 'true');\n                        document.getElementById('secondaryPrint').setAttribute('hidden', 'true');\n                    }\n\n                    if ($attrs.width) {\n                        document.getElementById('outerContainer').style.width = $attrs.width;\n                    }\n\n                    if ($attrs.height) {\n                        document.getElementById('outerContainer').style.height = $attrs.height;\n                    }\n                });\n            }\n        };\n    }]);\n\n    // === get current script file ===\n    var file = {};\n    file.scripts = document.querySelectorAll('script[src]');\n    file.path = file.scripts[file.scripts.length - 1].src;\n    file.filename = getFileName(file.path);\n    file.folder = getLocation(file.path).pathname.replace(file.filename, '');\n\n    function getFileName(url) {\n        var anchor = url.indexOf('#');\n        var query = url.indexOf('?');\n        var end = Math.min(anchor > 0 ? anchor : url.length, query > 0 ? query : url.length);\n\n        return url.substring(url.lastIndexOf('/', end) + 1, end);\n    }\n\n    function getLocation(href) {\n        var location = document.createElement(\"a\");\n        location.href = href;\n\n        if (!location.host) location.href = location.href; // Weird assigment\n\n        return location;\n    }\n    // ======\n}();\n"
  }
]