Mithril as main method

This commit is contained in:
2017-10-25 12:08:41 +07:00
parent 6040809710
commit d1d5ee1b0c
157 changed files with 19593 additions and 716 deletions

View File

@@ -0,0 +1,17 @@
module.exports = {
get: function(cname) {
var name = cname + "=";
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(';');
for(var i = 0; i <ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
}

View File

@@ -0,0 +1,32 @@
var fitText = {
fitAll: function(cl) {
var elFS, elH
cl = document.getElementsByClassName(cl)
var h = window.innerHeight
|| document.documentElement.clientHeight
|| document.body.clientHeight
// console.log(h, window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight);
for (var i = 0; i < cl.length; i++) {
elFS = parseInt(window.getComputedStyle(cl[i].children[0]).fontSize)
cl[i].children[0].style.fontSize = elFS + 'px'
elH = parseInt(window.getComputedStyle(cl[i].children[0]).height)
while (elH < h - (h*.15)) {
elFS++
cl[i].children[0].style.fontSize = elFS + 'px'
elH = parseInt(window.getComputedStyle(cl[i].children[0]).height)
}
while (elH > h - (h*.15)) {
elFS--
cl[i].children[0].style.fontSize = elFS + 'px'
elH = parseInt(window.getComputedStyle(cl[i].children[0]).height)
}
}
return true
}
}
module.exports = fitText

View File

@@ -0,0 +1,25 @@
let user = require('../models/user')
var idleTimeout = {
timeoutId: 0,
setup: function() {
window.addEventListener("mousemove", idleTimeout.resetTimer, false);
window.addEventListener("mousedown", idleTimeout.resetTimer, false);
window.addEventListener("keypress", idleTimeout.resetTimer, false);
window.addEventListener("DOMMouseScroll", idleTimeout.resetTimer, false);
window.addEventListener("mousewheel", idleTimeout.resetTimer, false);
window.addEventListener("touchmove", idleTimeout.resetTimer, false);
window.addEventListener("MSPointerMove", idleTimeout.resetTimer, false);
idleTimeout.startTimer();
},
startTimer: function() {
idleTimeout.timeoutId = window.setTimeout(user.logout, 60000*5);
},
resetTimer: function() {
window.clearTimeout(idleTimeout.timeoutId);
idleTimeout.startTimer();
}
}
module.exports = idleTimeout