B4BY.588
Home
Terminal
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
sportmx
/
www
/
wp-content
/
plugins
/
rel-nofollow-checkbox
/
Filename :
wplink.min.js
back
Copy
/* rel-nofollow-checkbox v1.1.5 | GPLv2 License | by fabiosantos.me */ /* global ajaxurl, tinymce, wpLinkL10n, setUserSetting, wpActiveEditor */ var wpLink;!function(e,t,n){function i(){return c||a.dom.getParent(a.selection.getNode(),"a[href]")}var a,r,s,l,o,c,u=/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,63}$/i,p=/^(https?|ftp):\/\/[A-Z0-9.-]+\.[A-Z]{2,63}[^ "]*$/i,h={},d={},w="ontouchend"in document;wpLink={timeToTriggerRiver:150,minRiverAJAXDuration:200,riverBottomThreshold:5,keySensitivity:100,lastSearch:"",textarea:"",modalOpen:!1,init:function(){var t='<div><label><span> </span><input type="checkbox" id="rel-nofollow-checkbox" /><strong> rel="nofollow"</strong></label></div>';e(t).insertAfter("#wp-link .link-target"),h.wrap=e("#wp-link-wrap"),h.dialog=e("#wp-link"),h.backdrop=e("#wp-link-backdrop"),h.submit=e("#wp-link-submit"),h.close=e("#wp-link-close"),h.text=e("#wp-link-text"),h.url=e("#wp-link-url"),h.nonce=e("#_ajax_linking_nonce"),h.openInNewTab=e("#wp-link-target"),h.noFollow=e("#rel-nofollow-checkbox"),h.search=e("#wp-link-search"),d.search=new s(e("#search-results")),d.recent=new s(e("#most-recent-results")),d.elements=h.dialog.find(".query-results"),h.queryNotice=e("#query-notice-message"),h.queryNoticeTextDefault=h.queryNotice.find(".query-notice-default"),h.queryNoticeTextHint=h.queryNotice.find(".query-notice-hint"),h.dialog.keydown(wpLink.keydown),h.dialog.keyup(wpLink.keyup),h.submit.click(function(e){e.preventDefault(),wpLink.update()}),h.close.add(h.backdrop).add("#wp-link-cancel button").click(function(e){e.preventDefault(),wpLink.close()}),d.elements.on("river-select",wpLink.updateFields),h.search.on("focus.wplink",function(){h.queryNoticeTextDefault.hide(),h.queryNoticeTextHint.removeClass("screen-reader-text").show()}).on("blur.wplink",function(){h.queryNoticeTextDefault.show(),h.queryNoticeTextHint.addClass("screen-reader-text").hide()}),h.search.on("keyup input",function(){window.clearTimeout(r),r=window.setTimeout(function(){wpLink.searchInternalLinks()},500)}),h.url.on("paste",function(){setTimeout(wpLink.correctURL,0)}),h.url.on("blur",wpLink.correctURL)},correctURL:function(){var t=e.trim(h.url.val());t&&o!==t&&!/^(?:[a-z]+:|#|\?|\.|\/)/.test(t)&&(h.url.val("http://"+t),o=t)},open:function(t,n,i,r){var s,l=e(document.body);l.addClass("modal-open"),wpLink.modalOpen=!0,c=r,wpLink.range=null,t&&(window.wpActiveEditor=t),window.wpActiveEditor&&(this.textarea=e("#"+window.wpActiveEditor).get(0),"undefined"!=typeof window.tinymce&&(l.append(h.backdrop,h.wrap),s=window.tinymce.get(window.wpActiveEditor),a=s&&!s.isHidden()?s:null),!wpLink.isMCE()&&document.selection&&(this.textarea.focus(),this.range=document.selection.createRange()),h.wrap.show(),h.backdrop.show(),wpLink.refresh(n,i),e(document).trigger("wplink-open",h.wrap))},isMCE:function(){return a&&!a.isHidden()},refresh:function(e,t){var n="";d.search.refresh(),d.recent.refresh(),wpLink.isMCE()?wpLink.mceRefresh(e,t):(h.wrap.hasClass("has-text-field")||h.wrap.addClass("has-text-field"),document.selection?n=document.selection.createRange().text||t||"":"undefined"!=typeof this.textarea.selectionStart&&this.textarea.selectionStart!==this.textarea.selectionEnd&&(t=this.textarea.value.substring(this.textarea.selectionStart,this.textarea.selectionEnd)||t||""),h.text.val(t),wpLink.setDefaultValues()),w?h.url.focus().blur():window.setTimeout(function(){h.url[0].select(),h.url.focus()}),d.recent.ul.children().length||d.recent.ajax(),o=h.url.val().replace(/^http:\/\//,"")},hasSelectedText:function(e){var t,n,i,r=a.selection.getContent();if(/</.test(r)&&(!/^<a [^>]+>[^<]+<\/a>$/.test(r)||-1===r.indexOf("href=")))return!1;if(e){if(n=e.childNodes,0===n.length)return!1;for(i=n.length-1;i>=0;i--)if(t=n[i],3!=t.nodeType&&!window.tinymce.dom.BookmarkManager.isBookmarkNode(t))return!1}return!0},mceRefresh:function(n,r){var s,l,o=i(),c=this.hasSelectedText(o);o?(s=o.textContent||o.innerText,l=a.dom.getAttrib(o,"href"),e.trim(s)||(s=r||""),n&&(p.test(n)||u.test(n))&&(l=n),"_wp_link_placeholder"!==l?(h.url.val(l),h.openInNewTab.prop("checked","_blank"===a.dom.getAttrib(o,"target")),h.noFollow.prop("checked",-1!==a.dom.getAttrib(o,"rel").indexOf("nofollow")),h.submit.val(t.update)):this.setDefaultValues(s),n&&n!==l?h.search.val(n):h.search.val(""),window.setTimeout(function(){wpLink.searchInternalLinks()})):(s=a.selection.getContent({format:"text"})||r||"",this.setDefaultValues(s)),c?(h.text.val(s),h.wrap.addClass("has-text-field")):(h.text.val(""),h.wrap.removeClass("has-text-field"))},close:function(t){e(document.body).removeClass("modal-open"),wpLink.modalOpen=!1,"noReset"!==t&&(wpLink.isMCE()?(a.plugins.wplink&&a.plugins.wplink.close(),a.focus()):(wpLink.textarea.focus(),wpLink.range&&(wpLink.range.moveToBookmark(wpLink.range.getBookmark()),wpLink.range.select()))),h.backdrop.hide(),h.wrap.hide(),o=!1,e(document).trigger("wplink-close",h.wrap)},getAttrs:function(){return wpLink.correctURL(),{href:e.trim(h.url.val()),target:h.openInNewTab.prop("checked")?"_blank":null,rel:h.noFollow.prop("checked")?"nofollow":""}},buildHtml:function(e){var t='<a href="'+e.href+'"';return e.target&&(t+=' target="'+e.target+'"'),e.rel&&(t+=' rel="'+e.rel+'"'),t+">"},update:function(){wpLink.isMCE()?wpLink.mceUpdate():wpLink.htmlUpdate()},htmlUpdate:function(){var e,i,a,r,s,l,o,c=wpLink.textarea;c&&(e=wpLink.getAttrs(),i=h.text.val(),e.href&&(a=wpLink.buildHtml(e),document.selection&&wpLink.range?(c.focus(),wpLink.range.text=a+(i||wpLink.range.text)+"</a>",wpLink.range.moveToBookmark(wpLink.range.getBookmark()),wpLink.range.select(),wpLink.range=null):"undefined"!=typeof c.selectionStart&&(r=c.selectionStart,s=c.selectionEnd,o=i||c.value.substring(r,s),a=a+o+"</a>",l=r+a.length,r!==s||o||(l-=4),c.value=c.value.substring(0,r)+a+c.value.substring(s,c.value.length),c.selectionStart=c.selectionEnd=l),wpLink.close(),c.focus(),n.a11y.speak(t.linkInserted)))},mceUpdate:function(){var r,s,l,o,c=wpLink.getAttrs();return c.href?(r=a.$(i()),a.undoManager.transact(function(){r.length||(a.execCommand("mceInsertLink",!1,{href:"_wp_link_placeholder","data-wp-temp-link":1}),r=a.$('a[data-wp-temp-link="1"]').removeAttr("data-wp-temp-link"),l=e.trim(r.text())),r.length?(h.wrap.hasClass("has-text-field")&&(s=h.text.val(),s?r.text(s):l||r.text(c.href)),c["data-wplink-edit"]=null,c["data-mce-href"]=null,r.attr(c)):a.execCommand("unlink")}),wpLink.close("noReset"),a.focus(),r.length&&(o=r.parent("#_mce_caret"),o.length&&o.before(r.removeAttr("data-mce-bogus")),a.selection.select(r[0]),a.selection.collapse(),a.plugins.wplink&&a.plugins.wplink.checkLink(r[0])),a.nodeChanged(),void n.a11y.speak(t.linkInserted)):(a.execCommand("unlink"),void wpLink.close())},updateFields:function(e,t){h.url.val(t.children(".item-permalink").val())},getUrlFromSelection:function(t){return t||(this.isMCE()?t=a.selection.getContent({format:"text"}):document.selection&&wpLink.range?t=wpLink.range.text:"undefined"!=typeof this.textarea.selectionStart&&(t=this.textarea.value.substring(this.textarea.selectionStart,this.textarea.selectionEnd))),t=e.trim(t),t&&u.test(t)?"mailto:"+t:t&&p.test(t)?t.replace(/&|�?38;/gi,"&"):""},setDefaultValues:function(e){h.url.val(this.getUrlFromSelection(e)),h.search.val(""),wpLink.searchInternalLinks(),h.submit.val(t.save)},searchInternalLinks:function(){var e,t=h.search.val()||"";if(t.length>2){if(d.recent.hide(),d.search.show(),wpLink.lastSearch==t)return;wpLink.lastSearch=t,e=h.search.parent().find(".spinner").addClass("is-active"),d.search.change(t),d.search.ajax(function(){e.removeClass("is-active")})}else d.search.hide(),d.recent.show()},next:function(){d.search.next(),d.recent.next()},prev:function(){d.search.prev(),d.recent.prev()},keydown:function(e){var t,n;27===e.keyCode?(wpLink.close(),e.stopImmediatePropagation()):9===e.keyCode&&(n=e.target.id,"wp-link-submit"!==n||e.shiftKey?"wp-link-close"===n&&e.shiftKey&&(h.submit.focus(),e.preventDefault()):(h.close.focus(),e.preventDefault())),(38===e.keyCode||40===e.keyCode)&&(!document.activeElement||"link-title-field"!==document.activeElement.id&&"url-field"!==document.activeElement.id)&&(t=38===e.keyCode?"prev":"next",clearInterval(wpLink.keyInterval),wpLink[t](),wpLink.keyInterval=setInterval(wpLink[t],wpLink.keySensitivity),e.preventDefault())},keyup:function(e){(38===e.keyCode||40===e.keyCode)&&(clearInterval(wpLink.keyInterval),e.preventDefault())},delayedCallback:function(e,t){var n,i,a,r;return t?(setTimeout(function(){return i?e.apply(r,a):void(n=!0)},t),function(){return n?e.apply(this,arguments):(a=arguments,r=this,void(i=!0))}):e}},s=function(t,n){var i=this;this.element=t,this.ul=t.children("ul"),this.contentHeight=t.children("#link-selector-height"),this.waiting=t.find(".river-waiting"),this.change(n),this.refresh(),e("#wp-link .query-results, #wp-link #link-selector").scroll(function(){i.maybeLoad()}),t.on("click","li",function(t){i.select(e(this),t)})},e.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,r;e.hasClass("unselectable")||e==this.selected||(this.deselect(),this.selected=e.addClass("selected"),n=e.outerHeight(),i=this.element.height(),a=e.position().top,r=this.element.scrollTop(),0>a?this.element.scrollTop(r+a):a+n>i&&this.element.scrollTop(r+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 t=this.selected?this.selected.next("li"):e("li:not(.unselectable):first",this.element);t.length&&this.select(t)}},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 l(e),this.element.scrollTop(0))},process:function(n,i){var a="",r=!0,s="",l=1==i.page;n?e.each(n,function(){s=r?"alternate":"",s+=this.title?"":" no-title",a+=s?'<li class="'+s+'">':"<li>",a+='<input type="hidden" class="item-permalink" value="'+this.permalink+'" />',a+='<span class="item-title">',a+=this.title?this.title:t.noTitle,a+='</span><span class="item-info">'+this.info+"</span></li>",r=!r}):l&&(a+='<li class="unselectable no-matches-found"><span class="item-title"><em>'+t.noMatchesFound+"</em></span></li>"),this.ul[l?"html":"append"](a)},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)}}),l=function(e){this.page=1,this.allLoaded=!1,this.querying=!1,this.search=e},e.extend(l.prototype,{ready:function(){return!(this.querying||this.allLoaded)},ajax:function(t){var n=this,i={action:"wp-link-ajax",page:this.page,_ajax_linking_nonce:h.nonce.val()};this.search&&(i.search=this.search),this.querying=!0,e.post(window.ajaxurl,i,function(e){n.page++,n.querying=!1,n.allLoaded=!e,t(e,i)},"json")}}),e(document).ready(wpLink.init)}(jQuery,window.wpLinkL10n,window.wp);