RubyApp 0.6.52 → 0.6.53
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ruby_app/elements/mobile/document.js.haml +49 -49
- data/lib/ruby_app/version.rb +1 -1
- metadata +4 -4
@@ -1,45 +1,45 @@
|
|
1
1
|
:plain
|
2
2
|
// #{__FILE__}
|
3
3
|
var RubyApp = new function() {
|
4
|
-
|
4
|
+
var queue = [];
|
5
5
|
this.enQueue = function(_function) {
|
6
|
-
if (
|
6
|
+
if ( queue.length <= 0 )
|
7
7
|
{
|
8
|
-
|
8
|
+
queue.push('next');
|
9
9
|
_function();
|
10
10
|
}
|
11
11
|
else
|
12
|
-
|
13
|
-
}
|
12
|
+
queue.push(_function);
|
13
|
+
};
|
14
14
|
this.deQueue = function() {
|
15
|
-
_function =
|
15
|
+
_function = queue.shift();
|
16
16
|
if ( _function )
|
17
17
|
if ( _function === 'next' )
|
18
18
|
RubyApp.deQueue();
|
19
19
|
else
|
20
20
|
{
|
21
|
-
|
21
|
+
queue.push('next');
|
22
22
|
_function();
|
23
23
|
}
|
24
|
-
}
|
25
|
-
|
24
|
+
};
|
25
|
+
var waitCount = 0;
|
26
26
|
this.showWait = function() {
|
27
|
-
if (
|
27
|
+
if ( waitCount == 0 )
|
28
28
|
{
|
29
29
|
$('div.overlay').css('display', 'block');
|
30
30
|
$.mobile.showPageLoadingMsg();
|
31
31
|
}
|
32
|
-
|
33
|
-
}
|
32
|
+
waitCount++;
|
33
|
+
};
|
34
34
|
this.hideWait = function() {
|
35
|
-
if (
|
36
|
-
|
37
|
-
if (
|
35
|
+
if ( waitCount > 0 )
|
36
|
+
waitCount--;
|
37
|
+
if ( waitCount == 0 )
|
38
38
|
{
|
39
39
|
$.mobile.hidePageLoadingMsg();
|
40
40
|
$('div.overlay').css('display', 'none');
|
41
41
|
}
|
42
|
-
}
|
42
|
+
};
|
43
43
|
this.sendEvent = function(event, wait) {
|
44
44
|
RubyApp.log('ENQUEUE event.class=' + event._class);
|
45
45
|
event.now = new Date().toString();
|
@@ -68,7 +68,7 @@
|
|
68
68
|
RubyApp.hideWait();
|
69
69
|
} )
|
70
70
|
} );
|
71
|
-
}
|
71
|
+
};
|
72
72
|
this.showPage = function(id, options) {
|
73
73
|
if ($('#' + id).length)
|
74
74
|
$.mobile.changePage($('#' + id), options);
|
@@ -95,10 +95,10 @@
|
|
95
95
|
} );
|
96
96
|
} );
|
97
97
|
}
|
98
|
-
}
|
98
|
+
};
|
99
99
|
this.removePage = function(id) {
|
100
100
|
$('#' + id).remove();
|
101
|
-
}
|
101
|
+
};
|
102
102
|
this.updateElement = function(id) {
|
103
103
|
RubyApp.log('ENQUEUE RubyApp.updateElement("' + id + '")');
|
104
104
|
RubyApp.enQueue ( function() {
|
@@ -125,121 +125,121 @@
|
|
125
125
|
} );
|
126
126
|
} );
|
127
127
|
RubyApp.sendEvent({_class:'RubyApp::Element::UpdatedEvent', source:id});
|
128
|
-
}
|
128
|
+
};
|
129
129
|
this.createTrigger = function(id, interval) {
|
130
130
|
RubyApp.destroyTrigger(id);
|
131
131
|
$('#' + id)[0]._trigger = window.setInterval( function() {
|
132
132
|
RubyApp.sendEvent({_class:'RubyApp::Element::TriggeredEvent', source:id});
|
133
133
|
}, interval );
|
134
|
-
}
|
134
|
+
};
|
135
135
|
this.destroyTrigger = function(id) {
|
136
136
|
if ($('#' + id)[0]._trigger) {
|
137
137
|
window.clearInterval($('#' + id)[0]._trigger);
|
138
138
|
$('#' + id)[0]._trigger = undefined;
|
139
139
|
RubyApp.log('SUCCESS RubyApp.destroyTrigger("' + id + '")');
|
140
140
|
}
|
141
|
-
}
|
141
|
+
};
|
142
142
|
this.refreshBrowser = function() {
|
143
143
|
$(window).clearQueue();
|
144
144
|
location.replace(location.href);
|
145
|
-
}
|
145
|
+
};
|
146
146
|
this.confirmRefreshBrowser = function(message) {
|
147
147
|
if (confirm(message))
|
148
148
|
RubyApp.refreshBrowser();
|
149
|
-
}
|
149
|
+
};
|
150
150
|
this.go = function(url) {
|
151
151
|
$(window).clearQueue();
|
152
152
|
location.replace(url);
|
153
|
-
}
|
153
|
+
};
|
154
154
|
this.updateStyle = function(selector, property, value) {
|
155
155
|
$(selector).css(property, value);
|
156
|
-
}
|
156
|
+
};
|
157
157
|
this.addClass = function(selector, _class) {
|
158
158
|
$(selector).addClass(_class);
|
159
|
-
}
|
159
|
+
};
|
160
160
|
this.removeClass = function(selector, _class) {
|
161
161
|
$(selector).removeClass(_class);
|
162
|
-
}
|
162
|
+
};
|
163
163
|
this.updateText = function(selector, value) {
|
164
164
|
$(selector).text(value);
|
165
|
-
}
|
165
|
+
};
|
166
166
|
this.updateValue = function(selector, value, change) {
|
167
167
|
$(selector).val(value);
|
168
168
|
if (change)
|
169
169
|
$(selector).change();
|
170
|
-
}
|
170
|
+
};
|
171
171
|
this.updateValueFor = function(selector, value, change) {
|
172
172
|
var _for = $(selector).attr('for');
|
173
173
|
RubyApp.updateValue('#' + _for, value, change);
|
174
|
-
}
|
174
|
+
};
|
175
175
|
this.setCookie = function(name, value, expires) {
|
176
176
|
document.cookie = name + '=' + value + '; expires=' + expires.toUTCString();
|
177
|
-
}
|
177
|
+
};
|
178
178
|
this.click = function(selector) {
|
179
179
|
$(selector).click();
|
180
|
-
}
|
180
|
+
};
|
181
181
|
this.swipeLeft = function() {
|
182
182
|
$('.ui-page-active').swipeleft();
|
183
|
-
}
|
183
|
+
};
|
184
184
|
this.swipeRight = function() {
|
185
185
|
$('.ui-page-active').swiperight();
|
186
|
-
}
|
186
|
+
};
|
187
187
|
this.isVisible = function(selector) {
|
188
188
|
var windowTop = $(window).scrollTop();
|
189
189
|
var windowBottom = windowTop + $(window).height();
|
190
190
|
var elementTop = $(selector).offset().top;
|
191
191
|
var elementBottom = elementTop + $(selector).height();
|
192
192
|
return ((elementBottom >= windowTop) && (elementTop <= windowBottom) && (elementBottom <= windowBottom) && (elementTop >= windowTop) );
|
193
|
-
}
|
193
|
+
};
|
194
194
|
this.assertExists = function(selector) {
|
195
195
|
RubyApp.assert('selector=' + selector, $(selector).length > 0);
|
196
|
-
}
|
196
|
+
};
|
197
197
|
this.assertNotExists = function(selector) {
|
198
198
|
RubyApp.assert('selector=' + selector, $(selector).length <= 0);
|
199
|
-
}
|
199
|
+
};
|
200
200
|
this.assertExistsValue = function(selector, value) {
|
201
201
|
var _value = $(selector).val();
|
202
202
|
RubyApp.assert('selector=' + selector + ', value=' + value, _value == value);
|
203
|
-
}
|
203
|
+
};
|
204
204
|
this.assertNotExistsValue = function(selector, value) {
|
205
205
|
var _value = $(selector).val();
|
206
206
|
RubyApp.assert('selector=' + selector + ', value=' + value, _value != value);
|
207
|
-
}
|
207
|
+
};
|
208
208
|
this.assertExistsFor = function(selector) {
|
209
209
|
var _for = $(selector).attr('for');
|
210
210
|
RubyApp.assert('selector=' + selector + ', for=' + _for, $('#' + _for).length > 0);
|
211
|
-
}
|
211
|
+
};
|
212
212
|
this.assertNotExistsFor = function(selector) {
|
213
213
|
var _for = $(selector).attr('for');
|
214
214
|
RubyApp.assert('selector=' + selector + ', for=' + _for, $('#' + _for).length <= 0);
|
215
|
-
}
|
215
|
+
};
|
216
216
|
this.assertExistsValueFor = function(selector, value) {
|
217
217
|
var _for = $(selector).attr('for');
|
218
218
|
var _value = $('#' + _for).val();
|
219
219
|
RubyApp.assert('selector=' + selector + ', for=' + _for + ', value=' + value, _value == value);
|
220
|
-
}
|
220
|
+
};
|
221
221
|
this.assertNotExistsValueFor = function(selector, value) {
|
222
222
|
var _for = $(selector).attr('for');
|
223
223
|
var _value = $('#' + _for).val();
|
224
224
|
RubyApp.assert('selector=' + selector + ', for=' + _for + ', value=' + value, _value != value);
|
225
|
-
}
|
225
|
+
};
|
226
226
|
this.assertIsVisible = function(selector) {
|
227
227
|
RubyApp.assert('selector=' + selector + ', visible', RubyApp.isVisible(selector) == true);
|
228
|
-
}
|
228
|
+
};
|
229
229
|
this.assertNotIsVisible = function(selector) {
|
230
230
|
RubyApp.assert('selector=' + selector + ', not visible', RubyApp.isVisible(selector) == false);
|
231
|
-
}
|
231
|
+
};
|
232
232
|
this.assert = function(name, value) {
|
233
233
|
RubyApp.sendEvent({_class:'RubyApp::Element::AssertedEvent', source:$('html').attr('id'), name:name, value:eval(value)});
|
234
|
-
}
|
234
|
+
};
|
235
235
|
this.getData = function(name, _default) {
|
236
236
|
var value = $('meta[name="' + name + '"]').attr('content');
|
237
237
|
return value == undefined ? _default : value;
|
238
|
-
}
|
238
|
+
};
|
239
239
|
this.log = function(message) {
|
240
240
|
if ( window.console )
|
241
241
|
window.console.log(message);
|
242
|
-
}
|
242
|
+
};
|
243
243
|
};
|
244
244
|
|
245
245
|
$(window).load(function() {
|
data/lib/ruby_app/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: RubyApp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 109
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 53
|
10
|
+
version: 0.6.53
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Frank G. Ficnar
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2013-01-
|
18
|
+
date: 2013-01-29 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|