mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-24 20:14:37 -04:00
Clean code.
This commit is contained in:
parent
ba10f70b12
commit
8951732f3c
42 changed files with 2547 additions and 2572 deletions
16
mkrfile.js
16
mkrfile.js
|
@ -14,12 +14,10 @@ var build = path.join(root, 'build');
|
|||
var mapSrc = $.map.p(src, build).s('.less', '.css').s('.jade', '');
|
||||
var mapRoot = $.map.p(root, path.join(build, '_h5ai'));
|
||||
|
||||
// bad hack
|
||||
var getBuildSuffix = function (callback) {
|
||||
|
||||
var child_process = require('child_process');
|
||||
function getBuildSuffix(callback) {
|
||||
|
||||
child_process.exec('git rev-list v' + pkg.version + '..HEAD', {cwd: root}, function (err, out) {
|
||||
require('child_process').exec('git rev-list v' + pkg.version + '..HEAD', {cwd: root}, function (err, out) {
|
||||
|
||||
try {
|
||||
var lines = out.trim().split(/\r?\n/);
|
||||
|
@ -28,7 +26,7 @@ var getBuildSuffix = function (callback) {
|
|||
callback('+X');
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
$.plugin('fquery-cssmin');
|
||||
|
@ -96,10 +94,10 @@ module.exports = function (suite) {
|
|||
});
|
||||
|
||||
|
||||
suite.target('build', ['check-version'], 'build all updated files').task(function () {
|
||||
suite.target('build', ['check-version', 'lint'], 'build all updated files').task(function () {
|
||||
|
||||
var env = {pkg: pkg};
|
||||
var header = '/* ' + pkg.name + ' ' + pkg.version + ' - ' + pkg.homepage + ' */\n';
|
||||
var env = {pkg: pkg};
|
||||
|
||||
$(src + ': _h5ai/client/js/*.js')
|
||||
.newerThan(mapSrc, $(src + ': _h5ai/client/js/**'))
|
||||
|
@ -136,10 +134,10 @@ module.exports = function (suite) {
|
|||
});
|
||||
|
||||
|
||||
suite.target('build-uncompressed', ['check-version'], 'build all updated files').task(function () {
|
||||
suite.target('build-uncompressed', ['check-version', 'lint'], 'build all updated files').task(function () {
|
||||
|
||||
var env = {pkg: pkg};
|
||||
var header = '/* ' + pkg.name + ' ' + pkg.version + ' - ' + pkg.homepage + ' */\n';
|
||||
var env = {pkg: pkg};
|
||||
|
||||
$(src + ': _h5ai/client/js/*.js')
|
||||
.newerThan(mapSrc, $(src + ': _h5ai/client/js/**'))
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
|
||||
modulejs.define('core/event', ['_'], function (_) {
|
||||
|
||||
var slice = Array.prototype.slice,
|
||||
subscriptions = {},
|
||||
var slice = Array.prototype.slice;
|
||||
var subscriptions = {};
|
||||
|
||||
sub = function (topic, callback) {
|
||||
|
||||
function sub(topic, callback) {
|
||||
|
||||
if (_.isString(topic) && _.isFunction(callback)) {
|
||||
|
||||
|
@ -13,17 +13,17 @@ modulejs.define('core/event', ['_'], function (_) {
|
|||
}
|
||||
subscriptions[topic].push(callback);
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
unsub = function (topic, callback) {
|
||||
function unsub(topic, callback) {
|
||||
|
||||
if (_.isString(topic) && _.isFunction(callback) && subscriptions[topic]) {
|
||||
|
||||
subscriptions[topic] = _.without(subscriptions[topic], callback);
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
pub = function (topic, data) {
|
||||
function pub(topic, data) {
|
||||
|
||||
var args = slice.call(arguments, 1);
|
||||
|
||||
|
@ -35,7 +35,8 @@ modulejs.define('core/event', ['_'], function (_) {
|
|||
callback.apply(topic, args);
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
sub: sub,
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
|
||||
modulejs.define('core/format', ['_', 'moment'], function (_, moment) {
|
||||
|
||||
var decimalMetric = {
|
||||
t: 1000.0,
|
||||
k: 1000.0,
|
||||
u: ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
|
||||
},
|
||||
binaryMetric = {
|
||||
};
|
||||
var binaryMetric = {
|
||||
t: 1024.0,
|
||||
k: 1024.0,
|
||||
u: ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']
|
||||
},
|
||||
defaultMetric = decimalMetric,
|
||||
defaultDateFormat = 'YYYY-MM-DD HH:mm',
|
||||
};
|
||||
var defaultMetric = decimalMetric;
|
||||
var defaultDateFormat = 'YYYY-MM-DD HH:mm';
|
||||
|
||||
setDefaultMetric = function (useBinaryMetric) {
|
||||
|
||||
function setDefaultMetric(useBinaryMetric) {
|
||||
|
||||
defaultMetric = useBinaryMetric ? binaryMetric : decimalMetric;
|
||||
},
|
||||
}
|
||||
|
||||
formatSize = function (size, metric) {
|
||||
function formatSize(size, metric) {
|
||||
|
||||
metric = metric || defaultMetric;
|
||||
|
||||
|
@ -27,25 +27,26 @@ modulejs.define('core/format', ['_', 'moment'], function (_, moment) {
|
|||
return '';
|
||||
}
|
||||
|
||||
var i = 0,
|
||||
maxI = metric.u.length - 1;
|
||||
var i = 0;
|
||||
var maxI = metric.u.length - 1;
|
||||
|
||||
while (size >= metric.t && i < maxI) {
|
||||
size /= metric.k;
|
||||
i += 1;
|
||||
}
|
||||
return (i <= 1 ? Math.round(size) : size.toFixed(1)).toString() + ' ' + metric.u[i];
|
||||
},
|
||||
}
|
||||
|
||||
setDefaultDateFormat = function (dateFormat) {
|
||||
function setDefaultDateFormat(dateFormat) {
|
||||
|
||||
defaultDateFormat = dateFormat;
|
||||
},
|
||||
}
|
||||
|
||||
formatDate = function (millis) {
|
||||
function formatDate(millis) {
|
||||
|
||||
return _.isNumber(millis) && millis ? moment(millis).format(defaultDateFormat) : '';
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
setDefaultMetric: setDefaultMetric,
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
modulejs.define('core/langs', ['config', '_'], function (config, _) {
|
||||
|
||||
return _.extend({}, config.langs);
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
|
||||
modulejs.define('core/location', ['_', 'modernizr', 'core/settings', 'core/event', 'core/notify'], function (_, modernizr, allsettings, event, notify) {
|
||||
|
||||
var settings = _.extend({
|
||||
smartBrowsing: true,
|
||||
unmanagedInNewWindow: true
|
||||
}, allsettings.view),
|
||||
}, allsettings.view);
|
||||
var doc = document;
|
||||
var history = settings.smartBrowsing && modernizr.history ? window.history : null;
|
||||
var reUriToPathname = /^.*:\/\/[^\/]*|[^\/]*$/g;
|
||||
var absHref = null;
|
||||
|
||||
doc = document,
|
||||
|
||||
history = settings.smartBrowsing && modernizr.history ? window.history : null,
|
||||
|
||||
forceEncoding = function (href) {
|
||||
function forceEncoding(href) {
|
||||
|
||||
return href
|
||||
.replace(/\/+/g, '/')
|
||||
|
@ -34,27 +34,26 @@ modulejs.define('core/location', ['_', 'modernizr', 'core/settings', 'core/event
|
|||
.replace(/@/g, '%40')
|
||||
.replace(/\[/g, '%5B')
|
||||
.replace(/\]/g, '%5D');
|
||||
},
|
||||
}
|
||||
|
||||
reUriToPathname = /^.*:\/\/[^\/]*|[^\/]*$/g,
|
||||
uriToPathname = function (uri) {
|
||||
function uriToPathname(uri) {
|
||||
|
||||
return uri.replace(reUriToPathname, '');
|
||||
},
|
||||
}
|
||||
|
||||
hrefsAreDecoded = (function () {
|
||||
var hrefsAreDecoded = (function () {
|
||||
|
||||
var testpathname = '/a b',
|
||||
a = doc.createElement('a');
|
||||
var testpathname = '/a b';
|
||||
var a = doc.createElement('a');
|
||||
|
||||
a.href = testpathname;
|
||||
return uriToPathname(a.href) === testpathname;
|
||||
}()),
|
||||
}());
|
||||
|
||||
encodedHref = function (href) {
|
||||
function encodedHref(href) {
|
||||
|
||||
var a = doc.createElement('a'),
|
||||
location;
|
||||
var a = doc.createElement('a');
|
||||
var location;
|
||||
|
||||
a.href = href;
|
||||
location = uriToPathname(a.href);
|
||||
|
@ -64,32 +63,29 @@ modulejs.define('core/location', ['_', 'modernizr', 'core/settings', 'core/event
|
|||
}
|
||||
|
||||
return forceEncoding(location);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
var absHref = null,
|
||||
|
||||
getDomain = function () {
|
||||
function getDomain() {
|
||||
|
||||
return doc.domain;
|
||||
},
|
||||
}
|
||||
|
||||
getAbsHref = function () {
|
||||
function getAbsHref() {
|
||||
|
||||
return absHref;
|
||||
},
|
||||
}
|
||||
|
||||
getItem = function () {
|
||||
function getItem() {
|
||||
|
||||
return modulejs.require('model/item').get(absHref);
|
||||
},
|
||||
}
|
||||
|
||||
load = function (callback) {
|
||||
function load(callback) {
|
||||
|
||||
modulejs.require('core/server').request({action: 'get', items: true, itemsHref: absHref, itemsWhat: 1}, function (json) {
|
||||
|
||||
var Item = modulejs.require('model/item'),
|
||||
item = Item.get(absHref);
|
||||
var Item = modulejs.require('model/item');
|
||||
var item = Item.get(absHref);
|
||||
|
||||
if (json) {
|
||||
|
||||
|
@ -112,9 +108,9 @@ modulejs.define('core/location', ['_', 'modernizr', 'core/settings', 'core/event
|
|||
callback(item);
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
setLocation = function (newAbsHref, keepBrowserUrl) {
|
||||
function setLocation(newAbsHref, keepBrowserUrl) {
|
||||
|
||||
event.pub('location.beforeChange');
|
||||
|
||||
|
@ -144,26 +140,26 @@ modulejs.define('core/location', ['_', 'modernizr', 'core/settings', 'core/event
|
|||
event.pub('location.changed', item);
|
||||
});
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
refresh = function () {
|
||||
function refresh() {
|
||||
|
||||
var item = getItem(),
|
||||
oldItems = _.values(item.content);
|
||||
var item = getItem();
|
||||
var oldItems = _.values(item.content);
|
||||
|
||||
event.pub('location.beforeRefresh');
|
||||
|
||||
load(function () {
|
||||
|
||||
var newItems = _.values(item.content),
|
||||
added = _.difference(newItems, oldItems),
|
||||
removed = _.difference(oldItems, newItems);
|
||||
var newItems = _.values(item.content);
|
||||
var added = _.difference(newItems, oldItems);
|
||||
var removed = _.difference(oldItems, newItems);
|
||||
|
||||
event.pub('location.refreshed', item, added, removed);
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
setLink = function ($el, item) {
|
||||
function setLink($el, item) {
|
||||
|
||||
$el.attr('href', item.absHref);
|
||||
|
||||
|
@ -178,7 +174,7 @@ modulejs.define('core/location', ['_', 'modernizr', 'core/settings', 'core/event
|
|||
if (settings.unmanagedInNewWindow && !item.isManaged) {
|
||||
$el.attr('target', '_blank');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
if (history) {
|
||||
|
@ -190,7 +186,6 @@ modulejs.define('core/location', ['_', 'modernizr', 'core/settings', 'core/event
|
|||
};
|
||||
}
|
||||
|
||||
|
||||
event.sub('ready', function () {
|
||||
|
||||
setLocation(document.location.href, true);
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
|
||||
modulejs.define('core/notify', ['$'], function ($) {
|
||||
|
||||
var template = '<div id="notify"/>',
|
||||
var template = '<div id="notify"/>';
|
||||
|
||||
set = function (content) {
|
||||
function set(content) {
|
||||
|
||||
if (content) {
|
||||
$('#notify').stop(true, true).html(content).fadeIn(400);
|
||||
} else {
|
||||
$('#notify').stop(true, true).fadeOut(400);
|
||||
}
|
||||
},
|
||||
|
||||
init = function () {
|
||||
}
|
||||
|
||||
$(template).hide().appendTo('body');
|
||||
};
|
||||
|
||||
init();
|
||||
|
||||
return {
|
||||
set: set
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
|
||||
modulejs.define('core/resource', ['_', '$', 'config', 'core/settings'], function (_, $, config, settings) {
|
||||
|
||||
var win = window,
|
||||
appHref = settings.appHref,
|
||||
imagesHref = appHref + 'client/images/',
|
||||
fallbackHref = appHref + 'client/images/fallback/',
|
||||
themesHref = appHref + 'client/themes/',
|
||||
scriptsHref = appHref + 'client/js/',
|
||||
fallbacks = ['file', 'folder', 'folder-page', 'folder-parent', 'ar', 'aud', 'bin', 'img', 'txt', 'vid'],
|
||||
var win = window;
|
||||
var appHref = settings.appHref;
|
||||
var imagesHref = appHref + 'client/images/';
|
||||
var fallbackHref = appHref + 'client/images/fallback/';
|
||||
var themesHref = appHref + 'client/themes/';
|
||||
var scriptsHref = appHref + 'client/js/';
|
||||
var fallbacks = ['file', 'folder', 'folder-page', 'folder-parent', 'ar', 'aud', 'bin', 'img', 'txt', 'vid'];
|
||||
|
||||
image = function (id) {
|
||||
|
||||
function image(id) {
|
||||
|
||||
return imagesHref + id + '.svg';
|
||||
},
|
||||
}
|
||||
|
||||
icon = function (id) {
|
||||
function icon(id) {
|
||||
|
||||
var baseId = id.split('-')[0],
|
||||
href = config.theme[id] || config.theme[baseId];
|
||||
|
@ -32,7 +32,7 @@ modulejs.define('core/resource', ['_', '$', 'config', 'core/settings'], function
|
|||
}
|
||||
|
||||
return fallbackHref + 'file.svg';
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
modulejs.define('core/server', ['$', '_', 'config', 'core/location'], function ($, _, config, location) {
|
||||
|
||||
var server = {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
modulejs.define('core/settings', ['config', '_'], function (config, _) {
|
||||
|
||||
return _.extend({}, config.options, {
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
|
||||
modulejs.define('core/store', ['modernizr'], function (modernizr) {
|
||||
|
||||
var store = modernizr.localstorage ? window.localStorage : null,
|
||||
var store = modernizr.localstorage ? window.localStorage : null;
|
||||
var key = '_h5ai';
|
||||
|
||||
key = '_h5ai',
|
||||
|
||||
load = function () {
|
||||
function load() {
|
||||
|
||||
if (store) {
|
||||
try {
|
||||
|
@ -13,26 +12,27 @@ modulejs.define('core/store', ['modernizr'], function (modernizr) {
|
|||
} catch (e) {}
|
||||
}
|
||||
return {};
|
||||
},
|
||||
}
|
||||
|
||||
save = function (obj) {
|
||||
function save(obj) {
|
||||
|
||||
if (store) {
|
||||
store[key] = JSON.stringify(obj);
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
put = function (key, value) {
|
||||
function put(key, value) {
|
||||
|
||||
var obj = load();
|
||||
obj[key] = value;
|
||||
return save(obj);
|
||||
},
|
||||
}
|
||||
|
||||
get = function (key) {
|
||||
function get(key) {
|
||||
|
||||
return load()[key];
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
put: put,
|
||||
|
|
|
@ -1,32 +1,32 @@
|
|||
|
||||
modulejs.define('core/types', ['config', '_'], function (config, _) {
|
||||
|
||||
var reEndsWithSlash = /\/$/,
|
||||
regexps = {},
|
||||
var reEndsWithSlash = /\/$/;
|
||||
var regexps = {};
|
||||
|
||||
escapeRegExp = function (sequence) {
|
||||
|
||||
function escapeRegExp(sequence) {
|
||||
|
||||
return sequence.replace(/[\-\[\]\/\{\}\(\)\+\?\.\\\^\$]/g, "\\$&");
|
||||
// return sequence.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
|
||||
},
|
||||
}
|
||||
|
||||
parse = function (types) {
|
||||
function parse(types) {
|
||||
|
||||
_.each(types, function (patterns, type) {
|
||||
|
||||
var pattern = '^(' + _.map(patterns, function (p) { return '(' + escapeRegExp(p).replace(/\*/g, '.*') + ')'; }).join('|') + ')$';
|
||||
regexps[type] = new RegExp(pattern, 'i');
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
getType = function (sequence) {
|
||||
function getType(sequence) {
|
||||
|
||||
if (reEndsWithSlash.test(sequence)) {
|
||||
return 'folder';
|
||||
}
|
||||
|
||||
var slashidx = sequence.lastIndexOf('/'),
|
||||
name = slashidx >= 0 ? sequence.substr(slashidx + 1) : sequence;
|
||||
var slashidx = sequence.lastIndexOf('/');
|
||||
var name = slashidx >= 0 ? sequence.substr(slashidx + 1) : sequence;
|
||||
|
||||
for (var type in regexps) {
|
||||
if (regexps.hasOwnProperty(type)) {
|
||||
|
@ -37,7 +37,8 @@ modulejs.define('core/types', ['config', '_'], function (config, _) {
|
|||
}
|
||||
|
||||
return 'file';
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
parse(_.extend({}, config.types));
|
||||
|
||||
|
|
|
@ -1,30 +1,29 @@
|
|||
|
||||
modulejs.define('ext/autorefresh', ['_', '$', 'core/settings', 'core/event', 'core/location'], function (_, $, allsettings, event, location) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false,
|
||||
interval: 5000
|
||||
}, allsettings.autorefresh),
|
||||
}, allsettings.autorefresh);
|
||||
var timeoutId = null;
|
||||
|
||||
timeoutId = null,
|
||||
|
||||
heartbeat = function () {
|
||||
function heartbeat() {
|
||||
|
||||
location.refresh();
|
||||
},
|
||||
}
|
||||
|
||||
before = function () {
|
||||
function before() {
|
||||
|
||||
clearTimeout(timeoutId);
|
||||
},
|
||||
}
|
||||
|
||||
after = function () {
|
||||
function after() {
|
||||
|
||||
clearTimeout(timeoutId);
|
||||
timeoutId = setTimeout(heartbeat, settings.interval);
|
||||
},
|
||||
}
|
||||
|
||||
init = function () {
|
||||
function init() {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
|
@ -36,7 +35,8 @@ modulejs.define('ext/autorefresh', ['_', '$', 'core/settings', 'core/event', 'co
|
|||
event.sub('location.beforeRefresh', before);
|
||||
event.sub('location.changed', after);
|
||||
event.sub('location.refreshed', after);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
init();
|
||||
});
|
||||
|
|
|
@ -1,28 +1,27 @@
|
|||
|
||||
modulejs.define('ext/crumb', ['_', '$', 'core/settings', 'core/resource', 'core/event', 'core/location'], function (_, $, allsettings, resource, event, location) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false
|
||||
}, allsettings.crumb),
|
||||
|
||||
template =
|
||||
}, allsettings.crumb);
|
||||
var template =
|
||||
'<li class="crumb">' +
|
||||
'<a>' +
|
||||
'<img src="' + resource.image('crumb') + '" alt=">"/>' +
|
||||
'<span/>' +
|
||||
'</a>' +
|
||||
'</li>',
|
||||
pageHintTemplate = '<img class="hint" src="' + resource.image('page') + '" alt="has index page"/>',
|
||||
statusHintTemplate = '<span class="hint"/>',
|
||||
'</li>';
|
||||
var pageHintTemplate = '<img class="hint" src="' + resource.image('page') + '" alt="has index page"/>';
|
||||
var statusHintTemplate = '<span class="hint"/>';
|
||||
|
||||
update = function (item, force) {
|
||||
|
||||
function update(item, force) {
|
||||
|
||||
if (!force && item.$crumb) {
|
||||
return item.$crumb;
|
||||
}
|
||||
|
||||
var $html = $(template),
|
||||
$a = $html.find('a');
|
||||
var $html = $(template);
|
||||
var $a = $html.find('a');
|
||||
|
||||
$html
|
||||
.addClass(item.isFolder() ? 'folder' : 'file')
|
||||
|
@ -55,13 +54,13 @@ modulejs.define('ext/crumb', ['_', '$', 'core/settings', 'core/resource', 'core/
|
|||
item.$crumb = $html;
|
||||
|
||||
return $html;
|
||||
},
|
||||
}
|
||||
|
||||
onLocationChanged = function (item) {
|
||||
function onLocationChanged(item) {
|
||||
|
||||
var crumb = item.getCrumb(),
|
||||
$ul = $('#navbar'),
|
||||
found = false;
|
||||
var crumb = item.getCrumb();
|
||||
var $ul = $('#navbar');
|
||||
var found = false;
|
||||
|
||||
$ul.find('.crumb').each(function () {
|
||||
|
||||
|
@ -81,16 +80,17 @@ modulejs.define('ext/crumb', ['_', '$', 'core/settings', 'core/resource', 'core/
|
|||
$ul.append(update(e, true));
|
||||
});
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
init = function () {
|
||||
function init() {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.sub('location.changed', onLocationChanged);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
init();
|
||||
});
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
|
||||
modulejs.define('ext/custom', ['_', '$', 'marked', 'core/settings', 'core/server', 'core/event', 'core/resource'], function (_, $, marked, allsettings, server, event, resource) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false
|
||||
}, allsettings.custom),
|
||||
}, allsettings.custom);
|
||||
var $header, $footer;
|
||||
var duration = 200;
|
||||
|
||||
$header, $footer,
|
||||
duration = 200,
|
||||
|
||||
onLocationChanged = function (item) {
|
||||
function onLocationChanged(item) {
|
||||
|
||||
server.request({action: 'get', custom: true, customHref: item.absHref}, function (response) {
|
||||
|
||||
|
@ -43,9 +42,9 @@ modulejs.define('ext/custom', ['_', '$', 'marked', 'core/settings', 'core/server
|
|||
$footer.stop().slideUp(duration);
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
init = function () {
|
||||
function init() {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
|
@ -55,7 +54,8 @@ modulejs.define('ext/custom', ['_', '$', 'marked', 'core/settings', 'core/server
|
|||
$footer = $('<div id="content-footer"/>').hide().appendTo('#content');
|
||||
|
||||
event.sub('location.changed', onLocationChanged);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
init();
|
||||
});
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
modulejs.define('ext/download', ['_', '$', 'core/settings', 'core/resource', 'core/event', 'core/location', 'core/server'], function (_, $, allsettings, resource, event, location, server) {
|
||||
|
||||
var settings = _.extend({
|
||||
|
@ -6,19 +5,18 @@ modulejs.define('ext/download', ['_', '$', 'core/settings', 'core/resource', 'co
|
|||
type: 'php-tar',
|
||||
packageName: 'package',
|
||||
alwaysVisible: false
|
||||
}, allsettings.download),
|
||||
|
||||
downloadBtnTemplate =
|
||||
}, allsettings.download);
|
||||
var downloadBtnTemplate =
|
||||
'<li id="download">' +
|
||||
'<a href="#">' +
|
||||
'<img src="' + resource.image('download') + '" alt="download"/>' +
|
||||
'<span class="l10n-download"/>' +
|
||||
'</a>' +
|
||||
'</li>',
|
||||
'</li>';
|
||||
var selectedItems = [];
|
||||
|
||||
selectedItems = [],
|
||||
|
||||
onSelection = function (items) {
|
||||
function onSelection(items) {
|
||||
|
||||
var $download = $('#download');
|
||||
|
||||
|
@ -28,13 +26,13 @@ modulejs.define('ext/download', ['_', '$', 'core/settings', 'core/resource', 'co
|
|||
} else if (!settings.alwaysVisible) {
|
||||
$download.hide();
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
onClick = function (event) {
|
||||
function onClick(event) {
|
||||
|
||||
var type = settings.type,
|
||||
extension = (type === 'shell-zip') ? 'zip' : 'tar',
|
||||
query = {
|
||||
var type = settings.type;
|
||||
var extension = (type === 'shell-zip') ? 'zip' : 'tar';
|
||||
var query = {
|
||||
action: 'download',
|
||||
as: (settings.packageName || location.getItem().label) + '.' + extension,
|
||||
type: type,
|
||||
|
@ -42,9 +40,9 @@ modulejs.define('ext/download', ['_', '$', 'core/settings', 'core/resource', 'co
|
|||
};
|
||||
|
||||
server.formRequest(query);
|
||||
},
|
||||
}
|
||||
|
||||
init = function () {
|
||||
function init() {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
|
@ -59,7 +57,8 @@ modulejs.define('ext/download', ['_', '$', 'core/settings', 'core/resource', 'co
|
|||
}
|
||||
|
||||
event.sub('selection', onSelection);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
init();
|
||||
});
|
||||
|
|
|
@ -1,26 +1,24 @@
|
|||
|
||||
modulejs.define('ext/filter', ['_', '$', 'core/settings', 'core/resource', 'core/event'], function (_, $, allsettings, resource, event) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false
|
||||
}, allsettings.filter),
|
||||
|
||||
template =
|
||||
}, allsettings.filter);
|
||||
var template =
|
||||
'<li id="filter">' +
|
||||
'<span class="element">' +
|
||||
'<img src="' + resource.image('filter') + '" alt="filter"/>' +
|
||||
'<input type="text" value="" placeholder="filter"/>' +
|
||||
'</span>' +
|
||||
'</li>',
|
||||
noMatchTemplate = '<div class="no-match l10n-noMatch"/>',
|
||||
'</li>';
|
||||
var noMatchTemplate = '<div class="no-match l10n-noMatch"/>';
|
||||
var $filter, $input, $noMatch;
|
||||
|
||||
$filter, $input, $noMatch,
|
||||
|
||||
filter = function (re) {
|
||||
function filter(re) {
|
||||
|
||||
var match = [],
|
||||
noMatch = [],
|
||||
duration = 200;
|
||||
var match = [];
|
||||
var noMatch = [];
|
||||
var duration = 200;
|
||||
|
||||
if (re) {
|
||||
$('#items .item').not('.folder-parent').each(function () {
|
||||
|
@ -44,14 +42,14 @@ modulejs.define('ext/filter', ['_', '$', 'core/settings', 'core/resource', 'core
|
|||
}
|
||||
$(match).fadeIn(duration);
|
||||
$(noMatch).fadeOut(duration);
|
||||
},
|
||||
}
|
||||
|
||||
escapeRegExp = function (sequence) {
|
||||
function escapeRegExp(sequence) {
|
||||
|
||||
return sequence.replace(/[\-\[\]{}()*+?.,\\$\^|#\s]/g, '\\$&');
|
||||
},
|
||||
}
|
||||
|
||||
parseFilterSequence = function (sequence) {
|
||||
function parseFilterSequence(sequence) {
|
||||
|
||||
if (sequence.substr(0, 3) === 're:') {
|
||||
return new RegExp(sequence.substr(3));
|
||||
|
@ -66,14 +64,14 @@ modulejs.define('ext/filter', ['_', '$', 'core/settings', 'core/resource', 'core
|
|||
}).join('|');
|
||||
|
||||
return new RegExp(sequence, 'i');
|
||||
},
|
||||
}
|
||||
|
||||
reset = function () {
|
||||
function reset() {
|
||||
|
||||
$input.val('').blur();
|
||||
},
|
||||
}
|
||||
|
||||
update = function (focus) {
|
||||
function update(focus) {
|
||||
|
||||
var val = $input.val();
|
||||
|
||||
|
@ -88,11 +86,19 @@ modulejs.define('ext/filter', ['_', '$', 'core/settings', 'core/resource', 'core
|
|||
filter();
|
||||
$filter.removeClass('current');
|
||||
}
|
||||
},
|
||||
updt = function () { update(true); },
|
||||
updf = function () { update(false); },
|
||||
}
|
||||
|
||||
init = function () {
|
||||
function updt() {
|
||||
|
||||
update(true);
|
||||
}
|
||||
|
||||
function updf() {
|
||||
|
||||
update(false);
|
||||
}
|
||||
|
||||
function init() {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
|
@ -115,7 +121,8 @@ modulejs.define('ext/filter', ['_', '$', 'core/settings', 'core/resource', 'core
|
|||
.on('keypress', updt);
|
||||
|
||||
event.sub('location.changed', reset);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
init();
|
||||
});
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
|
||||
modulejs.define('ext/google-analytics-ga', ['_', 'core/settings'], function (_, allsettings) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false,
|
||||
gaq: []
|
||||
}, allsettings['google-analytics-ga']),
|
||||
}, allsettings['google-analytics-ga']);
|
||||
|
||||
init = function () {
|
||||
|
||||
function init() {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
|
@ -14,15 +14,16 @@ modulejs.define('ext/google-analytics-ga', ['_', 'core/settings'], function (_,
|
|||
|
||||
window._gaq = settings.gaq;
|
||||
|
||||
var scriptLiteral = 'script',
|
||||
doc = document,
|
||||
newScriptTag = doc.createElement(scriptLiteral),
|
||||
firstScriptTag = doc.getElementsByTagName(scriptLiteral)[0];
|
||||
var scriptLiteral = 'script';
|
||||
var doc = document;
|
||||
var newScriptTag = doc.createElement(scriptLiteral);
|
||||
var firstScriptTag = doc.getElementsByTagName(scriptLiteral)[0];
|
||||
|
||||
newScriptTag.async = true;
|
||||
newScriptTag.src = ('https:' === location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||
firstScriptTag.parentNode.insertBefore(newScriptTag, firstScriptTag);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
init();
|
||||
});
|
||||
|
@ -33,14 +34,14 @@ modulejs.define('ext/google-analytics-ua', ['_', 'core/settings', 'core/event'],
|
|||
var settings = _.extend({
|
||||
enabled: false,
|
||||
id: 'UA-000000-0'
|
||||
}, allsettings['google-analytics-ua']),
|
||||
}, allsettings['google-analytics-ua']);
|
||||
var win = window;
|
||||
var doc = document;
|
||||
var scriptLiteral = 'script';
|
||||
var id = 'h5ai-ga';
|
||||
|
||||
win = window,
|
||||
doc = document,
|
||||
scriptLiteral = 'script',
|
||||
id = 'h5ai-ga',
|
||||
|
||||
init = function () {
|
||||
function init() {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
|
@ -71,7 +72,8 @@ modulejs.define('ext/google-analytics-ua', ['_', 'core/settings', 'core/event'],
|
|||
title: _.pluck(item.getCrumb(), 'label').join(' > ')
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
init();
|
||||
});
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
|
||||
modulejs.define('ext/l10n', ['_', '$', 'core/settings', 'core/langs', 'core/format', 'core/store', 'core/event', 'core/server'], function (_, $, allsettings, langs, format, store, event, server) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false,
|
||||
lang: 'en',
|
||||
useBrowserLang: true
|
||||
}, allsettings.l10n),
|
||||
|
||||
defaultTranslations = {
|
||||
}, allsettings.l10n);
|
||||
var defaultTranslations = {
|
||||
isoCode: 'en',
|
||||
lang: 'english',
|
||||
details: 'details',
|
||||
|
@ -26,19 +24,17 @@ modulejs.define('ext/l10n', ['_', '$', 'core/settings', 'core/langs', 'core/form
|
|||
dateFormat: 'YYYY-MM-DD HH:mm',
|
||||
filter: 'filter',
|
||||
'delete': 'delete'
|
||||
},
|
||||
|
||||
blockTemplate = '<div class="block"><div class="select"><select id="langs"/></div></div>',
|
||||
optionTemplate = '<option/>',
|
||||
|
||||
storekey = 'ext/l10n',
|
||||
|
||||
loaded = {
|
||||
};
|
||||
var blockTemplate = '<div class="block"><div class="select"><select id="langs"/></div></div>';
|
||||
var optionTemplate = '<option/>';
|
||||
var storekey = 'ext/l10n';
|
||||
var loaded = {
|
||||
en: _.extend({}, defaultTranslations)
|
||||
},
|
||||
currentLang = loaded.en,
|
||||
};
|
||||
var currentLang = loaded.en;
|
||||
|
||||
update = function (lang) {
|
||||
|
||||
function update(lang) {
|
||||
|
||||
if (lang) {
|
||||
currentLang = lang;
|
||||
|
@ -62,9 +58,9 @@ modulejs.define('ext/l10n', ['_', '$', 'core/settings', 'core/langs', 'core/form
|
|||
});
|
||||
|
||||
$('#filter input').attr('placeholder', currentLang.filter);
|
||||
},
|
||||
}
|
||||
|
||||
loadLanguage = function (isoCode, callback) {
|
||||
function loadLanguage(isoCode, callback) {
|
||||
|
||||
if (loaded[isoCode]) {
|
||||
|
||||
|
@ -78,9 +74,9 @@ modulejs.define('ext/l10n', ['_', '$', 'core/settings', 'core/langs', 'core/form
|
|||
callback(loaded[isoCode]);
|
||||
});
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
localize = function (langs, isoCode, useBrowserLang) {
|
||||
function localize(langs, isoCode, useBrowserLang) {
|
||||
|
||||
var storedIsoCode = store.get(storekey);
|
||||
|
||||
|
@ -102,13 +98,13 @@ modulejs.define('ext/l10n', ['_', '$', 'core/settings', 'core/langs', 'core/form
|
|||
}
|
||||
|
||||
loadLanguage(isoCode, update);
|
||||
},
|
||||
}
|
||||
|
||||
initLangSelector = function (langs) {
|
||||
function initLangSelector(langs) {
|
||||
|
||||
var isoCodes = _.keys(langs).sort(),
|
||||
$block = $(blockTemplate),
|
||||
$select = $block.find('select')
|
||||
var isoCodes = _.keys(langs).sort();
|
||||
var $block = $(blockTemplate);
|
||||
var $select = $block.find('select')
|
||||
.on('change', function (event) {
|
||||
var isoCode = event.target.value;
|
||||
store.put(storekey, isoCode);
|
||||
|
@ -124,9 +120,9 @@ modulejs.define('ext/l10n', ['_', '$', 'core/settings', 'core/langs', 'core/form
|
|||
});
|
||||
|
||||
$block.appendTo('#settings');
|
||||
},
|
||||
}
|
||||
|
||||
init = function () {
|
||||
function init() {
|
||||
|
||||
if (settings.enabled) {
|
||||
initLangSelector(langs);
|
||||
|
@ -136,7 +132,8 @@ modulejs.define('ext/l10n', ['_', '$', 'core/settings', 'core/langs', 'core/form
|
|||
|
||||
localize(langs, settings.lang, settings.useBrowserLang);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
init();
|
||||
});
|
||||
|
|
|
@ -1,40 +1,39 @@
|
|||
|
||||
modulejs.define('ext/link-hover-states', ['_', '$', 'core/settings', 'core/event'], function (_, $, allsettings, event) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false
|
||||
}, allsettings['link-hover-states']),
|
||||
}, allsettings['link-hover-states']);
|
||||
var selector = "a[href^='/']";
|
||||
|
||||
selector = "a[href^='/']",
|
||||
|
||||
selectLinks = function (href) {
|
||||
function selectLinks(href) {
|
||||
|
||||
return $(_.filter($(selector), function (el) {
|
||||
|
||||
return $(el).attr('href') === href;
|
||||
}));
|
||||
},
|
||||
}
|
||||
|
||||
onMouseEnter = function () {
|
||||
function onMouseEnter() {
|
||||
|
||||
var href = $(this).attr('href');
|
||||
|
||||
selectLinks(href).addClass('hover');
|
||||
},
|
||||
}
|
||||
|
||||
onMouseLeave = function () {
|
||||
function onMouseLeave() {
|
||||
|
||||
var href = $(this).attr('href');
|
||||
|
||||
selectLinks(href).removeClass('hover');
|
||||
},
|
||||
}
|
||||
|
||||
onLocationChanged = function () {
|
||||
function onLocationChanged() {
|
||||
|
||||
$('.hover').removeClass('hover');
|
||||
},
|
||||
}
|
||||
|
||||
init = function () {
|
||||
function init() {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
|
@ -45,7 +44,8 @@ modulejs.define('ext/link-hover-states', ['_', '$', 'core/settings', 'core/event
|
|||
.on('mouseleave', selector, onMouseLeave);
|
||||
|
||||
event.sub('location.changed', onLocationChanged);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
init();
|
||||
});
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
|
||||
modulejs.define('ext/piwik-analytics', ['_', '$', 'core/settings'], function (_, $, allsettings) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false,
|
||||
baseURL: 'not-set',
|
||||
idSite: 0
|
||||
}, allsettings['piwik-analytics']),
|
||||
}, allsettings['piwik-analytics']);
|
||||
|
||||
init = function () {
|
||||
|
||||
function init() {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
|
@ -25,7 +25,8 @@ modulejs.define('ext/piwik-analytics', ['_', '$', 'core/settings'], function (_,
|
|||
piwikTracker.trackPageView();
|
||||
piwikTracker.enableLinkTracking();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
init();
|
||||
});
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
|
||||
modulejs.define('ext/preview-audio', ['_', '$', 'moment', 'core/settings', 'core/event', 'ext/preview'], function (_, $, moment, allsettings, event, preview) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false,
|
||||
types: []
|
||||
}, allsettings['preview-aud']),
|
||||
}, allsettings['preview-aud']);
|
||||
|
||||
preloadAudio = function (src, callback) {
|
||||
|
||||
function preloadAudio(src, callback) {
|
||||
|
||||
var $audio = $('<audio/>')
|
||||
.one('loadedmetadata', function () {
|
||||
|
@ -17,18 +17,18 @@ modulejs.define('ext/preview-audio', ['_', '$', 'moment', 'core/settings', 'core
|
|||
.attr('autoplay', 'autoplay')
|
||||
.attr('controls', 'controls')
|
||||
.attr('src', src);
|
||||
},
|
||||
}
|
||||
|
||||
onEnter = function (items, idx) {
|
||||
function onEnter(items, idx) {
|
||||
|
||||
var currentItems = items,
|
||||
currentIdx = idx,
|
||||
currentItem = items[idx],
|
||||
var currentItems = items;
|
||||
var currentIdx = idx;
|
||||
var currentItem = items[idx];
|
||||
|
||||
onAdjustSize = function () {
|
||||
function onAdjustSize() {
|
||||
|
||||
var $content = $('#pv-content'),
|
||||
$audio = $('#pv-aud-audio');
|
||||
var $content = $('#pv-content');
|
||||
var $audio = $('#pv-aud-audio');
|
||||
|
||||
if ($audio.length) {
|
||||
|
||||
|
@ -42,9 +42,9 @@ modulejs.define('ext/preview-audio', ['_', '$', 'moment', 'core/settings', 'core
|
|||
moment(0).add('seconds', $audio[0].duration).format('m:ss')
|
||||
]);
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
onIdxChange = function (rel) {
|
||||
function onIdxChange(rel) {
|
||||
|
||||
currentIdx = (currentIdx + rel + currentItems.length) % currentItems.length;
|
||||
currentItem = currentItems[currentIdx];
|
||||
|
@ -72,15 +72,15 @@ modulejs.define('ext/preview-audio', ['_', '$', 'moment', 'core/settings', 'core
|
|||
}, 10);
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
onIdxChange(0);
|
||||
preview.setOnIndexChange(onIdxChange);
|
||||
preview.setOnAdjustSize(onAdjustSize);
|
||||
preview.enter();
|
||||
},
|
||||
}
|
||||
|
||||
initItem = function (item) {
|
||||
function initItem(item) {
|
||||
|
||||
if (item.$view && _.indexOf(settings.types, item.type) >= 0) {
|
||||
item.$view.find('a').on('click', function (event) {
|
||||
|
@ -96,19 +96,19 @@ modulejs.define('ext/preview-audio', ['_', '$', 'moment', 'core/settings', 'core
|
|||
onEnter(matchedEntries, _.indexOf(matchedEntries, item));
|
||||
});
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
onLocationChanged = function (item) {
|
||||
function onLocationChanged(item) {
|
||||
|
||||
_.each(item.content, initItem);
|
||||
},
|
||||
}
|
||||
|
||||
onLocationRefreshed = function (item, added, removed) {
|
||||
function onLocationRefreshed(item, added, removed) {
|
||||
|
||||
_.each(added, initItem);
|
||||
},
|
||||
}
|
||||
|
||||
init = function () {
|
||||
function init() {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
|
@ -116,7 +116,8 @@ modulejs.define('ext/preview-audio', ['_', '$', 'moment', 'core/settings', 'core
|
|||
|
||||
event.sub('location.changed', onLocationChanged);
|
||||
event.sub('location.refreshed', onLocationRefreshed);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
init();
|
||||
});
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
|
||||
modulejs.define('ext/preview-img', ['_', '$', 'core/settings', 'core/event', 'ext/preview'], function (_, $, allsettings, event, preview) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false,
|
||||
types: []
|
||||
}, allsettings['preview-img']),
|
||||
}, allsettings['preview-img']);
|
||||
|
||||
preloadImg = function (src, callback) {
|
||||
|
||||
function preloadImg(src, callback) {
|
||||
|
||||
var $img = $('<img/>')
|
||||
.one('load', function () {
|
||||
|
@ -15,18 +15,18 @@ modulejs.define('ext/preview-img', ['_', '$', 'core/settings', 'core/event', 'ex
|
|||
// setTimeout(function () { callback($img); }, 1000); // for testing
|
||||
})
|
||||
.attr('src', src);
|
||||
},
|
||||
}
|
||||
|
||||
onEnter = function (items, idx) {
|
||||
function onEnter(items, idx) {
|
||||
|
||||
var currentItems = items,
|
||||
currentIdx = idx,
|
||||
currentItem = items[idx],
|
||||
var currentItems = items;
|
||||
var currentIdx = idx;
|
||||
var currentItem = items[idx];
|
||||
|
||||
onAdjustSize = function () {
|
||||
function onAdjustSize() {
|
||||
|
||||
var $content = $('#pv-content'),
|
||||
$img = $('#pv-img-image');
|
||||
var $content = $('#pv-content');
|
||||
var $img = $('#pv-img-image');
|
||||
|
||||
if ($img.length) {
|
||||
|
||||
|
@ -41,9 +41,9 @@ modulejs.define('ext/preview-img', ['_', '$', 'core/settings', 'core/event', 'ex
|
|||
'' + (100 * $img.width() / $img[0].naturalWidth).toFixed(0) + '%'
|
||||
]);
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
onIdxChange = function (rel) {
|
||||
function onIdxChange(rel) {
|
||||
|
||||
currentIdx = (currentIdx + rel + currentItems.length) % currentItems.length;
|
||||
currentItem = currentItems[currentIdx];
|
||||
|
@ -74,15 +74,15 @@ modulejs.define('ext/preview-img', ['_', '$', 'core/settings', 'core/event', 'ex
|
|||
}, 10);
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
onIdxChange(0);
|
||||
preview.setOnIndexChange(onIdxChange);
|
||||
preview.setOnAdjustSize(onAdjustSize);
|
||||
preview.enter();
|
||||
},
|
||||
}
|
||||
|
||||
initItem = function (item) {
|
||||
function initItem(item) {
|
||||
|
||||
if (item.$view && _.indexOf(settings.types, item.type) >= 0) {
|
||||
item.$view.find('a').on('click', function (event) {
|
||||
|
@ -98,19 +98,19 @@ modulejs.define('ext/preview-img', ['_', '$', 'core/settings', 'core/event', 'ex
|
|||
onEnter(matchedEntries, _.indexOf(matchedEntries, item));
|
||||
});
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
onLocationChanged = function (item) {
|
||||
function onLocationChanged(item) {
|
||||
|
||||
_.each(item.content, initItem);
|
||||
},
|
||||
}
|
||||
|
||||
onLocationRefreshed = function (item, added, removed) {
|
||||
function onLocationRefreshed(item, added, removed) {
|
||||
|
||||
_.each(added, initItem);
|
||||
},
|
||||
}
|
||||
|
||||
init = function () {
|
||||
function init() {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
|
@ -118,7 +118,8 @@ modulejs.define('ext/preview-img', ['_', '$', 'core/settings', 'core/event', 'ex
|
|||
|
||||
event.sub('location.changed', onLocationChanged);
|
||||
event.sub('location.refreshed', onLocationRefreshed);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
init();
|
||||
});
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
|
||||
modulejs.define('ext/preview-txt', ['_', '$', 'marked', 'prism', 'core/settings', 'core/event', 'ext/preview'], function (_, $, marked, prism, allsettings, event, preview) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false,
|
||||
types: {}
|
||||
}, allsettings['preview-txt']),
|
||||
}, allsettings['preview-txt']);
|
||||
var templateText = '<pre id="pv-txt-text" class="highlighted"/>';
|
||||
var templateMarkdown = '<div id="pv-txt-text" class="markdown"/>';
|
||||
|
||||
templateText = '<pre id="pv-txt-text" class="highlighted"/>',
|
||||
templateMarkdown = '<div id="pv-txt-text" class="markdown"/>',
|
||||
|
||||
preloadText = function (absHref, callback) {
|
||||
function preloadText(absHref, callback) {
|
||||
|
||||
$.ajax({
|
||||
url: absHref,
|
||||
|
@ -24,26 +23,26 @@ modulejs.define('ext/preview-txt', ['_', '$', 'marked', 'prism', 'core/settings'
|
|||
|
||||
callback('[ajax error] ' + textStatus);
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
onEnter = function (items, idx) {
|
||||
function onEnter(items, idx) {
|
||||
|
||||
var currentItems = items,
|
||||
currentIdx = idx,
|
||||
currentItem = items[idx],
|
||||
var currentItems = items;
|
||||
var currentIdx = idx;
|
||||
var currentItem = items[idx];
|
||||
|
||||
onAdjustSize = function () {
|
||||
function onAdjustSize() {
|
||||
|
||||
var $content = $('#pv-content'),
|
||||
$text = $('#pv-txt-text');
|
||||
var $content = $('#pv-content');
|
||||
var $text = $('#pv-txt-text');
|
||||
|
||||
if ($text.length) {
|
||||
|
||||
$text.height($content.height() - 16);
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
onIdxChange = function (rel) {
|
||||
function onIdxChange(rel) {
|
||||
|
||||
currentIdx = (currentIdx + rel + currentItems.length) % currentItems.length;
|
||||
currentItem = currentItems[currentIdx];
|
||||
|
@ -57,8 +56,8 @@ modulejs.define('ext/preview-txt', ['_', '$', 'marked', 'prism', 'core/settings'
|
|||
|
||||
$('#pv-content').fadeOut(100, function () {
|
||||
|
||||
var type = settings.types[currentItem.type],
|
||||
$text, $code;
|
||||
var type = settings.types[currentItem.type];
|
||||
var $text, $code;
|
||||
|
||||
if (type === 'none') {
|
||||
$text = $(templateMarkdown).text(textContent);
|
||||
|
@ -88,15 +87,15 @@ modulejs.define('ext/preview-txt', ['_', '$', 'marked', 'prism', 'core/settings'
|
|||
preview.setRawLink(currentItem.absHref);
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
onIdxChange(0);
|
||||
preview.setOnIndexChange(onIdxChange);
|
||||
preview.setOnAdjustSize(onAdjustSize);
|
||||
preview.enter();
|
||||
},
|
||||
}
|
||||
|
||||
initItem = function (item) {
|
||||
function initItem(item) {
|
||||
|
||||
if (item.$view && _.indexOf(_.keys(settings.types), item.type) >= 0) {
|
||||
item.$view.find('a').on('click', function (event) {
|
||||
|
@ -112,19 +111,19 @@ modulejs.define('ext/preview-txt', ['_', '$', 'marked', 'prism', 'core/settings'
|
|||
onEnter(matchedEntries, _.indexOf(matchedEntries, item));
|
||||
});
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
onLocationChanged = function (item) {
|
||||
function onLocationChanged(item) {
|
||||
|
||||
_.each(item.content, initItem);
|
||||
},
|
||||
}
|
||||
|
||||
onLocationRefreshed = function (item, added, removed) {
|
||||
function onLocationRefreshed(item, added, removed) {
|
||||
|
||||
_.each(added, initItem);
|
||||
},
|
||||
}
|
||||
|
||||
init = function () {
|
||||
function init() {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
|
@ -132,7 +131,8 @@ modulejs.define('ext/preview-txt', ['_', '$', 'marked', 'prism', 'core/settings'
|
|||
|
||||
event.sub('location.changed', onLocationChanged);
|
||||
event.sub('location.refreshed', onLocationRefreshed);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
init();
|
||||
});
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
|
||||
modulejs.define('ext/preview-vid', ['_', '$', 'core/settings', 'core/event', 'ext/preview'], function (_, $, allsettings, event, preview) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false,
|
||||
types: []
|
||||
}, allsettings['preview-vid']),
|
||||
}, allsettings['preview-vid']);
|
||||
|
||||
preloadVid = function (src, callback) {
|
||||
|
||||
function preloadVid(src, callback) {
|
||||
|
||||
var $video = $('<video/>')
|
||||
.one('loadedmetadata', function () {
|
||||
|
@ -17,15 +17,15 @@ modulejs.define('ext/preview-vid', ['_', '$', 'core/settings', 'core/event', 'ex
|
|||
.attr('autoplay', 'autoplay')
|
||||
.attr('controls', 'controls')
|
||||
.attr('src', src);
|
||||
},
|
||||
}
|
||||
|
||||
onEnter = function (items, idx) {
|
||||
function onEnter(items, idx) {
|
||||
|
||||
var currentItems = items,
|
||||
currentIdx = idx,
|
||||
currentItem = items[idx],
|
||||
var currentItems = items;
|
||||
var currentIdx = idx;
|
||||
var currentItem = items[idx];
|
||||
|
||||
onAdjustSize = function () {
|
||||
function onAdjustSize() {
|
||||
|
||||
var $content = $('#pv-content'),
|
||||
$vid = $('#pv-vid-video');
|
||||
|
@ -43,9 +43,9 @@ modulejs.define('ext/preview-vid', ['_', '$', 'core/settings', 'core/event', 'ex
|
|||
'' + (100 * $vid.width() / $vid[0].videoWidth).toFixed(0) + '%'
|
||||
]);
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
onIdxChange = function (rel) {
|
||||
function onIdxChange(rel) {
|
||||
|
||||
currentIdx = (currentIdx + rel + currentItems.length) % currentItems.length;
|
||||
currentItem = currentItems[currentIdx];
|
||||
|
@ -73,15 +73,15 @@ modulejs.define('ext/preview-vid', ['_', '$', 'core/settings', 'core/event', 'ex
|
|||
}, 10);
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
onIdxChange(0);
|
||||
preview.setOnIndexChange(onIdxChange);
|
||||
preview.setOnAdjustSize(onAdjustSize);
|
||||
preview.enter();
|
||||
},
|
||||
}
|
||||
|
||||
initItem = function (item) {
|
||||
function initItem(item) {
|
||||
|
||||
if (item.$view && _.indexOf(settings.types, item.type) >= 0) {
|
||||
item.$view.find('a').on('click', function (event) {
|
||||
|
@ -97,19 +97,19 @@ modulejs.define('ext/preview-vid', ['_', '$', 'core/settings', 'core/event', 'ex
|
|||
onEnter(matchedEntries, _.indexOf(matchedEntries, item));
|
||||
});
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
onLocationChanged = function (item) {
|
||||
function onLocationChanged(item) {
|
||||
|
||||
_.each(item.content, initItem);
|
||||
},
|
||||
}
|
||||
|
||||
onLocationRefreshed = function (item, added, removed) {
|
||||
function onLocationRefreshed(item, added, removed) {
|
||||
|
||||
_.each(added, initItem);
|
||||
},
|
||||
}
|
||||
|
||||
init = function () {
|
||||
function init() {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
|
@ -117,7 +117,8 @@ modulejs.define('ext/preview-vid', ['_', '$', 'core/settings', 'core/event', 'ex
|
|||
|
||||
event.sub('location.changed', onLocationChanged);
|
||||
event.sub('location.refreshed', onLocationRefreshed);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
init();
|
||||
});
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
|
||||
modulejs.define('ext/preview', ['_', '$', 'core/settings', 'core/resource', 'core/store'], function (_, $, allsettings, resource, store) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: true
|
||||
}, allsettings.preview),
|
||||
|
||||
template =
|
||||
}, allsettings.preview);
|
||||
var template =
|
||||
'<div id="pv-overlay" class="noSelection">' +
|
||||
'<div id="pv-content"/>' +
|
||||
'<div id="pv-spinner"><img src="' + resource.image('spinner') + '"/></div>' +
|
||||
|
@ -21,21 +19,23 @@ modulejs.define('ext/preview', ['_', '$', 'core/settings', 'core/resource', 'cor
|
|||
'<li id="pv-bar-prev" class="bar-right bar-button"><img src="' + resource.image('preview/prev') + '"/></li>' +
|
||||
'</ul>' +
|
||||
'</div>' +
|
||||
'</div>',
|
||||
'</div>';
|
||||
var storekey = 'ext/preview';
|
||||
var currentEntries = [];
|
||||
var currentIdx = 0;
|
||||
var isFullscreen = store.get(storekey) || false;
|
||||
var userAliveTimeoutId = null;
|
||||
var onIndexChange = null;
|
||||
var onAdjustSize = null;
|
||||
|
||||
storekey = 'ext/preview',
|
||||
|
||||
currentEntries = [],
|
||||
currentIdx = 0,
|
||||
isFullscreen = store.get(storekey) || false,
|
||||
function adjustSize() {
|
||||
|
||||
adjustSize = function () {
|
||||
|
||||
var rect = $(window).fracs('viewport'),
|
||||
$container = $('#pv-content'),
|
||||
$spinner = $('#pv-spinner'),
|
||||
margin = isFullscreen ? 0 : 20,
|
||||
barheight = isFullscreen ? 0 : 31;
|
||||
var rect = $(window).fracs('viewport');
|
||||
var $container = $('#pv-content');
|
||||
var $spinner = $('#pv-spinner');
|
||||
var margin = isFullscreen ? 0 : 20;
|
||||
var barheight = isFullscreen ? 0 : 31;
|
||||
|
||||
$container.css({
|
||||
width: rect.width - 2 * margin,
|
||||
|
@ -60,9 +60,9 @@ modulejs.define('ext/preview', ['_', '$', 'core/settings', 'core/resource', 'cor
|
|||
if (_.isFunction(onAdjustSize)) {
|
||||
onAdjustSize(1);
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
onEnter = function () {
|
||||
function onEnter() {
|
||||
|
||||
$('#pv-content').empty();
|
||||
setLabels([]);
|
||||
|
@ -70,33 +70,32 @@ modulejs.define('ext/preview', ['_', '$', 'core/settings', 'core/resource', 'cor
|
|||
$(window).on('keydown', onKeydown);
|
||||
|
||||
adjustSize();
|
||||
},
|
||||
}
|
||||
|
||||
onExit = function () {
|
||||
function onExit() {
|
||||
|
||||
$(window).off('keydown', onKeydown);
|
||||
$('#pv-overlay').stop(true, true).fadeOut(200, function () {
|
||||
$('#pv-content').empty();
|
||||
setLabels([]);
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
onNext = function () {
|
||||
function onNext() {
|
||||
|
||||
if (_.isFunction(onIndexChange)) {
|
||||
onIndexChange(1);
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
onPrevious = function () {
|
||||
function onPrevious() {
|
||||
|
||||
if (_.isFunction(onIndexChange)) {
|
||||
onIndexChange(-1);
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
userAliveTimeoutId = null,
|
||||
userAlive = function () {
|
||||
function userAlive() {
|
||||
|
||||
clearTimeout(userAliveTimeoutId);
|
||||
$('#pv-overlay .hof').stop(true, true).fadeIn(200);
|
||||
|
@ -107,66 +106,66 @@ modulejs.define('ext/preview', ['_', '$', 'core/settings', 'core/resource', 'cor
|
|||
$('#pv-overlay .hof').stop(true, true).fadeOut(2000);
|
||||
}, 2000);
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
onFullscreen = function () {
|
||||
function onFullscreen() {
|
||||
|
||||
isFullscreen = !isFullscreen;
|
||||
store.put(storekey, isFullscreen);
|
||||
|
||||
userAlive();
|
||||
adjustSize();
|
||||
},
|
||||
}
|
||||
|
||||
onKeydown = function (event) {
|
||||
function onKeydown(ev) {
|
||||
|
||||
var key = event.which,
|
||||
delay = 300;
|
||||
var key = ev.which;
|
||||
var delay = 300;
|
||||
|
||||
if (key === 27) { // esc
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
ev.preventDefault();
|
||||
ev.stopImmediatePropagation();
|
||||
onExit();
|
||||
} else if (key === 8 || key === 37) { // backspace, left
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
ev.preventDefault();
|
||||
ev.stopImmediatePropagation();
|
||||
$('#pv-bar-prev').addClass('hover');
|
||||
setTimeout(function () { $('#pv-bar-prev').removeClass('hover'); }, delay);
|
||||
onPrevious();
|
||||
} else if (key === 13 || key === 32 || key === 39) { // enter, space, right
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
ev.preventDefault();
|
||||
ev.stopImmediatePropagation();
|
||||
$('#pv-bar-next').addClass('hover');
|
||||
setTimeout(function () { $('#pv-bar-next').removeClass('hover'); }, delay);
|
||||
onNext();
|
||||
} else if (key === 70) { // f
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
ev.preventDefault();
|
||||
ev.stopImmediatePropagation();
|
||||
$('#pv-bar-fullscreen').addClass('hover');
|
||||
setTimeout(function () { $('#pv-bar-fullscreen').removeClass('hover'); }, delay);
|
||||
onFullscreen();
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
setIndex = function (idx, total) {
|
||||
function setIndex(idx, total) {
|
||||
|
||||
if (_.isNumber(idx)) {
|
||||
$('#pv-bar-idx').text('' + idx + (_.isNumber(total) ? '/' + total : '')).show();
|
||||
} else {
|
||||
$('#pv-bar-idx').text('').hide();
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
setRawLink = function (href) {
|
||||
function setRawLink(href) {
|
||||
|
||||
if (href) {
|
||||
$('#pv-bar-raw').find('a').attr('href', href).end().show();
|
||||
} else {
|
||||
$('#pv-bar-raw').find('a').attr('href', '#').end().hide();
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
setLabels = function (labels) {
|
||||
function setLabels(labels) {
|
||||
|
||||
$('#pv-buttons .bar-left').remove();
|
||||
_.each(labels, function (label) {
|
||||
|
@ -176,21 +175,19 @@ modulejs.define('ext/preview', ['_', '$', 'core/settings', 'core/resource', 'cor
|
|||
.text(label)
|
||||
.appendTo('#pv-buttons');
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
onIndexChange = null,
|
||||
setOnIndexChange = function (fn) {
|
||||
function setOnIndexChange(fn) {
|
||||
|
||||
onIndexChange = fn;
|
||||
},
|
||||
}
|
||||
|
||||
onAdjustSize = null,
|
||||
setOnAdjustSize = function (fn) {
|
||||
function setOnAdjustSize(fn) {
|
||||
|
||||
onAdjustSize = fn;
|
||||
},
|
||||
}
|
||||
|
||||
showSpinner = function (show, millis) {
|
||||
function showSpinner(show, millis) {
|
||||
|
||||
if (!_.isNumber(millis)) {
|
||||
millis = 400;
|
||||
|
@ -201,9 +198,9 @@ modulejs.define('ext/preview', ['_', '$', 'core/settings', 'core/resource', 'cor
|
|||
} else {
|
||||
$('#pv-spinner').stop(true, true).fadeOut(millis);
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
init = function () {
|
||||
function init() {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
|
@ -220,18 +217,19 @@ modulejs.define('ext/preview', ['_', '$', 'core/settings', 'core/resource', 'cor
|
|||
$('#pv-overlay')
|
||||
.on('keydown', onKeydown)
|
||||
.on('mousemove mousedown', userAlive)
|
||||
.on('click mousedown mousemove keydown keypress', function (event) {
|
||||
.on('click mousedown mousemove keydown keypress', function (ev) {
|
||||
|
||||
if (event.type === 'click') {
|
||||
if (event.target.id === 'pv-overlay' || event.target.id === 'pv-content') {
|
||||
if (ev.type === 'click') {
|
||||
if (ev.target.id === 'pv-overlay' || ev.target.id === 'pv-content') {
|
||||
onExit();
|
||||
}
|
||||
}
|
||||
event.stopImmediatePropagation();
|
||||
ev.stopImmediatePropagation();
|
||||
});
|
||||
|
||||
$(window).on('resize load', adjustSize);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
init();
|
||||
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
|
||||
modulejs.define('ext/qrcode', ['_', '$', 'modernizr', 'core/settings', 'core/event'], function (_, $, modernizr, allsettings, event) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false,
|
||||
size: 150
|
||||
}, allsettings.qrcode),
|
||||
}, allsettings.qrcode);
|
||||
var template = '<div id="qrcode"/>';
|
||||
var $qrcode, hideTimeoutId;
|
||||
|
||||
template = '<div id="qrcode"/>',
|
||||
|
||||
$qrcode, hideTimeoutId,
|
||||
|
||||
update = function (item) {
|
||||
function update(item) {
|
||||
|
||||
$qrcode.empty().qrcode({
|
||||
render: modernizr.canvas ? 'canvas' : 'div',
|
||||
|
@ -20,26 +18,26 @@ modulejs.define('ext/qrcode', ['_', '$', 'modernizr', 'core/settings', 'core/eve
|
|||
bgColor: '#fff',
|
||||
text: window.location.protocol + '//' + window.location.host + item.absHref
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
onMouseenter = function (item) {
|
||||
function onMouseenter(item) {
|
||||
|
||||
if (!item.isFolder()) {
|
||||
update(item);
|
||||
clearTimeout(hideTimeoutId);
|
||||
$qrcode.stop(true, true).fadeIn(400);
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
onMouseleave = function (item) {
|
||||
function onMouseleave(item) {
|
||||
|
||||
hideTimeoutId = setTimeout(function () {
|
||||
|
||||
$qrcode.stop(true, true).fadeOut(400);
|
||||
}, 200);
|
||||
},
|
||||
}
|
||||
|
||||
init = function () {
|
||||
function init() {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
|
@ -49,7 +47,7 @@ modulejs.define('ext/qrcode', ['_', '$', 'modernizr', 'core/settings', 'core/eve
|
|||
|
||||
event.sub('item.mouseenter', onMouseenter);
|
||||
event.sub('item.mouseleave', onMouseleave);
|
||||
};
|
||||
}
|
||||
|
||||
init();
|
||||
});
|
||||
|
|
|
@ -1,20 +1,18 @@
|
|||
|
||||
modulejs.define('ext/select', ['_', '$', 'core/settings', 'core/resource', 'core/event'], function (_, $, allsettings, resource, event) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false,
|
||||
checkboxes: false
|
||||
}, allsettings.select),
|
||||
}, allsettings.select);
|
||||
var template = '<span class="selector"><img src="' + resource.image('selected') + '" alt="selected"/></span>';
|
||||
var x = 0, y = 0;
|
||||
var l = 0, t = 0, w = 0, h = 0;
|
||||
var shrink = 1/3;
|
||||
var $document = $(document);
|
||||
var $selectionRect = $('<div id="selection-rect"/>');
|
||||
|
||||
template = '<span class="selector"><img src="' + resource.image('selected') + '" alt="selected"/></span>',
|
||||
|
||||
x = 0, y = 0,
|
||||
l = 0, t = 0, w = 0, h = 0,
|
||||
shrink = 1/3,
|
||||
$document = $(document),
|
||||
$selectionRect = $('<div id="selection-rect"/>'),
|
||||
|
||||
publish = function () {
|
||||
function publish() {
|
||||
|
||||
var items = _.map($('#items .item.selected'), function (itemElement) {
|
||||
|
||||
|
@ -22,9 +20,9 @@ modulejs.define('ext/select', ['_', '$', 'core/settings', 'core/resource', 'core
|
|||
});
|
||||
|
||||
event.pub('selection', items);
|
||||
},
|
||||
}
|
||||
|
||||
selectionUpdate = function (event) {
|
||||
function selectionUpdate(event) {
|
||||
|
||||
l = Math.min(x, event.pageX);
|
||||
t = Math.min(y, event.pageY);
|
||||
|
@ -40,16 +38,17 @@ modulejs.define('ext/select', ['_', '$', 'core/settings', 'core/resource', 'core
|
|||
var selRect = $selectionRect.fracs('rect');
|
||||
$('#items .item').removeClass('selecting').each(function () {
|
||||
|
||||
var $item = $(this),
|
||||
rect = $item.find('a').fracs('rect'),
|
||||
inter = selRect.intersection(rect);
|
||||
var $item = $(this);
|
||||
var rect = $item.find('a').fracs('rect');
|
||||
var inter = selRect.intersection(rect);
|
||||
|
||||
if (inter && !$item.hasClass('folder-parent')) {
|
||||
$item.addClass('selecting');
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
selectionEnd = function (event) {
|
||||
function selectionEnd(event) {
|
||||
|
||||
event.preventDefault();
|
||||
$document.off('mousemove', selectionUpdate);
|
||||
|
@ -72,13 +71,13 @@ modulejs.define('ext/select', ['_', '$', 'core/settings', 'core/resource', 'core
|
|||
$selectionRect.hide();
|
||||
}
|
||||
);
|
||||
},
|
||||
}
|
||||
|
||||
selectionStart = function (event) {
|
||||
function selectionStart(event) {
|
||||
|
||||
var $window = $(window),
|
||||
viewRight = $window.scrollLeft() + $window.width(),
|
||||
viewBottom = $window.scrollTop() + $window.height();
|
||||
var $window = $(window);
|
||||
var viewRight = $window.scrollLeft() + $window.width();
|
||||
var viewBottom = $window.scrollTop() + $window.height();
|
||||
|
||||
x = event.pageX;
|
||||
y = event.pageY;
|
||||
|
@ -99,25 +98,24 @@ modulejs.define('ext/select', ['_', '$', 'core/settings', 'core/resource', 'core
|
|||
.one('mouseup', selectionEnd);
|
||||
|
||||
selectionUpdate(event);
|
||||
},
|
||||
}
|
||||
|
||||
noSelection = function (event) {
|
||||
function noSelection(event) {
|
||||
|
||||
event.stopImmediatePropagation();
|
||||
return false;
|
||||
},
|
||||
}
|
||||
|
||||
noSelectionUnlessCtrl = function (event) {
|
||||
function noSelectionUnlessCtrl(event) {
|
||||
|
||||
if (!event.ctrlKey && !event.metaKey) {
|
||||
noSelection(event);
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
initItem = function (item) {
|
||||
function initItem(item) {
|
||||
|
||||
if (item.$view) {
|
||||
|
||||
$(template)
|
||||
.appendTo(item.$view.find('a'))
|
||||
.on('click', function (event) {
|
||||
|
@ -129,17 +127,17 @@ modulejs.define('ext/select', ['_', '$', 'core/settings', 'core/resource', 'core
|
|||
publish();
|
||||
});
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
onLocationChanged = function (item) {
|
||||
function onLocationChanged(item) {
|
||||
|
||||
if (settings.checkboxes) {
|
||||
_.each(item.content, initItem);
|
||||
}
|
||||
publish();
|
||||
},
|
||||
}
|
||||
|
||||
onLocationRefreshed = function (item, added, removed) {
|
||||
function onLocationRefreshed(item, added, removed) {
|
||||
|
||||
var selectionChanged = false;
|
||||
|
||||
|
@ -157,9 +155,9 @@ modulejs.define('ext/select', ['_', '$', 'core/settings', 'core/resource', 'core
|
|||
if (selectionChanged) {
|
||||
publish();
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
init = function () {
|
||||
function init() {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
|
@ -174,7 +172,8 @@ modulejs.define('ext/select', ['_', '$', 'core/settings', 'core/resource', 'core
|
|||
.on('mousedown', '.noSelection', noSelection)
|
||||
.on('mousedown', '.noSelectionUnlessCtrl,input,select,a', noSelectionUnlessCtrl)
|
||||
.on('mousedown', selectionStart);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
init();
|
||||
});
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
modulejs.define('ext/sort', ['_', '$', 'core/settings', 'core/resource', 'core/event', 'core/store'], function (_, $, allsettings, resource, event, store) {
|
||||
|
||||
var settings = _.extend({
|
||||
|
@ -8,14 +7,14 @@ modulejs.define('ext/sort', ['_', '$', 'core/settings', 'core/resource', 'core/e
|
|||
ignorecase: true,
|
||||
natural: false,
|
||||
folders: 0
|
||||
}, allsettings.sort),
|
||||
|
||||
storekey = 'ext/sort',
|
||||
template =
|
||||
}, allsettings.sort);
|
||||
var storekey = 'ext/sort';
|
||||
var template =
|
||||
'<img src="' + resource.image('ascending') + '" class="sort ascending" alt="ascending" />' +
|
||||
'<img src="' + resource.image('descending') + '" class="sort descending" alt="descending" />',
|
||||
'<img src="' + resource.image('descending') + '" class="sort descending" alt="descending" />';
|
||||
|
||||
getType = function (item) {
|
||||
|
||||
function getType(item) {
|
||||
|
||||
var $item = $(item);
|
||||
|
||||
|
@ -31,56 +30,57 @@ modulejs.define('ext/sort', ['_', '$', 'core/settings', 'core/resource', 'core/e
|
|||
return 1;
|
||||
}
|
||||
return 2;
|
||||
},
|
||||
}
|
||||
|
||||
getName = function (item) {
|
||||
function getName(item) {
|
||||
|
||||
return $(item).find('.label').text();
|
||||
},
|
||||
}
|
||||
|
||||
getTime = function (item) {
|
||||
function getTime(item) {
|
||||
|
||||
return $(item).find('.date').data('time');
|
||||
},
|
||||
}
|
||||
|
||||
getSize = function (item) {
|
||||
function getSize(item) {
|
||||
|
||||
return $(item).find('.size').data('bytes');
|
||||
},
|
||||
}
|
||||
|
||||
columnGetters = {
|
||||
|
||||
var columnGetters = {
|
||||
0: getName,
|
||||
1: getTime,
|
||||
2: getSize
|
||||
},
|
||||
|
||||
columnClasses = {
|
||||
};
|
||||
var columnClasses = {
|
||||
0: 'label',
|
||||
1: 'date',
|
||||
2: 'size'
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
// Natural Sort algorithm for Javascript - Version 0.7 - Released under MIT license
|
||||
// Author: Jim Palmer (based on chunking idea from Dave Koelle)
|
||||
//
|
||||
// Modified to make it work with h5ai
|
||||
naturalCmpFn = function (val1, val2) {
|
||||
function naturalCmpFn(val1, val2) {
|
||||
|
||||
var re = /(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/gi,
|
||||
sre = /(^[ ]*|[ ]*$)/g,
|
||||
dre = /(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,
|
||||
hre = /^0x[0-9a-f]+$/i,
|
||||
ore = /^0/,
|
||||
var re = /(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/gi;
|
||||
var sre = /(^[ ]*|[ ]*$)/g;
|
||||
var dre = /(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/;
|
||||
var hre = /^0x[0-9a-f]+$/i;
|
||||
var ore = /^0/;
|
||||
// convert all to strings strip whitespace
|
||||
x = ('' + val1).replace(sre, ''),
|
||||
y = ('' + val2).replace(sre, ''),
|
||||
var x = ('' + val1).replace(sre, '');
|
||||
var y = ('' + val2).replace(sre, '');
|
||||
// chunk/tokenize
|
||||
xN = x.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0'),
|
||||
yN = y.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0'),
|
||||
var xN = x.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0');
|
||||
var yN = y.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0');
|
||||
// numeric, hex or date detection
|
||||
xD = parseInt(x.match(hre), 10) || (xN.length !== 1 && x.match(dre) && Date.parse(x)),
|
||||
yD = parseInt(y.match(hre), 10) || xD && y.match(dre) && Date.parse(y) || null,
|
||||
oFxNcL, oFyNcL;
|
||||
var xD = parseInt(x.match(hre), 10) || (xN.length !== 1 && x.match(dre) && Date.parse(x));
|
||||
var yD = parseInt(y.match(hre), 10) || xD && y.match(dre) && Date.parse(y) || null;
|
||||
var oFxNcL, oFyNcL;
|
||||
// first try and sort Hex codes or Dates
|
||||
if (yD) {
|
||||
if (xD < yD) {
|
||||
|
@ -109,9 +109,9 @@ modulejs.define('ext/sort', ['_', '$', 'core/settings', 'core/resource', 'core/e
|
|||
}
|
||||
}
|
||||
return 0;
|
||||
},
|
||||
}
|
||||
|
||||
cmpFn = function (getValue, reverse, ignorecase, natural) {
|
||||
function cmpFn(getValue, reverse, ignorecase, natural) {
|
||||
|
||||
return function (item1, item2) {
|
||||
|
||||
|
@ -143,17 +143,15 @@ modulejs.define('ext/sort', ['_', '$', 'core/settings', 'core/resource', 'core/e
|
|||
|
||||
return reverse ? -res : res;
|
||||
};
|
||||
},
|
||||
}
|
||||
|
||||
sortItems = function (column, reverse) {
|
||||
function sortItems(column, reverse) {
|
||||
|
||||
var headers = $('#items li.header a'),
|
||||
header = $('#items li.header a.' + columnClasses[column]),
|
||||
|
||||
fn = cmpFn(columnGetters[column], reverse, settings.ignorecase, column === 0 && settings.natural),
|
||||
|
||||
current = $('#items .item'),
|
||||
sorted = $('#items .item').sort(fn);
|
||||
var headers = $('#items li.header a');
|
||||
var header = $('#items li.header a.' + columnClasses[column]);
|
||||
var fn = cmpFn(columnGetters[column], reverse, settings.ignorecase, column === 0 && settings.natural);
|
||||
var current = $('#items .item');
|
||||
var sorted = $('#items .item').sort(fn);
|
||||
|
||||
store.put(storekey, {column: column, reverse: reverse});
|
||||
|
||||
|
@ -166,18 +164,18 @@ modulejs.define('ext/sort', ['_', '$', 'core/settings', 'core/resource', 'core/e
|
|||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
onContentChanged = function (item) {
|
||||
function onContentChanged(item) {
|
||||
|
||||
var order = store.get(storekey),
|
||||
column = order && order.column || settings.column,
|
||||
reverse = order && order.reverse || settings.reverse;
|
||||
var order = store.get(storekey);
|
||||
var column = order && order.column || settings.column;
|
||||
var reverse = order && order.reverse || settings.reverse;
|
||||
|
||||
sortItems(column, reverse);
|
||||
},
|
||||
}
|
||||
|
||||
init = function () {
|
||||
function init() {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
|
@ -211,7 +209,8 @@ modulejs.define('ext/sort', ['_', '$', 'core/settings', 'core/resource', 'core/e
|
|||
|
||||
event.sub('location.changed', onContentChanged);
|
||||
event.sub('location.refreshed', onContentChanged);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
init();
|
||||
});
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
|
||||
modulejs.define('ext/statusbar', ['_', '$', 'core/settings', 'core/format', 'core/event'], function (_, $, allsettings, format, event) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false
|
||||
}, allsettings.statusbar),
|
||||
|
||||
template =
|
||||
}, allsettings.statusbar);
|
||||
var template =
|
||||
'<span class="statusbar">' +
|
||||
'<span class="status default">' +
|
||||
'<span class="folderTotal"/> <span class="l10n-folders"/>' +
|
||||
|
@ -13,13 +11,13 @@ modulejs.define('ext/statusbar', ['_', '$', 'core/settings', 'core/format', 'cor
|
|||
'<span class="fileTotal"/> <span class="l10n-files"/>' +
|
||||
'</span>' +
|
||||
'<span class="status dynamic"/>' +
|
||||
'</span>',
|
||||
sepTemplate = '<span class="sep"/>',
|
||||
'</span>';
|
||||
var sepTemplate = '<span class="sep"/>';
|
||||
var $statusDynamic;
|
||||
var $statusDefault;
|
||||
|
||||
$statusDynamic,
|
||||
$statusDefault,
|
||||
|
||||
update = function (html) {
|
||||
function update(html) {
|
||||
|
||||
if (html) {
|
||||
$statusDefault.hide();
|
||||
|
@ -28,18 +26,18 @@ modulejs.define('ext/statusbar', ['_', '$', 'core/settings', 'core/format', 'cor
|
|||
$statusDynamic.empty().hide();
|
||||
$statusDefault.show();
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
init = function () {
|
||||
function init() {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
var $statusbar = $(template),
|
||||
$folderTotal = $statusbar.find('.folderTotal'),
|
||||
$fileTotal = $statusbar.find('.fileTotal'),
|
||||
onLocationChanged = function (item) {
|
||||
var $statusbar = $(template);
|
||||
var $folderTotal = $statusbar.find('.folderTotal');
|
||||
var $fileTotal = $statusbar.find('.fileTotal');
|
||||
var onLocationChanged = function (item) {
|
||||
|
||||
var stats = item.getStats();
|
||||
$folderTotal.text(stats.folders);
|
||||
|
@ -77,7 +75,8 @@ modulejs.define('ext/statusbar', ['_', '$', 'core/settings', 'core/format', 'cor
|
|||
|
||||
update();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
init();
|
||||
});
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
modulejs.define('ext/thumbnails', ['_', 'core/settings', 'core/event', 'core/server'], function (_, allsettings, event, server) {
|
||||
|
||||
var settings = _.extend({
|
||||
|
@ -8,9 +7,10 @@ modulejs.define('ext/thumbnails', ['_', 'core/settings', 'core/event', 'core/ser
|
|||
doc: ['pdf', 'ps'],
|
||||
delay: 1000,
|
||||
size: 96
|
||||
}, allsettings.thumbnails),
|
||||
}, allsettings.thumbnails);
|
||||
|
||||
requestThumb = function (type, href, mode, ratio, callback) {
|
||||
|
||||
function requestThumb(type, href, mode, ratio, callback) {
|
||||
|
||||
server.request({
|
||||
action: 'getThumbHref',
|
||||
|
@ -23,9 +23,9 @@ modulejs.define('ext/thumbnails', ['_', 'core/settings', 'core/event', 'core/ser
|
|||
|
||||
callback(json && json.code === 0 ? json.absHref : null);
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
checkItem = function (item) {
|
||||
function checkItem(item) {
|
||||
|
||||
var type = null;
|
||||
|
||||
|
@ -61,22 +61,22 @@ modulejs.define('ext/thumbnails', ['_', 'core/settings', 'core/event', 'core/ser
|
|||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
onLocationChanged = function (item) {
|
||||
function onLocationChanged(item) {
|
||||
|
||||
setTimeout(function () {
|
||||
|
||||
_.each(item.content, checkItem);
|
||||
}, settings.delay);
|
||||
},
|
||||
}
|
||||
|
||||
onLocationRefreshed = function (item, added, removed) {
|
||||
function onLocationRefreshed(item, added, removed) {
|
||||
|
||||
_.each(added, checkItem);
|
||||
},
|
||||
}
|
||||
|
||||
init = function () {
|
||||
function init() {
|
||||
|
||||
if (!settings.enabled || !server.api) {
|
||||
return;
|
||||
|
@ -84,7 +84,8 @@ modulejs.define('ext/thumbnails', ['_', 'core/settings', 'core/event', 'core/ser
|
|||
|
||||
event.sub('location.changed', onLocationChanged);
|
||||
event.sub('location.refreshed', onLocationRefreshed);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
init();
|
||||
});
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
|
||||
modulejs.define('ext/title', ['_', 'core/settings', 'core/event'], function (_, allsettings, event) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false
|
||||
}, allsettings.title),
|
||||
}, allsettings.title);
|
||||
|
||||
onLocationChanged = function (item) {
|
||||
function onLocationChanged(item) {
|
||||
|
||||
var labels = _.pluck(item.getCrumb(), 'label'),
|
||||
title = labels.join(' > ');
|
||||
|
@ -15,16 +14,16 @@ modulejs.define('ext/title', ['_', 'core/settings', 'core/event'], function (_,
|
|||
}
|
||||
|
||||
document.title = title;
|
||||
},
|
||||
}
|
||||
|
||||
init = function () {
|
||||
function init() {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.sub('location.changed', onLocationChanged);
|
||||
};
|
||||
}
|
||||
|
||||
init();
|
||||
});
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
|
||||
modulejs.define('ext/tree', ['_', '$', 'core/settings', 'core/resource', 'core/event', 'core/location'], function (_, $, allsettings, resource, event, location) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false,
|
||||
slide: true,
|
||||
maxSubfolders: 50
|
||||
}, allsettings.tree),
|
||||
|
||||
template =
|
||||
}, allsettings.tree);
|
||||
var template =
|
||||
'<div class="item">' +
|
||||
'<span class="indicator none">' +
|
||||
'<img src="' + resource.image('tree') + '"/>' +
|
||||
|
@ -16,16 +14,17 @@ modulejs.define('ext/tree', ['_', '$', 'core/settings', 'core/resource', 'core/e
|
|||
'<span class="icon"><img/></span>' +
|
||||
'<span class="label"/>' +
|
||||
'</a>' +
|
||||
'</span>',
|
||||
statusHintTemplate = '<span class="hint"/>',
|
||||
'</span>';
|
||||
var statusHintTemplate = '<span class="hint"/>';
|
||||
|
||||
update = function (item) {
|
||||
|
||||
var $html = $(template),
|
||||
$indicator = $html.find('.indicator'),
|
||||
$a = $html.find('a'),
|
||||
$img = $html.find('.icon img'),
|
||||
$label = $html.find('.label');
|
||||
function update(item) {
|
||||
|
||||
var $html = $(template);
|
||||
var $indicator = $html.find('.indicator');
|
||||
var $a = $html.find('a');
|
||||
var $img = $html.find('.icon img');
|
||||
var $label = $html.find('.label');
|
||||
|
||||
$html
|
||||
.addClass(item.isFolder() ? 'folder' : 'file')
|
||||
|
@ -102,12 +101,13 @@ modulejs.define('ext/tree', ['_', '$', 'core/settings', 'core/resource', 'core/e
|
|||
item.$tree = $html;
|
||||
|
||||
return $html;
|
||||
},
|
||||
}
|
||||
|
||||
createOnIndicatorClick = function () {
|
||||
function createOnIndicatorClick() {
|
||||
|
||||
var $tree = $('#tree'),
|
||||
slide = function (item, $indicator, $content, down) {
|
||||
var $tree = $('#tree');
|
||||
|
||||
function slide(item, $indicator, $content, down) {
|
||||
|
||||
item.isContentVisible = down;
|
||||
$indicator.removeClass('open close').addClass(down ? 'open' : 'close');
|
||||
|
@ -116,14 +116,14 @@ modulejs.define('ext/tree', ['_', '$', 'core/settings', 'core/resource', 'core/e
|
|||
|
||||
$tree.scrollpanel('update');
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
return function () {
|
||||
|
||||
var $indicator = $(this),
|
||||
$item = $indicator.closest('.item'),
|
||||
item = $item.data('item'),
|
||||
$content = $item.find('> ul.content');
|
||||
var $indicator = $(this);
|
||||
var $item = $indicator.closest('.item');
|
||||
var item = $item.data('item');
|
||||
var $content = $item.find('> ul.content');
|
||||
|
||||
if ($indicator.hasClass('unknown')) {
|
||||
|
||||
|
@ -131,9 +131,9 @@ modulejs.define('ext/tree', ['_', '$', 'core/settings', 'core/resource', 'core/e
|
|||
|
||||
item.isContentVisible = false;
|
||||
|
||||
var $item = update(item),
|
||||
$indicator = $item.find('> .indicator'),
|
||||
$content = $item.find('> ul.content');
|
||||
var $item = update(item);
|
||||
var $indicator = $item.find('> .indicator');
|
||||
var $content = $item.find('> ul.content');
|
||||
|
||||
if (!$indicator.hasClass('none')) {
|
||||
slide(item, $indicator, $content, true);
|
||||
|
@ -149,22 +149,22 @@ modulejs.define('ext/tree', ['_', '$', 'core/settings', 'core/resource', 'core/e
|
|||
slide(item, $indicator, $content, true);
|
||||
}
|
||||
};
|
||||
},
|
||||
}
|
||||
|
||||
shiftTree = function (forceVisible, dontAnimate) {
|
||||
function shiftTree(forceVisible, dontAnimate) {
|
||||
|
||||
var $tree = $("#tree"),
|
||||
$view = $("#view"),
|
||||
left = ((settings.slide && $tree.outerWidth() < $view.offset().left) || forceVisible || !$view.is(':visible')) ? 0 : 18 - $tree.outerWidth();
|
||||
var $tree = $("#tree");
|
||||
var $view = $("#view");
|
||||
var left = ((settings.slide && $tree.outerWidth() < $view.offset().left) || forceVisible || !$view.is(':visible')) ? 0 : 18 - $tree.outerWidth();
|
||||
|
||||
if (dontAnimate) {
|
||||
$tree.stop().css({ left: left });
|
||||
} else {
|
||||
$tree.stop().animate({ left: left });
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
fetchTree = function (item, callback) {
|
||||
function fetchTree(item, callback) {
|
||||
|
||||
item.isContentVisible = true;
|
||||
item.fetchContent(function (item) {
|
||||
|
@ -175,14 +175,14 @@ modulejs.define('ext/tree', ['_', '$', 'core/settings', 'core/resource', 'core/e
|
|||
callback(item);
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
adjustSpacing = function () {
|
||||
function adjustSpacing() {
|
||||
|
||||
var $tree = $('#tree'),
|
||||
winHeight = $(window).height(),
|
||||
navHeight = $('#topbar').outerHeight(),
|
||||
footerHeight = $('#bottombar').outerHeight();
|
||||
var $tree = $('#tree');
|
||||
var winHeight = $(window).height();
|
||||
var navHeight = $('#topbar').outerHeight();
|
||||
var footerHeight = $('#bottombar').outerHeight();
|
||||
|
||||
$tree.css({
|
||||
top: navHeight,
|
||||
|
@ -190,9 +190,9 @@ modulejs.define('ext/tree', ['_', '$', 'core/settings', 'core/resource', 'core/e
|
|||
});
|
||||
|
||||
$tree.scrollpanel('update');
|
||||
},
|
||||
}
|
||||
|
||||
onLocationChanged = function (item) {
|
||||
function onLocationChanged(item) {
|
||||
|
||||
fetchTree(item, function (root) {
|
||||
|
||||
|
@ -202,9 +202,9 @@ modulejs.define('ext/tree', ['_', '$', 'core/settings', 'core/resource', 'core/e
|
|||
adjustSpacing();
|
||||
shiftTree(false, true);
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
init = function () {
|
||||
function init() {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
|
@ -231,7 +231,8 @@ modulejs.define('ext/tree', ['_', '$', 'core/settings', 'core/resource', 'core/e
|
|||
adjustSpacing();
|
||||
shiftTree();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
init();
|
||||
});
|
||||
|
|
|
@ -1,19 +1,16 @@
|
|||
|
||||
modulejs.define('info', ['$', 'config'], function ($, config) {
|
||||
|
||||
var testsTemp =
|
||||
'<div id="tests-wrapper">' +
|
||||
'<ul id="tests">' +
|
||||
'</div>',
|
||||
|
||||
testTemp =
|
||||
'</div>';
|
||||
var testTemp =
|
||||
'<li class="test">' +
|
||||
'<span class="label"></span>' +
|
||||
'<span class="result"></span>' +
|
||||
'<div class="info"></div>' +
|
||||
'</li>',
|
||||
|
||||
loginTemp =
|
||||
'</li>';
|
||||
var loginTemp =
|
||||
'<div id="login-wrapper">' +
|
||||
'<input id="pass" type="password" placeholder="password"/>' +
|
||||
'<span id="login">login</span>' +
|
||||
|
@ -22,13 +19,11 @@ modulejs.define('info', ['$', 'config'], function ($, config) {
|
|||
'The preset password is the empty string, so just hit login. ' +
|
||||
'You might change it in the index file to keep this information private.' +
|
||||
'</div>' +
|
||||
'</div>',
|
||||
'</div>';
|
||||
var setup = config.setup;
|
||||
|
||||
setup = config.setup,
|
||||
|
||||
addTests = function () {
|
||||
|
||||
var addTest = function (label, info, passed, result) {
|
||||
function addTest(label, info, passed, result) {
|
||||
|
||||
$(testTemp)
|
||||
.find('.label')
|
||||
|
@ -42,7 +37,9 @@ modulejs.define('info', ['$', 'config'], function ($, config) {
|
|||
.html(info)
|
||||
.end()
|
||||
.appendTo('#tests');
|
||||
};
|
||||
}
|
||||
|
||||
function addTests() {
|
||||
|
||||
$(testsTemp).appendTo('body');
|
||||
|
||||
|
@ -110,11 +107,9 @@ modulejs.define('info', ['$', 'config'], function ($, config) {
|
|||
'Shell du', 'Command line program <code>du</code> available',
|
||||
setup.HAS_CMD_DU
|
||||
);
|
||||
},
|
||||
}
|
||||
|
||||
addLogin = function () {
|
||||
|
||||
var request = function (data) {
|
||||
function request(data) {
|
||||
|
||||
$.ajax({
|
||||
url: 'server/php/index.php',
|
||||
|
@ -126,29 +121,32 @@ modulejs.define('info', ['$', 'config'], function ($, config) {
|
|||
|
||||
window.location.reload();
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
onLogin = function () {
|
||||
function onLogin() {
|
||||
|
||||
request({
|
||||
'action': 'login',
|
||||
'pass': $('#pass').val()
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
onLogout = function () {
|
||||
function onLogout() {
|
||||
|
||||
request({
|
||||
'action': 'logout'
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
onKeydown = function (event) {
|
||||
function onKeydown(event) {
|
||||
|
||||
if (event.which === 13) {
|
||||
onLogin();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function addLogin() {
|
||||
|
||||
|
||||
$(loginTemp).appendTo('body');
|
||||
|
||||
|
@ -164,15 +162,16 @@ modulejs.define('info', ['$', 'config'], function ($, config) {
|
|||
if (setup.HAS_CUSTOM_PASSHASH) {
|
||||
$('#hint').remove();
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
init = function () {
|
||||
function init() {
|
||||
|
||||
addLogin();
|
||||
if (setup.AS_ADMIN) {
|
||||
addTests();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
init();
|
||||
});
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
modulejs.define('main', ['_', 'core/event'], function (_, event) {
|
||||
|
||||
modulejs.require('view/ensure');
|
||||
|
|
|
@ -1,26 +1,23 @@
|
|||
|
||||
modulejs.define('model/item', ['_', 'core/types', 'core/event', 'core/settings', 'core/server', 'core/location'], function (_, types, event, settings, server, location) {
|
||||
|
||||
var reEndsWithSlash = /\/$/;
|
||||
var reSplitPath = /^(.*\/)([^\/]+\/?)$/;
|
||||
var cache = {};
|
||||
|
||||
var reEndsWithSlash = /\/$/,
|
||||
|
||||
startsWith = function (sequence, part) {
|
||||
function startsWith(sequence, part) {
|
||||
|
||||
return sequence.slice && part.length && sequence.slice(0, part.length) === part;
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
createLabel = function (sequence) {
|
||||
function createLabel(sequence) {
|
||||
|
||||
sequence = sequence.replace(reEndsWithSlash, '');
|
||||
try { sequence = decodeURIComponent(sequence); } catch (e) {}
|
||||
return sequence;
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
reSplitPath = /^(.*\/)([^\/]+\/?)$/,
|
||||
|
||||
splitPath = function (sequence) {
|
||||
function splitPath(sequence) {
|
||||
|
||||
if (sequence === '/') {
|
||||
return { parent: null, name: '/' };
|
||||
|
@ -35,13 +32,9 @@ modulejs.define('model/item', ['_', 'core/types', 'core/event', 'core/settings',
|
|||
}
|
||||
return split;
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
||||
cache = {},
|
||||
|
||||
getItem = function (absHref, time, size, isManaged, isContentFetched, md5, sha1) {
|
||||
function getItem(absHref, time, size, isManaged, isContentFetched, md5, sha1) {
|
||||
|
||||
absHref = location.forceEncoding(absHref);
|
||||
|
||||
|
@ -71,9 +64,9 @@ modulejs.define('model/item', ['_', 'core/types', 'core/event', 'core/settings',
|
|||
}
|
||||
|
||||
return self;
|
||||
},
|
||||
}
|
||||
|
||||
removeItem = function (absHref) {
|
||||
function removeItem(absHref) {
|
||||
|
||||
absHref = location.forceEncoding(absHref);
|
||||
|
||||
|
@ -89,9 +82,9 @@ modulejs.define('model/item', ['_', 'core/types', 'core/event', 'core/settings',
|
|||
removeItem(item.absHref);
|
||||
});
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
fetchContent = function (absHref, callback) {
|
||||
function fetchContent(absHref, callback) {
|
||||
|
||||
var self = getItem(absHref);
|
||||
|
||||
|
@ -113,11 +106,10 @@ modulejs.define('model/item', ['_', 'core/types', 'core/event', 'core/settings',
|
|||
callback(self);
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
var Item = function (absHref) {
|
||||
function Item(absHref) {
|
||||
|
||||
var split = splitPath(absHref);
|
||||
|
||||
|
@ -139,7 +131,7 @@ modulejs.define('model/item', ['_', 'core/types', 'core/event', 'core/settings',
|
|||
this.parent.isContentFetched = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
_.extend(Item.prototype, {
|
||||
|
||||
|
@ -190,8 +182,8 @@ modulejs.define('model/item', ['_', 'core/types', 'core/event', 'core/settings',
|
|||
|
||||
getCrumb: function () {
|
||||
|
||||
var item = this,
|
||||
crumb = [item];
|
||||
var item = this;
|
||||
var crumb = [item];
|
||||
|
||||
while (item.parent) {
|
||||
item = item.parent;
|
||||
|
@ -214,8 +206,8 @@ modulejs.define('model/item', ['_', 'core/types', 'core/event', 'core/settings',
|
|||
|
||||
getStats: function () {
|
||||
|
||||
var folders = 0,
|
||||
files = 0;
|
||||
var folders = 0;
|
||||
var files = 0;
|
||||
|
||||
_.each(this.content, function (item) {
|
||||
|
||||
|
@ -226,8 +218,8 @@ modulejs.define('model/item', ['_', 'core/types', 'core/event', 'core/settings',
|
|||
}
|
||||
});
|
||||
|
||||
var depth = 0,
|
||||
item = this;
|
||||
var depth = 0;
|
||||
var item = this;
|
||||
|
||||
while (item.parent) {
|
||||
depth += 1;
|
||||
|
@ -242,6 +234,7 @@ modulejs.define('model/item', ['_', 'core/types', 'core/event', 'core/settings',
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
return {
|
||||
get: getItem,
|
||||
remove: removeItem
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
|
||||
modulejs.define('view/ensure', ['$', 'config', 'core/event'], function ($, config, event) {
|
||||
|
||||
var selb = '#bottombar',
|
||||
selr = selb + ' .right',
|
||||
sela = selr + ' a',
|
||||
sequence = 'powered by h5ai ' + config.setup.VERSION,
|
||||
url = 'http://larsjung.de/h5ai/',
|
||||
isVisible = ':visible',
|
||||
styleKey = 'style',
|
||||
styleVal = 'display: inline !important',
|
||||
var selb = '#bottombar';
|
||||
var selr = selb + ' .right';
|
||||
var sela = selr + ' a';
|
||||
var sequence = 'powered by h5ai ' + config.setup.VERSION;
|
||||
var url = 'http://larsjung.de/h5ai/';
|
||||
var isVisible = ':visible';
|
||||
var styleKey = 'style';
|
||||
var styleVal = 'display: inline !important';
|
||||
|
||||
ensure = function () {
|
||||
|
||||
function ensure() {
|
||||
|
||||
if (
|
||||
$(selr).text() !== sequence ||
|
||||
|
@ -35,16 +35,17 @@ modulejs.define('view/ensure', ['$', 'config', 'core/event'], function ($, confi
|
|||
.end()
|
||||
.prependTo(selb);
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
init = function () {
|
||||
function init() {
|
||||
|
||||
event.sub('ready', function () {
|
||||
|
||||
ensure();
|
||||
setInterval(ensure, 60000);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
init();
|
||||
});
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
modulejs.define('view/items', ['_', '$', 'core/settings', 'core/resource', 'core/format', 'core/event', 'core/location'], function (_, $, allsettings, resource, format, event, location) {
|
||||
|
||||
var settings = _.extend({
|
||||
|
@ -6,9 +5,8 @@ modulejs.define('view/items', ['_', '$', 'core/settings', 'core/resource', 'core
|
|||
hideFolders: false,
|
||||
hideParentFolder: false,
|
||||
setParentFolderLabels: false
|
||||
}, allsettings.view),
|
||||
|
||||
itemTemplate =
|
||||
}, allsettings.view);
|
||||
var itemTemplate =
|
||||
'<li class="item">' +
|
||||
'<a>' +
|
||||
'<span class="icon square"><img/></span>' +
|
||||
|
@ -17,9 +15,9 @@ modulejs.define('view/items', ['_', '$', 'core/settings', 'core/resource', 'core
|
|||
'<span class="date"/>' +
|
||||
'<span class="size"/>' +
|
||||
'</a>' +
|
||||
'</li>',
|
||||
hintTemplate = '<span class="hint"/>',
|
||||
contentTemplate =
|
||||
'</li>';
|
||||
var hintTemplate = '<span class="hint"/>';
|
||||
var contentTemplate =
|
||||
'<div id="content">' +
|
||||
'<div id="view">' +
|
||||
'<ul id="items" class="clearfix">' +
|
||||
|
@ -32,20 +30,21 @@ modulejs.define('view/items', ['_', '$', 'core/settings', 'core/resource', 'core
|
|||
'</ul>' +
|
||||
'<div class="empty l10n-empty"/>' +
|
||||
'</div>' +
|
||||
'</div>',
|
||||
'</div>';
|
||||
|
||||
update = function (item, force) {
|
||||
|
||||
function update(item, force) {
|
||||
|
||||
if (!force && item.$view) {
|
||||
return item.$view;
|
||||
}
|
||||
|
||||
var $html = $(itemTemplate),
|
||||
$a = $html.find('a'),
|
||||
$iconImg = $html.find('.icon img'),
|
||||
$label = $html.find('.label'),
|
||||
$date = $html.find('.date'),
|
||||
$size = $html.find('.size');
|
||||
var $html = $(itemTemplate);
|
||||
var $a = $html.find('a');
|
||||
var $iconImg = $html.find('.icon img');
|
||||
var $label = $html.find('.label');
|
||||
var $date = $html.find('.date');
|
||||
var $size = $html.find('.size');
|
||||
|
||||
$html
|
||||
.addClass(item.isFolder() ? 'folder' : 'file')
|
||||
|
@ -77,24 +76,24 @@ modulejs.define('view/items', ['_', '$', 'core/settings', 'core/resource', 'core
|
|||
item.$view = $html;
|
||||
|
||||
return $html;
|
||||
},
|
||||
}
|
||||
|
||||
onMouseenter = function () {
|
||||
function onMouseenter() {
|
||||
|
||||
var item = $(this).closest('.item').data('item');
|
||||
event.pub('item.mouseenter', item);
|
||||
},
|
||||
}
|
||||
|
||||
onMouseleave = function () {
|
||||
function onMouseleave() {
|
||||
|
||||
var item = $(this).closest('.item').data('item');
|
||||
event.pub('item.mouseleave', item);
|
||||
},
|
||||
}
|
||||
|
||||
onLocationChanged = function (item) {
|
||||
function onLocationChanged(item) {
|
||||
|
||||
var $items = $('#items'),
|
||||
$empty = $('#view').find('.empty');
|
||||
var $items = $('#items');
|
||||
var $empty = $('#view').find('.empty');
|
||||
|
||||
$items.find('.item').remove();
|
||||
|
||||
|
@ -116,12 +115,12 @@ modulejs.define('view/items', ['_', '$', 'core/settings', 'core/resource', 'core
|
|||
}
|
||||
|
||||
$('html,body').scrollLeft(0).scrollTop(0);
|
||||
},
|
||||
}
|
||||
|
||||
onLocationRefreshed = function (item, added, removed) {
|
||||
function onLocationRefreshed(item, added, removed) {
|
||||
|
||||
var $items = $('#items'),
|
||||
$empty = $('#view').find('.empty');
|
||||
var $items = $('#items');
|
||||
var $empty = $('#view').find('.empty');
|
||||
|
||||
_.each(added, function (item) {
|
||||
|
||||
|
@ -142,14 +141,14 @@ modulejs.define('view/items', ['_', '$', 'core/settings', 'core/resource', 'core
|
|||
} else {
|
||||
$empty.hide();
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
init = function () {
|
||||
function init() {
|
||||
|
||||
var $content = $(contentTemplate),
|
||||
$view = $content.find('#view'),
|
||||
$items = $view.find('#items'),
|
||||
$emtpy = $view.find('.empty').hide();
|
||||
var $content = $(contentTemplate);
|
||||
var $view = $content.find('#view');
|
||||
var $items = $view.find('#items');
|
||||
var $emtpy = $view.find('.empty').hide();
|
||||
|
||||
format.setDefaultMetric(settings.binaryPrefix);
|
||||
|
||||
|
@ -161,7 +160,8 @@ modulejs.define('view/items', ['_', '$', 'core/settings', 'core/resource', 'core
|
|||
event.sub('location.refreshed', onLocationRefreshed);
|
||||
|
||||
$content.appendTo('body');
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
init();
|
||||
});
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
modulejs.define('view/spacing', ['_', '$', 'core/settings', 'core/event'], function (_, $, allsettings, event) {
|
||||
|
||||
var settings = _.extend({
|
||||
|
@ -7,17 +6,18 @@ modulejs.define('view/spacing', ['_', '$', 'core/settings', 'core/event'], funct
|
|||
right: 'auto',
|
||||
bottom: 50,
|
||||
left: 'auto'
|
||||
}, allsettings.spacing),
|
||||
}, allsettings.spacing);
|
||||
|
||||
adjustSpacing = function () {
|
||||
|
||||
function adjustSpacing() {
|
||||
|
||||
$('#content').css({
|
||||
'margin-top': settings.top + $('#topbar').outerHeight(),
|
||||
'margin-bottom': settings.bottom + $('#bottombar').outerHeight()
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
init = function () {
|
||||
function init() {
|
||||
|
||||
$('#content').css({
|
||||
'max-width': settings.maxWidth,
|
||||
|
@ -27,7 +27,8 @@ modulejs.define('view/spacing', ['_', '$', 'core/settings', 'core/event'], funct
|
|||
|
||||
event.sub('ready', adjustSpacing);
|
||||
$(window).on('resize', adjustSpacing);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
init();
|
||||
});
|
||||
|
|
|
@ -1,47 +1,42 @@
|
|||
|
||||
modulejs.define('view/viewmode', ['_', '$', 'core/settings', 'core/resource', 'core/store', 'core/event'], function (_, $, allsettings, resource, store, event) {
|
||||
|
||||
var modes = ['details', 'grid', 'icons'],
|
||||
sizes = [16, 24, 32, 48, 64, 96, 128, 192, 256, 384],
|
||||
|
||||
settings = _.extend({}, {
|
||||
var modes = ['details', 'grid', 'icons'];
|
||||
var sizes = [16, 24, 32, 48, 64, 96, 128, 192, 256, 384];
|
||||
var settings = _.extend({}, {
|
||||
modes: modes,
|
||||
sizes: sizes
|
||||
}, allsettings.view),
|
||||
|
||||
storekey = 'viewmode',
|
||||
menuIsVisible = false,
|
||||
|
||||
sidebarToggleTemplate =
|
||||
}, allsettings.view);
|
||||
var storekey = 'viewmode';
|
||||
var menuIsVisible = false;
|
||||
var sidebarToggleTemplate =
|
||||
'<li id="menu-toggle" class="view">' +
|
||||
'<a href="#">' +
|
||||
'<img src="' + resource.image('settings') + '" alt="settings"/>' +
|
||||
'</a>' +
|
||||
'</li>',
|
||||
|
||||
modeTemplate =
|
||||
'</li>';
|
||||
var modeTemplate =
|
||||
'<div id="view-[MODE]" class="view">' +
|
||||
'<a href="#">' +
|
||||
'<img src="' + resource.image('view-[MODE]') + '" alt="view-[MODE]"/>' +
|
||||
'</a>' +
|
||||
'</div>',
|
||||
'</div>';
|
||||
var sizeTemplate =
|
||||
'<input id="view-size" type="range" min="0" max="0" value="0">';
|
||||
|
||||
sizeTemplate =
|
||||
'<input id="view-size" type="range" min="0" max="0" value="0">',
|
||||
|
||||
adjustSpacing = function () {
|
||||
function adjustSpacing() {
|
||||
|
||||
var contentWidth = $('#content').width(),
|
||||
$view = $('#view'),
|
||||
itemWidth = ($view.hasClass('view-icons') || $view.hasClass('view-grid')) ? ($view.find('.item').eq(0).outerWidth(true) || 1) : 1;
|
||||
var contentWidth = $('#content').width();
|
||||
var $view = $('#view');
|
||||
var itemWidth = ($view.hasClass('view-icons') || $view.hasClass('view-grid')) ? ($view.find('.item').eq(0).outerWidth(true) || 1) : 1;
|
||||
|
||||
$view.width(Math.floor(contentWidth / itemWidth) * itemWidth);
|
||||
},
|
||||
}
|
||||
|
||||
update = function (mode, size) {
|
||||
function update(mode, size) {
|
||||
|
||||
var $view = $('#view'),
|
||||
stored = store.get(storekey);
|
||||
var $view = $('#view');
|
||||
var stored = store.get(storekey);
|
||||
|
||||
mode = mode || stored && stored.mode;
|
||||
size = size || stored && stored.size;
|
||||
|
@ -70,14 +65,14 @@ modulejs.define('view/viewmode', ['_', '$', 'core/settings', 'core/resource', 'c
|
|||
$('#view-size').val(_.indexOf(_.intersection(sizes, settings.sizes), size));
|
||||
|
||||
adjustSpacing();
|
||||
},
|
||||
}
|
||||
|
||||
init = function () {
|
||||
function init() {
|
||||
|
||||
var $sidebar = $('#sidebar'),
|
||||
$settings = $('#settings'),
|
||||
$viewBlock = $('<div class="block"/>'),
|
||||
max;
|
||||
var $sidebar = $('#sidebar');
|
||||
var $settings = $('#settings');
|
||||
var $viewBlock = $('<div class="block"/>');
|
||||
var max;
|
||||
|
||||
$(sidebarToggleTemplate)
|
||||
.on('click', 'a', function (event) {
|
||||
|
@ -123,7 +118,8 @@ modulejs.define('view/viewmode', ['_', '$', 'core/settings', 'core/resource', 'c
|
|||
|
||||
event.sub('location.changed', adjustSpacing);
|
||||
$(window).on('resize', adjustSpacing);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
init();
|
||||
});
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
// other libs
|
||||
// ----------
|
||||
// @include "lib/modernizr-*.js"
|
||||
|
@ -28,10 +27,10 @@
|
|||
|
||||
// @include "inc/**/*.js"
|
||||
|
||||
var $ = jQuery,
|
||||
module = $('script[data-module]').data('module'),
|
||||
data = {action: 'get', setup: true, options: true, types: true, theme: true, langs: true},
|
||||
url;
|
||||
var $ = jQuery;
|
||||
var module = $('script[data-module]').data('module');
|
||||
var data = {action: 'get', setup: true, options: true, types: true, theme: true, langs: true};
|
||||
var url;
|
||||
|
||||
if ($('html').hasClass('no-browser')) {
|
||||
return;
|
||||
|
@ -56,5 +55,4 @@
|
|||
modulejs.define('config', config);
|
||||
$(function () { modulejs.require(module); });
|
||||
});
|
||||
|
||||
}());
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
doctype html
|
||||
//if lt IE 10
|
||||
<html class="no-js no-browser" lang="en">
|
||||
//[if gt IE 9]><!
|
||||
html.no-js.browser( lang="en" )
|
||||
//<![endif]
|
||||
<!--[if lt IE 10]><html class="no-js no-browser" lang="en"><![endif]-->
|
||||
<!--[if gt IE 9]><!--><html class="no-js browser" lang="en"><!--<![endif]-->
|
||||
|
||||
head
|
||||
meta( charset="utf-8" )
|
||||
|
@ -41,3 +38,5 @@ html.no-js.browser( lang="en" )
|
|||
a( href="{{pkg.homepage}}", title="{{pkg.name}} {{pkg.version}} · {{pkg.description}}" )
|
||||
| powered by {{pkg.name}} {{pkg.version}}
|
||||
span.center
|
||||
|
||||
</html>
|
||||
|
|
|
@ -4,11 +4,8 @@
|
|||
|
||||
<?php header("Content-type: text/html;charset=utf-8"); ?>
|
||||
doctype html
|
||||
//if lt IE 10
|
||||
<html class="no-js no-browser" lang="en">
|
||||
//[if gt IE 9]><!
|
||||
html.no-js.browser( lang="en" )
|
||||
//<![endif]
|
||||
<!--[if lt IE 10]><html class="no-js no-browser" lang="en"><![endif]-->
|
||||
<!--[if gt IE 9]><!--><html class="no-js browser" lang="en"><!--<![endif]-->
|
||||
|
||||
head
|
||||
meta( charset="utf-8" )
|
||||
|
@ -43,3 +40,5 @@ html.no-js.browser( lang="en" )
|
|||
div#settings
|
||||
|
||||
div#fallback !{fallback}
|
||||
|
||||
</html>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue