diff --git a/app/assets/javascripts/mobile.js b/app/assets/javascripts/mobile.js new file mode 100644 index 000000000..a4d84f44b --- /dev/null +++ b/app/assets/javascripts/mobile.js @@ -0,0 +1,16 @@ +// This is a manifest file that'll be compiled into including all the files listed below. +// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically +// be included in the compiled file accessible from http://example.com/assets/application.js +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// the compiled file. +// +//= require jquery +//= require lib/jquery.preload.min.js +//= require cycle2 +//= require mobile/jquery.mu.image.resize +//= require mobile/orbit.mobile +//= require mobile/jquery.mobile-1.2.0.min +//= require mobile/jquery.swipeplanes-1.2.min +//= require mobile/add2home +//= require mobile/gmAPI +//= require mobile/jquery.ui.map \ No newline at end of file diff --git a/app/assets/javascripts/mobile/add2home.js b/app/assets/javascripts/mobile/add2home.js new file mode 100644 index 000000000..38b35bfa1 --- /dev/null +++ b/app/assets/javascripts/mobile/add2home.js @@ -0,0 +1,350 @@ +/*! + * Add to Homescreen v2.0.4 ~ Copyright (c) 2012 Matteo Spinelli, http://cubiq.org + * Released under MIT license, http://cubiq.org/license + */ +var addToHome = (function (w) { + var nav = w.navigator, + isIDevice = 'platform' in nav && (/iphone|ipod|ipad/gi).test(nav.platform), + isIPad, + isRetina, + isSafari, + isStandalone, + OSVersion, + startX = 0, + startY = 0, + lastVisit = 0, + isExpired, + isSessionActive, + isReturningVisitor, + balloon, + overrideChecks, + + positionInterval, + closeTimeout, + + options = { + autostart: true, // Automatically open the balloon + returningVisitor: false, // Show the balloon to returning visitors only (setting this to true is HIGHLY RECCOMENDED) + animationIn: 'bubble', // drop || bubble || fade + animationOut: 'drop', // drop || bubble || fade + startDelay: 2000, // 2 seconds from page load before the balloon appears + lifespan: 10000, // 15 seconds before it is automatically destroyed + bottomOffset: 14, // Distance of the balloon from bottom + expire: 0, // Minutes to wait before showing the popup again (0 = always displayed) + message: '', // Customize your message or force a language ('' = automatic) + touchIcon: true, // Display the touch icon + arrow: true, // Display the balloon arrow + hookOnLoad: true, // Should we hook to onload event? (really advanced usage) + iterations: 100 // Internal/debug use + }, + + intl = { + ca_es: 'Per instal·lar aquesta aplicació al vostre %device premeu %icon i llavors Afegir a pantalla d\'inici.', + cs_cz: 'Pro instalaci aplikace na Váš %device, stiskněte %icon a v nabídce Přidat na plochu.', + da_dk: 'Tilføj denne side til din %device: tryk på %icon og derefter Føj til hjemmeskærm.', + de_de: 'Installieren Sie diese App auf Ihrem %device: %icon antippen und dann Zum Home-Bildschirm.', + el_gr: 'Εγκαταστήσετε αυτήν την Εφαρμογή στήν συσκευή σας %device: %icon μετά πατάτε Προσθήκη σε Αφετηρία.', + en_us: 'Install this web app on your %device: tap %icon and then Add to Home Screen.', + es_es: 'Para instalar esta app en su %device, pulse %icon y seleccione Añadir a pantalla de inicio.', + fi_fi: 'Asenna tämä web-sovellus laitteeseesi %device: paina %icon ja sen jälkeen valitse Lisää Koti-valikkoon.', + fr_fr: 'Ajoutez cette application sur votre %device en cliquant sur %icon, puis Ajouter à l\'écran d\'accueil.', + he_il: 'התקן אפליקציה זו על ה-%device שלך: הקש %icon ואז הוסף למסך הבית.', + hr_hr: 'Instaliraj ovu aplikaciju na svoj %device: klikni na %icon i odaberi Dodaj u početni zaslon.', + hu_hu: 'Telepítse ezt a web-alkalmazást az Ön %device-jára: nyomjon a %icon-ra majd a Főképernyőhöz adás gombra.', + it_it: 'Installa questa applicazione sul tuo %device: premi su %icon e poi Aggiungi a Home.', + ja_jp: 'このウェブアプリをあなたの%deviceにインストールするには%iconをタップしてホーム画面に追加を選んでください。', + ko_kr: '%device에 웹앱을 설치하려면 %icon을 터치 후 "홈화면에 추가"를 선택하세요', + nb_no: 'Installer denne appen på din %device: trykk på %icon og deretter Legg til på Hjem-skjerm', + nl_nl: 'Installeer deze webapp op uw %device: tik %icon en dan Zet in beginscherm.', + pl_pl: 'Aby zainstalować tę aplikacje na %device: naciśnij %icon a następnie Dodaj jako ikonę.', + pt_br: 'Instale este web app em seu %device: aperte %icon e selecione Adicionar à Tela Inicio.', + pt_pt: 'Para instalar esta aplicação no seu %device, prima o %icon e depois o Adicionar ao ecrã principal.', + ru_ru: 'Установите это веб-приложение на ваш %device: нажмите %icon, затем Добавить в «Домой».', + sv_se: 'Lägg till denna webbapplikation på din %device: tryck på %icon och därefter Lägg till på hemskärmen.', + th_th: 'ติดตั้งเว็บแอพฯ นี้บน %device ของคุณ: แตะ %icon และ เพิ่มที่หน้าจอโฮม', + tr_tr: '%device için bu uygulamayı kurduktan sonra %icon simgesine dokunarak Ana Ekrana Ekleyin.', + zh_cn: '您可以将此应用程式安装到您的 %device 上。请按 %icon 然后点选添加至主屏幕。', + zh_tw: '您可以將此應用程式安裝到您的 %device 上。請按 %icon 然後點選加入主畫面螢幕。' + }; + + function init () { + // Preliminary check, all further checks are performed on iDevices only + if ( !isIDevice ) return; + + var now = Date.now(), + i; + + // Merge local with global options + if ( w.addToHomeConfig ) { + for ( i in w.addToHomeConfig ) { + options[i] = w.addToHomeConfig[i]; + } + } + if ( !options.autostart ) options.hookOnLoad = false; + + isIPad = (/ipad/gi).test(nav.platform); + isRetina = w.devicePixelRatio && w.devicePixelRatio > 1; + isSafari = (/Safari/i).test(nav.appVersion) && !(/CriOS/i).test(nav.appVersion); + isStandalone = nav.standalone; + OSVersion = nav.appVersion.match(/OS (\d+_\d+)/i); + OSVersion = OSVersion[1] ? +OSVersion[1].replace('_', '.') : 0; + + lastVisit = +w.localStorage.getItem('addToHome'); + + isSessionActive = w.sessionStorage.getItem('addToHomeSession'); + isReturningVisitor = options.returningVisitor ? lastVisit && lastVisit + 28*24*60*60*1000 > now : true; + + if ( !lastVisit ) lastVisit = now; + + // If it is expired we need to reissue a new balloon + isExpired = isReturningVisitor && lastVisit <= now; + + if ( options.hookOnLoad ) w.addEventListener('load', loaded, false); + else if ( !options.hookOnLoad && options.autostart ) loaded(); + } + + function loaded () { + w.removeEventListener('load', loaded, false); + + if ( !isReturningVisitor ) w.localStorage.setItem('addToHome', Date.now()); + else if ( options.expire && isExpired ) w.localStorage.setItem('addToHome', Date.now() + options.expire * 60000); + + if ( !overrideChecks && ( !isSafari || !isExpired || isSessionActive || isStandalone || !isReturningVisitor ) ) return; + + var icons = options.touchIcon ? document.querySelectorAll('head link[rel=apple-touch-icon],head link[rel=apple-touch-icon-precomposed]') : [], + sizes, + touchIcon = '', + closeButton, + platform = nav.platform.split(' ')[0], + language = nav.language.replace('-', '_'), + i, l; + + balloon = document.createElement('div'); + balloon.id = 'addToHomeScreen'; + balloon.style.cssText += 'left:-9999px;-webkit-transition-property:-webkit-transform,opacity;-webkit-transition-duration:0;-webkit-transform:translate3d(0,0,0);position:' + (OSVersion < 5 ? 'absolute' : 'fixed'); + + // Localize message + if ( options.message in intl ) { // You may force a language despite the user's locale + language = options.message; + options.message = ''; + } + if ( options.message === '' ) { // We look for a suitable language (defaulted to en_us) + options.message = language in intl ? intl[language] : intl['en_us']; + } + + // Search for the apple-touch-icon + if ( icons.length ) { + for ( i = 0, l = icons.length; i < l; i++ ) { + sizes = icons[i].getAttribute('sizes'); + + if ( sizes ) { + if ( isRetina && sizes == '114x114' ) { + touchIcon = icons[i].href; + break; + } + } else { + touchIcon = icons[i].href; + } + } + + touchIcon = ''; + } + + balloon.className = (isIPad ? 'addToHomeIpad' : 'addToHomeIphone') + (touchIcon ? ' addToHomeWide' : ''); + balloon.innerHTML = touchIcon + + options.message.replace('%device', platform).replace('%icon', OSVersion >= 4.2 ? '' : '+') + + (options.arrow ? '' : '') + + '\u00D7'; + + document.body.appendChild(balloon); + + // Add the close action + closeButton = balloon.querySelector('.addToHomeClose'); + if ( closeButton ) closeButton.addEventListener('click', clicked, false); + + if ( !isIPad && OSVersion >= 6 ) window.addEventListener('orientationchange', orientationCheck, false); + + setTimeout(show, options.startDelay); + } + + function show () { + var duration, + iPadXShift = 208; + + // Set the initial position + if ( isIPad ) { + if ( OSVersion < 5 ) { + startY = w.scrollY; + startX = w.scrollX; + } else if ( OSVersion < 6 ) { + iPadXShift = 160; + } + + balloon.style.top = startY + options.bottomOffset + 'px'; + balloon.style.left = startX + iPadXShift - Math.round(balloon.offsetWidth / 2) + 'px'; + + switch ( options.animationIn ) { + case 'drop': + duration = '0.6s'; + balloon.style.webkitTransform = 'translate3d(0,' + -(w.scrollY + options.bottomOffset + balloon.offsetHeight) + 'px,0)'; + break; + case 'bubble': + duration = '0.6s'; + balloon.style.opacity = '0'; + balloon.style.webkitTransform = 'translate3d(0,' + (startY + 50) + 'px,0)'; + break; + default: + duration = '1s'; + balloon.style.opacity = '0'; + } + } else { + startY = w.innerHeight + w.scrollY; + + if ( OSVersion < 5 ) { + startX = Math.round((w.innerWidth - balloon.offsetWidth) / 2) + w.scrollX; + balloon.style.left = startX + 'px'; + balloon.style.top = startY - balloon.offsetHeight - options.bottomOffset + 'px'; + } else { + balloon.style.left = '50%'; + balloon.style.marginLeft = -Math.round(balloon.offsetWidth / 2) - ( w.orientation%180 && OSVersion >= 6 ? 40 : 0 ) + 'px'; + balloon.style.bottom = options.bottomOffset + 'px'; + } + + switch (options.animationIn) { + case 'drop': + duration = '1s'; + balloon.style.webkitTransform = 'translate3d(0,' + -(startY + options.bottomOffset) + 'px,0)'; + break; + case 'bubble': + duration = '0.6s'; + balloon.style.webkitTransform = 'translate3d(0,' + (balloon.offsetHeight + options.bottomOffset + 50) + 'px,0)'; + break; + default: + duration = '1s'; + balloon.style.opacity = '0'; + } + } + + balloon.offsetHeight; // repaint trick + balloon.style.webkitTransitionDuration = duration; + balloon.style.opacity = '1'; + balloon.style.webkitTransform = 'translate3d(0,0,0)'; + balloon.addEventListener('webkitTransitionEnd', transitionEnd, false); + + closeTimeout = setTimeout(close, options.lifespan); + } + + function manualShow (override) { + if ( !isIDevice || balloon ) return; + + overrideChecks = override; + loaded(); + } + + function close () { + clearInterval( positionInterval ); + clearTimeout( closeTimeout ); + closeTimeout = null; + + var posY = 0, + posX = 0, + opacity = '1', + duration = '0', + closeButton = balloon.querySelector('.addToHomeClose'); + + if ( closeButton ) closeButton.removeEventListener('click', close, false); + if ( !isIPad && OSVersion >= 6 ) window.removeEventListener('orientationchange', orientationCheck, false); + + if ( OSVersion < 5 ) { + posY = isIPad ? w.scrollY - startY : w.scrollY + w.innerHeight - startY; + posX = isIPad ? w.scrollX - startX : w.scrollX + Math.round((w.innerWidth - balloon.offsetWidth)/2) - startX; + } + + balloon.style.webkitTransitionProperty = '-webkit-transform,opacity'; + + switch ( options.animationOut ) { + case 'drop': + if ( isIPad ) { + duration = '0.4s'; + opacity = '0'; + posY = posY + 50; + } else { + duration = '0.6s'; + posY = posY + balloon.offsetHeight + options.bottomOffset + 50; + } + break; + case 'bubble': + if ( isIPad ) { + duration = '0.8s'; + posY = posY - balloon.offsetHeight - options.bottomOffset - 50; + } else { + duration = '0.4s'; + opacity = '0'; + posY = posY - 50; + } + break; + default: + duration = '0.8s'; + opacity = '0'; + } + + balloon.addEventListener('webkitTransitionEnd', transitionEnd, false); + balloon.style.opacity = opacity; + balloon.style.webkitTransitionDuration = duration; + balloon.style.webkitTransform = 'translate3d(' + posX + 'px,' + posY + 'px,0)'; + } + + + function clicked () { + w.sessionStorage.setItem('addToHomeSession', '1'); + isSessionActive = true; + close(); + } + + function transitionEnd () { + balloon.removeEventListener('webkitTransitionEnd', transitionEnd, false); + + balloon.style.webkitTransitionProperty = '-webkit-transform'; + balloon.style.webkitTransitionDuration = '0.2s'; + + // We reached the end! + if ( !closeTimeout ) { + balloon.parentNode.removeChild(balloon); + balloon = null; + return; + } + + // On iOS 4 we start checking the element position + if ( OSVersion < 5 && closeTimeout ) positionInterval = setInterval(setPosition, options.iterations); + } + + function setPosition () { + var matrix = new WebKitCSSMatrix(w.getComputedStyle(balloon, null).webkitTransform), + posY = isIPad ? w.scrollY - startY : w.scrollY + w.innerHeight - startY, + posX = isIPad ? w.scrollX - startX : w.scrollX + Math.round((w.innerWidth - balloon.offsetWidth) / 2) - startX; + + // Screen didn't move + if ( posY == matrix.m42 && posX == matrix.m41 ) return; + + balloon.style.webkitTransform = 'translate3d(' + posX + 'px,' + posY + 'px,0)'; + } + + // Clear local and session storages (this is useful primarily in development) + function reset () { + w.localStorage.removeItem('addToHome'); + w.sessionStorage.removeItem('addToHomeSession'); + } + + function orientationCheck () { + balloon.style.marginLeft = -Math.round(balloon.offsetWidth / 2) - ( w.orientation%180 && OSVersion >= 6 ? 40 : 0 ) + 'px'; + } + + // Bootstrap! + init(); + + return { + show: manualShow, + close: close, + reset: reset + }; +})(window); diff --git a/app/assets/javascripts/mobile/gmAPI.js b/app/assets/javascripts/mobile/gmAPI.js new file mode 100644 index 000000000..ab078c3af --- /dev/null +++ b/app/assets/javascripts/mobile/gmAPI.js @@ -0,0 +1,34 @@ + String.prototype.format = function() { a = this; for ( k in arguments ) { a = a.replace("{" + k + "}", arguments[k]); } return a; }; + window.gmAPI = { + 'version': '3.0-rc1', + 'ga': '', + 'primaryUrl': 'http://code.google.com/p/jquery-ui-map/', + 'url': 'http://jquery-ui-map.googlecode.com/', + 'forum': 'http://groups.google.com/group/jquery-ui-map-discuss/feed/rss_v2_0_msgs.xml', + 'subscribe': 'http://groups.google.com/group/jquery-ui-map-discuss/boxsubscribe', + 'exception': 'Unable to load due to either poor internet connection or some CDN\'s aren\'t as responsive as we would like them to be. Try refreshing the page :D.', + 'init': function() { + //window._gaq = [['_setAccount', this.ga], ['_trackPageview'], ['_trackPageLoadTime']]; + //Modernizr.load({ 'test': ( location.href.indexOf(this.url) > -1 ), 'yep': 'http://www.google-analytics.com/ga.js' }); + this.test('Backbone', function() { + $('#forum').append('

