This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* browser sinffing | |
* http://james.padolsey.com/javascript/detect-ie-in-js-using-conditional-comments/ | |
*/ | |
(function(){ | |
var ie = (function(){ | |
var undef, | |
v = 3, | |
div = document.createElement('div'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* need underscore.js */ | |
/** | |
* randomNum | |
* randomNum(3,6); => 4 | |
*/ | |
var randomNum = function(from, to) { | |
return from + Math.floor( Math.random() * (to - from + 1) ); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Based on: http://www.quirksmode.org/js/cookies.html | |
* and https://github.com/wojodesign/local-storage-js/blob/master/storage.js | |
* and https://gist.github.com/350433 | |
* License: http://www.opensource.org/licenses/MIT | |
*/ | |
(function(window) { | |
'use strict'; | |
window.sessionStorage = window.sessionStorage || { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eventmodule */ | |
/* Events */ | |
var Events = { | |
on: function(events, callback) { | |
if(!this._observer) { | |
this._observer = $({}); | |
} | |
this._observer.bind(events, callback); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var oldSafari = (function() { | |
var ua = window.navigator.userAgent; | |
if(!/safari/i.test(ua)) { | |
return false; | |
} | |
if(/chrome/i.test(ua)) { | |
// chrome has 'Safari' in its ua. | |
return false; | |
} | |
if(/mobile/i.test(ua)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* `html` class tweaking | |
* if `devicePixelRatio` was 2, switch html's class | |
* from `dpr-1` to `dpr-2` | |
*/ | |
(function() { | |
var html = document.getElementsByTagName("html")[0]; | |
/* helpers */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// a little modified version of | |
// position: fixed support detection from jQuery mobile. | |
// | |
// This script also defines Android2.x as out of support. | |
// | |
// https://github.com/jquery/jquery-mobile/blob/master/js/support.js | |
// http://demos.jquerymobile.com/1.4.4/toolbar-fixed/ | |
// http://jimbergman.net/webkit-version-in-android-version/ | |
Modernizr.addTest('positionfixed', function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# IE version detection | |
# original: http://james.padolsey.com/javascript/detect-ie-in-js-using-conditional-comments/ | |
ie = do -> | |
version = 3 | |
div = document.createElement 'div' | |
all = div.getElementsByTagName 'i' | |
refresh = -> | |
version += 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* mobile UA detection http://jsfiddle.net/Takazudo/rxPYk/ */ | |
var ua = (function(){ | |
var ua = {}; | |
var navigator = window.navigator; | |
var platforms = [ | |
{ property: 'platform', regex: /iPhone/i, identity: 'iPhone' }, | |
{ property: 'platform', regex: /iPod/i, identity: 'iPod' }, | |
{ property: 'userAgent', regex: /iPad/i, identity: 'iPad' }, | |
{ property: 'userAgent', regex: /Blackberry/i, identity: 'Blackberry' }, |
NewerOlder