]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/js/tinymce/plugins/wpgallery/editor_plugin.js
WordPress 3.8
[autoinstalls/wordpress.git] / wp-includes / js / tinymce / plugins / wpgallery / editor_plugin.js
index e924e3dc248de0ef94aa9f089d3218ca068668b4..cd426627b295905a57af652d4d11c289bc94483d 100644 (file)
@@ -1 +1 @@
-(function(){tinymce.create("tinymce.plugins.wpGallery",{init:function(a,b){var c=this;c.url=b;c._createButtons();a.addCommand("WP_Gallery",function(){var h=a.selection.getNode(),f,e=tinymce.DOM.getViewPort(),g=e.h-80,d=(640<e.w)?640:e.w;if(h.nodeName!="IMG"){return}if(a.dom.getAttrib(h,"class").indexOf("wpGallery")==-1){return}f=tinymce.DOM.get("post_ID").value;tb_show("",tinymce.documentBaseURL+"/media-upload.php?post_id="+f+"&tab=gallery&TB_iframe=true&width="+d+"&height="+g);tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")});a.onInit.add(function(d){tinymce.dom.Event.add(d.getWin(),"scroll",function(f){d.plugins.wpgallery.hideButtons()})});a.onBeforeExecCommand.add(function(d,f,e,g){d.plugins.wpgallery.hideButtons()});a.onSaveContent.add(function(d,e){d.plugins.wpgallery.hideButtons()});a.onMouseUp.add(function(d,f){if(tinymce.isOpera){if(f.target.nodeName=="IMG"){d.plugins.wpgallery.showButtons(f.target)}}});a.onMouseDown.add(function(d,f){if(tinymce.isOpera||f.target.nodeName!="IMG"){c.hideButtons();return}d.plugins.wpgallery.showButtons(f.target)});a.onBeforeSetContent.add(function(d,e){e.content=c._do_gallery(e.content)});a.onPostProcess.add(function(d,e){if(e.get){e.content=c._get_gallery(e.content)}})},_do_gallery:function(a){return a.replace(/\[gallery([^\]]*)\]/g,function(d,c){return'<img src="'+tinymce.baseURL+'/plugins/wpgallery/img/t.gif" class="wpGallery mceItem" title="gallery'+tinymce.DOM.encode(c)+'" />'})},_get_gallery:function(b){function a(c,d){d=new RegExp(d+'="([^"]+)"',"g").exec(c);return d?tinymce.DOM.decode(d[1]):""}return b.replace(/(?:<p[^>]*>)*(<img[^>]+>)(?:<\/p>)*/g,function(e,d){var c=a(d,"class");if(c.indexOf("wpGallery")!=-1){return"<p>["+tinymce.trim(a(d,"title"))+"]</p>"}return e})},showButtons:function(d){var i=this,e=tinyMCE.activeEditor,g,f,a,h=tinymce.DOM,c,b;if(e.dom.getAttrib(d,"class").indexOf("wpGallery")==-1){return}a=e.dom.getViewPort(e.getWin());g=h.getPos(e.getContentAreaContainer());f=e.dom.getPos(d);c=Math.max(f.x-a.x,0)+g.x;b=Math.max(f.y-a.y,0)+g.y;h.setStyles("wp_gallerybtns",{top:b+5+"px",left:c+5+"px",display:"block"});i.btnsTout=window.setTimeout(function(){e.plugins.wpgallery.hideButtons()},5000)},hideButtons:function(){if(tinymce.DOM.isHidden("wp_gallerybtns")){return}tinymce.DOM.hide("wp_gallerybtns");window.clearTimeout(this.btnsTout)},_createButtons:function(){var d=this,b=tinyMCE.activeEditor,e=tinymce.DOM,c,f,a;e.remove("wp_gallerybtns");c=e.add(document.body,"div",{id:"wp_gallerybtns",style:"display:none;"});f=e.add("wp_gallerybtns","img",{src:d.url+"/img/edit.png",id:"wp_editgallery",width:"24",height:"24",title:b.getLang("wordpress.editgallery")});f.onmousedown=function(h){var g=tinyMCE.activeEditor;g.windowManager.bookmark=g.selection.getBookmark("simple");g.execCommand("WP_Gallery");this.parentNode.style.display="none"};a=e.add("wp_gallerybtns","img",{src:d.url+"/img/delete.png",id:"wp_delgallery",width:"24",height:"24",title:b.getLang("wordpress.delgallery")});a.onmousedown=function(i){var g=tinyMCE.activeEditor,h=g.selection.getNode();if(h.nodeName=="IMG"&&g.dom.getAttrib(h,"class").indexOf("wpGallery")!=-1){g.dom.remove(h);this.parentNode.style.display="none";g.execCommand("mceRepaint");return false}}},getInfo:function(){return{longname:"Gallery Settings",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}});tinymce.PluginManager.add("wpgallery",tinymce.plugins.wpGallery)})();
\ No newline at end of file
+!function(){tinymce.create("tinymce.plugins.wpGallery",{init:function(a,b){var c=this;c.url=b,c.editor=a,c._createButtons(),a.addCommand("WP_Gallery",function(){tinymce.isIE&&a.selection.moveToBookmark(a.wpGalleryBookmark);var b,c=a.selection.getNode(),d=wp.media.gallery;"undefined"!=typeof wp&&wp.media&&wp.media.gallery&&"IMG"==c.nodeName&&-1!=a.dom.getAttrib(c,"class").indexOf("wp-gallery")&&(b=d.edit("["+a.dom.getAttrib(c,"title")+"]"),b.state("gallery-edit").on("update",function(b){var e=d.shortcode(b).string().slice(1,-1);a.dom.setAttrib(c,"title",e)}))}),a.onInit.add(function(a){"ontouchstart"in window&&a.dom.events.add(a.getBody(),"touchstart",function(b){var c=b.target;"IMG"==c.nodeName&&a.dom.hasClass(c,"wp-gallery")&&(a.selection.select(c),a.dom.events.cancel(b),a.plugins.wordpress._hideButtons(),a.plugins.wordpress._showButtons(c,"wp_gallerybtns"))})}),a.onMouseDown.add(function(a,b){"IMG"==b.target.nodeName&&a.dom.hasClass(b.target,"wp-gallery")&&(a.plugins.wordpress._hideButtons(),a.plugins.wordpress._showButtons(b.target,"wp_gallerybtns"))}),a.onBeforeSetContent.add(function(a,b){b.content=c._do_gallery(b.content)}),a.onPostProcess.add(function(a,b){b.get&&(b.content=c._get_gallery(b.content))})},_do_gallery:function(a){return a.replace(/\[gallery([^\]]*)\]/g,function(a,b){return'<img src="'+tinymce.baseURL+'/plugins/wpgallery/img/t.gif" class="wp-gallery mceItem" title="gallery'+tinymce.DOM.encode(b)+'" />'})},_get_gallery:function(a){function b(a,b){return b=new RegExp(b+'="([^"]+)"',"g").exec(a),b?tinymce.DOM.decode(b[1]):""}return a.replace(/(?:<p[^>]*>)*(<img[^>]+>)(?:<\/p>)*/g,function(a,c){var d=b(c,"class");return-1!=d.indexOf("wp-gallery")?"<p>["+tinymce.trim(b(c,"title"))+"]</p>":a})},_createButtons:function(){var a,b,c,d=this,e=tinymce.activeEditor,f=tinymce.DOM;f.get("wp_gallerybtns")||(c=window.devicePixelRatio&&window.devicePixelRatio>1||window.matchMedia&&window.matchMedia("(min-resolution:130dpi)").matches,f.add(document.body,"div",{id:"wp_gallerybtns",style:"display:none;"}),a=f.add("wp_gallerybtns","img",{src:c?d.url+"/img/edit-2x.png":d.url+"/img/edit.png",id:"wp_editgallery",width:"24",height:"24",title:e.getLang("wordpress.editgallery")}),tinymce.dom.Event.add(a,"mousedown",function(){var a=tinymce.activeEditor;a.wpGalleryBookmark=a.selection.getBookmark("simple"),a.execCommand("WP_Gallery"),a.plugins.wordpress._hideButtons()}),b=f.add("wp_gallerybtns","img",{src:c?d.url+"/img/delete-2x.png":d.url+"/img/delete.png",id:"wp_delgallery",width:"24",height:"24",title:e.getLang("wordpress.delgallery")}),tinymce.dom.Event.add(b,"mousedown",function(a){var b=tinymce.activeEditor,c=b.selection.getNode();"IMG"==c.nodeName&&b.dom.hasClass(c,"wp-gallery")&&(b.dom.remove(c),b.execCommand("mceRepaint"),b.dom.events.cancel(a)),b.plugins.wordpress._hideButtons()}))},getInfo:function(){return{longname:"Gallery Settings",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}}),tinymce.PluginManager.add("wpgallery",tinymce.plugins.wpGallery)}();
\ No newline at end of file