', {class: "next"}).append("Afficher plus d'éléments");
next.click(function () {
load();
});
res.append(next);
} else {
$me.find(".next").remove();
}
loading = false;
change();
});
};
var change = function () {
searching = setTimeout(function() {
// only search if the value has changed
var val2 = txt.val().trim().replace(/<>"/, '');
if (val2 != val) {
val = val2.trim().replace(/<>"/, '');
start = 0;
load();
}
}, 400 );
};
$me.append($('
').append(txt));
if (D.multi) {
$me.append('
Touche Maj pour ajouter plusieurs éléments
');
}
$me.append(res);
txt.bind( "keydown", function(event) {
// keypress is triggered before the input value is changed
clearTimeout(searching);
change();
});
load();
}
if (j.c.remove !== undefined) {
var D = j.c.remove;
$(this).click(function (e) {
e.preventDefault();
if (D.type == 'parent') {
$(this).closest(D.item).remove();
} else if (D.type == 'id') {
$(D.item).remove();
}
if (D.show !== undefined) {
$(D.show).show();
}
});
}
if (typeof j.c['f'] !== 'undefined') {
self[j.c.f]($(this));
}
}
});
$elt.find('form').each(function() {
var ajx = $(this).data("ajax");
if (ajx === true) {
$(this).append('
');
$(this).submit(function () {
if (typeof CKEDITOR !== "undefined") {
for (var instanceName in CKEDITOR.instances)
CKEDITOR.instances[instanceName].updateElement();
}
$.ajax({
type: "POST", data: $(this).serialize(), url: $(this).attr("action"),
success: function (obj) {
self.proceedResponse(obj);
}
});
return false;
});
}
});
$elt.find(".tooltip").each(function () {
$(this).wTooltip({style: { zIndex: "10000", maxWidth: "500px", fontSize: "14px", padding: "8px 12px",color: "#fff", background: "#7499b4", border: "none", borderRadius: "4px", MozBorderRadius: "4px", WebkitBorderRadius: "4px",MozBoxShadow: "2px 2px 2px rgba(30, 30, 30, 0.2)", WebkitBoxShadow: "2px 2px 2px rgba(30, 30, 30, 0.2)", boxShadow: "2px 2px 2px rgba(30, 30, 30, 0.2)" }});
});
},
addrow: function(o) {
var $tab = $('div.tableau' + o.table);
var $row = $(o.row);
$row.find('a.table-row-delete').click(function (e) {
e.preventDefault();
$(this).closest('tr').remove();
if ($tab.find('tr').length === 0) {
$tab.find('.table-empty').slideDown();
}
return false;
});
$tab.find('table').append($row);
$._kooneo.centerDialog(this.nbDialogs - 1);
$tab.find('.table-empty').slideUp();
},
table_newpage: function(o) {
this.table.current = o.page.current;
this.table.totaldata = o.page.totaldata;
var $c = $(o.page.content);
$._kooneo.init($c);
this.table.$tab.closest(".tableau").find(o.page.selector).append($c);
this.table.$tab.find(".tblp-more p").show();
this.table.$tab.find(".tblp-more .tblp-moreLoader").css({display: 'none'});
this.table.$tab.find(".tblp-counterPerc").html(o.page.percent + '%');
this.table.$tab.find(".tblp-counterProgress > div").width(o.page.percent + "%");
if (o.page.current >= this.table.countrows) {
this.table.$tab.find(".tblp-more").remove();
this.table.$tab.find(".fa-chevron-down").remove();
this.table.$tab.find(".tblp-selpage").unbind();
}
if (o.page.godown == 1) {
setTimeout(function() {
var pos = $(document).height() - $(window).height();
$("html, body").animate({ scrollTop: pos }, "fast");
}, 100);
}
},
tableLoadNextPage: function (godown = 0) {
var totaldata = this.table.totaldata;
var nb = this.table.nbperpage;
if (nb === undefined) nb = 20;
if (totaldata === undefined) {
totaldata = 0;
}
this.table.$tab.find(".tblp-more p").hide();
this.table.$tab.find(".tblp-more .tblp-moreLoader").css({display: 'inline-block'});
this.ajxPost(this.table.url, { action: 'table_nextpage', table_total: this.table.countrows,
table_current: this.table.current, table_totaldata: totaldata, godown: godown, tab_parpage: nb });
},
remove: function(o) {
$(o.id).remove();
},
table_settotal: function(o) {
this.tabletotaldata = o.page.totaldata;
},
table_checkall: function(p, $elt) {
if ($elt.prop("checked")) {
$(".chkboxtab").prop("checked", true);
} else {
$(".chkboxtab").prop("checked", false);
}
return true;
},
update_dynaselect: function(obj) {
$._kooneo.closedialog();
var html = '', $opt;
var elts = obj.elts;
for (var i in elts) {
$opt = $('
' + elts[i] + ' ').attr('value', i);
if (obj.sel == i) {
$opt.attr("selected", "selected");
}
html += $opt[0].outerHTML;
}
this.dynaselect_elt.html(html);
this.dynaselect_elt.trigger('change');
},
fill_email: function(obj) {
var $sel = $(obj.sel), edit = 'tiny_' + obj.editor;
$sel.find("input[name=exped" + obj.suffix + "]").val(obj.e.email);
$sel.find("input[name=nomexped" + obj.suffix + "]").val(obj.e.name);
$sel.find("input[name=sujet" + obj.suffix + "]").val(obj.e.subject);
CKEDITOR.instances[edit].setData(obj.e.html);
},
paramslist_number: function($p, varname) {
var pos = 0;
$p.find(".param_elt").each(function () {
var i = pos;
pos++;
var $n = $(this).find(".param_num");
$n.find("span").html(pos);
$n.find("input").attr("name", varname + "[" + i + "]");
});
},
paramslist_getelt: function ($sel, varname, k, value, type) {
var c = '', i = k + 1;
c += '
' + i + '
';
if ($sel !== false) {
if (type == 'select') {
var v = $sel.find("option[value='" + value + "']");
if (v.length) {
c += '
' + v.text() + '
';
} else {
return '';
}
} else {
c += '
' + value + '
';
$sel.val('');
c += '
';
}
c += '
';
}
c += '
';
return c;
},
paramslist_setdelete: function(c, $p, varname) {
var $c = $(c), self = this;
$c.find(".list-params-delelt").click(function () {
$(this).closest(".param_elt").remove();
self.paramslist_number($p, varname);
return false;
});
$c.find(".list-params-editelt").click(function () {
var $e = $(this).closest(".param_elt");
var $td = $e.find(".param_txt");
var $h = $e.find("input[type=hidden]");
$("#lpeditor_text").remove();
$td.append('
');
$("#lpeditor_text").css("font-size", $td.css("font-size")).css("font-family", $td.css("font-family")).val($h.val()).focus().
on("keypress", function(event){ if(event.keyCode == 13){ $h.val($(this).val()); $td.html($(this).val()); $(this).remove(); }}).
blur(function() { $(this).remove(); });
return false;
});
return $c;
},
paramslist_setlist: function(D, $self, $p, $sel) {
var i = 0;
var c = '
';
var self = this;
for (var k in D.default) {
var r = self.paramslist_getelt($sel, D.varname, i, D.default[k], D.type);
if (r !== '') {
c += r;
i++;
}
}
if (i === 0) {
c = '
La liste est vide, cliquez sur + pour ajouter un nouvel élément
';
$p.html(c);
} else {
c += '
';
var $r = self.paramslist_setdelete(c, $p, D.varname);
$p.html($r);
}
$self.data("params-count", i);
if ("undefined" !== typeof D.sortable && D.sortable) {
$p.sortable({items: '.param_elt', update: function(event, ui) { self.paramslist_number($p, D.varname); }});
}
},
reload: function(obj) {
var d = $(obj).data('kneo-w');
if (d !== undefined) {
var url = d.c.ajx.url, o = {};
if (typeof d.c.ajx['opts'] !== 'undefined') {
o = d.c.ajx['opts'];
}
this.ajxPost(url, o);
}
},
set_values: function(values) {
for (var id in values) {
$(id).val(values[id]);
}
},
proceedResponse: function(obj, callback) {
$(".dialog-button-confirm").attr("disabled", false).removeClass('waiting').find('.c-spin').remove();
if ("undefined" != typeof obj.status) {
if (obj.status === 'error') {
showErrorToast(obj.message);
return false;
}
if (callback !== undefined) {
callback(obj.params);
}
if (obj.action !== '') {
var A = obj.action;
for (var i in obj.action) {
if (A[i].m === 'core') {
$._kooneo[A[i].a](A[i].p);
} else if (A[i].m === 'c') {
this[A[i].a](A[i].p);
} else if (typeof $._kooneo.mods[A[i].m] !== "undefined") {
if (typeof $._kooneo.mods[A[i].m][A[i].a] === "function") {
$._kooneo.mods[A[i].m][A[i].a](A[i].p);
}
} else {
if (A[i].a == 'location.replace') {
window.location.replace(A[i].p);
} else {
var f = A[i].a.split('.'), F;
for (var j in f) {
if (j == 0) {
F = window[f[0]];
} else {
if (F !== undefined) {
F = F[f[j]].bind(F);
}
}
}
if (F !== undefined) {
F(A[i].p);
}
}
}
}
}
if (obj.message !== '') {
$._kooneo.successMsg(obj.message);
}
if ("undefined" !== typeof obj.params) {
for (var p in obj.params) {
if (p === 'core') {
$._kooneo[obj.params[p]]();
}
}
}
if ("undefined" !== typeof obj.content) {
var p, s;
for (var c in obj.content) {
p = c.slice(-1);
if (p === '+') {
s = c.slice(0, -1);
} else {
s = c;
}
if (c === 'popup') {
$._kooneo.setPopupContent(obj.content[c], obj.content['title']);
} else {
var $tag = $(s);
if (p === '+') {
var $el = $(obj.content[c]);
$tag.append($el);
$tag.closest(".tableau").find(".table-empty").remove();
$._kooneo.init($el);
} else {
$tag.html(obj.content[c]);
var dlg = $tag.closest('.ui-dialog-content');
if (dlg.length) {
var n = dlg.data('n');
this.centerDialog(n);
}
$._kooneo.init($tag);
}
}
}
}
}
},
ajxPost: function(url, opts, callback) {
var o = $.extend({}, opts),
self = this;
$._kooneo.openwait();
$.ajax({
type: "POST",
url: url,
data: o,
success: function(data) {
$._kooneo.closewait();
self.proceedResponse(data, callback);
},
error: function(jqXHR, textStatus, errorThrown) {
alert("Error, status = " + textStatus + ", " +
"error thrown: " + errorThrown
);
}
});
},
successMsg: function(msg) {
showSuccessToast(msg);
},
ueCookies: function() {
Cookies.set("ue_cookies", "accepted", { expires: 365, samesite: "None", secure: true });
$("#cookieBanner").fadeOut();
return false;
}
};
$._kooneo = new Kooneo();
$(document).ready(function() {
$._kooneo.startmodules($('body'));
$._kooneo.ready();
});
} (jQuery));
/*!
* JavaScript Cookie v2.1.3
* https://github.com/js-cookie/js-cookie
*
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
* Released under the MIT license
*/
(function (factory) {
var registeredInModuleLoader = false;
if (typeof define === 'function' && define.amd) {
define(factory);
registeredInModuleLoader = true;
}
if (typeof exports === 'object') {
module.exports = factory();
registeredInModuleLoader = true;
}
if (!registeredInModuleLoader) {
var OldCookies = window.Cookies;
var api = window.Cookies = factory();
api.noConflict = function () {
window.Cookies = OldCookies;
return api;
};
}
}(function () {
function extend () {
var i = 0;
var result = {};
for (; i < arguments.length; i++) {
var attributes = arguments[ i ];
for (var key in attributes) {
result[key] = attributes[key];
}
}
return result;
}
function init (converter) {
function api (key, value, attributes) {
var result;
if (typeof document === 'undefined') {
return;
}
// Write
if (arguments.length > 1) {
attributes = extend({
path: '/'
}, api.defaults, attributes);
if (typeof attributes.expires === 'number') {
var expires = new Date();
expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5);
attributes.expires = expires;
}
try {
result = JSON.stringify(value);
if (/^[\{\[]/.test(result)) {
value = result;
}
} catch (e) {}
if (!converter.write) {
value = encodeURIComponent(String(value))
.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
} else {
value = converter.write(value, key);
}
key = encodeURIComponent(String(key));
key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);
key = key.replace(/[\(\)]/g, escape);
return (document.cookie = [
key, '=', value,
attributes.expires ? '; expires=' + attributes.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
attributes.path ? '; path=' + attributes.path : '',
attributes.domain ? '; domain=' + attributes.domain : '',
attributes.samesite ? '; SameSite=' + attributes.samesite : '',
attributes.secure ? '; secure' : ''
].join(''));
}
// Read
if (!key) {
result = {};
}
// To prevent the for loop in the first place assign an empty array
// in case there are no cookies at all. Also prevents odd result when
// calling "get()"
var cookies = document.cookie ? document.cookie.split('; ') : [];
var rdecode = /(%[0-9A-Z]{2})+/g;
var i = 0;
for (; i < cookies.length; i++) {
var parts = cookies[i].split('=');
var cookie = parts.slice(1).join('=');
if (cookie.charAt(0) === '"') {
cookie = cookie.slice(1, -1);
}
try {
var name = parts[0].replace(rdecode, decodeURIComponent);
cookie = converter.read ?
converter.read(cookie, name) : converter(cookie, name) ||
cookie.replace(rdecode, decodeURIComponent);
if (this.json) {
try {
cookie = JSON.parse(cookie);
} catch (e) {}
}
if (key === name) {
result = cookie;
break;
}
if (!key) {
result[name] = cookie;
}
} catch (e) {}
}
return result;
}
api.set = api;
api.get = function (key) {
return api.call(api, key);
};
api.getJSON = function () {
return api.apply({
json: true
}, [].slice.call(arguments));
};
api.defaults = {};
api.remove = function (key, attributes) {
api(key, '', extend(attributes, {
expires: -1
}));
};
api.withConverter = init;
return api;
}
return init(function () {});
}));