ttrss/lib/dijit/_editor/plugins/FullScreen.js

2 lines
6.3 KiB
JavaScript
Raw Permalink Normal View History

2012-08-14 14:59:10 +00:00
//>>built
define("dijit/_editor/plugins/FullScreen",["dojo/aspect","dojo/_base/declare","dojo/dom-class","dojo/dom-geometry","dojo/dom-style","dojo/i18n","dojo/keys","dojo/_base/lang","dojo/on","dojo/sniff","dojo/_base/window","dojo/window","../../focus","../_Plugin","../../form/ToggleButton","../../registry","dojo/i18n!../nls/commands"],function(_1,_2,_3,_4,_5,_6,_7,_8,on,_9,_a,_b,_c,_d,_e,_f){var _10=_2("dijit._editor.plugins.FullScreen",_d,{zIndex:500,_origState:null,_origiFrameState:null,_resizeHandle:null,isFullscreen:false,toggle:function(){this.button.set("checked",!this.button.get("checked"));},_initButton:function(){var _11=_6.getLocalization("dijit._editor","commands"),_12=this.editor;this.button=new _e({label:_11["fullScreen"],ownerDocument:_12.ownerDocument,dir:_12.dir,lang:_12.lang,showLabel:false,iconClass:this.iconClassPrefix+" "+this.iconClassPrefix+"FullScreen",tabIndex:"-1",onChange:_8.hitch(this,"_setFullScreen")});},setEditor:function(_13){this.editor=_13;this._initButton();this.editor.addKeyHandler(_7.F11,true,true,_8.hitch(this,function(e){this.toggle();e.stopPropagation();e.preventDefault();this.editor.defer("focus",250);return true;}));this.own(on(this.editor.domNode,"keydown",_8.hitch(this,"_containFocus")));},_containFocus:function(e){if(this.isFullscreen){var ed=this.editor;if(!ed.isTabIndent&&ed._fullscreen_oldOnKeyDown&&e.keyCode===_7.TAB){var f=_c.curNode;var avn=this._getAltViewNode();if(f==ed.iframe||(avn&&f===avn)){setTimeout(_8.hitch(this,function(){ed.toolbar.focus();}),10);}else{if(avn&&_5.get(ed.iframe,"display")==="none"){setTimeout(_8.hitch(this,function(){_c.focus(avn);}),10);}else{setTimeout(_8.hitch(this,function(){ed.focus();}),10);}}event.stopPropagation();event.preventDefault();}else{if(ed._fullscreen_oldOnKeyDown){ed._fullscreen_oldOnKeyDown(e);}}}},_resizeEditor:function(){var vp=_b.getBox(this.editor.ownerDocument);_4.setMarginBox(this.editor.domNode,{w:vp.w,h:vp.h});var _14=this.editor.getHeaderHeight();var _15=this.editor.getFooterHeight();var _16=_4.getPadBorderExtents(this.editor.domNode);var _17=_4.getPadBorderExtents(this.editor.iframe.parentNode);var _18=_4.getMarginExtents(this.editor.iframe.parentNode);var _19=vp.h-(_14+_16.h+_15);_4.setMarginBox(this.editor.iframe.parentNode,{h:_19,w:vp.w});_4.setMarginBox(this.editor.iframe,{h:_19-(_17.h+_18.h)});},_getAltViewNode:function(){},_setFullScreen:function(_1a){var ed=this.editor;var _1b=ed.ownerDocumentBody;var _1c=ed.domNode.parentNode;var vp=_b.getBox(ed.ownerDocument);this.isFullscreen=_1a;if(_1a){while(_1c&&_1c!==_1b){_3.add(_1c,"dijitForceStatic");_1c=_1c.parentNode;}this._editorResizeHolder=this.editor.resize;ed.resize=function(){};ed._fullscreen_oldOnKeyDown=ed.onKeyDown;ed.onKeyDown=_8.hitch(this,this._containFocus);this._origState={};this._origiFrameState={};var _1d=ed.domNode,_1e=_1d&&_1d.style||{};this._origState={width:_1e.width||"",height:_1e.height||"",top:_5.get(_1d,"top")||"",left:_5.get(_1d,"left")||"",position:_5.get(_1d,"position")||"static",marginBox:_4.getMarginBox(ed.domNode)};var _1f=ed.iframe,_20=_1f&&_1f.style||{};var bc=_5.get(ed.iframe,"backgroundColor");this._origiFrameState={backgroundColor:bc||"transparent",width:_20.width||"auto",height:_20.height||"auto",zIndex:_20.zIndex||""};_5.set(ed.domNode,{position:"absolute",top:"0px",left:"0px",zIndex:this.zIndex,width:vp.w+"px",height:vp.h+"px"});_5.set(ed.iframe,{height:"100%",width:"100%",zIndex:this.zIndex,backgroundColor:bc!=="transparent"&&bc!=="rgba(0, 0, 0, 0)"?bc:"white"});_5.set(ed.iframe.parentNode,{height:"95%",width:"100%"});if(_1b.style&&_1b.style.overflow){this._oldOverflow=_5.get(_1b,"overflow");}else{this._oldOverflow="";}if(_9("ie")&&!_9("quirks")){if(_1b.parentNode&&_1b.parentNode.style&&_1b.parentNode.style.overflow){this._oldBodyParentOverflow=_1b.parentNode.style.overflow;}else{try{this._oldBodyParentOverflow=_5.get(_1b.parentNode,"overflow");}catch(e){this._oldBodyParentOverflow="scroll";}}_5.set(_1b.parentNode,"overflow","hidden");}_5.set(_1b,"overflow","hidden");var _21=function(){var vp=_b.getBox(ed.ownerDocument);if("_prevW" in