mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-25 12:34:47 -04:00
Renames main script file to H5ai.js and main h5ai reference to h5ai.
This commit is contained in:
parent
fbff8686bf
commit
194a202a0b
14 changed files with 159 additions and 151 deletions
|
@ -50,8 +50,8 @@
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="lint" depends="build-prepare">
|
<target name="lint" depends="build-prepare">
|
||||||
<wepp file="${build.dir}/_h5ai/js/inc/main.js" tofile="${build.dir}/_h5ai/js/inc/main.js" />
|
<wepp file="${build.dir}/_h5ai/js/inc/H5ai.js" tofile="${build.dir}/_h5ai/js/inc/H5ai.js" />
|
||||||
<jslint files="${build.dir}/_h5ai/js/inc/main.js" />
|
<jslint files="${build.dir}/_h5ai/js/inc/H5ai.js" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
|
|
||||||
(function ($, H5AI) {
|
(function ($, h5ai) {
|
||||||
|
|
||||||
var cache = {},
|
var cache = {},
|
||||||
pathnameStatusCache = {},
|
pathnameStatusCache = {},
|
||||||
contentTypeRegEx = /^text\/html;h5ai=/,
|
contentTypeRegEx = /^text\/html;h5ai=/,
|
||||||
getPath = function (folder, tableRow) {
|
getPath = function (folder, tableRow) {
|
||||||
|
|
||||||
var absHref = H5AI.util.getAbsHref(folder, tableRow),
|
var absHref = h5ai.util.getAbsHref(folder, tableRow),
|
||||||
path = cache[absHref];
|
path = cache[absHref];
|
||||||
|
|
||||||
if (!path) {
|
if (!path) {
|
||||||
path = H5AI.Path(folder, tableRow);
|
path = h5ai.Path(folder, tableRow);
|
||||||
if (!path.isParentFolder) {
|
if (!path.isParentFolder) {
|
||||||
cache[path.absHref] = path;
|
cache[path.absHref] = path;
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,8 @@
|
||||||
},
|
},
|
||||||
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]);
|
||||||
|
@ -51,8 +51,8 @@
|
||||||
if (status !== "h5ai") {
|
if (status !== "h5ai") {
|
||||||
path.status = status;
|
path.status = status;
|
||||||
}
|
}
|
||||||
H5AI.html.updateHtml(path);
|
h5ai.html.updateHtml(path);
|
||||||
H5AI.core.linkHoverStates();
|
h5ai.core.linkHoverStates();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -103,10 +103,10 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
H5AI.connector = {
|
h5ai.connector = {
|
||||||
getPath: getPath,
|
getPath: getPath,
|
||||||
updatePaths: updatePaths,
|
updatePaths: updatePaths,
|
||||||
fetchStatusAndContent: fetchStatusAndContent
|
fetchStatusAndContent: fetchStatusAndContent
|
||||||
};
|
};
|
||||||
|
|
||||||
}(jQuery, H5AI));
|
}(jQuery, h5ai));
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
(function ($, H5AI) {
|
(function ($, h5ai) {
|
||||||
|
|
||||||
var $context,
|
var $context,
|
||||||
qrCodesSize,
|
qrCodesSize,
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
},
|
},
|
||||||
init = function () {
|
init = function () {
|
||||||
|
|
||||||
qrCodesSize = H5AI.core.settings.qrCodesSize;
|
qrCodesSize = h5ai.core.settings.qrCodesSize;
|
||||||
if (!qrCodesSize) {
|
if (!qrCodesSize) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -44,8 +44,8 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
H5AI.context = {
|
h5ai.context = {
|
||||||
init: init
|
init: init
|
||||||
};
|
};
|
||||||
|
|
||||||
}(jQuery, H5AI));
|
}(jQuery, h5ai));
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
(function (window, $, H5AI, config) {
|
(function (window, $, h5ai, config) {
|
||||||
|
|
||||||
var $window = $(window),
|
var $window = $(window),
|
||||||
defaults = {
|
defaults = {
|
||||||
|
@ -95,7 +95,7 @@
|
||||||
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") {
|
||||||
|
@ -293,7 +293,7 @@
|
||||||
$(".lang").text(lang);
|
$(".lang").text(lang);
|
||||||
$(".langOption").removeClass("current");
|
$(".langOption").removeClass("current");
|
||||||
$(".langOption." + lang).addClass("current");
|
$(".langOption." + lang).addClass("current");
|
||||||
H5AI.core.hash({lang: lang});
|
h5ai.core.hash({lang: lang});
|
||||||
}
|
}
|
||||||
|
|
||||||
formatDates(selected.dateFormat || settings.dateFormat);
|
formatDates(selected.dateFormat || settings.dateFormat);
|
||||||
|
@ -395,7 +395,7 @@
|
||||||
|
|
||||||
var $this = $(this),
|
var $this = $(this),
|
||||||
bytes = $this.data("bytes"),
|
bytes = $this.data("bytes"),
|
||||||
formattedSize = bytes >= 0 ? H5AI.util.formatSize(bytes) : "";
|
formattedSize = bytes >= 0 ? h5ai.util.formatSize(bytes) : "";
|
||||||
|
|
||||||
$this.text(formattedSize);
|
$this.text(formattedSize);
|
||||||
});
|
});
|
||||||
|
@ -421,7 +421,7 @@
|
||||||
initIndicators();
|
initIndicators();
|
||||||
};
|
};
|
||||||
|
|
||||||
H5AI.core = {
|
h5ai.core = {
|
||||||
settings: settings,
|
settings: settings,
|
||||||
hash: hash,
|
hash: hash,
|
||||||
api: api,
|
api: api,
|
||||||
|
@ -435,4 +435,4 @@
|
||||||
init: init
|
init: init
|
||||||
};
|
};
|
||||||
|
|
||||||
}(window, jQuery, H5AI, H5AI_CONFIG));
|
}(window, jQuery, h5ai, H5AI_CONFIG));
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
|
|
||||||
(function (document, $, H5AI) {
|
(function (document, $, h5ai) {
|
||||||
|
|
||||||
var initBreadcrumb = function () {
|
var initBreadcrumb = function () {
|
||||||
|
|
||||||
var $ul = $("body > nav ul"),
|
var $ul = $("body > nav ul"),
|
||||||
pathname = "/",
|
pathname = "/",
|
||||||
path = H5AI.connector.getPath(pathname),
|
path = h5ai.connector.getPath(pathname),
|
||||||
pathnameParts = document.location.pathname.split("/"),
|
pathnameParts = document.location.pathname.split("/"),
|
||||||
lastPart = "",
|
lastPart = "",
|
||||||
title = document.domain;
|
title = document.domain;
|
||||||
|
|
||||||
$ul.append(H5AI.html.updateCrumbHtml(path));
|
$ul.append(h5ai.html.updateCrumbHtml(path));
|
||||||
|
|
||||||
$.each(pathnameParts, function (idx, part) {
|
$.each(pathnameParts, function (idx, part) {
|
||||||
if (part !== "") {
|
if (part !== "") {
|
||||||
pathname += part + "/";
|
pathname += part + "/";
|
||||||
$ul.append(H5AI.html.updateCrumbHtml(H5AI.connector.getPath(pathname)));
|
$ul.append(h5ai.html.updateCrumbHtml(h5ai.connector.getPath(pathname)));
|
||||||
lastPart = part + " - ";
|
lastPart = part + " - ";
|
||||||
title += " > " + part;
|
title += " > " + part;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
document.title = H5AI.util.checkedDecodeUri(lastPart + title);
|
document.title = h5ai.util.checkedDecodeUri(lastPart + title);
|
||||||
},
|
},
|
||||||
initExtendedView = function () {
|
initExtendedView = function () {
|
||||||
|
|
||||||
|
@ -37,8 +37,8 @@
|
||||||
|
|
||||||
// entries
|
// entries
|
||||||
$("#table td").closest("tr").each(function () {
|
$("#table td").closest("tr").each(function () {
|
||||||
var path = H5AI.connector.getPath(document.location.pathname, this);
|
var path = h5ai.connector.getPath(document.location.pathname, this);
|
||||||
$ul.append(H5AI.html.updateExtendedHtml(path));
|
$ul.append(h5ai.html.updateExtendedHtml(path));
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#extended").append($ul);
|
$("#extended").append($ul);
|
||||||
|
@ -51,9 +51,9 @@
|
||||||
},
|
},
|
||||||
customize = function () {
|
customize = function () {
|
||||||
|
|
||||||
if (H5AI.core.settings.customHeader) {
|
if (h5ai.core.settings.customHeader) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: H5AI.core.settings.customHeader,
|
url: h5ai.core.settings.customHeader,
|
||||||
dataType: "html",
|
dataType: "html",
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
$("#content > header").append($(data)).show();
|
$("#content > header").append($(data)).show();
|
||||||
|
@ -61,9 +61,9 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (H5AI.core.settings.customFooter) {
|
if (h5ai.core.settings.customFooter) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: H5AI.core.settings.customFooter,
|
url: h5ai.core.settings.customFooter,
|
||||||
dataType: "html",
|
dataType: "html",
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
$("#content > footer").prepend($(data)).show();
|
$("#content > footer").prepend($(data)).show();
|
||||||
|
@ -73,9 +73,9 @@
|
||||||
},
|
},
|
||||||
fetchPath = function (pathname, callback) {
|
fetchPath = function (pathname, callback) {
|
||||||
|
|
||||||
H5AI.connector.fetchStatusAndContent(pathname, false, function (status, content) {
|
h5ai.connector.fetchStatusAndContent(pathname, false, function (status, content) {
|
||||||
|
|
||||||
var path = H5AI.connector.getPath(pathname);
|
var path = h5ai.connector.getPath(pathname);
|
||||||
|
|
||||||
path.status = status;
|
path.status = status;
|
||||||
path.content = content;
|
path.content = content;
|
||||||
|
@ -86,7 +86,7 @@
|
||||||
|
|
||||||
fetchPath(pathname, function (path) {
|
fetchPath(pathname, function (path) {
|
||||||
|
|
||||||
var parent = H5AI.util.splitPath(pathname).parent;
|
var parent = h5ai.util.splitPath(pathname).parent;
|
||||||
|
|
||||||
path.treeOpen = true;
|
path.treeOpen = true;
|
||||||
if (childPath) {
|
if (childPath) {
|
||||||
|
@ -103,11 +103,11 @@
|
||||||
|
|
||||||
fetchTree(document.location.pathname, function (path) {
|
fetchTree(document.location.pathname, function (path) {
|
||||||
$("#tree")
|
$("#tree")
|
||||||
.append(H5AI.html.updateTreeHtml(path))
|
.append(h5ai.html.updateTreeHtml(path))
|
||||||
.scrollpanel()
|
.scrollpanel()
|
||||||
.show();
|
.show();
|
||||||
H5AI.core.shiftTree(false, true);
|
h5ai.core.shiftTree(false, true);
|
||||||
H5AI.core.linkHoverStates();
|
h5ai.core.linkHoverStates();
|
||||||
setTimeout(function () { $("#tree").get(0).updateScrollbar(); }, 1);
|
setTimeout(function () { $("#tree").get(0).updateScrollbar(); }, 1);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -116,14 +116,14 @@
|
||||||
initBreadcrumb();
|
initBreadcrumb();
|
||||||
initExtendedView();
|
initExtendedView();
|
||||||
customize();
|
customize();
|
||||||
H5AI.connector.updatePaths();
|
h5ai.connector.updatePaths();
|
||||||
if (H5AI.core.settings.showTree) {
|
if (h5ai.core.settings.showTree) {
|
||||||
populateTree();
|
populateTree();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
H5AI.extended = {
|
h5ai.extended = {
|
||||||
init: init
|
init: init
|
||||||
};
|
};
|
||||||
|
|
||||||
}(document, jQuery, H5AI));
|
}(document, jQuery, h5ai));
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
(function ($, H5AI) {
|
(function ($, h5ai) {
|
||||||
|
|
||||||
var filter = function (re) {
|
var filter = function (re) {
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
} else {
|
} else {
|
||||||
$filter.removeClass('current');
|
$filter.removeClass('current');
|
||||||
}
|
}
|
||||||
H5AI.core.hash({filter: val});
|
h5ai.core.hash({filter: val});
|
||||||
},
|
},
|
||||||
parseFilterSequence = function (sequence) {
|
parseFilterSequence = function (sequence) {
|
||||||
|
|
||||||
|
@ -53,20 +53,20 @@
|
||||||
|
|
||||||
sequence = $.map($.trim(sequence).split(/\s+/), function (part) {
|
sequence = $.map($.trim(sequence).split(/\s+/), function (part) {
|
||||||
|
|
||||||
return H5AI.util.reEscape(part);
|
return h5ai.util.reEscape(part);
|
||||||
}).join('|');
|
}).join('|');
|
||||||
return new RegExp(sequence);
|
return new RegExp(sequence);
|
||||||
},
|
},
|
||||||
init = function () {
|
init = function () {
|
||||||
|
|
||||||
if (H5AI.core.settings.showFilter) {
|
if (h5ai.core.settings.showFilter) {
|
||||||
$("<li id='filter'><span class='element'><img alt='filter' /><input type='text' value='' placeholder='filter' /></span></li>")
|
$("<li id='filter'><span class='element'><img alt='filter' /><input type='text' value='' placeholder='filter' /></span></li>")
|
||||||
.on('click', function () {
|
.on('click', function () {
|
||||||
|
|
||||||
var $input = $(this).find('input');
|
var $input = $(this).find('input');
|
||||||
$input.focus();
|
$input.focus();
|
||||||
})
|
})
|
||||||
.find("img").attr("src", H5AI.core.image("filter")).end()
|
.find("img").attr("src", h5ai.core.image("filter")).end()
|
||||||
.find("input")
|
.find("input")
|
||||||
.on('focus', function () {
|
.on('focus', function () {
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@
|
||||||
.end()
|
.end()
|
||||||
.appendTo($("#navbar"));
|
.appendTo($("#navbar"));
|
||||||
|
|
||||||
var initialFilter = H5AI.core.hash('filter');
|
var initialFilter = h5ai.core.hash('filter');
|
||||||
if (initialFilter) {
|
if (initialFilter) {
|
||||||
$('#filter input').val(initialFilter);
|
$('#filter input').val(initialFilter);
|
||||||
checkState(false);
|
checkState(false);
|
||||||
|
@ -99,9 +99,9 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
H5AI.finder = {
|
h5ai.finder = {
|
||||||
init: init,
|
init: init,
|
||||||
filter: filter
|
filter: filter
|
||||||
};
|
};
|
||||||
|
|
||||||
}(jQuery, H5AI));
|
}(jQuery, h5ai));
|
50
src/_h5ai/js/inc/H5ai.js
Normal file
50
src/_h5ai/js/inc/H5ai.js
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
|
||||||
|
(function ($) {
|
||||||
|
'use strict';
|
||||||
|
/*jslint browser: true, confusion: true, regexp: true, vars: true, white: true */
|
||||||
|
/*global Modernizr, jQuery, amplify, Base64, H5AI_CONFIG */
|
||||||
|
|
||||||
|
var h5ai = function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
init = function () {
|
||||||
|
|
||||||
|
var $html = $('html');
|
||||||
|
|
||||||
|
h5ai.isJs = $html.hasClass('h5ai-js');
|
||||||
|
h5ai.isPhp = $html.hasClass('h5ai-php');
|
||||||
|
|
||||||
|
if (h5ai.isJs) {
|
||||||
|
h5ai.extended.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
h5ai.core.init();
|
||||||
|
h5ai.sort.init();
|
||||||
|
h5ai.finder.init();
|
||||||
|
h5ai.zippedDownload.init();
|
||||||
|
h5ai.context.init();
|
||||||
|
|
||||||
|
if (h5ai.isPhp) {
|
||||||
|
$('#tree').scrollpanel();
|
||||||
|
h5ai.core.shiftTree(false, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// publish for testing
|
||||||
|
window.h5ai = h5ai;
|
||||||
|
};
|
||||||
|
|
||||||
|
// @include "Util.js"
|
||||||
|
// @include "Core.js"
|
||||||
|
// @include "Sort.js"
|
||||||
|
// @include "ZippedDownload.js"
|
||||||
|
// @include "Finder.js"
|
||||||
|
// @include "Context.js"
|
||||||
|
|
||||||
|
// @include "Path.js"
|
||||||
|
// @include "Connector.js"
|
||||||
|
// @include "Html.js"
|
||||||
|
// @include "Extended.js"
|
||||||
|
|
||||||
|
$(init);
|
||||||
|
|
||||||
|
}(jQuery));
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
(function ($, H5AI) {
|
(function ($, h5ai) {
|
||||||
|
|
||||||
var onClick = function (path, context) {
|
var onClick = function (path, context) {
|
||||||
|
|
||||||
|
@ -22,12 +22,12 @@
|
||||||
$a = $html.find("a")
|
$a = $html.find("a")
|
||||||
.attr("href", path.absHref)
|
.attr("href", path.absHref)
|
||||||
.click(function() { onClick(path, "crumb"); })
|
.click(function() { onClick(path, "crumb"); })
|
||||||
.find("img").attr("src", H5AI.core.image("crumb")).end()
|
.find("img").attr("src", h5ai.core.image("crumb")).end()
|
||||||
.find("span").text(path.label).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("img").attr("src", h5ai.core.image("home"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (path.isCurrentFolder) {
|
if (path.isCurrentFolder) {
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
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.append($("<img class='hint' src='" + h5ai.core.image("page") + "' alt='not listable' />"));
|
||||||
} else {
|
} else {
|
||||||
$a.append($("<span class='hint'>(" + path.status + ")</span>"));
|
$a.append($("<span class='hint'>(" + path.status + ")</span>"));
|
||||||
}
|
}
|
||||||
|
@ -52,10 +52,10 @@
|
||||||
updateExtendedHtml = function (path) {
|
updateExtendedHtml = function (path) {
|
||||||
|
|
||||||
var $html, $a, $label,
|
var $html, $a, $label,
|
||||||
formattedDate = path.date ? path.date.toString(H5AI.core.settings.dateFormat) : "",
|
formattedDate = path.date ? path.date.toString(h5ai.core.settings.dateFormat) : "",
|
||||||
imgClass = "",
|
imgClass = "",
|
||||||
icon16 = H5AI.core.icon(path.type),
|
icon16 = h5ai.core.icon(path.type),
|
||||||
icon48 = H5AI.core.icon(path.type, true);
|
icon48 = h5ai.core.icon(path.type, true);
|
||||||
|
|
||||||
if (path.html.$extended && path.html.$extended.data("status") === path.status) {
|
if (path.html.$extended && path.html.$extended.data("status") === path.status) {
|
||||||
return path.html.$extended;
|
return path.html.$extended;
|
||||||
|
@ -69,11 +69,11 @@
|
||||||
$html.data("status", path.status);
|
$html.data("status", path.status);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (H5AI.core.settings.showThumbs === true && $.inArray(path.type, H5AI.core.settings.thumbTypes) >= 0) {
|
if (h5ai.core.settings.showThumbs === true && $.inArray(path.type, h5ai.core.settings.thumbTypes) >= 0) {
|
||||||
imgClass = "class='thumb'";
|
imgClass = "class='thumb'";
|
||||||
var escapedHref = path.absHref.replace(/'/g, "%27").replace(/"/g, "%22");
|
var escapedHref = path.absHref.replace(/'/g, "%27").replace(/"/g, "%22");
|
||||||
icon16 = H5AI.core.api() + "?action=thumb&href=" + escapedHref + "&width=16&height=16&mode=square";
|
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";
|
icon48 = h5ai.core.api() + "?action=thumb&href=" + escapedHref + "&width=96&height=46&mode=rational";
|
||||||
}
|
}
|
||||||
|
|
||||||
$label = $("<span class='label'>" + path.label + "</span>");
|
$label = $("<span class='label'>" + path.label + "</span>");
|
||||||
|
@ -113,7 +113,7 @@
|
||||||
);
|
);
|
||||||
|
|
||||||
if (path.isParentFolder) {
|
if (path.isParentFolder) {
|
||||||
if (!H5AI.core.settings.setParentFolderLabels) {
|
if (!h5ai.core.settings.setParentFolderLabels) {
|
||||||
$label.addClass("l10n-parentDirectory");
|
$label.addClass("l10n-parentDirectory");
|
||||||
}
|
}
|
||||||
$html.addClass("folder-parent");
|
$html.addClass("folder-parent");
|
||||||
|
@ -122,8 +122,8 @@
|
||||||
if (!isNaN(path.status)) {
|
if (!isNaN(path.status)) {
|
||||||
if (path.status === 200) {
|
if (path.status === 200) {
|
||||||
$html.addClass("page");
|
$html.addClass("page");
|
||||||
$a.find(".icon.small img").attr("src", H5AI.core.icon("folder-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));
|
$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>"));
|
$label.append($("<span class='hint'> " + path.status + " </span>"));
|
||||||
|
@ -132,7 +132,7 @@
|
||||||
|
|
||||||
if (path.html.$extended) {
|
if (path.html.$extended) {
|
||||||
path.html.$extended.replaceWith($html);
|
path.html.$extended.replaceWith($html);
|
||||||
H5AI.core.formatDates();
|
h5ai.core.formatDates();
|
||||||
}
|
}
|
||||||
path.html.$extended = $html;
|
path.html.$extended = $html;
|
||||||
|
|
||||||
|
@ -152,19 +152,19 @@
|
||||||
.attr("href", path.absHref)
|
.attr("href", path.absHref)
|
||||||
.click(function() { onClick(path, "tree"); })
|
.click(function() { onClick(path, "tree"); })
|
||||||
.appendTo($html)
|
.appendTo($html)
|
||||||
.append($("<span class='icon'><img src='" + H5AI.core.icon(path.type) + "' /></span>"))
|
.append($("<span class='icon'><img src='" + h5ai.core.icon(path.type) + "' /></span>"))
|
||||||
.append($("<span class='label'>" + path.label + "</span>"));
|
.append($("<span class='label'>" + path.label + "</span>"));
|
||||||
|
|
||||||
if (path.isFolder) {
|
if (path.isFolder) {
|
||||||
// indicator
|
// indicator
|
||||||
if (path.status === undefined || !path.isEmpty()) {
|
if (path.status === undefined || !path.isEmpty()) {
|
||||||
$indicator = $("<span class='indicator initiated'><img src='" + H5AI.core.image("tree") + "' /></span>")
|
$indicator = $("<span class='indicator initiated'><img src='" + h5ai.core.image("tree") + "' /></span>")
|
||||||
.click(function (event) {
|
.click(function (event) {
|
||||||
|
|
||||||
var $entry = $indicator.closest(".entry"); // $html
|
var $entry = $indicator.closest(".entry"); // $html
|
||||||
|
|
||||||
if ($indicator.hasClass("unknown")) {
|
if ($indicator.hasClass("unknown")) {
|
||||||
H5AI.connector.fetchStatusAndContent(path.absHref, false, function (status, content) {
|
h5ai.connector.fetchStatusAndContent(path.absHref, false, function (status, content) {
|
||||||
|
|
||||||
path.status = status;
|
path.status = status;
|
||||||
path.content = content;
|
path.content = content;
|
||||||
|
@ -205,13 +205,13 @@
|
||||||
// is path the domain?
|
// is path the domain?
|
||||||
if (path.isDomain) {
|
if (path.isDomain) {
|
||||||
$html.addClass("domain");
|
$html.addClass("domain");
|
||||||
$a.find(".icon img").attr("src", H5AI.core.icon("folder-home"));
|
$a.find(".icon img").attr("src", h5ai.core.icon("folder-home"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// is path the current folder?
|
// 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"));
|
$a.find(".icon img").attr("src", h5ai.core.icon("folder-open"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// does it have subfolders?
|
// does it have subfolders?
|
||||||
|
@ -228,8 +228,8 @@
|
||||||
// reflect folder status
|
// reflect folder status
|
||||||
if (!isNaN(path.status)) {
|
if (!isNaN(path.status)) {
|
||||||
if (path.status === 200) {
|
if (path.status === 200) {
|
||||||
$a.find(".icon img").attr("src", H5AI.core.icon("folder-page"));
|
$a.find(".icon img").attr("src", h5ai.core.icon("folder-page"));
|
||||||
$a.append($("<span class='hint'><img src='" + H5AI.core.image("page") + "' /></span>"));
|
$a.append($("<span class='hint'><img src='" + h5ai.core.image("page") + "' /></span>"));
|
||||||
} else {
|
} else {
|
||||||
$html.addClass("error");
|
$html.addClass("error");
|
||||||
$a.append($("<span class='hint'>" + path.status + "</span>"));
|
$a.append($("<span class='hint'>" + path.status + "</span>"));
|
||||||
|
@ -251,11 +251,11 @@
|
||||||
updateTreeHtml(path);
|
updateTreeHtml(path);
|
||||||
};
|
};
|
||||||
|
|
||||||
H5AI.html = {
|
h5ai.html = {
|
||||||
updateCrumbHtml: updateCrumbHtml,
|
updateCrumbHtml: updateCrumbHtml,
|
||||||
updateExtendedHtml: updateExtendedHtml,
|
updateExtendedHtml: updateExtendedHtml,
|
||||||
updateTreeHtml: updateTreeHtml,
|
updateTreeHtml: updateTreeHtml,
|
||||||
updateHtml: updateHtml
|
updateHtml: updateHtml
|
||||||
};
|
};
|
||||||
|
|
||||||
}(jQuery, H5AI));
|
}(jQuery, h5ai));
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
(function (document, $, H5AI) {
|
(function (document, $, h5ai) {
|
||||||
|
|
||||||
H5AI.Path = function (folder, tableRow) {
|
h5ai.Path = function (folder, tableRow) {
|
||||||
|
|
||||||
var path = {},
|
var path = {},
|
||||||
$tds, $a, date, size, splits;
|
$tds, $a, date, size, splits;
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
};
|
};
|
||||||
path.treeOpen = false;
|
path.treeOpen = false;
|
||||||
|
|
||||||
if (!H5AI.util.pathEndsWithSlash(folder)) {
|
if (!h5ai.util.pathEndsWithSlash(folder)) {
|
||||||
folder += "/";
|
folder += "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,21 +35,21 @@
|
||||||
$tds = $(tableRow).find("td");
|
$tds = $(tableRow).find("td");
|
||||||
$a = $tds.eq(1).find("a");
|
$a = $tds.eq(1).find("a");
|
||||||
date = Date.parse($tds.eq(2).text());
|
date = Date.parse($tds.eq(2).text());
|
||||||
size = H5AI.util.parseSize($tds.eq(3).text());
|
size = h5ai.util.parseSize($tds.eq(3).text());
|
||||||
|
|
||||||
path.parentFolder = folder;
|
path.parentFolder = folder;
|
||||||
path.label = $a.text();
|
path.label = $a.text();
|
||||||
path.type = H5AI.util.pathEndsWithSlash(path.label) ? "folder" : H5AI.core.getFileType(path.label);
|
path.type = h5ai.util.pathEndsWithSlash(path.label) ? "folder" : h5ai.core.getFileType(path.label);
|
||||||
path.href = $a.attr("href");
|
path.href = $a.attr("href");
|
||||||
path.time = date ? date.getTime() : 0;
|
path.time = date ? date.getTime() : 0;
|
||||||
path.size = size;
|
path.size = size;
|
||||||
} else {
|
} else {
|
||||||
splits = H5AI.util.splitPath(folder);
|
splits = h5ai.util.splitPath(folder);
|
||||||
|
|
||||||
path.parentFolder = splits.parent || "";
|
path.parentFolder = splits.parent || "";
|
||||||
path.label = H5AI.util.checkedDecodeUri(splits.name);
|
path.label = h5ai.util.checkedDecodeUri(splits.name);
|
||||||
if (path.label === "/") {
|
if (path.label === "/") {
|
||||||
path.label = H5AI.util.checkedDecodeUri(document.domain);
|
path.label = h5ai.util.checkedDecodeUri(document.domain);
|
||||||
}
|
}
|
||||||
path.type = "folder";
|
path.type = "folder";
|
||||||
path.href = splits.name;
|
path.href = splits.name;
|
||||||
|
@ -57,7 +57,7 @@
|
||||||
path.size = -1;
|
path.size = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (H5AI.util.pathEndsWithSlash(path.label)) {
|
if (h5ai.util.pathEndsWithSlash(path.label)) {
|
||||||
path.label = path.label.slice(0, -1);
|
path.label = path.label.slice(0, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,12 +71,12 @@
|
||||||
path.isCurrentFolder = (path.absHref === document.location.pathname);
|
path.isCurrentFolder = (path.absHref === document.location.pathname);
|
||||||
path.isDomain = (path.absHref === "/");
|
path.isDomain = (path.absHref === "/");
|
||||||
|
|
||||||
if (path.isParentFolder && H5AI.core.settings.setParentFolderLabels) {
|
if (path.isParentFolder && h5ai.core.settings.setParentFolderLabels) {
|
||||||
if (path.isDomain) {
|
if (path.isDomain) {
|
||||||
path.label = H5AI.util.checkedDecodeUri(document.domain);
|
path.label = h5ai.util.checkedDecodeUri(document.domain);
|
||||||
} else {
|
} else {
|
||||||
splits = H5AI.util.splitPath(path.parentFolder);
|
splits = h5ai.util.splitPath(path.parentFolder);
|
||||||
path.label = H5AI.util.checkedDecodeUri(splits.parentname);
|
path.label = h5ai.util.checkedDecodeUri(splits.parentname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,10 +86,10 @@
|
||||||
};
|
};
|
||||||
path.onClick = function (context) {
|
path.onClick = function (context) {
|
||||||
|
|
||||||
H5AI.core.triggerPathClick(path, context);
|
h5ai.core.triggerPathClick(path, context);
|
||||||
};
|
};
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
};
|
};
|
||||||
|
|
||||||
}(document, jQuery, H5AI));
|
}(document, jQuery, h5ai));
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
(function ($, H5AI) {
|
(function ($, h5ai) {
|
||||||
|
|
||||||
var type = function (entry) {
|
var type = function (entry) {
|
||||||
|
|
||||||
|
@ -78,13 +78,13 @@
|
||||||
$all.removeClass("ascending").removeClass("descending");
|
$all.removeClass("ascending").removeClass("descending");
|
||||||
order.head.addClass(order.clas);
|
order.head.addClass(order.clas);
|
||||||
sort(order.fn);
|
sort(order.fn);
|
||||||
H5AI.core.hash({sort: id});
|
h5ai.core.hash({sort: id});
|
||||||
},
|
},
|
||||||
init = function () {
|
init = function () {
|
||||||
|
|
||||||
var $ascending = $("<img src='" + H5AI.core.image("ascending") + "' class='sort ascending' alt='ascending' />"),
|
var $ascending = $("<img src='" + h5ai.core.image("ascending") + "' class='sort ascending' alt='ascending' />"),
|
||||||
$descending = $("<img src='" + H5AI.core.image("descending") + "' class='sort descending' alt='descending' />"),
|
$descending = $("<img src='" + h5ai.core.image("descending") + "' class='sort descending' alt='descending' />"),
|
||||||
initialOrder = H5AI.core.hash('sort'),
|
initialOrder = h5ai.core.hash('sort'),
|
||||||
$header = $("#extended li.header"),
|
$header = $("#extended li.header"),
|
||||||
$label = $header.find("a.label"),
|
$label = $header.find("a.label"),
|
||||||
$date = $header.find("a.date"),
|
$date = $header.find("a.date"),
|
||||||
|
@ -124,7 +124,7 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
sortBy(initialOrder ? initialOrder : H5AI.core.settings.sortorder);
|
sortBy(initialOrder ? initialOrder : h5ai.core.settings.sortorder);
|
||||||
|
|
||||||
$label
|
$label
|
||||||
.append($ascending.clone()).append($descending.clone())
|
.append($ascending.clone()).append($descending.clone())
|
||||||
|
@ -148,8 +148,8 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
H5AI.sort = {
|
h5ai.sort = {
|
||||||
init: init
|
init: init
|
||||||
};
|
};
|
||||||
|
|
||||||
}(jQuery, H5AI));
|
}(jQuery, h5ai));
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
(function ($, H5AI) {
|
(function ($, h5ai) {
|
||||||
|
|
||||||
var reSplitPath = /^\/([^\/]+\/?)$/,
|
var reSplitPath = /^\/([^\/]+\/?)$/,
|
||||||
reSplitPath2 = /^(\/(?:.*\/)*?([^\/]+)\/)([^\/]+\/?)$/,
|
reSplitPath2 = /^(\/(?:.*\/)*?([^\/]+)\/)([^\/]+\/?)$/,
|
||||||
|
@ -104,7 +104,7 @@
|
||||||
return sequence.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
return sequence.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
||||||
};
|
};
|
||||||
|
|
||||||
H5AI.util = {
|
h5ai.util = {
|
||||||
splitPath: splitPath,
|
splitPath: splitPath,
|
||||||
pathEndsWithSlash: pathEndsWithSlash,
|
pathEndsWithSlash: pathEndsWithSlash,
|
||||||
getAbsHref: getAbsHref,
|
getAbsHref: getAbsHref,
|
||||||
|
@ -114,4 +114,4 @@
|
||||||
reEscape: reEscape
|
reEscape: reEscape
|
||||||
};
|
};
|
||||||
|
|
||||||
}(jQuery, H5AI));
|
}(jQuery, h5ai));
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
(function ($, H5AI) {
|
(function ($, h5ai) {
|
||||||
|
|
||||||
var x = 0,
|
var x = 0,
|
||||||
y = 0,
|
y = 0,
|
||||||
|
@ -102,11 +102,11 @@
|
||||||
|
|
||||||
|
|
||||||
$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 {
|
} else {
|
||||||
if (response.code === 401) {
|
if (response.code === 401) {
|
||||||
$downloadAuth
|
$downloadAuth
|
||||||
|
@ -126,9 +126,9 @@
|
||||||
requestZipping = function (hrefsStr) {
|
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
|
||||||
|
@ -156,9 +156,9 @@
|
||||||
},
|
},
|
||||||
init = function () {
|
init = function () {
|
||||||
|
|
||||||
if (H5AI.core.settings.zippedDownload) {
|
if (h5ai.core.settings.zippedDownload) {
|
||||||
$("<li id='download'><a href='#'><img alt='download' /><span class='l10n-download'>download</span></a></li>")
|
$("<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("img").attr("src", h5ai.core.image("download")).end()
|
||||||
.find("a").click(function (event) {
|
.find("a").click(function (event) {
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
@ -181,8 +181,8 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
H5AI.zippedDownload = {
|
h5ai.zippedDownload = {
|
||||||
init: init
|
init: init
|
||||||
};
|
};
|
||||||
|
|
||||||
}(jQuery, H5AI));
|
}(jQuery, h5ai));
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
|
|
||||||
(function ($) {
|
|
||||||
'use strict';
|
|
||||||
/*jslint browser: true, confusion: true, regexp: true, vars: true, white: true */
|
|
||||||
/*global Modernizr, jQuery, amplify, Base64, H5AI_CONFIG */
|
|
||||||
|
|
||||||
var H5AI = {};
|
|
||||||
|
|
||||||
// @include "Util.js"
|
|
||||||
// @include "Core.js"
|
|
||||||
// @include "Sort.js"
|
|
||||||
// @include "ZippedDownload.js"
|
|
||||||
// @include "Finder.js"
|
|
||||||
// @include "Context.js"
|
|
||||||
|
|
||||||
// @include "Path.js"
|
|
||||||
// @include "Connector.js"
|
|
||||||
// @include "Html.js"
|
|
||||||
// @include "Extended.js"
|
|
||||||
|
|
||||||
$(function () {
|
|
||||||
|
|
||||||
var isPhp = $('html.h5ai-php').length > 0;
|
|
||||||
|
|
||||||
if (!isPhp) {
|
|
||||||
H5AI.extended.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
H5AI.core.init();
|
|
||||||
H5AI.sort.init();
|
|
||||||
H5AI.finder.init();
|
|
||||||
H5AI.zippedDownload.init();
|
|
||||||
H5AI.context.init();
|
|
||||||
|
|
||||||
if (isPhp) {
|
|
||||||
$('#tree').scrollpanel();
|
|
||||||
H5AI.core.shiftTree(false, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}(jQuery));
|
|
|
@ -10,4 +10,4 @@
|
||||||
// @include "inc/lib/base64.js"
|
// @include "inc/lib/base64.js"
|
||||||
// @include "inc/lib/date.js"
|
// @include "inc/lib/date.js"
|
||||||
|
|
||||||
// @include "inc/main.js"
|
// @include "inc/H5ai.js"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue