imagine_cms 4.1.4 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +2 -1
- data/app/assets/images/interface/form_loading.gif +0 -0
- data/app/assets/images/management/btn-top-delete.png +0 -0
- data/app/assets/images/management/btn-top-edit.png +0 -0
- data/app/assets/images/management/btn-top-exterminate.png +0 -0
- data/app/assets/images/management/btn-top-new.png +0 -0
- data/app/assets/images/management/btn-top-preview.png +0 -0
- data/app/assets/images/management/btn-top-properties.png +0 -0
- data/app/assets/javascripts/codemirror/modes-custom/imagine_cms.js +87 -0
- data/app/assets/javascripts/imagine_cms/core.js +510 -0
- data/app/assets/javascripts/imagine_cms/legacy/misc.js +537 -0
- data/app/assets/javascripts/imagine_cms/legacy/rollovers.js +193 -0
- data/app/assets/javascripts/imagine_cms/legacy/slideshow.js +116 -0
- data/app/assets/javascripts/imagine_cms/legacy/textfieldhints.js +55 -0
- data/app/assets/javascripts/imagine_cms.js +14 -1
- data/app/assets/javascripts/imagine_cms_compat.js +26 -0
- data/app/assets/javascripts/jquery-ui.js +16608 -0
- data/app/assets/javascripts/tag-it.js +591 -0
- data/app/assets/stylesheets/imagine_cms.css.scss +26 -10
- data/app/assets/stylesheets/imagine_controls.css.scss +8 -0
- data/app/assets/stylesheets/jquery-ui.css +1225 -0
- data/app/assets/stylesheets/jquery-ui.structure.css +833 -0
- data/app/assets/stylesheets/jquery-ui.theme.css +410 -0
- data/app/assets/stylesheets/jquery.tagit.css +69 -0
- data/app/assets/stylesheets/management.css.scss +7 -0
- data/app/assets/stylesheets/tagit.ui-imagine.css +100 -0
- data/app/controllers/cms/content_controller.rb +28 -45
- data/app/controllers/management/cms_controller.rb +116 -94
- data/app/helpers/cms_application_helper.rb +76 -39
- data/app/models/cms_page.rb +32 -14
- data/app/models/cms_page_object.rb +1 -1
- data/app/models/cms_page_tag.rb +2 -2
- data/app/models/cms_template.rb +1 -1
- data/app/models/user.rb +6 -6
- data/app/models/user_group.rb +1 -1
- data/app/views/cms/content/_photo_gallery.html.erb +12 -12
- data/app/views/cms/content/_search.html.erb +2 -2
- data/app/views/cms/content/_search_result.html.erb +16 -10
- data/app/views/layouts/management.html.erb +18 -17
- data/app/views/management/cms/_edit_page.html.erb +47 -33
- data/app/views/management/cms/_gallery_index.html.erb +4 -4
- data/app/views/management/cms/_image.html.erb +3 -3
- data/app/views/management/cms/_image_details.html.erb +9 -8
- data/app/views/management/cms/_list_page.html.erb +2 -2
- data/app/views/management/cms/_list_page_select.html.erb +1 -1
- data/app/views/management/cms/_page_list.html.erb +69 -48
- data/app/views/management/cms/_page_list_source_folder.html.erb +2 -2
- data/app/views/management/cms/_template_options.html.erb +4 -4
- data/app/views/management/cms/_template_reference.html.erb +13 -15
- data/app/views/management/cms/edit_page_content.html.erb +3 -3
- data/app/views/management/cms/edit_snippet.html.erb +19 -41
- data/app/views/management/cms/edit_template.html.erb +15 -38
- data/app/views/management/cms/pages.html.erb +17 -29
- data/app/views/management/cms/snippets.html.erb +2 -2
- data/app/views/management/cms/templates.html.erb +2 -2
- data/app/views/management/cms/toolbar_edit.html.erb +2 -0
- data/app/views/management/cms/toolbar_preview.html.erb +2 -2
- data/config/initializers/config_file.rb +1 -1
- data/imagine_cms.gemspec +7 -4
- data/lib/extensions/action_controller_extensions.rb +50 -19
- data/lib/imagine_cms/engine.rb +12 -8
- data/lib/imagine_cms/version.rb +1 -1
- data/lib/prototype_legacy_helper/lib/prototype_legacy_helper.rb +2 -2
- data/lib/tasks/imagine_cms_tasks.rake +8 -0
- metadata +69 -91
- data/app/assets/images/management/btn_archive.gif +0 -0
- data/app/assets/images/management/btn_delete.gif +0 -0
- data/app/assets/images/management/btn_duplicate.gif +0 -0
- data/app/assets/images/management/btn_edit.gif +0 -0
- data/app/assets/images/management/btn_new_page.gif +0 -0
- data/app/assets/images/management/btn_preview.gif +0 -0
- data/app/assets/images/management/btn_properties.gif +0 -0
- data/app/assets/images/management/btn_restore.gif +0 -0
- data/app/assets/images/management/btn_top_delete.gif +0 -0
- data/app/assets/images/management/btn_top_duplicate.gif +0 -0
- data/app/assets/images/management/btn_top_edit.gif +0 -0
- data/app/assets/images/management/btn_top_new.gif +0 -0
- data/app/assets/images/management/btn_top_preview.gif +0 -0
- data/app/assets/images/management/btn_top_properties.gif +0 -0
- data/app/assets/javascripts/codepress/codepress.html +0 -36
- data/app/assets/javascripts/codepress/codepress.js +0 -130
- data/app/assets/javascripts/codepress/engines/gecko.js +0 -240
- data/app/assets/javascripts/codepress/engines/khtml.js +0 -0
- data/app/assets/javascripts/codepress/engines/msie.js +0 -263
- data/app/assets/javascripts/codepress/engines/older.js +0 -0
- data/app/assets/javascripts/codepress/engines/opera.js +0 -259
- data/app/assets/javascripts/codepress/languages/css.js +0 -23
- data/app/assets/javascripts/codepress/languages/generic.js +0 -25
- data/app/assets/javascripts/codepress/languages/html.js +0 -63
- data/app/assets/javascripts/codepress/languages/java.js +0 -24
- data/app/assets/javascripts/codepress/languages/javascript.js +0 -30
- data/app/assets/javascripts/codepress/languages/perl.js +0 -27
- data/app/assets/javascripts/codepress/languages/php.js +0 -60
- data/app/assets/javascripts/codepress/languages/ruby.js +0 -26
- data/app/assets/javascripts/codepress/languages/sql.js +0 -30
- data/app/assets/javascripts/codepress/languages/text.js +0 -9
- data/app/assets/javascripts/imagine.js +0 -1393
- data/app/assets/stylesheets/codepress/codepress.css +0 -7
- data/app/assets/stylesheets/codepress/languages/css.css +0 -10
- data/app/assets/stylesheets/codepress/languages/generic.css +0 -9
- data/app/assets/stylesheets/codepress/languages/html.css +0 -18
- data/app/assets/stylesheets/codepress/languages/java.css +0 -7
- data/app/assets/stylesheets/codepress/languages/javascript.css +0 -8
- data/app/assets/stylesheets/codepress/languages/perl.css +0 -11
- data/app/assets/stylesheets/codepress/languages/php.css +0 -12
- data/app/assets/stylesheets/codepress/languages/ruby.css +0 -10
- data/app/assets/stylesheets/codepress/languages/sql.css +0 -10
- data/app/assets/stylesheets/codepress/languages/text.css +0 -5
@@ -0,0 +1,537 @@
|
|
1
|
+
function addLoadEvent(func) {
|
2
|
+
var oldonload = window.onload;
|
3
|
+
if (typeof window.onload != 'function') {
|
4
|
+
window.onload = func;
|
5
|
+
} else {
|
6
|
+
window.onload = function() {
|
7
|
+
oldonload();
|
8
|
+
func();
|
9
|
+
}
|
10
|
+
}
|
11
|
+
}
|
12
|
+
|
13
|
+
function addUnloadEvent(func) {
|
14
|
+
var oldonunload = window.onunload;
|
15
|
+
if (typeof window.onunload != 'function') {
|
16
|
+
window.onunload = func;
|
17
|
+
} else {
|
18
|
+
window.onunload = function() {
|
19
|
+
oldonunload();
|
20
|
+
func();
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
|
26
|
+
/********************************
|
27
|
+
* dialog/popup functions *
|
28
|
+
********************************/
|
29
|
+
|
30
|
+
function openDialog(url, w, h, opts) {
|
31
|
+
window.open(url, '_blank', (w && h ? 'width=' + w + ',height=' + h : '') + (typeof(opts) == 'undefined' ? '' : ',' + opts));
|
32
|
+
}
|
33
|
+
|
34
|
+
// resize the window to fit the content
|
35
|
+
function autoResize(masterDiv) {
|
36
|
+
if (typeof(masterDiv) == 'undefined') {
|
37
|
+
masterDiv = $('masterDiv');
|
38
|
+
} else {
|
39
|
+
masterDiv = $(masterDiv);
|
40
|
+
}
|
41
|
+
var max = Math.min(screen.height - 100, 800);
|
42
|
+
var ht = Math.min(masterDiv.scrollHeight, max);
|
43
|
+
|
44
|
+
if (typeof(window.innerWidth) == 'number') {
|
45
|
+
//Non-IE
|
46
|
+
myWidth = window.innerWidth;
|
47
|
+
myHeight = window.innerHeight;
|
48
|
+
} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
|
49
|
+
//IE 6+ in 'standards compliant mode'
|
50
|
+
myWidth = document.documentElement.clientWidth;
|
51
|
+
myHeight = document.documentElement.clientHeight;
|
52
|
+
} else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
|
53
|
+
//IE 4 compatible
|
54
|
+
myWidth = document.body.clientWidth;
|
55
|
+
myHeight = document.body.clientHeight;
|
56
|
+
}
|
57
|
+
|
58
|
+
resizeBy(0, ht - myHeight);
|
59
|
+
}
|
60
|
+
|
61
|
+
// the opposite... resize the content to fit the window
|
62
|
+
function autoResizeDiv(masterDiv, adjustment) {
|
63
|
+
if (typeof(masterDiv) == 'undefined') {
|
64
|
+
masterDiv = $('masterDiv');
|
65
|
+
} else {
|
66
|
+
masterDiv = $(masterDiv);
|
67
|
+
}
|
68
|
+
if (typeof(adjustment) == 'undefined') adjustment = 0;
|
69
|
+
|
70
|
+
var max = Math.min(screen.height - 100, 800);
|
71
|
+
var ht = Math.min(masterDiv.scrollHeight, max);
|
72
|
+
|
73
|
+
if (typeof(window.innerWidth) == 'number') {
|
74
|
+
//Non-IE
|
75
|
+
myWidth = window.innerWidth;
|
76
|
+
myHeight = window.innerHeight;
|
77
|
+
} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
|
78
|
+
//IE 6+ in 'standards compliant mode'
|
79
|
+
myWidth = document.documentElement.clientWidth;
|
80
|
+
myHeight = document.documentElement.clientHeight;
|
81
|
+
} else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
|
82
|
+
//IE 4 compatible
|
83
|
+
myWidth = document.body.clientWidth;
|
84
|
+
myHeight = document.body.clientHeight;
|
85
|
+
}
|
86
|
+
|
87
|
+
masterDiv.style.height = myHeight - 200 + adjustment + 'px';
|
88
|
+
}
|
89
|
+
|
90
|
+
|
91
|
+
/********************************
|
92
|
+
* horizontal tab interface *
|
93
|
+
********************************/
|
94
|
+
|
95
|
+
function setPageVisibility() {
|
96
|
+
var opts = $A($('page_select').options);
|
97
|
+
opts.each(function (opt) {
|
98
|
+
$(opt.value).hide();
|
99
|
+
});
|
100
|
+
$($F('page_select')).show();
|
101
|
+
}
|
102
|
+
|
103
|
+
|
104
|
+
/********************************
|
105
|
+
* vertical tab interface *
|
106
|
+
********************************/
|
107
|
+
|
108
|
+
function selectTab(tabName, tabArray, tabBtnPrefix, tabDivPrefix, hiddenTextFieldId) {
|
109
|
+
tabArray._each(function (tab) {
|
110
|
+
$(tabBtnPrefix + tab).className = 'tab_normal';
|
111
|
+
$(tabDivPrefix + tab).style.display = 'none';
|
112
|
+
})
|
113
|
+
$('pmtbtn_' + tabName).className = 'tab_selected';
|
114
|
+
$('pmtinfo_' + tabName).style.display = '';
|
115
|
+
$(hiddenTextFieldId).value = tabName;
|
116
|
+
}
|
117
|
+
|
118
|
+
|
119
|
+
function setReportDates(interval) {
|
120
|
+
startDateField = $('report_start_date');
|
121
|
+
endDateField = $('report_end_date');
|
122
|
+
today = startDate = endDate = new Date();
|
123
|
+
|
124
|
+
switch (interval) {
|
125
|
+
case 'yesterday':
|
126
|
+
startDate = new Date('' + (today.getMonth()+1) + '/' + (today.getDate()-1) + '/' + today.getYear());
|
127
|
+
endDate = startDate;
|
128
|
+
break;
|
129
|
+
|
130
|
+
case 'last_month':
|
131
|
+
startDate = new Date('' + today.getMonth() + '/1/' + today.getYear());
|
132
|
+
endDate = new Date('' + (today.getMonth()+1) + '/0/' + today.getYear());
|
133
|
+
break;
|
134
|
+
|
135
|
+
case 'last_quarter':
|
136
|
+
startMonth = Math.floor(today.getMonth() / 3) * 3 - 3;
|
137
|
+
startYear = today.getYear();
|
138
|
+
if (startMonth < 0) {
|
139
|
+
startMonth += 12;
|
140
|
+
startYear--;
|
141
|
+
}
|
142
|
+
endMonth = startMonth + 3;
|
143
|
+
endYear = startYear;
|
144
|
+
if (endMonth > 11) {
|
145
|
+
endMonth -= 12;
|
146
|
+
endYear++;
|
147
|
+
}
|
148
|
+
startDate = new Date('' + (startMonth+1) + '/1/' + startYear);
|
149
|
+
endDate = new Date('' + (endMonth+1) + '/0/' + endYear);
|
150
|
+
break;
|
151
|
+
|
152
|
+
case 'last_year':
|
153
|
+
startDate = new Date('1/1/' + (today.getYear()-1));
|
154
|
+
endDate = new Date('12/31/' + (today.getYear()-1));
|
155
|
+
break;
|
156
|
+
|
157
|
+
case 'today':
|
158
|
+
startDate = new Date('' + (today.getMonth()+1 )+ '/' + today.getDate() + '/' + today.getYear());
|
159
|
+
endDate = startDate;
|
160
|
+
break;
|
161
|
+
|
162
|
+
case 'this_month':
|
163
|
+
startDate = new Date('' + (today.getMonth()+1) + '/1/' + today.getYear());
|
164
|
+
endDate = new Date('' + (today.getMonth()+2) + '/0/' + today.getYear());
|
165
|
+
break;
|
166
|
+
|
167
|
+
case 'this_quarter':
|
168
|
+
startMonth = Math.floor(today.getMonth() / 3) * 3;
|
169
|
+
endMonth = startMonth + 3;
|
170
|
+
endYear = startYear;
|
171
|
+
if (endMonth > 11) {
|
172
|
+
endMonth -= 12;
|
173
|
+
endYear++;
|
174
|
+
}
|
175
|
+
startDate = new Date('' + (startMonth+1) + '/1/' + today.getYear());
|
176
|
+
endDate = new Date('' + (endMonth+1) + '/0/' + endYear);
|
177
|
+
break;
|
178
|
+
|
179
|
+
case 'this_year':
|
180
|
+
startDate = new Date('1/1/' + today.getYear());
|
181
|
+
endDate = new Date('12/31/' + today.getYear());
|
182
|
+
break;
|
183
|
+
|
184
|
+
case 'all_time':
|
185
|
+
startDate = new Date('1/1/' + (today.getYear()-5));
|
186
|
+
endDate = new Date('12/31/' + (today.getYear()+50));
|
187
|
+
break;
|
188
|
+
|
189
|
+
default:
|
190
|
+
// same as "today"
|
191
|
+
startDate = new Date('' + (today.getMonth()+1 )+ '/' + today.getDate() + '/' + today.getYear());
|
192
|
+
endDate = startDate;
|
193
|
+
break;
|
194
|
+
}
|
195
|
+
|
196
|
+
startDateField.value = startDate.format('mm/dd/yyyy');
|
197
|
+
endDateField.value = endDate.format('mm/dd/yyyy');
|
198
|
+
}
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
/*
|
203
|
+
Date Format 1.1
|
204
|
+
(c) 2007 Steven Levithan <stevenlevithan.com>
|
205
|
+
MIT license
|
206
|
+
With code by Scott Trenda (Z and o flags, and enhanced brevity)
|
207
|
+
*/
|
208
|
+
|
209
|
+
/*** dateFormat
|
210
|
+
Accepts a date, a mask, or a date and a mask.
|
211
|
+
Returns a formatted version of the given date.
|
212
|
+
The date defaults to the current date/time.
|
213
|
+
The mask defaults ``"ddd mmm d yyyy HH:MM:ss"``.
|
214
|
+
*/
|
215
|
+
var dateFormat = function () {
|
216
|
+
var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloZ]|"[^"]*"|'[^']*'/g,
|
217
|
+
timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
|
218
|
+
timezoneClip = /[^-+\dA-Z]/g,
|
219
|
+
pad = function (value, length) {
|
220
|
+
value = String(value);
|
221
|
+
length = parseInt(length) || 2;
|
222
|
+
while (value.length < length)
|
223
|
+
value = "0" + value;
|
224
|
+
return value;
|
225
|
+
};
|
226
|
+
|
227
|
+
// Regexes and supporting functions are cached through closure
|
228
|
+
return function (date, mask) {
|
229
|
+
// Treat the first argument as a mask if it doesn't contain any numbers
|
230
|
+
if (
|
231
|
+
arguments.length == 1 &&
|
232
|
+
(typeof date == "string" || date instanceof String) &&
|
233
|
+
!/\d/.test(date)
|
234
|
+
) {
|
235
|
+
mask = date;
|
236
|
+
date = undefined;
|
237
|
+
}
|
238
|
+
|
239
|
+
date = date ? new Date(date) : new Date();
|
240
|
+
if (isNaN(date))
|
241
|
+
throw "invalid date";
|
242
|
+
|
243
|
+
var dF = dateFormat;
|
244
|
+
mask = String(dF.masks[mask] || mask || dF.masks["default"]);
|
245
|
+
|
246
|
+
var d = date.getDate(),
|
247
|
+
D = date.getDay(),
|
248
|
+
m = date.getMonth(),
|
249
|
+
y = date.getFullYear()+1900,
|
250
|
+
H = date.getHours(),
|
251
|
+
M = date.getMinutes(),
|
252
|
+
s = date.getSeconds(),
|
253
|
+
L = date.getMilliseconds(),
|
254
|
+
o = date.getTimezoneOffset(),
|
255
|
+
flags = {
|
256
|
+
d: d,
|
257
|
+
dd: pad(d),
|
258
|
+
ddd: dF.i18n.dayNames[D],
|
259
|
+
dddd: dF.i18n.dayNames[D + 7],
|
260
|
+
m: m + 1,
|
261
|
+
mm: pad(m + 1),
|
262
|
+
mmm: dF.i18n.monthNames[m],
|
263
|
+
mmmm: dF.i18n.monthNames[m + 12],
|
264
|
+
yy: String(y).slice(2),
|
265
|
+
yyyy: y,
|
266
|
+
h: H % 12 || 12,
|
267
|
+
hh: pad(H % 12 || 12),
|
268
|
+
H: H,
|
269
|
+
HH: pad(H),
|
270
|
+
M: M,
|
271
|
+
MM: pad(M),
|
272
|
+
s: s,
|
273
|
+
ss: pad(s),
|
274
|
+
l: pad(L, 3),
|
275
|
+
L: pad(L > 99 ? Math.round(L / 10) : L),
|
276
|
+
t: H < 12 ? "a" : "p",
|
277
|
+
tt: H < 12 ? "am" : "pm",
|
278
|
+
T: H < 12 ? "A" : "P",
|
279
|
+
TT: H < 12 ? "AM" : "PM",
|
280
|
+
Z: (String(date).match(timezone) || [""]).pop().replace(timezoneClip, ""),
|
281
|
+
o: (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4)
|
282
|
+
};
|
283
|
+
|
284
|
+
return mask.replace(token, function ($0) {
|
285
|
+
return ($0 in flags) ? flags[$0] : $0.slice(1, $0.length - 1);
|
286
|
+
});
|
287
|
+
};
|
288
|
+
}();
|
289
|
+
|
290
|
+
// Some common format strings
|
291
|
+
dateFormat.masks = {
|
292
|
+
"default": "ddd mmm d yyyy HH:MM:ss",
|
293
|
+
shortDate: "m/d/yy",
|
294
|
+
mediumDate: "mmm d, yyyy",
|
295
|
+
longDate: "mmmm d, yyyy",
|
296
|
+
fullDate: "dddd, mmmm d, yyyy",
|
297
|
+
shortTime: "h:MM TT",
|
298
|
+
mediumTime: "h:MM:ss TT",
|
299
|
+
longTime: "h:MM:ss TT Z",
|
300
|
+
isoDate: "yyyy-mm-dd",
|
301
|
+
isoTime: "HH:MM:ss",
|
302
|
+
isoDateTime: "yyyy-mm-dd'T'HH:MM:ss",
|
303
|
+
isoFullDateTime: "yyyy-mm-dd'T'HH:MM:ss.lo"
|
304
|
+
};
|
305
|
+
|
306
|
+
// Internationalization strings
|
307
|
+
dateFormat.i18n = {
|
308
|
+
dayNames: [
|
309
|
+
"Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat",
|
310
|
+
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
|
311
|
+
],
|
312
|
+
monthNames: [
|
313
|
+
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
|
314
|
+
"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
|
315
|
+
]
|
316
|
+
};
|
317
|
+
|
318
|
+
// For convenience...
|
319
|
+
Date.prototype.format = function (mask) {
|
320
|
+
return dateFormat(this, mask);
|
321
|
+
}
|
322
|
+
|
323
|
+
|
324
|
+
// Ultimate client-side JavaScript client sniff. Version 3.03
|
325
|
+
// (C) Netscape Communications 1999. Permission granted to reuse and distribute.
|
326
|
+
// Revised 17 May 99 to add is.nav5up and is.ie5up (see below).
|
327
|
+
// Revised 21 Nov 00 to add is.gecko and is.ie5_5 Also Changed is.nav5 and is.nav5up to is.nav6 and is.nav6up
|
328
|
+
// Revised 22 Feb 01 to correct Javascript Detection for IE 5.x, Opera 4,
|
329
|
+
// correct Opera 5 detection
|
330
|
+
// add support for winME and win2k
|
331
|
+
// synch with browser-type-oo.js
|
332
|
+
// Revised 26 Mar 01 to correct Opera detection
|
333
|
+
// Revised 02 Oct 01 to add IE6 detection
|
334
|
+
|
335
|
+
// Everything you always wanted to know about your JavaScript client
|
336
|
+
// but were afraid to ask ... "Is" is the constructor function for "is" object,
|
337
|
+
// which has properties indicating:
|
338
|
+
// (1) browser vendor:
|
339
|
+
// is.nav, is.ie, is.opera, is.hotjava, is.webtv, is.TVNavigator, is.AOLTV
|
340
|
+
// (2) browser version number:
|
341
|
+
// is.major (integer indicating major version number: 2, 3, 4 ...)
|
342
|
+
// is.minor (float indicating full version number: 2.02, 3.01, 4.04 ...)
|
343
|
+
// (3) browser vendor AND major version number
|
344
|
+
// is.nav2, is.nav3, is.nav4, is.nav4up, is.nav6, is.nav6up, is.gecko, is.ie3,
|
345
|
+
// is.ie4, is.ie4up, is.ie5, is.ie5up, is.ie5_5, is.ie5_5up, is.ie6, is.ie6up, is.hotjava3, is.hotjava3up
|
346
|
+
// (4) JavaScript version number:
|
347
|
+
// is.js (float indicating full JavaScript version number: 1, 1.1, 1.2 ...)
|
348
|
+
// (5) OS platform and version:
|
349
|
+
// is.win, is.win16, is.win32, is.win31, is.win95, is.winnt, is.win98, is.winme, is.win2k
|
350
|
+
// is.os2
|
351
|
+
// is.mac, is.mac68k, is.macppc
|
352
|
+
// is.unix
|
353
|
+
// is.sun, is.sun4, is.sun5, is.suni86
|
354
|
+
// is.irix, is.irix5, is.irix6
|
355
|
+
// is.hpux, is.hpux9, is.hpux10
|
356
|
+
// is.aix, is.aix1, is.aix2, is.aix3, is.aix4
|
357
|
+
// is.linux, is.sco, is.unixware, is.mpras, is.reliant
|
358
|
+
// is.dec, is.sinix, is.freebsd, is.bsd
|
359
|
+
// is.vms
|
360
|
+
//
|
361
|
+
// See http://www.it97.de/JavaScript/JS_tutorial/bstat/navobj.html and
|
362
|
+
// http://www.it97.de/JavaScript/JS_tutorial/bstat/Browseraol.html
|
363
|
+
// for detailed lists of userAgent strings.
|
364
|
+
//
|
365
|
+
// Note: you don't want your Nav4 or IE4 code to "turn off" or
|
366
|
+
// stop working when Nav5 and IE5 (or later) are released, so
|
367
|
+
// in conditional code forks, use is.nav4up ("Nav4 or greater")
|
368
|
+
// and is.ie4up ("IE4 or greater") instead of is.nav4 or is.ie4
|
369
|
+
// to check version in code which you want to work on future
|
370
|
+
// versions.
|
371
|
+
|
372
|
+
|
373
|
+
function Is ()
|
374
|
+
{ // convert all characters to lowercase to simplify testing
|
375
|
+
var agt=navigator.userAgent.toLowerCase();
|
376
|
+
|
377
|
+
// *** BROWSER VERSION ***
|
378
|
+
// Note: On IE5, these return 4, so use is.ie5up to detect IE5.
|
379
|
+
|
380
|
+
this.major = parseInt(navigator.appVersion);
|
381
|
+
this.minor = parseFloat(navigator.appVersion);
|
382
|
+
|
383
|
+
// Note: Opera and WebTV spoof Navigator. We do strict client detection.
|
384
|
+
// If you want to allow spoofing, take out the tests for opera and webtv.
|
385
|
+
this.nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
|
386
|
+
&& (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
|
387
|
+
&& (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
|
388
|
+
this.nav2 = (this.nav && (this.major == 2));
|
389
|
+
this.nav3 = (this.nav && (this.major == 3));
|
390
|
+
this.nav4 = (this.nav && (this.major == 4));
|
391
|
+
this.nav4up = (this.nav && (this.major >= 4));
|
392
|
+
this.navonly = (this.nav && ((agt.indexOf(";nav") != -1) ||
|
393
|
+
(agt.indexOf("; nav") != -1)) );
|
394
|
+
this.nav6 = (this.nav && (this.major == 5));
|
395
|
+
this.nav6up = (this.nav && (this.major >= 5));
|
396
|
+
this.gecko = (agt.indexOf('gecko') != -1);
|
397
|
+
|
398
|
+
|
399
|
+
this.ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
|
400
|
+
this.ie3 = (this.ie && (this.major < 4));
|
401
|
+
this.ie4 = (this.ie && (this.major == 4) && (agt.indexOf("msie 4")!=-1) );
|
402
|
+
this.ie4up = (this.ie && (this.major >= 4));
|
403
|
+
this.ie5 = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.0")!=-1) );
|
404
|
+
this.ie5_5 = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.5") !=-1));
|
405
|
+
this.ie5up = (this.ie && !this.ie3 && !this.ie4);
|
406
|
+
this.ie5_5up =(this.ie && !this.ie3 && !this.ie4 && !this.ie5);
|
407
|
+
this.ie6 = (this.ie && (this.major == 4) && (agt.indexOf("msie 6.")!=-1) );
|
408
|
+
this.ie6up = (this.ie && !this.ie3 && !this.ie4 && !this.ie5 && !this.ie5_5);
|
409
|
+
this.ie7 = (this.ie && (this.major == 4) && (agt.indexOf("msie 7.")!=-1) );
|
410
|
+
this.ie7up = (this.ie && !this.ie3 && !this.ie4 && !this.ie5 && !this.ie5_5 && !this.ie6);
|
411
|
+
|
412
|
+
// KNOWN BUG: On AOL4, returns false if IE3 is embedded browser
|
413
|
+
// or if this is the first browser window opened. Thus the
|
414
|
+
// variables is.aol, is.aol3, and is.aol4 aren't 100% reliable.
|
415
|
+
this.aol = (agt.indexOf("aol") != -1);
|
416
|
+
this.aol3 = (this.aol && this.ie3);
|
417
|
+
this.aol4 = (this.aol && this.ie4);
|
418
|
+
this.aol5 = (agt.indexOf("aol 5") != -1);
|
419
|
+
this.aol6 = (agt.indexOf("aol 6") != -1);
|
420
|
+
|
421
|
+
this.opera = (agt.indexOf("opera") != -1);
|
422
|
+
this.opera2 = (agt.indexOf("opera 2") != -1 || agt.indexOf("opera/2") != -1);
|
423
|
+
this.opera3 = (agt.indexOf("opera 3") != -1 || agt.indexOf("opera/3") != -1);
|
424
|
+
this.opera4 = (agt.indexOf("opera 4") != -1 || agt.indexOf("opera/4") != -1);
|
425
|
+
this.opera5 = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1);
|
426
|
+
this.opera5up = (this.opera && !this.opera2 && !this.opera3 && !this.opera4);
|
427
|
+
|
428
|
+
this.webtv = (agt.indexOf("webtv") != -1);
|
429
|
+
|
430
|
+
this.TVNavigator = ((agt.indexOf("navio") != -1) || (agt.indexOf("navio_aoltv") != -1));
|
431
|
+
this.AOLTV = this.TVNavigator;
|
432
|
+
|
433
|
+
this.hotjava = (agt.indexOf("hotjava") != -1);
|
434
|
+
this.hotjava3 = (this.hotjava && (this.major == 3));
|
435
|
+
this.hotjava3up = (this.hotjava && (this.major >= 3));
|
436
|
+
|
437
|
+
// *** JAVASCRIPT VERSION CHECK ***
|
438
|
+
if (this.nav2 || this.ie3) this.js = 1.0;
|
439
|
+
else if (this.nav3) this.js = 1.1;
|
440
|
+
else if (this.opera5up) this.js = 1.3;
|
441
|
+
else if (this.opera) this.js = 1.1;
|
442
|
+
else if ((this.nav4 && (this.minor <= 4.05)) || this.ie4) this.js = 1.2;
|
443
|
+
else if ((this.nav4 && (this.minor > 4.05)) || this.ie5) this.js = 1.3;
|
444
|
+
else if (this.hotjava3up) this.js = 1.4;
|
445
|
+
else if (this.nav6 || this.gecko) this.js = 1.5;
|
446
|
+
// NOTE: In the future, update this code when newer versions of JS
|
447
|
+
// are released. For now, we try to provide some upward compatibility
|
448
|
+
// so that future versions of Nav and IE will show they are at
|
449
|
+
// *least* JS 1.x capable. Always check for JS version compatibility
|
450
|
+
// with > or >=.
|
451
|
+
else if (this.nav6up) this.js = 1.5;
|
452
|
+
// note ie5up on mac is 1.4
|
453
|
+
else if (this.ie5up) this.js = 1.3
|
454
|
+
|
455
|
+
// HACK: no idea for other browsers; always check for JS version with > or >=
|
456
|
+
else this.js = 0.0;
|
457
|
+
|
458
|
+
// *** PLATFORM ***
|
459
|
+
this.win = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
|
460
|
+
// NOTE: On Opera 3.0, the userAgent string includes "Windows 95/NT4" on all
|
461
|
+
// Win32, so you can't distinguish between Win95 and WinNT.
|
462
|
+
this.win95 = ((agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1));
|
463
|
+
|
464
|
+
// is this a 16 bit compiled version?
|
465
|
+
this.win16 = ((agt.indexOf("win16")!=-1) ||
|
466
|
+
(agt.indexOf("16bit")!=-1) || (agt.indexOf("windows 3.1")!=-1) ||
|
467
|
+
(agt.indexOf("windows 16-bit")!=-1) );
|
468
|
+
|
469
|
+
this.win31 = ((agt.indexOf("windows 3.1")!=-1) || (agt.indexOf("win16")!=-1) ||
|
470
|
+
(agt.indexOf("windows 16-bit")!=-1));
|
471
|
+
|
472
|
+
// NOTE: Reliable detection of Win98 may not be possible. It appears that:
|
473
|
+
// - On Nav 4.x and before you'll get plain "Windows" in userAgent.
|
474
|
+
// - On Mercury client, the 32-bit version will return "Win98", but
|
475
|
+
// the 16-bit version running on Win98 will still return "Win95".
|
476
|
+
this.win98 = ((agt.indexOf("win98")!=-1) || (agt.indexOf("windows 98")!=-1));
|
477
|
+
this.winnt = ((agt.indexOf("winnt")!=-1) || (agt.indexOf("windows nt")!=-1));
|
478
|
+
this.win32 = (this.win95 || this.winnt || this.win98 ||
|
479
|
+
((this.major >= 4) && (navigator.platform == "Win32")) ||
|
480
|
+
(agt.indexOf("win32")!=-1) || (agt.indexOf("32bit")!=-1));
|
481
|
+
|
482
|
+
this.winme = ((agt.indexOf("win 9x 4.90")!=-1));
|
483
|
+
this.win2k = ((agt.indexOf("windows nt 5.0")!=-1));
|
484
|
+
|
485
|
+
this.os2 = ((agt.indexOf("os/2")!=-1) ||
|
486
|
+
(navigator.appVersion.indexOf("OS/2")!=-1) ||
|
487
|
+
(agt.indexOf("ibm-webexplorer")!=-1));
|
488
|
+
|
489
|
+
this.mac = (agt.indexOf("mac")!=-1);
|
490
|
+
// hack ie5 js version for mac
|
491
|
+
if (this.mac && this.ie5up) this.js = 1.4;
|
492
|
+
this.mac68k = (this.mac && ((agt.indexOf("68k")!=-1) ||
|
493
|
+
(agt.indexOf("68000")!=-1)));
|
494
|
+
this.macppc = (this.mac && ((agt.indexOf("ppc")!=-1) ||
|
495
|
+
(agt.indexOf("powerpc")!=-1)));
|
496
|
+
|
497
|
+
this.sun = (agt.indexOf("sunos")!=-1);
|
498
|
+
this.sun4 = (agt.indexOf("sunos 4")!=-1);
|
499
|
+
this.sun5 = (agt.indexOf("sunos 5")!=-1);
|
500
|
+
this.suni86= (this.sun && (agt.indexOf("i86")!=-1));
|
501
|
+
this.irix = (agt.indexOf("irix") !=-1); // SGI
|
502
|
+
this.irix5 = (agt.indexOf("irix 5") !=-1);
|
503
|
+
this.irix6 = ((agt.indexOf("irix 6") !=-1) || (agt.indexOf("irix6") !=-1));
|
504
|
+
this.hpux = (agt.indexOf("hp-ux")!=-1);
|
505
|
+
this.hpux9 = (this.hpux && (agt.indexOf("09.")!=-1));
|
506
|
+
this.hpux10= (this.hpux && (agt.indexOf("10.")!=-1));
|
507
|
+
this.aix = (agt.indexOf("aix") !=-1); // IBM
|
508
|
+
this.aix1 = (agt.indexOf("aix 1") !=-1);
|
509
|
+
this.aix2 = (agt.indexOf("aix 2") !=-1);
|
510
|
+
this.aix3 = (agt.indexOf("aix 3") !=-1);
|
511
|
+
this.aix4 = (agt.indexOf("aix 4") !=-1);
|
512
|
+
this.linux = (agt.indexOf("inux")!=-1);
|
513
|
+
this.sco = (agt.indexOf("sco")!=-1) || (agt.indexOf("unix_sv")!=-1);
|
514
|
+
this.unixware = (agt.indexOf("unix_system_v")!=-1);
|
515
|
+
this.mpras = (agt.indexOf("ncr")!=-1);
|
516
|
+
this.reliant = (agt.indexOf("reliantunix")!=-1);
|
517
|
+
this.dec = ((agt.indexOf("dec")!=-1) || (agt.indexOf("osf1")!=-1) ||
|
518
|
+
(agt.indexOf("dec_alpha")!=-1) || (agt.indexOf("alphaserver")!=-1) ||
|
519
|
+
(agt.indexOf("ultrix")!=-1) || (agt.indexOf("alphastation")!=-1));
|
520
|
+
this.sinix = (agt.indexOf("sinix")!=-1);
|
521
|
+
this.freebsd = (agt.indexOf("freebsd")!=-1);
|
522
|
+
this.bsd = (agt.indexOf("bsd")!=-1);
|
523
|
+
this.unix = ((agt.indexOf("x11")!=-1) || this.sun || this.irix || this.hpux ||
|
524
|
+
this.sco ||this.unixware || this.mpras || this.reliant ||
|
525
|
+
this.dec || this.sinix || this.aix || this.linux || this.bsd || this.freebsd);
|
526
|
+
|
527
|
+
this.vms = ((agt.indexOf("vax")!=-1) || (agt.indexOf("openvms")!=-1));
|
528
|
+
}
|
529
|
+
|
530
|
+
var is;
|
531
|
+
var isIE3Mac = false;
|
532
|
+
// this section is designed specifically for IE3 for the Mac
|
533
|
+
|
534
|
+
if ((navigator.appVersion.indexOf("Mac")!=-1) && (navigator.userAgent.indexOf("MSIE")!=-1) &&
|
535
|
+
(parseInt(navigator.appVersion)==3))
|
536
|
+
isIE3Mac = true;
|
537
|
+
else is = new Is();
|