String.prototype.parameterize = function () { return this.trim().replace(/[^a-zA-Z0-9-\s]/g, '').replace(/[^a-zA-Z0-9-]/g, '-').toLowerCase(); }; Number.prototype.pad = function (size) { var s = String(this); while (s.length < (size || 2)) { s = "0" + s; } return s; }; // $(document).on('ajaxSend', function (event, request, settings) { // $('#ajax-indicator').fadeIn('fast'); // }); // // $(document).on('ajaxComplete', function (event, request, settings) { // $('#ajax-indicator').fadeOut('fast'); // }); window.Symphonia = { routes: {}, toggle: function (element, state) { if (typeof(state) === 'boolean') { if (state) { element.style.display = null; } else { element.style.display = 'none' } } else { window.Symphonia.toggle(element, (element.style.display === 'none')); } }, renderFlash: function (message, type) { var container = document.getElementById("flash_messages"); container.innerHTML = ""; var c = document.createElement("div"); c.setAttribute("class", "alert alert-" + (type || "success")); c.innerText = message.body || message.title; var b = document.createElement("button"); b.setAttribute("class", "fa fa-times-circle-o close"); b.dataset.dismiss = "alert"; c.appendChild(b); container.appendChild(c) } }