Skip to content

Instantly share code, notes, and snippets.

@scottjehl
Created December 6, 2010 15:15
Show Gist options
  • Save scottjehl/730415 to your computer and use it in GitHub Desktop.
Save scottjehl/730415 to your computer and use it in GitHub Desktop.
/*!
* jQuery Mobile v1.0a3pre
* http://jquerymobile.com/
*
* Copyright 2010, jQuery Project
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*/
(function(a,f){if(a.cleanData){var c=a.cleanData;a.cleanData=function(b){for(var e=0,d;(d=b[e])!=null;e++)a(d).triggerHandler("remove");c(b)}}else{var g=a.fn.remove;a.fn.remove=function(b,e){return this.each(function(){if(!e)if(!b||a.filter(b,[this]).length)a("*",this).add([this]).each(function(){a(this).triggerHandler("remove")});return g.call(a(this),b,e)})}}a.widget=function(b,e,d){var i=b.split(".")[0],k;b=b.split(".")[1];k=i+"-"+b;if(!d){d=e;e=a.Widget}a.expr[":"][k]=function(l){return!!a.data(l,
b)};a[i]=a[i]||{};a[i][b]=function(l,h){arguments.length&&this._createWidget(l,h)};e=new e;e.options=a.extend(true,{},e.options);a[i][b].prototype=a.extend(true,e,{namespace:i,widgetName:b,widgetEventPrefix:a[i][b].prototype.widgetEventPrefix||b,widgetBaseClass:k},d);a.widget.bridge(b,a[i][b])};a.widget.bridge=function(b,e){a.fn[b]=function(d){var i=typeof d==="string",k=Array.prototype.slice.call(arguments,1),l=this;d=!i&&k.length?a.extend.apply(null,[true,d].concat(k)):d;if(i&&d.charAt(0)==="_")return l;
i?this.each(function(){var h=a.data(this,b);if(!h)throw"cannot call methods on "+b+" prior to initialization; attempted to call method '"+d+"'";if(!a.isFunction(h[d]))throw"no such method '"+d+"' for "+b+" widget instance";var m=h[d].apply(h,k);if(m!==h&&m!==f){l=m;return false}}):this.each(function(){var h=a.data(this,b);h?h.option(d||{})._init():a.data(this,b,new e(d,this))});return l}};a.Widget=function(b,e){arguments.length&&this._createWidget(b,e)};a.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",
options:{disabled:false},_createWidget:function(b,e){a.data(e,this.widgetName,this);this.element=a(e);this.options=a.extend(true,{},this.options,this._getCreateOptions(),b);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){var b={};if(a.metadata)b=a.metadata.get(element)[this.widgetName];return b},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);
this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(b,e){var d=b;if(arguments.length===0)return a.extend({},this.options);if(typeof b==="string"){if(e===f)return this.options[b];d={};d[b]=e}this._setOptions(d);return this},_setOptions:function(b){var e=this;a.each(b,function(d,i){e._setOption(d,i)});return this},_setOption:function(b,e){this.options[b]=e;if(b===
"disabled")this.widget()[e?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",e);return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(b,e,d){var i=this.options[b];e=a.Event(e);e.type=(b===this.widgetEventPrefix?b:this.widgetEventPrefix+b).toLowerCase();d=d||{};if(e.originalEvent){b=a.event.props.length;for(var k;b;){k=a.event.props[--b];e[k]=e.originalEvent[k]}}this.element.trigger(e,
d);return!(a.isFunction(i)&&i.call(this.element[0],e,d)===false||e.isDefaultPrevented())}}})(jQuery);(function(a,f){a.widget("mobile.widget",{_getCreateOptions:function(){var c=this.element,g={};a.each(this.options,function(b){var e=c.data(b.replace(/[A-Z]/g,function(d){return"-"+d.toLowerCase()}));if(e!==f)g[b]=e});return g}})})(jQuery);
(function(a){function f(){var e=c.width(),d=[],i=[],k;g.removeClass("min-width-"+b.join("px min-width-")+"px max-width-"+b.join("px max-width-")+"px");a.each(b,function(l,h){e>=h&&d.push("min-width-"+h+"px");e<=h&&i.push("max-width-"+h+"px")});if(d.length)k=d.join(" ");if(i.length)k+=" "+i.join(" ");g.addClass(k)}var c=a(window),g=a("html"),b=[320,480,768,1024];a.mobile.media=function(){var e={},d=a("<div id='jquery-mediatest'>"),i=a("<body>").append(d);return function(k){if(!(k in e)){var l=a("<style type='text/css'>@media "+
k+"{#jquery-mediatest{position:absolute;}}</style>");g.prepend(i).prepend(l);e[k]=d.css("position")==="absolute";i.add(l).remove()}return e[k]}}();a.mobile.addResolutionBreakpoints=function(e){if(a.type(e)==="array")b=b.concat(e);else b.push(e);b.sort(function(d,i){return d-i});f()};a(document).bind("mobileinit.htmlclass",function(){c.bind("orientationchange.htmlclass resize.htmlclass",function(e){e.orientation&&g.removeClass("portrait landscape").addClass(e.orientation);f()});c.trigger("orientationchange.htmlclass")})})(jQuery);
(function(a,f){function c(k){var l=k.charAt(0).toUpperCase()+k.substr(1);k=(k+" "+e.join(l+" ")+l).split(" ");for(var h in k)if(b[k[h]]!==f)return true}var g=a("<body>").prependTo("html"),b=g[0].style,e=["webkit","moz","o"],d=window.palmGetResource||window.PalmServiceBridge,i=window.blackberry;a.extend(a.support,{orientation:"orientation"in window,touch:"ontouchend"in document,cssTransitions:"WebKitTransitionEvent"in window,pushState:!!history.pushState,mediaquery:a.mobile.media("only all"),cssPseudoElement:!!c("content"),
boxShadow:!!c("boxShadow")&&!i,scrollTop:("pageXOffset"in window||"scrollTop"in document.documentElement||"scrollTop"in g[0])&&!d,dynamicBaseTag:function(){var k=location.protocol+"//"+location.host+location.pathname+"ui-dir/",l=a("<base>",{href:k}).appendTo("head"),h=a("<a href='testurl'></a>").prependTo(g)[0].href;l.remove();return h.indexOf(k)===0}()});g.remove();a.support.boxShadow||a("html").addClass("ui-mobile-nosupport-boxshadow")})(jQuery);
(function(a,f){a.each("touchstart touchmove touchend orientationchange tap taphold swipe swipeleft swiperight scrollstart scrollstop".split(" "),function(d,i){a.fn[i]=function(k){return k?this.bind(i,k):this.trigger(i)};a.attrFn[i]=true});var c=a.support.touch,g=c?"touchstart":"mousedown",b=c?"touchend":"mouseup",e=c?"touchmove":"mousemove";a.event.special.scrollstart={enabled:true,setup:function(){function d(h,m){k=m;var n=h.type;h.type=k?"scrollstart":"scrollstop";a.event.handle.call(i,h);h.type=
n}var i=this,k,l;a(i).bind("touchmove scroll",function(h){if(a.event.special.scrollstart.enabled){k||d(h,true);clearTimeout(l);l=setTimeout(function(){d(h,false)},50)}})}};a.event.special.tap={setup:function(){var d=this,i=a(d);i.bind(g,function(k){function l(){if(Math.abs(n[0]-k.pageX)>10||Math.abs(n[1]-k.pageY)>10)h=true}if(!(k.which&&k.which!==1)){var h=false,m=true,n=[k.pageX,k.pageY],j,o;o=setTimeout(function(){if(m&&!h){j=k.type;k.type="taphold";a.event.handle.call(d,k);k.type=j}},750);i.one(e,
l).one(b,function(p){i.unbind(e,l);clearTimeout(o);m=false;if(!h){j=p.type;p.type="tap";a.event.handle.call(d,p);p.type=j}})}})}};a.event.special.swipe={setup:function(){var d=a(this);d.bind(g,function(i){function k(n){if(h){var j=n.originalEvent.touches?n.originalEvent.touches[0]:n;m={time:(new Date).getTime(),coords:[j.pageX,j.pageY]};Math.abs(h.coords[0]-m.coords[0])>10&&n.preventDefault()}}var l=i.originalEvent.touches?i.originalEvent.touches[0]:i,h={time:(new Date).getTime(),coords:[l.pageX,
l.pageY],origin:a(i.target)},m;d.bind(e,k).one(b,function(){d.unbind(e,k);if(h&&m)if(m.time-h.time<1E3&&Math.abs(h.coords[0]-m.coords[0])>30&&Math.abs(h.coords[1]-m.coords[1])<75)h.origin.trigger("swipe").trigger(h.coords[0]>m.coords[0]?"swipeleft":"swiperight");h=m=f})})}};(function(d){function i(){var m=l();if(m!==h){h=m;k.trigger("orientationchange")}}var k=d(window),l,h;d.event.special.orientationchange={setup:function(){if(d.support.orientation)return false;h=l();k.bind("resize",i)},teardown:function(){if(d.support.orientation)return false;
k.unbind("resize",i)},add:function(m){var n=m.handler;m.handler=function(j){j.orientation=l();return n.apply(this,arguments)}}};l=function(){var m=document.documentElement;return m&&m.clientWidth/m.clientHeight<1.1?"portrait":"landscape"}})(jQuery);a.each({scrollstop:"scrollstart",taphold:"tap",swipeleft:"swipe",swiperight:"swipe"},function(d,i){a.event.special[d]={setup:function(){a(this).bind(i,a.noop)}}})})(jQuery);
(function(a,f,c){function g(h){h=h||location.href;return"#"+h.replace(/^[^#]*#?(.*)$/,"$1")}var b="hashchange",e=document,d,i=a.event.special,k=e.documentMode,l="on"+b in f&&(k===c||k>7);a.fn[b]=function(h){return h?this.bind(b,h):this.trigger(b)};a.fn[b].delay=50;i[b]=a.extend(i[b],{setup:function(){if(l)return false;a(d.start)},teardown:function(){if(l)return false;a(d.stop)}});d=function(){function h(){var s=g(),u=q(j);if(s!==j){p(j=s,u);a(f).trigger(b)}else if(u!==j)location.href=location.href.replace(/#.*/,
"")+u;n=setTimeout(h,a.fn[b].delay)}var m={},n,j=g(),o=function(s){return s},p=o,q=o;m.start=function(){n||h()};m.stop=function(){n&&clearTimeout(n);n=c};a.browser.msie&&!l&&function(){var s,u;m.start=function(){if(!s){u=(u=a.fn[b].src)&&u+g();s=a('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){u||p(g());h()}).attr("src",u||"javascript:0").insertAfter("body")[0].contentWindow;e.onpropertychange=function(){try{if(event.propertyName==="title")s.document.title=e.title}catch(v){}}}};
m.stop=o;q=function(){return g(s.location.href)};p=function(v,r){var t=s.document,w=a.fn[b].domain;if(v!==r){t.title=e.title;t.open();w&&t.write('<script>document.domain="'+w+'"<\/script>');t.close();s.location.hash=v}}}();return m}()})(jQuery,this);
(function(a,f,c){a.extend(a.mobile,{subPageUrlKey:"ui-page",nonHistorySelectors:"dialog",activePageClass:"ui-page-active",activeBtnClass:"ui-btn-active",ajaxLinksEnabled:true,ajaxFormsEnabled:true,defaultTransition:"slide",loadingMessage:"loading",metaViewportContent:"width=device-width, minimum-scale=1, maximum-scale=1",gradeA:function(){return a.support.mediaquery}});a(f.document).trigger("mobileinit");if(a.mobile.gradeA()){var g=a(f),b=a("html"),e=a("head"),d=a.mobile.loadingMessage?a('<div class="ui-loader ui-body-a ui-corner-all"><span class="ui-icon ui-icon-loading spin"></span><h1>'+
a.mobile.loadingMessage+"</h1></div>"):c;b.addClass("ui-mobile ui-mobile-rendering");a.mobile.metaViewportContent&&a("<meta>",{name:"viewport",content:a.mobile.metaViewportContent}).prependTo(e);a.extend(a.mobile,{pageLoading:function(i){if(i)b.removeClass("ui-loading");else{a.mobile.loadingMessage&&d.appendTo(a.mobile.pageContainer).css({top:a(f).scrollTop()+75});b.addClass("ui-loading")}},silentScroll:function(i){a.event.special.scrollstart.enabled=false;setTimeout(function(){f.scrollTo(0,i||0)},
20);setTimeout(function(){a.event.special.scrollstart.enabled=true},150)}});a(function(){var i=a("[data-role='page']");a.mobile.startPage=a.mobile.activePage=i.first();a.mobile.pageContainer=a.mobile.startPage.parent().addClass("ui-mobile-viewport");a.mobile.pageLoading();i.page();g.trigger("hashchange",[true]);b.removeClass("ui-mobile-rendering")});g.load(a.mobile.silentScroll)}})(jQuery,this);
(function(a,f){function c(j){var o=j.find(".ui-title:eq(0)");o.length?o.focus():j.find(h).eq(0).focus()}function g(j){if(k&&(!k.closest(".ui-page-active").length||j))k.removeClass(a.mobile.activeBtnClass);k=null}var b=a(window);a("html");var e=a("head"),d={get:function(j){if(j==f)j=location.hash;j=j.replace(/#/,"").split("/");j.pop();return j.join("/")+(j.length?"/":"")},getFilePath:function(j){var o="&"+a.mobile.subPageUrlKey;return j.indexOf(o)>-1?j.split(o)[0]:j},set:function(j,o){if(o)n=false;
location.hash=j},origin:null,setOrigin:function(){d.origin=d.get(location.protocol+"//"+location.host+location.pathname)}},i=a.support.dynamicBaseTag?{element:a("<base>",{href:d.origin}).prependTo(e),set:function(j){i.element.attr("href",d.origin+d.get(j))},reset:function(){i.element.attr("href",d.origin)}}:f,k=null,l=[{url:location.hash.replace(/^#/,""),transition:f}],h="[tabindex],a,button:visible,select:visible,input",m=null,n=true;d.setOrigin();a.fn.animationComplete=function(j){if(a.support.cssTransitions)return a(this).one("webkitAnimationEnd",
j);else j()};a.mobile.updateHash=d.set;a.mobile.urlStack=l;a.mobile.changePage=function(j,o,p,q){function s(){function A(){a.mobile.pageLoading(true);c(j);q!==false&&t&&d.set(t,p!==true);g();D!=null&&D.remove();a.mobile.silentScroll(j.data("lastScroll"));if(r.data("page")._trigger("hide",null,{nextPage:j})!==false&&j.data("page")._trigger("show",null,{prevPage:r})!==false)a.mobile.activePage=j}var B=b.scrollTop();r.data("lastScroll",B);r.data("page")._trigger("beforehide",{nextPage:j});j.data("page")._trigger("beforeshow",
{prevPage:r});if(o&&o!=="none"){a.mobile.pageContainer.addClass("ui-mobile-viewport-transitioning");r.addClass(o+" out "+(p?"reverse":""));j.addClass(a.mobile.activePageClass+" "+o+" in "+(p?"reverse":""));j.animationComplete(function(){r.add(j).removeClass("out in reverse "+o);r.removeClass(a.mobile.activePageClass);A();a.mobile.pageContainer.removeClass("ui-mobile-viewport-transitioning")})}else{r.removeClass(a.mobile.activePageClass);j.addClass(a.mobile.activePageClass);A()}}function u(){if(m){j.attr("data-role",
m);m=f}j.page()}var v=a.type(j)==="array",r=v?j[0]:a.mobile.activePage;j=v?j[1]:j;var t=fileUrl=a.type(j)==="string"?j.replace(/^#/,""):null;v=f;var w="get",C=false,D=null;p=p!==f?p:l.length>1&&l[l.length-2].url===t;o=o!==f?o:a.mobile.defaultTransition;if(!(l.length>1&&t===l[l.length-1].url)){if(a.type(j)==="object"&&j.url){t=j.url;v=j.data;w=j.type;C=true;if(v&&w=="get"){t+="?"+v;v=f}}i&&i.reset();a(window.document.activeElement).add(":focus").blur();if(p){var y=l.pop();if(y)o=y.transition}else l.push({url:t,
transition:o});if(t){j=a("[id='"+t+"']");fileUrl=d.getFilePath(t)}else{y=j.attr("id");var F=d.getFilePath(y);if(y!=F)fileUrl=F}if(j.length&&!C){fileUrl&&i&&i.set(fileUrl);u();s()}else{if(j.length)D=j;a.mobile.pageLoading();a.ajax({url:fileUrl,type:w,data:v,success:function(A){i&&i.set(fileUrl);var B=a("<div></div>");B.get(0).innerHTML=A;j=B.find('[data-role="page"]');if(!a.support.dynamicBaseTag){var H=d.get(fileUrl);j.find("[src],link[href]").each(function(){var x=a(this).is("[href]")?"href":"src",
E=a(this).attr(x);E.replace(location.protocol+"//"+location.host+location.pathname,"");/^(\w+:|#|\/)/.test(E)||a(this).attr(x,H+E)})}if(j.attr("id")){var z=["data-role","data-theme","data-fullscreen"],G=j.wrap("<div>").parent();a.each(z,function(x){if(j.attr(z[x])){G.attr(z[x],j.attr(z[x]));j.removeAttr(z[x])}});j=G}j.attr("id",fileUrl).appendTo(a.mobile.pageContainer);u();s()},error:function(){a.mobile.pageLoading(true);g(true);a("<div class='ui-loader ui-overlay-shadow ui-body-e ui-corner-all'><h1>Error Loading Page</h1></div>").css({display:"block",
opacity:0.96,top:a(window).scrollTop()+100}).appendTo(a.mobile.pageContainer).delay(800).fadeOut(400,function(){a(this).remove()})}})}}};a("form").live("submit",function(j){if(a.mobile.ajaxFormsEnabled){var o=a(this).attr("method"),p=a(this).attr("action").replace(location.protocol+"//"+location.host,"");if(!/^(:?\w+:)/.test(p)){if(p.indexOf("/")&&p.indexOf("#")!==0)p=d.get()+p;a.mobile.changePage({url:p,type:o,data:a(this).serialize()},f,f,true);j.preventDefault()}}});a("a").live("click",function(j){if(a.mobile.ajaxLinksEnabled){var o=
a(this),p=o.attr("href").replace(location.protocol+"//"+location.host,""),q=o.is("[target]"),s=q||/^(:?\w+:)/.test(p)||o.is("[rel=external]");q=o.is("[target]");if(p==="#")return false;k=o.closest(".ui-btn").addClass(a.mobile.activeBtnClass);if(s||!a.mobile.ajaxLinksEnabled){g(true);if(q)window.open(p);else location.href=p}else{q=o.data("transition");s=o.data("back");var u=!o.is("[data-rel="+a.mobile.nonHistorySelectors+"]");m=o.attr("data-rel");if(p.indexOf("/")&&p.indexOf("#")!==0)p=d.get()+p;p.replace(/^#/,
"");a.mobile.changePage(p,q,s,u)}j.preventDefault()}});b.bind("hashchange",function(j,o){if(n){if(!a(".ui-page-active").is("[data-role="+a.mobile.nonHistorySelectors+"]")){var p=location.hash,q=o?false:f;if(p)a.mobile.changePage(p,q,f,false);else if(a.mobile.activePage.length&&a.mobile.startPage[0]!==a.mobile.activePage[0]&&!o)a.mobile.changePage(a.mobile.startPage,q,true,false);else{a.mobile.startPage.trigger("pagebeforeshow",{prevPage:a("")});a.mobile.startPage.addClass(a.mobile.activePageClass);
a.mobile.pageLoading(true);a.mobile.startPage.trigger("pageshow",{prevPage:a("")})!==false&&c(a.mobile.startPage)}}}else n=true})})(jQuery);
(function(a){a.widget("mobile.page",a.mobile.widget,{options:{backBtnText:"Back",addBackBtn:true,degradeInputs:{color:false,date:false,datetime:false,"datetime-local":false,email:false,month:false,number:false,range:"number",search:true,tel:false,time:false,url:false,week:false},keepNative:null},_create:function(){var f=this.element,c=this.options;this.keepNative="[data-role='none'], [data-role='nojs']"+(c.keepNative?", "+c.keepNative:"");if(this._trigger("beforeCreate")!==false){f.find("[data-role='page'], [data-role='content']").andSelf().each(function(){a(this).addClass("ui-"+
a(this).data("role"))});f.find("[data-role='nojs']").addClass("ui-nojs");this._enchanceControls();f.find("[data-role]").andSelf().each(function(){var g=a(this),b=g.data("role"),e=g.data("theme");if(b==="header"||b==="footer"){g.addClass("ui-bar-"+(e||g.parent("[data-role=page]").data("theme")||"a"));g.attr("role",b==="header"?"banner":"contentinfo");e=g.children("a");var d=e.hasClass("ui-btn-left"),i=e.hasClass("ui-btn-right");if(!d)d=e.eq(0).not(".ui-btn-right").addClass("ui-btn-left").length;if(!i)i=
e.eq(1).addClass("ui-btn-right").length;if(c.addBackBtn&&b==="header"&&(a.mobile.urlStack.length>1||a(".ui-page").length>1)&&!d&&!g.data("noBackBtn"))a("<a href='#' class='ui-btn-left' data-icon='arrow-l'>"+c.backBtnText+"</a>").click(function(){history.back();return false}).prependTo(g);g.children("h1, h2, h3, h4, h5, h6").addClass("ui-title").attr({tabindex:"0",role:"heading","aria-level":"1"})}else if(b==="content"){e&&g.addClass("ui-body-"+e);g.attr("role","main")}else if(b==="page")g.addClass("ui-body-"+
(e||"c"));switch(b){case "header":case "footer":case "page":case "content":g.addClass("ui-"+b);break;case "collapsible":case "fieldcontain":case "navbar":case "listview":case "dialog":g[b]()}});f.find("[data-role='button'], .ui-bar a, .ui-header a, .ui-footer a").not(".ui-btn").not(this.keepNative).buttonMarkup();f.find("[data-role='controlgroup']").controlgroup();f.find("a:not(.ui-btn):not(.ui-link-inherit)").not(this.keepNative).addClass("ui-link");f.fixHeaderFooter()}},_enchanceControls:function(){var f=
this.options;this.element.find("input").not(this.keepNative).each(function(){var c=this.getAttribute("type"),g=f.degradeInputs[c]||"text";f.degradeInputs[c]&&a(this).replaceWith(a("<div>").html(a(this).clone()).html().replace(/type="([a-zA-Z]+)"/,"type="+g+" data-type='$1'"))});this.element.find("[type='radio'], [type='checkbox']").not(this.keepNative).checkboxradio();this.element.find("button, [type='button'], [type='submit'], [type='reset'], [type='image']").not(this.keepNative).button();this.element.find("input, textarea").not("[type='radio'], [type='checkbox'], button, [type='button'], [type='submit'], [type='reset'], [type='image']").not(this.keepNative).textinput();
this.element.find("input, select").not(this.keepNative).filter("[data-role='slider'], [data-type='range']").slider();this.element.find("select:not([data-role='slider'])").not(this.keepNative).selectmenu()}})})(jQuery);
(function(a){a.ui=a.ui||{};var f=/left|center|right/,c=/top|center|bottom/,g=a.fn.position,b=a.fn.offset;a.fn.position=function(e){if(!e||!e.of)return g.apply(this,arguments);e=a.extend({},e);var d=a(e.of),i=d[0],k=(e.collision||"flip").split(" "),l=e.offset?e.offset.split(" "):[0,0],h,m,n;if(i.nodeType===9){h=d.width();m=d.height();n={top:0,left:0}}else if(i.setTimeout){h=d.width();m=d.height();n={top:d.scrollTop(),left:d.scrollLeft()}}else if(i.preventDefault){e.at="left top";h=m=0;n={top:e.of.pageY,
left:e.of.pageX}}else{h=d.outerWidth();m=d.outerHeight();n=d.offset()}a.each(["my","at"],function(){var j=(e[this]||"").split(" ");if(j.length===1)j=f.test(j[0])?j.concat(["center"]):c.test(j[0])?["center"].concat(j):["center","center"];j[0]=f.test(j[0])?j[0]:"center";j[1]=c.test(j[1])?j[1]:"center";e[this]=j});if(k.length===1)k[1]=k[0];l[0]=parseInt(l[0],10)||0;if(l.length===1)l[1]=l[0];l[1]=parseInt(l[1],10)||0;if(e.at[0]==="right")n.left+=h;else if(e.at[0]==="center")n.left+=h/2;if(e.at[1]==="bottom")n.top+=
m;else if(e.at[1]==="center")n.top+=m/2;n.left+=l[0];n.top+=l[1];return this.each(function(){var j=a(this),o=j.outerWidth(),p=j.outerHeight(),q=parseInt(a.curCSS(this,"marginLeft",true))||0,s=parseInt(a.curCSS(this,"marginTop",true))||0,u=o+q+parseInt(a.curCSS(this,"marginRight",true))||0,v=p+s+parseInt(a.curCSS(this,"marginBottom",true))||0,r=a.extend({},n),t;if(e.my[0]==="right")r.left-=o;else if(e.my[0]==="center")r.left-=o/2;if(e.my[1]==="bottom")r.top-=p;else if(e.my[1]==="center")r.top-=p/2;
r.left=parseInt(r.left);r.top=parseInt(r.top);t={left:r.left-q,top:r.top-s};a.each(["left","top"],function(w,C){a.ui.position[k[w]]&&a.ui.position[k[w]][C](r,{targetWidth:h,targetHeight:m,elemWidth:o,elemHeight:p,collisionPosition:t,collisionWidth:u,collisionHeight:v,offset:l,my:e.my,at:e.at})});a.fn.bgiframe&&j.bgiframe();j.offset(a.extend(r,{using:e.using}))})};a.ui.position={fit:{left:function(e,d){var i=a(window);i=d.collisionPosition.left+d.collisionWidth-i.width()-i.scrollLeft();e.left=i>0?
e.left-i:Math.max(e.left-d.collisionPosition.left,e.left)},top:function(e,d){var i=a(window);i=d.collisionPosition.top+d.collisionHeight-i.height()-i.scrollTop();e.top=i>0?e.top-i:Math.max(e.top-d.collisionPosition.top,e.top)}},flip:{left:function(e,d){if(d.at[0]!=="center"){var i=a(window);i=d.collisionPosition.left+d.collisionWidth-i.width()-i.scrollLeft();var k=d.my[0]==="left"?-d.elemWidth:d.my[0]==="right"?d.elemWidth:0,l=d.at[0]==="left"?d.targetWidth:-d.targetWidth,h=-2*d.offset[0];e.left+=
d.collisionPosition.left<0?k+l+h:i>0?k+l+h:0}},top:function(e,d){if(d.at[1]!=="center"){var i=a(window);i=d.collisionPosition.top+d.collisionHeight-i.height()-i.scrollTop();var k=d.my[1]==="top"?-d.elemHeight:d.my[1]==="bottom"?d.elemHeight:0,l=d.at[1]==="top"?d.targetHeight:-d.targetHeight,h=-2*d.offset[1];e.top+=d.collisionPosition.top<0?k+l+h:i>0?k+l+h:0}}}};if(!a.offset.setOffset){a.offset.setOffset=function(e,d){if(/static/.test(a.curCSS(e,"position")))e.style.position="relative";var i=a(e),
k=i.offset(),l=parseInt(a.curCSS(e,"top",true),10)||0,h=parseInt(a.curCSS(e,"left",true),10)||0;k={top:d.top-k.top+l,left:d.left-k.left+h};"using"in d?d.using.call(e,k):i.css(k)};a.fn.offset=function(e){var d=this[0];if(!d||!d.ownerDocument)return null;if(e)return this.each(function(){a.offset.setOffset(this,e)});return b.call(this)}}})(jQuery);
(function(a){a.fn.fixHeaderFooter=function(){if(!a.support.scrollTop)return a(this);return a(this).each(function(){a(this).data("fullscreen")&&a(this).addClass("ui-page-fullscreen");a(this).find('.ui-header[data-position="fixed"]').addClass("ui-header-fixed ui-fixed-inline fade");a(this).find('.ui-footer[data-position="fixed"]').addClass("ui-footer-fixed ui-fixed-inline fade")})};a.fixedToolbars=function(){function f(h){var m=0;if(h){var n=h.offsetParent,j=document.body;for(m=h.offsetTop;h&&h!=j;){m+=
h.scrollTop||0;if(h==n){m+=n.offsetTop;n=h.offsetParent}h=h.parentNode}}return m}function c(h){var m=a(window).scrollTop(),n=f(h[0]),j=h.css("top")=="auto"?0:parseFloat(h.css("top")),o=window.innerHeight,p=h.outerHeight(),q=h.parents(".ui-page:not(.ui-page-fullscreen)").length;if(h.is(".ui-header-fixed")){j=m-n+j;if(j<n)j=0;return h.css("top",q?j:m)}else{j=m+o-p-(n-j);return h.css("top",q?j:m+o-p)}}if(a.support.scrollTop){var g="inline",b,e=a.support.touch,d=e?"touchstart":"mousedown",i=e?"touchend":
"mouseup",k=null,l=false;a(function(){a(document).bind(d,function(h){if(!a(h.target).closest("a,input,textarea,select,button,label,.ui-header-fixed,.ui-footer-fixed").length){k=g;a.fixedToolbars.hide(true)}}).bind("scrollstart",function(h){if(!a(h.target).closest("a,input,textarea,select,button,label,.ui-header-fixed,.ui-footer-fixed").length){l=true;if(k==null)k=g;a.fixedToolbars.hide(true)}}).bind(i,function(h){if(!a(h.target).closest("a,input,textarea,select,button,label,.ui-header-fixed,.ui-footer-fixed").length)if(!l){a.fixedToolbars.toggle(k);
k=null}}).bind("scrollstop",function(h){if(!a(h.target).closest("a,input,textarea,select,button,label,.ui-header-fixed,.ui-footer-fixed").length){l=false;a.fixedToolbars.toggle(k=="overlay"?"inline":"overlay");k=null}});a(".ui-page").live("pagebeforeshow",function(h){var m=a(h.target).find('[data-role="footer"]');b=a('.ui-footer[data-id="'+m.data("id")+'"]:not(.ui-footer-duplicate)').not(m);if(b.length){b.parents(".ui-page:eq(0)").find('.ui-footer[data-id="'+b.data("id")+'"]').length==1&&b.before(b.clone().addClass("ui-footer-duplicate"));
a(h.target).find('[data-role="footer"]').addClass("ui-footer-duplicate");b.appendTo(a.pageContainer).css("top",0);c(b)}});a(".ui-page").live("pageshow",function(h){b&&b.length&&b.appendTo(h.target).css("top",0);a.fixedToolbars.show(true,this)})});return{show:function(h,m){g="overlay";return(m?a(m):a.mobile.activePage?a.mobile.activePage:a(".ui-page-active")).children(".ui-header-fixed:first, .ui-footer-fixed:not(.ui-footer-duplicate):last").each(function(){var n=a(this),j=a(window).scrollTop(),o=
f(n[0]),p=window.innerHeight,q=n.outerHeight();j=n.is(".ui-header-fixed")&&j<=o+q||n.is(".ui-footer-fixed")&&o<=j+p;n.addClass("ui-fixed-overlay").removeClass("ui-fixed-inline");!j&&!h&&n.addClass("in").animationComplete(function(){n.removeClass("in")});c(n)})},hide:function(h){g="inline";return(a.mobile.activePage?a.mobile.activePage:a(".ui-page-active")).children(".ui-header-fixed:first, .ui-footer-fixed:not(.ui-footer-duplicate):last").each(function(){var m=a(this),n=m.css("top");n=n=="auto"?0:
parseFloat(n);m.addClass("ui-fixed-inline").removeClass("ui-fixed-overlay");if(n<0||m.is(".ui-header-fixed")&&n!=0)if(h)m.css("top",0);else m.css("top")!=="auto"&&parseFloat(m.css("top"))!==0&&m.addClass("out reverse").animationComplete(function(){m.removeClass("out reverse");m.css("top",0)})})},hideAfterDelay:function(){setTimeout(function(){a.fixedToolbars.hide()},3E3)},toggle:function(h){if(h)g=h;return g=="overlay"?a.fixedToolbars.hide():a.fixedToolbars.show()}}}}()})(jQuery);
(function(a,f){a.widget("mobile.checkboxradio",a.mobile.widget,{options:{theme:null},_create:function(){var c=this.element,g=a("label[for='"+c.attr("id")+"']"),b=c.attr("type"),e="ui-icon-"+b+"-off";if(!(b!="checkbox"&&b!="radio")){g.buttonMarkup({theme:this.options.theme,icon:this.element.parents("[data-type='horizontal']").length?f:e,shadow:false});c.add(g).wrapAll("<div class='ui-"+b+"'></div>");g.bind({mouseover:function(){if(a(this).parent().is(".ui-disabled"))return false},mousedown:function(){if(a(this).parent().is(".ui-disabled"))return false;
g.data("state",c.attr("checked"))},click:function(){setTimeout(function(){c.attr("checked")===g.data("state")&&c.trigger("click")},1)}});c.bind({click:function(){a("input[name='"+c.attr("name")+"'][type='"+b+"']").checkboxradio("refresh")},focus:function(){g.addClass("ui-focus")},blur:function(){g.removeClass("ui-focus")}});this.refresh()}},refresh:function(){var c=this.element,g=a("label[for='"+c.attr("id")+"']"),b=c.attr("type"),e=g.find(".ui-icon"),d="ui-icon-"+b+"-on";b="ui-icon-"+b+"-off";if(c[0].checked){g.addClass("ui-btn-active");
e.addClass(d);e.removeClass(b)}else{g.removeClass("ui-btn-active");e.removeClass(d);e.addClass(b)}c.is(":disabled")?this.disable():this.enable()},disable:function(){this.element.attr("disabled",true).parent().addClass("ui-disabled")},enable:function(){this.element.attr("disabled",false).parent().removeClass("ui-disabled")}})})(jQuery);
(function(a){a.widget("mobile.textinput",a.mobile.widget,{options:{theme:null},_create:function(){var f=this.element,c=this.options,g=c.theme;if(!g){g=this.element.closest("[class*='ui-bar-'],[class*='ui-body-']");g=g.length?/ui-(bar|body)-([a-z])/.exec(g.attr("class"))[2]:"c"}g=" ui-body-"+g;a("label[for="+f.attr("id")+"]").addClass("ui-input-text");f.addClass("ui-input-text ui-body-"+c.theme);var b=f;if(f.is('[type="search"],[data-type="search"]')){b=f.wrap('<div class="ui-input-search ui-shadow-inset ui-btn-corner-all ui-btn-shadow ui-icon-search'+
g+'"></div>').parent();var e=a('<a href="#" class="ui-input-clear" title="clear text">clear text</a>').click(function(){f.val("").focus();f.trigger("change");e.addClass("ui-input-clear-hidden");return false}).appendTo(b).buttonMarkup({icon:"delete",iconpos:"notext",corners:true,shadow:true});c=function(){f.val()==""?e.addClass("ui-input-clear-hidden"):e.removeClass("ui-input-clear-hidden")};c();f.keyup(c)}else f.addClass("ui-corner-all ui-shadow-inset"+g);f.focus(function(){b.addClass("ui-focus")}).blur(function(){b.removeClass("ui-focus")});
if(f.is("textarea")){var d=function(){var k=f[0].scrollHeight;f[0].clientHeight<k&&f.css({height:k+15})},i;f.keyup(function(){clearTimeout(i);i=setTimeout(d,100)})}},disable:function(){(this.element.attr("disabled",true).is('[type="search"],[data-type="search"]')?this.element.parent():this.element).addClass("ui-disabled")},enable:function(){(this.element.attr("disabled",false).is('[type="search"],[data-type="search"]')?this.element.parent():this.element).removeClass("ui-disabled")}})})(jQuery);
(function(a){a.widget("mobile.selectmenu",a.mobile.widget,{options:{theme:null,disabled:false,icon:"arrow-d",iconpos:"right",inline:null,corners:true,shadow:true,iconshadow:true,menuPageTheme:"b",overlayTheme:"a",hidePlaceholderMenuItems:true},_create:function(){var f=this,c=this.options,g=this.element.attr("tabindex","-1").wrap("<div class='ui-select'>"),b=g.attr("id"),e=a("label[for="+b+"]").addClass("ui-select"),d=b+"-button",i=b+"-menu",k=g.closest(".ui-page"),l=a("<a>",{href:"#",role:"button",
id:d,"aria-haspopup":"true","aria-owns":i}).text(a(g[0].options.item(g[0].selectedIndex)).text()).insertBefore(g).buttonMarkup({theme:c.theme,icon:c.icon,iconpos:c.iconpos,inline:c.inline,corners:c.corners,shadow:c.shadow,iconshadow:c.iconshadow}),h=/ui-btn-up-([a-z])/.exec(l.attr("class"))[1],m=a("<div data-role='dialog' data-theme='"+c.menuPageTheme+"'><div data-role='header'><div class='ui-title'>"+e.text()+"</div></div><div data-role='content'></div></div>").appendTo(a.mobile.pageContainer).page(),
n=m.find(".ui-content"),j=a("<div>",{"class":"ui-selectmenu-screen ui-screen-hidden"}).appendTo(k);c=a("<div>",{"class":"ui-selectmenu ui-selectmenu-hidden ui-overlay-shadow ui-corner-all pop ui-body-"+c.overlayTheme}).insertAfter(j);var o=a("<ul>",{"class":"ui-selectmenu-list",id:i,role:"listbox","aria-labelledby":d,"data-theme":h}).appendTo(c);a.extend(f,{select:g,selectID:b,label:e,buttonId:d,menuId:i,thisPage:k,button:l,menuPage:m,menuPageContent:n,screen:j,listbox:c,list:o,menuType:void 0});
f.refresh();this.options.disabled&&this.disable();g.change(function(){f.refresh()}).focus(function(){a(this).blur();l.focus()});l.bind(a.support.touch?"touchstart":"click",function(p){f.open();p.preventDefault()});o.delegate("li:not(.ui-disabled, .ui-li-divider)","click",function(p){var q=o.find("li:not(.ui-li-divider)").index(this),s=g[0].selectedIndex;g[0].selectedIndex=q;q!==s&&g.trigger("change");f.refresh();f.close();p.preventDefault()});j.click(function(p){f.close();p.preventDefault()})},_buildList:function(){var f=
this,c=[],g=this.options;f.list.empty().filter(".ui-listview").listview("destroy");f.select.find("option").each(function(){var b=a(this).parent();if(b.is("optgroup")){b=b.attr("label");if(a.inArray(b,c)===-1){a('<li data-role="list-divider"></li>').text(b).appendTo(f.list);c.push(b)}}b=a("<a>",{role:"option",href:"#",text:a(this).text()});var e=a("<li>",{"data-icon":"checkbox-on"});this.disabled&&e.addClass("ui-disabled").attr("aria-disabled",true);if(g.hidePlaceholderMenuItems)if(!this.getAttribute("value")||
a(this).text().length==0||a(this).data("placeholder"))e.addClass("ui-selectmenu-placeholder");e.append(b).appendTo(f.list)});f.list.listview()},refresh:function(f){var c=this.element,g=c[0].selectedIndex;if(f||c[0].options.length>this.list.find("li").length)this._buildList();this.button.find(".ui-btn-text").text(a(c[0].options.item(g)).text());this.list.find("li:not(.ui-li-divider)").removeClass(a.mobile.activeBtnClass).attr("aria-selected",false).eq(g).addClass(a.mobile.activeBtnClass).find("a").attr("aria-selected",
true)},open:function(){function f(){c.list.find(".ui-btn-active").focus()}if(!this.options.disabled){var c=this,g=c.list.outerHeight();c.list.outerWidth();var b=a(window).scrollTop(),e=c.button.offset().top,d=window.innerHeight;c.button.addClass(a.mobile.activeBtnClass);if(g>d-80||!a.support.scrollTop){b==0&&e>d&&c.thisPage.one("pagehide",function(){a(this).data("lastScroll",e)});c.menuPage.one("pageshow",f);c.menuType="page";c.menuPageContent.append(c.list);a.mobile.changePage(c.menuPage,"pop",false,
false)}else{c.menuType="overlay";c.screen.height(a(document).height()).removeClass("ui-screen-hidden");c.listbox.append(c.list).removeClass("ui-selectmenu-hidden").position({my:"center center",at:"center center",of:c.button,collision:"fit"}).addClass("in");f()}}},close:function(){function f(){setTimeout(function(){c.button.focus();c.button.removeClass(a.mobile.activeBtnClass)},40);c.listbox.removeAttr("style").append(c.list)}if(!this.options.disabled){var c=this;if(c.menuType=="page"){a.mobile.changePage([c.menuPage,
c.thisPage],"pop",true,false);c.menuPage.one("pagehide",function(){f()})}else{c.screen.addClass("ui-screen-hidden");c.listbox.addClass("ui-selectmenu-hidden").removeAttr("style").removeClass("in");f()}}},disable:function(){this.element.attr("disabled",true);this.button.addClass("ui-disabled").attr("aria-disabled",true);return this._setOption("disabled",true)},enable:function(){this.element.attr("disabled",false);this.button.removeClass("ui-disabled").attr("aria-disabled",false);return this._setOption("disabled",
false)}})})(jQuery);
(function(a){a.fn.buttonMarkup=function(c){return this.each(function(){var g=a(this),b=a.extend({},a.fn.buttonMarkup.defaults,g.data(),c),e,d="ui-btn-inner",i;f&&f();if(!b.theme){e=g.closest("[class*='ui-bar-'],[class*='ui-body-']");b.theme=e.length?/ui-(bar|body)-([a-z])/.exec(e.attr("class"))[2]:"c"}e="ui-btn ui-btn-up-"+b.theme;if(b.inline)e+=" ui-btn-inline";if(b.icon){b.icon="ui-icon-"+b.icon;b.iconpos=b.iconpos||"left";i="ui-icon "+b.icon;if(b.shadow)i+=" ui-icon-shadow"}if(b.iconpos){e+=" ui-btn-icon-"+
b.iconpos;b.iconpos=="notext"&&!g.attr("title")&&g.attr("title",g.text())}if(b.corners){e+=" ui-btn-corner-all";d+=" ui-btn-corner-all"}if(b.shadow)e+=" ui-shadow";g.attr("data-theme",b.theme).addClass(e);b=("<D class='"+d+"'><D class='ui-btn-text'></D>"+(b.icon?"<span class='"+i+"'></span>":"")+"</D>").replace(/D/g,b.wrapperEls);g.wrapInner(b)})};a.fn.buttonMarkup.defaults={corners:true,shadow:true,iconshadow:true,wrapperEls:"span"};var f=function(){a(".ui-btn:not(.ui-disabled)").live({mousedown:function(){var c=
a(this).attr("data-theme");a(this).removeClass("ui-btn-up-"+c).addClass("ui-btn-down-"+c)},mouseup:function(){var c=a(this).attr("data-theme");a(this).removeClass("ui-btn-down-"+c).addClass("ui-btn-up-"+c)},"mouseover focus":function(){var c=a(this).attr("data-theme");a(this).removeClass("ui-btn-up-"+c).addClass("ui-btn-hover-"+c)},"mouseout blur":function(){var c=a(this).attr("data-theme");a(this).removeClass("ui-btn-hover-"+c).addClass("ui-btn-up-"+c)}});f=null}})(jQuery);
(function(a){a.widget("mobile.button",a.mobile.widget,{options:{theme:null,icon:null,iconpos:null,inline:null,corners:true,shadow:true,iconshadow:true},_create:function(){var f=this.element,c=this.options;f.attr("type");f.addClass("ui-btn-hidden").attr("tabindex","-1");this.button=a("<a>",{href:"#",role:"button","aria-label":f.attr("type")}).text(f.text()||f.val()).insertBefore(f).click(function(){if(!c.disabled){f.click();return false}}).buttonMarkup({theme:c.theme,icon:c.icon,iconpos:c.iconpos,
inline:c.inline,corners:c.corners,shadow:c.shadow,iconshadow:c.iconshadow})},enable:function(){this.element.attr("disabled",false);this.button.removeClass("ui-disabled").attr("aria-disabled",false);return this._setOption("disabled",false)},disable:function(){this.element.attr("disabled",true);this.button.addClass("ui-disabled").attr("aria-disabled",true);return this._setOption("disabled",true)}})})(jQuery);
(function(a){a.widget("mobile.slider",a.mobile.widget,{options:{theme:null,trackTheme:null,disabled:false},_create:function(){var f=this,c=this.element,g=c.parents("[class*=ui-bar-],[class*=ui-body-]").eq(0);g=g.length?g.attr("class").match(/ui-(bar|body)-([a-z])/)[2]:"c";var b=this.options.theme?this.options.theme:g,e=this.options.trackTheme?this.options.trackTheme:g,d=c[0].nodeName.toLowerCase();g=d=="select"?"ui-slider-switch":"";var i=c.attr("id"),k=i+"-label";i=a("[for="+i+"]").attr("id",k);
var l=d=="input"?parseFloat(c.val()):c[0].selectedIndex,h=d=="input"?parseFloat(c.attr("min")):0,m=d=="input"?parseFloat(c.attr("max")):c.find("option").length-1,n=a('<div class="ui-slider '+g+" ui-btn-down-"+e+' ui-btn-corner-all" role="application"></div>'),j=a('<a href="#" class="ui-slider-handle"></a>').appendTo(n).buttonMarkup({corners:true,theme:b,shadow:true}).attr({role:"slider","aria-valuemin":h,"aria-valuemax":m,"aria-valuenow":l,"aria-valuetext":l,title:l,"aria-labelledby":k});a.extend(this,
{slider:n,handle:j,dragging:false,beforeStart:null});if(d=="select"){n.wrapInner('<div class="ui-slider-inneroffset"></div>');c.find("option");c.find("option").each(function(o){var p=o==0?"b":"a",q=o==0?"right":"left";o=o==0?" ui-btn-down-"+e:" ui-btn-active";a('<div class="ui-slider-labelbg ui-slider-labelbg-'+p+o+" ui-btn-corner-"+q+'"></div>').prependTo(n);a('<span class="ui-slider-label ui-slider-label-'+p+o+" ui-btn-corner-"+q+'" role="img">'+a(this).text()+"</span>").prependTo(j)})}i.addClass("ui-slider");
c.addClass(d=="input"?"ui-slider-input":"ui-slider-switch").keyup(function(){f.refresh(a(this).val())});a(document).bind(a.support.touch?"touchmove":"mousemove",function(o){if(f.dragging){f.refresh(o);return false}});n.bind(a.support.touch?"touchstart":"mousedown",function(o){f.dragging=true;if(d==="select")f.beforeStart=c[0].selectedIndex;f.refresh(o);return false});n.add(document).bind(a.support.touch?"touchend":"mouseup",function(){if(f.dragging){f.dragging=false;if(d==="select"){if(f.beforeStart===
c[0].selectedIndex)f.refresh(f.beforeStart===0?1:0);var o=d==="input"?parseFloat(c.val()):c[0].selectedIndex;o=Math.round(o/(m-h)*100);j.addClass("ui-slider-handle-snapping").css("left",o+"%").animationComplete(function(){j.removeClass("ui-slider-handle-snapping")})}return false}});n.insertAfter(c);j.bind("click",function(){return false});this.refresh()},refresh:function(f){if(!this.options.disabled){var c=this.element,g=c[0].nodeName.toLowerCase(),b=g==="input"?parseFloat(c.attr("min")):0,e=g===
"input"?parseFloat(c.attr("max")):c.find("option").length-1;if(typeof f==="object"){f=f.originalEvent.touches?f.originalEvent.touches[0]:f;if(!this.dragging||f.pageX<this.slider.offset().left-8||f.pageX>this.slider.offset().left+this.slider.width()+8)return;f=Math.round((f.pageX-this.slider.offset().left)/this.slider.width()*100)}else{if(f==null)f=g==="input"?parseFloat(c.val()):c[0].selectedIndex;f=(parseFloat(f)-b)/(e-b)*100}if(!isNaN(f)){if(f<0)f=0;if(f>100)f=100;var d=Math.round(f/100*(e-b))+
b;if(d<b)d=b;if(d>e)d=e;this.handle.css("left",f+"%");this.handle.attr({"aria-valuenow":g==="input"?d:c.find("option").eq(d).attr("value"),"aria-valuetext":g==="input"?d:c.find("option").eq(d).text(),title:d});if(g==="select")d===0?this.slider.addClass("ui-slider-switch-a").removeClass("ui-slider-switch-b"):this.slider.addClass("ui-slider-switch-b").removeClass("ui-slider-switch-a");if(g==="input")c.val(d);else c[0].selectedIndex=d;c.trigger("change")}}},enable:function(){this.element.attr("disabled",
false);this.slider.removeClass("ui-disabled").attr("aria-disabled",false);return this._setOption("disabled",false)},disable:function(){this.element.attr("disabled",true);this.slider.addClass("ui-disabled").attr("aria-disabled",true);return this._setOption("disabled",true)}})})(jQuery);
(function(a){a.widget("mobile.collapsible",a.mobile.widget,{options:{expandCueText:" click to expand contents",collapseCueText:" click to collapse contents",collapsed:false,heading:">:header,>legend",theme:null,iconTheme:"d"},_create:function(){var f=this.element,c=this.options,g=f.addClass("ui-collapsible-contain"),b=f.find(c.heading).eq(0),e=g.wrapInner('<div class="ui-collapsible-content"></div>').find(".ui-collapsible-content");f=f.closest('[data-role="collapsible-set"]').addClass("ui-collapsible-set");
if(b.is("legend")){b=a('<div role="heading">'+b.html()+"</div>").insertBefore(b);b.next().remove()}b.insertBefore(e);b.addClass("ui-collapsible-heading").append('<span class="ui-collapsible-heading-status"></span>').wrapInner('<a href="#" class="ui-collapsible-heading-toggle"></a>').find("a:eq(0)").buttonMarkup({shadow:!!!f.length,corners:false,iconPos:"left",icon:"plus",theme:c.theme}).find(".ui-icon").removeAttr("class").buttonMarkup({shadow:true,corners:true,iconPos:"notext",icon:"plus",theme:c.iconTheme});
if(f.length)g.data("collapsible-last")&&b.find("a:eq(0), .ui-btn-inner").addClass("ui-corner-bottom");else b.find("a:eq(0)").addClass("ui-corner-all").find(".ui-btn-inner").addClass("ui-corner-all");g.bind("collapse",function(d){if(!d.isDefaultPrevented()){d.preventDefault();b.addClass("ui-collapsible-heading-collapsed").find(".ui-collapsible-heading-status").text(c.expandCueText);b.find(".ui-icon").removeClass("ui-icon-minus").addClass("ui-icon-plus");e.addClass("ui-collapsible-content-collapsed").attr("aria-hidden",
true);g.data("collapsible-last")&&b.find("a:eq(0), .ui-btn-inner").addClass("ui-corner-bottom")}}).bind("expand",function(d){if(!d.isDefaultPrevented()){d.preventDefault();b.removeClass("ui-collapsible-heading-collapsed").find(".ui-collapsible-heading-status").text(c.collapseCueText);b.find(".ui-icon").removeClass("ui-icon-plus").addClass("ui-icon-minus");e.removeClass("ui-collapsible-content-collapsed").attr("aria-hidden",false);g.data("collapsible-last")&&b.find("a:eq(0), .ui-btn-inner").removeClass("ui-corner-bottom")}}).trigger(c.collapsed?
"collapse":"expand");if(f.length&&!f.data("collapsiblebound")){f.data("collapsiblebound",true).bind("expand",function(d){a(this).find(".ui-collapsible-contain").not(a(d.target).closest(".ui-collapsible-contain")).not("> .ui-collapsible-contain .ui-collapsible-contain").trigger("collapse")});f=f.find("[data-role=collapsible]");f.first().find("a:eq(0)").addClass("ui-corner-top").find(".ui-btn-inner").addClass("ui-corner-top");f.last().data("collapsible-last",true)}b.bind(a.support.touch?"touchstart":
"click",function(){b.is(".ui-collapsible-heading-collapsed")?g.trigger("expand"):g.trigger("collapse");return false})}})})(jQuery);
(function(a){a.fn.controlgroup=function(f){return a(this).each(function(){function c(d){d.removeClass("ui-btn-corner-all ui-shadow").eq(0).addClass(e[0]).end().filter(":last").addClass(e[1]).addClass("ui-controlgroup-last")}var g=a.extend({direction:a(this).data("type")||"vertical",shadow:false},f),b=a(this).find(">legend"),e=g.direction=="horizontal"?["ui-corner-left","ui-corner-right"]:["ui-corner-top","ui-corner-bottom"];a(this).find("input:eq(0)").attr("type");if(b.length){a(this).wrapInner('<div class="ui-controlgroup-controls"></div>');
a('<div role="heading" class="ui-controlgroup-label">'+b.html()+"</div>").insertBefore(a(this).children(0));b.remove()}a(this).addClass("ui-corner-all ui-controlgroup ui-controlgroup-"+g.direction);c(a(this).find(".ui-btn"));c(a(this).find(".ui-btn-inner"));g.shadow&&a(this).addClass("ui-shadow")})}})(jQuery);(function(a){a.fn.fieldcontain=function(){return a(this).addClass("ui-field-contain ui-body ui-br")}})(jQuery);
(function(a){a.widget("mobile.listview",a.mobile.widget,{options:{theme:"c",countTheme:"c",headerTheme:"b",dividerTheme:"b",splitIcon:"arrow-r",splitTheme:"b",inset:false},_create:function(){var f=this.element,c=this.options;f.addClass("ui-listview").attr("role","listbox");c.inset&&f.addClass("ui-listview-inset ui-corner-all ui-shadow");f.delegate(".ui-li","focusin",function(){a(this).attr("tabindex","0")});this._itemApply(f,f);this.refresh(true);f.keydown(function(g){var b=a(g.target),e=b.closest("li");
switch(g.keyCode){case 38:g=e.prev();if(g.length){b.blur().attr("tabindex","-1");g.find("a").first().focus()}return false;case 40:g=e.next();if(g.length){b.blur().attr("tabindex","-1");g.find("a").first().focus()}return false;case 39:g=e.find("a.ui-li-link-alt");if(g.length){b.blur();g.first().focus()}return false;case 37:g=e.find("a.ui-link-inherit");if(g.length){b.blur();g.first().focus()}return false;case 13:case 32:b.trigger("click");return false}});f.delegate("li","click",function(g){if(!a(g.target).closest("a").length){a(this).find("a").first().trigger("click");
return false}})},_itemApply:function(f,c){c.find(".ui-li-count").addClass("ui-btn-up-"+(f.data("counttheme")||this.options.countTheme)+" ui-btn-corner-all");c.find("h1, h2, h3, h4, h5, h6").addClass("ui-li-heading");c.find("p, dl").addClass("ui-li-desc");c.find("img").addClass("ui-li-thumb").each(function(){a(this).closest("li").addClass(a(this).is(".ui-li-icon")?"ui-li-has-icon":"ui-li-has-thumb")});var g=c.find(".ui-li-aside");g.length&&g.each(function(b,e){a(e).prependTo(a(e).parent())});a.support.cssPseudoElement||
a.nodeName(c[0],"ol")},_removeCorners:function(f){f.add(f.find(".ui-btn-inner, .ui-li-link-alt, .ui-li-thumb")).removeClass("ui-corner-top ui-corner-bottom ui-corner-br ui-corner-bl ui-corner-tr ui-corner-tl")},refresh:function(f){this._createSubPages();var c=this.options,g=this.element,b=this,e=g.data("dividertheme")||c.dividerTheme,d=g.children("li"),i=a.support.cssPseudoElement||!a.nodeName(g[0],"ol")?0:1;i&&g.find(".ui-li-dec").remove();d.attr({role:"option",tabindex:"-1"});d.first().attr("tabindex",
"0");d.each(function(k){var l=a(this),h="ui-li";if(!(!f&&l.hasClass("ui-li"))){var m=l.find("a");if(m.length){l.buttonMarkup({wrapperEls:"div",shadow:false,corners:false,iconpos:"right",icon:m.length>1?false:l.data("icon")||"arrow-r",theme:c.theme});m.first().addClass("ui-link-inherit");if(m.length>1){h+=" ui-li-has-alt";m=m.last();var n=g.data("splittheme")||m.data("theme")||c.splitTheme;m.attr("title",m.text()).addClass("ui-li-link-alt").empty().buttonMarkup({shadow:false,corners:false,theme:c.theme,
icon:false,iconpos:false}).find(".ui-btn-inner").append(a("<span>").buttonMarkup({shadow:true,corners:true,theme:n,iconpos:"notext",icon:g.data("spliticon")||m.data("icon")||c.splitIcon}))}}else if(l.data("role")==="list-divider"){h+=" ui-li-divider ui-btn ui-bar-"+e;l.attr("role","heading");if(i)i=1}else h+=" ui-li-static ui-btn-up-"+c.theme;if(c.inset)if(k===0){h+=" ui-corner-top";l.add(l.find(".ui-btn-inner")).find(".ui-li-link-alt").addClass("ui-corner-tr").end().find(".ui-li-thumb").addClass("ui-corner-tl");
l.next().next().length&&b._removeCorners(l.next())}else if(k===d.length-1){h+=" ui-corner-bottom";l.add(l.find(".ui-btn-inner")).find(".ui-li-link-alt").addClass("ui-corner-br").end().find(".ui-li-thumb").addClass("ui-corner-bl");l.prev().prev().length&&b._removeCorners(l.prev())}i&&h.indexOf("ui-li-divider")<0&&l.find(".ui-link-inherit").first().addClass("ui-li-jsnumbering").prepend("<span class='ui-li-dec'>"+i++ +". </span>");l.addClass(h);f||b._itemApply(g,l)}})},_idStringEscape:function(f){return f.replace(/[^a-zA-Z0-9]/g,
"-")},_createSubPages:function(){var f=this.element,c=f.closest(".ui-page"),g=c.attr("id"),b=this.options,e=this,d=c.find("[data-role='footer']").data("id");a(f.find("ul, ol").toArray().reverse()).each(function(i){var k=a(this),l=k.parent(),h=l.contents()[0].nodeValue.split("\n")[0];i=g+"&"+a.mobile.subPageUrlKey+"="+e._idStringEscape(h+" "+i);var m=k.data("theme")||b.theme,n=k.data("counttheme")||f.data("counttheme")||b.countTheme;k.wrap("<div data-role='page'><div data-role='content'></div></div>").parent().before("<div data-role='header' data-theme='"+
b.headerTheme+"'><div class='ui-title'>"+h+"</div></div>").after(d?a("<div>",{"data-role":"footer","data-id":d,"class":"ui-footer-duplicate"}):"").parent().attr({id:i,"data-theme":m,"data-count-theme":n}).appendTo(a.mobile.pageContainer).page();l.html("<a href='#"+i+"'>"+h+"</a>")}).listview()}})})(jQuery);
(function(a){a.mobile.listview.prototype.options.filter=false;a("[data-role='listview']").live("listviewcreate",function(){var f=a(this);if(f.data("listview").options.filter){var c=a("<form>",{"class":"ui-listview-filter ui-bar-c",role:"search"});a("<input>",{placeholder:"Filter results...","data-type":"search"}).bind("keyup change",function(){var g=this.value.toLowerCase();f.children().show();g&&f.children().filter(function(){return a(this).text().toLowerCase().indexOf(g)===-1}).hide()}).appendTo(c).textinput();
c.insertBefore(f)}})})(jQuery);
(function(a,f){a.widget("mobile.dialog",a.mobile.widget,{options:{},_create:function(){var c=this,g=c.element,b=a.mobile.activePage,e=a('<a href="#" data-icon="delete" data-iconpos="notext">Close</a>');g.delegate("a, form","click submit",function(d){if(d.type=="click"&&(a(d.target).closest("[data-back]")[0]||this==e[0])){c.close();return false}a.mobile.activePage=c.element});this.element.bind("pageshow",function(){return false}).attr("role","dialog").addClass("ui-page ui-dialog ui-body-a").find("[data-role=header]").addClass("ui-corner-top ui-overlay-shadow").prepend(e).end().find('.ui-content:not([class*="ui-body-"])').addClass("ui-body-c").end().find(".ui-content,[data-role=footer]").last().addClass("ui-corner-bottom ui-overlay-shadow");a(window).bind("hashchange",
function(){if(g.is(".ui-page-active")){c.close();g.bind("pagehide",function(){a.mobile.updateHash(b.attr("id"),true)})}})},close:function(){a.mobile.changePage([this.element,a.mobile.activePage],f,true,true)}})})(jQuery);
(function(a,f){a.widget("mobile.navbar",a.mobile.widget,{options:{iconpos:"top",grid:null},_create:function(){var c=this.element,g=c.find("a"),b=g.filter("[data-icon]").length?this.options.iconpos:f;c.addClass("ui-navbar").attr("role","navigation").find("ul").grid({grid:this.options.grid});b||c.addClass("ui-navbar-noicons");g.buttonMarkup({corners:false,shadow:false,iconpos:b});c.delegate("a","click",function(){g.removeClass("ui-btn-active")})}})})(jQuery);
(function(a){a.fn.grid=function(f){return a(this).each(function(){var c=a.extend({grid:null},f),g=a(this).children(),b={a:2,b:3,c:4,d:5};c=c.grid;if(!c)if(g.length<=5)for(var e in b){if(b[e]==g.length)c=e}else c="a";b=b[c];a(this).addClass("ui-grid-"+c);g.filter(":nth-child("+b+"n+1)").addClass("ui-block-a");g.filter(":nth-child("+b+"n+2)").addClass("ui-block-b");b>2&&g.filter(":nth-child(3n+3)").addClass("ui-block-c");b>3&&g.filter(":nth-child(4n+4)").addClass("ui-block-d");b>4&&g.filter(":nth-child(5n+5)").addClass("ui-block-e")})}})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment