]> git.wh0rd.org - tt-rss.git/blobdiff - lib/dijit/_editor/plugins/Print.js
update dojo to 1.7.3
[tt-rss.git] / lib / dijit / _editor / plugins / Print.js
index 83cf0ddc743c5a48cc1f5d70e86c9762354aa3d6..7de192d52ea86c5b0f75d0f2b7ae8b7931f83f9e 100644 (file)
@@ -1,125 +1,2 @@
-/*
-       Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
-       Available via Academic Free License >= 2.1 OR the modified BSD license.
-       see: http://dojotoolkit.org/license for details
-*/
-
-
-if(!dojo._hasResource["dijit._editor.plugins.Print"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dijit._editor.plugins.Print"] = true;
-dojo.provide("dijit._editor.plugins.Print");
-dojo.require("dijit._editor._Plugin");
-dojo.require("dijit.form.Button");
-dojo.require("dojo.i18n");
-dojo.requireLocalization("dijit._editor", "commands", null, "ROOT,ar,ca,cs,da,de,el,es,fi,fr,he,hu,it,ja,kk,ko,nb,nl,pl,pt,pt-pt,ro,ru,sk,sl,sv,th,tr,zh,zh-tw");
-
-
-dojo.declare("dijit._editor.plugins.Print",dijit._editor._Plugin,{
-       // summary:
-       //              This plugin provides Print cabability to the editor.  When
-       //              clicked, the document in the editor frame will be printed.
-
-       _initButton: function(){
-               // summary:
-               //              Over-ride for creation of the Print button.
-               var strings = dojo.i18n.getLocalization("dijit._editor", "commands"),
-                       editor = this.editor;
-               this.button = new dijit.form.Button({
-                       label: strings["print"],
-                       dir: editor.dir,
-                       lang: editor.lang,
-                       showLabel: false,
-                       iconClass: this.iconClassPrefix + " " + this.iconClassPrefix + "Print",
-                       tabIndex: "-1",
-                       onClick: dojo.hitch(this, "_print")
-               });
-       },
-
-       setEditor: function(/*dijit.Editor*/ editor){
-               // summary:
-               //              Tell the plugin which Editor it is associated with.
-               // editor: Object
-               //              The editor object to attach the print capability to.
-               this.editor = editor;
-               this._initButton();
-
-               // Set up a check that we have a print function
-               // and disable button if we do not.
-               this.editor.onLoadDeferred.addCallback(
-                       dojo.hitch(this, function(){
-                               if(!this.editor.iframe.contentWindow["print"]){
-                                       this.button.set("disabled", true);
-                               }
-                       })
-               );
-       },
-
-       updateState: function(){
-               // summary:
-               //              Over-ride for button state control for disabled to work.
-               var disabled = this.get("disabled");
-               if(!this.editor.iframe.contentWindow["print"]){
-                       disabled = true;
-               }
-               this.button.set("disabled", disabled);
-       },
-
-       _print: function(){
-               // summary:
-               //              Function to trigger printing of the editor document
-               // tags:
-               //              private
-               var edFrame = this.editor.iframe;
-               if(edFrame.contentWindow["print"]){
-                       // IE requires the frame to be focused for
-                       // print to work, but since this is okay for all
-                       // no special casing.
-                       if(!dojo.isOpera && !dojo.isChrome){
-                               dijit.focus(edFrame);
-                               edFrame.contentWindow.print();
-                       }else{
-                               // Neither Opera nor Chrome 3 et you print single frames.
-                               // So, open a new 'window', print it, and close it.
-                               // Also, can't use size 0x0, have to use 1x1
-                               var edDoc = this.editor.document;
-                               var content = this.editor.get("value");
-                               content = "<html><head><meta http-equiv='Content-Type' " +
-                                       "content='text/html; charset='UTF-8'></head><body>" +
-                                       content + "</body></html>";
-                               var win = window.open("javascript: ''",
-                                       "",
-                                       "status=0,menubar=0,location=0,toolbar=0," +
-                                       "width=1,height=1,resizable=0,scrollbars=0");
-                               win.document.open();
-                               win.document.write(content);
-                               win.document.close();
-                               var styles = [];
-                               var styleNodes = edDoc.getElementsByTagName("style");
-                               if(styleNodes){
-                                       // Clone over any editor view styles, since we can't print the iframe
-                                       // directly.
-                                       var i;
-                                       for(i = 0; i < styleNodes.length; i++){
-                                               var style = styleNodes[i].innerHTML;
-                                               var sNode = win.document.createElement("style");
-                                               sNode.appendChild(win.document.createTextNode(style));
-                                               win.document.getElementsByTagName("head")[0].appendChild(sNode);
-                                       }
-                               }
-                               win.print();
-                               win.close();
-                       }
-               }
-       }
-});
-
-// Register this plugin.
-dojo.subscribe(dijit._scopeName + ".Editor.getPlugin",null,function(o){
-       if(o.plugin){ return; }
-       var name = o.args.name.toLowerCase();
-       if(name === "print"){
-               o.plugin = new dijit._editor.plugins.Print({command: "print"});
-       }
-});
-
-}
+//>>built
+define("dijit/_editor/plugins/Print",["dojo/_base/declare","dojo/i18n","dojo/_base/lang","dojo/_base/sniff","../../focus","../_Plugin","../../form/Button","dojo/i18n!../nls/commands"],function(_1,_2,_3,_4,_5,_6,_7){var _8=_1("dijit._editor.plugins.Print",_6,{_initButton:function(){var _9=_2.getLocalization("dijit._editor","commands"),_a=this.editor;this.button=new _7({label:_9["print"],dir:_a.dir,lang:_a.lang,showLabel:false,iconClass:this.iconClassPrefix+" "+this.iconClassPrefix+"Print",tabIndex:"-1",onClick:_3.hitch(this,"_print")});},setEditor:function(_b){this.editor=_b;this._initButton();this.editor.onLoadDeferred.addCallback(_3.hitch(this,function(){if(!this.editor.iframe.contentWindow["print"]){this.button.set("disabled",true);}}));},updateState:function(){var _c=this.get("disabled");if(!this.editor.iframe.contentWindow["print"]){_c=true;}this.button.set("disabled",_c);},_print:function(){var _d=this.editor.iframe;if(_d.contentWindow["print"]){if(!_4("opera")&&!_4("chrome")){_5.focus(_d);_d.contentWindow.print();}else{var _e=this.editor.document;var _f=this.editor.get("value");_f="<html><head><meta http-equiv='Content-Type' "+"content='text/html; charset='UTF-8'></head><body>"+_f+"</body></html>";var win=window.open("javascript: ''","","status=0,menubar=0,location=0,toolbar=0,"+"width=1,height=1,resizable=0,scrollbars=0");win.document.open();win.document.write(_f);win.document.close();var _10=_e.getElementsByTagName("style");if(_10){var i;for(i=0;i<_10.length;i++){var _11=_10[i].innerHTML;var _12=win.document.createElement("style");_12.appendChild(win.document.createTextNode(_11));win.document.getElementsByTagName("head")[0].appendChild(_12);}}win.print();win.close();}}}});_6.registry["print"]=function(){return new _8({command:"print"});};return _8;});
\ No newline at end of file