Forum

Subscribe

'); + ForumCollection = Backbone.Collection.extend({ 'url': 'http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&callback=?&q={0}'.format(encodeURIComponent(gmAPI.forum)), 'parse': function(response) { return response.responseData.feed.entries; } }); + ForumPost = Backbone.View.extend({ 'tagName': 'li', 'className': 'group-item', 'template': _.template('<%=title%>'), 'render': function() { $(this.el).html(this.template(this.model.toJSON())); return this; } }); + Forum = Backbone.View.extend({ 'el': $("#forum"), 'initialize': function() { this.col = new ForumCollection(); this.col.bind('reset', this.load, this); this.col.fetch(); }, 'add': function(post) { var view = new ForumPost({'model': post}); $('#forum_posts').append(view.render().el); }, 'load': function () { this.col.each(this.add); $('#forum_subscribe').attr('action', gmAPI.subscribe); $(this.el).show(); } }); + var app = new Forum(); + }); + this.test('prettyPrint', function() { prettyPrint(); }); + $('#version').text(this.version); + }, + 'redirect': function(url) { alert('This page is deprecated. Please update your URL. Redirecting to new page.'); window.location = url; }, + 'col': [], + 'tests': [], + 'test': function(a, b) { if ( window[a] ) { b(); } }, + 'add': function(a, b) { if (b) { this.col[a] = b; } else { this.col.push(a); } return this; }, + 'load': function(a) { var self = this; if (a) { self.col[a](); } else { $.each(self.col, function(i,d) { try { d(); } catch (err) { alert(self.exception); } }); } }, + 'timeStart': function(key, desc) { this.tests[key] = { 'start': new Date().getTime(), 'desc': desc }; }, + 'timeEnd': function(key) { this.tests[key].elapsed = new Date().getTime(); }, + 'report': function(id) { var i = 1; for ( var k in this.tests ) { var t = this.tests[k]; $(id).append('
' + (t.elapsed - t.start) + ' ms

