t},onadd:function(){vart=this,n=(this.parent(),this.find("iframe"));n.addClass("center"),n.bind("load",function(){t._adjustIframeForPreview(),t._loadCurrentPage(),e(this).removeClass("loading")}),e.browser.msie&&8===parseInt(e.browser.version,10)&&n.bind("readystatechange",function(e){"interactive"==n[0].readyState&&(t.getOrAppendFontFixStyleElement().removeAttr("disabled"),setTimeout(function(){t.getOrAppendFontFixStyleElement().attr("disabled","disabled")},0))}),this.append('<div class="cms-preview-overlay ui-widget-overlay-light"></div>'),this.find(".cms-preview-overlay").hide(),this.disablePreview(),this._super()},_supportsLocalStorage:function(){vare,t,n=newDate;try{return(e=window.localStorage).setItem(n,n),t=e.getItem(n)==n,e.removeItem(n),t&&e}catch(i){console.warn("localStorge is not available due to current browser / system settings.")}},onenable:function(){vart=e(".preview-mode-selector");t.removeClass("split-disabled"),t.find(".disabled-tooltip").hide()},ondisable:function(){vart=e(".preview-mode-selector");t.addClass("split-disabled"),t.find(".disabled-tooltip").show()},_block:function(){returnthis.addClass("blocked"),this.find(".cms-preview-overlay").show(),this},_unblock:function(){returnthis.removeClass("blocked"),this.find(".cms-preview-overlay").hide(),this},_initialiseFromContent:function(){vart,n;returne(".cms-previewable").length?(t=this.loadState("mode"),n=this.loadState("size"),this._moveNavigator(),t&&"content"==t||(this.enablePreview(),this._loadCurrentState()),this.redraw(),t&&this.changeMode(t),n&&this.changeSize(n)):this.disablePreview(),this},"from .cms-container":{onafterstatechange:function(e,t){t.xhr.getResponseHeader("X-ControllerURL")||this._initialiseFromContent()}},PendingURL:null,oncolumnvisibilitychanged:function(){vare=this.getPendingURL();e&&!this.is(".column-hidden")&&(this.setPendingURL(null),this._loadUrl(e),this._unblock())},"from .cms-container .cms-edit-form":{onaftersubmitform:function(){this._initialiseFromContent()}},_loadUrl:function(e){returnthis.find("iframe").addClass("loading").attr("src",e),this},_getNavigatorStates:function(){vart=e.map(this.getAllowedStates(),function(t){varn=e(".cms-preview-states .state-name[data-name="+t+"]");returnn.length?{name:t,url:n.attr("data-link"),active:n.is(":radio")?n.is(":checked"):n.is(":selected")}:null});returnt},_loadCurrentState:function(){if(!this.getIsPreviewEnabled())returnthis;vart=this._getNavigatorStates(),n=this.getCurrentStateName(),i=null;t&&(i=e.grep(t,function(e,t){returnn===e.name||!n&&e.active}));vars=null;returni[0]?s=i[0].url:t.length?(this.setCurrentStateName(t[0].name),s=t[0].url):this.setCurrentStateName(null),s+=(-1===s.indexOf("?")?"?":"&")+"CMSPreview=1",this.is(".column-hidden")?(this.setPendingURL(s),this._loadUrl("about:blank"),this._block()):(this.setPendingURL(null),s?(this._loadUrl(s),this._unblock()):this._block()),this},_moveNavigator:function(){vart=e(".cms-preview .cms-preview-controls"),n=e(".cms-edit-form .cms-navigator");n.length&&t.length?t.html(e(".cms-edit-form .cms-navigator").detach()):this._block()},_loadCurrentPage:function(){if(this.getIsPreviewEnabled()){vart;e(".cms-container");try{t=this.find("iframe")[0].contentDocument}catch(n){console.warn("Unable to access iframe, possible https mis-match")}if(t){vari=e(t).find("meta[name=x-page-id]").attr("content"),s=e(t).find("meta[name=x-cms-edit-link]").attr("content"),a=e(".cms-content");i&&a.find(":input[name=ID]").val()!=i&&e(".cms-container").entwine(".ss").loadPanel(s)}}},_adjustIframeForPreview:function(){vare,t=this.find("iframe")[0];if(t){try{e=t.contentDocument}catch(n){console.warn("Unable to access iframe, possible https mis-match")}if(e){for(vari=e.getElementsByTagName("A"),s=0;s<i.length;s++){vara=i[s].getAttribute("href");a&&a.match(/^http:\/\//)&&i[s].setAttribute("target","_blank")}varo=e.getElementById("SilverStripeNavigator");o&&(o.style.display="none");varr=e.getElementById("SilverStripeNavigatorMessage");r&&(r.style.display="none"),this.trigger("afterIframeAdjustedForPreview",[e])}}}}),e(".cms-