/*****************************************************************/ /* 5grid 0.3.2 by n33.co | MIT+GPLv2 license licensed */ /* init.js: Init script */ /*****************************************************************/ /*********************/ /* Object Setup */ /*********************/ var _5gridC = function() { this.events = new Array(); this.isReady = false; this.isMobile = false; this.isDesktop = false; this.isFluid = false; this.is1000px = false; this.is1200px = false; }; _5gridC.prototype.bind = function(name, f) { if (!this.events[name]) this.events[name] = new Array(); this.events[name].push(f); }; _5gridC.prototype.trigger = function(name) { if (!this.isReady || !this.events[name] || this.events[name].length < 1) return; for (i in this.events[name]) (this.events[name][i])(); }; _5gridC.prototype.ready = function(f) { this.bind('ready', f); }; _5gridC.prototype.orientationChange = function(f) { this.bind('orientationChange', f); }; _5gridC.prototype.mobileUINavOpen = function(f) { this.bind('mobileUINavOpen', f); }; _5gridC.prototype.mobileUINavClose = function(f) { this.bind('mobileUINavClose', f); }; _5gridC.prototype.readyCheck = function() { var x = this; window.setTimeout(function() { if (x.isReady) x.trigger('ready'); else x.readyCheck(); }, 50); }; var _5grid = new _5gridC; (function() { /*********************/ /* Initialize */ /*********************/ // Vars var _baseURL, _opts, _fluid, _1000px, _1200px, _mobile, _desktop, _mobileOnly, _window = jQuery(window), _head = jQuery('head'), _document = jQuery(document), _headQueue = new Array(), _isLocked = false, _isTouch = !!('ontouchstart' in window), _eventType = (_isTouch ? 'touchend' : 'click'), v, w, x, y; // Shortcut methods _headQueue.pushI_5grid = function(s) { _headQueue.push({ type: 'i', value: s }); }; _headQueue.pushE_5grid = function(s) { _headQueue.push({ type: 'e', value: s }); }; _headQueue.process_5grid = function() { var doE; if (document.createStyleSheet) doE = function(s) { document.createStyleSheet(s); }; else doE = function(s) { _head.append(''); }; for (var x in _headQueue) { if (_headQueue[x].type == 'i') _head.append(''); else if (_headQueue[x].type == 'e') (doE)(_headQueue[x].value); } }; jQuery.fn.disableSelection_5grid = function() { return jQuery(this).css('user-select', 'none').css('-khtml-user-select', 'none').css('-moz-user-select', 'none').css('-o-user-select', 'none').css('-webkit-user-select', 'none'); }; jQuery.fn.enableSelection_5grid = function() { return jQuery(this).css('user-select', 'auto').css('-khtml-user-select', 'auto').css('-moz-user-select', 'auto').css('-o-user-select', 'auto').css('-webkit-user-select', 'auto'); }; jQuery.fn.accelerate_5grid = function() { return jQuery(this).css('-webkit-transform', 'translateZ(0)').css('-webkit-backface-visibility', 'hidden').css('-webkit-perspective', '1000'); }; // Determine base URL, opts x = jQuery('script').filter(function() { return this.src.match(/5grid\/init\.js/); }).first(); y = x.attr('src').split('?'); _baseURL = y[0].replace(/5grid\/init\.js/, ''); _opts = new Array(); // Default opts _opts['use'] = 'mobile,desktop'; _opts['prefix'] = 'style'; _opts['mobileUI'] = 0; _opts['mobileUI.force'] = 0; _opts['mobileUI.titleBarHeight'] = 44; _opts['mobileUI.titleBarOverlaid'] = 0; _opts['mobileUI.openerWidth'] = 60; _opts['mobileUI.openerText'] = '='; _opts['mobileUI.titleBarFixed'] = 1; _opts['mobileUI.theme'] = 'beveled'; _opts['mobileUI.themeTitleBarColor'] = '#444444'; _opts['mobileUI.themeNavColor'] = '#272727'; _opts['mobileUI.hideAddressBar'] = 0; _opts['viewport.is1000px'] = 1040; _opts['viewport.is1200px'] = 1280; _opts['debug.noExtLoad'] = 0; // Custom opts if (y.length > 1) { x = y[1].split('&'); for (var v in x) { w = x[v].split('='); _opts[w[0]] = w[1]; } } // Debug options if (_opts['debug.noExtLoad'] == 1) _headQueue.pushE_5grid = function(s) { }; // Determine viewing modes _desktop = _mobile = _fluid = _1000px = _1200px = _mobileOnly = false; v = _opts['use'].split(','); if (jQuery.inArray('fluid', v) > -1) _fluid = true; if (jQuery.inArray('desktop', v) > -1) _desktop = true; if (jQuery.inArray('1000px', v) > -1) _1000px = true; if (jQuery.inArray('1200px', v) > -1) _1200px = true; if (jQuery.inArray('mobile', v) > -1) _mobile = true; if (_mobile && !_fluid && !_1000px && !_1200px && !_desktop) _mobileOnly = true; //_desktop = true; /*********************/ /* Core */ /*********************/ // Legacy IE fixes if ($.browser.msie) { // HTML5 Shiv if ($.browser.version < 9) _head.append('