30
1
mirror of https://github.com/joomla-extensions/weblinks.git synced 2024-06-03 06:50:49 +00:00
weblinks/src/media/com_weblinks/js/admin-weblinks-modal.min.js
2021-12-21 18:20:54 +07:00

1 line
878 B
JavaScript

!function(){"use strict";window.jSelectWeblink=function(t,e,n,a,r,i){var o,l="";if(!Joomla.getOptions("xtd-weblinks"))return window.parent.Joomla.Modal.getCurrent().close(),!1;o=Joomla.getOptions("xtd-weblinks").editor,""!==i&&(l=' hreflang="'+i+'"'),e="<a"+l+' href="'+r+'">'+e+"</a>",window.parent.Joomla.editors.instances[o].replaceSelection(e),window.parent.Joomla.Modal.getCurrent().close()},document.addEventListener("DOMContentLoaded",function(){for(var t=document.querySelectorAll(".select-link"),e=0,n=t.length;e<n;e++)t[e].addEventListener("click",function(t){t.preventDefault();var e=t.target.getAttribute("data-function");("jSelectWeblink"===e?window:window.parent)[e](t.target.getAttribute("data-id"),t.target.getAttribute("data-title"),t.target.getAttribute("data-cat-id"),null,t.target.getAttribute("data-uri"),t.target.getAttribute("data-language",null))})})}();