mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-28 14:04:45 -04:00
Removes unnecessary closures.
This commit is contained in:
parent
b1f6bd0d67
commit
fbff8686bf
10 changed files with 1341 additions and 1370 deletions
|
@ -1,115 +1,112 @@
|
||||||
|
|
||||||
(function ($, H5AI) {
|
(function ($, H5AI) {
|
||||||
|
|
||||||
H5AI.connector = (function () {
|
var cache = {},
|
||||||
|
pathnameStatusCache = {},
|
||||||
|
contentTypeRegEx = /^text\/html;h5ai=/,
|
||||||
|
getPath = function (folder, tableRow) {
|
||||||
|
|
||||||
var cache = {},
|
var absHref = H5AI.util.getAbsHref(folder, tableRow),
|
||||||
pathnameStatusCache = {},
|
path = cache[absHref];
|
||||||
contentTypeRegEx = /^text\/html;h5ai=/,
|
|
||||||
getPath = function (folder, tableRow) {
|
|
||||||
|
|
||||||
var absHref = H5AI.util.getAbsHref(folder, tableRow),
|
if (!path) {
|
||||||
path = cache[absHref];
|
path = H5AI.Path(folder, tableRow);
|
||||||
|
if (!path.isParentFolder) {
|
||||||
if (!path) {
|
cache[path.absHref] = path;
|
||||||
path = H5AI.Path(folder, tableRow);
|
|
||||||
if (!path.isParentFolder) {
|
|
||||||
cache[path.absHref] = path;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
},
|
},
|
||||||
fetchStatus = function (pathname, callback) {
|
fetchStatus = function (pathname, callback) {
|
||||||
|
|
||||||
if (H5AI.core.settings.folderStatus[pathname]) {
|
if (H5AI.core.settings.folderStatus[pathname]) {
|
||||||
callback(H5AI.core.settings.folderStatus[pathname]);
|
callback(H5AI.core.settings.folderStatus[pathname]);
|
||||||
return;
|
return;
|
||||||
} else if (pathnameStatusCache[pathname]) {
|
} else if (pathnameStatusCache[pathname]) {
|
||||||
callback(pathnameStatusCache[pathname]);
|
callback(pathnameStatusCache[pathname]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: pathname,
|
||||||
|
type: "HEAD",
|
||||||
|
complete: function (xhr) {
|
||||||
|
|
||||||
|
var status = xhr.status;
|
||||||
|
|
||||||
|
if (status === 200 && contentTypeRegEx.test(xhr.getResponseHeader("Content-Type"))) {
|
||||||
|
status = "h5ai";
|
||||||
|
}
|
||||||
|
pathnameStatusCache[pathname] = status;
|
||||||
|
callback(status);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
updatePath = function (path) {
|
||||||
|
|
||||||
|
if (path.isFolder && !path.isParentFolder && path.status === undefined) {
|
||||||
|
fetchStatus(path.absHref, function (status) {
|
||||||
|
|
||||||
|
if (status !== "h5ai") {
|
||||||
|
path.status = status;
|
||||||
|
}
|
||||||
|
H5AI.html.updateHtml(path);
|
||||||
|
H5AI.core.linkHoverStates();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
updatePaths = function () {
|
||||||
|
|
||||||
|
$.each(cache, function (ref, cached) {
|
||||||
|
updatePath(cached);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
fetchStatusAndContent = function (pathname, includeParent, callback) {
|
||||||
|
|
||||||
|
fetchStatus(pathname, function (status) {
|
||||||
|
|
||||||
|
if (status !== "h5ai") {
|
||||||
|
callback(status, {});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: pathname,
|
url: pathname,
|
||||||
type: "HEAD",
|
type: "GET",
|
||||||
complete: function (xhr) {
|
dataType: "html",
|
||||||
|
error: function (xhr) {
|
||||||
|
|
||||||
var status = xhr.status;
|
callback(xhr.status, {}); // since it was checked before this should never happen
|
||||||
|
},
|
||||||
|
success: function (html, status, xhr) {
|
||||||
|
|
||||||
if (status === 200 && contentTypeRegEx.test(xhr.getResponseHeader("Content-Type"))) {
|
var content = {};
|
||||||
status = "h5ai";
|
|
||||||
}
|
|
||||||
pathnameStatusCache[pathname] = status;
|
|
||||||
callback(status);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
updatePath = function (path) {
|
|
||||||
|
|
||||||
if (path.isFolder && !path.isParentFolder && path.status === undefined) {
|
|
||||||
fetchStatus(path.absHref, function (status) {
|
|
||||||
|
|
||||||
if (status !== "h5ai") {
|
|
||||||
path.status = status;
|
|
||||||
}
|
|
||||||
H5AI.html.updateHtml(path);
|
|
||||||
H5AI.core.linkHoverStates();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
updatePaths = function () {
|
|
||||||
|
|
||||||
$.each(cache, function (ref, cached) {
|
|
||||||
updatePath(cached);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
fetchStatusAndContent = function (pathname, includeParent, callback) {
|
|
||||||
|
|
||||||
fetchStatus(pathname, function (status) {
|
|
||||||
|
|
||||||
if (status !== "h5ai") {
|
|
||||||
callback(status, {});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: pathname,
|
|
||||||
type: "GET",
|
|
||||||
dataType: "html",
|
|
||||||
error: function (xhr) {
|
|
||||||
|
|
||||||
|
if (!contentTypeRegEx.test(xhr.getResponseHeader("Content-Type"))) {
|
||||||
callback(xhr.status, {}); // since it was checked before this should never happen
|
callback(xhr.status, {}); // since it was checked before this should never happen
|
||||||
},
|
return;
|
||||||
success: function (html, status, xhr) {
|
|
||||||
|
|
||||||
var content = {};
|
|
||||||
|
|
||||||
if (!contentTypeRegEx.test(xhr.getResponseHeader("Content-Type"))) {
|
|
||||||
callback(xhr.status, {}); // since it was checked before this should never happen
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$(html).find("#table td").closest("tr").each(function () {
|
|
||||||
|
|
||||||
var path = getPath(pathname, this);
|
|
||||||
|
|
||||||
if (path.isFolder && (!path.isParentFolder || includeParent)) {
|
|
||||||
content[path.absHref] = path;
|
|
||||||
updatePath(path);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
callback("h5ai", content);
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
return {
|
$(html).find("#table td").closest("tr").each(function () {
|
||||||
getPath: getPath,
|
|
||||||
updatePaths: updatePaths,
|
var path = getPath(pathname, this);
|
||||||
fetchStatusAndContent: fetchStatusAndContent
|
|
||||||
|
if (path.isFolder && (!path.isParentFolder || includeParent)) {
|
||||||
|
content[path.absHref] = path;
|
||||||
|
updatePath(path);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
callback("h5ai", content);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}());
|
|
||||||
|
H5AI.connector = {
|
||||||
|
getPath: getPath,
|
||||||
|
updatePaths: updatePaths,
|
||||||
|
fetchStatusAndContent: fetchStatusAndContent
|
||||||
|
};
|
||||||
|
|
||||||
}(jQuery, H5AI));
|
}(jQuery, H5AI));
|
||||||
|
|
|
@ -1,55 +1,51 @@
|
||||||
|
|
||||||
(function ($, H5AI) {
|
(function ($, H5AI) {
|
||||||
|
|
||||||
H5AI.context = (function () {
|
var $context,
|
||||||
|
qrCodesSize,
|
||||||
|
showQrCode = function ($a) {
|
||||||
|
|
||||||
var $context,
|
var absHref = $a.attr('href'),
|
||||||
qrCodesSize,
|
url = 'http://' + document.domain + absHref;
|
||||||
showQrCode = function ($a) {
|
|
||||||
|
|
||||||
var absHref = $a.attr('href'),
|
$context.find('.qrcode').empty().qrcode({
|
||||||
url = 'http://' + document.domain + absHref;
|
render: Modernizr.canvas ? 'canvas' : 'div',
|
||||||
|
width: qrCodesSize,
|
||||||
|
height: qrCodesSize,
|
||||||
|
color: '#333',
|
||||||
|
text: url
|
||||||
|
});
|
||||||
|
},
|
||||||
|
init = function () {
|
||||||
|
|
||||||
$context.find('.qrcode').empty().qrcode({
|
qrCodesSize = H5AI.core.settings.qrCodesSize;
|
||||||
render: Modernizr.canvas ? 'canvas' : 'div',
|
if (!qrCodesSize) {
|
||||||
width: qrCodesSize,
|
return;
|
||||||
height: qrCodesSize,
|
}
|
||||||
color: '#333',
|
|
||||||
text: url
|
var hideTimeoutId = null;
|
||||||
|
|
||||||
|
$context = $('<div id="context"><div class="qrcode"/></div>');
|
||||||
|
$context.appendTo('body');
|
||||||
|
|
||||||
|
$('#extended')
|
||||||
|
.on('mouseenter', '.entry.file a', function () {
|
||||||
|
|
||||||
|
showQrCode($(this));
|
||||||
|
clearTimeout(hideTimeoutId);
|
||||||
|
$context.stop(true, true).fadeIn(400);
|
||||||
|
})
|
||||||
|
.on('mouseleave', '.entry.file a', function () {
|
||||||
|
|
||||||
|
hideTimeoutId = setTimeout(function () {
|
||||||
|
|
||||||
|
$context.stop(true, true).fadeOut(400);
|
||||||
|
}, 200);
|
||||||
});
|
});
|
||||||
},
|
|
||||||
init = function () {
|
|
||||||
|
|
||||||
qrCodesSize = H5AI.core.settings.qrCodesSize;
|
|
||||||
if (!qrCodesSize) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var hideTimeoutId = null;
|
|
||||||
|
|
||||||
$context = $('<div id="context"><div class="qrcode"/></div>');
|
|
||||||
$context.appendTo('body');
|
|
||||||
|
|
||||||
$('#extended')
|
|
||||||
.on('mouseenter', '.entry.file a', function () {
|
|
||||||
|
|
||||||
showQrCode($(this));
|
|
||||||
clearTimeout(hideTimeoutId);
|
|
||||||
$context.stop(true, true).fadeIn(400);
|
|
||||||
})
|
|
||||||
.on('mouseleave', '.entry.file a', function () {
|
|
||||||
|
|
||||||
hideTimeoutId = setTimeout(function () {
|
|
||||||
|
|
||||||
$context.stop(true, true).fadeOut(400);
|
|
||||||
}, 200);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
return {
|
|
||||||
init: init
|
|
||||||
};
|
};
|
||||||
}());
|
|
||||||
|
H5AI.context = {
|
||||||
|
init: init
|
||||||
|
};
|
||||||
|
|
||||||
}(jQuery, H5AI));
|
}(jQuery, H5AI));
|
|
@ -1,441 +1,438 @@
|
||||||
|
|
||||||
(function (window, $, H5AI, config) {
|
(function (window, $, H5AI, config) {
|
||||||
|
|
||||||
H5AI.core = (function () {
|
var $window = $(window),
|
||||||
|
defaults = {
|
||||||
var $window = $(window),
|
store: {
|
||||||
defaults = {
|
viewmode: "h5ai.pref.viewmode",
|
||||||
store: {
|
lang: "h5ai.pref.lang"
|
||||||
viewmode: "h5ai.pref.viewmode",
|
},
|
||||||
lang: "h5ai.pref.lang"
|
callbacks: {
|
||||||
},
|
pathClick: []
|
||||||
callbacks: {
|
|
||||||
pathClick: []
|
|
||||||
},
|
|
||||||
|
|
||||||
rootAbsHref: "/",
|
|
||||||
h5aiAbsHref: "/_h5ai/",
|
|
||||||
customHeader: null,
|
|
||||||
customFooter: null,
|
|
||||||
viewmodes: ["details", "icons"],
|
|
||||||
sortorder: "na",
|
|
||||||
showTree: true,
|
|
||||||
slideTree: true,
|
|
||||||
folderStatus: {},
|
|
||||||
lang: "en",
|
|
||||||
useBrowserLang: true,
|
|
||||||
setParentFolderLabels: true,
|
|
||||||
linkHoverStates: true,
|
|
||||||
dateFormat: "yyyy-MM-dd HH:mm",
|
|
||||||
showThumbs: false,
|
|
||||||
thumbTypes: ["bmp", "gif", "ico", "image", "jpg", "png", "tiff"],
|
|
||||||
zippedDownload: false,
|
|
||||||
qrCodesSize: null,
|
|
||||||
showFilter: false
|
|
||||||
},
|
},
|
||||||
settings = $.extend({}, defaults, config.options),
|
|
||||||
currentDateFormat = settings.dateFormat,
|
|
||||||
extToFileType = (function (types) {
|
|
||||||
var map = {};
|
|
||||||
$.each(types, function (type, exts) {
|
|
||||||
$.each(exts, function (idx, ext) {
|
|
||||||
map[ext] = type;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return map;
|
|
||||||
}(config.types)),
|
|
||||||
hash = function (obj) {
|
|
||||||
|
|
||||||
if ($.isPlainObject(obj)) {
|
rootAbsHref: "/",
|
||||||
var hashStr = '';
|
h5aiAbsHref: "/_h5ai/",
|
||||||
$.each($.extend({}, hash(), obj), function (key, value) {
|
customHeader: null,
|
||||||
if (value) {
|
customFooter: null,
|
||||||
hashStr += '/' + encodeURIComponent(key) + '=' + encodeURIComponent(value);
|
viewmodes: ["details", "icons"],
|
||||||
|
sortorder: "na",
|
||||||
|
showTree: true,
|
||||||
|
slideTree: true,
|
||||||
|
folderStatus: {},
|
||||||
|
lang: "en",
|
||||||
|
useBrowserLang: true,
|
||||||
|
setParentFolderLabels: true,
|
||||||
|
linkHoverStates: true,
|
||||||
|
dateFormat: "yyyy-MM-dd HH:mm",
|
||||||
|
showThumbs: false,
|
||||||
|
thumbTypes: ["bmp", "gif", "ico", "image", "jpg", "png", "tiff"],
|
||||||
|
zippedDownload: false,
|
||||||
|
qrCodesSize: null,
|
||||||
|
showFilter: false
|
||||||
|
},
|
||||||
|
settings = $.extend({}, defaults, config.options),
|
||||||
|
currentDateFormat = settings.dateFormat,
|
||||||
|
extToFileType = (function (types) {
|
||||||
|
var map = {};
|
||||||
|
$.each(types, function (type, exts) {
|
||||||
|
$.each(exts, function (idx, ext) {
|
||||||
|
map[ext] = type;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return map;
|
||||||
|
}(config.types)),
|
||||||
|
hash = function (obj) {
|
||||||
|
|
||||||
|
if ($.isPlainObject(obj)) {
|
||||||
|
var hashStr = '';
|
||||||
|
$.each($.extend({}, hash(), obj), function (key, value) {
|
||||||
|
if (value) {
|
||||||
|
hashStr += '/' + encodeURIComponent(key) + '=' + encodeURIComponent(value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
hashStr = '#!' + hashStr;
|
||||||
|
window.location.hash = hashStr;
|
||||||
|
return hashStr;
|
||||||
|
} else {
|
||||||
|
var result = {},
|
||||||
|
parts = document.location.hash.split('/');
|
||||||
|
|
||||||
|
if (parts.length >= 2 || parts[0] === '#!') {
|
||||||
|
parts.shift();
|
||||||
|
$.each(parts, function (idx, part) {
|
||||||
|
|
||||||
|
var match = /^([^=]*)=(.*?)$/.exec(part);
|
||||||
|
if (match) {
|
||||||
|
result[decodeURIComponent(match[1])] = decodeURIComponent(match[2]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
hashStr = '#!' + hashStr;
|
|
||||||
window.location.hash = hashStr;
|
|
||||||
return hashStr;
|
|
||||||
} else {
|
|
||||||
var result = {},
|
|
||||||
parts = document.location.hash.split('/');
|
|
||||||
|
|
||||||
if (parts.length >= 2 || parts[0] === '#!') {
|
|
||||||
parts.shift();
|
|
||||||
$.each(parts, function (idx, part) {
|
|
||||||
|
|
||||||
var match = /^([^=]*)=(.*?)$/.exec(part);
|
|
||||||
if (match) {
|
|
||||||
result[decodeURIComponent(match[1])] = decodeURIComponent(match[2]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return typeof obj === 'string' ? result[obj] : result;
|
|
||||||
}
|
}
|
||||||
},
|
return typeof obj === 'string' ? result[obj] : result;
|
||||||
api = function () {
|
}
|
||||||
|
},
|
||||||
|
api = function () {
|
||||||
|
|
||||||
return settings.h5aiAbsHref + "php/api.php";
|
return settings.h5aiAbsHref + "php/api.php";
|
||||||
},
|
},
|
||||||
image = function (id, noPngExt) {
|
image = function (id, noPngExt) {
|
||||||
|
|
||||||
return settings.h5aiAbsHref + "images/" + id + (noPngExt ? "" : ".png");
|
return settings.h5aiAbsHref + "images/" + id + (noPngExt ? "" : ".png");
|
||||||
},
|
},
|
||||||
icon = function (id, big) {
|
icon = function (id, big) {
|
||||||
|
|
||||||
return settings.h5aiAbsHref + "icons/" + (big ? "48x48" : "16x16") + "/" + id + ".png";
|
return settings.h5aiAbsHref + "icons/" + (big ? "48x48" : "16x16") + "/" + id + ".png";
|
||||||
},
|
},
|
||||||
viewmode = function (viewmode) {
|
viewmode = function (viewmode) {
|
||||||
|
|
||||||
var $viewDetails = $("#viewdetails"),
|
var $viewDetails = $("#viewdetails"),
|
||||||
$viewIcons = $("#viewicons"),
|
$viewIcons = $("#viewicons"),
|
||||||
$extended = $("#extended");
|
$extended = $("#extended");
|
||||||
|
|
||||||
if (viewmode) {
|
if (viewmode) {
|
||||||
amplify.store(settings.store.viewmode, viewmode);
|
amplify.store(settings.store.viewmode, viewmode);
|
||||||
} else {
|
} else {
|
||||||
viewmode = amplify.store(settings.store.viewmode);
|
viewmode = amplify.store(settings.store.viewmode);
|
||||||
}
|
}
|
||||||
viewmode = $.inArray(viewmode, settings.viewmodes) >= 0 ? viewmode : settings.viewmodes[0];
|
viewmode = $.inArray(viewmode, settings.viewmodes) >= 0 ? viewmode : settings.viewmodes[0];
|
||||||
H5AI.core.hash({view: viewmode});
|
H5AI.core.hash({view: viewmode});
|
||||||
|
|
||||||
$viewDetails.add($viewIcons).removeClass("current");
|
$viewDetails.add($viewIcons).removeClass("current");
|
||||||
if (viewmode === "details") {
|
if (viewmode === "details") {
|
||||||
$viewDetails.addClass("current");
|
$viewDetails.addClass("current");
|
||||||
$extended.addClass("details-view").removeClass("icons-view").show();
|
$extended.addClass("details-view").removeClass("icons-view").show();
|
||||||
} else if (viewmode === "icons") {
|
} else if (viewmode === "icons") {
|
||||||
$viewIcons.addClass("current");
|
$viewIcons.addClass("current");
|
||||||
$extended.removeClass("details-view").addClass("icons-view").show();
|
$extended.removeClass("details-view").addClass("icons-view").show();
|
||||||
} else {
|
} else {
|
||||||
$extended.hide();
|
$extended.hide();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
initTopSpace = function () {
|
initTopSpace = function () {
|
||||||
|
|
||||||
var $body = $("body"),
|
var $body = $("body"),
|
||||||
$tree = $("#tree"),
|
$tree = $("#tree"),
|
||||||
adjustTopSpace = function () {
|
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,
|
||||||
treeSpacing = 0;
|
treeSpacing = 0;
|
||||||
|
|
||||||
$body.css({
|
$body.css({
|
||||||
"margin-top": navHeight + contentSpacing,
|
"margin-top": navHeight + contentSpacing,
|
||||||
"margin-bottom": footerHeight + contentSpacing
|
"margin-bottom": footerHeight + contentSpacing
|
||||||
});
|
});
|
||||||
|
|
||||||
$tree.css({
|
$tree.css({
|
||||||
top: navHeight + treeSpacing,
|
top: navHeight + treeSpacing,
|
||||||
height: winHeight - navHeight - footerHeight - 16 - 2 * treeSpacing
|
height: winHeight - navHeight - footerHeight - 16 - 2 * treeSpacing
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$tree.get(0).updateScrollbar();
|
$tree.get(0).updateScrollbar();
|
||||||
} catch (err) {}
|
} catch (err) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
$window.resize(function () {
|
$window.resize(function () {
|
||||||
adjustTopSpace();
|
|
||||||
});
|
|
||||||
adjustTopSpace();
|
adjustTopSpace();
|
||||||
},
|
});
|
||||||
initViews = function () {
|
adjustTopSpace();
|
||||||
|
},
|
||||||
|
initViews = function () {
|
||||||
|
|
||||||
var $navbar = $("#navbar"),
|
var $navbar = $("#navbar"),
|
||||||
$extended = $("#extended");
|
$extended = $("#extended");
|
||||||
|
|
||||||
$("#table").remove();
|
$("#table").remove();
|
||||||
|
|
||||||
if (settings.viewmodes.length > 1) {
|
if (settings.viewmodes.length > 1) {
|
||||||
if ($.inArray("icons", settings.viewmodes) >= 0) {
|
if ($.inArray("icons", settings.viewmodes) >= 0) {
|
||||||
$("<li id='viewicons' class='view'><a href='#'><img alt='view-icons' /><span class='l10n-icons'>icons</span></a></li>")
|
$("<li id='viewicons' class='view'><a href='#'><img alt='view-icons' /><span class='l10n-icons'>icons</span></a></li>")
|
||||||
.find("img").attr("src", image("view-icons")).end()
|
.find("img").attr("src", image("view-icons")).end()
|
||||||
.find("a").click(function (event) {
|
.find("a").click(function (event) {
|
||||||
viewmode("icons");
|
viewmode("icons");
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}).end()
|
}).end()
|
||||||
.appendTo($navbar);
|
.appendTo($navbar);
|
||||||
}
|
|
||||||
if ($.inArray("details", settings.viewmodes) >= 0) {
|
|
||||||
$("<li id='viewdetails' class='view'><a href='#'><img alt='view-details' /><span class='l10n-details'>details</span></a></li>")
|
|
||||||
.find("img").attr("src", image("view-details")).end()
|
|
||||||
.find("a").click(function (event) {
|
|
||||||
viewmode("details");
|
|
||||||
event.preventDefault();
|
|
||||||
}).end()
|
|
||||||
.appendTo($navbar);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if ($.inArray("details", settings.viewmodes) >= 0) {
|
||||||
|
$("<li id='viewdetails' class='view'><a href='#'><img alt='view-details' /><span class='l10n-details'>details</span></a></li>")
|
||||||
|
.find("img").attr("src", image("view-details")).end()
|
||||||
|
.find("a").click(function (event) {
|
||||||
|
viewmode("details");
|
||||||
|
event.preventDefault();
|
||||||
|
}).end()
|
||||||
|
.appendTo($navbar);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// status update
|
// status update
|
||||||
$extended.find(".entry a").hover(
|
$extended.find(".entry a").hover(
|
||||||
function () {
|
function () {
|
||||||
if ($extended.hasClass("icons-view")) {
|
if ($extended.hasClass("icons-view")) {
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
$(".status.default").hide();
|
$(".status.default").hide();
|
||||||
|
$(".status.dynamic")
|
||||||
|
.empty()
|
||||||
|
.append($this.find(".label").clone())
|
||||||
|
.append($("<span class='sep'>·</span>"))
|
||||||
|
.append($this.find(".date").clone())
|
||||||
|
.show();
|
||||||
|
|
||||||
|
if (!$this.closest(".entry").hasClass("folder")) {
|
||||||
$(".status.dynamic")
|
$(".status.dynamic")
|
||||||
.empty()
|
|
||||||
.append($this.find(".label").clone())
|
|
||||||
.append($("<span class='sep'>·</span>"))
|
.append($("<span class='sep'>·</span>"))
|
||||||
.append($this.find(".date").clone())
|
.append($this.find(".size").clone());
|
||||||
.show();
|
|
||||||
|
|
||||||
if (!$this.closest(".entry").hasClass("folder")) {
|
|
||||||
$(".status.dynamic")
|
|
||||||
.append($("<span class='sep'>·</span>"))
|
|
||||||
.append($this.find(".size").clone());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
function () {
|
|
||||||
$(".status.default").show();
|
|
||||||
$(".status.dynamic").empty().hide();
|
|
||||||
}
|
}
|
||||||
);
|
},
|
||||||
},
|
function () {
|
||||||
shiftTree = function (forceVisible, dontAnimate) {
|
$(".status.default").show();
|
||||||
|
$(".status.dynamic").empty().hide();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
shiftTree = function (forceVisible, dontAnimate) {
|
||||||
|
|
||||||
var $tree = $("#tree"),
|
var $tree = $("#tree"),
|
||||||
$extended = $("#extended");
|
$extended = $("#extended");
|
||||||
|
|
||||||
if ((settings.slideTree && $tree.outerWidth() < $extended.offset().left) || forceVisible) {
|
if ((settings.slideTree && $tree.outerWidth() < $extended.offset().left) || forceVisible) {
|
||||||
if (dontAnimate) {
|
if (dontAnimate) {
|
||||||
$tree.stop().css({ left: 0 });
|
$tree.stop().css({ left: 0 });
|
||||||
} else {
|
|
||||||
$tree.stop().animate({ left: 0 });
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (dontAnimate) {
|
$tree.stop().animate({ left: 0 });
|
||||||
$tree.stop().css({ left: 18 - $tree.outerWidth() });
|
|
||||||
} else {
|
|
||||||
$tree.stop().animate({ left: 18 - $tree.outerWidth() });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
} else {
|
||||||
initTree = function () {
|
if (dontAnimate) {
|
||||||
|
$tree.stop().css({ left: 18 - $tree.outerWidth() });
|
||||||
$("#tree").hover(
|
|
||||||
function () { shiftTree(true); },
|
|
||||||
function () { shiftTree(); }
|
|
||||||
);
|
|
||||||
$window.resize(function () { shiftTree(); });
|
|
||||||
shiftTree(false, true);
|
|
||||||
},
|
|
||||||
selectLinks = function (href) {
|
|
||||||
|
|
||||||
var elements = [];
|
|
||||||
$("a[href^='/']").each(function () {
|
|
||||||
|
|
||||||
if ($(this).attr("href") === href) {
|
|
||||||
elements.push(this);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return $(elements);
|
|
||||||
},
|
|
||||||
linkHoverStates = function () {
|
|
||||||
|
|
||||||
if (settings.linkHoverStates) {
|
|
||||||
$("a[href^='/']:not(.linkedHoverStates)").each(function () {
|
|
||||||
|
|
||||||
var $a = $(this).addClass("linkedHoverStates"),
|
|
||||||
href = $a.attr("href");
|
|
||||||
|
|
||||||
$a.hover(
|
|
||||||
function () { selectLinks(href).addClass("hover"); },
|
|
||||||
function () { selectLinks(href).removeClass("hover"); }
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
formatDates = function (dateFormat) {
|
|
||||||
|
|
||||||
if (dateFormat) {
|
|
||||||
currentDateFormat = dateFormat;
|
|
||||||
}
|
|
||||||
|
|
||||||
$("#extended .entry .date").each(function () {
|
|
||||||
|
|
||||||
var $this = $(this),
|
|
||||||
time = $this.data("time"),
|
|
||||||
formattedDate = time ? new Date(time).toString(currentDateFormat) : "";
|
|
||||||
|
|
||||||
$this.text(formattedDate);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
localize = function (langs, lang, useBrowserLang) {
|
|
||||||
|
|
||||||
var storedLang = amplify.store(settings.store.lang),
|
|
||||||
browserLang, selected, key;
|
|
||||||
|
|
||||||
if (langs[storedLang]) {
|
|
||||||
lang = storedLang;
|
|
||||||
} else if (useBrowserLang) {
|
|
||||||
browserLang = navigator.language || navigator.browserLanguage;
|
|
||||||
if (browserLang) {
|
|
||||||
if (langs[browserLang]) {
|
|
||||||
lang = browserLang;
|
|
||||||
} else if (browserLang.length > 2 && langs[browserLang.substr(0, 2)]) {
|
|
||||||
lang = browserLang.substr(0, 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!langs[lang]) {
|
|
||||||
lang = "en";
|
|
||||||
}
|
|
||||||
|
|
||||||
selected = langs[lang];
|
|
||||||
if (selected) {
|
|
||||||
$.each(selected, function (key, value) {
|
|
||||||
$(".l10n-" + key).text(value);
|
|
||||||
});
|
|
||||||
$(".lang").text(lang);
|
|
||||||
$(".langOption").removeClass("current");
|
|
||||||
$(".langOption." + lang).addClass("current");
|
|
||||||
H5AI.core.hash({lang: lang});
|
|
||||||
}
|
|
||||||
|
|
||||||
formatDates(selected.dateFormat || settings.dateFormat);
|
|
||||||
},
|
|
||||||
initLangSelector = function (langs) {
|
|
||||||
|
|
||||||
var $langOptions = $("#langSelector .langOptions"),
|
|
||||||
sortedLangsKeys = [],
|
|
||||||
$ul;
|
|
||||||
|
|
||||||
$.each(langs, function (lang) {
|
|
||||||
sortedLangsKeys.push(lang);
|
|
||||||
});
|
|
||||||
sortedLangsKeys.sort();
|
|
||||||
|
|
||||||
$ul = $("<ul />");
|
|
||||||
$.each(sortedLangsKeys, function (idx, lang) {
|
|
||||||
$("<li class='langOption' />")
|
|
||||||
.addClass(lang)
|
|
||||||
.text(lang + " - " + langs[lang].lang)
|
|
||||||
.appendTo($ul)
|
|
||||||
.click(function () {
|
|
||||||
amplify.store(settings.store.lang, lang);
|
|
||||||
localize(langs, lang, false);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
$langOptions
|
|
||||||
.append($ul)
|
|
||||||
.scrollpanel();
|
|
||||||
|
|
||||||
$("#langSelector").hover(
|
|
||||||
function () {
|
|
||||||
$langOptions
|
|
||||||
.css("top", "-" + $langOptions.outerHeight() + "px")
|
|
||||||
.stop(true, true)
|
|
||||||
.fadeIn();
|
|
||||||
$langOptions.get(0).updateScrollbar();
|
|
||||||
},
|
|
||||||
function () {
|
|
||||||
$langOptions
|
|
||||||
.stop(true, true)
|
|
||||||
.fadeOut();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
|
||||||
onIndicatorClick = function (event) {
|
|
||||||
|
|
||||||
var $indicator = $(this),
|
|
||||||
$entry = $indicator.closest(".entry"),
|
|
||||||
updateTreeScrollbar = $("#tree").get(0).updateScrollbar;
|
|
||||||
|
|
||||||
if ($indicator.hasClass("unknown")) {
|
|
||||||
$.get(api(), { "action": "tree", "href": $entry.find("> a").attr("href") }, function (html) {
|
|
||||||
|
|
||||||
var $content = $(html);
|
|
||||||
|
|
||||||
$indicator.removeClass("unknown");
|
|
||||||
if ($content.find("> li").size() === 0) {
|
|
||||||
$indicator.replaceWith($("<span class='blank' />"));
|
|
||||||
} else {
|
|
||||||
$indicator.addClass("open");
|
|
||||||
$entry.find("> .content").replaceWith($content);
|
|
||||||
updateTreeScrollbar();
|
|
||||||
$content.find(".indicator:not(.initiated)")
|
|
||||||
.click(onIndicatorClick)
|
|
||||||
.addClass("initiated");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else if ($indicator.hasClass("open")) {
|
|
||||||
$indicator.removeClass("open");
|
|
||||||
updateTreeScrollbar(true);
|
|
||||||
$entry.find("> .content").slideUp(function () {
|
|
||||||
updateTreeScrollbar();
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
$indicator.addClass("open");
|
$tree.stop().animate({ left: 18 - $tree.outerWidth() });
|
||||||
updateTreeScrollbar(true);
|
|
||||||
$entry.find("> .content").slideDown(function () {
|
|
||||||
updateTreeScrollbar();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
initIndicators = function () {
|
},
|
||||||
|
initTree = function () {
|
||||||
|
|
||||||
$("#tree .entry.folder .indicator:not(.initiated)")
|
$("#tree").hover(
|
||||||
.click(onIndicatorClick)
|
function () { shiftTree(true); },
|
||||||
.addClass("initiated");
|
function () { shiftTree(); }
|
||||||
},
|
);
|
||||||
getFileType = function (filename) {
|
$window.resize(function () { shiftTree(); });
|
||||||
|
shiftTree(false, true);
|
||||||
|
},
|
||||||
|
selectLinks = function (href) {
|
||||||
|
|
||||||
var dotidx = filename.lastIndexOf('.'),
|
var elements = [];
|
||||||
ext = dotidx >= 0 ? filename.substr(dotidx) : filename;
|
$("a[href^='/']").each(function () {
|
||||||
|
|
||||||
return extToFileType[ext.toLowerCase()] || "unknown";
|
if ($(this).attr("href") === href) {
|
||||||
},
|
elements.push(this);
|
||||||
formatSizes = function () {
|
}
|
||||||
|
});
|
||||||
|
return $(elements);
|
||||||
|
},
|
||||||
|
linkHoverStates = function () {
|
||||||
|
|
||||||
$("#extended .entry .size").each(function () {
|
if (settings.linkHoverStates) {
|
||||||
|
$("a[href^='/']:not(.linkedHoverStates)").each(function () {
|
||||||
|
|
||||||
var $this = $(this),
|
var $a = $(this).addClass("linkedHoverStates"),
|
||||||
bytes = $this.data("bytes"),
|
href = $a.attr("href");
|
||||||
formattedSize = bytes >= 0 ? H5AI.util.formatSize(bytes) : "";
|
|
||||||
|
|
||||||
$this.text(formattedSize);
|
$a.hover(
|
||||||
|
function () { selectLinks(href).addClass("hover"); },
|
||||||
|
function () { selectLinks(href).removeClass("hover"); }
|
||||||
|
);
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
setTotals = function () {
|
},
|
||||||
|
formatDates = function (dateFormat) {
|
||||||
|
|
||||||
var $extended = $("#extended");
|
if (dateFormat) {
|
||||||
|
currentDateFormat = dateFormat;
|
||||||
|
}
|
||||||
|
|
||||||
$(".folderTotal").text($extended.find(".entry.folder:not(.folder-parent)").length);
|
$("#extended .entry .date").each(function () {
|
||||||
$(".fileTotal").text($extended.find(".entry.file").length);
|
|
||||||
},
|
|
||||||
init = function () {
|
|
||||||
|
|
||||||
initViews();
|
var $this = $(this),
|
||||||
viewmode();
|
time = $this.data("time"),
|
||||||
initTopSpace();
|
formattedDate = time ? new Date(time).toString(currentDateFormat) : "";
|
||||||
initTree();
|
|
||||||
linkHoverStates();
|
|
||||||
initLangSelector(config.langs);
|
|
||||||
localize(config.langs, settings.lang, settings.useBrowserLang);
|
|
||||||
formatSizes();
|
|
||||||
setTotals();
|
|
||||||
initIndicators();
|
|
||||||
};
|
|
||||||
|
|
||||||
return {
|
$this.text(formattedDate);
|
||||||
settings: settings,
|
});
|
||||||
hash: hash,
|
},
|
||||||
api: api,
|
localize = function (langs, lang, useBrowserLang) {
|
||||||
image: image,
|
|
||||||
icon: icon,
|
var storedLang = amplify.store(settings.store.lang),
|
||||||
shiftTree: shiftTree,
|
browserLang, selected, key;
|
||||||
linkHoverStates: linkHoverStates,
|
|
||||||
initIndicators: initIndicators,
|
if (langs[storedLang]) {
|
||||||
formatDates: formatDates,
|
lang = storedLang;
|
||||||
getFileType: getFileType,
|
} else if (useBrowserLang) {
|
||||||
init: init
|
browserLang = navigator.language || navigator.browserLanguage;
|
||||||
|
if (browserLang) {
|
||||||
|
if (langs[browserLang]) {
|
||||||
|
lang = browserLang;
|
||||||
|
} else if (browserLang.length > 2 && langs[browserLang.substr(0, 2)]) {
|
||||||
|
lang = browserLang.substr(0, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!langs[lang]) {
|
||||||
|
lang = "en";
|
||||||
|
}
|
||||||
|
|
||||||
|
selected = langs[lang];
|
||||||
|
if (selected) {
|
||||||
|
$.each(selected, function (key, value) {
|
||||||
|
$(".l10n-" + key).text(value);
|
||||||
|
});
|
||||||
|
$(".lang").text(lang);
|
||||||
|
$(".langOption").removeClass("current");
|
||||||
|
$(".langOption." + lang).addClass("current");
|
||||||
|
H5AI.core.hash({lang: lang});
|
||||||
|
}
|
||||||
|
|
||||||
|
formatDates(selected.dateFormat || settings.dateFormat);
|
||||||
|
},
|
||||||
|
initLangSelector = function (langs) {
|
||||||
|
|
||||||
|
var $langOptions = $("#langSelector .langOptions"),
|
||||||
|
sortedLangsKeys = [],
|
||||||
|
$ul;
|
||||||
|
|
||||||
|
$.each(langs, function (lang) {
|
||||||
|
sortedLangsKeys.push(lang);
|
||||||
|
});
|
||||||
|
sortedLangsKeys.sort();
|
||||||
|
|
||||||
|
$ul = $("<ul />");
|
||||||
|
$.each(sortedLangsKeys, function (idx, lang) {
|
||||||
|
$("<li class='langOption' />")
|
||||||
|
.addClass(lang)
|
||||||
|
.text(lang + " - " + langs[lang].lang)
|
||||||
|
.appendTo($ul)
|
||||||
|
.click(function () {
|
||||||
|
amplify.store(settings.store.lang, lang);
|
||||||
|
localize(langs, lang, false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$langOptions
|
||||||
|
.append($ul)
|
||||||
|
.scrollpanel();
|
||||||
|
|
||||||
|
$("#langSelector").hover(
|
||||||
|
function () {
|
||||||
|
$langOptions
|
||||||
|
.css("top", "-" + $langOptions.outerHeight() + "px")
|
||||||
|
.stop(true, true)
|
||||||
|
.fadeIn();
|
||||||
|
$langOptions.get(0).updateScrollbar();
|
||||||
|
},
|
||||||
|
function () {
|
||||||
|
$langOptions
|
||||||
|
.stop(true, true)
|
||||||
|
.fadeOut();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
onIndicatorClick = function (event) {
|
||||||
|
|
||||||
|
var $indicator = $(this),
|
||||||
|
$entry = $indicator.closest(".entry"),
|
||||||
|
updateTreeScrollbar = $("#tree").get(0).updateScrollbar;
|
||||||
|
|
||||||
|
if ($indicator.hasClass("unknown")) {
|
||||||
|
$.get(api(), { "action": "tree", "href": $entry.find("> a").attr("href") }, function (html) {
|
||||||
|
|
||||||
|
var $content = $(html);
|
||||||
|
|
||||||
|
$indicator.removeClass("unknown");
|
||||||
|
if ($content.find("> li").size() === 0) {
|
||||||
|
$indicator.replaceWith($("<span class='blank' />"));
|
||||||
|
} else {
|
||||||
|
$indicator.addClass("open");
|
||||||
|
$entry.find("> .content").replaceWith($content);
|
||||||
|
updateTreeScrollbar();
|
||||||
|
$content.find(".indicator:not(.initiated)")
|
||||||
|
.click(onIndicatorClick)
|
||||||
|
.addClass("initiated");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if ($indicator.hasClass("open")) {
|
||||||
|
$indicator.removeClass("open");
|
||||||
|
updateTreeScrollbar(true);
|
||||||
|
$entry.find("> .content").slideUp(function () {
|
||||||
|
updateTreeScrollbar();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$indicator.addClass("open");
|
||||||
|
updateTreeScrollbar(true);
|
||||||
|
$entry.find("> .content").slideDown(function () {
|
||||||
|
updateTreeScrollbar();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
initIndicators = function () {
|
||||||
|
|
||||||
|
$("#tree .entry.folder .indicator:not(.initiated)")
|
||||||
|
.click(onIndicatorClick)
|
||||||
|
.addClass("initiated");
|
||||||
|
},
|
||||||
|
getFileType = function (filename) {
|
||||||
|
|
||||||
|
var dotidx = filename.lastIndexOf('.'),
|
||||||
|
ext = dotidx >= 0 ? filename.substr(dotidx) : filename;
|
||||||
|
|
||||||
|
return extToFileType[ext.toLowerCase()] || "unknown";
|
||||||
|
},
|
||||||
|
formatSizes = function () {
|
||||||
|
|
||||||
|
$("#extended .entry .size").each(function () {
|
||||||
|
|
||||||
|
var $this = $(this),
|
||||||
|
bytes = $this.data("bytes"),
|
||||||
|
formattedSize = bytes >= 0 ? H5AI.util.formatSize(bytes) : "";
|
||||||
|
|
||||||
|
$this.text(formattedSize);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
setTotals = function () {
|
||||||
|
|
||||||
|
var $extended = $("#extended");
|
||||||
|
|
||||||
|
$(".folderTotal").text($extended.find(".entry.folder:not(.folder-parent)").length);
|
||||||
|
$(".fileTotal").text($extended.find(".entry.file").length);
|
||||||
|
},
|
||||||
|
init = function () {
|
||||||
|
|
||||||
|
initViews();
|
||||||
|
viewmode();
|
||||||
|
initTopSpace();
|
||||||
|
initTree();
|
||||||
|
linkHoverStates();
|
||||||
|
initLangSelector(config.langs);
|
||||||
|
localize(config.langs, settings.lang, settings.useBrowserLang);
|
||||||
|
formatSizes();
|
||||||
|
setTotals();
|
||||||
|
initIndicators();
|
||||||
};
|
};
|
||||||
}());
|
|
||||||
|
H5AI.core = {
|
||||||
|
settings: settings,
|
||||||
|
hash: hash,
|
||||||
|
api: api,
|
||||||
|
image: image,
|
||||||
|
icon: icon,
|
||||||
|
shiftTree: shiftTree,
|
||||||
|
linkHoverStates: linkHoverStates,
|
||||||
|
initIndicators: initIndicators,
|
||||||
|
formatDates: formatDates,
|
||||||
|
getFileType: getFileType,
|
||||||
|
init: init
|
||||||
|
};
|
||||||
|
|
||||||
}(window, jQuery, H5AI, H5AI_CONFIG));
|
}(window, jQuery, H5AI, H5AI_CONFIG));
|
||||||
|
|
|
@ -1,132 +1,129 @@
|
||||||
|
|
||||||
(function (document, $, H5AI) {
|
(function (document, $, H5AI) {
|
||||||
|
|
||||||
H5AI.extended = (function () {
|
var initBreadcrumb = function () {
|
||||||
|
|
||||||
var initBreadcrumb = function () {
|
var $ul = $("body > nav ul"),
|
||||||
|
pathname = "/",
|
||||||
|
path = H5AI.connector.getPath(pathname),
|
||||||
|
pathnameParts = document.location.pathname.split("/"),
|
||||||
|
lastPart = "",
|
||||||
|
title = document.domain;
|
||||||
|
|
||||||
var $ul = $("body > nav ul"),
|
$ul.append(H5AI.html.updateCrumbHtml(path));
|
||||||
pathname = "/",
|
|
||||||
path = H5AI.connector.getPath(pathname),
|
|
||||||
pathnameParts = document.location.pathname.split("/"),
|
|
||||||
lastPart = "",
|
|
||||||
title = document.domain;
|
|
||||||
|
|
||||||
$ul.append(H5AI.html.updateCrumbHtml(path));
|
$.each(pathnameParts, function (idx, part) {
|
||||||
|
if (part !== "") {
|
||||||
|
pathname += part + "/";
|
||||||
|
$ul.append(H5AI.html.updateCrumbHtml(H5AI.connector.getPath(pathname)));
|
||||||
|
lastPart = part + " - ";
|
||||||
|
title += " > " + part;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$.each(pathnameParts, function (idx, part) {
|
document.title = H5AI.util.checkedDecodeUri(lastPart + title);
|
||||||
if (part !== "") {
|
},
|
||||||
pathname += part + "/";
|
initExtendedView = function () {
|
||||||
$ul.append(H5AI.html.updateCrumbHtml(H5AI.connector.getPath(pathname)));
|
|
||||||
lastPart = part + " - ";
|
var $ul, $li;
|
||||||
title += " > " + part;
|
|
||||||
|
$ul = $("<ul/>");
|
||||||
|
$li = $("<li class='header' />")
|
||||||
|
.appendTo($ul)
|
||||||
|
.append($("<a class='icon'></a>"))
|
||||||
|
.append($("<a class='label' href='#'><span class='l10n-name'></span></a>"))
|
||||||
|
.append($("<a class='date' href='#'><span class='l10n-lastModified'></span></a>"))
|
||||||
|
.append($("<a class='size' href='#'><span class='l10n-size'></span></a>"));
|
||||||
|
|
||||||
|
// entries
|
||||||
|
$("#table td").closest("tr").each(function () {
|
||||||
|
var path = H5AI.connector.getPath(document.location.pathname, this);
|
||||||
|
$ul.append(H5AI.html.updateExtendedHtml(path));
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#extended").append($ul);
|
||||||
|
|
||||||
|
// empty
|
||||||
|
if ($ul.children(".entry:not(.folder-parent)").size() === 0) {
|
||||||
|
$("#extended").append($("<div class='empty l10n-empty'>empty</div>"));
|
||||||
|
}
|
||||||
|
$("#extended").append($("<div class='no-match l10n-noMatch'>no match</div>"));
|
||||||
|
},
|
||||||
|
customize = function () {
|
||||||
|
|
||||||
|
if (H5AI.core.settings.customHeader) {
|
||||||
|
$.ajax({
|
||||||
|
url: H5AI.core.settings.customHeader,
|
||||||
|
dataType: "html",
|
||||||
|
success: function (data) {
|
||||||
|
$("#content > header").append($(data)).show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
document.title = H5AI.util.checkedDecodeUri(lastPart + title);
|
if (H5AI.core.settings.customFooter) {
|
||||||
},
|
$.ajax({
|
||||||
initExtendedView = function () {
|
url: H5AI.core.settings.customFooter,
|
||||||
|
dataType: "html",
|
||||||
var $ul, $li;
|
success: function (data) {
|
||||||
|
$("#content > footer").prepend($(data)).show();
|
||||||
$ul = $("<ul/>");
|
}
|
||||||
$li = $("<li class='header' />")
|
|
||||||
.appendTo($ul)
|
|
||||||
.append($("<a class='icon'></a>"))
|
|
||||||
.append($("<a class='label' href='#'><span class='l10n-name'></span></a>"))
|
|
||||||
.append($("<a class='date' href='#'><span class='l10n-lastModified'></span></a>"))
|
|
||||||
.append($("<a class='size' href='#'><span class='l10n-size'></span></a>"));
|
|
||||||
|
|
||||||
// entries
|
|
||||||
$("#table td").closest("tr").each(function () {
|
|
||||||
var path = H5AI.connector.getPath(document.location.pathname, this);
|
|
||||||
$ul.append(H5AI.html.updateExtendedHtml(path));
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fetchPath = function (pathname, callback) {
|
||||||
|
|
||||||
$("#extended").append($ul);
|
H5AI.connector.fetchStatusAndContent(pathname, false, function (status, content) {
|
||||||
|
|
||||||
// empty
|
var path = H5AI.connector.getPath(pathname);
|
||||||
if ($ul.children(".entry:not(.folder-parent)").size() === 0) {
|
|
||||||
$("#extended").append($("<div class='empty l10n-empty'>empty</div>"));
|
path.status = status;
|
||||||
|
path.content = content;
|
||||||
|
callback(path);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
fetchTree = function (pathname, callback, childPath) {
|
||||||
|
|
||||||
|
fetchPath(pathname, function (path) {
|
||||||
|
|
||||||
|
var parent = H5AI.util.splitPath(pathname).parent;
|
||||||
|
|
||||||
|
path.treeOpen = true;
|
||||||
|
if (childPath) {
|
||||||
|
path.content[childPath.absHref] = childPath;
|
||||||
}
|
}
|
||||||
$("#extended").append($("<div class='no-match l10n-noMatch'>no match</div>"));
|
if (parent === null) {
|
||||||
},
|
|
||||||
customize = function () {
|
|
||||||
|
|
||||||
if (H5AI.core.settings.customHeader) {
|
|
||||||
$.ajax({
|
|
||||||
url: H5AI.core.settings.customHeader,
|
|
||||||
dataType: "html",
|
|
||||||
success: function (data) {
|
|
||||||
$("#content > header").append($(data)).show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (H5AI.core.settings.customFooter) {
|
|
||||||
$.ajax({
|
|
||||||
url: H5AI.core.settings.customFooter,
|
|
||||||
dataType: "html",
|
|
||||||
success: function (data) {
|
|
||||||
$("#content > footer").prepend($(data)).show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
fetchPath = function (pathname, callback) {
|
|
||||||
|
|
||||||
H5AI.connector.fetchStatusAndContent(pathname, false, function (status, content) {
|
|
||||||
|
|
||||||
var path = H5AI.connector.getPath(pathname);
|
|
||||||
|
|
||||||
path.status = status;
|
|
||||||
path.content = content;
|
|
||||||
callback(path);
|
callback(path);
|
||||||
});
|
} else {
|
||||||
},
|
fetchTree(parent, callback, path);
|
||||||
fetchTree = function (pathname, callback, childPath) {
|
|
||||||
|
|
||||||
fetchPath(pathname, function (path) {
|
|
||||||
|
|
||||||
var parent = H5AI.util.splitPath(pathname).parent;
|
|
||||||
|
|
||||||
path.treeOpen = true;
|
|
||||||
if (childPath) {
|
|
||||||
path.content[childPath.absHref] = childPath;
|
|
||||||
}
|
|
||||||
if (parent === null) {
|
|
||||||
callback(path);
|
|
||||||
} else {
|
|
||||||
fetchTree(parent, callback, path);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
populateTree = function () {
|
|
||||||
|
|
||||||
fetchTree(document.location.pathname, function (path) {
|
|
||||||
$("#tree")
|
|
||||||
.append(H5AI.html.updateTreeHtml(path))
|
|
||||||
.scrollpanel()
|
|
||||||
.show();
|
|
||||||
H5AI.core.shiftTree(false, true);
|
|
||||||
H5AI.core.linkHoverStates();
|
|
||||||
setTimeout(function () { $("#tree").get(0).updateScrollbar(); }, 1);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
init = function () {
|
|
||||||
|
|
||||||
initBreadcrumb();
|
|
||||||
initExtendedView();
|
|
||||||
customize();
|
|
||||||
H5AI.connector.updatePaths();
|
|
||||||
if (H5AI.core.settings.showTree) {
|
|
||||||
populateTree();
|
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
},
|
||||||
|
populateTree = function () {
|
||||||
|
|
||||||
return {
|
fetchTree(document.location.pathname, function (path) {
|
||||||
init: init
|
$("#tree")
|
||||||
|
.append(H5AI.html.updateTreeHtml(path))
|
||||||
|
.scrollpanel()
|
||||||
|
.show();
|
||||||
|
H5AI.core.shiftTree(false, true);
|
||||||
|
H5AI.core.linkHoverStates();
|
||||||
|
setTimeout(function () { $("#tree").get(0).updateScrollbar(); }, 1);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
init = function () {
|
||||||
|
|
||||||
|
initBreadcrumb();
|
||||||
|
initExtendedView();
|
||||||
|
customize();
|
||||||
|
H5AI.connector.updatePaths();
|
||||||
|
if (H5AI.core.settings.showTree) {
|
||||||
|
populateTree();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}());
|
|
||||||
|
H5AI.extended = {
|
||||||
|
init: init
|
||||||
|
};
|
||||||
|
|
||||||
}(document, jQuery, H5AI));
|
}(document, jQuery, H5AI));
|
||||||
|
|
|
@ -1,111 +1,107 @@
|
||||||
|
|
||||||
(function ($, H5AI) {
|
(function ($, H5AI) {
|
||||||
|
|
||||||
H5AI.finder = (function () {
|
var filter = function (re) {
|
||||||
|
|
||||||
var filter = function (re) {
|
var match = [],
|
||||||
|
noMatch = [];
|
||||||
|
|
||||||
var match = [],
|
if (re) {
|
||||||
noMatch = [];
|
$('#extended .entry').each(function () {
|
||||||
|
|
||||||
if (re) {
|
var label = $(this).find('.label').text();
|
||||||
$('#extended .entry').each(function () {
|
|
||||||
|
|
||||||
var label = $(this).find('.label').text();
|
if (label.match(re)) {
|
||||||
|
match.push(this);
|
||||||
if (label.match(re)) {
|
} else {
|
||||||
match.push(this);
|
noMatch.push(this);
|
||||||
} else {
|
|
||||||
noMatch.push(this);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
match = $('#extended .entry');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($(match).length) {
|
|
||||||
$('#extended .no-match').hide();
|
|
||||||
} else {
|
|
||||||
setTimeout(function () {
|
|
||||||
|
|
||||||
$('#extended .no-match').show();
|
|
||||||
}, 200);
|
|
||||||
}
|
|
||||||
$(match).fadeIn(200);
|
|
||||||
$(noMatch).fadeOut(200);
|
|
||||||
},
|
|
||||||
checkState = function (focus) {
|
|
||||||
|
|
||||||
var $filter = $('#filter'),
|
|
||||||
$input = $filter.find('input'),
|
|
||||||
val = $input.val();
|
|
||||||
|
|
||||||
if (val || focus) {
|
|
||||||
$filter.addClass('current');
|
|
||||||
} else {
|
|
||||||
$filter.removeClass('current');
|
|
||||||
}
|
|
||||||
H5AI.core.hash({filter: val});
|
|
||||||
},
|
|
||||||
parseFilterSequence = function (sequence) {
|
|
||||||
|
|
||||||
if (sequence.substr(0,3) === 're:') {
|
|
||||||
return new RegExp(sequence.substr(3));
|
|
||||||
}
|
|
||||||
|
|
||||||
sequence = $.map($.trim(sequence).split(/\s+/), function (part) {
|
|
||||||
|
|
||||||
return H5AI.util.reEscape(part);
|
|
||||||
}).join('|');
|
|
||||||
return new RegExp(sequence);
|
|
||||||
},
|
|
||||||
init = function () {
|
|
||||||
|
|
||||||
if (H5AI.core.settings.showFilter) {
|
|
||||||
$("<li id='filter'><span class='element'><img alt='filter' /><input type='text' value='' placeholder='filter' /></span></li>")
|
|
||||||
.on('click', function () {
|
|
||||||
|
|
||||||
var $input = $(this).find('input');
|
|
||||||
$input.focus();
|
|
||||||
})
|
|
||||||
.find("img").attr("src", H5AI.core.image("filter")).end()
|
|
||||||
.find("input")
|
|
||||||
.on('focus', function () {
|
|
||||||
|
|
||||||
checkState(true);
|
|
||||||
})
|
|
||||||
.on('blur', function () {
|
|
||||||
|
|
||||||
checkState(false);
|
|
||||||
})
|
|
||||||
.on('keyup', function () {
|
|
||||||
|
|
||||||
var $input = $(this),
|
|
||||||
val = $input.val();
|
|
||||||
|
|
||||||
if (val) {
|
|
||||||
filter(parseFilterSequence(val));
|
|
||||||
} else {
|
|
||||||
filter();
|
|
||||||
}
|
|
||||||
checkState($input.is(':focus'));
|
|
||||||
})
|
|
||||||
.end()
|
|
||||||
.appendTo($("#navbar"));
|
|
||||||
|
|
||||||
var initialFilter = H5AI.core.hash('filter');
|
|
||||||
if (initialFilter) {
|
|
||||||
$('#filter input').val(initialFilter);
|
|
||||||
checkState(false);
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
match = $('#extended .entry');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($(match).length) {
|
||||||
|
$('#extended .no-match').hide();
|
||||||
|
} else {
|
||||||
|
setTimeout(function () {
|
||||||
|
|
||||||
|
$('#extended .no-match').show();
|
||||||
|
}, 200);
|
||||||
|
}
|
||||||
|
$(match).fadeIn(200);
|
||||||
|
$(noMatch).fadeOut(200);
|
||||||
|
},
|
||||||
|
checkState = function (focus) {
|
||||||
|
|
||||||
|
var $filter = $('#filter'),
|
||||||
|
$input = $filter.find('input'),
|
||||||
|
val = $input.val();
|
||||||
|
|
||||||
|
if (val || focus) {
|
||||||
|
$filter.addClass('current');
|
||||||
|
} else {
|
||||||
|
$filter.removeClass('current');
|
||||||
|
}
|
||||||
|
H5AI.core.hash({filter: val});
|
||||||
|
},
|
||||||
|
parseFilterSequence = function (sequence) {
|
||||||
|
|
||||||
|
if (sequence.substr(0,3) === 're:') {
|
||||||
|
return new RegExp(sequence.substr(3));
|
||||||
|
}
|
||||||
|
|
||||||
|
sequence = $.map($.trim(sequence).split(/\s+/), function (part) {
|
||||||
|
|
||||||
|
return H5AI.util.reEscape(part);
|
||||||
|
}).join('|');
|
||||||
|
return new RegExp(sequence);
|
||||||
|
},
|
||||||
|
init = function () {
|
||||||
|
|
||||||
|
if (H5AI.core.settings.showFilter) {
|
||||||
|
$("<li id='filter'><span class='element'><img alt='filter' /><input type='text' value='' placeholder='filter' /></span></li>")
|
||||||
|
.on('click', function () {
|
||||||
|
|
||||||
|
var $input = $(this).find('input');
|
||||||
|
$input.focus();
|
||||||
|
})
|
||||||
|
.find("img").attr("src", H5AI.core.image("filter")).end()
|
||||||
|
.find("input")
|
||||||
|
.on('focus', function () {
|
||||||
|
|
||||||
|
checkState(true);
|
||||||
|
})
|
||||||
|
.on('blur', function () {
|
||||||
|
|
||||||
|
checkState(false);
|
||||||
|
})
|
||||||
|
.on('keyup', function () {
|
||||||
|
|
||||||
|
var $input = $(this),
|
||||||
|
val = $input.val();
|
||||||
|
|
||||||
|
if (val) {
|
||||||
|
filter(parseFilterSequence(val));
|
||||||
|
} else {
|
||||||
|
filter();
|
||||||
|
}
|
||||||
|
checkState($input.is(':focus'));
|
||||||
|
})
|
||||||
|
.end()
|
||||||
|
.appendTo($("#navbar"));
|
||||||
|
|
||||||
|
var initialFilter = H5AI.core.hash('filter');
|
||||||
|
if (initialFilter) {
|
||||||
|
$('#filter input').val(initialFilter);
|
||||||
|
checkState(false);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
return {
|
|
||||||
init: init,
|
|
||||||
filter: filter
|
|
||||||
};
|
};
|
||||||
}());
|
|
||||||
|
H5AI.finder = {
|
||||||
|
init: init,
|
||||||
|
filter: filter
|
||||||
|
};
|
||||||
|
|
||||||
}(jQuery, H5AI));
|
}(jQuery, H5AI));
|
|
@ -1,264 +1,261 @@
|
||||||
|
|
||||||
(function ($, H5AI) {
|
(function ($, H5AI) {
|
||||||
|
|
||||||
H5AI.html = (function () {
|
var onClick = function (path, context) {
|
||||||
|
|
||||||
var onClick = function (path, context) {
|
},
|
||||||
|
updateCrumbHtml = function (path) {
|
||||||
|
|
||||||
},
|
var $html, $a;
|
||||||
updateCrumbHtml = function (path) {
|
|
||||||
|
|
||||||
var $html, $a;
|
if (path.html.$crumb && path.html.$crumb.data("status") === path.status) {
|
||||||
|
return path.html.$crumb;
|
||||||
|
}
|
||||||
|
|
||||||
if (path.html.$crumb && path.html.$crumb.data("status") === path.status) {
|
$html = $("<li class='crumb'><a><img alt='>' /><span></span></a></li>")
|
||||||
return path.html.$crumb;
|
.addClass(path.isFolder ? "folder" : "file");
|
||||||
|
|
||||||
|
if (path.status) {
|
||||||
|
$html.data("status", path.status);
|
||||||
|
}
|
||||||
|
|
||||||
|
$a = $html.find("a")
|
||||||
|
.attr("href", path.absHref)
|
||||||
|
.click(function() { onClick(path, "crumb"); })
|
||||||
|
.find("img").attr("src", H5AI.core.image("crumb")).end()
|
||||||
|
.find("span").text(path.label).end();
|
||||||
|
|
||||||
|
if (path.isDomain) {
|
||||||
|
$html.addClass("domain");
|
||||||
|
$a.find("img").attr("src", H5AI.core.image("home"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (path.isCurrentFolder) {
|
||||||
|
$html.addClass("current");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isNaN(path.status)) {
|
||||||
|
if (path.status === 200) {
|
||||||
|
$a.append($("<img class='hint' src='" + H5AI.core.image("page") + "' alt='not listable' />"));
|
||||||
|
} else {
|
||||||
|
$a.append($("<span class='hint'>(" + path.status + ")</span>"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (path.html.$crumb) {
|
||||||
|
path.html.$crumb.replaceWith($html);
|
||||||
|
}
|
||||||
|
path.html.$crumb = $html;
|
||||||
|
|
||||||
|
return $html;
|
||||||
|
},
|
||||||
|
updateExtendedHtml = function (path) {
|
||||||
|
|
||||||
|
var $html, $a, $label,
|
||||||
|
formattedDate = path.date ? path.date.toString(H5AI.core.settings.dateFormat) : "",
|
||||||
|
imgClass = "",
|
||||||
|
icon16 = H5AI.core.icon(path.type),
|
||||||
|
icon48 = H5AI.core.icon(path.type, true);
|
||||||
|
|
||||||
|
if (path.html.$extended && path.html.$extended.data("status") === path.status) {
|
||||||
|
return path.html.$extended;
|
||||||
|
}
|
||||||
|
|
||||||
|
$html = $("<li class='entry' />")
|
||||||
|
.data("path", path)
|
||||||
|
.addClass(path.isFolder ? "folder" : "file");
|
||||||
|
|
||||||
|
if (path.status) {
|
||||||
|
$html.data("status", path.status);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (H5AI.core.settings.showThumbs === true && $.inArray(path.type, H5AI.core.settings.thumbTypes) >= 0) {
|
||||||
|
imgClass = "class='thumb'";
|
||||||
|
var escapedHref = path.absHref.replace(/'/g, "%27").replace(/"/g, "%22");
|
||||||
|
icon16 = H5AI.core.api() + "?action=thumb&href=" + escapedHref + "&width=16&height=16&mode=square";
|
||||||
|
icon48 = H5AI.core.api() + "?action=thumb&href=" + escapedHref + "&width=96&height=46&mode=rational";
|
||||||
|
}
|
||||||
|
|
||||||
|
$label = $("<span class='label'>" + path.label + "</span>");
|
||||||
|
$a = $("<a />")
|
||||||
|
.attr("href", path.absHref)
|
||||||
|
.click(function() { onClick(path, "extended"); })
|
||||||
|
.appendTo($html)
|
||||||
|
.append($("<span class='icon small'><img " + imgClass + " src='" + icon16 + "' alt='" + path.type + "' /></span>"))
|
||||||
|
.append($("<span class='icon big'><img " + imgClass + " src='" + icon48 + "' alt='" + path.type + "' /></span>"))
|
||||||
|
.append($label)
|
||||||
|
.append($("<span class='date' data-time='" + path.time + "'></span>"))
|
||||||
|
.append($("<span class='size' data-bytes='" + path.size + "'></span>"));
|
||||||
|
|
||||||
|
$a.hover(
|
||||||
|
function () {
|
||||||
|
if ($("#extended").hasClass("icons-view")) {
|
||||||
|
var $this = $(this);
|
||||||
|
$(".status.default").hide();
|
||||||
|
$(".status.dynamic")
|
||||||
|
.empty()
|
||||||
|
.append($this.find(".label").clone())
|
||||||
|
.append($("<span class='sep'>·</span>"))
|
||||||
|
.append($this.find(".date").clone())
|
||||||
|
.show();
|
||||||
|
|
||||||
|
if (!$this.closest(".entry").hasClass("folder")) {
|
||||||
|
$(".status.dynamic")
|
||||||
|
.append($("<span class='sep'>·</span>"))
|
||||||
|
.append($this.find(".size").clone());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
function () {
|
||||||
|
$(".status.default").show();
|
||||||
|
$(".status.dynamic").empty().hide();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (path.isParentFolder) {
|
||||||
|
if (!H5AI.core.settings.setParentFolderLabels) {
|
||||||
|
$label.addClass("l10n-parentDirectory");
|
||||||
|
}
|
||||||
|
$html.addClass("folder-parent");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isNaN(path.status)) {
|
||||||
|
if (path.status === 200) {
|
||||||
|
$html.addClass("page");
|
||||||
|
$a.find(".icon.small img").attr("src", H5AI.core.icon("folder-page"));
|
||||||
|
$a.find(".icon.big img").attr("src", H5AI.core.icon("folder-page", true));
|
||||||
|
} else {
|
||||||
|
$html.addClass("error");
|
||||||
|
$label.append($("<span class='hint'> " + path.status + " </span>"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (path.html.$extended) {
|
||||||
|
path.html.$extended.replaceWith($html);
|
||||||
|
H5AI.core.formatDates();
|
||||||
|
}
|
||||||
|
path.html.$extended = $html;
|
||||||
|
|
||||||
|
return $html;
|
||||||
|
},
|
||||||
|
updateTreeHtml = function (path) {
|
||||||
|
|
||||||
|
var $html, $blank, $a, $indicator, $ul, idx;
|
||||||
|
|
||||||
|
$html = $("<div class='entry' />")
|
||||||
|
.data("path", path)
|
||||||
|
.addClass(path.isFolder ? "folder" : "file");
|
||||||
|
|
||||||
|
$blank = $("<span class='blank' />").appendTo($html);
|
||||||
|
|
||||||
|
$a = $("<a />")
|
||||||
|
.attr("href", path.absHref)
|
||||||
|
.click(function() { onClick(path, "tree"); })
|
||||||
|
.appendTo($html)
|
||||||
|
.append($("<span class='icon'><img src='" + H5AI.core.icon(path.type) + "' /></span>"))
|
||||||
|
.append($("<span class='label'>" + path.label + "</span>"));
|
||||||
|
|
||||||
|
if (path.isFolder) {
|
||||||
|
// indicator
|
||||||
|
if (path.status === undefined || !path.isEmpty()) {
|
||||||
|
$indicator = $("<span class='indicator initiated'><img src='" + H5AI.core.image("tree") + "' /></span>")
|
||||||
|
.click(function (event) {
|
||||||
|
|
||||||
|
var $entry = $indicator.closest(".entry"); // $html
|
||||||
|
|
||||||
|
if ($indicator.hasClass("unknown")) {
|
||||||
|
H5AI.connector.fetchStatusAndContent(path.absHref, false, function (status, content) {
|
||||||
|
|
||||||
|
path.status = status;
|
||||||
|
path.content = content;
|
||||||
|
path.treeOpen = true;
|
||||||
|
$("#tree").get(0).updateScrollbar(true);
|
||||||
|
updateTreeHtml(path);
|
||||||
|
$("#tree").get(0).updateScrollbar();
|
||||||
|
});
|
||||||
|
} else if ($indicator.hasClass("open")) {
|
||||||
|
path.treeOpen = false;
|
||||||
|
$indicator.removeClass("open");
|
||||||
|
$("#tree").get(0).updateScrollbar(true);
|
||||||
|
$entry.find("> ul.content").slideUp(function() {
|
||||||
|
|
||||||
|
$("#tree").get(0).updateScrollbar();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
path.treeOpen = true;
|
||||||
|
$indicator.addClass("open");
|
||||||
|
$("#tree").get(0).updateScrollbar(true);
|
||||||
|
$entry.find("> ul.content").slideDown(function() {
|
||||||
|
|
||||||
|
$("#tree").get(0).updateScrollbar();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
if (path.status === undefined) {
|
||||||
|
$indicator.addClass("unknown");
|
||||||
|
} else if (path.treeOpen) {
|
||||||
|
$indicator.addClass("open");
|
||||||
|
}
|
||||||
|
|
||||||
|
$blank.replaceWith($indicator);
|
||||||
}
|
}
|
||||||
|
|
||||||
$html = $("<li class='crumb'><a><img alt='>' /><span></span></a></li>")
|
// is path the domain?
|
||||||
.addClass(path.isFolder ? "folder" : "file");
|
|
||||||
|
|
||||||
if (path.status) {
|
|
||||||
$html.data("status", path.status);
|
|
||||||
}
|
|
||||||
|
|
||||||
$a = $html.find("a")
|
|
||||||
.attr("href", path.absHref)
|
|
||||||
.click(function() { onClick(path, "crumb"); })
|
|
||||||
.find("img").attr("src", H5AI.core.image("crumb")).end()
|
|
||||||
.find("span").text(path.label).end();
|
|
||||||
|
|
||||||
if (path.isDomain) {
|
if (path.isDomain) {
|
||||||
$html.addClass("domain");
|
$html.addClass("domain");
|
||||||
$a.find("img").attr("src", H5AI.core.image("home"));
|
$a.find(".icon img").attr("src", H5AI.core.icon("folder-home"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// is path the current folder?
|
||||||
if (path.isCurrentFolder) {
|
if (path.isCurrentFolder) {
|
||||||
$html.addClass("current");
|
$html.addClass("current");
|
||||||
|
$a.find(".icon img").attr("src", H5AI.core.icon("folder-open"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// does it have subfolders?
|
||||||
|
if (!path.isEmpty()) {
|
||||||
|
$ul = $("<ul class='content' />").appendTo($html);
|
||||||
|
$.each(path.content, function (idx, entry) {
|
||||||
|
$("<li />").append(updateTreeHtml(entry)).appendTo($ul);
|
||||||
|
});
|
||||||
|
if (path.status === undefined || !path.treeOpen) {
|
||||||
|
$ul.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// reflect folder status
|
||||||
if (!isNaN(path.status)) {
|
if (!isNaN(path.status)) {
|
||||||
if (path.status === 200) {
|
if (path.status === 200) {
|
||||||
$a.append($("<img class='hint' src='" + H5AI.core.image("page") + "' alt='not listable' />"));
|
$a.find(".icon img").attr("src", H5AI.core.icon("folder-page"));
|
||||||
} else {
|
$a.append($("<span class='hint'><img src='" + H5AI.core.image("page") + "' /></span>"));
|
||||||
$a.append($("<span class='hint'>(" + path.status + ")</span>"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (path.html.$crumb) {
|
|
||||||
path.html.$crumb.replaceWith($html);
|
|
||||||
}
|
|
||||||
path.html.$crumb = $html;
|
|
||||||
|
|
||||||
return $html;
|
|
||||||
},
|
|
||||||
updateExtendedHtml = function (path) {
|
|
||||||
|
|
||||||
var $html, $a, $label,
|
|
||||||
formattedDate = path.date ? path.date.toString(H5AI.core.settings.dateFormat) : "",
|
|
||||||
imgClass = "",
|
|
||||||
icon16 = H5AI.core.icon(path.type),
|
|
||||||
icon48 = H5AI.core.icon(path.type, true);
|
|
||||||
|
|
||||||
if (path.html.$extended && path.html.$extended.data("status") === path.status) {
|
|
||||||
return path.html.$extended;
|
|
||||||
}
|
|
||||||
|
|
||||||
$html = $("<li class='entry' />")
|
|
||||||
.data("path", path)
|
|
||||||
.addClass(path.isFolder ? "folder" : "file");
|
|
||||||
|
|
||||||
if (path.status) {
|
|
||||||
$html.data("status", path.status);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (H5AI.core.settings.showThumbs === true && $.inArray(path.type, H5AI.core.settings.thumbTypes) >= 0) {
|
|
||||||
imgClass = "class='thumb'";
|
|
||||||
var escapedHref = path.absHref.replace(/'/g, "%27").replace(/"/g, "%22");
|
|
||||||
icon16 = H5AI.core.api() + "?action=thumb&href=" + escapedHref + "&width=16&height=16&mode=square";
|
|
||||||
icon48 = H5AI.core.api() + "?action=thumb&href=" + escapedHref + "&width=96&height=46&mode=rational";
|
|
||||||
}
|
|
||||||
|
|
||||||
$label = $("<span class='label'>" + path.label + "</span>");
|
|
||||||
$a = $("<a />")
|
|
||||||
.attr("href", path.absHref)
|
|
||||||
.click(function() { onClick(path, "extended"); })
|
|
||||||
.appendTo($html)
|
|
||||||
.append($("<span class='icon small'><img " + imgClass + " src='" + icon16 + "' alt='" + path.type + "' /></span>"))
|
|
||||||
.append($("<span class='icon big'><img " + imgClass + " src='" + icon48 + "' alt='" + path.type + "' /></span>"))
|
|
||||||
.append($label)
|
|
||||||
.append($("<span class='date' data-time='" + path.time + "'></span>"))
|
|
||||||
.append($("<span class='size' data-bytes='" + path.size + "'></span>"));
|
|
||||||
|
|
||||||
$a.hover(
|
|
||||||
function () {
|
|
||||||
if ($("#extended").hasClass("icons-view")) {
|
|
||||||
var $this = $(this);
|
|
||||||
$(".status.default").hide();
|
|
||||||
$(".status.dynamic")
|
|
||||||
.empty()
|
|
||||||
.append($this.find(".label").clone())
|
|
||||||
.append($("<span class='sep'>·</span>"))
|
|
||||||
.append($this.find(".date").clone())
|
|
||||||
.show();
|
|
||||||
|
|
||||||
if (!$this.closest(".entry").hasClass("folder")) {
|
|
||||||
$(".status.dynamic")
|
|
||||||
.append($("<span class='sep'>·</span>"))
|
|
||||||
.append($this.find(".size").clone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
function () {
|
|
||||||
$(".status.default").show();
|
|
||||||
$(".status.dynamic").empty().hide();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
if (path.isParentFolder) {
|
|
||||||
if (!H5AI.core.settings.setParentFolderLabels) {
|
|
||||||
$label.addClass("l10n-parentDirectory");
|
|
||||||
}
|
|
||||||
$html.addClass("folder-parent");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isNaN(path.status)) {
|
|
||||||
if (path.status === 200) {
|
|
||||||
$html.addClass("page");
|
|
||||||
$a.find(".icon.small img").attr("src", H5AI.core.icon("folder-page"));
|
|
||||||
$a.find(".icon.big img").attr("src", H5AI.core.icon("folder-page", true));
|
|
||||||
} else {
|
} else {
|
||||||
$html.addClass("error");
|
$html.addClass("error");
|
||||||
$label.append($("<span class='hint'> " + path.status + " </span>"));
|
$a.append($("<span class='hint'>" + path.status + "</span>"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (path.html.$extended) {
|
if (path.html.$tree) {
|
||||||
path.html.$extended.replaceWith($html);
|
path.html.$tree.replaceWith($html);
|
||||||
H5AI.core.formatDates();
|
}
|
||||||
}
|
path.html.$tree = $html;
|
||||||
path.html.$extended = $html;
|
|
||||||
|
|
||||||
return $html;
|
return $html;
|
||||||
},
|
},
|
||||||
updateTreeHtml = function (path) {
|
updateHtml = function (path) {
|
||||||
|
|
||||||
var $html, $blank, $a, $indicator, $ul, idx;
|
updateCrumbHtml(path);
|
||||||
|
updateExtendedHtml(path);
|
||||||
$html = $("<div class='entry' />")
|
updateTreeHtml(path);
|
||||||
.data("path", path)
|
|
||||||
.addClass(path.isFolder ? "folder" : "file");
|
|
||||||
|
|
||||||
$blank = $("<span class='blank' />").appendTo($html);
|
|
||||||
|
|
||||||
$a = $("<a />")
|
|
||||||
.attr("href", path.absHref)
|
|
||||||
.click(function() { onClick(path, "tree"); })
|
|
||||||
.appendTo($html)
|
|
||||||
.append($("<span class='icon'><img src='" + H5AI.core.icon(path.type) + "' /></span>"))
|
|
||||||
.append($("<span class='label'>" + path.label + "</span>"));
|
|
||||||
|
|
||||||
if (path.isFolder) {
|
|
||||||
// indicator
|
|
||||||
if (path.status === undefined || !path.isEmpty()) {
|
|
||||||
$indicator = $("<span class='indicator initiated'><img src='" + H5AI.core.image("tree") + "' /></span>")
|
|
||||||
.click(function (event) {
|
|
||||||
|
|
||||||
var $entry = $indicator.closest(".entry"); // $html
|
|
||||||
|
|
||||||
if ($indicator.hasClass("unknown")) {
|
|
||||||
H5AI.connector.fetchStatusAndContent(path.absHref, false, function (status, content) {
|
|
||||||
|
|
||||||
path.status = status;
|
|
||||||
path.content = content;
|
|
||||||
path.treeOpen = true;
|
|
||||||
$("#tree").get(0).updateScrollbar(true);
|
|
||||||
updateTreeHtml(path);
|
|
||||||
$("#tree").get(0).updateScrollbar();
|
|
||||||
});
|
|
||||||
} else if ($indicator.hasClass("open")) {
|
|
||||||
path.treeOpen = false;
|
|
||||||
$indicator.removeClass("open");
|
|
||||||
$("#tree").get(0).updateScrollbar(true);
|
|
||||||
$entry.find("> ul.content").slideUp(function() {
|
|
||||||
|
|
||||||
$("#tree").get(0).updateScrollbar();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
path.treeOpen = true;
|
|
||||||
$indicator.addClass("open");
|
|
||||||
$("#tree").get(0).updateScrollbar(true);
|
|
||||||
$entry.find("> ul.content").slideDown(function() {
|
|
||||||
|
|
||||||
$("#tree").get(0).updateScrollbar();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
if (path.status === undefined) {
|
|
||||||
$indicator.addClass("unknown");
|
|
||||||
} else if (path.treeOpen) {
|
|
||||||
$indicator.addClass("open");
|
|
||||||
}
|
|
||||||
|
|
||||||
$blank.replaceWith($indicator);
|
|
||||||
}
|
|
||||||
|
|
||||||
// is path the domain?
|
|
||||||
if (path.isDomain) {
|
|
||||||
$html.addClass("domain");
|
|
||||||
$a.find(".icon img").attr("src", H5AI.core.icon("folder-home"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// is path the current folder?
|
|
||||||
if (path.isCurrentFolder) {
|
|
||||||
$html.addClass("current");
|
|
||||||
$a.find(".icon img").attr("src", H5AI.core.icon("folder-open"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// does it have subfolders?
|
|
||||||
if (!path.isEmpty()) {
|
|
||||||
$ul = $("<ul class='content' />").appendTo($html);
|
|
||||||
$.each(path.content, function (idx, entry) {
|
|
||||||
$("<li />").append(updateTreeHtml(entry)).appendTo($ul);
|
|
||||||
});
|
|
||||||
if (path.status === undefined || !path.treeOpen) {
|
|
||||||
$ul.hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// reflect folder status
|
|
||||||
if (!isNaN(path.status)) {
|
|
||||||
if (path.status === 200) {
|
|
||||||
$a.find(".icon img").attr("src", H5AI.core.icon("folder-page"));
|
|
||||||
$a.append($("<span class='hint'><img src='" + H5AI.core.image("page") + "' /></span>"));
|
|
||||||
} else {
|
|
||||||
$html.addClass("error");
|
|
||||||
$a.append($("<span class='hint'>" + path.status + "</span>"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (path.html.$tree) {
|
|
||||||
path.html.$tree.replaceWith($html);
|
|
||||||
}
|
|
||||||
path.html.$tree = $html;
|
|
||||||
|
|
||||||
return $html;
|
|
||||||
},
|
|
||||||
updateHtml = function (path) {
|
|
||||||
|
|
||||||
updateCrumbHtml(path);
|
|
||||||
updateExtendedHtml(path);
|
|
||||||
updateTreeHtml(path);
|
|
||||||
};
|
|
||||||
|
|
||||||
return {
|
|
||||||
updateCrumbHtml: updateCrumbHtml,
|
|
||||||
updateExtendedHtml: updateExtendedHtml,
|
|
||||||
updateTreeHtml: updateTreeHtml,
|
|
||||||
updateHtml: updateHtml
|
|
||||||
};
|
};
|
||||||
}());
|
|
||||||
|
H5AI.html = {
|
||||||
|
updateCrumbHtml: updateCrumbHtml,
|
||||||
|
updateExtendedHtml: updateExtendedHtml,
|
||||||
|
updateTreeHtml: updateTreeHtml,
|
||||||
|
updateHtml: updateHtml
|
||||||
|
};
|
||||||
|
|
||||||
}(jQuery, H5AI));
|
}(jQuery, H5AI));
|
||||||
|
|
|
@ -1,158 +1,155 @@
|
||||||
|
|
||||||
(function ($, H5AI) {
|
(function ($, H5AI) {
|
||||||
|
|
||||||
H5AI.sort = (function () {
|
var type = function (entry) {
|
||||||
|
|
||||||
var type = function (entry) {
|
var $entry = $(entry);
|
||||||
|
|
||||||
var $entry = $(entry);
|
if ($entry.hasClass("folder-parent")) {
|
||||||
|
|
||||||
if ($entry.hasClass("folder-parent")) {
|
|
||||||
return 0;
|
|
||||||
} else if ($entry.hasClass("folder")) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 2;
|
|
||||||
},
|
|
||||||
cmp = function (entry1, entry2, rev, getVal) {
|
|
||||||
|
|
||||||
var res, val1, val2;
|
|
||||||
|
|
||||||
res = type(entry1) - type(entry2);
|
|
||||||
if (res !== 0) {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
val1 = getVal(entry1);
|
|
||||||
val2 = getVal(entry2);
|
|
||||||
if (val1 < val2) {
|
|
||||||
return rev ? 1 : -1;
|
|
||||||
} else if (val1 > val2) {
|
|
||||||
return rev ? -1 : 1;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
},
|
} else if ($entry.hasClass("folder")) {
|
||||||
cmpName = function (entry1, entry2) {
|
return 1;
|
||||||
|
}
|
||||||
|
return 2;
|
||||||
|
},
|
||||||
|
cmp = function (entry1, entry2, rev, getVal) {
|
||||||
|
|
||||||
return cmp(entry1, entry2, false, function (entry) {
|
var res, val1, val2;
|
||||||
return $(entry).find(".label").text().toLowerCase();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
cmpTime = function (entry1, entry2) {
|
|
||||||
|
|
||||||
return cmp(entry1, entry2, false, function (entry) {
|
res = type(entry1) - type(entry2);
|
||||||
return $(entry).find(".date").data("time");
|
if (res !== 0) {
|
||||||
});
|
return res;
|
||||||
},
|
}
|
||||||
cmpSize = function (entry1, entry2) {
|
|
||||||
|
|
||||||
return cmp(entry1, entry2, false, function (entry) {
|
val1 = getVal(entry1);
|
||||||
return $(entry).find(".size").data("bytes");
|
val2 = getVal(entry2);
|
||||||
});
|
if (val1 < val2) {
|
||||||
},
|
return rev ? 1 : -1;
|
||||||
cmpNameRev = function (entry1, entry2) {
|
} else if (val1 > val2) {
|
||||||
|
return rev ? -1 : 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
},
|
||||||
|
cmpName = function (entry1, entry2) {
|
||||||
|
|
||||||
return cmp(entry1, entry2, true, function (entry) {
|
return cmp(entry1, entry2, false, function (entry) {
|
||||||
return $(entry).find(".label").text().toLowerCase();
|
return $(entry).find(".label").text().toLowerCase();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
cmpTimeRev = function (entry1, entry2) {
|
cmpTime = function (entry1, entry2) {
|
||||||
|
|
||||||
return cmp(entry1, entry2, true, function (entry) {
|
return cmp(entry1, entry2, false, function (entry) {
|
||||||
return $(entry).find(".date").data("time");
|
return $(entry).find(".date").data("time");
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
cmpSizeRev = function (entry1, entry2) {
|
cmpSize = function (entry1, entry2) {
|
||||||
|
|
||||||
return cmp(entry1, entry2, true, function (entry) {
|
return cmp(entry1, entry2, false, function (entry) {
|
||||||
return $(entry).find(".size").data("bytes");
|
return $(entry).find(".size").data("bytes");
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
sort = function (fn) {
|
cmpNameRev = function (entry1, entry2) {
|
||||||
|
|
||||||
$("#extended .entry").detach().sort(fn).appendTo($("#extended > ul"));
|
return cmp(entry1, entry2, true, function (entry) {
|
||||||
},
|
return $(entry).find(".label").text().toLowerCase();
|
||||||
$all, orders,
|
});
|
||||||
sortBy = function (id) {
|
},
|
||||||
|
cmpTimeRev = function (entry1, entry2) {
|
||||||
|
|
||||||
var order = orders[id];
|
return cmp(entry1, entry2, true, function (entry) {
|
||||||
|
return $(entry).find(".date").data("time");
|
||||||
|
});
|
||||||
|
},
|
||||||
|
cmpSizeRev = function (entry1, entry2) {
|
||||||
|
|
||||||
$all.removeClass("ascending").removeClass("descending");
|
return cmp(entry1, entry2, true, function (entry) {
|
||||||
order.head.addClass(order.clas);
|
return $(entry).find(".size").data("bytes");
|
||||||
sort(order.fn);
|
});
|
||||||
H5AI.core.hash({sort: id});
|
},
|
||||||
},
|
sort = function (fn) {
|
||||||
init = function () {
|
|
||||||
|
|
||||||
var $ascending = $("<img src='" + H5AI.core.image("ascending") + "' class='sort ascending' alt='ascending' />"),
|
$("#extended .entry").detach().sort(fn).appendTo($("#extended > ul"));
|
||||||
$descending = $("<img src='" + H5AI.core.image("descending") + "' class='sort descending' alt='descending' />"),
|
},
|
||||||
initialOrder = H5AI.core.hash('sort'),
|
$all, orders,
|
||||||
$header = $("#extended li.header"),
|
sortBy = function (id) {
|
||||||
$label = $header.find("a.label"),
|
|
||||||
$date = $header.find("a.date"),
|
|
||||||
$size = $header.find("a.size");
|
|
||||||
|
|
||||||
$all = $header.find("a.label,a.date,a.size");
|
var order = orders[id];
|
||||||
orders = {
|
|
||||||
na: {
|
|
||||||
head: $label,
|
|
||||||
clas: "ascending",
|
|
||||||
fn: cmpName
|
|
||||||
},
|
|
||||||
nd: {
|
|
||||||
head: $label,
|
|
||||||
clas: "descending",
|
|
||||||
fn: cmpNameRev
|
|
||||||
},
|
|
||||||
da: {
|
|
||||||
head: $date,
|
|
||||||
clas: "ascending",
|
|
||||||
fn: cmpTime
|
|
||||||
},
|
|
||||||
dd: {
|
|
||||||
head: $date,
|
|
||||||
clas: "descending",
|
|
||||||
fn: cmpTimeRev
|
|
||||||
},
|
|
||||||
sa: {
|
|
||||||
head: $size,
|
|
||||||
clas: "ascending",
|
|
||||||
fn: cmpSize
|
|
||||||
},
|
|
||||||
sd: {
|
|
||||||
head: $size,
|
|
||||||
clas: "descending",
|
|
||||||
fn: cmpSizeRev
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
sortBy(initialOrder ? initialOrder : H5AI.core.settings.sortorder);
|
$all.removeClass("ascending").removeClass("descending");
|
||||||
|
order.head.addClass(order.clas);
|
||||||
|
sort(order.fn);
|
||||||
|
H5AI.core.hash({sort: id});
|
||||||
|
},
|
||||||
|
init = function () {
|
||||||
|
|
||||||
$label
|
var $ascending = $("<img src='" + H5AI.core.image("ascending") + "' class='sort ascending' alt='ascending' />"),
|
||||||
.append($ascending.clone()).append($descending.clone())
|
$descending = $("<img src='" + H5AI.core.image("descending") + "' class='sort descending' alt='descending' />"),
|
||||||
.click(function (event) {
|
initialOrder = H5AI.core.hash('sort'),
|
||||||
sortBy("n" + ($label.hasClass("ascending") ? "d" : "a"));
|
$header = $("#extended li.header"),
|
||||||
event.preventDefault();
|
$label = $header.find("a.label"),
|
||||||
});
|
$date = $header.find("a.date"),
|
||||||
|
$size = $header.find("a.size");
|
||||||
|
|
||||||
$date
|
$all = $header.find("a.label,a.date,a.size");
|
||||||
.prepend($ascending.clone()).prepend($descending.clone())
|
orders = {
|
||||||
.click(function (event) {
|
na: {
|
||||||
sortBy("d" + ($date.hasClass("ascending") ? "d" : "a"));
|
head: $label,
|
||||||
event.preventDefault();
|
clas: "ascending",
|
||||||
});
|
fn: cmpName
|
||||||
|
},
|
||||||
$size
|
nd: {
|
||||||
.prepend($ascending.clone()).prepend($descending.clone())
|
head: $label,
|
||||||
.click(function (event) {
|
clas: "descending",
|
||||||
sortBy("s" + ($size.hasClass("ascending") ? "d" : "a"));
|
fn: cmpNameRev
|
||||||
event.preventDefault();
|
},
|
||||||
});
|
da: {
|
||||||
|
head: $date,
|
||||||
|
clas: "ascending",
|
||||||
|
fn: cmpTime
|
||||||
|
},
|
||||||
|
dd: {
|
||||||
|
head: $date,
|
||||||
|
clas: "descending",
|
||||||
|
fn: cmpTimeRev
|
||||||
|
},
|
||||||
|
sa: {
|
||||||
|
head: $size,
|
||||||
|
clas: "ascending",
|
||||||
|
fn: cmpSize
|
||||||
|
},
|
||||||
|
sd: {
|
||||||
|
head: $size,
|
||||||
|
clas: "descending",
|
||||||
|
fn: cmpSizeRev
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
sortBy(initialOrder ? initialOrder : H5AI.core.settings.sortorder);
|
||||||
init: init
|
|
||||||
|
$label
|
||||||
|
.append($ascending.clone()).append($descending.clone())
|
||||||
|
.click(function (event) {
|
||||||
|
sortBy("n" + ($label.hasClass("ascending") ? "d" : "a"));
|
||||||
|
event.preventDefault();
|
||||||
|
});
|
||||||
|
|
||||||
|
$date
|
||||||
|
.prepend($ascending.clone()).prepend($descending.clone())
|
||||||
|
.click(function (event) {
|
||||||
|
sortBy("d" + ($date.hasClass("ascending") ? "d" : "a"));
|
||||||
|
event.preventDefault();
|
||||||
|
});
|
||||||
|
|
||||||
|
$size
|
||||||
|
.prepend($ascending.clone()).prepend($descending.clone())
|
||||||
|
.click(function (event) {
|
||||||
|
sortBy("s" + ($size.hasClass("ascending") ? "d" : "a"));
|
||||||
|
event.preventDefault();
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}());
|
|
||||||
|
H5AI.sort = {
|
||||||
|
init: init
|
||||||
|
};
|
||||||
|
|
||||||
}(jQuery, H5AI));
|
}(jQuery, H5AI));
|
||||||
|
|
|
@ -1,120 +1,117 @@
|
||||||
|
|
||||||
(function ($, H5AI) {
|
(function ($, H5AI) {
|
||||||
|
|
||||||
H5AI.util = (function () {
|
var reSplitPath = /^\/([^\/]+\/?)$/,
|
||||||
|
reSplitPath2 = /^(\/(?:.*\/)*?([^\/]+)\/)([^\/]+\/?)$/,
|
||||||
|
splitPath = function (pathname) {
|
||||||
|
|
||||||
var reSplitPath = /^\/([^\/]+\/?)$/,
|
var match;
|
||||||
reSplitPath2 = /^(\/(?:.*\/)*?([^\/]+)\/)([^\/]+\/?)$/,
|
|
||||||
splitPath = function (pathname) {
|
|
||||||
|
|
||||||
var match;
|
if (pathname === "/") {
|
||||||
|
return {
|
||||||
|
parent: null,
|
||||||
|
parentname: null,
|
||||||
|
name: "/"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
match = reSplitPath2.exec(pathname);
|
||||||
|
if (match) {
|
||||||
|
return {
|
||||||
|
parent: match[1],
|
||||||
|
parentname: match[2],
|
||||||
|
name: match[3]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
match = reSplitPath.exec(pathname);
|
||||||
|
if (match) {
|
||||||
|
return {
|
||||||
|
parent: "/",
|
||||||
|
parentname: "/",
|
||||||
|
name: match[1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
},
|
||||||
|
rePathEndsWithSlash = /\/$/,
|
||||||
|
pathEndsWithSlash = function (pathname) {
|
||||||
|
|
||||||
if (pathname === "/") {
|
return rePathEndsWithSlash.test(pathname);
|
||||||
return {
|
},
|
||||||
parent: null,
|
getAbsHref = function (folder, tableRow) {
|
||||||
parentname: null,
|
|
||||||
name: "/"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
match = reSplitPath2.exec(pathname);
|
|
||||||
if (match) {
|
|
||||||
return {
|
|
||||||
parent: match[1],
|
|
||||||
parentname: match[2],
|
|
||||||
name: match[3]
|
|
||||||
};
|
|
||||||
}
|
|
||||||
match = reSplitPath.exec(pathname);
|
|
||||||
if (match) {
|
|
||||||
return {
|
|
||||||
parent: "/",
|
|
||||||
parentname: "/",
|
|
||||||
name: match[1]
|
|
||||||
};
|
|
||||||
}
|
|
||||||
},
|
|
||||||
rePathEndsWithSlash = /\/$/,
|
|
||||||
pathEndsWithSlash = function (pathname) {
|
|
||||||
|
|
||||||
return rePathEndsWithSlash.test(pathname);
|
var $a, isParentFolder, href;
|
||||||
},
|
|
||||||
getAbsHref = function (folder, tableRow) {
|
|
||||||
|
|
||||||
var $a, isParentFolder, href;
|
if (!pathEndsWithSlash(folder)) {
|
||||||
|
folder += "/";
|
||||||
|
}
|
||||||
|
if (!tableRow) {
|
||||||
|
return folder;
|
||||||
|
}
|
||||||
|
$a = $(tableRow).find("td").eq(1).find("a");
|
||||||
|
isParentFolder = ($a.text() === "Parent Directory");
|
||||||
|
href = $a.attr("href");
|
||||||
|
return isParentFolder ? undefined : folder + href;
|
||||||
|
},
|
||||||
|
kilo = 1000.0,
|
||||||
|
reParseSize = /^\s*([\.\d]+)\s*([kmg]?)b?\s*$/i,
|
||||||
|
parseSize = function (str) {
|
||||||
|
|
||||||
if (!pathEndsWithSlash(folder)) {
|
var match = reParseSize.exec(str),
|
||||||
folder += "/";
|
val, unit;
|
||||||
}
|
|
||||||
if (!tableRow) {
|
|
||||||
return folder;
|
|
||||||
}
|
|
||||||
$a = $(tableRow).find("td").eq(1).find("a");
|
|
||||||
isParentFolder = ($a.text() === "Parent Directory");
|
|
||||||
href = $a.attr("href");
|
|
||||||
return isParentFolder ? undefined : folder + href;
|
|
||||||
},
|
|
||||||
kilo = 1000.0,
|
|
||||||
reParseSize = /^\s*([\.\d]+)\s*([kmg]?)b?\s*$/i,
|
|
||||||
parseSize = function (str) {
|
|
||||||
|
|
||||||
var match = reParseSize.exec(str),
|
if (!match) {
|
||||||
val, unit;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (!match) {
|
val = parseFloat(match[1]);
|
||||||
return -1;
|
unit = match[2].toLowerCase();
|
||||||
}
|
if (unit === "k") {
|
||||||
|
val *= kilo;
|
||||||
|
} else if (unit === "m") {
|
||||||
|
val *= kilo * kilo;
|
||||||
|
} else if (unit === "g") {
|
||||||
|
val *= kilo * kilo * kilo;
|
||||||
|
} else if (unit === "t") {
|
||||||
|
val *= kilo * kilo * kilo * kilo;
|
||||||
|
}
|
||||||
|
return val;
|
||||||
|
},
|
||||||
|
sizeUnits = ["B", "KB", "MB", "GB", "TB"],
|
||||||
|
formatSize = function (size) {
|
||||||
|
|
||||||
val = parseFloat(match[1]);
|
var th = 1000.0,
|
||||||
unit = match[2].toLowerCase();
|
i = 0,
|
||||||
if (unit === "k") {
|
maxI = sizeUnits.length - 1;
|
||||||
val *= kilo;
|
|
||||||
} else if (unit === "m") {
|
|
||||||
val *= kilo * kilo;
|
|
||||||
} else if (unit === "g") {
|
|
||||||
val *= kilo * kilo * kilo;
|
|
||||||
} else if (unit === "t") {
|
|
||||||
val *= kilo * kilo * kilo * kilo;
|
|
||||||
}
|
|
||||||
return val;
|
|
||||||
},
|
|
||||||
sizeUnits = ["B", "KB", "MB", "GB", "TB"],
|
|
||||||
formatSize = function (size) {
|
|
||||||
|
|
||||||
var th = 1000.0,
|
if (isNaN(size)) {
|
||||||
i = 0,
|
return size;
|
||||||
maxI = sizeUnits.length - 1;
|
}
|
||||||
|
|
||||||
if (isNaN(size)) {
|
while (size >= th && i < maxI) {
|
||||||
return size;
|
size /= kilo;
|
||||||
}
|
i += 1;
|
||||||
|
}
|
||||||
|
return (i <= 1 ? Math.round(size) : size.toFixed(1)).toString() + " " + sizeUnits[i];
|
||||||
|
},
|
||||||
|
checkedDecodeUri = function (uri) {
|
||||||
|
|
||||||
while (size >= th && i < maxI) {
|
try {
|
||||||
size /= kilo;
|
return decodeURI(uri);
|
||||||
i += 1;
|
} catch (err) {}
|
||||||
}
|
return uri;
|
||||||
return (i <= 1 ? Math.round(size) : size.toFixed(1)).toString() + " " + sizeUnits[i];
|
},
|
||||||
},
|
reEscape = function (sequence) {
|
||||||
checkedDecodeUri = function (uri) {
|
|
||||||
|
|
||||||
try {
|
return sequence.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
||||||
return decodeURI(uri);
|
|
||||||
} catch (err) {}
|
|
||||||
return uri;
|
|
||||||
},
|
|
||||||
reEscape = function (sequence) {
|
|
||||||
|
|
||||||
return sequence.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
|
||||||
};
|
|
||||||
|
|
||||||
return {
|
|
||||||
splitPath: splitPath,
|
|
||||||
pathEndsWithSlash: pathEndsWithSlash,
|
|
||||||
getAbsHref: getAbsHref,
|
|
||||||
parseSize: parseSize,
|
|
||||||
formatSize: formatSize,
|
|
||||||
checkedDecodeUri: checkedDecodeUri,
|
|
||||||
reEscape: reEscape
|
|
||||||
};
|
};
|
||||||
}());
|
|
||||||
|
H5AI.util = {
|
||||||
|
splitPath: splitPath,
|
||||||
|
pathEndsWithSlash: pathEndsWithSlash,
|
||||||
|
getAbsHref: getAbsHref,
|
||||||
|
parseSize: parseSize,
|
||||||
|
formatSize: formatSize,
|
||||||
|
checkedDecodeUri: checkedDecodeUri,
|
||||||
|
reEscape: reEscape
|
||||||
|
};
|
||||||
|
|
||||||
}(jQuery, H5AI));
|
}(jQuery, H5AI));
|
||||||
|
|
|
@ -1,191 +1,188 @@
|
||||||
|
|
||||||
(function ($, H5AI) {
|
(function ($, H5AI) {
|
||||||
|
|
||||||
H5AI.zippedDownload = (function () {
|
var x = 0,
|
||||||
|
y = 0,
|
||||||
|
$document = $(document),
|
||||||
|
$selectionRect = $("#selection-rect"),
|
||||||
|
selectedHrefsStr = "",
|
||||||
|
$download, $img, $downloadAuth, $downloadUser, $downloadPassword,
|
||||||
|
|
||||||
var x = 0,
|
updateDownloadBtn = function () {
|
||||||
y = 0,
|
|
||||||
$document = $(document),
|
|
||||||
$selectionRect = $("#selection-rect"),
|
|
||||||
selectedHrefsStr = "",
|
|
||||||
$download, $img, $downloadAuth, $downloadUser, $downloadPassword,
|
|
||||||
|
|
||||||
updateDownloadBtn = function () {
|
var $selected = $("#extended a.selected"),
|
||||||
|
$downloadBtn = $("#download");
|
||||||
|
|
||||||
var $selected = $("#extended a.selected"),
|
selectedHrefsStr = "";
|
||||||
$downloadBtn = $("#download");
|
if ($selected.length) {
|
||||||
|
$selected.each(function () {
|
||||||
|
|
||||||
selectedHrefsStr = "";
|
var href = $(this).attr("href");
|
||||||
if ($selected.length) {
|
selectedHrefsStr = selectedHrefsStr ? selectedHrefsStr + ":" + href : href;
|
||||||
$selected.each(function () {
|
|
||||||
|
|
||||||
var href = $(this).attr("href");
|
|
||||||
selectedHrefsStr = selectedHrefsStr ? selectedHrefsStr + ":" + href : href;
|
|
||||||
});
|
|
||||||
$downloadBtn.show();
|
|
||||||
} else {
|
|
||||||
$downloadBtn.hide();
|
|
||||||
$downloadAuth.hide();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
selectionUpdate = function (event) {
|
|
||||||
|
|
||||||
var l = Math.min(x, event.pageX),
|
|
||||||
t = Math.min(y, event.pageY),
|
|
||||||
w = Math.abs(x - event.pageX),
|
|
||||||
h = Math.abs(y - event.pageY),
|
|
||||||
selRect;
|
|
||||||
|
|
||||||
event.preventDefault();
|
|
||||||
$selectionRect.css({left: l, top: t, width: w, height: h});
|
|
||||||
|
|
||||||
selRect = $selectionRect.fracs("rect");
|
|
||||||
$("#extended a").removeClass("selecting").each(function () {
|
|
||||||
|
|
||||||
var $a = $(this),
|
|
||||||
rect = $a.fracs("rect"),
|
|
||||||
inter = selRect.intersection(rect);
|
|
||||||
if (inter && !$a.closest(".entry").hasClass("folder-parent")) {
|
|
||||||
$a.addClass("selecting");
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
},
|
$downloadBtn.show();
|
||||||
selectionEnd = function (event) {
|
} else {
|
||||||
|
$downloadBtn.hide();
|
||||||
|
$downloadAuth.hide();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
selectionUpdate = function (event) {
|
||||||
|
|
||||||
event.preventDefault();
|
var l = Math.min(x, event.pageX),
|
||||||
$document.off("mousemove", selectionUpdate);
|
t = Math.min(y, event.pageY),
|
||||||
$selectionRect.hide().css({left: 0, top: 0, width: 0, height: 0});
|
w = Math.abs(x - event.pageX),
|
||||||
$("#extended a.selecting.selected").removeClass("selecting").removeClass("selected");
|
h = Math.abs(y - event.pageY),
|
||||||
$("#extended a.selecting").removeClass("selecting").addClass("selected");
|
selRect;
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
$selectionRect.css({left: l, top: t, width: w, height: h});
|
||||||
|
|
||||||
|
selRect = $selectionRect.fracs("rect");
|
||||||
|
$("#extended a").removeClass("selecting").each(function () {
|
||||||
|
|
||||||
|
var $a = $(this),
|
||||||
|
rect = $a.fracs("rect"),
|
||||||
|
inter = selRect.intersection(rect);
|
||||||
|
if (inter && !$a.closest(".entry").hasClass("folder-parent")) {
|
||||||
|
$a.addClass("selecting");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
selectionEnd = function (event) {
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
$document.off("mousemove", selectionUpdate);
|
||||||
|
$selectionRect.hide().css({left: 0, top: 0, width: 0, height: 0});
|
||||||
|
$("#extended a.selecting.selected").removeClass("selecting").removeClass("selected");
|
||||||
|
$("#extended a.selecting").removeClass("selecting").addClass("selected");
|
||||||
|
updateDownloadBtn();
|
||||||
|
},
|
||||||
|
selectionStart = function (event) {
|
||||||
|
|
||||||
|
var view = $.fracs.viewport();
|
||||||
|
|
||||||
|
x = event.pageX;
|
||||||
|
y = event.pageY;
|
||||||
|
// only on left button and don't block the scrollbars
|
||||||
|
if (event.button !== 0 || x >= view.right || y >= view.bottom) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
$(':focus').blur();
|
||||||
|
if (!event.ctrlKey) {
|
||||||
|
$("#extended a").removeClass("selected");
|
||||||
updateDownloadBtn();
|
updateDownloadBtn();
|
||||||
},
|
}
|
||||||
selectionStart = function (event) {
|
$selectionRect.show().css({left: x, top: y, width: 0, height: 0});
|
||||||
|
|
||||||
var view = $.fracs.viewport();
|
$document
|
||||||
|
.on("mousemove", selectionUpdate)
|
||||||
|
.one("mouseup", selectionEnd);
|
||||||
|
},
|
||||||
|
noSelection = function (event) {
|
||||||
|
|
||||||
x = event.pageX;
|
event.stopImmediatePropagation();
|
||||||
y = event.pageY;
|
return false;
|
||||||
// only on left button and don't block the scrollbars
|
},
|
||||||
if (event.button !== 0 || x >= view.right || y >= view.bottom) {
|
noSelectionUnlessCtrl = function (event) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
event.preventDefault();
|
if (!event.ctrlKey) {
|
||||||
$(':focus').blur();
|
noSelection(event);
|
||||||
if (!event.ctrlKey) {
|
}
|
||||||
$("#extended a").removeClass("selected");
|
},
|
||||||
updateDownloadBtn();
|
failed = function () {
|
||||||
}
|
|
||||||
$selectionRect.show().css({left: x, top: y, width: 0, height: 0});
|
|
||||||
|
|
||||||
$document
|
$download.addClass('failed');
|
||||||
.on("mousemove", selectionUpdate)
|
setTimeout(function () {
|
||||||
.one("mouseup", selectionEnd);
|
$download.removeClass('failed');
|
||||||
},
|
}, 1000);
|
||||||
noSelection = function (event) {
|
},
|
||||||
|
handleResponse = function (response) {
|
||||||
event.stopImmediatePropagation();
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
noSelectionUnlessCtrl = function (event) {
|
|
||||||
|
|
||||||
if (!event.ctrlKey) {
|
|
||||||
noSelection(event);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
failed = function () {
|
|
||||||
|
|
||||||
$download.addClass('failed');
|
|
||||||
setTimeout(function () {
|
|
||||||
$download.removeClass('failed');
|
|
||||||
}, 1000);
|
|
||||||
},
|
|
||||||
handleResponse = function (response) {
|
|
||||||
|
|
||||||
|
|
||||||
$download.removeClass('current');
|
$download.removeClass('current');
|
||||||
$img.attr('src', H5AI.core.image("download"));
|
$img.attr('src', H5AI.core.image("download"));
|
||||||
|
|
||||||
if (response) {
|
if (response) {
|
||||||
if (response.status === 'ok') {
|
if (response.status === 'ok') {
|
||||||
window.location = H5AI.core.api() + '?action=getzip&id=' + response.id;
|
window.location = H5AI.core.api() + '?action=getzip&id=' + response.id;
|
||||||
} else {
|
|
||||||
if (response.code === 401) {
|
|
||||||
$downloadAuth
|
|
||||||
.css({
|
|
||||||
left: $download.offset().left,
|
|
||||||
top: $download.offset().top + $download.outerHeight()
|
|
||||||
})
|
|
||||||
.show();
|
|
||||||
$downloadUser.focus();
|
|
||||||
}
|
|
||||||
failed();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
|
if (response.code === 401) {
|
||||||
|
$downloadAuth
|
||||||
|
.css({
|
||||||
|
left: $download.offset().left,
|
||||||
|
top: $download.offset().top + $download.outerHeight()
|
||||||
|
})
|
||||||
|
.show();
|
||||||
|
$downloadUser.focus();
|
||||||
|
}
|
||||||
failed();
|
failed();
|
||||||
}
|
}
|
||||||
},
|
} else {
|
||||||
requestZipping = function (hrefsStr) {
|
failed();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
requestZipping = function (hrefsStr) {
|
||||||
|
|
||||||
$download.addClass('current');
|
$download.addClass('current');
|
||||||
$img.attr('src', H5AI.core.image("loading.gif", true));
|
$img.attr('src', H5AI.core.image("loading.gif", true));
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: H5AI.core.api(),
|
url: H5AI.core.api(),
|
||||||
data: {
|
data: {
|
||||||
action: 'zip',
|
action: 'zip',
|
||||||
hrefs: selectedHrefsStr
|
hrefs: selectedHrefsStr
|
||||||
},
|
},
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
beforeSend: function (xhr) {
|
beforeSend: function (xhr) {
|
||||||
|
|
||||||
var user = $downloadUser.val(),
|
var user = $downloadUser.val(),
|
||||||
password = $downloadPassword.val();
|
password = $downloadPassword.val();
|
||||||
|
|
||||||
if (user) {
|
if (user) {
|
||||||
xhr.setRequestHeader ('Authorization', 'Basic ' + Base64.encode(user + ':' + password));
|
xhr.setRequestHeader ('Authorization', 'Basic ' + Base64.encode(user + ':' + password));
|
||||||
}
|
|
||||||
},
|
|
||||||
success: function (response) {
|
|
||||||
|
|
||||||
handleResponse(response);
|
|
||||||
},
|
|
||||||
failed: function () {
|
|
||||||
|
|
||||||
handleResponse();
|
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
},
|
success: function (response) {
|
||||||
init = function () {
|
|
||||||
|
|
||||||
if (H5AI.core.settings.zippedDownload) {
|
handleResponse(response);
|
||||||
$("<li id='download'><a href='#'><img alt='download' /><span class='l10n-download'>download</span></a></li>")
|
},
|
||||||
.find("img").attr("src", H5AI.core.image("download")).end()
|
failed: function () {
|
||||||
.find("a").click(function (event) {
|
|
||||||
|
|
||||||
event.preventDefault();
|
handleResponse();
|
||||||
$downloadAuth.hide();
|
|
||||||
requestZipping(selectedHrefsStr);
|
|
||||||
}).end()
|
|
||||||
.appendTo($("#navbar"));
|
|
||||||
$("<div id='download-auth'><input id='download-auth-user' type='text' value='' placeholder='user' /><input id='download-auth-password' type='text' value='' placeholder='password' /></div>")
|
|
||||||
.appendTo($("body"));
|
|
||||||
|
|
||||||
$download = $('#download');
|
|
||||||
$downloadAuth = $('#download-auth');
|
|
||||||
$downloadUser = $('#download-auth-user');
|
|
||||||
$downloadPassword = $('#download-auth-password');
|
|
||||||
$img = $download.find('img');
|
|
||||||
|
|
||||||
$("body>nav,body>footer,#tree,input").on("mousedown", noSelection);
|
|
||||||
$("#content").on("mousedown", "a", noSelectionUnlessCtrl);
|
|
||||||
$document.on("mousedown", selectionStart);
|
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
},
|
||||||
|
init = function () {
|
||||||
|
|
||||||
return {
|
if (H5AI.core.settings.zippedDownload) {
|
||||||
init: init
|
$("<li id='download'><a href='#'><img alt='download' /><span class='l10n-download'>download</span></a></li>")
|
||||||
|
.find("img").attr("src", H5AI.core.image("download")).end()
|
||||||
|
.find("a").click(function (event) {
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
$downloadAuth.hide();
|
||||||
|
requestZipping(selectedHrefsStr);
|
||||||
|
}).end()
|
||||||
|
.appendTo($("#navbar"));
|
||||||
|
$("<div id='download-auth'><input id='download-auth-user' type='text' value='' placeholder='user' /><input id='download-auth-password' type='text' value='' placeholder='password' /></div>")
|
||||||
|
.appendTo($("body"));
|
||||||
|
|
||||||
|
$download = $('#download');
|
||||||
|
$downloadAuth = $('#download-auth');
|
||||||
|
$downloadUser = $('#download-auth-user');
|
||||||
|
$downloadPassword = $('#download-auth-password');
|
||||||
|
$img = $download.find('img');
|
||||||
|
|
||||||
|
$("body>nav,body>footer,#tree,input").on("mousedown", noSelection);
|
||||||
|
$("#content").on("mousedown", "a", noSelectionUnlessCtrl);
|
||||||
|
$document.on("mousedown", selectionStart);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}());
|
|
||||||
|
H5AI.zippedDownload = {
|
||||||
|
init: init
|
||||||
|
};
|
||||||
|
|
||||||
}(jQuery, H5AI));
|
}(jQuery, H5AI));
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
(function ($) {
|
(function ($) {
|
||||||
'use strict';
|
'use strict';
|
||||||
/*jslint browser: true, confusion: true, regexp: true, vars: true, white: true */
|
/*jslint browser: true, confusion: true, regexp: true, vars: true, white: true */
|
||||||
/*global Modernizr, jQuery, amplify, H5AI_CONFIG */
|
/*global Modernizr, jQuery, amplify, Base64, H5AI_CONFIG */
|
||||||
|
|
||||||
var H5AI = {};
|
var H5AI = {};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue