Total Complexity | 9 |
Complexity/F | 1.5 |
Lines of Code | 60 |
Function Count | 6 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | /** |
||
10 | (function (OC, window, $) { |
||
11 | 'use strict'; |
||
12 | /** global: OCA */ |
||
13 | if (!OCA.Ocr) { |
||
14 | /** |
||
15 | * @namespace |
||
16 | * global: OCA |
||
17 | */ |
||
18 | OCA.Ocr = {}; |
||
19 | } |
||
20 | /** |
||
21 | * OCA.Ocr.App |
||
22 | * Integrates all necessary objects to build the app. |
||
23 | * @type {{initialize: OCA.Ocr.App.initialize}} |
||
24 | * global: OCA |
||
25 | */ |
||
26 | OCA.Ocr.App = { |
||
27 | /** |
||
28 | * Initialize function. Gets all things together. |
||
29 | */ |
||
30 | initialize: function () { |
||
31 | var self = this; |
||
32 | //Create the OCR object |
||
33 | /** global: OC, OCA */ |
||
34 | this._ocr = new OCA.Ocr.Ocr(OC.generateUrl('/apps/ocr')); |
||
35 | // Create the View Object |
||
36 | /** global: OCA */ |
||
37 | this._view = new OCA.Ocr.View(this._ocr); |
||
38 | self._ocr.initialize().done(function(){ |
||
39 | self._view.initialize(); |
||
40 | }).fail(function (message) { |
||
41 | self._view.notifyError('OCR App could not be initialized: ' + message); |
||
42 | }); |
||
43 | }, |
||
44 | /** |
||
45 | * Destroy function. Deregisters everthing and destroys the Ocr app. |
||
46 | */ |
||
47 | destroy: function () { |
||
48 | var self = this; |
||
49 | self._view.destroy(); |
||
50 | } |
||
51 | }; |
||
52 | /** |
||
53 | * Init the App |
||
54 | */ |
||
55 | $(document).ready(function () { |
||
56 | /** |
||
57 | * We have to be in the Files App! |
||
58 | */ |
||
59 | if(!OCA.Files){ // we don't have the files app, so ignore anything |
||
60 | return; |
||
61 | } |
||
62 | if(/(public)\.php/i.exec(window.location.href)!==null){ |
||
63 | return; // escape when the requested file is public.php |
||
64 | } |
||
65 | /** global: OCA */ |
||
66 | OCA.Ocr.App.initialize(); |
||
67 | }); |
||
68 | /** global: OC */ |
||
69 | })(OC, window, jQuery); |