Benchmark case ' + i + '

' + t.desc + '

'); i++; }; } + }; + + gmAPI.init(); \ No newline at end of file diff --git a/app/assets/javascripts/mobile/jquery.mobile-1.2.0.min.js b/app/assets/javascripts/mobile/jquery.mobile-1.2.0.min.js new file mode 100644 index 000000000..e0d02a9b9 --- /dev/null +++ b/app/assets/javascripts/mobile/jquery.mobile-1.2.0.min.js @@ -0,0 +1,2 @@ +/*! jQuery Mobile vGit Build: SHA1: b49cc06499abf8f987cf90f35349cfac0918c939 <> Date: Tue Oct 2 11:22:34 2012 -0700 jquerymobile.com | jquery.org/license !*/ +(function(a,b,c){typeof define=="function"&&define.amd?define(["jquery"],function(d){return c(d,a,b),d.mobile}):c(a.jQuery,a,b)})(this,document,function(a,b,c,d){(function(a,b,d){var e={};a.mobile=a.extend({},{version:"1.2.0",ns:"",subPageUrlKey:"ui-page",activePageClass:"ui-page-active",activeBtnClass:"ui-btn-active",focusClass:"ui-focus",ajaxEnabled:!0,hashListeningEnabled:!0,linkBindingEnabled:!0,defaultPageTransition:"fade",maxTransitionWidth:!1,minScrollBack:250,touchOverflowEnabled:!1,defaultDialogTransition:"pop",pageLoadErrorMessage:"Error Loading Page",pageLoadErrorMessageTheme:"e",phonegapNavigationEnabled:!1,autoInitializePage:!0,pushStateEnabled:!0,ignoreContentEnabled:!1,orientationChangeEnabled:!0,buttonMarkup:{hoverDelay:200},keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91},silentScroll:function(d){a.type(d)!=="number"&&(d=a.mobile.defaultHomeScroll),a.event.special.scrollstart.enabled=!1,setTimeout(function(){b.scrollTo(0,d),a(c).trigger("silentscroll",{x:0,y:d})},20),setTimeout(function(){a.event.special.scrollstart.enabled=!0},150)},nsNormalizeDict:e,nsNormalize:function(b){if(!b)return;return e[b]||(e[b]=a.camelCase(a.mobile.ns+b))},getInheritedTheme:function(a,b){var c=a[0],d="",e=/ui-(bar|body|overlay)-([a-z])\b/,f,g;while(c){f=c.className||"";if(f&&(g=e.exec(f))&&(d=g[2]))break;c=c.parentNode}return d||b||"a"},closestPageData:function(a){return a.closest(':jqmData(role="page"), :jqmData(role="dialog")').data("page")},enhanceable:function(a){return this.haveParents(a,"enhance")},hijackable:function(a){return this.haveParents(a,"ajax")},haveParents:function(b,c){if(!a.mobile.ignoreContentEnabled)return b;var d=b.length,e=a(),f,g,h;for(var i=0;i").text(a(this).text()).html()},a.fn.jqmEnhanceable=function(){return a.mobile.enhanceable(this)},a.fn.jqmHijackable=function(){return a.mobile.hijackable(this)};var f=a.find,g=/:jqmData\(([^)]*)\)/g;a.find=function(b,c,d,e){return b=b.replace(g,"[data-"+(a.mobile.ns||"")+"$1]"),f.call(this,b,c,d,e)},a.extend(a.find,f),a.find.matches=function(b,c){return a.find(b,null,null,c)},a.find.matchesSelector=function(b,c){return a.find(c,null,null,[b]).length>0}})(a,this),function(a,b){var c=0,d=Array.prototype.slice,e=a.cleanData;a.cleanData=function(b){for(var c=0,d;(d=b[c])!=null;c++)try{a(d).triggerHandler("remove")}catch(f){}e(b)},a.widget=function(b,c,d){var e,f,g,h,i=b.split(".")[0];b=b.split(".")[1],e=i+"-"+b,d||(d=c,c=a.Widget),a.expr[":"][e]=function(b){return!!a.data(b,e)},a[i]=a[i]||{},f=a[i][b],g=a[i][b]=function(a,b){if(!this._createWidget)return new g(a,b);arguments.length&&this._createWidget(a,b)},a.extend(g,f,{version:d.version,_proto:a.extend({},d),_childConstructors:[]}),h=new c,h.options=a.widget.extend({},h.options),a.each(d,function(b,e){a.isFunction(e)&&(d[b]=function(){var a=function(){return c.prototype[b].apply(this,arguments)},d=function(a){return c.prototype[b].apply(this,a)};return function(){var b=this._super,c=this._superApply,f;return this._super=a,this._superApply=d,f=e.apply(this,arguments),this._super=b,this._superApply=c,f}}())}),g.prototype=a.widget.extend(h,{widgetEventPrefix:b},d,{constructor:g,namespace:i,widgetName:b,widgetBaseClass:e,widgetFullName:e}),f?(a.each(f._childConstructors,function(b,c){var d=c.prototype;a.widget(d.namespace+"."+d.widgetName,g,c._proto)}),delete f._childConstructors):c._childConstructors.push(g),a.widget.bridge(b,g)},a.widget.extend=function(c){var e=d.call(arguments,1),f=0,g=e.length,h,i;for(;f",options:{disabled:!1,create:null},_createWidget:function(b,d){d=a(d||this.defaultElement||this)[0],this.element=a(d),this.uuid=c++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=a.widget.extend({},this.options,this._getCreateOptions(),b),this.bindings=a(),this.hoverable=a(),this.focusable=a(),d!==this&&(a.data(d,this.widgetName,this),a.data(d,this.widgetFullName,this),this._on({remove:"destroy"}),this.document=a(d.style?d.ownerDocument:d.document||d),this.window=a(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:a.noop,_getCreateEventData:a.noop,_create:a.noop,_init:a.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(a.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:a.noop,widget:function(){return this.element},option:function(c,d){var e=c,f,g,h;if(arguments.length===0)return a.widget.extend({},this.options);if(typeof c=="string"){e={},f=c.split("."),c=f.shift();if(f.length){g=e[c]=a.widget.extend({},this.options[c]);for(h=0;h"+""+"

