mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
Fix JSHint errors in wplink.js.
props jorbin. fixes #25914. Built from https://develop.svn.wordpress.org/trunk@26193 git-svn-id: http://core.svn.wordpress.org/trunk@26101 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
cd6096c44b
commit
fe440d71d8
@ -1,3 +1,4 @@
|
||||
/* global ajaxurl, tinymce, wpLinkL10n, tinyMCEPopup, setUserSetting, wpActiveEditor */
|
||||
var wpLink;
|
||||
|
||||
(function($){
|
||||
@ -113,7 +114,7 @@ var wpLink;
|
||||
inputs.url.val( ed.dom.getAttrib(e, 'href') );
|
||||
inputs.title.val( ed.dom.getAttrib(e, 'title') );
|
||||
// Set open in new tab.
|
||||
inputs.openInNewTab.prop('checked', ( "_blank" == ed.dom.getAttrib( e, 'target' ) ) );
|
||||
inputs.openInNewTab.prop('checked', ( '_blank' == ed.dom.getAttrib( e, 'target' ) ) );
|
||||
// Update save prompt.
|
||||
inputs.submit.val( wpLinkL10n.update );
|
||||
|
||||
@ -156,7 +157,7 @@ var wpLink;
|
||||
},
|
||||
|
||||
htmlUpdate : function() {
|
||||
var attrs, html, begin, end, cursor,
|
||||
var attrs, html, begin, end, cursor, selection,
|
||||
textarea = wpLink.textarea;
|
||||
|
||||
if ( ! textarea )
|
||||
@ -201,9 +202,8 @@ var wpLink;
|
||||
if ( begin == end )
|
||||
cursor -= '</a>'.length;
|
||||
|
||||
textarea.value = textarea.value.substring( 0, begin )
|
||||
+ html
|
||||
+ textarea.value.substring( end, textarea.value.length );
|
||||
textarea.value = textarea.value.substring( 0, begin ) + html +
|
||||
textarea.value.substring( end, textarea.value.length );
|
||||
|
||||
// Update cursor position
|
||||
textarea.selectionStart = textarea.selectionEnd = cursor;
|
||||
@ -227,17 +227,17 @@ var wpLink;
|
||||
b = ed.selection.getBookmark();
|
||||
ed.dom.remove(e, 1);
|
||||
ed.selection.moveToBookmark(b);
|
||||
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
||||
tinyMCEPopup.execCommand('mceEndUndoLevel');
|
||||
wpLink.close();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (e == null) {
|
||||
ed.getDoc().execCommand("unlink", false, null);
|
||||
tinyMCEPopup.execCommand("mceInsertLink", false, "#mce_temp_url#", {skip_undo : 1});
|
||||
ed.getDoc().execCommand('unlink', false, null);
|
||||
tinyMCEPopup.execCommand('mceInsertLink', false, '#mce_temp_url#', {skip_undo : 1});
|
||||
|
||||
tinymce.each(ed.dom.select("a"), function(n) {
|
||||
tinymce.each(ed.dom.select('a'), function(n) {
|
||||
if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') {
|
||||
e = n;
|
||||
ed.dom.setAttribs(e, attrs);
|
||||
@ -262,7 +262,7 @@ var wpLink;
|
||||
tinyMCEPopup.storeSelection();
|
||||
}
|
||||
|
||||
ed.execCommand("mceEndUndoLevel");
|
||||
ed.execCommand('mceEndUndoLevel');
|
||||
wpLink.close();
|
||||
ed.focus();
|
||||
},
|
||||
@ -270,7 +270,7 @@ var wpLink;
|
||||
updateFields : function( e, li, originalEvent ) {
|
||||
inputs.url.val( li.children('.item-permalink').val() );
|
||||
inputs.title.val( li.hasClass('no-title') ? '' : li.children('.item-title').text() );
|
||||
if ( originalEvent && originalEvent.type == "click" )
|
||||
if ( originalEvent && originalEvent.type == 'click' )
|
||||
inputs.url.focus();
|
||||
},
|
||||
setDefaultValues : function() {
|
||||
@ -318,39 +318,31 @@ var wpLink;
|
||||
keydown : function( event ) {
|
||||
var fn, key = $.ui.keyCode;
|
||||
|
||||
switch( event.which ) {
|
||||
case key.UP:
|
||||
fn = 'prev';
|
||||
case key.DOWN:
|
||||
fn = fn || 'next';
|
||||
clearInterval( wpLink.keyInterval );
|
||||
wpLink[ fn ]();
|
||||
wpLink.keyInterval = setInterval( wpLink[ fn ], wpLink.keySensitivity );
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
if ( event.which !== key.UP && event.which !== key.DOWN ) {
|
||||
return;
|
||||
}
|
||||
|
||||
fn = event.which === key.UP ? 'prev' : 'next';
|
||||
clearInterval( wpLink.keyInterval );
|
||||
wpLink[ fn ]();
|
||||
wpLink.keyInterval = setInterval( wpLink[ fn ], wpLink.keySensitivity );
|
||||
event.preventDefault();
|
||||
},
|
||||
|
||||
keyup: function( event ) {
|
||||
var key = $.ui.keyCode;
|
||||
|
||||
switch( event.which ) {
|
||||
case key.ESCAPE:
|
||||
event.stopImmediatePropagation();
|
||||
if ( ! $(document).triggerHandler( 'wp_CloseOnEscape', [{ event: event, what: 'wplink', cb: wpLink.close }] ) )
|
||||
wpLink.close();
|
||||
|
||||
return false;
|
||||
break;
|
||||
case key.UP:
|
||||
case key.DOWN:
|
||||
clearInterval( wpLink.keyInterval );
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
if ( event.which === key.ESCAPE ) {
|
||||
event.stopImmediatePropagation();
|
||||
if ( ! $(document).triggerHandler( 'wp_CloseOnEscape', [{ event: event, what: 'wplink', cb: wpLink.close }] ) )
|
||||
wpLink.close();
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( event.which === key.UP || event.which === key.DOWN ) {
|
||||
clearInterval( wpLink.keyInterval );
|
||||
event.preventDefault();
|
||||
}
|
||||
event.preventDefault();
|
||||
},
|
||||
|
||||
delayedCallback : function( func, delay ) {
|
||||
@ -507,19 +499,18 @@ var wpLink;
|
||||
|
||||
if ( !results ) {
|
||||
if ( firstPage ) {
|
||||
list += '<li class="unselectable"><span class="item-title"><em>'
|
||||
+ wpLinkL10n.noMatchesFound
|
||||
+ '</em></span></li>';
|
||||
list += '<li class="unselectable"><span class="item-title"><em>' +
|
||||
wpLinkL10n.noMatchesFound + '</em></span></li>';
|
||||
}
|
||||
} else {
|
||||
$.each( results, function() {
|
||||
classes = alt ? 'alternate' : '';
|
||||
classes += this['title'] ? '' : ' no-title';
|
||||
classes += this.title ? '' : ' no-title';
|
||||
list += classes ? '<li class="' + classes + '">' : '<li>';
|
||||
list += '<input type="hidden" class="item-permalink" value="' + this['permalink'] + '" />';
|
||||
list += '<input type="hidden" class="item-permalink" value="' + this.permalink + '" />';
|
||||
list += '<span class="item-title">';
|
||||
list += this['title'] ? this['title'] : wpLinkL10n.noTitle;
|
||||
list += '</span><span class="item-info">' + this['info'] + '</span></li>';
|
||||
list += this.title ? this.title : wpLinkL10n.noTitle;
|
||||
list += '</span><span class="item-info">' + this.info + '</span></li>';
|
||||
alt = ! alt;
|
||||
});
|
||||
}
|
||||
@ -578,7 +569,7 @@ var wpLink;
|
||||
self.querying = false;
|
||||
self.allLoaded = !r;
|
||||
callback( r, query );
|
||||
}, "json" );
|
||||
}, 'json' );
|
||||
}
|
||||
});
|
||||
|
||||
|
2
wp-includes/js/wplink.min.js
vendored
2
wp-includes/js/wplink.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user