You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
13 KiB
JavaScript
1 line
13 KiB
JavaScript
7 months ago
|
(()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var i in n)e.o(n,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:n[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=jQuery;!function(e,t,n){var i,l,a,s,r,o=/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,63}$/i,c=/^(https?|ftp):\/\/[A-Z0-9.-]+\.[A-Z]{2,63}[^ "]*$/i,p={},d={},u="ontouchend"in document;function h(){return i?i.$('a[data-wplink-edit="true"]'):null}window.wpLink={timeToTriggerRiver:150,minRiverAJAXDuration:200,riverBottomThreshold:5,keySensitivity:100,lastSearch:"",textarea:"",modalOpen:!1,init:function(){p.wrap=e("#wp-link-wrap"),p.dialog=e("#wp-link"),p.backdrop=e("#wp-link-backdrop"),p.submit=e("#wp-link-submit"),p.close=e("#wp-link-close");var n=e('<div class="link-nofollow"><label><span> </span> <input type="checkbox" id="wp-link-nofollow"> <code>'+t.relCheckbox+'</code></label></div><div class="link-sponsored"><label><span> </span> <input type="checkbox" id="wp-link-sponsored"> <code>'+t.sponsoredCheckbox+"</code></label></div><h4>"+t.schemaMarkupLabel+'</h4><div class="link-is-about"><label><span> </span> <input type="checkbox" id="wp-link-about"> <code>'+t.aboutCheckbox+'</code></label></div><div class="link-is-mentions"><label><span> </span> <input type="checkbox" id="wp-link-mentions"> <code>'+t.mentionsCheckbox+"</code></label></div>"),i=e('<div class="wp-link-title-field"> <label><span>'+t.linkTitle+'</span> <input id="wp-link-title" type="text"></label></div>');n.insertAfter("#wp-link .link-target"),i.insertAfter("#wp-link .wp-link-text-field"),e("#wp-link .query-results").css("top","290px"),p.text=e("#wp-link-text"),p.url=e("#wp-link-url"),p.nonce=e("#_ajax_linking_nonce"),p.openInNewTab=e("#wp-link-target"),p.search=e("#wp-link-search"),p.nofollow=e("#wp-link-nofollow"),p.sponsored=e("#wp-link-sponsored"),p.about=e("#wp-link-about"),p.mentions=e("#wp-link-mentions"),p.title=e("#wp-link-title"),d.search=new r(e("#search-results")),d.recent=new r(e("#most-recent-results")),d.elements=p.dialog.find(".query-results"),p.queryNotice=e("#query-notice-message"),p.queryNoticeTextDefault=p.queryNotice.find(".query-notice-default"),p.queryNoticeTextHint=p.queryNotice.find(".query-notice-hint"),p.dialog.on("keydown",(function(e){return wpLink.keydown(e)})),p.dialog.on("keyup",(function(e){return wpLink.keyup(e)})),p.submit.on("click",(function(e){e.preventDefault(),wpLink.update()})),p.close.add(p.backdrop).add("#wp-link-cancel button").on("click",(function(e){e.preventDefault(),wpLink.close()})),d.elements.on("river-select",wpLink.updateFields),p.search.on("focus.wplink",(function(){p.queryNoticeTextDefault.hide(),p.queryNoticeTextHint.removeClass("screen-reader-text").show()})).on("blur.wplink",(function(){p.queryNoticeTextDefault.show(),p.queryNoticeTextHint.addClass("screen-reader-text").hide()})),p.search.on("keyup input",(function(){window.clearTimeout(l),l=window.setTimeout((function(){wpLink.searchInternalLinks()}),500)})),p.url.on("paste",(function(){setTimeout(wpLink.correctURL,0)})),p.url.on("blur",wpLink.correctURL)},correctURL:function(){var t=e.trim(p.url.val());t&&a!==t&&!/^(?:[a-z]+:|#|\?|\.|\/)/.test(t)&&(p.url.val("http://"+t),a=t)},open:function(t,n,l){var a;"acf-link-textarea"===t?e(".wp-link-title-field").hide():e(".wp-link-title-field").show();var s=e(document.body);s.addClass("modal-open"),wpLink.modalOpen=!0,wpLink.range=null,t&&(window.wpActiveEditor=t),window.wpActiveEditor&&(this.textarea=e("#"+window.wpActiveEditor).get(0),void 0!==window.tinymce&&(s.append(p.backdrop,p.wrap),a=window.tinymce.get(window.wpActiveEditor),i=a&&!a.isHidden()?a:null),!wpLink.isMCE()&&document.selection&&(this.textarea.focus(),this.range=document.selection.createRange()),p.wrap.show(),p.backdrop.show(),wpLink.refresh(n,l),e(document).trigger("wplink-open",p.wrap))},isMCE:function(){return i&&!i.isHidden()},refresh:function(e,t){d.search.refresh(),d.recent.refresh(),wpLink.isMCE()?wpLink.mceRefresh(e,t):(p.wrap.hasClass("has-text-field")||p.wrap.addClass("has-text-field"),d
|