| Current Path : /home/poneycluc/www/media/mod_advanced_cookies/js/ |
| Current File : /home/poneycluc/www/media/mod_advanced_cookies/js/admin.js |
/*
* jQuery file for the backend
*
* */
jQuery(document).ready(function ($) {
/* In the service area activate the all buttons with one button*/
const all_service_enable = jQuery("#jform_params_all_service1");
const all_service_disable = jQuery("#jform_params_all_service0");
const all_service_array = ['jform_params_service_google_analytics',
'jform_params_service_google_ads',
'jform_params_service_google_maps',
'jform_params_service_calameo',
'jform_params_service_recaptcha_v2',
'jform_params_service_recaptcha_v3',
'jform_params_service_chatbot',
'jform_params_service_mailchimp',
'jform_params_service_facebook',
'jform_params_service_twitter',
'jform_params_service_google_plus',
'jform_params_service_linkedin',
'jform_params_service_pinterest',
'jform_params_service_instagram',
'jform_params_service_youtube',
'jform_params_service_vimeo',
'jform_params_service_dailymotion'];
/*The function check the services if they are activated SHOW(), if not activated HIDE() the inputs of the service*/
all_service_enable.click(function () {
jQuery.each(all_service_array, function (key, value) {
switch_enable(value);
});
});
all_service_disable.click(function () {
jQuery.each(all_service_array, function (key, value) {
switch_disable(value);
});
});
function switch_enable(service) {
all_service_enable.click(function () {
jQuery('label[for*="' + service + '1"]').click().addClass('active', 'btn-success');
jQuery('label[for*="' + service + '0"]').removeClass('active', 'btn-danger');
});
}
function switch_disable(service) {
all_service_disable.click(function () {
jQuery('label[for*="' + service + '0"]').click().addClass('active', 'btn-danger');
jQuery('label[for*="' + service + '1"]').removeClass('active', 'btn-success');
});
}
/*
* This is a link to activate the Version Pro.
* It's generate a link in the backend to redirect the user to the site
* At the same time a variable with a value.
* It's verified in the default.php to show the Version Pro tab button
*/
var x1;
var pathArray = window.location.pathname.split('/');
var host = location.host;
if(host === "localhost") {
x1 = window.location.protocol + "//" + window.location.host + "/" + pathArray[1];
}else {
x1 = window.location.protocol + "//" + window.location.host;
}
var html = '<a target="_blank" href="'+x1+'?hob=90gl65pzqledzkcbzpr">Cliquez ici</a>';
jQuery('#jform_params_license2-lbl').html(html);
});