Sha256: cc6c60c47f2a9dabc0b9b78f3d634a0ad3d8b25aa4c9d7ada5e3da05e3fe6c2c
Contents?: true
Size: 1.66 KB
Versions: 12
Compression:
Stored size: 1.66 KB
Contents
I"“(function() { window.modal = { open: function(content) { var modal_html; this.close(); $("body").addClass("modal-open"); modal_html = $("<div class='modal'> <div class='modal-overlay'></div> <button class='modal-close'></button> <div class='modal-body'>" + content + "</div> </div>"); modal_html.find(".modal-overlay, .modal-close").click(function() { return modal.close(); }); $("body").append(modal_html); return $(document).trigger("page:load"); }, close: function() { $(".modal").remove(); return $("body").removeClass("modal-open"); }, xhrLoad: function(url) { var type; modal.open("Chargement..."); if (this.method) { type = this.method.toUpperCase(); } else { type = "GET"; } url = url || this.href || this.action || null; if (url === null) { modal.open("Invalid element"); return false; } $.ajax({ url: url, type: type, dataType: "html", success: function(data) { return modal.open(data); }, error: function() { return modal.open("Erreur"); } }); return false; }, setup: function(scope) { scope = $(scope || document); scope.find("a[data-modal=1], .modal-body a:not([data-modal=0])").off("click", modal.xhrLoad).on("click", modal.xhrLoad); return scope.find("form[data-modal=1], .modal-body form:not([data-modal=0])").off("submit", modal.xhrLoad).on("submit", modal.xhrLoad); } }; $(document).on("ready page:load", function() { return modal.setup(); }); }).call(this); :ET
Version data entries
12 entries across 6 versions & 1 rubygems