summaryrefslogtreecommitdiff
path: root/frontend/delta/js/Clipperz/PM/UI/Components/Overlay.js
Unidiff
Diffstat (limited to 'frontend/delta/js/Clipperz/PM/UI/Components/Overlay.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/delta/js/Clipperz/PM/UI/Components/Overlay.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/frontend/delta/js/Clipperz/PM/UI/Components/Overlay.js b/frontend/delta/js/Clipperz/PM/UI/Components/Overlay.js
index cc4a06c..cb5f81a 100644
--- a/frontend/delta/js/Clipperz/PM/UI/Components/Overlay.js
+++ b/frontend/delta/js/Clipperz/PM/UI/Components/Overlay.js
@@ -1,122 +1,123 @@
1/* 1/*
2 2
3Copyright 2008-2013 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz, the online password manager. 5This file is part of Clipperz, the online password manager.
6For further information about its features and functionalities please 6For further information about its features and functionalities please
7refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
8 8
9* Clipperz is free software: you can redistribute it and/or modify it 9* Clipperz is free software: you can redistribute it and/or modify it
10 under the terms of the GNU Affero General Public License as published 10 under the terms of the GNU Affero General Public License as published
11 by the Free Software Foundation, either version 3 of the License, or 11 by the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version. 12 (at your option) any later version.
13 13
14* Clipperz is distributed in the hope that it will be useful, but 14* Clipperz is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of 15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
18 18
19* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
20 License along with Clipperz. If not, see http://www.gnu.org/licenses/. 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
21 21
22*/ 22*/
23 23
24Clipperz.Base.module('Clipperz.PM.UI.Components'); 24Clipperz.Base.module('Clipperz.PM.UI.Components');
25 25
26Clipperz.PM.UI.Components.Overlay = function(args) { 26Clipperz.PM.UI.Components.Overlay = function(args) {
27 args = args || {}; 27 args = args || {};
28 28
29 this._defaultDelay = 2; 29 this._defaultDelay = 2;
30 this._element = MochiKit.DOM.getElement('overlay'); 30 this._element = MochiKit.DOM.getElement('overlay');
31 31
32 return this; 32 return this;
33} 33}
34 34
35//============================================================================= 35//=============================================================================
36 36
37Clipperz.Base.extend(Clipperz.PM.UI.Components.Overlay, Object, { 37Clipperz.Base.extend(Clipperz.PM.UI.Components.Overlay, Object, {
38 38
39 //------------------------------------------------------------------------- 39 //-------------------------------------------------------------------------
40 40
41 'toString': function () { 41 'toString': function () {
42 return "Clipperz.PM.UI.Components.Overlay component"; 42 return "Clipperz.PM.UI.Components.Overlay component";
43 }, 43 },
44 44
45 'element': function () { 45 'element': function () {
46 // return MochiKit.DOM.getElement('overlay'); 46 // return MochiKit.DOM.getElement('overlay');
47 return this._element; 47 return this._element;
48 }, 48 },
49 49
50 'getElement': function (aClass) { 50 'getElement': function (aClass) {
51 return MochiKit.Selector.findChildElements(this.element(), ['.'+aClass])[0]; 51 return MochiKit.Selector.findChildElements(this.element(), ['.'+aClass])[0];
52 }, 52 },
53 53
54 //------------------------------------------------------------------------- 54 //-------------------------------------------------------------------------
55 55
56 'show': function (aMessage) { 56 'show': function (aMessage) {
57 this.resetStatus(); 57 this.resetStatus();
58 this.setMessage(aMessage); 58 this.setMessage(aMessage);
59 MochiKit.DOM.removeElementClass(this.element(), 'ios-overlay-hide'); 59 MochiKit.DOM.removeElementClass(this.element(), 'ios-overlay-hide');
60 MochiKit.DOM.addElementClass(this.element(), 'ios-overlay-show'); 60 MochiKit.DOM.addElementClass(this.element(), 'ios-overlay-show');
61 }, 61 },
62 62
63 'done': function (aMessage, aDelayBeforeHiding) { 63 'done': function (aMessage, aDelayBeforeHiding) {
64 this.completed(this.showDoneIcon, aMessage, aDelayBeforeHiding); 64 this.completed(this.showDoneIcon, aMessage, aDelayBeforeHiding);
65 }, 65 },
66 66
67 'failed': function (aMessage, aDelayBeforeHiding) { 67 'failed': function (aMessage, aDelayBeforeHiding) {
68 this.completed(this.showFailIcon, aMessage, aDelayBeforeHiding); 68 this.completed(this.showFailIcon, aMessage, aDelayBeforeHiding);
69 }, 69 },
70 70
71 //------------------------------------------------------------------------- 71 //-------------------------------------------------------------------------
72 72
73 'resetStatus': function () { 73 'resetStatus': function () {
74 MochiKit.Style.showElement(this.element()); 74 MochiKit.Style.showElement(this.element());
75 MochiKit.Style.showElement(this.getElement('spinner')); 75 MochiKit.Style.showElement(this.getElement('spinner'));
76 MochiKit.Style.hideElement(this.getElement('done')); 76 MochiKit.Style.hideElement(this.getElement('done'));
77 MochiKit.Style.hideElement(this.getElement('failed')); 77 MochiKit.Style.hideElement(this.getElement('failed'));
78 }, 78 },
79 79
80 'setMessage': function (aMessage) { 80 'setMessage': function (aMessage) {
81 if (typeof(aMessage) != 'undefined') { 81 if (typeof(aMessage) != 'undefined') {
82 this.getElement('title').innerHTML = aMessage; 82 this.getElement('title').innerHTML = aMessage;
83 } 83 }
84 }, 84 },
85 85
86 'completed': function (aFunctionToShowResult, aMessage, aDelayBeforeHiding) { 86 'completed': function (aFunctionToShowResult, aMessage, aDelayBeforeHiding) {
87 var delay = aDelayBeforeHiding || this.defaultDelay(); 87 var delay = aDelayBeforeHiding || this.defaultDelay();
88 88
89 this.hideSpinner(); 89 this.hideSpinner();
90 MochiKit.Base.bind(aFunctionToShowResult, this)(); 90 MochiKit.Base.bind(aFunctionToShowResult, this)();
91 this.setMessage(aMessage); 91 this.setMessage(aMessage);
92 92
93 MochiKit.Async.callLater(delay, MochiKit.Base.bind(this.hide, this)) 93 MochiKit.Async.callLater(delay, MochiKit.Base.bind(this.hide, this))
94 }, 94 },
95 95
96 'hide': function () { 96 'hide': function () {
97 MochiKit.DOM.removeElementClass(this.element(), 'ios-overlay-show'); 97 var element = this.element();
98 MochiKit.DOM.addElementClass(this.element(), 'ios-overlay-hide'); 98 MochiKit.DOM.removeElementClass(element, 'ios-overlay-show');
99 MochiKit.Async.callLater(1, MochiKit.Style.hideElement, this.element()); 99 MochiKit.DOM.addElementClass(element, 'ios-overlay-hide');
100 MochiKit.Async.callLater(1, MochiKit.Style.hideElement, element);
100 }, 101 },
101 102
102 'hideSpinner': function () { 103 'hideSpinner': function () {
103 MochiKit.Style.hideElement(this.getElement('spinner')); 104 MochiKit.Style.hideElement(this.getElement('spinner'));
104 }, 105 },
105 106
106 'showDoneIcon': function () { 107 'showDoneIcon': function () {
107 MochiKit.Style.showElement(this.getElement('done')); 108 MochiKit.Style.showElement(this.getElement('done'));
108 }, 109 },
109 110
110 'showFailIcon': function () { 111 'showFailIcon': function () {
111 MochiKit.Style.showElement(this.getElement('failed')); 112 MochiKit.Style.showElement(this.getElement('failed'));
112 }, 113 },
113 114
114 //------------------------------------------------------------------------- 115 //-------------------------------------------------------------------------
115 116
116 'defaultDelay': function () { 117 'defaultDelay': function () {
117 return this._defaultDelay; 118 return this._defaultDelay;
118 }, 119 },
119 120
120 //------------------------------------------------------------------------- 121 //-------------------------------------------------------------------------
121 __syntaxFix__: "syntax fix" 122 __syntaxFix__: "syntax fix"
122}); 123});