Minifying js and adding xtd-editors web link
This commit is contained in:
parent
75684b9918
commit
3151bf9c8f
|
@ -21,6 +21,7 @@
|
||||||
<file type="plugin" id="weblinks" group="finder">plg_finder_weblinks.zip</file>
|
<file type="plugin" id="weblinks" group="finder">plg_finder_weblinks.zip</file>
|
||||||
<file type="plugin" id="weblinks" group="search">plg_search_weblinks.zip</file>
|
<file type="plugin" id="weblinks" group="search">plg_search_weblinks.zip</file>
|
||||||
<file type="plugin" id="weblinks" group="system">plg_system_weblinks.zip</file>
|
<file type="plugin" id="weblinks" group="system">plg_system_weblinks.zip</file>
|
||||||
|
<file type="plugin" id="weblinks" group="editors-xtd">plg_editors-xtd_weblink.zip</file>
|
||||||
</files>
|
</files>
|
||||||
<languages folder="language">
|
<languages folder="language">
|
||||||
<language tag="en-GB">en-GB/en-GB.pkg_weblinks.sys.ini</language>
|
<language tag="en-GB">en-GB/en-GB.pkg_weblinks.sys.ini</language>
|
||||||
|
|
|
@ -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
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
*/
|
*/
|
||||||
(function() {
|
(function() {
|
||||||
|
@ -49,7 +49,7 @@
|
||||||
var functionName = event.target.getAttribute('data-function');
|
var functionName = event.target.getAttribute('data-function');
|
||||||
|
|
||||||
if (functionName === 'jSelectWeblink') {
|
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));
|
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 {
|
} else {
|
||||||
// Used in com_menus
|
// Used in com_menus
|
||||||
|
|
|
@ -1,61 +1 @@
|
||||||
/**
|
!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="<a"+g+' href="'+e+'">'+b+"</a>",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))})})}();
|
||||||
* @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 = '<a' + hreflang + ' href="' + link + '">' + title + '</a>';
|
|
||||||
|
|
||||||
/** 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));
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
});
|
|
||||||
})();
|
|
|
@ -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."
|
|
@ -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."
|
|
@ -0,0 +1,59 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Plugin
|
||||||
|
* @subpackage Editors-xtd.weblink
|
||||||
|
*
|
||||||
|
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Editor WEb Link button
|
||||||
|
*
|
||||||
|
* @since __DEPLOY_VERSION__
|
||||||
|
*/
|
||||||
|
class PlgButtonWeblink extends JPlugin
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Load the language file on instantiation.
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
* @since __DEPLOY_VERSION__
|
||||||
|
*/
|
||||||
|
protected $autoloadLanguage = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the button
|
||||||
|
*
|
||||||
|
* @param string $name The name of the button to add
|
||||||
|
*
|
||||||
|
* @return JObject The button options as JObject
|
||||||
|
*
|
||||||
|
* @since __DEPLOY_VERSION__
|
||||||
|
*/
|
||||||
|
public function onDisplay($name)
|
||||||
|
{
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
|
||||||
|
if ($user->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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<extension version="3.7" type="plugin" group="editors-xtd" method="upgrade">
|
||||||
|
<name>plg_editors-xtd_weblink</name>
|
||||||
|
<author>Joomla! Project</author>
|
||||||
|
<creationDate>##DATE##</creationDate>
|
||||||
|
<copyright>Copyright (C) 2005 - 2017 Open Source Matters. All rights reserved.</copyright>
|
||||||
|
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||||
|
<authorEmail>admin@joomla.org</authorEmail>
|
||||||
|
<authorUrl>www.joomla.org</authorUrl>
|
||||||
|
<version>3.7.0</version>
|
||||||
|
<description>PLG_EDITORS-XTD_WEBLINK_XML_DESCRIPTION</description>
|
||||||
|
<files>
|
||||||
|
##FILES##
|
||||||
|
</files>
|
||||||
|
<languages folder="language">
|
||||||
|
##LANGUAGE_FILES##
|
||||||
|
</languages>
|
||||||
|
</extension>
|
Loading…
Reference in New Issue