"+"",fakeFixLoader:function(){var b=a("."+a.mobile.activeBtnClass).first();this.element.css({top:a.support.scrollTop&&f.scrollTop()+f.height()/2||b.length&&b.offset().top||100})},checkLoaderPosition:function(){var b=this.element.offset(),c=f.scrollTop(),d=a.mobile.getScreenHeight();if(b.topd)this.element.addClass("ui-loader-fakefix"),this.fakeFixLoader(),f.unbind("scroll",this.checkLoaderPosition).bind("scroll",this.fakeFixLoader)},resetHtml:function(){this.element.html(a(this.defaultHtml).html())},show:function(b,g,h){var i,j,k,l;this.resetHtml(),a.type(b)==="object"?(l=a.extend({},this.options,b),b=l.theme||a.mobile.loadingMessageTheme):(l=this.options,b=b||a.mobile.loadingMessageTheme||l.theme),j=g||a.mobile.loadingMessage||l.text,e.addClass("ui-loading");if(a.mobile.loadingMessage!==!1||l.html)a.mobile.loadingMessageTextVisible!==d?i=a.mobile.loadingMessageTextVisible:i=l.textVisible,this.element.attr("class",c+" ui-corner-all ui-body-"+b+" ui-loader-"+(i||g||b.text?"verbose":"default")+(l.textonly||h?" ui-loader-textonly":"")),l.html?this.element.html(l.html):this.element.find("h1").text(j),this.element.appendTo(a.mobile.pageContainer),this.checkLoaderPosition(),f.bind("scroll",a.proxy(this.checkLoaderPosition,this))},hide:function(){e.removeClass("ui-loading"),a.mobile.loadingMessage&&this.element.removeClass("ui-loader-fakefix"),a(b).unbind("scroll",a.proxy(this.fakeFixLoader,this)),a(b).unbind("scroll",a.proxy(this.checkLoaderPosition,this))}}),f.bind("pagecontainercreate",function(){a.mobile.loaderWidget=a.mobile.loaderWidget||a(a.mobile.loader.prototype.defaultHtml).loader()})}(a,this),function(a,b,c,d){function x(a){while(a&&typeof a.originalEvent!="undefined")a=a.originalEvent;return a}function y(b,c){var e=b.type,f,g,i,k,l,m,n,o,p;b=a.Event(b),b.type=c,f=b.originalEvent,g=a.event.props,e.search(/^(mouse|click)/)>-1&&(g=j);if(f)for(n=g.length,k;n;)k=g[--n],b[k]=f[k];e.search(/mouse(down|up)|click/)>-1&&!b.which&&(b.which=1);if(e.search(/^touch/)!==-1){i=x(f),e=i.touches,l=i.changedTouches,m=e&&e.length?e[0]:l&&l.length?l[0]:d;if(m)for(o=0,p=h.length;oe||Math.abs(c.pageY-n)>e,o&&!d&&H("vmousecancel",b,f),H("vmousemove",b,f),F()}function M(a){if(r)return;C();var b=z(a.target),c;H("vmouseup",a,b);if(!o){var d=H("vclick",a,b);d&&d.isDefaultPrevented()&&(c=x(a).changedTouches[0],p.push({touchID:v,x:c.clientX,y:c.clientY}),q=!0)}H("vmouseout",a,b),o=!1,F()}function N(b){var c=a.data(b,e),d;if(c)for(d in c)if(c[d])return!0;return!1}function O(){}function P(b){var c=b.substr(1);return{setup:function(d,f){N(this)||a.data(this,e,{});var g=a.data(this,e);g[b]=!0,k[b]=(k[b]||0)+1,k[b]===1&&t.bind(c,I),a(this).bind(c,O),s&&(k.touchstart=(k.touchstart||0)+1,k.touchstart===1&&t.bind("touchstart",J).bind("touchend",M).bind("touchmove",L).bind("scroll",K))},teardown:function(d,f){--k[b],k[b]||t.unbind(c,I),s&&(--k.touchstart,k.touchstart||t.unbind("touchstart",J).unbind("touchmove",L).unbind("touchend",M).unbind("scroll",K));var g=a(this),h=a.data(this,e);h&&(h[b]=!1),g.unbind(c,O),N(this)||g.removeData(e)}}}var e="virtualMouseBindings",f="virtualTouchID",g="vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split(" "),h="clientX clientY pageX pageY screenX screenY".split(" "),i=a.event.mouseHooks?a.event.mouseHooks.props:[],j=a.event.props.concat(i),k={},l=0,m=0,n=0,o=!1,p=[],q=!1,r=!1,s="addEventListener"in c,t=a(c),u=1,v=0,w;a.vmouse={moveDistanceThreshold:10,clickDistanceThreshold:10,resetTimerDuration:1500};for(var Q=0;Qa.event.special.swipe.scrollSupressionThreshold&&b.preventDefault()}var e=b.originalEvent.touches?b.originalEvent.touches[0]:b,f={time:(new Date).getTime(),coords:[e.pageX,e.pageY],origin:a(b.target)},g;c.bind(i,j).one(h,function(b){c.unbind(i,j),f&&g&&g.time-f.timea.event.special.swipe.horizontalDistanceThreshold&&Math.abs(f.coords[1]-g.coords[1])g.coords[0]?"swipeleft":"swiperight"),f=g=d})})}},a.each({scrollstop:"scrollstart",taphold:"tap",swipeleft:"swipe",swiperight:"swipe"},function(b,c){a.event.special[b]={setup:function(){a(this).bind(c,a.noop)}}})}(a,this),function(a,c){a.extend(a.support,{orientation:"orientation"in b&&"onorientationchange"in b})}(a),function(a){a.event.special.throttledresize={setup:function(){a(this).bind("resize",c)},teardown:function(){a(this).unbind("resize",c)}};var b=250,c=function(){f=(new Date).getTime(),g=f-d,g>=b?(d=f,a(this).trigger("throttledresize")):(e&&clearTimeout(e),e=setTimeout(c,b-g))},d=0,e,f,g}(a),function(a,b){function o(){var a=g();a!==h&&(h=a,d.trigger(e))}var d=a(b),e="orientationchange",f,g,h,i,j,k={0:!0,180:!0};if(a.support.orientation){var l=b.innerWidth||a(b).width(),m=b.innerHeight||a(b).height(),n=50;i=l>m&&l-m>n,j=k[b.orientation];if(i&&j||!i&&!j)k={"-90":!0,90:!0}}a.event.special.orientationchange=a.extend({},a.event.special.orientationchange,{setup:function(){if(a.support.orientation&&!a.event.special.orientationchange.disabled)return!1;h=g(),d.bind("throttledresize",o)},teardown:function(){if(a.support.orientation&&!a.event.special.orientationchange.disabled)return!1;d.unbind("throttledresize",o)},add:function(a){var b=a.handler;a.handler=function(a){return a.orientation=g(),b.apply(this,arguments)}}}),a.event.special.orientationchange.orientation=g=function(){var d=!0,e=c.documentElement;return a.support.orientation?d=k[b.orientation]:d=e&&e.clientWidth/e.clientHeight<1.1,d?"portrait":"landscape"},a.fn[e]=function(a){return a?this.bind(e,a):this.trigger(e)},a.attrFn&&(a.attrFn[e]=!0)}(a,this),function(a,d){var e=a(b),f=a("html");a.mobile.media=function(){var b={},d=a("
"),e=a("").append(d);return function(a){if(!(a in b)){var g=c.createElement("style"),h="@media "+a+" { #jquery-mediatest { position:absolute; } }";g.type="text/css",g.styleSheet?g.styleSheet.cssText=h:g.appendChild(c.createTextNode(h)),f.prepend(e).prepend(g),b[a]=d.css("position")==="absolute",e.add(g).remove()}return b[a]}}()}(a),function(a,d){function e(a){var b=a.charAt(0).toUpperCase()+a.substr(1),c=(a+" "+h.join(b+" ")+b).split(" ");for(var e in c)if(g[c[e]]!==d)return!0}function m(a,b,d){var e=c.createElement("div"),f=function(a){return a.charAt(0).toUpperCase()+a.substr(1)},g=function(a){return"-"+a.charAt(0).toLowerCase()+a.substr(1)+"-"},i=function(c){var d=g(c)+a+": "+b+";",h=f(c),i=h+f(a);e.setAttribute("style",d),!e.style[i]||(k=!0)},j=d?[d]:h,k;for(var l=0;l",{href:b}).appendTo("head"),g=a("").prependTo(f),h=g[0].href,c[0].href=e||location.pathname,d&&d.remove(),h.indexOf(b)===0}function p(){var a=c.createElement("x"),d=c.documentElement,e=b.getComputedStyle,f;return"pointerEvents"in a.style?(a.style.pointerEvents="auto",a.style.pointerEvents="x",d.appendChild(a),f=e&&e(a,"").pointerEvents==="auto",d.removeChild(a),!!f):!1}function q(){var a=c.createElement("div");return typeof a.getBoundingClientRect!="undefined"}var f=a("").prependTo("html"),g=f[0].style,h=["Webkit","Moz","O"],i="palmGetResource"in b,j=b.opera,k=b.operamini&&{}.toString.call(b.operamini)==="[object OperaMini]",l=b.blackberry&&!e("-webkit-transform");a.extend(a.mobile,{browser:{}}),a.mobile.browser.ie=function(){var a=3,b=c.createElement("div"),d=b.all||[];do b.innerHTML="";while(d[0]);return a>4?a:!a}(),a.extend(a.support,{cssTransitions:"WebKitTransitionEvent"in b||m("transition","height 100ms linear")&&!j,pushState:"pushState"in history&&"replaceState"in history,mediaquery:a.mobile.media("only all"),cssPseudoElement:!!e("content"),touchOverflow:!!e("overflowScrolling"),cssTransform3d:n(),boxShadow:!!e("boxShadow")&&!l,scrollTop:("pageXOffset"in b||"scrollTop"in c.documentElement||"scrollTop"in f[0])&&!i&&!k,dynamicBaseTag:o(),cssPointerEvents:p(),boundingRect:q()}),f.remove();var r=function(){var a=b.navigator.userAgent;return a.indexOf("Nokia")>-1&&(a.indexOf("Symbian/3")>-1||a.indexOf("Series60/5")>-1)&&a.indexOf("AppleWebKit")>-1&&a.match(/(BrowserNG|NokiaBrowser)\/7\.[0-3]/)}();a.mobile.gradeA=function(){return(a.support.mediaquery||a.mobile.browser.ie&&a.mobile.browser.ie>=7)&&(a.support.boundingRect||a.fn.jquery.match(/1\.[0-7+]\.[0-9+]?/)!==null)},a.mobile.ajaxBlacklist=b.blackberry&&!b.WebKitPoint||k||r,r&&a(function(){a("head link[rel='stylesheet']").attr("rel","alternate stylesheet").attr("rel","stylesheet")}),a.support.boxShadow||a("html").addClass("ui-mobile-nosupport-boxshadow")}(a),function(a,b){a.widget("mobile.page",a.mobile.widget,{options:{theme:"c",domCache:!1,keepNativeDefault:":jqmData(role='none'), :jqmData(role='nojs')"},_create:function(){var a=this;if(a._trigger("beforecreate")===!1)return!1;a.element.attr("tabindex","0").addClass("ui-page ui-body-"+a.options.theme).bind("pagebeforehide",function(){a.removeContainerBackground()}).bind("pagebeforeshow",function(){a.setContainerBackground()})},removeContainerBackground:function(){a.mobile.pageContainer.removeClass("ui-overlay-"+a.mobile.getInheritedTheme(this.element.parent()))},setContainerBackground:function(b){this.options.theme&&a.mobile.pageContainer.addClass("ui-overlay-"+(b||this.options.theme))},keepNativeSelector:function(){var b=this.options,c=b.keepNative&&a.trim(b.keepNative);return c&&b.keepNative!==b.keepNativeDefault?[b.keepNative,b.keepNativeDefault].join(", "):b.keepNativeDefault}})}(a),function(a,b,d){function k(a){return a=a||location.href,"#"+a.replace(/^[^#]*#?(.*)$/,"$1")}var e="hashchange",f=c,g,h=a.event.special,i=f.documentMode,j="on"+e in b&&(i===d||i>7);a.fn[e]=function(a){return a?this.bind(e,a):this.trigger(e)},a.fn[e].delay=50,h[e]=a.extend(h[e],{setup:function(){if(j)return!1;a(g.start)},teardown:function(){if(j)return!1;a(g.stop)}}),g=function(){function n(){var c=k(),d=m(h);c!==h?(l(h=c,d),a(b).trigger(e)):d!==h&&(location.href=location.href.replace(/#.*/,"")+d),g=setTimeout(n,a.fn[e].delay)}var c={},g,h=k(),i=function(a){return a},l=i,m=i;return c.start=function(){g||n()},c.stop=function(){g&&clearTimeout(g),g=d},a.browser.msie&&!j&&function(){var b,d;c.start=function(){b||(d=a.fn[e].src,d=d&&d+k(),b=a('