X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/9c40b4d36daed9e28e48a5fe9205c32557195a4b..6d3aa5fe58b2f91735fe04e94a2c12b7dd9adb09:/wp-includes/js/tinymce/plugins/wpgallery/editor_plugin.js diff --git a/wp-includes/js/tinymce/plugins/wpgallery/editor_plugin.js b/wp-includes/js/tinymce/plugins/wpgallery/editor_plugin.js index e924e3dc..cd426627 100644 --- a/wp-includes/js/tinymce/plugins/wpgallery/editor_plugin.js +++ b/wp-includes/js/tinymce/plugins/wpgallery/editor_plugin.js @@ -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'})},_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>)*/g,function(e,d){var c=a(d,"class");if(c.indexOf("wpGallery")!=-1){return"

["+tinymce.trim(a(d,"title"))+"]

"}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''})},_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>)*/g,function(a,c){var d=b(c,"class");return-1!=d.indexOf("wp-gallery")?"

["+tinymce.trim(b(c,"title"))+"]

":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