(function(){"use strict";u8.Mobile.Page=function(e){e.page=this;this.element=e.document.body;var t=e.location.href;this.url=new u8.Base.Uri(t);u8.Base._Window.extend(e);u8.create("Application",document.body);this._createView()};u8.Mobile.Page.makeClass({name:"Page"});$.extend(u8.Mobile.Page.prototype,{navigate:function(e){if(typeof e=="string"){e={url:e}}var t=e.url;this.url=new u8.Base.Uri(t);return this._view.load(e)},confirm:function(){return $.Deferred().resolve().promise()},abort:function(){if(this._view){this._view.abort()}},busy:function(e){if(e){this.element.classList.add("loading")}else{this.element.classList.remove("loading")}},getView:function(){return this._view},widgets:function(){return _widgets},_createView:function(){this._view=new u8.Mobile.Widgets.View(this.element,{parent:this,view:"full",enableValidation:true});var e=this._onSizeChange.despam(500).bind(this);$(document).on("scroll.page",e);$(window).on("resize.page",e)},_onSizeChange:function(){$(this.element).widgets("create")},"View.onPreUpdate":function(e,t){if(e!=this._view){return}t.preventDefault=true;var i=$(e.element);var n=t.data;var a=document.implementation.createHTMLDocument("");a.documentElement.innerHTML=n;var r=$(a.head);var o=$(a.body);var s=o.attr("data-page");if(s){$("body").attr("data-page",s)}else{$("body").removeAttr("data-page")}var d=i.children("header"),l=o.find("header");if(l.length){if(d.length){d.widgets("dispose").replaceWith(l)}else{i.prepend(l)}}else{d.remove()}var u=i.children("footer"),h=o.find("footer");if(h.length){if(u.length){u.widgets("dispose").replaceWith(h)}else{i.append(h)}}else{u.remove()}var c=o.find(".u8-main");if(!c.length){c=o.children()}if(t.transition){c.addClass("u8-transition-in")}var f=i.find(".u8-main-box");if(!f.length){i.children("div").remove();f=$("<div class='u8-main-box'></div>").appendTo(i)}f.widgets("dispose").empty().append(c);$("html, body").scrollTop(0);var p=r.children("title");if(p.length){$("head > title").text(p.text())}}})})();