2017-01-27 22:16:59 -05:00
|
|
|
define(["jqmwidget"],function(){!function($,undefined){var props={animation:{},transition:{}},testElement=document.createElement("a"),vendorPrefixes=["","webkit-","moz-","o-"];$.each(["animation","transition"],function(i,test){var testName=0===i?test+"-name":test;$.each(vendorPrefixes,function(j,prefix){if(testElement.style[$.camelCase(prefix+testName)]!==undefined)return props[test].prefix=prefix,!1}),props[test].duration=$.camelCase(props[test].prefix+test+"-duration"),props[test].event=$.camelCase(props[test].prefix+test+"-end"),""===props[test].prefix&&(props[test].event=props[test].event.toLowerCase())}),$(testElement).remove(),$.fn.animationComplete=function(callback,type,fallbackTime){var timer,duration,that=this,eventBinding=function(){clearTimeout(timer),callback.apply(this,arguments)},animationType=type&&"animation"!==type?"transition":"animation";return fallbackTime===undefined&&($(this).context!==document&&(duration=3e3*parseFloat($(this).css(props[animationType].duration))),(0===duration||duration===undefined||isNaN(duration))&&(duration=$.fn.animationComplete.defaultDuration)),timer=setTimeout(function(){$(that).off(props[animationType].event,eventBinding),callback.apply(that)},duration),$(this).one(props[animationType].event,eventBinding)},$.fn.animationComplete.defaultDuration=1e3}(jQuery),function($,undefined){function fitSegmentInsideSegment(windowSize,segmentSize,offset,desired){var returnValue=desired;return returnValue=windowSize<segmentSize?offset+(windowSize-segmentSize)/2:Math.min(Math.max(offset,desired-segmentSize/2),offset+windowSize-segmentSize)}function getWindowCoordinates(theWindow){return{x:theWindow.scrollLeft(),y:theWindow.scrollTop(),cx:theWindow[0].innerWidth||theWindow.width(),cy:theWindow[0].innerHeight||theWindow.height()}}$.extend($.mobile,{browser:{}}),$.mobile.browser.oldIE=function(){var v=3,div=document.createElement("div"),a=div.all||[];do div.innerHTML="<!--[if gt IE "+ ++v+"]><br><![endif]-->";while(a[0]);return v>4?v:!v}(),$.widget("mobile.popup",{options:{wrapperClass:null,theme:null,overlayTheme:null,shadow:!0,corners:!0,transition:"none",positionTo:"origin",tolerance:null,closeLinkSelector:"a[data-rel='back']",closeLinkEvents:"click.popup",navigateEvents:"navigate.popup",closeEvents:"navigate.popup pagebeforechange.popup",dismissible:!0,enhanced:!1,history:!$.mobile.browser.oldIE},_handleDocumentVmousedown:function(theEvent){this._isOpen&&$.contains(this._ui.container[0],theEvent.target)&&this._ignoreResizeEvents()},_create:function(){var theElement=this.element,myId=theElement.attr("id"),currentOptions=this.options;currentOptions.history=currentOptions.history&&$.mobile.ajaxEnabled&&$.mobile.hashListeningEnabled,this._on(this.document,{mousedown:"_handleDocumentVmousedown"}),$.extend(this,{_scrollTop:0,_page:theElement.parents("div[data-role='page']"),_ui:null,_fallbackTransition:"",_currentTransition:!1,_prerequisites:null,_isOpen:!1,_tolerance:null,_resizeData:null,_ignoreResizeTo:0,_orientationchangeInProgress:!1}),0===this._page.length&&(this._page=$("body")),currentOptions.enhanced?this._ui={container:theElement.parent(),screen:theElement.parent().prev(),placeholder:$(this.document[0].getElementById(myId+"-placeholder"))}:(this._ui=this._enhance(theElement,myId),this._applyTransition(currentOptions.transition)),this._setTolerance(currentOptions.tolerance)._ui.focusElement=this._ui.container,this._on(this._ui.screen,{click:"_eatEventAndClose"}),this._on(this.window,{orientationchange:$.proxy(this,"_handleWindowOrientationchange"),resize:$.proxy(this,"_handleWindowResize")}),this._on(this.document,{focusin:"_handleDocumentFocusIn"})},_delay:function(handler,delay){function handlerProxy(){return("string"==typeof handler?instance[handler]:handler).apply(instance,arguments)}var instance=this;return setTimeout(handlerProxy,delay||0)},_enhance:function(theElement,myId){var currentOptions=this.options,wrapperClass=currentOptions.wrapperClass,ui={screen:$("<div class='ui-screen-hidden ui-popup-screen "+this._themeClassFromOption("ui-overlay-",currentOptions.overlayTheme)+"
|