|
|
|
|
|
|
|
|
"October", |
|
|
"October", |
|
|
"November", |
|
|
"November", |
|
|
"December" |
|
|
"December" |
|
|
] |
|
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
window.util = {}; |
|
|
window.util = {}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
notify.timeout = setTimeout(function() { |
|
|
notify.timeout = setTimeout(function() { |
|
|
elem.removeClass("active"); |
|
|
elem.removeClass("active"); |
|
|
}, 5000); |
|
|
}, 5000); |
|
|
} |
|
|
|
|
|
|
|
|
}; |
|
|
$(document).ready(function() { |
|
|
$(document).ready(function() { |
|
|
$("#notify-box").on("mouseenter", function() { |
|
|
$("#notify-box").on("mouseenter", function() { |
|
|
clearTimeout(util.notify.timeout); |
|
|
clearTimeout(util.notify.timeout); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
util.error = function(body) { |
|
|
util.error = function(body) { |
|
|
util.notify("Error: "+body); |
|
|
util.notify("Error: "+body); |
|
|
} |
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
util.htmlEntities = function(str) { |
|
|
util.htmlEntities = function(str) { |
|
|
return str.replace(/&/g, "&") |
|
|
return str.replace(/&/g, "&") |
|
|
.replace(/</g, "<") |
|
|
.replace(/</g, "<") |
|
|
.replace(/>/g, ">") |
|
|
.replace(/>/g, ">") |
|
|
.replace(/"/g, """); |
|
|
.replace(/"/g, """); |
|
|
} |
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
util.api = function(name, data, cb, getXhr) { |
|
|
util.api = function(name, data, cb, getXhr) { |
|
|
var fd = new FormData(); |
|
|
var fd = new FormData(); |
|
|
|
|
|
|
|
|
else |
|
|
else |
|
|
cb(res.error); |
|
|
cb(res.error); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
util.async = function(n, cb) { |
|
|
util.async = function(n, cb) { |
|
|
if (typeof n !== "number") |
|
|
if (typeof n !== "number") |
|
|
|
|
|
|
|
|
cb(res); |
|
|
cb(res); |
|
|
else |
|
|
else |
|
|
n -= 1; |
|
|
n -= 1; |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
util.pad = function(str, length, padChar) { |
|
|
util.pad = function(str, length, padChar) { |
|
|
var missing = (length - str.length) + 1; |
|
|
var missing = (length - str.length) + 1; |
|
|
|
|
|
|
|
|
return str; |
|
|
return str; |
|
|
|
|
|
|
|
|
return new Array(missing).join(padChar) + str; |
|
|
return new Array(missing).join(padChar) + str; |
|
|
} |
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
util.dateToString = function(date) { |
|
|
util.dateToString = function(date) { |
|
|
var day = util.pad(date.getDate().toString(), 2, "0"); |
|
|
var day = util.pad(date.getDate().toString(), 2, "0"); |
|
|
|
|
|
|
|
|
date.getFullYear()+", "+ |
|
|
date.getFullYear()+", "+ |
|
|
util.pad(date.getHours().toString(), 2, "0")+":"+ |
|
|
util.pad(date.getHours().toString(), 2, "0")+":"+ |
|
|
util.pad(date.getMinutes().toString(), 2, "0"); |
|
|
util.pad(date.getMinutes().toString(), 2, "0"); |
|
|
} |
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
util.prevent = function(evt) { |
|
|
util.prevent = function(evt) { |
|
|
evt.preventDefault(); |
|
|
evt.preventDefault(); |
|
|
evt.stopPropagation(); |
|
|
evt.stopPropagation(); |
|
|
} |
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
util.redirect = function(url, timeout) { |
|
|
util.redirect = function(url, timeout) { |
|
|
setTimeout(function() { |
|
|
setTimeout(function() { |
|
|
location.href = url; |
|
|
location.href = url; |
|
|
}, timeout || 1000); |
|
|
}, timeout || 1000); |
|
|
} |
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
window.display = {}; |
|
|
window.display = {}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
util.notify("Logged In", "You are now logged in."); |
|
|
util.notify("Logged In", "You are now logged in."); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
display.logIn = function() { |
|
|
display.logIn = function() { |
|
|
util.api("template?navbar-login", {}, function(err, res) { |
|
|
util.api("template?navbar-login", {}, function(err, res) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
util.notify("Logged Out", "You are now logged out."); |
|
|
util.notify("Logged Out", "You are now logged out."); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
$(document).ready(function() { |
|
|
$(document).ready(function() { |
|
|
$("#login-form").on("submit", function(evt) { |
|
|
$("#login-form").on("submit", function(evt) { |