mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-06-05 09:23:40 -04:00
More refactorings.
This commit is contained in:
parent
4c1ed3d1e8
commit
caced60eaa
10 changed files with 150 additions and 165 deletions
|
@ -16,5 +16,5 @@ release.dir = release
|
||||||
|
|
||||||
|
|
||||||
# tools
|
# tools
|
||||||
wepp = tools/wepp
|
tool.wepp = tools/wepp
|
||||||
|
|
||||||
|
|
|
@ -99,18 +99,14 @@ H5aiJs.factory.Extended = function () {
|
||||||
|
|
||||||
$(".folderCount").text($("#extended .entry.folder:not(.parentfolder)").size());
|
$(".folderCount").text($("#extended .entry.folder:not(.parentfolder)").size());
|
||||||
$(".fileCount").text($("#extended .entry.file").size());
|
$(".fileCount").text($("#extended .entry.file").size());
|
||||||
},
|
|
||||||
init = function () {
|
|
||||||
|
|
||||||
initTitle();
|
|
||||||
initBreadcrumb();
|
|
||||||
initExtendedView();
|
|
||||||
customize();
|
|
||||||
initCounts();
|
|
||||||
},
|
|
||||||
extended = {
|
|
||||||
init: init
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return extended;
|
this.init = function () {
|
||||||
|
|
||||||
|
initTitle();
|
||||||
|
initBreadcrumb();
|
||||||
|
initExtendedView();
|
||||||
|
customize();
|
||||||
|
initCounts();
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
H5aiJs.factory.H5ai = function (options, langs) {
|
H5aiJs.factory.H5ai = function (options, langs) {
|
||||||
|
|
||||||
var defaults = {
|
var $window = $(window),
|
||||||
|
defaults = {
|
||||||
store: {
|
store: {
|
||||||
viewmode: "h5ai.viewmode",
|
viewmode: "h5ai.viewmode",
|
||||||
lang: "h5ai.lang"
|
lang: "h5ai.lang"
|
||||||
|
@ -41,7 +42,7 @@ H5aiJs.factory.H5ai = function (options, langs) {
|
||||||
triggerPathClick = function (path, context) {
|
triggerPathClick = function (path, context) {
|
||||||
|
|
||||||
$.each(settings.callbacks.pathClick, function (idx, callback) {
|
$.each(settings.callbacks.pathClick, function (idx, callback) {
|
||||||
callback.call(window, path, context);
|
callback(path, context);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getViewmode = function () {
|
getViewmode = function () {
|
||||||
|
@ -82,7 +83,7 @@ H5aiJs.factory.H5ai = function (options, langs) {
|
||||||
|
|
||||||
var adjustTopSpace = function () {
|
var adjustTopSpace = function () {
|
||||||
|
|
||||||
var winHeight = $(window).height(),
|
var winHeight = $window.height(),
|
||||||
navHeight = $("body > nav").outerHeight(),
|
navHeight = $("body > nav").outerHeight(),
|
||||||
footerHeight = $("body > footer").outerHeight(),
|
footerHeight = $("body > footer").outerHeight(),
|
||||||
contentSpacing = 50,
|
contentSpacing = 50,
|
||||||
|
@ -103,7 +104,7 @@ H5aiJs.factory.H5ai = function (options, langs) {
|
||||||
} catch (err) {}
|
} catch (err) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
$(window).resize(function () {
|
$window.resize(function () {
|
||||||
adjustTopSpace();
|
adjustTopSpace();
|
||||||
});
|
});
|
||||||
adjustTopSpace();
|
adjustTopSpace();
|
||||||
|
@ -141,7 +142,7 @@ H5aiJs.factory.H5ai = function (options, langs) {
|
||||||
$(".status.default").show();
|
$(".status.default").show();
|
||||||
$(".status.dynamic").empty().hide();
|
$(".status.dynamic").empty().hide();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
shiftTree = function (forceVisible, dontAnimate) {
|
shiftTree = function (forceVisible, dontAnimate) {
|
||||||
|
|
||||||
|
@ -168,7 +169,7 @@ H5aiJs.factory.H5ai = function (options, langs) {
|
||||||
function () { shiftTree(true); },
|
function () { shiftTree(true); },
|
||||||
function () { shiftTree(); }
|
function () { shiftTree(); }
|
||||||
);
|
);
|
||||||
$(window).resize(function () { shiftTree(); });
|
$window.resize(function () { shiftTree(); });
|
||||||
shiftTree(false, true);
|
shiftTree(false, true);
|
||||||
},
|
},
|
||||||
linkHoverStates = function () {
|
linkHoverStates = function () {
|
||||||
|
@ -266,7 +267,9 @@ H5aiJs.factory.H5ai = function (options, langs) {
|
||||||
$indicator.addClass("open");
|
$indicator.addClass("open");
|
||||||
$entry.find("> .content").replaceWith($content);
|
$entry.find("> .content").replaceWith($content);
|
||||||
$("#tree").get(0).updateScrollbar();
|
$("#tree").get(0).updateScrollbar();
|
||||||
initIndicators();
|
$content.find(".indicator:not(.initiated)")
|
||||||
|
.click(onIndicatorClick)
|
||||||
|
.addClass("initiated");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if ($indicator.hasClass("open")) {
|
} else if ($indicator.hasClass("open")) {
|
||||||
|
@ -285,16 +288,14 @@ H5aiJs.factory.H5ai = function (options, langs) {
|
||||||
},
|
},
|
||||||
initIndicators = function () {
|
initIndicators = function () {
|
||||||
|
|
||||||
$("#tree .entry.folder .indicator:not(.initiated)").each(function () {
|
$("#tree .entry.folder .indicator:not(.initiated)")
|
||||||
|
.click(onIndicatorClick)
|
||||||
$(this).addClass("initiated").click(onIndicatorClick);
|
.addClass("initiated");
|
||||||
});
|
|
||||||
},
|
},
|
||||||
initZippedDownload = function () {
|
initZippedDownload = function () {
|
||||||
|
|
||||||
var x = 0,
|
var x = 0,
|
||||||
y = 0,
|
y = 0,
|
||||||
$window = $(window),
|
|
||||||
selected = function (hrefs) {
|
selected = function (hrefs) {
|
||||||
|
|
||||||
var query, idx;
|
var query, idx;
|
||||||
|
@ -377,16 +378,15 @@ H5aiJs.factory.H5ai = function (options, langs) {
|
||||||
localize(langs, settings.lang, settings.useBrowserLang);
|
localize(langs, settings.lang, settings.useBrowserLang);
|
||||||
initIndicators();
|
initIndicators();
|
||||||
initZippedDownload();
|
initZippedDownload();
|
||||||
},
|
|
||||||
h5ai = {
|
|
||||||
settings: settings,
|
|
||||||
shiftTree: shiftTree,
|
|
||||||
linkHoverStates: linkHoverStates,
|
|
||||||
pathClick: pathClick,
|
|
||||||
triggerPathClick: triggerPathClick,
|
|
||||||
initIndicators: initIndicators,
|
|
||||||
init: init
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return h5ai;
|
return {
|
||||||
|
settings: settings,
|
||||||
|
shiftTree: shiftTree,
|
||||||
|
linkHoverStates: linkHoverStates,
|
||||||
|
pathClick: pathClick,
|
||||||
|
triggerPathClick: triggerPathClick,
|
||||||
|
initIndicators: initIndicators,
|
||||||
|
init: init
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,104 +2,95 @@
|
||||||
|
|
||||||
H5aiJs.factory.Path = function (folder, tableRow) {
|
H5aiJs.factory.Path = function (folder, tableRow) {
|
||||||
|
|
||||||
var path,
|
var checkedDecodeUri = function (uri) {
|
||||||
checkedDecodeUri = function (uri) {
|
|
||||||
|
|
||||||
try { return decodeURI(uri); } catch (err) {}
|
try { return decodeURI(uri); } catch (err) {}
|
||||||
return uri;
|
return uri;
|
||||||
},
|
},
|
||||||
isEmpty = function () {
|
$tds, $img, $a, splits;
|
||||||
|
|
||||||
return !path.content || $.isEmptyObject(path.content);
|
// parentFolder: undefined,
|
||||||
},
|
// label: undefined,
|
||||||
onClick = function (context) {
|
// date: undefined,
|
||||||
|
// size: undefined,
|
||||||
|
// href: undefined,
|
||||||
|
// absHref: undefined,
|
||||||
|
// alt: undefined,
|
||||||
|
// icon16: undefined,
|
||||||
|
// icon48: undefined,
|
||||||
|
// isFolder: undefined,
|
||||||
|
// isParentFolder: undefined,
|
||||||
|
// isCurrentFolder: undefined,
|
||||||
|
// isDomain: undefined,
|
||||||
|
|
||||||
H5aiJs.h5ai.triggerPathClick(path, context);
|
this.status = undefined; // undefined, "h5ai" or HTTP response code
|
||||||
},
|
this.content = undefined; // associative array path.absHref -> path
|
||||||
init = function () {
|
this.html = {
|
||||||
|
$crumb: undefined,
|
||||||
|
$extended: undefined,
|
||||||
|
$tree: undefined
|
||||||
|
};
|
||||||
|
this.treeOpen = false;
|
||||||
|
|
||||||
|
if (!H5aiJs.pathCache.pathEndsWithSlash(folder)) {
|
||||||
|
folder += "/";
|
||||||
|
}
|
||||||
|
|
||||||
var $tds, $img, $a, splits;
|
if (tableRow) {
|
||||||
|
$tds = $(tableRow).find("td");
|
||||||
|
$img = $tds.eq(0).find("img");
|
||||||
|
$a = $tds.eq(1).find("a");
|
||||||
|
|
||||||
path = {
|
this.parentFolder = folder;
|
||||||
// parentFolder: undefined,
|
this.label = $a.text();
|
||||||
// label: undefined,
|
this.date = $tds.eq(2).text();
|
||||||
// date: undefined,
|
this.size = $tds.eq(3).text();
|
||||||
// size: undefined,
|
this.href = $a.attr("href");
|
||||||
// href: undefined,
|
this.alt = $img.attr("alt");
|
||||||
// absHref: undefined,
|
this.icon16 = $img.attr("src");
|
||||||
// alt: undefined,
|
} else {
|
||||||
// icon16: undefined,
|
splits = H5aiJs.pathCache.splitPathname(folder);
|
||||||
// icon48: undefined,
|
|
||||||
// isFolder: undefined,
|
|
||||||
// isParentFolder: undefined,
|
|
||||||
// isCurrentFolder: undefined,
|
|
||||||
// isDomain: undefined,
|
|
||||||
|
|
||||||
status: undefined, // undefined, "h5ai" or HTTP response code
|
this.parentFolder = splits[0];
|
||||||
content: undefined, // associative array path.absHref -> path
|
this.label = checkedDecodeUri(splits[1]);
|
||||||
html: {
|
if (this.label === "/") {
|
||||||
$crumb: undefined,
|
this.label = checkedDecodeUri(document.domain) + "/";
|
||||||
$extended: undefined,
|
}
|
||||||
$tree: undefined
|
this.date = "";
|
||||||
},
|
this.size = "";
|
||||||
treeOpen: false,
|
this.href = splits[1];
|
||||||
|
this.alt = "[DIR]";
|
||||||
|
this.icon16 = "/h5ai/icons/16x16/folder.png";
|
||||||
|
}
|
||||||
|
|
||||||
isEmpty: isEmpty,
|
if (H5aiJs.pathCache.pathEndsWithSlash(this.label)) {
|
||||||
onClick: onClick
|
this.label = this.label.slice(0, -1);
|
||||||
};
|
}
|
||||||
|
|
||||||
if (!H5aiJs.pathCache.pathEndsWithSlash(folder)) {
|
this.icon48 = this.icon16.replace("16x16", "48x48");
|
||||||
folder += "/";
|
this.isFolder = (this.alt === "[DIR]");
|
||||||
}
|
this.isParentFolder = (this.isFolder && this.label === "Parent Directory");
|
||||||
|
this.absHref = this.isParentFolder ? this.href : this.parentFolder + this.href;
|
||||||
|
this.isCurrentFolder = (this.absHref === document.location.pathname);
|
||||||
|
this.isDomain = (this.absHref === "/");
|
||||||
|
|
||||||
if (tableRow) {
|
if (this.isParentFolder && H5aiJs.h5ai.settings.setParentFolderLabels) {
|
||||||
$tds = $(tableRow).find("td");
|
if (this.isDomain) {
|
||||||
$img = $tds.eq(0).find("img");
|
this.label = checkedDecodeUri(document.domain);
|
||||||
$a = $tds.eq(1).find("a");
|
} else {
|
||||||
|
this.label = checkedDecodeUri(H5aiJs.pathCache.splitPathname(H5aiJs.pathCache.splitPathname(this.parentFolder)[0])[1].slice(0, -1));
|
||||||
path.parentFolder = folder;
|
}
|
||||||
path.label = $a.text();
|
}
|
||||||
path.date = $tds.eq(2).text();
|
};
|
||||||
path.size = $tds.eq(3).text();
|
|
||||||
path.href = $a.attr("href");
|
H5aiJs.factory.Path.prototype = {
|
||||||
path.alt = $img.attr("alt");
|
|
||||||
path.icon16 = $img.attr("src");
|
isEmpty: function () {
|
||||||
} else {
|
|
||||||
splits = H5aiJs.pathCache.splitPathname(folder);
|
return !this.content || $.isEmptyObject(this.content);
|
||||||
|
},
|
||||||
path.parentFolder = splits[0];
|
onClick: function (context) {
|
||||||
path.label = checkedDecodeUri(splits[1]);
|
|
||||||
if (path.label === "/") {
|
H5aiJs.h5ai.triggerPathClick(this, context);
|
||||||
path.label = checkedDecodeUri(document.domain) + "/";
|
}
|
||||||
}
|
|
||||||
path.date = "";
|
|
||||||
path.size = "";
|
|
||||||
path.href = splits[1];
|
|
||||||
path.alt = "[DIR]";
|
|
||||||
path.icon16 = "/h5ai/icons/16x16/folder.png";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (H5aiJs.pathCache.pathEndsWithSlash(path.label)) {
|
|
||||||
path.label = path.label.slice(0, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
path.icon48 = path.icon16.replace("16x16", "48x48");
|
|
||||||
path.isFolder = (path.alt === "[DIR]");
|
|
||||||
path.isParentFolder = (path.isFolder && path.label === "Parent Directory");
|
|
||||||
path.absHref = path.isParentFolder ? path.href : path.parentFolder + path.href;
|
|
||||||
path.isCurrentFolder = (path.absHref === document.location.pathname);
|
|
||||||
path.isDomain = (path.absHref === "/");
|
|
||||||
|
|
||||||
if (path.isParentFolder && H5aiJs.h5ai.settings.setParentFolderLabels) {
|
|
||||||
if (path.isDomain) {
|
|
||||||
path.label = checkedDecodeUri(document.domain);
|
|
||||||
} else {
|
|
||||||
path.label = checkedDecodeUri(H5aiJs.pathCache.splitPathname(H5aiJs.pathCache.splitPathname(path.parentFolder)[0])[1].slice(0, -1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
init();
|
|
||||||
|
|
||||||
return path;
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
|
|
||||||
H5aiJs.factory.PathCache = function () {
|
H5aiJs.factory.PathCache = function () {
|
||||||
|
|
||||||
var pathCache,
|
var cache = {},
|
||||||
cache = {},
|
|
||||||
rePathnameSplit = /^(\/(.*\/)*)([^\/]+\/?)$/,
|
rePathnameSplit = /^(\/(.*\/)*)([^\/]+\/?)$/,
|
||||||
rePathEndsWithSlash = /\/$/,
|
rePathEndsWithSlash = /\/$/,
|
||||||
splitPathname = function (pathname) {
|
splitPathname = function (pathname) {
|
||||||
|
@ -50,12 +49,8 @@ H5aiJs.factory.PathCache = function () {
|
||||||
return path;
|
return path;
|
||||||
};
|
};
|
||||||
|
|
||||||
pathCache = {
|
this.splitPathname = splitPathname;
|
||||||
splitPathname: splitPathname,
|
this.pathEndsWithSlash = pathEndsWithSlash;
|
||||||
pathEndsWithSlash: pathEndsWithSlash,
|
this.getPath = getPath;
|
||||||
getPath: getPath,
|
this.cache = cache;
|
||||||
cache: cache
|
|
||||||
};
|
|
||||||
|
|
||||||
return pathCache;
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,15 +4,15 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var init = function (htmlElement) {
|
var init = function (htmlElement) {
|
||||||
|
|
||||||
var $element = $(htmlElement),
|
var $element = $(htmlElement),
|
||||||
$scrollbar, $drag, $wrapper, $content, mouseOffsetY, updateId,
|
$scrollbar, $drag, $wrapper, $content, mouseOffsetY, updateId,
|
||||||
update, scroll;
|
update, scroll;
|
||||||
|
|
||||||
if (!$element.css("position") || $element.css("position") === "static") {
|
if (!$element.css("position") || $element.css("position") === "static") {
|
||||||
$element.css("position", "relative");
|
$element.css("position", "relative");
|
||||||
}
|
}
|
||||||
|
|
||||||
$scrollbar = $("<div class='scrollbar' />");
|
$scrollbar = $("<div class='scrollbar' />");
|
||||||
$drag = $("<div class='drag' />").appendTo($scrollbar);
|
$drag = $("<div class='drag' />").appendTo($scrollbar);
|
||||||
$element
|
$element
|
||||||
|
@ -21,25 +21,25 @@
|
||||||
$wrapper = $element.find("> .wrapper");
|
$wrapper = $element.find("> .wrapper");
|
||||||
$content = $wrapper.find("> .content");
|
$content = $wrapper.find("> .content");
|
||||||
mouseOffsetY = 0;
|
mouseOffsetY = 0;
|
||||||
|
|
||||||
update = function (repeat) {
|
update = function (repeat) {
|
||||||
|
|
||||||
var visibleHeight, contentHeight, scrollTop, scrollTopFrac, visVertFrac;
|
var visibleHeight, contentHeight, scrollTop, scrollTopFrac, visVertFrac;
|
||||||
|
|
||||||
if (updateId && !repeat) {
|
if (updateId && !repeat) {
|
||||||
clearInterval(updateId);
|
clearInterval(updateId);
|
||||||
updateId = undefined;
|
updateId = undefined;
|
||||||
} else if (!updateId && repeat) {
|
} else if (!updateId && repeat) {
|
||||||
updateId = setInterval(function() { update(true); }, 50);
|
updateId = setInterval(function() { update(true); }, 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
$wrapper.css("height", $element.height());
|
$wrapper.css("height", $element.height());
|
||||||
visibleHeight = $element.height();
|
visibleHeight = $element.height();
|
||||||
contentHeight = $content.outerHeight();
|
contentHeight = $content.outerHeight();
|
||||||
scrollTop = $wrapper.scrollTop();
|
scrollTop = $wrapper.scrollTop();
|
||||||
scrollTopFrac = scrollTop / contentHeight;
|
scrollTopFrac = scrollTop / contentHeight;
|
||||||
visVertFrac = Math.min(visibleHeight / contentHeight, 1);
|
visVertFrac = Math.min(visibleHeight / contentHeight, 1);
|
||||||
|
|
||||||
if (visVertFrac < 1) {
|
if (visVertFrac < 1) {
|
||||||
$scrollbar
|
$scrollbar
|
||||||
.fadeIn(50)
|
.fadeIn(50)
|
||||||
|
@ -55,19 +55,19 @@
|
||||||
$scrollbar.fadeOut(50);
|
$scrollbar.fadeOut(50);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
scroll = function (event) {
|
scroll = function (event) {
|
||||||
|
|
||||||
var clickFrac = (event.pageY - $scrollbar.offset().top - mouseOffsetY) / $scrollbar.height();
|
var clickFrac = (event.pageY - $scrollbar.offset().top - mouseOffsetY) / $scrollbar.height();
|
||||||
|
|
||||||
$wrapper.scrollTop($content.outerHeight() * clickFrac);
|
$wrapper.scrollTop($content.outerHeight() * clickFrac);
|
||||||
update();
|
update();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
};
|
};
|
||||||
|
|
||||||
$element
|
$element
|
||||||
.mousewheel(function (event, delta) {
|
.mousewheel(function (event, delta) {
|
||||||
|
|
||||||
$wrapper.scrollTop($wrapper.scrollTop() - 50 * delta);
|
$wrapper.scrollTop($wrapper.scrollTop() - 50 * delta);
|
||||||
update();
|
update();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
@ -90,14 +90,14 @@
|
||||||
cursor: "pointer"
|
cursor: "pointer"
|
||||||
})
|
})
|
||||||
.mousedown(function (event) {
|
.mousedown(function (event) {
|
||||||
|
|
||||||
mouseOffsetY = $drag.outerHeight() / 2;
|
mouseOffsetY = $drag.outerHeight() / 2;
|
||||||
scroll(event);
|
scroll(event);
|
||||||
$scrollbar.addClass("dragOn");
|
$scrollbar.addClass("dragOn");
|
||||||
$(window)
|
$(window)
|
||||||
.bind("mousemove", scroll)
|
.bind("mousemove", scroll)
|
||||||
.one("mouseup", function (event) {
|
.one("mouseup", function (event) {
|
||||||
|
|
||||||
$scrollbar.removeClass("dragOn");
|
$scrollbar.removeClass("dragOn");
|
||||||
$(window).unbind("mousemove", scroll);
|
$(window).unbind("mousemove", scroll);
|
||||||
scroll(event);
|
scroll(event);
|
||||||
|
@ -106,9 +106,9 @@
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
})
|
})
|
||||||
.each(function () {
|
.each(function () {
|
||||||
|
|
||||||
this.onselectstart = function () {
|
this.onselectstart = function () {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@ -119,14 +119,14 @@
|
||||||
width: "100%"
|
width: "100%"
|
||||||
})
|
})
|
||||||
.mousedown(function (event) {
|
.mousedown(function (event) {
|
||||||
|
|
||||||
mouseOffsetY = event.pageY - $drag.offset().top;
|
mouseOffsetY = event.pageY - $drag.offset().top;
|
||||||
scroll(event);
|
scroll(event);
|
||||||
$scrollbar.addClass("dragOn");
|
$scrollbar.addClass("dragOn");
|
||||||
$(window)
|
$(window)
|
||||||
.bind("mousemove", scroll)
|
.bind("mousemove", scroll)
|
||||||
.one("mouseup", function (event) {
|
.one("mouseup", function (event) {
|
||||||
|
|
||||||
$scrollbar.removeClass("dragOn");
|
$scrollbar.removeClass("dragOn");
|
||||||
$(window).unbind("mousemove", scroll);
|
$(window).unbind("mousemove", scroll);
|
||||||
scroll(event);
|
scroll(event);
|
||||||
|
@ -134,7 +134,7 @@
|
||||||
});
|
});
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
});
|
});
|
||||||
|
|
||||||
update();
|
update();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
// http://paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
|
// http://paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
|
||||||
// modified
|
// modified
|
||||||
$.log = function () {
|
$.log = function () {
|
||||||
|
|
||||||
$.log.history = $.log.history || [];
|
$.log.history = $.log.history || [];
|
||||||
$.log.history.push(arguments);
|
$.log.history.push(arguments);
|
||||||
if (window.console) {
|
if (window.console) {
|
||||||
|
@ -14,17 +15,17 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
$.timer = (function () {
|
$.timer = (function () {
|
||||||
var start = $.now(),
|
|
||||||
last = start,
|
|
||||||
timer = {
|
|
||||||
log: function (label) {
|
|
||||||
var now = $.now();
|
|
||||||
$.log("timer", label, "+" + (now - last), "=" + (now - start));
|
|
||||||
last = now;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return timer;
|
var start = $.now(),
|
||||||
|
last = start;
|
||||||
|
|
||||||
|
return {
|
||||||
|
log: function (label) {
|
||||||
|
var now = $.now();
|
||||||
|
$.log("timer", label, "+" + (now - last), "=" + (now - start));
|
||||||
|
last = now;
|
||||||
|
}
|
||||||
|
};
|
||||||
}());
|
}());
|
||||||
|
|
||||||
}(jQuery));
|
}(jQuery));
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
var H5aiJs = {
|
var H5aiJs = {
|
||||||
factory: {},
|
factory: {},
|
||||||
init: function () {
|
init: function () {
|
||||||
|
|
||||||
this.h5ai = new this.factory.H5ai(h5aiOptions, h5aiLangs);
|
this.h5ai = new this.factory.H5ai(h5aiOptions, h5aiLangs);
|
||||||
this.pathCache = new this.factory.PathCache();
|
this.pathCache = new this.factory.PathCache();
|
||||||
this.connector = new this.factory.Connector();
|
this.connector = new this.factory.Connector();
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
var H5aiJs = {
|
var H5aiJs = {
|
||||||
factory: {},
|
factory: {},
|
||||||
init: function () {
|
init: function () {
|
||||||
|
|
||||||
this.h5ai = new this.factory.H5ai(h5aiOptions, h5aiLangs);
|
this.h5ai = new this.factory.H5ai(h5aiOptions, h5aiLangs);
|
||||||
|
|
||||||
this.h5ai.init();
|
this.h5ai.init();
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<attribute name="toFile" />
|
<attribute name="toFile" />
|
||||||
<attribute name="args" default="" />
|
<attribute name="args" default="" />
|
||||||
<sequential>
|
<sequential>
|
||||||
<exec executable="${wepp}">
|
<exec executable="${tool.wepp}">
|
||||||
<arg line="@{args}" />
|
<arg line="@{args}" />
|
||||||
<arg value="--in" />
|
<arg value="--in" />
|
||||||
<arg value="@{file}" />
|
<arg value="@{file}" />
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
<attribute name="dir" />
|
<attribute name="dir" />
|
||||||
<attribute name="args" default="" />
|
<attribute name="args" default="" />
|
||||||
<sequential>
|
<sequential>
|
||||||
<exec executable="${wepp}">
|
<exec executable="${tool.wepp}">
|
||||||
<arg line="@{args}" />
|
<arg line="@{args}" />
|
||||||
<arg value="--inDir" />
|
<arg value="--inDir" />
|
||||||
<arg value="@{dir}" />
|
<arg value="@{dir}" />
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue