jreject_rails 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in jreject_rails.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Forward
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,51 @@
1
+ # JRejectRails
2
+
3
+ Easily add jReject plugin for warning users that you don't support certain browsers and prompting them to upgrade.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'jreject_rails'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ ## Usage
16
+
17
+ Add javascript sprocket include to application.js:
18
+
19
+ //= require jquery.reject
20
+
21
+ Add css sprocket include to application.css:
22
+
23
+ *= require jquery.reject
24
+
25
+ ### Call it in your javascript code:
26
+
27
+ javascript:
28
+
29
+ $(function() {
30
+ $.reject({
31
+ reject: {
32
+ msie5: true,
33
+ msie6: true,
34
+ msie7: true
35
+ }
36
+ });
37
+ });
38
+
39
+ coffeescript:
40
+
41
+ $ ->
42
+ $.reject reject:
43
+ msie5: true, msie6: true, msie7: true
44
+
45
+ ## Contributing
46
+
47
+ 1. Fork it
48
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
49
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
50
+ 4. Push to the branch (`git push origin my-new-feature`)
51
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
Binary file
Binary file
Binary file
@@ -0,0 +1,542 @@
1
+ /*
2
+ * jReject (jQuery Browser Rejection Plugin)
3
+ * Version 1.0.1
4
+ * URL: http://jreject.turnwheel.com/
5
+ * Description: jReject is a easy method of rejecting specific browsers on your site
6
+ * Author: Steven Bower (TurnWheel Designs) http://turnwheel.com/
7
+ * Copyright: Copyright (c) 2009-2011 Steven Bower under dual MIT/GPL license.
8
+ */
9
+
10
+ (function($) {
11
+ $.reject = function(options) {
12
+ var opts = $.extend(true,{
13
+ reject : { // Rejection flags for specific browsers
14
+ all: false, // Covers Everything (Nothing blocked)
15
+ msie5: true, msie6: true // Covers MSIE 5-6 (Blocked by default)
16
+ /*
17
+ * Possibilities are endless...
18
+ *
19
+ * // MSIE Flags (Global, 5-8)
20
+ * msie, msie5, msie6, msie7, msie8,
21
+ * // Firefox Flags (Global, 1-3)
22
+ * firefox, firefox1, firefox2, firefox3,
23
+ * // Konqueror Flags (Global, 1-3)
24
+ * konqueror, konqueror1, konqueror2, konqueror3,
25
+ * // Chrome Flags (Global, 1-4)
26
+ * chrome, chrome1, chrome2, chrome3, chrome4,
27
+ * // Safari Flags (Global, 1-4)
28
+ * safari, safari2, safari3, safari4,
29
+ * // Opera Flags (Global, 7-10)
30
+ * opera, opera7, opera8, opera9, opera10,
31
+ * // Rendering Engines (Gecko, Webkit, Trident, KHTML, Presto)
32
+ * gecko, webkit, trident, khtml, presto,
33
+ * // Operating Systems (Win, Mac, Linux, Solaris, iPhone)
34
+ * win, mac, linux, solaris, iphone,
35
+ * unknown // Unknown covers everything else
36
+ */
37
+ },
38
+ display: [], // What browsers to display and their order (default set below)
39
+ browserShow: true, // Should the browser options be shown?
40
+ browserInfo: { // Settings for which browsers to display
41
+ firefox: {
42
+ text: 'Firefox 12', // Text below the icon
43
+ url: 'http://www.mozilla.com/firefox/' // URL For icon/text link
44
+ },
45
+ safari: {
46
+ text: 'Safari 5',
47
+ url: 'http://www.apple.com/safari/download/'
48
+ },
49
+ opera: {
50
+ text: 'Opera 11',
51
+ url: 'http://www.opera.com/download/'
52
+ },
53
+ chrome: {
54
+ text: 'Chrome 18',
55
+ url: 'http://www.google.com/chrome/'
56
+ },
57
+ msie: {
58
+ text: 'Internet Explorer 9',
59
+ url: 'http://www.microsoft.com/windows/Internet-explorer/'
60
+ },
61
+ gcf: {
62
+ text: 'Google Chrome Frame',
63
+ url: 'http://code.google.com/chrome/chromeframe/',
64
+ // This browser option will only be displayed for MSIE
65
+ allow: { all: false, msie: true }
66
+ }
67
+ },
68
+
69
+ // Header of pop-up window
70
+ header: 'Did you know that your Internet Browser is out of date?',
71
+ // Paragraph 1
72
+ paragraph1: 'Your browser is out of date, and may not be compatible with '+
73
+ 'our website. A list of the most popular web browsers can be '+
74
+ 'found below.',
75
+ // Paragraph 2
76
+ paragraph2: 'Just click on the icons to get to the download page',
77
+ close: true, // Allow closing of window
78
+ // Message displayed below closing link
79
+ closeMessage: 'By closing this window you acknowledge that your experience '+
80
+ 'on this website may be degraded',
81
+ closeLink: 'Close This Window', // Text for closing link
82
+ closeURL: '#', // Close URL
83
+ closeESC: true, // Allow closing of window with esc key
84
+
85
+ // If cookies should be used to remmember if the window was closed
86
+ // See cookieSettings for more options
87
+ closeCookie: false,
88
+ // Cookie settings are only used if closeCookie is true
89
+ cookieSettings: {
90
+ // Path for the cookie to be saved on
91
+ // Should be root domain in most cases
92
+ path: '/',
93
+ // Expiration Date (in seconds)
94
+ // 0 (default) means it ends with the current session
95
+ expires: 0
96
+ },
97
+
98
+ imagePath: './assets/', // Path where images are located
99
+ overlayBgColor: '#000', // Background color for overlay
100
+ overlayOpacity: 0.8, // Background transparency (0-1)
101
+
102
+ // Fade in time on open ('slow','medium','fast' or integer in ms)
103
+ fadeInTime: 'fast',
104
+ // Fade out time on close ('slow','medium','fast' or integer in ms)
105
+ fadeOutTime: 'fast',
106
+
107
+ // Google Analytics Link Tracking (Optional)
108
+ // Set to true to enable
109
+ // Note: Analytics tracking code must be added separately
110
+ analytics: false
111
+ }, options);
112
+
113
+ // Set default browsers to display if not already defined
114
+ if (opts.display.length < 1)
115
+ opts.display = ['firefox','chrome','msie','safari','opera','gcf'];
116
+
117
+ // beforeRject: Customized Function
118
+ if ($.isFunction(opts.beforeReject)) opts.beforeReject();
119
+
120
+ // Disable 'closeESC' if closing is disabled (mutually exclusive)
121
+ if (!opts.close) opts.closeESC = false;
122
+
123
+ // This function parses the advanced browser options
124
+ var browserCheck = function(settings) {
125
+ // Check 1: Look for 'all' forced setting
126
+ // Check 2: Operating System (eg. 'win','mac','linux','solaris','iphone')
127
+ // Check 3: Rendering engine (eg. 'webkit', 'gecko', 'trident')
128
+ // Check 4: Browser name (eg. 'firefox','msie','chrome')
129
+ // Check 5: Browser+major version (eg. 'firefox3','msie7','chrome4')
130
+ return (settings['all'] ? true : false) ||
131
+ (settings[$.os.name] ? true : false) ||
132
+ (settings[$.layout.name] ? true : false) ||
133
+ (settings[$.browser.name] ? true : false) ||
134
+ (settings[$.browser.className] ? true : false);
135
+ };
136
+
137
+ // Determine if we need to display rejection for this browser, or exit
138
+ if (!browserCheck(opts.reject)) {
139
+ // onFail: Customized Function
140
+ if ($.isFunction(opts.onFail)) opts.onFail();
141
+ return false;
142
+ }
143
+
144
+ // If user can close and set to remmember close, initiate cookie functions
145
+ if (opts.close && opts.closeCookie) {
146
+ // Local global setting for the name of the cookie used
147
+ var COOKIE_NAME = 'jreject-close';
148
+
149
+ // Cookies Function: Handles creating/retrieving/deleting cookies
150
+ // Cookies are only used for opts.closeCookie parameter functionality
151
+ var _cookie = function(name, value) {
152
+ if (typeof value != 'undefined') {
153
+ var expires = '';
154
+
155
+ // Check if we need to set an expiration date
156
+ if (opts.cookieSettings.expires !== 0) {
157
+ var date = new Date();
158
+ date.setTime(date.getTime()+(opts.cookieSettings.expires*1000));
159
+ expires = "; expires="+date.toGMTString();
160
+ }
161
+
162
+ // Get path from settings
163
+ var path = opts.cookieSettings.path || '/';
164
+
165
+ // Set Cookie with parameters
166
+ document.cookie = name+'='+
167
+ encodeURIComponent((!value) ? '' : value)+expires+
168
+ '; path='+path;
169
+ }
170
+ else { // Get cookie value
171
+ var cookie,val = null;
172
+
173
+ if (document.cookie && document.cookie !== '') {
174
+ var cookies = document.cookie.split(';');
175
+
176
+ // Loop through all cookie values
177
+ var clen = cookies.length;
178
+ for (var i = 0; i < clen; ++i) {
179
+ cookie = $.trim(cookies[i]);
180
+
181
+ // Does this cookie string begin with the name we want?
182
+ if (cookie.substring(0,name.length+1) == (name+'=')) {
183
+ var len = name.length;
184
+ val = decodeURIComponent(cookie.substring(len+1));
185
+ break;
186
+ }
187
+ }
188
+ }
189
+
190
+ return val; // Return cookie value
191
+ }
192
+ };
193
+
194
+ // If cookie is set, return false and don't display rejection
195
+ if (_cookie(COOKIE_NAME)) return false;
196
+ }
197
+
198
+ // Load background overlay (jr_overlay) + Main wrapper (jr_wrap) +
199
+ // Inner Wrapper (jr_inner) w/ opts.header (jr_header) +
200
+ // opts.paragraph1/opts.paragraph2 if set
201
+ var html = '<div id="jr_overlay"></div><div id="jr_wrap"><div id="jr_inner">'+
202
+ '<h1 id="jr_header">'+opts.header+'</h1>'+
203
+ (opts.paragraph1 === '' ? '' : '<p>'+opts.paragraph1+'</p>')+
204
+ (opts.paragraph2 === '' ? '' : '<p>'+opts.paragraph2+'</p>');
205
+
206
+ if (opts.browserShow) {
207
+ html += '<ul>';
208
+
209
+ var displayNum = 0; // Tracks number of browsers being displayed
210
+ // Generate the browsers to display
211
+ for (var x in opts.display) {
212
+ var browser = opts.display[x]; // Current Browser
213
+ var info = opts.browserInfo[browser] || false; // Browser Information
214
+
215
+ // If no info exists for this browser
216
+ // or if this browser is not suppose to display to this user
217
+ if (!info || (info['allow'] != undefined && !browserCheck(info['allow']))) {
218
+ continue;
219
+ }
220
+
221
+ var url = info.url || '#'; // URL to link text/icon to
222
+ // Generate HTML for this browser option
223
+ html += '<li id="jr_'+browser+'"><div class="jr_icon"></div>'+
224
+ '<div><a href="'+url+'">'+(info.text || 'Unknown')+'</a>'+
225
+ '</div></li>';
226
+ ++displayNum; // Increment number of browser being displayed
227
+ }
228
+
229
+ html += '</ul>';
230
+ }
231
+
232
+ // Close list and #jr_list
233
+ html += '<div id="jr_close">'+
234
+ // Display close links/message if set
235
+ (opts.close ? '<a href="'+opts.closeURL+'">'+opts.closeLink+'</a>'+
236
+ '<p>'+opts.closeMessage+'</p>' : '')+'</div>'+
237
+ // Close #jr_inner and #jr_wrap
238
+ '</div></div>';
239
+
240
+ var element = $('<div>'+html+'</div>'); // Create element
241
+ var size = _pageSize(); // Get page size
242
+ var scroll = _scrollSize(); // Get page scroll
243
+
244
+ // This function handles closing this reject window
245
+ // When clicked, fadeOut and remove all elements
246
+ element.bind('closejr', function() {
247
+ // Make sure the permission to close is granted
248
+ if (!opts.close) return false;
249
+
250
+ // Customized Function
251
+ if ($.isFunction(opts.beforeClose)) opts.beforeClose();
252
+
253
+ // Remove binding function so it
254
+ // doesn't get called more than once
255
+ $(this).unbind('closejr');
256
+
257
+ // Fade out background and modal wrapper
258
+ $('#jr_overlay,#jr_wrap').fadeOut(opts.fadeOutTime,function() {
259
+ $(this).remove(); // Remove element from DOM
260
+
261
+ // afterClose: Customized Function
262
+ if ($.isFunction(opts.afterClose)) opts.afterClose();
263
+ });
264
+
265
+ // Show elements that were hidden for layering issues
266
+ var elmhide = 'embed.jr_hidden, object.jr_hidden, select.jr_hidden, applet.jr_hidden';
267
+ $(elmhide).show().removeClass('jr_hidden');
268
+
269
+ // Set close cookie for next run
270
+ if (opts.closeCookie) _cookie(COOKIE_NAME,'true');
271
+ return true;
272
+ });
273
+
274
+ // Tracks clicks in Google Analytics (category 'External Links')
275
+ // only if opts.analytics is enabled
276
+ var analytics = function (url) {
277
+ if (!opts.analytics) return false;
278
+
279
+ // Get just the hostname
280
+ var host = url.split(/\/+/g)[1];
281
+
282
+ // Send external link event to Google Analaytics
283
+ // Attempts both versions of analytics code. (Newest first)
284
+ try {
285
+ // Newest analytics code
286
+ _gaq.push(['_trackEvent','External Links', host, url]);
287
+ } catch (e) {
288
+ try {
289
+ // Older analytics code
290
+ pageTracker._trackEvent('External Links', host, url);
291
+ } catch (e) { }
292
+ }
293
+ };
294
+
295
+ // Called onClick for browser links (and icons)
296
+ // Opens link in new window
297
+ var openBrowserLinks = function(url) {
298
+ // Send link to analytics if enabled
299
+ analytics(url);
300
+
301
+ // Open window, generate random id value
302
+ window.open(url, 'jr_'+ Math.round(Math.random()*11));
303
+
304
+ return false;
305
+ };
306
+
307
+ /*
308
+ * Trverse through element DOM and apply JS variables
309
+ * All CSS elements that do not require JS will be in
310
+ * css/jquery.jreject.css
311
+ */
312
+
313
+ // Creates 'background' (div)
314
+ element.find('#jr_overlay').css({
315
+ width: size[0],
316
+ height: size[1],
317
+ background: opts.overlayBgColor,
318
+ opacity: opts.overlayOpacity
319
+ });
320
+
321
+ // Wrapper for our pop-up (div)
322
+ element.find('#jr_wrap').css({
323
+ top: scroll[1]+(size[3]/4),
324
+ left: scroll[0]
325
+ });
326
+
327
+ // Wrapper for inner centered content (div)
328
+ element.find('#jr_inner').css({
329
+ minWidth: displayNum*100,
330
+ maxWidth: displayNum*140,
331
+ // min/maxWidth not supported by IE
332
+ width: $.layout.name == 'trident' ? displayNum*155 : 'auto'
333
+ });
334
+
335
+ element.find('#jr_inner li').css({ // Browser list items (li)
336
+ background: 'transparent url("'+opts.imagePath+'background_browser.gif")'+
337
+ 'no-repeat scroll left top'
338
+ });
339
+
340
+ element.find('#jr_inner li .jr_icon').each(function() {
341
+ // Dynamically sets the icon background image
342
+ var self = $(this);
343
+ self.css('background','transparent url('+opts.imagePath+'browser_'+
344
+ (self.parent('li').attr('id').replace(/jr_/,''))+'.gif)'+
345
+ ' no-repeat scroll left top');
346
+
347
+ // Send link clicks to openBrowserLinks
348
+ self.click(function () {
349
+ var url = $(this).next('div').children('a').attr('href');
350
+ openBrowserLinks(url);
351
+ });
352
+ });
353
+
354
+ element.find('#jr_inner li a').click(function() {
355
+ openBrowserLinks($(this).attr('href'));
356
+ return false;
357
+ });
358
+
359
+ // Bind closing event to trigger closejr
360
+ // to be consistant with ESC key close function
361
+ element.find('#jr_close a').click(function() {
362
+ $(this).trigger('closejr');
363
+
364
+ // If plain anchor is set, return false so there is no page jump
365
+ if (opts.closeURL === '#') return false;
366
+ });
367
+
368
+ // Set focus (fixes ESC key issues with forms and other focus bugs)
369
+ $('#jr_overlay').focus();
370
+
371
+ // Hide elements that won't display properly
372
+ $('embed, object, select, applet').each(function() {
373
+ if ($(this).is(':visible')) {
374
+ $(this).hide().addClass('jr_hidden');
375
+ }
376
+ });
377
+
378
+ // Append element to body of document to display
379
+ $('body').append(element.hide().fadeIn(opts.fadeInTime));
380
+
381
+ // Handle window resize/scroll events and update overlay dimensions
382
+ $(window).bind('resize scroll',function() {
383
+ var size = _pageSize(); // Get size
384
+
385
+ // Update overlay dimensions based on page size
386
+ $('#jr_overlay').css({
387
+ width: size[0],
388
+ height: size[1]
389
+ });
390
+
391
+ var scroll = _scrollSize(); // Get page scroll
392
+
393
+ // Update modal position based on scroll
394
+ $('#jr_wrap').css({
395
+ top: scroll[1] + (size[3]/4),
396
+ left: scroll[0]
397
+ });
398
+ });
399
+
400
+ // Add optional ESC Key functionality
401
+ if (opts.closeESC) {
402
+ $(document).bind('keydown',function(event) {
403
+ // ESC = Keycode 27
404
+ if (event.keyCode == 27) element.trigger('closejr');
405
+ });
406
+ }
407
+
408
+ // afterReject: Customized Function
409
+ if ($.isFunction(opts.afterReject)) opts.afterReject();
410
+
411
+ return true;
412
+ };
413
+
414
+ // Based on compatibility data from quirksmode.com
415
+ var _pageSize = function() {
416
+ var xScroll = window.innerWidth && window.scrollMaxX ?
417
+ window.innerWidth + window.scrollMaxX :
418
+ (document.body.scrollWidth > document.body.offsetWidth ?
419
+ document.body.scrollWidth : document.body.offsetWidth);
420
+
421
+ var yScroll = window.innerHeight && window.scrollMaxY ?
422
+ window.innerHeight + window.scrollMaxY :
423
+ (document.body.scrollHeight > document.body.offsetHeight ?
424
+ document.body.scrollHeight : document.body.offsetHeight);
425
+
426
+ var windowWidth = window.innerWidth ? window.innerWidth :
427
+ (document.documentElement && document.documentElement.clientWidth ?
428
+ document.documentElement.clientWidth : document.body.clientWidth);
429
+
430
+ var windowHeight = window.innerHeight ? window.innerHeight :
431
+ (document.documentElement && document.documentElement.clientHeight ?
432
+ document.documentElement.clientHeight : document.body.clientHeight);
433
+
434
+ return [
435
+ xScroll < windowWidth ? xScroll : windowWidth, // Page Width
436
+ yScroll < windowHeight ? windowHeight : yScroll, // Page Height
437
+ windowWidth,windowHeight
438
+ ];
439
+ };
440
+
441
+
442
+ // Based on compatibility data from quirksmode.com
443
+ var _scrollSize = function() {
444
+ return [
445
+ // scrollSize X
446
+ window.pageXOffset ? window.pageXOffset : (document.documentElement &&
447
+ document.documentElement.scrollTop ?
448
+ document.documentElement.scrollLeft : document.body.scrollLeft),
449
+
450
+ // scrollSize Y
451
+ window.pageYOffset ? window.pageYOffset : (document.documentElement &&
452
+ document.documentElement.scrollTop ?
453
+ document.documentElement.scrollTop : document.body.scrollTop)
454
+ ];
455
+ };
456
+ })(jQuery);
457
+
458
+ /*
459
+ * jQuery Browser Plugin
460
+ * Version 2.4 / jReject 1.0.0
461
+ * URL: http://jquery.thewikies.com/browser
462
+ * Description: jQuery Browser Plugin extends browser detection capabilities and
463
+ * can assign browser selectors to CSS classes.
464
+ * Author: Nate Cavanaugh, Minhchau Dang, Jonathan Neal, & Gregory Waxman
465
+ * Updated By: Steven Bower for use with jReject plugin
466
+ * Copyright: Copyright (c) 2008 Jonathan Neal under dual MIT/GPL license.
467
+ */
468
+
469
+ (function ($) {
470
+ $.browserTest = function (a, z) {
471
+ var u = 'unknown',
472
+ x = 'X',
473
+ m = function (r, h) {
474
+ for (var i = 0; i < h.length; i = i + 1) {
475
+ r = r.replace(h[i][0], h[i][1]);
476
+ }
477
+
478
+ return r;
479
+ }, c = function (i, a, b, c) {
480
+ var r = {
481
+ name: m((a.exec(i) || [u, u])[1], b)
482
+ };
483
+
484
+ r[r.name] = true;
485
+
486
+ if (!r.opera) {
487
+ r.version = (c.exec(i) || [x, x, x, x])[3];
488
+ }
489
+ else {
490
+ r.version = window.opera.version();
491
+ }
492
+
493
+ if (/safari/.test(r.name) && r.version > 400) {
494
+ r.version = '2.0';
495
+ }
496
+ else if (r.name === 'presto') {
497
+ r.version = ($.browser.version > 9.27) ? 'futhark' : 'linear_b';
498
+ }
499
+
500
+ r.versionNumber = parseFloat(r.version, 10) || 0;
501
+ var minorStart = 1;
502
+ if (r.versionNumber < 100 && r.versionNumber > 9) {
503
+ minorStart = 2;
504
+ }
505
+ r.versionX = (r.version !== x) ? r.version.substr(0, minorStart) : x;
506
+ r.className = r.name + r.versionX;
507
+
508
+ return r;
509
+ };
510
+
511
+ a = (/Opera|Navigator|Minefield|KHTML|Chrome/.test(a) ? m(a, [
512
+ [/(Firefox|MSIE|KHTML,\slike\sGecko|Konqueror)/, ''],
513
+ ['Chrome Safari', 'Chrome'],
514
+ ['KHTML', 'Konqueror'],
515
+ ['Minefield', 'Firefox'],
516
+ ['Navigator', 'Netscape']
517
+ ]) : a).toLowerCase();
518
+
519
+ $.browser = $.extend((!z) ? $.browser : {}, c(a,
520
+ /(camino|chrome|firefox|netscape|konqueror|lynx|msie|opera|safari)/,
521
+ [],
522
+ /(camino|chrome|firefox|netscape|netscape6|opera|version|konqueror|lynx|msie|safari)(\/|\s)([a-z0-9\.\+]*?)(\;|dev|rel|\s|$)/));
523
+
524
+ $.layout = c(a, /(gecko|konqueror|msie|opera|webkit)/, [
525
+ ['konqueror', 'khtml'],
526
+ ['msie', 'trident'],
527
+ ['opera', 'presto']
528
+ ], /(applewebkit|rv|konqueror|msie)(\:|\/|\s)([a-z0-9\.]*?)(\;|\)|\s)/);
529
+
530
+ $.os = {
531
+ name: (/(win|mac|linux|sunos|solaris|iphone|ipad)/.
532
+ exec(navigator.platform.toLowerCase()) || [u])[0].replace('sunos', 'solaris')
533
+ };
534
+
535
+ if (!z) {
536
+ $('html').addClass([$.os.name, $.browser.name, $.browser.className,
537
+ $.layout.name, $.layout.className].join(' '));
538
+ }
539
+ };
540
+
541
+ $.browserTest(navigator.userAgent);
542
+ }(jQuery));
@@ -0,0 +1,118 @@
1
+ /*
2
+ * jReject (jQuery Browser Rejection Plugin)
3
+ * Version 1.0.0
4
+ * URL: http://jreject.turnwheel.com/
5
+ * Description: jReject is a easy method of rejecting specific browsers on your site
6
+ * Author: Steven Bower (TurnWheel Designs) http://turnwheel.com/
7
+ * Copyright: Copyright (c) 2009-2011 Steven Bower under dual MIT/GPL license.
8
+ */
9
+
10
+ #jr_overlay {
11
+ top: 0;
12
+ left: 0;
13
+ padding: 0;
14
+ margin: 0;
15
+ z-index: 200;
16
+ position: absolute;
17
+ }
18
+
19
+ #jr_wrap {
20
+ position: absolute;
21
+ text-align: center;
22
+ width: 100%;
23
+ z-index: 300;
24
+ padding: 0;
25
+ margin: 0;
26
+ }
27
+
28
+ #jr_inner {
29
+ font-family: "Lucida Grande","Lucida Sans Unicode",Arial,Verdana,sans-serif;
30
+ font-size: 12px;
31
+ background: #FFF;
32
+ border: 1px solid #CCC;
33
+ color: #4F4F4F;
34
+ margin: 0 auto;
35
+ height: auto;
36
+ padding: 20px;
37
+ position: relative;
38
+ }
39
+
40
+ #jr_header {
41
+ display: block;
42
+ color: #333;
43
+ padding: 5px;
44
+ padding-bottom: 0;
45
+ margin: 0;
46
+ font-family: Helvetica,Arial,sans-serif;
47
+ font-weight: bold;
48
+ text-align: left;
49
+ font-size: 1.3em;
50
+ margin-bottom: 0.5em;
51
+ }
52
+
53
+ #jr_inner p {
54
+ text-align: left;
55
+ padding: 5px;
56
+ margin: 0;
57
+ }
58
+
59
+ #jr_inner ul {
60
+ list-style-image: none;
61
+ list-style-position: outside;
62
+ list-style-type: none;
63
+ margin: 0;
64
+ padding: 0;
65
+ }
66
+
67
+ #jr_inner ul li {
68
+ cursor: pointer;
69
+ float: left;
70
+ width: 120px;
71
+ height: 122px;
72
+ margin: 0 10px 10px 10px;
73
+ padding: 0;
74
+ text-align: center;
75
+ }
76
+
77
+ #jr_inner li a {
78
+ color: #333;
79
+ font-size: 0.8em;
80
+ text-decoration: none;
81
+ padding: 0;
82
+ margin: 0;
83
+ }
84
+
85
+ #jr_inner li a:hover {
86
+ text-decoration: underline;
87
+ }
88
+
89
+ #jr_inner .jr_icon {
90
+ width: 100px;
91
+ height: 100px;
92
+ margin: 1px auto;
93
+ padding: 0;
94
+ background: transparent no-repeat scroll left top;
95
+ cursor: pointer;
96
+ }
97
+
98
+ #jr_close {
99
+ margin: 0 0 0 50px;
100
+ clear: both;
101
+ text-align: left;
102
+ padding: 0;
103
+ margin: 0;
104
+ }
105
+
106
+ #jr_close a {
107
+ color: #000;
108
+ display: block;
109
+ width: auto;
110
+ margin: 0;
111
+ padding: 0;
112
+ text-decoration: underline;
113
+ }
114
+
115
+ #jr_close p {
116
+ padding: 10px 0 0 0;
117
+ margin: 0;
118
+ }
@@ -0,0 +1,17 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/jreject_rails/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Andrew Nesbitt"]
6
+ gem.email = ["andrew@forward.co.uk"]
7
+ gem.description = %q{Asset Pipeline gem for jReject}
8
+ gem.summary = %q{Easily add jReject plugin for warning users that you don't support certain browsers and prompting them to upgrade.}
9
+ gem.homepage = "http://github.com/forward/jreject-rails"
10
+
11
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
+ gem.files = `git ls-files`.split("\n")
13
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
+ gem.name = "jreject_rails"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = JRejectRails::VERSION
17
+ end
@@ -0,0 +1,7 @@
1
+ module JRejectRails
2
+ class Engine < ::Rails::Engine
3
+ initializer :assets do |config|
4
+ Rails.application.config.assets.precompile += %w(jquery.reject.js jquery.reject.css)
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ module JRejectRails
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,6 @@
1
+ require 'jreject_rails/engine'
2
+ require "jreject_rails/version"
3
+
4
+ module JRejectRails
5
+
6
+ end
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jreject_rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Andrew Nesbitt
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-01-16 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Asset Pipeline gem for jReject
15
+ email:
16
+ - andrew@forward.co.uk
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - .gitignore
22
+ - Gemfile
23
+ - LICENSE
24
+ - README.md
25
+ - Rakefile
26
+ - app/assets/images/background_browser.gif
27
+ - app/assets/images/browser_chrome.gif
28
+ - app/assets/images/browser_firefox.gif
29
+ - app/assets/images/browser_gcf.gif
30
+ - app/assets/images/browser_konqueror.gif
31
+ - app/assets/images/browser_msie.gif
32
+ - app/assets/images/browser_opera.gif
33
+ - app/assets/images/browser_safari.gif
34
+ - app/assets/javascripts/jquery.reject.js
35
+ - app/assets/stylesheets/jquery.reject.css
36
+ - jreject-rails.gemspec
37
+ - lib/jreject_rails.rb
38
+ - lib/jreject_rails/engine.rb
39
+ - lib/jreject_rails/version.rb
40
+ homepage: http://github.com/forward/jreject-rails
41
+ licenses: []
42
+ post_install_message:
43
+ rdoc_options: []
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ none: false
48
+ requirements:
49
+ - - ! '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ! '>='
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ requirements: []
59
+ rubyforge_project:
60
+ rubygems_version: 1.8.24
61
+ signing_key:
62
+ specification_version: 3
63
+ summary: Easily add jReject plugin for warning users that you don't support certain
64
+ browsers and prompting them to upgrade.
65
+ test_files: []
66
+ has_rdoc: