diff --git a/src/administrator/manifests/packages/pkg_weblinks.xml b/src/administrator/manifests/packages/pkg_weblinks.xml
index 7fcc815..35dc053 100644
--- a/src/administrator/manifests/packages/pkg_weblinks.xml
+++ b/src/administrator/manifests/packages/pkg_weblinks.xml
@@ -21,6 +21,7 @@
plg_finder_weblinks.zip
plg_search_weblinks.zip
plg_system_weblinks.zip
+ plg_editors-xtd_weblink.zip
en-GB/en-GB.pkg_weblinks.sys.ini
diff --git a/src/media/com_weblinks/js/admin-weblinks-modal.js b/src/media/com_weblinks/js/admin-weblinks-modal.js
index e29bde7..0ba5441 100644
--- a/src/media/com_weblinks/js/admin-weblinks-modal.js
+++ b/src/media/com_weblinks/js/admin-weblinks-modal.js
@@ -1,5 +1,5 @@
/**
- * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
+ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
(function() {
@@ -49,7 +49,7 @@
var functionName = event.target.getAttribute('data-function');
if (functionName === 'jSelectWeblink') {
- // Used in xtd_contacts
+ // Used in xtd_weblinks
window[functionName](event.target.getAttribute('data-id'), event.target.getAttribute('data-title'), event.target.getAttribute('data-cat-id'), null, event.target.getAttribute('data-uri'), event.target.getAttribute('data-language', null));
} else {
// Used in com_menus
diff --git a/src/media/com_weblinks/js/admin-weblinks-modal.min.js b/src/media/com_weblinks/js/admin-weblinks-modal.min.js
index e29bde7..dcc3689 100644
--- a/src/media/com_weblinks/js/admin-weblinks-modal.min.js
+++ b/src/media/com_weblinks/js/admin-weblinks-modal.min.js
@@ -1,61 +1 @@
-/**
- * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
- * @license GNU General Public License version 2 or later; see LICENSE.txt
- */
-(function() {
- "use strict";
- /**
- * Javascript to insert the link
- * View element calls jSelectWeblink when an weblink is clicked
- * jSelectWeblink creates the link tag, sends it to the editor,
- * and closes the select frame.
- **/
- window.jSelectWeblink = function (id, title, catid, object, link, lang) {
- var hreflang = '', editor, tag;
-
- if (!Joomla.getOptions('xtd-weblinks')) {
- // Something went wrong!
- window.parent.jModalClose();
- return false;
- }
-
- editor = Joomla.getOptions('xtd-weblinks').editor;
-
- if (lang !== '')
- {
- hreflang = ' hreflang="' + lang + '"';
- }
-
- tag = '' + title + '';
-
- /** Use the API, if editor supports it **/
- if (window.Joomla && window.Joomla.editors && Joomla.editors.instances && Joomla.editors.instances.hasOwnProperty(editor)) {
- Joomla.editors.instances[editor].replaceSelection(tag)
- } else {
- window.parent.jInsertEditorText(tag, editor);
- }
-
- window.parent.jModalClose();
- };
-
- document.addEventListener('DOMContentLoaded', function(){
- // Get the elements
- var elements = document.querySelectorAll('.select-link');
-
- for(var i = 0, l = elements.length; l>i; i++) {
- // Listen for click event
- elements[i].addEventListener('click', function (event) {
- event.preventDefault();
- var functionName = event.target.getAttribute('data-function');
-
- if (functionName === 'jSelectWeblink') {
- // Used in xtd_contacts
- window[functionName](event.target.getAttribute('data-id'), event.target.getAttribute('data-title'), event.target.getAttribute('data-cat-id'), null, event.target.getAttribute('data-uri'), event.target.getAttribute('data-language', null));
- } else {
- // Used in com_menus
- window.parent[functionName](event.target.getAttribute('data-id'), event.target.getAttribute('data-title'), event.target.getAttribute('data-cat-id'), null, event.target.getAttribute('data-uri'), event.target.getAttribute('data-language', null));
- }
- })
- }
- });
-})();
+!function(){"use strict";window.jSelectWeblink=function(a,b,c,d,e,f){var h,i,g="";if(!Joomla.getOptions("xtd-weblinks"))return window.parent.jModalClose(),!1;h=Joomla.getOptions("xtd-weblinks").editor,""!==f&&(g=' hreflang="'+f+'"'),i="'+b+"",window.Joomla&&window.Joomla.editors&&Joomla.editors.instances&&Joomla.editors.instances.hasOwnProperty(h)?Joomla.editors.instances[h].replaceSelection(i):window.parent.jInsertEditorText(i,h),window.parent.jModalClose()},document.addEventListener("DOMContentLoaded",function(){for(var a=document.querySelectorAll(".select-link"),b=0,c=a.length;c>b;b++)a[b].addEventListener("click",function(a){a.preventDefault();var b=a.target.getAttribute("data-function");"jSelectWeblink"===b?window[b](a.target.getAttribute("data-id"),a.target.getAttribute("data-title"),a.target.getAttribute("data-cat-id"),null,a.target.getAttribute("data-uri"),a.target.getAttribute("data-language",null)):window.parent[b](a.target.getAttribute("data-id"),a.target.getAttribute("data-title"),a.target.getAttribute("data-cat-id"),null,a.target.getAttribute("data-uri"),a.target.getAttribute("data-language",null))})})}();
\ No newline at end of file
diff --git a/src/plugins/editors-xtd/weblink/language/en-GB/en-GB.plg_editors-xtd_weblink.ini b/src/plugins/editors-xtd/weblink/language/en-GB/en-GB.plg_editors-xtd_weblink.ini
new file mode 100644
index 0000000..471be69
--- /dev/null
+++ b/src/plugins/editors-xtd/weblink/language/en-GB/en-GB.plg_editors-xtd_weblink.ini
@@ -0,0 +1,8 @@
+; Joomla! Project
+; Copyright (C) 2005 - 2017 Open Source Matters. All rights reserved.
+; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
+; Note : All ini files need to be saved as UTF-8
+
+PLG_EDITORS-XTD_WEBLINK="Button - Web Link"
+PLG_EDITORS-XTD_WEBLINK_BUTTON_WEBLINK="Web Link"
+PLG_EDITORS-XTD_WEBLINK_XML_DESCRIPTION="Displays a button to make it possible to insert web links into an Article. Displays a popup allowing you to choose the web link."
diff --git a/src/plugins/editors-xtd/weblink/language/en-GB/en-GB.plg_editors-xtd_weblink.sys.ini b/src/plugins/editors-xtd/weblink/language/en-GB/en-GB.plg_editors-xtd_weblink.sys.ini
new file mode 100644
index 0000000..c644667
--- /dev/null
+++ b/src/plugins/editors-xtd/weblink/language/en-GB/en-GB.plg_editors-xtd_weblink.sys.ini
@@ -0,0 +1,7 @@
+; Joomla! Project
+; Copyright (C) 2005 - 2017 Open Source Matters. All rights reserved.
+; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
+; Note : All ini files need to be saved as UTF-8
+
+PLG_EDITORS-XTD_WEBLINK="Button - Web Link"
+PLG_EDITORS-XTD_WEBLINK_XML_DESCRIPTION="Displays a button to make it possible to insert web links into an Article. Displays a popup allowing you to choose the web link."
diff --git a/src/plugins/editors-xtd/weblink/weblink.php b/src/plugins/editors-xtd/weblink/weblink.php
new file mode 100644
index 0000000..90ea9b4
--- /dev/null
+++ b/src/plugins/editors-xtd/weblink/weblink.php
@@ -0,0 +1,59 @@
+authorise('core.create', 'com_weblinks')
+ || $user->authorise('core.edit', 'com_weblinks')
+ || $user->authorise('core.edit.own', 'com_weblinks'))
+ {
+ // The URL for the weblinks list
+ $link = 'index.php?option=com_weblinks&view=weblinks&layout=modal&tmpl=component&'
+ . JSession::getFormToken() . '=1&editor=' . $name;
+
+ $button = new JObject;
+ $button->modal = true;
+ $button->class = 'btn';
+ $button->link = $link;
+ $button->text = JText::_('PLG_EDITORS-XTD_WEBLINK_BUTTON_WEBLINK');
+ $button->name = 'link';
+ $button->options = "{handler: 'iframe', size: {x: 800, y: 500}}";
+
+ return $button;
+ }
+ }
+}
diff --git a/src/plugins/editors-xtd/weblink/weblink.xml b/src/plugins/editors-xtd/weblink/weblink.xml
new file mode 100644
index 0000000..29c425a
--- /dev/null
+++ b/src/plugins/editors-xtd/weblink/weblink.xml
@@ -0,0 +1,18 @@
+
+
+ plg_editors-xtd_weblink
+ Joomla! Project
+ ##DATE##
+ Copyright (C) 2005 - 2017 Open Source Matters. All rights reserved.
+ GNU General Public License version 2 or later; see LICENSE.txt
+ admin@joomla.org
+ www.joomla.org
+ 3.7.0
+ PLG_EDITORS-XTD_WEBLINK_XML_DESCRIPTION
+
+ ##FILES##
+
+
+ ##LANGUAGE_FILES##
+
+