arcabouco 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,211 @@
1
+ var BrowserDetect = {
2
+ init: function () {
3
+ this.browser = this.searchString(this.dataBrowser) || "unknown";
4
+ this.version = this.searchVersion(navigator.userAgent)
5
+ || this.searchVersion(navigator.appVersion)
6
+ || "unknown_version";
7
+ this.OS = this.searchString(this.dataOS) || "unknown_os";
8
+ },
9
+ searchString: function (data) {
10
+ for (var i=0;i<data.length;i++) {
11
+ var dataString = data[i].string;
12
+ var dataProp = data[i].prop;
13
+ this.versionSearchString = data[i].versionSearch || data[i].identity;
14
+ if (dataString) {
15
+ if (dataString.indexOf(data[i].subString) != -1)
16
+ return data[i].identity;
17
+ }
18
+ else if (dataProp)
19
+ return data[i].identity;
20
+ }
21
+ },
22
+ searchVersion: function (dataString) {
23
+ var index = dataString.indexOf(this.versionSearchString);
24
+ if (index == -1) return;
25
+ return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
26
+ },
27
+ dataBrowser: [
28
+ {
29
+ string: navigator.userAgent,
30
+ subString: "Chrome",
31
+ identity: "Chrome"
32
+ },
33
+ { string: navigator.userAgent,
34
+ subString: "OmniWeb",
35
+ versionSearch: "OmniWeb/",
36
+ identity: "OmniWeb"
37
+ },
38
+ {
39
+ string: navigator.vendor,
40
+ subString: "Apple",
41
+ identity: "Safari",
42
+ versionSearch: "Version"
43
+ },
44
+ {
45
+ prop: window.opera,
46
+ identity: "Opera",
47
+ versionSearch: "Version"
48
+ },
49
+ {
50
+ string: navigator.vendor,
51
+ subString: "iCab",
52
+ identity: "iCab"
53
+ },
54
+ {
55
+ string: navigator.vendor,
56
+ subString: "KDE",
57
+ identity: "Konqueror"
58
+ },
59
+ {
60
+ string: navigator.userAgent,
61
+ subString: "Firefox",
62
+ identity: "Firefox"
63
+ },
64
+ {
65
+ string: navigator.vendor,
66
+ subString: "Camino",
67
+ identity: "Camino"
68
+ },
69
+ {
70
+ string: navigator.userAgent,
71
+ subString: "Android",
72
+ identity: "Webkit"
73
+ },
74
+ { // for newer Netscapes (6+)
75
+ string: navigator.userAgent,
76
+ subString: "Netscape",
77
+ identity: "Netscape"
78
+ },
79
+ {
80
+ string: navigator.userAgent,
81
+ subString: "MSIE",
82
+ identity: "Explorer",
83
+ versionSearch: "MSIE"
84
+ },
85
+ {
86
+ string: navigator.userAgent,
87
+ subString: "Gecko",
88
+ identity: "Mozilla",
89
+ versionSearch: "rv"
90
+ },
91
+ { // for older Netscapes (4-)
92
+ string: navigator.userAgent,
93
+ subString: "Mozilla",
94
+ identity: "Netscape",
95
+ versionSearch: "Mozilla"
96
+ }
97
+ ],
98
+ dataOS : [
99
+ {
100
+ string: navigator.platform,
101
+ subString: "Win",
102
+ identity: "Windows"
103
+ },
104
+ {
105
+ string: navigator.platform,
106
+ subString: "Mac",
107
+ identity: "Mac"
108
+ },
109
+ {
110
+ string: navigator.userAgent,
111
+ subString: "iPhone",
112
+ identity: "iPhone"
113
+ },
114
+ {
115
+ string: navigator.userAgent,
116
+ subString: "Android",
117
+ identity: "Android"
118
+ },
119
+ {
120
+ string: navigator.platform,
121
+ subString: "Linux",
122
+ identity: "Linux"
123
+ }
124
+ ]
125
+
126
+ };
127
+ BrowserDetect.init();
128
+
129
+ $( function() {
130
+
131
+ window.IS_MOBILE = false;
132
+ window.IS_DESKTOP = false;
133
+ window.IS_IOS = false;
134
+ window.IS_ANDROID = false;
135
+ window.IS_DEPRECATED_ANDROID = false;
136
+
137
+ $("html").removeClass("no-js").addClass("js");
138
+ $("html").removeClass("not-ready").addClass("ready");
139
+ if (navigator.userAgent.match(/Android/i)) { $("html").addClass("android mobile"); window.IS_MOBILE=true; window.IS_ANDROID=true; }
140
+ else if (navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i)) { $("html").addClass("ios mobile"); window.IS_MOBILE=true; window.IS_IOS=true }
141
+ else { $("html").addClass("desktop"); window.IS_DESKTOP=true }
142
+
143
+ $("html").addClass( BrowserDetect.browser.toLowerCase() )
144
+ $("html").addClass( BrowserDetect.browser.toLowerCase() + '_' + BrowserDetect.version )
145
+ $("html").addClass( 'os_' + BrowserDetect.OS.toLowerCase() )
146
+
147
+ var ua = navigator.userAgent;
148
+ if( ua.indexOf("Android") >= 0 )
149
+ {
150
+ var androidversion = parseFloat(ua.slice(ua.indexOf("Android")+8));
151
+ if (androidversion < 3)
152
+ {
153
+ $("html").addClass( 'deprecated_android' );
154
+ window.IS_DEPRECATED_ANDROID = true;
155
+ }
156
+ }
157
+
158
+ window.TOUCH_SUPPORT = jQuery.support.touch;
159
+
160
+ window.matchMedia = window.matchMedia || (function(doc, undefined){
161
+
162
+ var bool,
163
+ docElem = doc.documentElement,
164
+ refNode = docElem.firstElementChild || docElem.firstChild,
165
+ // fakeBody required for <FF4 when executed in <head>
166
+ fakeBody = doc.createElement('body'),
167
+ div = doc.createElement('div');
168
+
169
+ div.id = 'mq-test-1';
170
+ div.style.cssText = "position:absolute;top:-100em";
171
+ fakeBody.style.background = "none";
172
+ fakeBody.appendChild(div);
173
+
174
+ return function(q){
175
+
176
+ div.innerHTML = '&shy;<style media="'+q+'"> #mq-test-1 { width: 42px; }</style>';
177
+
178
+ docElem.insertBefore(fakeBody, refNode);
179
+ bool = div.offsetWidth == 42;
180
+ docElem.removeChild(fakeBody);
181
+
182
+ return { matches: bool, media: q };
183
+ };
184
+
185
+ })(document);
186
+
187
+ window.HAS_MEDIAQUERY = window.matchMedia && window.matchMedia( "only all" ).matches;
188
+
189
+ function configureMediaQuery() {
190
+ $("body").removeClass("mq-mp"); // Mobile Portrait
191
+ $("body").removeClass("mq-ml"); // Mobile Landscape
192
+ $("body").removeClass("mq-tb"); // For Tablets
193
+ $("body").removeClass("mq-ls"); // For Large Screens
194
+ $("body").removeClass("mq-sm"); // For Small Screens
195
+ var queryWidth = $(window).width();
196
+ if (queryWidth < 480) $("body").addClass("mq-mp");
197
+ else if (queryWidth < 768 && queryWidth > 479) $("body").addClass("mq-mp");
198
+ else if (queryWidth < 1023 && queryWidth > 767) $("body").addClass("mq-tb");
199
+ else if (queryWidth > 768) $("body").addClass("mq-ls");
200
+ else if (queryWidth < 769) $("body").addClass("mq-sm");
201
+ }
202
+
203
+ if (window.HAS_MEDIAQUERY) {
204
+ $("html").addClass("mediaquery");
205
+ } else {
206
+ configureMediaQuery();
207
+ $(window).resize(configureMediaQuery);
208
+ }
209
+
210
+ });
211
+
@@ -0,0 +1,3 @@
1
+ window.app.debug = (message) ->
2
+ if (window.app.enable_debug)
3
+ console.log message
@@ -0,0 +1,14 @@
1
+ window.app = {}
2
+ @app = window.app
3
+ @app._routers = []
4
+ @app.routes = {}
5
+ @app.activeView = null
6
+ @app._features = {}
7
+ @app.ui = {}
8
+ @app.enable_debug = true
9
+ @app.domain = ''
10
+
11
+ @app.registerRouter = ( router ) ->
12
+ this._routers.push router
13
+
14
+ # Backbone.old_sync = Backbone.sync
File without changes
File without changes