WordPress.org

Plugin Directory

Changeset 1396731


Ignore:
Timestamp:
04/15/16 17:39:48 (20 months ago)
Author:
bitacre
Message:

added fix

Location:
nofollow/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • nofollow/trunk/nofollow.php

    r1319430 r1396731  
    44Plugin URI: http://shinraholdings.com/plugins/nofollow 
    55Description: A suite of tools that gives you complete control over the rel=nofollow tag on an individual link basis. 
    6 Version: 1.4.4 
     6Version: 1.4.5 
    77Author: bitacre 
    8 Author URI: http://shinraholdings.com.com 
    9 License: GPLv2  
     8Author URI: http://shinraholdings.com 
     9License: GPLv2 
    1010    Copyright 2016 Shinra Web Holdings (shinraholdings.com) 
    1111 
  • nofollow/trunk/readme.txt

    r1319430 r1396731  
    11=== Ultimate Nofollow === 
    22Plugin URI: http://shinraholdings.com/plugins/nofollow 
    3 Contributors: bitacre 
     3Contributors: bitacre, keesromkes 
    44Donate link: http://shinraholdings.com/donate 
    55Tags: nofollow,link,links,meta,insert,rel nofollow,seo,checkbox,popup,shortcode,blogroll 
    66Requires at least: 2.8 
    7 Tested up to: 4.4 
    8 Stable tag: 1.4.4 
     7Tested up to: 4.5 
     8Stable tag: 1.4.5 
    99 
    1010Adds a checkbox in the insert link popup box for including rel="nofollow" in links as you create them; as well as other tools that provides complete control over the rel="nofollow" tag on your blogroll links and comments. 
     
    4646 
    4747== Changelog == 
     48= 1.4.5 = 
     49* Fixed checkbox bug, thanks [keesromkes](https://wordpress.org/support/profile/keesromkes) 
     50 
    4851= 1.4.4 = 
    4952* Purely cosmetic WordPress 4.4 update 
     
    8588 
    8689== Upgrade Notice == 
     90= 1.4.5 = 
     91Fixes checkbox bug introducef in WP 4.5. 
     92 
    8793= 1.4.4 = 
    8894Purely cosmetic WordPress 4.4 update. Happy New Year. 
  • nofollow/trunk/wplink.min.js

    r1153382 r1396731  
    1 var wpLink;!function(t){function n(){return i.dom.getParent(i.selection.getNode(),"a")}var i,a,s,r,l,o={},c={},u="ontouchend"in document;wpLink={timeToTriggerRiver:150,minRiverAJAXDuration:200,riverBottomThreshold:5,keySensitivity:100,lastSearch:"",textarea:"",append:function(){var e='<br /><label><span> </span><input type="checkbox" id="link-nofollow-checkbox" /> Add <code>rel="nofollow"</code> to link</label>';t("#wp-link .link-target").append(e)},init:function(){function e(){var e=t.trim(o.url.val());e&&l!==e&&!/^(?:[a-z]+:|#|\?|\.|\/)/.test(e)&&(o.url.val("http://"+e),l=e)}o.wrap=t("#wp-link-wrap"),o.dialog=t("#wp-link"),o.backdrop=t("#wp-link-backdrop"),o.submit=t("#wp-link-submit"),o.close=t("#wp-link-close"),o.text=t("#wp-link-text"),o.url=t("#wp-link-url"),o.nonce=t("#_ajax_linking_nonce"),o.openInNewTab=t("#wp-link-target"),o.relNofollow=t("#link-nofollow-checkbox"),o.search=t("#wp-link-search"),c.search=new s(t("#search-results")),c.recent=new s(t("#most-recent-results")),c.elements=o.dialog.find(".query-results"),o.queryNotice=t("#query-notice-message"),o.queryNoticeTextDefault=o.queryNotice.find(".query-notice-default"),o.queryNoticeTextHint=o.queryNotice.find(".query-notice-hint"),o.dialog.keydown(wpLink.keydown),o.dialog.keyup(wpLink.keyup),o.submit.click(function(e){e.preventDefault(),wpLink.update()}),o.close.add(o.backdrop).add("#wp-link-cancel a").click(function(e){e.preventDefault(),wpLink.close()}),t("#wp-link-search-toggle").on("click",wpLink.toggleInternalLinking),c.elements.on("river-select",wpLink.updateFields),o.search.on("focus.wplink",function(){o.queryNoticeTextDefault.hide(),o.queryNoticeTextHint.removeClass("screen-reader-text").show()}).on("blur.wplink",function(){o.queryNoticeTextDefault.show(),o.queryNoticeTextHint.addClass("screen-reader-text").hide()}),o.search.keyup(function(){var e=this;window.clearTimeout(a),a=window.setTimeout(function(){wpLink.searchInternalLinks.call(e)},500)}),o.url.on("paste",function(){setTimeout(e,0)}),o.url.on("blur",e)},open:function(e){var n;t(document.body).addClass("modal-open"),wpLink.range=null,e&&(window.wpActiveEditor=e),window.wpActiveEditor&&(this.textarea=t("#"+window.wpActiveEditor).get(0),"undefined"!=typeof tinymce&&(n=tinymce.get(wpActiveEditor),i=n&&!n.isHidden()?n:null,i&&tinymce.isIE&&(i.windowManager.bookmark=i.selection.getBookmark())),!wpLink.isMCE()&&document.selection&&(this.textarea.focus(),this.range=document.selection.createRange()),o.wrap.show(),o.backdrop.show(),wpLink.refresh(),t(document).trigger("wplink-open",o.wrap))},isMCE:function(){return i&&!i.isHidden()},refresh:function(){var e="";c.search.refresh(),c.recent.refresh(),wpLink.isMCE()?wpLink.mceRefresh():(o.wrap.hasClass("has-text-field")||o.wrap.addClass("has-text-field"),document.selection?e=document.selection.createRange().text||"":"undefined"!=typeof this.textarea.selectionStart&&this.textarea.selectionStart!==this.textarea.selectionEnd&&(e=this.textarea.value.substring(this.textarea.selectionStart,this.textarea.selectionEnd)||""),o.text.val(e),wpLink.setDefaultValues()),u?o.url.focus().blur():o.url.focus()[0].select(),c.recent.ul.children().length||c.recent.ajax(),l=o.url.val().replace(/^http:\/\//,"")},hasSelectedText:function(e){var t=i.selection.getContent();if(/</.test(t)&&(!/^<a [^>]+>[^<]+<\/a>$/.test(t)||-1===t.indexOf("href=")))return!1;if(e){var n,a=e.childNodes;if(0===a.length)return!1;for(n=a.length-1;n>=0;n--)if(3!=a[n].nodeType)return!1}return!0},mceRefresh:function(){var t,n=i.selection.getNode(),a=i.dom.getParent(n,"a[href]"),s=this.hasSelectedText(a);a?(t=a.innerText||a.textContent,o.url.val(i.dom.getAttrib(a,"href")),o.openInNewTab.prop("checked","_blank"===i.dom.getAttrib(a,"target")),"nofollow"==ed.dom.getAttrib(e,"rel")&&o.relNofollow.prop("checked",!0),o.submit.val(wpLinkL10n.update)):(t=i.selection.getContent({format:"text"}),this.setDefaultValues()),s?(o.text.val(t||""),o.wrap.addClass("has-text-field")):(o.text.val(""),o.wrap.removeClass("has-text-field"))},close:function(){t(document.body).removeClass("modal-open"),wpLink.isMCE()?i.focus():(wpLink.textarea.focus(),wpLink.range&&(wpLink.range.moveToBookmark(wpLink.range.getBookmark()),wpLink.range.select())),o.backdrop.hide(),o.wrap.hide(),l=!1,t(document).trigger("wplink-close",o.wrap)},getAttrs:function(){return{href:t.trim(o.url.val()),target:o.openInNewTab.prop("checked")?"_blank":"",rel:o.relNofollow.prop("checked")?"nofollow":""}},update:function(){wpLink.isMCE()?wpLink.mceUpdate():wpLink.htmlUpdate()},htmlUpdate:function(){var e,t,n,i,a,s,r,l=wpLink.textarea;l&&(e=wpLink.getAttrs(),t=o.text.val(),e.href&&(n='<a href="'+e.href+'"',e.target&&(n+=' target="'+e.target+'"'),e.rel&&(n+=' rel="'+e.rel+'"'),n+=">",document.selection&&wpLink.range?(l.focus(),wpLink.range.text=n+(t||wpLink.range.text)+"</a>",wpLink.range.moveToBookmark(wpLink.range.getBookmark()),wpLink.range.select(),wpLink.range=null):"undefined"!=typeof l.selectionStart&&(i=l.selectionStart,a=l.selectionEnd,r=t||l.value.substring(i,a),n=n+r+"</a>",s=i+n.length,i!==a||r||(s-=4),l.value=l.value.substring(0,i)+n+l.value.substring(a,l.value.length),l.selectionStart=l.selectionEnd=s),wpLink.close(),l.focus()))},mceUpdate:function(){var e,t,a=wpLink.getAttrs();return wpLink.close(),i.focus(),tinymce.isIE&&i.selection.moveToBookmark(i.windowManager.bookmark),a.href?(e=n(),t=o.text.val(),void(e?(t&&("innerText"in e?e.innerText=t:e.textContent=t),i.dom.setAttribs(e,a)):t?i.selection.setNode(i.dom.create("a",a,t)):i.execCommand("mceInsertLink",!1,a))):void i.execCommand("unlink")},updateFields:function(e,t){o.url.val(t.children(".item-permalink").val())},setDefaultValues:function(){var e,t=/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i,n=/^(https?|ftp):\/\/[A-Z0-9.-]+\.[A-Z]{2,4}[^ "]*$/i;this.isMCE()?e=i.selection.getContent():document.selection&&wpLink.range?e=wpLink.range.text:"undefined"!=typeof this.textarea.selectionStart&&(e=this.textarea.value.substring(this.textarea.selectionStart,this.textarea.selectionEnd)),o.url.val(e&&t.test(e)?"mailto:"+e:e&&n.test(e)?e.replace(/&|&#0?38;/gi,"&"):""),o.submit.val(wpLinkL10n.save)},searchInternalLinks:function(){var e,n=t(this),i=n.val();if(i.length>2){if(c.recent.hide(),c.search.show(),wpLink.lastSearch==i)return;wpLink.lastSearch=i,e=n.parent().find(".spinner").addClass("is-active"),c.search.change(i),c.search.ajax(function(){e.removeClass("is-active")})}else c.search.hide(),c.recent.show()},next:function(){c.search.next(),c.recent.next()},prev:function(){c.search.prev(),c.recent.prev()},keydown:function(e){var n,i,a=t.ui.keyCode;a.ESCAPE===e.keyCode?(wpLink.close(),e.stopImmediatePropagation()):a.TAB===e.keyCode&&(i=e.target.id,"wp-link-submit"!==i||e.shiftKey?"wp-link-close"===i&&e.shiftKey&&(o.submit.focus(),e.preventDefault()):(o.close.focus(),e.preventDefault())),(e.keyCode===a.UP||e.keyCode===a.DOWN)&&(!document.activeElement||"link-title-field"!==document.activeElement.id&&"url-field"!==document.activeElement.id)&&(n=e.keyCode===a.UP?"prev":"next",clearInterval(wpLink.keyInterval),wpLink[n](),wpLink.keyInterval=setInterval(wpLink[n],wpLink.keySensitivity),e.preventDefault())},keyup:function(e){var n=t.ui.keyCode;(e.which===n.UP||e.which===n.DOWN)&&(clearInterval(wpLink.keyInterval),e.preventDefault())},delayedCallback:function(e,t){var n,i,a,s;return t?(setTimeout(function(){return i?e.apply(s,a):void(n=!0)},t),function(){return n?e.apply(this,arguments):(a=arguments,s=this,void(i=!0))}):e},toggleInternalLinking:function(e){var t=o.wrap.hasClass("search-panel-visible");o.wrap.toggleClass("search-panel-visible",!t),setUserSetting("wplink",t?"0":"1"),o[t?"url":"search"].focus(),e.preventDefault()}},s=function(e,n){var i=this;this.element=e,this.ul=e.children("ul"),this.contentHeight=e.children("#link-selector-height"),this.waiting=e.find(".river-waiting"),this.change(n),this.refresh(),t("#wp-link .query-results, #wp-link #link-selector").scroll(function(){i.maybeLoad()}),e.on("click","li",function(e){i.select(t(this),e)})},t.extend(s.prototype,{refresh:function(){this.deselect(),this.visible=this.element.is(":visible")},show:function(){this.visible||(this.deselect(),this.element.show(),this.visible=!0)},hide:function(){this.element.hide(),this.visible=!1},select:function(e,t){var n,i,a,s;e.hasClass("unselectable")||e==this.selected||(this.deselect(),this.selected=e.addClass("selected"),n=e.outerHeight(),i=this.element.height(),a=e.position().top,s=this.element.scrollTop(),0>a?this.element.scrollTop(s+a):a+n>i&&this.element.scrollTop(s+a-i+n),this.element.trigger("river-select",[e,t,this]))},deselect:function(){this.selected&&this.selected.removeClass("selected"),this.selected=!1},prev:function(){if(this.visible){var e;this.selected&&(e=this.selected.prev("li"),e.length&&this.select(e))}},next:function(){if(this.visible){var e=this.selected?this.selected.next("li"):t("li:not(.unselectable):first",this.element);e.length&&this.select(e)}},ajax:function(e){var t=this,n=1==this.query.page?0:wpLink.minRiverAJAXDuration,i=wpLink.delayedCallback(function(n,i){t.process(n,i),e&&e(n,i)},n);this.query.ajax(i)},change:function(e){this.query&&this._search==e||(this._search=e,this.query=new r(e),this.element.scrollTop(0))},process:function(e,n){var i="",a=!0,s="",r=1==n.page;e?t.each(e,function(){s=a?"alternate":"",s+=this.title?"":" no-title",i+=s?'<li class="'+s+'">':"<li>",i+='<input type="hidden" class="item-permalink" value="'+this.permalink+'" />',i+='<span class="item-title">',i+=this.title?this.title:wpLinkL10n.noTitle,i+='</span><span class="item-info">'+this.info+"</span></li>",a=!a}):r&&(i+='<li class="unselectable no-matches-found"><span class="item-title"><em>'+wpLinkL10n.noMatchesFound+"</em></span></li>"),this.ul[r?"html":"append"](i)},maybeLoad:function(){var e=this,t=this.element,n=t.scrollTop()+t.height();!this.query.ready()||n<this.contentHeight.height()-wpLink.riverBottomThreshold||setTimeout(function(){var n=t.scrollTop(),i=n+t.height();!e.query.ready()||i<e.contentHeight.height()-wpLink.riverBottomThreshold||(e.waiting.addClass("is-active"),t.scrollTop(n+e.waiting.outerHeight()),e.ajax(function(){e.waiting.removeClass("is-active")}))},wpLink.timeToTriggerRiver)}}),r=function(e){this.page=1,this.allLoaded=!1,this.querying=!1,this.search=e},t.extend(r.prototype,{ready:function(){return!(this.querying||this.allLoaded)},ajax:function(e){var n=this,i={action:"wp-link-ajax",page:this.page,_ajax_linking_nonce:o.nonce.val()};this.search&&(i.search=this.search),this.querying=!0,t.post(ajaxurl,i,function(t){n.page++,n.querying=!1,n.allLoaded=!t,e(t,i)},"json")}}),t(document).ready(wpLink.append),t(document).ready(wpLink.init)}(jQuery); 
     1var wpLink;!function(t){function n(){return i.dom.getParent(i.selection.getNode(),"a")}var i,a,s,r,l,o={},c={},u="ontouchend"in document;wpLink={timeToTriggerRiver:150,minRiverAJAXDuration:200,riverBottomThreshold:5,keySensitivity:100,lastSearch:"",textarea:"",append:function(){var e='<br /><label><span> </span><input type="checkbox" id="link-nofollow-checkbox" /> Add <code>rel="nofollow"</code> to link</label>';t("#wp-link .link-target").append(e)},init:function(){function e(){var e=t.trim(o.url.val());e&&l!==e&&!/^(?:[a-z]+:|#|\?|\.|\/)/.test(e)&&(o.url.val("http://"+e),l=e)}o.wrap=t("#wp-link-wrap"),o.dialog=t("#wp-link"),o.backdrop=t("#wp-link-backdrop"),o.submit=t("#wp-link-submit"),o.close=t("#wp-link-close"),o.text=t("#wp-link-text"),o.url=t("#wp-link-url"),o.nonce=t("#_ajax_linking_nonce"),o.openInNewTab=t("#wp-link-target"),o.relNofollow=t("#link-nofollow-checkbox"),o.search=t("#wp-link-search"),c.search=new s(t("#search-results")),c.recent=new s(t("#most-recent-results")),c.elements=o.dialog.find(".query-results"),o.queryNotice=t("#query-notice-message"),o.queryNoticeTextDefault=o.queryNotice.find(".query-notice-default"),o.queryNoticeTextHint=o.queryNotice.find(".query-notice-hint"),o.dialog.keydown(wpLink.keydown),o.dialog.keyup(wpLink.keyup),o.submit.click(function(e){e.preventDefault(),wpLink.update()}),o.close.add(o.backdrop).add("#wp-link-cancel a").click(function(e){e.preventDefault(),wpLink.close()}),t("#wp-link-search-toggle").on("click",wpLink.toggleInternalLinking),c.elements.on("river-select",wpLink.updateFields),o.search.on("focus.wplink",function(){o.queryNoticeTextDefault.hide(),o.queryNoticeTextHint.removeClass("screen-reader-text").show()}).on("blur.wplink",function(){o.queryNoticeTextDefault.show(),o.queryNoticeTextHint.addClass("screen-reader-text").hide()}),o.search.keyup(function(){var e=this;window.clearTimeout(a),a=window.setTimeout(function(){wpLink.searchInternalLinks.call(e)},500)}),o.url.on("paste",function(){setTimeout(e,0)}),o.url.on("blur",e)},open:function(e){var n;t(document.body).addClass("modal-open"),wpLink.range=null,e&&(window.wpActiveEditor=e),window.wpActiveEditor&&(this.textarea=t("#"+window.wpActiveEditor).get(0),"undefined"!=typeof tinymce&&(n=tinymce.get(wpActiveEditor),i=n&&!n.isHidden()?n:null,i&&tinymce.isIE&&(i.windowManager.bookmark=i.selection.getBookmark())),!wpLink.isMCE()&&document.selection&&(this.textarea.focus(),this.range=document.selection.createRange()),o.wrap.show(),o.backdrop.show(),wpLink.refresh(),t(document).trigger("wplink-open",o.wrap))},isMCE:function(){return i&&!i.isHidden()},refresh:function(){var e="";c.search.refresh(),c.recent.refresh(),wpLink.isMCE()?wpLink.mceRefresh():(o.wrap.hasClass("has-text-field")||o.wrap.addClass("has-text-field"),document.selection?e=document.selection.createRange().text||"":"undefined"!=typeof this.textarea.selectionStart&&this.textarea.selectionStart!==this.textarea.selectionEnd&&(e=this.textarea.value.substring(this.textarea.selectionStart,this.textarea.selectionEnd)||""),o.text.val(e),wpLink.setDefaultValues()),u?o.url.focus().blur():o.url.focus()[0].select(),c.recent.ul.children().length||c.recent.ajax(),l=o.url.val().replace(/^http:\/\//,"")},hasSelectedText:function(e){var t=i.selection.getContent();if(/</.test(t)&&(!/^<a [^>]+>[^<]+<\/a>$/.test(t)||-1===t.indexOf("href=")))return!1;if(e){var n,a=e.childNodes;if(0===a.length)return!1;for(n=a.length-1;n>=0;n--)if(3!=a[n].nodeType)return!1}return!0},mceRefresh:function(){var t,n=i.selection.getNode(),a=i.dom.getParent(n,"a[href]"),s=this.hasSelectedText(a);a?(t=a.innerText||a.textContent,o.url.val(i.dom.getAttrib(a,"href")),o.openInNewTab.prop("checked","_blank"===i.dom.getAttrib(a,"target")),"nofollow"==ed.dom.getAttrib(e,"rel")&&o.relNofollow.prop("checked",!0),o.submit.val(wpLinkL10n.update)):(t=i.selection.getContent({format:"text"}),this.setDefaultValues()),s?(o.text.val(t||""),o.wrap.addClass("has-text-field")):(o.text.val(""),o.wrap.removeClass("has-text-field"))},close:function(){t(document.body).removeClass("modal-open"),wpLink.isMCE()?i.focus():(wpLink.textarea.focus(),wpLink.range&&(wpLink.range.moveToBookmark(wpLink.range.getBookmark()),wpLink.range.select())),o.backdrop.hide(),o.wrap.hide(),l=!1,t(document).trigger("wplink-close",o.wrap)},getAttrs:function(){return{href:t.trim(o.url.val()),target:o.openInNewTab.prop("checked")?"_blank":"",rel:o.relNofollow.prop("checked")?"nofollow":""}},update:function(){wpLink.isMCE()?wpLink.mceUpdate():wpLink.htmlUpdate()},htmlUpdate:function(){var e,t,n,i,a,s,r,l=wpLink.textarea;l&&(e=wpLink.getAttrs(),t=o.text.val(),e.href&&(n='<a href="'+e.href+'"',e.target&&(n+=' target="'+e.target+'"'),e.rel&&(n+=' rel="'+e.rel+'"'),n+=">",document.selection&&wpLink.range?(l.focus(),wpLink.range.text=n+(t||wpLink.range.text)+"</a>",wpLink.range.moveToBookmark(wpLink.range.getBookmark()),wpLink.range.select(),wpLink.range=null):"undefined"!=typeof l.selectionStart&&(i=l.selectionStart,a=l.selectionEnd,r=t||l.value.substring(i,a),n=n+r+"</a>",s=i+n.length,i!==a||r||(s-=4),l.value=l.value.substring(0,i)+n+l.value.substring(a,l.value.length),l.selectionStart=l.selectionEnd=s),wpLink.close(),l.focus()))},mceUpdate:function(){var e,t,a=wpLink.getAttrs();return wpLink.close(),i.focus(),tinymce.isIE&&i.selection.moveToBookmark(i.windowManager.bookmark),a.href?(e=n(),t=o.text.val(),void(e?(t&&("innerText"in e?e.innerText=t:e.textContent=t),i.dom.setAttribs(e,a)):t?i.selection.setNode(i.dom.create("a",a,t)):i.execCommand("mceInsertLink",!1,a))):void i.execCommand("unlink")},updateFields:function(e,t){o.url.val(t.children(".item-permalink").val())},setDefaultValues:function(){var e,t=/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i,n=/^(https?|ftp):\/\/[A-Z0-9.-]+\.[A-Z]{2,4}[^ "]*$/i;this.isMCE()?e=i.selection.getContent():document.selection&&wpLink.range?e=wpLink.range.text:"undefined"!=typeof this.textarea.selectionStart&&(e=this.textarea.value.substring(this.textarea.selectionStart,this.textarea.selectionEnd)),e&&t.test(e)?o.url.val("mailto:"+e):e&&n.test(e)?o.url.val(e.replace(/&amp;|&#0?38;/gi,"&")):o.url.val(""),o.submit.val(wpLinkL10n.save)},searchInternalLinks:function(){var e,n=t(this),i=n.val();if(i.length>2){if(c.recent.hide(),c.search.show(),wpLink.lastSearch==i)return;wpLink.lastSearch=i,e=n.parent().find(".spinner").addClass("is-active"),c.search.change(i),c.search.ajax(function(){e.removeClass("is-active")})}else c.search.hide(),c.recent.show()},next:function(){c.search.next(),c.recent.next()},prev:function(){c.search.prev(),c.recent.prev()},keydown:function(e){var n,i,a=t.ui.keyCode;a.ESCAPE===e.keyCode?(wpLink.close(),e.stopImmediatePropagation()):a.TAB===e.keyCode&&(i=e.target.id,"wp-link-submit"!==i||e.shiftKey?"wp-link-close"===i&&e.shiftKey&&(o.submit.focus(),e.preventDefault()):(o.close.focus(),e.preventDefault())),(e.keyCode===a.UP||e.keyCode===a.DOWN)&&(!document.activeElement||"link-title-field"!==document.activeElement.id&&"url-field"!==document.activeElement.id)&&(n=e.keyCode===a.UP?"prev":"next",clearInterval(wpLink.keyInterval),wpLink[n](),wpLink.keyInterval=setInterval(wpLink[n],wpLink.keySensitivity),e.preventDefault())},keyup:function(e){var n=t.ui.keyCode;(e.which===n.UP||e.which===n.DOWN)&&(clearInterval(wpLink.keyInterval),e.preventDefault())},delayedCallback:function(e,t){var n,i,a,s;return t?(setTimeout(function(){return i?e.apply(s,a):void(n=!0)},t),function(){return n?e.apply(this,arguments):(a=arguments,s=this,void(i=!0))}):e},toggleInternalLinking:function(e){var t=o.wrap.hasClass("search-panel-visible");o.wrap.toggleClass("search-panel-visible",!t),setUserSetting("wplink",t?"0":"1"),o[t?"url":"search"].focus(),e.preventDefault()}},s=function(e,n){var i=this;this.element=e,this.ul=e.children("ul"),this.contentHeight=e.children("#link-selector-height"),this.waiting=e.find(".river-waiting"),this.change(n),this.refresh(),t("#wp-link .query-results, #wp-link #link-selector").scroll(function(){i.maybeLoad()}),e.on("click","li",function(e){i.select(t(this),e)})},t.extend(s.prototype,{refresh:function(){this.deselect(),this.visible=this.element.is(":visible")},show:function(){this.visible||(this.deselect(),this.element.show(),this.visible=!0)},hide:function(){this.element.hide(),this.visible=!1},select:function(e,t){var n,i,a,s;e.hasClass("unselectable")||e==this.selected||(this.deselect(),this.selected=e.addClass("selected"),n=e.outerHeight(),i=this.element.height(),a=e.position().top,s=this.element.scrollTop(),0>a?this.element.scrollTop(s+a):a+n>i&&this.element.scrollTop(s+a-i+n),this.element.trigger("river-select",[e,t,this]))},deselect:function(){this.selected&&this.selected.removeClass("selected"),this.selected=!1},prev:function(){if(this.visible){var e;this.selected&&(e=this.selected.prev("li"),e.length&&this.select(e))}},next:function(){if(this.visible){var e=this.selected?this.selected.next("li"):t("li:not(.unselectable):first",this.element);e.length&&this.select(e)}},ajax:function(e){var t=this,n=1==this.query.page?0:wpLink.minRiverAJAXDuration,i=wpLink.delayedCallback(function(n,i){t.process(n,i),e&&e(n,i)},n);this.query.ajax(i)},change:function(e){this.query&&this._search==e||(this._search=e,this.query=new r(e),this.element.scrollTop(0))},process:function(e,n){var i="",a=!0,s="",r=1==n.page;e?t.each(e,function(){s=a?"alternate":"",s+=this.title?"":" no-title",i+=s?'<li class="'+s+'">':"<li>",i+='<input type="hidden" class="item-permalink" value="'+this.permalink+'" />',i+='<span class="item-title">',i+=this.title?this.title:wpLinkL10n.noTitle,i+='</span><span class="item-info">'+this.info+"</span></li>",a=!a}):r&&(i+='<li class="unselectable no-matches-found"><span class="item-title"><em>'+wpLinkL10n.noMatchesFound+"</em></span></li>"),this.ul[r?"html":"append"](i)},maybeLoad:function(){var e=this,t=this.element,n=t.scrollTop()+t.height();!this.query.ready()||n<this.contentHeight.height()-wpLink.riverBottomThreshold||setTimeout(function(){var n=t.scrollTop(),i=n+t.height();!e.query.ready()||i<e.contentHeight.height()-wpLink.riverBottomThreshold||(e.waiting.addClass("is-active"),t.scrollTop(n+e.waiting.outerHeight()),e.ajax(function(){e.waiting.removeClass("is-active")}))},wpLink.timeToTriggerRiver)}}),r=function(e){this.page=1,this.allLoaded=!1,this.querying=!1,this.search=e},t.extend(r.prototype,{ready:function(){return!(this.querying||this.allLoaded)},ajax:function(e){var n=this,i={action:"wp-link-ajax",page:this.page,_ajax_linking_nonce:o.nonce.val()};this.search&&(i.search=this.search),this.querying=!0,t.post(ajaxurl,i,function(t){n.page++,n.querying=!1,n.allLoaded=!t,e(t,i)},"json")}}),t(document).ready(wpLink.append),t(document).ready(wpLink.init)}(jQuery); 
Note: See TracChangeset for help on using the changeset viewer.