From 04ff67e26b880dde8bfb6462f312cf434457cd46 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 26 Nov 2016 16:00:52 -0500 Subject: Rewrite task move position component and remove Vuejs --- assets/js/core/kb.js | 58 ---------------------------------------------------- 1 file changed, 58 deletions(-) delete mode 100644 assets/js/core/kb.js (limited to 'assets/js/core/kb.js') diff --git a/assets/js/core/kb.js b/assets/js/core/kb.js deleted file mode 100644 index 8ed0e41c..00000000 --- a/assets/js/core/kb.js +++ /dev/null @@ -1,58 +0,0 @@ -var KB = { - components: {}, - utils: {}, - clickEvents: {} -}; - -KB.onClick = function (selector, callback) { - this.clickEvents[selector] = callback; -}; - -KB.listen = function () { - var self = this; - - function onClick(e) { - for (var selector in self.clickEvents) { - if (self.clickEvents.hasOwnProperty(selector) && e.target.matches(selector)) { - e.preventDefault(); - self.clickEvents[selector](e); - } - } - } - - document.addEventListener('click', onClick, false); -}; - -KB.component = function (name, object) { - this.components[name] = object; -}; - -KB.render = function () { - for (var name in this.components) { - var elementList = document.querySelectorAll('.js-' + name); - - for (var i = 0; i < elementList.length; i++) { - if (this.components.hasOwnProperty(name)) { - var object = this.components[name]; - var component = new object(elementList[i], JSON.parse(elementList[i].dataset.params)); - - component.render(); - elementList[i].className = elementList[i].className + '-rendered'; - } - } - } -}; - -KB.utils.formatDuration = function (d) { - if (d >= 86400) { - return Math.round(d/86400) + "d"; - } - else if (d >= 3600) { - return Math.round(d/3600) + "h"; - } - else if (d >= 60) { - return Math.round(d/60) + "m"; - } - - return d + "s"; -}; -- cgit v1.2.3