diff --git a/wp-includes/js/tinymce/plugins/wplink/js/wplink.dev.js b/wp-includes/js/tinymce/plugins/wplink/js/wplink.dev.js
new file mode 100644
index 0000000000..adec3cb19c
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/wplink/js/wplink.dev.js
@@ -0,0 +1,280 @@
+(function($){
+ $.widget('wp.wpTabs', {
+ options: {},
+ _create: function() {
+ var self = this,
+ ul = this.element,
+ lis = ul.children();
+
+ this.active = lis.filter('.wp-tab-active');
+ // Calculate panel IDs
+ lis.each(function() {
+ var panel = self._getPanel( $(this) );
+ if ( self.active[0] == this )
+ panel.show();
+ else
+ panel.hide();
+ });
+
+ ul.delegate('li', 'click.wpTabs', function(e) {
+ var li = $(this);
+
+ // Prevent any child link from redirecting the page.
+ e.preventDefault();
+ // Deactivate previous tab.
+ self._getPanel( self.active ).hide();
+ self.active.removeClass('wp-tab-active');
+ self._trigger("hide", e, self.widget() );
+
+ // Activate current tab.
+ self.active = li.addClass('wp-tab-active');
+ self._getPanel( self.active ).show();
+ self._trigger("show", e, self.widget() );
+ });
+ },
+ widget: function() {
+ return {
+ ul: this.element,
+ tab: this.active,
+ panel: this._getPanel( this.active )
+ };
+ },
+ _setPanel: function( $el ) {
+ var panel = $( '#' + $el.children('.wp-tab-for-id').val() );
+ $el.data( 'wp-tab-panel', panel );
+ return panel;
+ },
+ _getPanel: function( $el ) {
+ var panel = $el.data('wp-tab-panel');
+ return ( !panel || !panel.length ) ? this._setPanel( $el ) : panel;
+ }
+ });
+ // Create tab bars by default.
+ $(function(){
+ $('.wp-tab-bar').wpTabs();
+ });
+})(jQuery);
+
+(function($){
+ var inputs = {}, panels, active, ed,
+ wpLink = {
+ init : function() {
+ var e, etarget, eclass;
+ // Init shared vars
+ ed = tinyMCEPopup.editor;
+ // Secondary options
+ inputs.title = $('#link-title-field');
+ // Advanced Options
+ inputs.openInNewTab = $('#link-target-checkbox');
+
+ panels = $('.link-panel');
+ active = $('.link-panel-active');
+ $('#link-panel-tab-bar').wpTabs({
+ show: function(e, widget) {
+ active = widget.panel;
+ active.addClass('link-panel-active');
+ wpLink.maybeLoadPanel();
+ },
+ hide: function(e, widget) {
+ active.removeClass('link-panel-active');
+ }
+ })
+
+ panels.each( function(){
+ var linkType = this.id.replace(/^link-panel-id-/,''),
+ parts = linkType.split('-');
+ $(this).data( 'link-type', {
+ full : linkType,
+ type : parts[0],
+ name : parts[1] || ''
+ });
+ });
+
+ // Bind event handlers
+ $('#wp-update').click( wpLink.update );
+ $('#wp-cancel').click( function() { tinyMCEPopup.close(); } );
+ $('.link-panel .wp-tab-bar').wpTabs('option', 'show', wpLink.maybeLoadPanel );
+ $('.link-panel .wp-tab-panel').delegate('li', 'click', wpLink.selectInternalLink );
+ $('.wp-tab-panel-pagelinks').delegate('a', 'click', wpLink.selectPageLink );
+ $('.link-panel .link-search-field').keyup( wpLink.searchInternalLinks );
+
+ active.find('input.url-field').focus();
+
+ // If link exists, select proper values.
+ e = ed.dom.getParent(ed.selection.getNode(), 'A');
+ if ( ! e )
+ return;
+
+ active.find('input.url-field').val( e.href );
+ inputs.title.val( ed.dom.getAttrib(e, 'title') );
+ // Advanced Options
+
+ if ( "_blank" == ed.dom.getAttrib(e, 'target') )
+ inputs.openInNewTab.attr('checked','checked');
+ },
+
+ update : function() {
+ var el,
+ ed = tinyMCEPopup.editor,
+ attrs = {
+ title : inputs.title.val(),
+ target : inputs.openInNewTab.attr('checked') ? '_blank' : ''
+ }, defaultContent, e, b;
+
+ if ( active.hasClass('link-panel-custom') ) {
+ attrs.href = active.find('input.url-field').val();
+ defaultContent = attrs.href;
+ } else {
+ el = active.find('li.selected:visible');
+ if ( !el.length )
+ return;
+
+ attrs.href = el.children('input').val();
+ defaultContent = el.text();
+ }
+
+ tinyMCEPopup.restoreSelection();
+ e = ed.dom.getParent(ed.selection.getNode(), 'A');
+
+ // If the values are empty...
+ if ( ! attrs.href ) {
+ // ...and nothing is selected, we should return
+ if ( ed.selection.isCollapsed() ) {
+ tinyMCEPopup.close();
+ return;
+ // ...and a link exists, we should unlink and return
+ } else if ( e ) {
+ tinyMCEPopup.execCommand("mceBeginUndoLevel");
+ b = ed.selection.getBookmark();
+ ed.dom.remove(e, 1);
+ ed.selection.moveToBookmark(b);
+ tinyMCEPopup.execCommand("mceEndUndoLevel");
+ tinyMCEPopup.close();
+ return;
+ }
+ }
+
+ tinyMCEPopup.execCommand("mceBeginUndoLevel");
+
+ if (e == null) {
+ ed.getDoc().execCommand("unlink", false, null);
+
+ // If no selection exists, create a new link from scratch.
+ if ( ed.selection.isCollapsed() ) {
+ var el = ed.dom.create('a', { href: "#mce_temp_url#" }, defaultContent);
+ ed.selection.setNode(el);
+ // If a selection exists, wrap it in a link.
+ } else {
+ tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1});
+ }
+
+ tinymce.each(ed.dom.select("a"), function(n) {
+ if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') {
+ e = n;
+ ed.dom.setAttribs(e, attrs);
+ }
+ });
+ } else {
+ ed.dom.setAttribs(e, attrs);
+ }
+
+ // Don't move caret if selection was image
+ if (e.childNodes.length != 1 || e.firstChild.nodeName != 'IMG') {
+ ed.focus();
+ ed.selection.select(e);
+ ed.selection.collapse(0);
+ tinyMCEPopup.storeSelection();
+ }
+
+ tinyMCEPopup.execCommand("mceEndUndoLevel");
+ tinyMCEPopup.close();
+ },
+
+ maybeLoadPanel : function() {
+ var panel = active.find('.wp-tab-panel:visible');
+ if ( panel.length && panel.find('.wp-tab-panel-loading').length )
+ wpLink.linkPanelAJAX( panel );
+ },
+
+ linkPanelAJAX : function( $panel, params, callback ) {
+ if ( ! $panel.hasClass('wp-tab-panel') )
+ $panel = $panel.parents('.wp-tab-panel');
+
+ if ( ! $panel.length )
+ return;
+
+ var query = $panel.children('.wp-tab-panel-query').val();
+
+ wpLink.linkAJAX( $panel, $.extend({
+ preset : query,
+ page : 'all' == query ? 1 : 0
+ }, params), function(r, lt) {
+ var pagelinks = $panel.children('.wp-tab-panel-pagelinks');
+
+ // Set results
+ $panel.children('ul').html( wpLink.generateListMarkup( r['results'], lt ) );
+
+ // Handle page links
+ if ( r['page_links'] )
+ pagelinks.html( r['page_links'] ).show();
+ else
+ pagelinks.hide();
+ // Run callback
+ if ( callback )
+ callback(r, lt);
+ })
+ },
+
+ selectInternalLink : function() {
+ var t = $(this);
+ if ( t.hasClass('unselectable') )
+ return;
+ t.siblings('.selected').removeClass('selected');
+ t.addClass('selected');
+ },
+
+ selectPageLink : function(e) {
+ var page = e.target.href.match(/page=(\d+)/);
+
+ page = page ? page[1] : 1; // If there's no match, it's the first page.
+ e.preventDefault(); // Prevent the link from redirecting.
+
+ wpLink.linkPanelAJAX( $(this), { page : page });
+ },
+
+ searchInternalLinks : function() {
+ var t = $(this),
+ waiting = t.siblings('img.waiting').show();
+
+ wpLink.linkPanelAJAX( t, { title : t.val() }, function(){ waiting.hide(); });
+ },
+
+ linkAJAX : function( el, params, callback ) {
+ var linkType = el.parents('.link-panel').data('link-type');
+ $.post( ajaxurl, $.extend({
+ action : 'wp-link-ajax',
+ type : linkType.type,
+ name : linkType.name
+ }, params ), function(r) {
+ return callback(r, linkType);
+ }, "json" );
+ },
+
+ generateListMarkup : function( results, linkType ) {
+ var s = '';
+
+ if ( ! results )
+ return '
' + wpLinkL10n.noMatchesFound + '';
+
+ $.each( results, function() {
+ s+= '';
+ s+= '';
+ s+= this['title'] ? this['title'] : ''+ wpLinkL10n.untitled + '';
+ s+= '';
+ });
+ return s;
+ }
+ }
+
+ $(document).ready( wpLink.init );
+})(jQuery);
\ No newline at end of file
diff --git a/wp-includes/js/tinymce/plugins/wplink/js/wplink.js b/wp-includes/js/tinymce/plugins/wplink/js/wplink.js
index adec3cb19c..0b85db8a4f 100644
--- a/wp-includes/js/tinymce/plugins/wplink/js/wplink.js
+++ b/wp-includes/js/tinymce/plugins/wplink/js/wplink.js
@@ -1,280 +1 @@
-(function($){
- $.widget('wp.wpTabs', {
- options: {},
- _create: function() {
- var self = this,
- ul = this.element,
- lis = ul.children();
-
- this.active = lis.filter('.wp-tab-active');
- // Calculate panel IDs
- lis.each(function() {
- var panel = self._getPanel( $(this) );
- if ( self.active[0] == this )
- panel.show();
- else
- panel.hide();
- });
-
- ul.delegate('li', 'click.wpTabs', function(e) {
- var li = $(this);
-
- // Prevent any child link from redirecting the page.
- e.preventDefault();
- // Deactivate previous tab.
- self._getPanel( self.active ).hide();
- self.active.removeClass('wp-tab-active');
- self._trigger("hide", e, self.widget() );
-
- // Activate current tab.
- self.active = li.addClass('wp-tab-active');
- self._getPanel( self.active ).show();
- self._trigger("show", e, self.widget() );
- });
- },
- widget: function() {
- return {
- ul: this.element,
- tab: this.active,
- panel: this._getPanel( this.active )
- };
- },
- _setPanel: function( $el ) {
- var panel = $( '#' + $el.children('.wp-tab-for-id').val() );
- $el.data( 'wp-tab-panel', panel );
- return panel;
- },
- _getPanel: function( $el ) {
- var panel = $el.data('wp-tab-panel');
- return ( !panel || !panel.length ) ? this._setPanel( $el ) : panel;
- }
- });
- // Create tab bars by default.
- $(function(){
- $('.wp-tab-bar').wpTabs();
- });
-})(jQuery);
-
-(function($){
- var inputs = {}, panels, active, ed,
- wpLink = {
- init : function() {
- var e, etarget, eclass;
- // Init shared vars
- ed = tinyMCEPopup.editor;
- // Secondary options
- inputs.title = $('#link-title-field');
- // Advanced Options
- inputs.openInNewTab = $('#link-target-checkbox');
-
- panels = $('.link-panel');
- active = $('.link-panel-active');
- $('#link-panel-tab-bar').wpTabs({
- show: function(e, widget) {
- active = widget.panel;
- active.addClass('link-panel-active');
- wpLink.maybeLoadPanel();
- },
- hide: function(e, widget) {
- active.removeClass('link-panel-active');
- }
- })
-
- panels.each( function(){
- var linkType = this.id.replace(/^link-panel-id-/,''),
- parts = linkType.split('-');
- $(this).data( 'link-type', {
- full : linkType,
- type : parts[0],
- name : parts[1] || ''
- });
- });
-
- // Bind event handlers
- $('#wp-update').click( wpLink.update );
- $('#wp-cancel').click( function() { tinyMCEPopup.close(); } );
- $('.link-panel .wp-tab-bar').wpTabs('option', 'show', wpLink.maybeLoadPanel );
- $('.link-panel .wp-tab-panel').delegate('li', 'click', wpLink.selectInternalLink );
- $('.wp-tab-panel-pagelinks').delegate('a', 'click', wpLink.selectPageLink );
- $('.link-panel .link-search-field').keyup( wpLink.searchInternalLinks );
-
- active.find('input.url-field').focus();
-
- // If link exists, select proper values.
- e = ed.dom.getParent(ed.selection.getNode(), 'A');
- if ( ! e )
- return;
-
- active.find('input.url-field').val( e.href );
- inputs.title.val( ed.dom.getAttrib(e, 'title') );
- // Advanced Options
-
- if ( "_blank" == ed.dom.getAttrib(e, 'target') )
- inputs.openInNewTab.attr('checked','checked');
- },
-
- update : function() {
- var el,
- ed = tinyMCEPopup.editor,
- attrs = {
- title : inputs.title.val(),
- target : inputs.openInNewTab.attr('checked') ? '_blank' : ''
- }, defaultContent, e, b;
-
- if ( active.hasClass('link-panel-custom') ) {
- attrs.href = active.find('input.url-field').val();
- defaultContent = attrs.href;
- } else {
- el = active.find('li.selected:visible');
- if ( !el.length )
- return;
-
- attrs.href = el.children('input').val();
- defaultContent = el.text();
- }
-
- tinyMCEPopup.restoreSelection();
- e = ed.dom.getParent(ed.selection.getNode(), 'A');
-
- // If the values are empty...
- if ( ! attrs.href ) {
- // ...and nothing is selected, we should return
- if ( ed.selection.isCollapsed() ) {
- tinyMCEPopup.close();
- return;
- // ...and a link exists, we should unlink and return
- } else if ( e ) {
- tinyMCEPopup.execCommand("mceBeginUndoLevel");
- b = ed.selection.getBookmark();
- ed.dom.remove(e, 1);
- ed.selection.moveToBookmark(b);
- tinyMCEPopup.execCommand("mceEndUndoLevel");
- tinyMCEPopup.close();
- return;
- }
- }
-
- tinyMCEPopup.execCommand("mceBeginUndoLevel");
-
- if (e == null) {
- ed.getDoc().execCommand("unlink", false, null);
-
- // If no selection exists, create a new link from scratch.
- if ( ed.selection.isCollapsed() ) {
- var el = ed.dom.create('a', { href: "#mce_temp_url#" }, defaultContent);
- ed.selection.setNode(el);
- // If a selection exists, wrap it in a link.
- } else {
- tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1});
- }
-
- tinymce.each(ed.dom.select("a"), function(n) {
- if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') {
- e = n;
- ed.dom.setAttribs(e, attrs);
- }
- });
- } else {
- ed.dom.setAttribs(e, attrs);
- }
-
- // Don't move caret if selection was image
- if (e.childNodes.length != 1 || e.firstChild.nodeName != 'IMG') {
- ed.focus();
- ed.selection.select(e);
- ed.selection.collapse(0);
- tinyMCEPopup.storeSelection();
- }
-
- tinyMCEPopup.execCommand("mceEndUndoLevel");
- tinyMCEPopup.close();
- },
-
- maybeLoadPanel : function() {
- var panel = active.find('.wp-tab-panel:visible');
- if ( panel.length && panel.find('.wp-tab-panel-loading').length )
- wpLink.linkPanelAJAX( panel );
- },
-
- linkPanelAJAX : function( $panel, params, callback ) {
- if ( ! $panel.hasClass('wp-tab-panel') )
- $panel = $panel.parents('.wp-tab-panel');
-
- if ( ! $panel.length )
- return;
-
- var query = $panel.children('.wp-tab-panel-query').val();
-
- wpLink.linkAJAX( $panel, $.extend({
- preset : query,
- page : 'all' == query ? 1 : 0
- }, params), function(r, lt) {
- var pagelinks = $panel.children('.wp-tab-panel-pagelinks');
-
- // Set results
- $panel.children('ul').html( wpLink.generateListMarkup( r['results'], lt ) );
-
- // Handle page links
- if ( r['page_links'] )
- pagelinks.html( r['page_links'] ).show();
- else
- pagelinks.hide();
- // Run callback
- if ( callback )
- callback(r, lt);
- })
- },
-
- selectInternalLink : function() {
- var t = $(this);
- if ( t.hasClass('unselectable') )
- return;
- t.siblings('.selected').removeClass('selected');
- t.addClass('selected');
- },
-
- selectPageLink : function(e) {
- var page = e.target.href.match(/page=(\d+)/);
-
- page = page ? page[1] : 1; // If there's no match, it's the first page.
- e.preventDefault(); // Prevent the link from redirecting.
-
- wpLink.linkPanelAJAX( $(this), { page : page });
- },
-
- searchInternalLinks : function() {
- var t = $(this),
- waiting = t.siblings('img.waiting').show();
-
- wpLink.linkPanelAJAX( t, { title : t.val() }, function(){ waiting.hide(); });
- },
-
- linkAJAX : function( el, params, callback ) {
- var linkType = el.parents('.link-panel').data('link-type');
- $.post( ajaxurl, $.extend({
- action : 'wp-link-ajax',
- type : linkType.type,
- name : linkType.name
- }, params ), function(r) {
- return callback(r, linkType);
- }, "json" );
- },
-
- generateListMarkup : function( results, linkType ) {
- var s = '';
-
- if ( ! results )
- return '' + wpLinkL10n.noMatchesFound + '';
-
- $.each( results, function() {
- s+= '';
- s+= '';
- s+= this['title'] ? this['title'] : ''+ wpLinkL10n.untitled + '';
- s+= '';
- });
- return s;
- }
- }
-
- $(document).ready( wpLink.init );
-})(jQuery);
\ No newline at end of file
+(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''+wpLinkL10n.noMatchesFound+""}d.each(h,function(){i+='';i+='';i+=this["title"]?this["title"]:""+wpLinkL10n.untitled+"";i+=""});return i}};d(document).ready(e.init)})(jQuery);
\ No newline at end of file