Minify wplink js. see #11420
git-svn-id: https://develop.svn.wordpress.org/trunk@16397 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
8de3626c6e
commit
4a3b49bb5d
|
@ -1 +1 @@
|
|||
(function(a){a.widget("wp.wpTabs",{options:{},_create:function(){var b=this,d=this.element,c=d.children();this.active=c.filter(".wp-tab-active");c.each(function(){var e=b._getPanel(a(this));if(b.active[0]==this){e.show()}else{e.hide()}});d.delegate("li","click.wpTabs",function(g){var f=a(this);g.preventDefault();b._getPanel(b.active).hide();b.active.removeClass("wp-tab-active");b._trigger("hide",g,b.widget());b.active=f.addClass("wp-tab-active");b._getPanel(b.active).show();b._trigger("show",g,b.widget())})},widget:function(){return{ul:this.element,tab:this.active,panel:this._getPanel(this.active)}},_setPanel:function(c){var b=a("#"+c.children(".wp-tab-for-id").val());c.data("wp-tab-panel",b);return b},_getPanel:function(c){var b=c.data("wp-tab-panel");return(!b||!b.length)?this._setPanel(c):b}});a(function(){a(".wp-tab-bar").wpTabs()})})(jQuery);(function(d){var a={},c,f,b,e={init:function(){var i,h,g;b=tinyMCEPopup.editor;a.title=d("#link-title-field");a.openInNewTab=d("#link-target-checkbox");c=d(".link-panel");f=d(".link-panel-active");d("#link-panel-tab-bar").wpTabs({show:function(k,j){f=j.panel;f.addClass("link-panel-active");e.maybeLoadPanel()},hide:function(k,j){f.removeClass("link-panel-active")}});c.each(function(){var j=this.id.replace(/^link-panel-id-/,""),k=j.split("-");d(this).data("link-type",{full:j,type:k[0],name:k[1]||""})});d("#wp-update").click(e.update);d("#wp-cancel").click(function(){tinyMCEPopup.close()});d(".link-panel .wp-tab-bar").wpTabs("option","show",e.maybeLoadPanel);d(".link-panel .wp-tab-panel").delegate("li","click",e.selectInternalLink);d(".wp-tab-panel-pagelinks").delegate("a","click",e.selectPageLink);d(".link-panel .link-search-field").keyup(e.searchInternalLinks);f.find("input.url-field").focus();i=b.dom.getParent(b.selection.getNode(),"A");if(!i){return}f.find("input.url-field").val(i.href);a.title.val(b.dom.getAttrib(i,"title"));if("_blank"==b.dom.getAttrib(i,"target")){a.openInNewTab.attr("checked","checked")}},update:function(){var k,h=tinyMCEPopup.editor,i={title:a.title.val(),target:a.openInNewTab.attr("checked")?"_blank":""},j,l,g;if(f.hasClass("link-panel-custom")){i.href=f.find("input.url-field").val();j=i.href}else{k=f.find("li.selected:visible");if(!k.length){return}i.href=k.children("input").val();j=k.text()}tinyMCEPopup.restoreSelection();l=h.dom.getParent(h.selection.getNode(),"A");if(!i.href){if(h.selection.isCollapsed()){tinyMCEPopup.close();return}else{if(l){tinyMCEPopup.execCommand("mceBeginUndoLevel");g=h.selection.getBookmark();h.dom.remove(l,1);h.selection.moveToBookmark(g);tinyMCEPopup.execCommand("mceEndUndoLevel");tinyMCEPopup.close();return}}}tinyMCEPopup.execCommand("mceBeginUndoLevel");if(l==null){h.getDoc().execCommand("unlink",false,null);if(h.selection.isCollapsed()){var k=h.dom.create("a",{href:"#mce_temp_url#"},j);h.selection.setNode(k)}else{tinyMCEPopup.execCommand("CreateLink",false,"#mce_temp_url#",{skip_undo:1})}tinymce.each(h.dom.select("a"),function(m){if(h.dom.getAttrib(m,"href")=="#mce_temp_url#"){l=m;h.dom.setAttribs(l,i)}})}else{h.dom.setAttribs(l,i)}if(l.childNodes.length!=1||l.firstChild.nodeName!="IMG"){h.focus();h.selection.select(l);h.selection.collapse(0);tinyMCEPopup.storeSelection()}tinyMCEPopup.execCommand("mceEndUndoLevel");tinyMCEPopup.close()},maybeLoadPanel:function(){var g=f.find(".wp-tab-panel:visible");if(g.length&&g.find(".wp-tab-panel-loading").length){e.linkPanelAJAX(g)}},linkPanelAJAX:function(i,h,j){if(!i.hasClass("wp-tab-panel")){i=i.parents(".wp-tab-panel")}if(!i.length){return}var g=i.children(".wp-tab-panel-query").val();e.linkAJAX(i,d.extend({preset:g,page:"all"==g?1:0},h),function(m,k){var l=i.children(".wp-tab-panel-pagelinks");i.children("ul").html(e.generateListMarkup(m.results,k));if(m.page_links){l.html(m.page_links).show()}else{l.hide()}if(j){j(m,k)}})},selectInternalLink:function(){var g=d(this);if(g.hasClass("unselectable")){return}g.siblings(".selected").removeClass("selected");g.addClass("selected")},selectPageLink:function(h){var g=h.target.href.match(/page=(\d+)/);g=g?g[1]:1;h.preventDefault();e.linkPanelAJAX(d(this),{page:g})},searchInternalLinks:function(){var g=d(this),h=g.siblings("img.waiting").show();e.linkPanelAJAX(g,{title:g.val()},function(){h.hide()})},linkAJAX:function(h,i,j){var g=h.parents(".link-panel").data("link-type");d.post(ajaxurl,d.extend({action:"wp-link-ajax",type:g.type,name:g.name},i),function(k){return j(k,g)},"json")},generateListMarkup:function(h,g){var i="";if(!h){return'<li class="no-matches-found unselectable"><em>'+wpLinkL10n.noMatchesFound+"</em></li>"}d.each(h,function(){i+='<li id="link-to-'+g.full+"-"+this["ID"]+'">';i+='<input type="hidden" value="'+this["permalink"]+'" />';i+=this["title"]?this["title"]:"<em>"+wpLinkL10n.untitled+"</em>";i+="</li>"});return i}};d(document).ready(e.init)})(jQuery);
|
||||
(function(d){var a={},c={},b,e={init:function(){var h,g,f;b=tinyMCEPopup.editor;a.url=d("#url-field");a.title=d("#link-title-field");a.openInNewTab=d("#link-target-checkbox");a.search=d("#search-field");c.search=d("#search-results");c.recent=d("#most-recent-results");d("#wp-update").click(e.update);d("#wp-cancel").click(function(){tinyMCEPopup.close()});d(".query-results").delegate("li","click",e.selectInternalLink);d(".wp-results-pagelinks").delegate("a","click",e.selectPageLink);a.search.keyup(e.searchInternalLinks);if(h=b.dom.getParent(b.selection.getNode(),"A")){a.url.val(h.href);a.title.val(b.dom.getAttrib(h,"title"));if("_blank"==b.dom.getAttrib(h,"target")){a.openInNewTab.attr("checked","checked")}}},update:function(){var j,g=tinyMCEPopup.editor,h={href:a.url.val(),title:a.title.val(),target:a.openInNewTab.attr("checked")?"_blank":""},k,f,i=h.title?h.title:h.href;tinyMCEPopup.restoreSelection();k=g.dom.getParent(g.selection.getNode(),"A");if(!h.href){if(g.selection.isCollapsed()){tinyMCEPopup.close();return}else{if(k){tinyMCEPopup.execCommand("mceBeginUndoLevel");f=g.selection.getBookmark();g.dom.remove(k,1);g.selection.moveToBookmark(f);tinyMCEPopup.execCommand("mceEndUndoLevel");tinyMCEPopup.close();return}}}tinyMCEPopup.execCommand("mceBeginUndoLevel");if(k==null){g.getDoc().execCommand("unlink",false,null);if(g.selection.isCollapsed()){var j=g.dom.create("a",{href:"#mce_temp_url#"},i);g.selection.setNode(j)}else{tinyMCEPopup.execCommand("CreateLink",false,"#mce_temp_url#",{skip_undo:1})}tinymce.each(g.dom.select("a"),function(l){if(g.dom.getAttrib(l,"href")=="#mce_temp_url#"){k=l;g.dom.setAttribs(k,h)}})}else{g.dom.setAttribs(k,h)}if(k.childNodes.length!=1||k.firstChild.nodeName!="IMG"){g.focus();g.selection.select(k);g.selection.collapse(0);tinyMCEPopup.storeSelection()}tinyMCEPopup.execCommand("mceEndUndoLevel");tinyMCEPopup.close()},selectInternalLink:function(){var f=d(this);if(f.hasClass("unselectable")){return}f.siblings(".selected").removeClass("selected");f.addClass("selected");a.url.val(f.children(".item-permalink").val());a.title.val(f.children(".item-title").text())},selectPageLink:function(g){var f=g.target.href.match(/page=(\d+)/);f=f?f[1]:1;g.preventDefault();e.linkAJAX(d(this),{page:f})},searchInternalLinks:function(){var f=d(this),h,g=f.val();if(g){c.recent.hide();c.search.show();h=f.siblings("img.waiting").show();e.linkAJAX(c.search,{title:g},function(){h.hide()})}else{c.search.hide();c.recent.show()}},linkAJAX:function(g,f,h){if(!g.hasClass("query-results")){g=g.parents(".query-results")}if(!g.length){return}d.post(ajaxurl,d.extend({action:"wp-link-ajax"},f),function(j){var i=g.children(".wp-results-pagelinks");g.children("ul").html(e.generateListMarkup(j.results));if(j.page_links){i.html(j.page_links).show()}else{i.hide()}if(h){h(j.results)}},"json")},generateListMarkup:function(f){var g="";if(!f){return'<li class="no-matches-found unselectable"><span class="item-title"><em>'+wpLinkL10n.noMatchesFound+"</em></span></li>"}d.each(f,function(){g+='<li><input type="hidden" class="item-permalink" value="'+this["permalink"]+'" />';g+='<span class="item-title">';g+=this["title"]?this["title"]:"<em>"+wpLinkL10n.untitled+"</em>";g+='</span><span class="item-info">'+this["info"]+"</span>";g+="</li>"});return g}};d(document).ready(e.init)})(jQuery);
|
Loading…
Reference in New Issue