2018-05-18 08:28:27 +02:00
|
|
|
/**
|
|
|
|
* @package Joomla.Component.Builder
|
|
|
|
*
|
|
|
|
* @created 30th April, 2015
|
|
|
|
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
|
|
|
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
2019-02-23 15:28:54 +02:00
|
|
|
* @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
2018-05-18 08:28:27 +02:00
|
|
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
|
|
|
*/
|
2017-04-05 14:21:10 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2018-03-11 04:44:43 +02:00
|
|
|
|
2017-04-05 14:21:10 +01:00
|
|
|
jQuery(document).ready(function($)
|
|
|
|
{
|
|
|
|
// set button to add more languages
|
2017-10-26 18:43:51 +02:00
|
|
|
addButton('language','entranslation');
|
2017-04-05 14:21:10 +01:00
|
|
|
});
|
2017-10-16 19:14:23 +02:00
|
|
|
function addData(result,where){
|
2017-10-26 18:43:51 +02:00
|
|
|
jQuery(result).insertAfter(jQuery(where).closest('.control-group'));
|
2017-10-16 19:14:23 +02:00
|
|
|
}
|
2018-02-27 14:17:38 +02:00
|
|
|
|
2018-03-28 11:46:14 +02:00
|
|
|
function addButton_server(type, size){
|
2018-12-29 16:56:06 +02:00
|
|
|
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButton&format=json&raw=true&vdm="+vastDevMod);
|
2017-04-05 14:21:10 +01:00
|
|
|
if(token.length > 0 && type.length > 0){
|
2019-07-08 18:05:54 +02:00
|
|
|
var request = token+'=1&type='+type+'&size='+size;
|
2017-04-05 14:21:10 +01:00
|
|
|
}
|
|
|
|
return jQuery.ajax({
|
|
|
|
type: 'GET',
|
|
|
|
url: getUrl,
|
2018-12-29 16:56:06 +02:00
|
|
|
dataType: 'json',
|
2017-04-05 14:21:10 +01:00
|
|
|
data: request,
|
2018-12-29 16:56:06 +02:00
|
|
|
jsonp: false
|
2017-04-05 14:21:10 +01:00
|
|
|
});
|
|
|
|
}
|
2018-03-28 11:46:14 +02:00
|
|
|
function addButton(type, where, size){
|
|
|
|
// just to insure that default behaviour still works
|
|
|
|
size = typeof size !== 'undefined' ? size : 1;
|
|
|
|
addButton_server(type, size).done(function(result) {
|
2017-04-05 14:21:10 +01:00
|
|
|
if(result){
|
2018-03-28 11:46:14 +02:00
|
|
|
if (2 == size) {
|
|
|
|
jQuery('#'+where).html(result);
|
|
|
|
} else {
|
|
|
|
addData(result, '#jform_'+where);
|
|
|
|
}
|
2017-04-05 14:21:10 +01:00
|
|
|
}
|
2017-10-16 19:14:23 +02:00
|
|
|
})
|
2018-02-27 14:17:38 +02:00
|
|
|
}
|