|
@@ -1,34 +1,74 @@
|
|
|
-function Navigate(url){
|
|
|
- window.location=url;
|
|
|
+function Navigate(url) {
|
|
|
+ window.location = url;
|
|
|
}
|
|
|
|
|
|
function CreateCookie(name, value, days) {
|
|
|
- var expires;
|
|
|
- if (days) {
|
|
|
- var date = new Date();
|
|
|
- date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
|
|
- expires = "; expires=" + date.toGMTString();
|
|
|
- }
|
|
|
- else {
|
|
|
- expires = "";
|
|
|
- }
|
|
|
- document.cookie = name + "=" + value + expires + "; path=/";
|
|
|
+ var expires;
|
|
|
+ if (days) {
|
|
|
+ var date = new Date();
|
|
|
+ date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
|
|
+ expires = "; expires=" + date.toGMTString();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ expires = "";
|
|
|
+ }
|
|
|
+ document.cookie = name + "=" + value + expires + "; path=/";
|
|
|
}
|
|
|
|
|
|
function round(value, decimals) {
|
|
|
- return Number(Math.round(value+'e'+decimals)+'e-'+decimals);
|
|
|
+ return Number(Math.round(value + 'e' + decimals) + 'e-' + decimals);
|
|
|
+}
|
|
|
+
|
|
|
+function isNumber(value){
|
|
|
+ return isFinite(String(value));
|
|
|
+}
|
|
|
+
|
|
|
+String.prototype.upperCaseFirst = function() {
|
|
|
+ var lower = this.toLowerCase();
|
|
|
+ return lower.charAt(0).toUpperCase() + lower.slice(1);
|
|
|
+};
|
|
|
+
|
|
|
+function twoDigitZeroPad(input){
|
|
|
+ input=input.toString();
|
|
|
+ return [!input[1] && '0' || "", input].join('');
|
|
|
}
|
|
|
|
|
|
-$(function(){
|
|
|
- var panels=$("nav > dl > .sub-pages");
|
|
|
- var goIndicators=$("nav > dl > dt .go");
|
|
|
- var expandIndicators=$("nav > dl > dt .expand");
|
|
|
+Date.prototype.oldToString = Date.prototype.toString;
|
|
|
+Date.prototype.toString = function(format) {
|
|
|
+ if (!format)
|
|
|
+ return this.oldToString();
|
|
|
+ var me=this;
|
|
|
+ return format.replace(/./g, function(match) {
|
|
|
+ switch(match){
|
|
|
+ case 'd': return twoDigitZeroPad(me.getDate());
|
|
|
+ case 'm': return twoDigitZeroPad(me.getMonth()+1);
|
|
|
+ case 'y': return me.getFullYear();
|
|
|
+ case "H": return twoDigitZeroPad(me.getHours());
|
|
|
+ case "i": return twoDigitZeroPad(me.getMinutes());
|
|
|
+ case "s": return twoDigitZeroPad(me.getSeconds());
|
|
|
+ default: return match;
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+Number.prototype.oldToString=Number.prototype.toString;
|
|
|
+Number.prototype.toString=function(input, shouldRound){
|
|
|
+ if (!shouldRound)
|
|
|
+ return this.oldToString(input);
|
|
|
+
|
|
|
+ return round(this, input);
|
|
|
+};
|
|
|
+
|
|
|
+$(function() {
|
|
|
+ var panels = $("nav > dl > .sub-pages");
|
|
|
+ var goIndicators = $("nav > dl > dt .go");
|
|
|
+ var expandIndicators = $("nav > dl > dt .expand");
|
|
|
panels.hide();
|
|
|
expandIndicators.show();
|
|
|
-
|
|
|
- $("nav > dl > dt").click(function(e){
|
|
|
- var next=$(this).next();
|
|
|
- if (!next.hasClass("sub-pages") || next.is(":visible")){
|
|
|
+
|
|
|
+ $("nav > dl > dt").click(function(e) {
|
|
|
+ var next = $(this).next();
|
|
|
+ if (!next.hasClass("sub-pages") || next.is(":visible")) {
|
|
|
Navigate($(this).children("a").attr("href"));
|
|
|
return;
|
|
|
}
|
|
@@ -39,57 +79,57 @@ $(function(){
|
|
|
$(this).children(".go").show();
|
|
|
$(this).children(".expand").hide();
|
|
|
});
|
|
|
-
|
|
|
- $("nav > dl > dt").each(function(){
|
|
|
+
|
|
|
+ $("nav > dl > dt").each(function() {
|
|
|
if ($(this).next().hasClass("sub-pages"))
|
|
|
$(this).attr("title", "Click once to expand, click again to go");
|
|
|
});
|
|
|
|
|
|
- $("nav dd").click(function(e){
|
|
|
+ $("nav dd").click(function(e) {
|
|
|
Navigate($(this).children("a").attr("href"));
|
|
|
});
|
|
|
-
|
|
|
- $("nav a").click(function(e){
|
|
|
+
|
|
|
+ $("nav a").click(function(e) {
|
|
|
$(this).parent().click();
|
|
|
return false;
|
|
|
});
|
|
|
-
|
|
|
- $("#content").css("margin-bottom",window.innerHeight-$("#buttons").offset().top);
|
|
|
-
|
|
|
- $("form[ajaxForm]").submit(function(e){
|
|
|
+
|
|
|
+ $("#content").css("margin-bottom", window.innerHeight - $("#buttons").offset().top);
|
|
|
+
|
|
|
+ $("form[ajaxForm]").submit(function(e) {
|
|
|
e.preventDefault();
|
|
|
- form=$(this);
|
|
|
+ form = $(this);
|
|
|
$.ajax({
|
|
|
- url:form.attr("action"),
|
|
|
- method:form.attr("method"),
|
|
|
- data:form.serialize(),
|
|
|
- success:function(data){
|
|
|
- var successFunction=form.attr("onsuccess");
|
|
|
- if (successFunction!==undefined && window[successFunction]!==undefined)
|
|
|
+ url: form.attr("action"),
|
|
|
+ method: form.attr("method"),
|
|
|
+ data: form.serialize(),
|
|
|
+ success: function(data) {
|
|
|
+ var successFunction = form.attr("onsuccess");
|
|
|
+ if (successFunction !== undefined && window[successFunction] !== undefined)
|
|
|
window[successFunction](data);
|
|
|
},
|
|
|
- error:function(){
|
|
|
- var errorFunction=form.attr("onerror");
|
|
|
- if (errorFunction!==undefined && window[errorFunction]!==undefined)
|
|
|
+ error: function() {
|
|
|
+ var errorFunction = form.attr("onerror");
|
|
|
+ if (errorFunction !== undefined && window[errorFunction] !== undefined)
|
|
|
window[errorFunction]();
|
|
|
},
|
|
|
});
|
|
|
- var postFunction=form.attr("onpost");
|
|
|
- if (postFunction!==undefined && window[postFunction]!==undefined)
|
|
|
+ var postFunction = form.attr("onpost");
|
|
|
+ if (postFunction !== undefined && window[postFunction] !== undefined)
|
|
|
window[postFunction]();
|
|
|
});
|
|
|
-
|
|
|
- $("td").each(function(){
|
|
|
- var elem=$(this);
|
|
|
- if (/^[+-]?\d+(\.\d+)?$/.test(elem.text())){
|
|
|
+
|
|
|
+ $("td").each(function() {
|
|
|
+ var elem = $(this);
|
|
|
+ if (/^[+-]?\d+(\.\d+)?$/.test(elem.text())) {
|
|
|
elem.addClass("number");
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
-$(document).delegate('.allowTabInput', 'keydown', function (e) {
|
|
|
+$(document).delegate('.allowTabInput', 'keydown', function(e) {
|
|
|
var keyCode = e.keyCode || e.which;
|
|
|
-console.log(e);
|
|
|
+ console.log(e);
|
|
|
if (keyCode == 9) {
|
|
|
e.preventDefault();
|
|
|
var start = $(this).get(0).selectionStart;
|