|
|
@@ -92,6 +92,7 @@ var load = function () {
|
|
|
};
|
|
|
|
|
|
// Intercepte la soumision de formulaires
|
|
|
+ $("#main").off("submit", "form");
|
|
|
$("#main").on("submit", "form", function (event) {
|
|
|
console.log("handle submit");
|
|
|
|
|
|
@@ -116,11 +117,14 @@ var load = function () {
|
|
|
var data = { data: event.target.result };
|
|
|
var template = Handlebars.compile(section.html());
|
|
|
$("#main").html(template(data));
|
|
|
+
|
|
|
+
|
|
|
};
|
|
|
});
|
|
|
|
|
|
// Gere le clic sur un bouton supprimer
|
|
|
- $("body").on("click", ".del", function (event) {
|
|
|
+ $("#main").off("click", ".del");
|
|
|
+ $("#main").on("click", ".del", function (event) {
|
|
|
var del = $(this);
|
|
|
if (confirm("Supprimer la selection!") == true) {
|
|
|
|
|
|
@@ -146,11 +150,12 @@ var load = function () {
|
|
|
//$("#main").html(template({}));
|
|
|
$("#main").html(section.html());
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
load();
|
|
|
|
|
|
+
|
|
|
+
|
|
|
// Recharge dynamiquement le contenu HTML à chaque changement d'url
|
|
|
$(window).on('hashchange', function () {
|
|
|
console.log("Trigger: hashchange");
|
|
|
@@ -183,7 +188,6 @@ else {
|
|
|
|
|
|
/* retour haut de page*/
|
|
|
window.onscroll = function (ev) {
|
|
|
-
|
|
|
document.getElementById("back-top").className =(window.pageYOffset > 100) ? "": "hidden";
|
|
|
};
|
|
|
|
|
|
@@ -197,13 +201,20 @@ $(".toggle-sync-dlg").click(function () {
|
|
|
if ($(this).hasClass("modal-close")) location.reload();
|
|
|
});
|
|
|
|
|
|
-// Rend selectionables les lignes des tables (.selectable)
|
|
|
-$("#main").selectable({
|
|
|
- filter: ".selectable tr",
|
|
|
- stop: function () {
|
|
|
- $(".del").removeAttr("disabled");
|
|
|
- }
|
|
|
-});
|
|
|
+// Rend les lignes des tables .selectable selectionnables
|
|
|
+mo = new MutationObserver(function (mutations, observer) {
|
|
|
+
|
|
|
+ $(".selectable > tbody").bind("mousedown", function (e) {
|
|
|
+ e.metaKey = true;
|
|
|
+ }).selectable({
|
|
|
+ filter: "tr",
|
|
|
+ stop: function () {
|
|
|
+ console.log($(".ui-selected").length);
|
|
|
+ $(".del").prop('disabled', ($(".ui-selected").length == 0));
|
|
|
+ },
|
|
|
+ });
|
|
|
+})
|
|
|
+mo.observe(document.querySelector('#main'), { childList: true });
|
|
|
|
|
|
// ### Synchronisation des données
|
|
|
|
|
|
@@ -395,69 +406,3 @@ var formToJSON = function formToJSON(elements) {
|
|
|
}, {});
|
|
|
};
|
|
|
|
|
|
-
|
|
|
-///*
|
|
|
-// Intensify by TEMPLATED
|
|
|
-// templated.co @templatedco
|
|
|
-// Released for free under the Creative Commons Attribution 3.0 license (templated.co/license)
|
|
|
-//*/
|
|
|
-
|
|
|
-//(function ($) {
|
|
|
-
|
|
|
-// skel.breakpoints({
|
|
|
-// xlarge: '(max-width: 1680px)',
|
|
|
-// large: '(max-width: 1280px)',
|
|
|
-// medium: '(max-width: 980px)',
|
|
|
-// small: '(max-width: 736px)',
|
|
|
-// xsmall: '(max-width: 480px)'
|
|
|
-// });
|
|
|
-
|
|
|
-// $(function () {
|
|
|
-
|
|
|
-// var $window = $(window),
|
|
|
-// $body = $('body'),
|
|
|
-// $header = $('#header');
|
|
|
-
|
|
|
-// // Disable animations/transitions until the page has loaded.
|
|
|
-// $body.addClass('is-loading');
|
|
|
-
|
|
|
-// $window.on('load', function () {
|
|
|
-// window.setTimeout(function () {
|
|
|
-// $body.removeClass('is-loading');
|
|
|
-// }, 100);
|
|
|
-// });
|
|
|
-
|
|
|
-// // Fix: Placeholder polyfill.
|
|
|
-// $('form').placeholder();
|
|
|
-
|
|
|
-// // Prioritize "important" elements on medium.
|
|
|
-// skel.on('+medium -medium', function () {
|
|
|
-// $.prioritize(
|
|
|
-// '.important\\28 medium\\29',
|
|
|
-// skel.breakpoint('medium').active
|
|
|
-// );
|
|
|
-// });
|
|
|
-
|
|
|
-// // Scrolly.
|
|
|
-// $('.scrolly').scrolly({
|
|
|
-// offset: function () {
|
|
|
-// return $header.height();
|
|
|
-// }
|
|
|
-// });
|
|
|
-
|
|
|
-// // Menu.
|
|
|
-// $('#menu')
|
|
|
-// .append('<a href="#menu" class="close"></a>')
|
|
|
-// .appendTo($body)
|
|
|
-// .panel({
|
|
|
-// delay: 500,
|
|
|
-// hideOnClick: true,
|
|
|
-// hideOnSwipe: true,
|
|
|
-// resetScroll: true,
|
|
|
-// resetForms: true,
|
|
|
-// side: 'right'
|
|
|
-// });
|
|
|
-
|
|
|
-// });
|
|
|
-
|
|
|
-//})(jQuery);
|