mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-06-05 17:24:20 -04:00
Cosmetics.
This commit is contained in:
parent
7494491637
commit
c71f891af2
311 changed files with 55 additions and 46 deletions
179
src/_h5ai/client/js/inc/core/ajax.js
Normal file
179
src/_h5ai/client/js/inc/core/ajax.js
Normal file
|
@ -0,0 +1,179 @@
|
|||
|
||||
modulejs.define('core/ajax', ['$', 'amplify', 'base64', 'core/resource'], function ($, amplify, base64, resource) {
|
||||
|
||||
var reContentType = /^text\/html;h5ai=/,
|
||||
|
||||
getStatus = function (href, withContent, callback) {
|
||||
|
||||
$.ajax({
|
||||
url: href,
|
||||
type: withContent ? 'GET' : 'HEAD',
|
||||
complete: function (xhr) {
|
||||
|
||||
var res = {
|
||||
status: xhr.status,
|
||||
content: xhr.responseText
|
||||
};
|
||||
|
||||
if (xhr.status === 200 && reContentType.test(xhr.getResponseHeader('Content-Type'))) {
|
||||
res.status = 'h5ai';
|
||||
}
|
||||
|
||||
callback(res);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
getChecks = function (callback) {
|
||||
|
||||
$.ajax({
|
||||
url: resource.api(),
|
||||
data: {
|
||||
action: 'getchecks'
|
||||
},
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
success: function (json) {
|
||||
|
||||
callback(json);
|
||||
},
|
||||
error: function () {
|
||||
|
||||
callback();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
getEntries = function (href, content, callback) {
|
||||
|
||||
$.ajax({
|
||||
url: resource.api(),
|
||||
data: {
|
||||
action: 'getentries',
|
||||
href: href,
|
||||
content: content
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function (json) {
|
||||
|
||||
callback(json);
|
||||
},
|
||||
error: function () {
|
||||
|
||||
callback();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
getArchive = function (data, callback) {
|
||||
|
||||
$.ajax({
|
||||
url: resource.api(),
|
||||
data: {
|
||||
action: 'archive',
|
||||
execution: data.execution,
|
||||
format: data.format,
|
||||
hrefs: data.hrefs
|
||||
},
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
beforeSend: function (xhr) {
|
||||
|
||||
if (data.user) {
|
||||
xhr.setRequestHeader('Authorization', 'Basic ' + base64.encode(data.user + ':' + data.password));
|
||||
}
|
||||
},
|
||||
success: function (json) {
|
||||
|
||||
callback(json);
|
||||
},
|
||||
error: function () {
|
||||
|
||||
callback();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
getThumbSrc = function (data, callback) {
|
||||
|
||||
$.ajax({
|
||||
url: resource.api(),
|
||||
data: {
|
||||
action: 'getthumbsrc',
|
||||
type: data.type,
|
||||
href: data.href,
|
||||
mode: data.mode,
|
||||
width: data.width,
|
||||
height: data.height
|
||||
},
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
success: function (json) {
|
||||
|
||||
if (json.code === 0) {
|
||||
callback(json.absHref);
|
||||
}
|
||||
callback();
|
||||
},
|
||||
error: function () {
|
||||
|
||||
callback();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
getThumbSrcSmall = function (type, href, callback) {
|
||||
|
||||
getThumbSrc(
|
||||
{
|
||||
type: type,
|
||||
href: href,
|
||||
mode: 'square',
|
||||
width: 16,
|
||||
height: 16
|
||||
},
|
||||
callback
|
||||
);
|
||||
},
|
||||
|
||||
getThumbSrcBig = function (type, href, callback) {
|
||||
|
||||
getThumbSrc(
|
||||
{
|
||||
type: type,
|
||||
href: href,
|
||||
mode: 'rational',
|
||||
width: 100,
|
||||
height: 48
|
||||
},
|
||||
callback
|
||||
);
|
||||
},
|
||||
|
||||
getHtml = function (url, callback) {
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
dataType: 'html',
|
||||
success: function (html) {
|
||||
|
||||
callback(html);
|
||||
},
|
||||
error: function () {
|
||||
|
||||
callback();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
return {
|
||||
getStatus: getStatus,
|
||||
getChecks: getChecks,
|
||||
getEntries: getEntries,
|
||||
getArchive: getArchive,
|
||||
getThumbSrcSmall: getThumbSrcSmall,
|
||||
getThumbSrcBig: getThumbSrcBig,
|
||||
getHtml: getHtml
|
||||
};
|
||||
});
|
15
src/_h5ai/client/js/inc/core/entry.js
Normal file
15
src/_h5ai/client/js/inc/core/entry.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
|
||||
modulejs.define('core/entry', ['$', 'core/parser', 'model/entry'], function ($, parser, Entry) {
|
||||
|
||||
var entry = Entry.get();
|
||||
|
||||
parser.parse(entry.absHref, $('body'));
|
||||
$('#data-apache-autoindex').remove();
|
||||
|
||||
entry.status = 'h5ai';
|
||||
if (entry.parent) {
|
||||
entry.parent.isParentFolder = true;
|
||||
}
|
||||
|
||||
return entry;
|
||||
});
|
25
src/_h5ai/client/js/inc/core/event.js
Normal file
25
src/_h5ai/client/js/inc/core/event.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
|
||||
modulejs.define('core/event', ['amplify'], function (amplify) {
|
||||
|
||||
var sub = function (topic, callback) {
|
||||
|
||||
amplify.subscribe(topic, callback);
|
||||
},
|
||||
|
||||
unsub = function (topic, callback) {
|
||||
|
||||
amplify.unsubscribe(topic, callback);
|
||||
},
|
||||
|
||||
pub = function (topic, data) {
|
||||
|
||||
// console.log('EVENT PUB', topic, data);
|
||||
amplify.publish(topic, data);
|
||||
};
|
||||
|
||||
return {
|
||||
sub: sub,
|
||||
unsub: unsub,
|
||||
pub: pub
|
||||
};
|
||||
});
|
104
src/_h5ai/client/js/inc/core/format.js
Normal file
104
src/_h5ai/client/js/inc/core/format.js
Normal file
|
@ -0,0 +1,104 @@
|
|||
|
||||
modulejs.define('core/format', ['_', 'moment'], function (_, moment) {
|
||||
|
||||
var reParseSize = /^\s*([\.\d]+)\s*([kmgt]?)b?\s*$/i,
|
||||
decimalMetric = {
|
||||
t: 1000.0,
|
||||
k: 1000.0,
|
||||
u: ['B', 'KB', 'MB', 'GB', 'TB']
|
||||
},
|
||||
binaryMetric = {
|
||||
t: 1024.0,
|
||||
k: 1024.0,
|
||||
u: ['B', 'KiB', 'MiB', 'GiB', 'TiB']
|
||||
},
|
||||
|
||||
parseSize = function (str) {
|
||||
|
||||
var match = reParseSize.exec(str),
|
||||
kilo = decimalMetric.k,
|
||||
val, unit;
|
||||
|
||||
if (!match) {
|
||||
return null;
|
||||
}
|
||||
|
||||
val = parseFloat(match[1]);
|
||||
unit = match[2].toLowerCase();
|
||||
if (unit === 'k') {
|
||||
val *= kilo;
|
||||
} else if (unit === 'm') {
|
||||
val *= kilo * kilo;
|
||||
} else if (unit === 'g') {
|
||||
val *= kilo * kilo * kilo;
|
||||
} else if (unit === 't') {
|
||||
val *= kilo * kilo * kilo * kilo;
|
||||
}
|
||||
return val;
|
||||
},
|
||||
|
||||
defaultMetric = decimalMetric,
|
||||
|
||||
setDefaultMetric = function (metric) {
|
||||
|
||||
if (!metric) {
|
||||
defaultMetric = decimalMetric;
|
||||
} else if (metric === true) {
|
||||
defaultMetric = binaryMetric;
|
||||
} else {
|
||||
defaultMetric = metric;
|
||||
}
|
||||
},
|
||||
|
||||
formatSize = function (size, metric) {
|
||||
|
||||
metric = metric || defaultMetric;
|
||||
|
||||
if (!_.isNumber(size) || size < 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
var i = 0,
|
||||
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];
|
||||
},
|
||||
|
||||
defaultDateFormat = 'YYYY-MM-DD HH:mm',
|
||||
|
||||
setDefaultDateFormat = function (dateFormat) {
|
||||
|
||||
defaultDateFormat = dateFormat;
|
||||
},
|
||||
|
||||
parseDate = function (str, dateFormat) {
|
||||
|
||||
try { // problems with ie < 9 :(
|
||||
return moment(str, dateFormat || defaultDateFormat).valueOf() || null;
|
||||
} catch (err) {}
|
||||
|
||||
return Date.parse(str).valueOf() || null;
|
||||
},
|
||||
|
||||
formatDate = function (millis, dateFormat) {
|
||||
|
||||
if (!_.isNumber(millis) || !millis) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return moment(millis).format(dateFormat || defaultDateFormat);
|
||||
};
|
||||
|
||||
return {
|
||||
parseSize: parseSize,
|
||||
setDefaultMetric: setDefaultMetric,
|
||||
formatSize: formatSize,
|
||||
setDefaultDateFormat: setDefaultDateFormat,
|
||||
parseDate: parseDate,
|
||||
formatDate: formatDate
|
||||
};
|
||||
});
|
5
src/_h5ai/client/js/inc/core/langs.js
Normal file
5
src/_h5ai/client/js/inc/core/langs.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
|
||||
modulejs.define('core/langs', ['config', '_'], function (config, _) {
|
||||
|
||||
return _.extend({}, config.langs);
|
||||
});
|
12
src/_h5ai/client/js/inc/core/mode.js
Normal file
12
src/_h5ai/client/js/inc/core/mode.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
|
||||
modulejs.define('core/mode', [], function () {
|
||||
|
||||
var mode = {
|
||||
// id: null,
|
||||
// dataType: null,
|
||||
// serverName: null,
|
||||
// serverVersion: null
|
||||
};
|
||||
|
||||
return mode;
|
||||
});
|
15
src/_h5ai/client/js/inc/core/parser.js
Normal file
15
src/_h5ai/client/js/inc/core/parser.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
|
||||
modulejs.define('core/parser', ['$'], function ($) {
|
||||
|
||||
if ($('#data-apache-autoindex').length) {
|
||||
return modulejs.require('parser/apache-autoindex');
|
||||
}
|
||||
if ($('#data-generic-json').length) {
|
||||
return modulejs.require('parser/generic-json');
|
||||
}
|
||||
|
||||
return {
|
||||
dataType: 'N/A',
|
||||
parse: function () { return []; }
|
||||
};
|
||||
});
|
35
src/_h5ai/client/js/inc/core/refresh.js
Normal file
35
src/_h5ai/client/js/inc/core/refresh.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
|
||||
modulejs.define('core/refresh', ['_', 'core/mode', 'core/ajax', 'model/entry'], function (_, mode, ajax, Entry) {
|
||||
|
||||
var parseJson = function (entry, json) {
|
||||
|
||||
var found = {};
|
||||
|
||||
_.each(json.entries, function (jsonEntry) {
|
||||
|
||||
found[jsonEntry.absHref] = true;
|
||||
Entry.get(jsonEntry.absHref, jsonEntry.time, jsonEntry.size, jsonEntry.status, jsonEntry.content);
|
||||
});
|
||||
|
||||
_.each(entry.content, function (e) {
|
||||
if (!found[e.absHref]) {
|
||||
Entry.remove(e.absHref);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
refresh = function () {
|
||||
|
||||
if (mode.id !== 'php') {
|
||||
return;
|
||||
}
|
||||
|
||||
var entry = Entry.get();
|
||||
ajax.getEntries(entry.absHref, 1, function (json) {
|
||||
|
||||
parseJson(entry, json);
|
||||
});
|
||||
};
|
||||
|
||||
return refresh;
|
||||
});
|
22
src/_h5ai/client/js/inc/core/resource.js
Normal file
22
src/_h5ai/client/js/inc/core/resource.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
|
||||
modulejs.define('core/resource', ['core/settings'], function (settings) {
|
||||
|
||||
var api = function () {
|
||||
|
||||
return settings.h5aiAbsHref + 'server/php/api.php';
|
||||
},
|
||||
image = function (id, noPngExt) {
|
||||
|
||||
return settings.h5aiAbsHref + 'client/images/' + id + (noPngExt ? '' : '.png');
|
||||
},
|
||||
icon = function (id, big) {
|
||||
|
||||
return settings.h5aiAbsHref + 'client/icons/' + (big ? '48x48' : '16x16') + '/' + id + '.png';
|
||||
};
|
||||
|
||||
return {
|
||||
api: api,
|
||||
image: image,
|
||||
icon: icon
|
||||
};
|
||||
});
|
12
src/_h5ai/client/js/inc/core/settings.js
Normal file
12
src/_h5ai/client/js/inc/core/settings.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
|
||||
modulejs.define('core/settings', ['config', '_'], function (config, _) {
|
||||
|
||||
var settings = _.extend({
|
||||
h5aiAbsHref: '/_h5ai/'
|
||||
}, config.options);
|
||||
|
||||
settings.h5aiAbsHref = settings.h5aiAbsHref.replace(/\/*$/, '/');
|
||||
settings.rootAbsHref = /^(.*\/)[^\/]+\/?$/.exec(settings.h5aiAbsHref)[1];
|
||||
|
||||
return settings;
|
||||
});
|
18
src/_h5ai/client/js/inc/core/store.js
Normal file
18
src/_h5ai/client/js/inc/core/store.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
|
||||
modulejs.define('core/store', ['amplify'], function (amplify) {
|
||||
|
||||
var put = function (key, value) {
|
||||
|
||||
amplify.store(key, value);
|
||||
},
|
||||
|
||||
get = function (key) {
|
||||
|
||||
return amplify.store(key);
|
||||
};
|
||||
|
||||
return {
|
||||
put: put,
|
||||
get: get
|
||||
};
|
||||
});
|
48
src/_h5ai/client/js/inc/core/types.js
Normal file
48
src/_h5ai/client/js/inc/core/types.js
Normal file
|
@ -0,0 +1,48 @@
|
|||
|
||||
modulejs.define('core/types', ['config', '_'], function (config, _) {
|
||||
|
||||
var reEndsWithSlash = /\/$/,
|
||||
reStartsWithDot = /^\./,
|
||||
|
||||
fileExts = {},
|
||||
fileNames = {},
|
||||
|
||||
parse = function (types) {
|
||||
|
||||
_.each(types, function (matches, type) {
|
||||
|
||||
_.each(matches, function (match) {
|
||||
|
||||
match = match.toLowerCase();
|
||||
|
||||
if (reStartsWithDot.test(match)) {
|
||||
fileExts[match] = type;
|
||||
} else {
|
||||
fileNames[match] = type;
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
getType = function (sequence) {
|
||||
|
||||
if (reEndsWithSlash.test(sequence)) {
|
||||
return 'folder';
|
||||
}
|
||||
|
||||
sequence = sequence.toLowerCase();
|
||||
|
||||
var slashidx = sequence.lastIndexOf('/'),
|
||||
name = slashidx >= 0 ? sequence.substr(slashidx + 1) : sequence,
|
||||
dotidx = sequence.lastIndexOf('.'),
|
||||
ext = dotidx >= 0 ? sequence.substr(dotidx) : sequence;
|
||||
|
||||
return fileNames[name] || fileExts[ext] || 'unknown';
|
||||
};
|
||||
|
||||
parse(_.extend({}, config.types));
|
||||
|
||||
return {
|
||||
getType: getType
|
||||
};
|
||||
});
|
30
src/_h5ai/client/js/inc/ext/autorefresh.js
Normal file
30
src/_h5ai/client/js/inc/ext/autorefresh.js
Normal file
|
@ -0,0 +1,30 @@
|
|||
|
||||
modulejs.define('ext/autorefresh', ['_', '$', 'core/settings', 'core/event', 'core/refresh'], function (_, $, allsettings, event, refresh) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false,
|
||||
interval: 5000
|
||||
}, allsettings.autorefresh),
|
||||
|
||||
heartbeat = function () {
|
||||
|
||||
refresh();
|
||||
setTimeout(heartbeat, settings.interval);
|
||||
},
|
||||
|
||||
init = function () {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
settings.interval = Math.max(1000, settings.interval);
|
||||
|
||||
event.sub('ready', function () {
|
||||
|
||||
setTimeout(heartbeat, settings.interval);
|
||||
});
|
||||
};
|
||||
|
||||
init();
|
||||
});
|
98
src/_h5ai/client/js/inc/ext/crumb.js
Normal file
98
src/_h5ai/client/js/inc/ext/crumb.js
Normal file
|
@ -0,0 +1,98 @@
|
|||
|
||||
modulejs.define('ext/crumb', ['_', '$', 'core/settings', 'core/resource', 'core/event', 'core/entry'], function (_, $, allsettings, resource, event, entry) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false
|
||||
}, allsettings.crumb),
|
||||
|
||||
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"/>',
|
||||
|
||||
// updates the crumb for this single entry
|
||||
update = function (entry, force) {
|
||||
|
||||
if (!force && entry.$crumb && entry.$crumb.data('status') === entry.status) {
|
||||
return entry.$crumb;
|
||||
}
|
||||
|
||||
var $html = $(template),
|
||||
$a = $html.find('a');
|
||||
|
||||
$html
|
||||
.addClass(entry.isFolder() ? 'folder' : 'file')
|
||||
.data('status', entry.status);
|
||||
|
||||
$a
|
||||
.attr('href', entry.absHref)
|
||||
.find('span').text(entry.label).end();
|
||||
|
||||
if (entry.isDomain()) {
|
||||
$html.addClass('domain');
|
||||
$a.find('img').attr('src', resource.image('home'));
|
||||
}
|
||||
|
||||
if (entry.isRoot()) {
|
||||
$html.addClass('root');
|
||||
$a.find('img').attr('src', resource.image('home'));
|
||||
}
|
||||
|
||||
if (entry.isCurrentFolder()) {
|
||||
$html.addClass('current');
|
||||
}
|
||||
|
||||
if (_.isNumber(entry.status)) {
|
||||
if (entry.status === 200) {
|
||||
$a.append($(pageHintTemplate));
|
||||
} else {
|
||||
$a.append($(statusHintTemplate).text('(' + entry.status + ')'));
|
||||
}
|
||||
}
|
||||
|
||||
if (entry.$crumb) {
|
||||
entry.$crumb.replaceWith($html);
|
||||
}
|
||||
entry.$crumb = $html;
|
||||
|
||||
return $html;
|
||||
},
|
||||
|
||||
onContentChanged = function (entry) {
|
||||
|
||||
if (entry.$crumb) {
|
||||
update(entry, true);
|
||||
}
|
||||
},
|
||||
|
||||
// creates the complete crumb from entry down to the root
|
||||
init = function (entry) {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
var crumb = entry.getCrumb(),
|
||||
$ul = $('#navbar');
|
||||
|
||||
_.each(crumb, function (e) {
|
||||
|
||||
$ul.append(update(e));
|
||||
|
||||
e.fetchStatus(function (e) {
|
||||
|
||||
update(e);
|
||||
});
|
||||
});
|
||||
|
||||
event.sub('entry.created', onContentChanged);
|
||||
event.sub('entry.removed', onContentChanged);
|
||||
event.sub('entry.changed', onContentChanged);
|
||||
};
|
||||
|
||||
init(entry);
|
||||
});
|
36
src/_h5ai/client/js/inc/ext/custom.js
Normal file
36
src/_h5ai/client/js/inc/ext/custom.js
Normal file
|
@ -0,0 +1,36 @@
|
|||
|
||||
modulejs.define('ext/custom', ['_', '$', 'core/settings', 'core/ajax'], function (_, $, allsettings, ajax) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false,
|
||||
header: '_h5ai.header.html',
|
||||
footer: '_h5ai.footer.html'
|
||||
}, allsettings.custom),
|
||||
|
||||
init = function () {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (_.isString(settings.header)) {
|
||||
ajax.getHtml(settings.header, function (html) {
|
||||
|
||||
if (html) {
|
||||
$('<div id="content-header">' + html + '</div>').prependTo('#content');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (_.isString(settings.footer)) {
|
||||
ajax.getHtml(settings.footer, function (html) {
|
||||
|
||||
if (html) {
|
||||
$('<div id="content-footer">' + html + '</div>').appendTo('#content');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
init();
|
||||
});
|
106
src/_h5ai/client/js/inc/ext/delete.js
Normal file
106
src/_h5ai/client/js/inc/ext/delete.js
Normal file
|
@ -0,0 +1,106 @@
|
|||
|
||||
modulejs.define('ext/delete', ['_', '$', 'core/settings', 'core/entry', 'core/event', 'core/resource', 'core/refresh'], function (_, $, allsettings, entry, event, resource, refresh) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false
|
||||
}, allsettings['delete']),
|
||||
|
||||
deleteBtnTemplate = '<li id="delete">' +
|
||||
'<a href="#">' +
|
||||
'<img src="' + resource.image('delete') + '" alt="delete"/>' +
|
||||
'<span class="l10n-delete">delete</span>' +
|
||||
'</a>' +
|
||||
'</li>',
|
||||
authTemplate = '<div id="delete-auth">' +
|
||||
'<input id="delete-auth-user" type="text" value="" placeholder="user"/>' +
|
||||
'<input id="delete-auth-password" type="text" value="" placeholder="password"/>' +
|
||||
'</div>',
|
||||
|
||||
selectedHrefsStr = '',
|
||||
$delete, $img, $deleteAuth, $deleteUser, $deletePassword,
|
||||
|
||||
failed = function () {
|
||||
|
||||
$delete.addClass('failed');
|
||||
setTimeout(function () {
|
||||
$delete.removeClass('failed');
|
||||
}, 1000);
|
||||
},
|
||||
|
||||
handleResponse = function (json) {
|
||||
|
||||
$delete.removeClass('current');
|
||||
$img.attr('src', resource.image('delete'));
|
||||
|
||||
if (!json || json.code) {
|
||||
if (json && json.code === 401) {
|
||||
$deleteAuth
|
||||
.css({
|
||||
left: $delete.offset().left,
|
||||
top: $delete.offset().top + $delete.outerHeight()
|
||||
})
|
||||
.show();
|
||||
$deleteUser.focus();
|
||||
}
|
||||
failed();
|
||||
}
|
||||
refresh();
|
||||
},
|
||||
|
||||
requestDeletion = function (hrefsStr) {
|
||||
|
||||
$delete.addClass('current');
|
||||
$img.attr('src', resource.image('loading.gif', true));
|
||||
$.ajax({
|
||||
url: resource.api(),
|
||||
data: {
|
||||
action: 'delete',
|
||||
hrefs: hrefsStr,
|
||||
user: $deleteUser.val(),
|
||||
password: $deletePassword.val()
|
||||
},
|
||||
dataType: 'json',
|
||||
success: handleResponse
|
||||
});
|
||||
},
|
||||
|
||||
onSelection = function (entries) {
|
||||
|
||||
selectedHrefsStr = '';
|
||||
if (entries.length) {
|
||||
selectedHrefsStr = _.map(entries, function (entry) {
|
||||
|
||||
return entry.absHref;
|
||||
}).join(':');
|
||||
$delete.appendTo('#navbar').show();
|
||||
} else {
|
||||
$delete.hide();
|
||||
$deleteAuth.hide();
|
||||
}
|
||||
},
|
||||
|
||||
init = function () {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
$delete = $(deleteBtnTemplate)
|
||||
.find('a').on('click', function (event) {
|
||||
|
||||
event.preventDefault();
|
||||
$deleteAuth.hide();
|
||||
requestDeletion(selectedHrefsStr);
|
||||
}).end()
|
||||
.appendTo('#navbar');
|
||||
$img = $delete.find('img');
|
||||
|
||||
$deleteAuth = $(authTemplate).appendTo('body');
|
||||
$deleteUser = $deleteAuth.find('#delete-auth-user');
|
||||
$deletePassword = $deleteAuth.find('#delete-auth-password');
|
||||
|
||||
event.sub('selection', onSelection);
|
||||
};
|
||||
|
||||
init();
|
||||
});
|
114
src/_h5ai/client/js/inc/ext/download.js
Normal file
114
src/_h5ai/client/js/inc/ext/download.js
Normal file
|
@ -0,0 +1,114 @@
|
|||
|
||||
modulejs.define('ext/download', ['_', '$', 'core/settings', 'core/resource', 'core/event', 'core/ajax'], function (_, $, allsettings, resource, event, ajax) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false,
|
||||
execution: 'php',
|
||||
format: 'zip'
|
||||
}, allsettings.download),
|
||||
|
||||
// formats = ['tar', 'zip'],
|
||||
|
||||
downloadBtnTemplate = '<li id="download">' +
|
||||
'<a href="#">' +
|
||||
'<img src="' + resource.image('download') + '" alt="download"/>' +
|
||||
'<span class="l10n-download">download</span>' +
|
||||
'</a>' +
|
||||
'</li>',
|
||||
authTemplate = '<div id="download-auth">' +
|
||||
'<input id="download-auth-user" type="text" value="" placeholder="user"/>' +
|
||||
'<input id="download-auth-password" type="text" value="" placeholder="password"/>' +
|
||||
'</div>',
|
||||
|
||||
selectedHrefsStr = '',
|
||||
$download, $img, $downloadAuth, $downloadUser, $downloadPassword,
|
||||
|
||||
failed = function () {
|
||||
|
||||
$download.addClass('failed');
|
||||
setTimeout(function () {
|
||||
$download.removeClass('failed');
|
||||
}, 1000);
|
||||
},
|
||||
|
||||
handleResponse = function (json) {
|
||||
|
||||
$download.removeClass('current');
|
||||
$img.attr('src', resource.image('download'));
|
||||
|
||||
if (json) {
|
||||
if (json.code === 0) {
|
||||
setTimeout(function () { // wait here so the img above can be updated in time
|
||||
|
||||
window.location = resource.api() + '?action=getarchive&id=' + json.id + '&as=h5ai-selection.' + settings.format;
|
||||
}, 200);
|
||||
} else {
|
||||
if (json.code === 401) {
|
||||
$downloadAuth
|
||||
.css({
|
||||
left: $download.offset().left,
|
||||
top: $download.offset().top + $download.outerHeight()
|
||||
})
|
||||
.show();
|
||||
$downloadUser.focus();
|
||||
}
|
||||
failed();
|
||||
}
|
||||
} else {
|
||||
failed();
|
||||
}
|
||||
},
|
||||
|
||||
requestArchive = function (hrefsStr) {
|
||||
|
||||
$download.addClass('current');
|
||||
$img.attr('src', resource.image('loading.gif', true));
|
||||
ajax.getArchive({
|
||||
execution: settings.execution,
|
||||
format: settings.format,
|
||||
hrefs: hrefsStr,
|
||||
user: $downloadUser.val(),
|
||||
password: $downloadPassword.val()
|
||||
}, handleResponse);
|
||||
},
|
||||
|
||||
onSelection = function (entries) {
|
||||
|
||||
selectedHrefsStr = '';
|
||||
if (entries.length) {
|
||||
selectedHrefsStr = _.map(entries, function (entry) {
|
||||
|
||||
return entry.absHref;
|
||||
}).join(':');
|
||||
$download.appendTo('#navbar').show();
|
||||
} else {
|
||||
$download.hide();
|
||||
$downloadAuth.hide();
|
||||
}
|
||||
},
|
||||
|
||||
init = function () {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
$download = $(downloadBtnTemplate)
|
||||
.find('a').on('click', function (event) {
|
||||
|
||||
event.preventDefault();
|
||||
$downloadAuth.hide();
|
||||
requestArchive(selectedHrefsStr);
|
||||
}).end()
|
||||
.appendTo('#navbar');
|
||||
$img = $download.find('img');
|
||||
|
||||
$downloadAuth = $(authTemplate).appendTo('body');
|
||||
$downloadUser = $downloadAuth.find('#download-auth-user');
|
||||
$downloadPassword = $downloadAuth.find('#download-auth-password');
|
||||
|
||||
event.sub('selection', onSelection);
|
||||
};
|
||||
|
||||
init();
|
||||
});
|
113
src/_h5ai/client/js/inc/ext/dropbox.js
Normal file
113
src/_h5ai/client/js/inc/ext/dropbox.js
Normal file
|
@ -0,0 +1,113 @@
|
|||
|
||||
modulejs.define('ext/dropbox', ['_', '$', 'core/settings', 'core/entry', 'core/resource', 'core/refresh'], function (_, $, allsettings, entry, resource, refresh) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false,
|
||||
maxfiles: 5,
|
||||
maxfilesize: 20
|
||||
}, allsettings.dropbox),
|
||||
|
||||
template = '<ul id="uploads"/>',
|
||||
|
||||
uploadTemplate = '<li class="upload clearfix">' +
|
||||
'<span class="name"/>' +
|
||||
'<span class="size"/>' +
|
||||
'<div class="progress"><div class="bar"/></div>' +
|
||||
'</li>',
|
||||
|
||||
init = function () {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
var $content = $('#content').append(template);
|
||||
|
||||
var uploads = {},
|
||||
afterUpload = function (err, file) {
|
||||
|
||||
if (file) {
|
||||
uploads[file.name]
|
||||
.addClass(err ? 'error' : 'finished')
|
||||
.find('.progress').replaceWith(err ? '<span class="error">' + err + '</span>' : '<span class="finished">okay</span>');
|
||||
|
||||
setTimeout(function () {
|
||||
uploads[file.name].slideUp(400, function () {
|
||||
|
||||
uploads[file.name].remove();
|
||||
delete uploads[file.name];
|
||||
});
|
||||
}, 5000);
|
||||
}
|
||||
};
|
||||
|
||||
$content.filedrop({
|
||||
|
||||
paramname: 'userfile',
|
||||
|
||||
maxfiles: settings.maxfiles,
|
||||
maxfilesize: settings.maxfilesize,
|
||||
url: resource.api(),
|
||||
data: {
|
||||
action: 'upload',
|
||||
href: entry.absHref
|
||||
},
|
||||
|
||||
docEnter: function () {
|
||||
|
||||
$content.addClass('hint');
|
||||
},
|
||||
|
||||
docLeave: function () {
|
||||
|
||||
$content.removeClass('hint');
|
||||
},
|
||||
|
||||
dragOver: function () {
|
||||
|
||||
$content.addClass('match');
|
||||
},
|
||||
|
||||
dragLeave: function () {
|
||||
|
||||
$content.removeClass('match');
|
||||
},
|
||||
|
||||
drop: function () {
|
||||
|
||||
$content.removeClass('hint match');
|
||||
},
|
||||
|
||||
|
||||
beforeEach: function (file) {
|
||||
|
||||
uploads[file.name] = $(uploadTemplate).appendTo('#uploads')
|
||||
.find('.name').text(file.name).end()
|
||||
.find('.size').text(file.size).end()
|
||||
.find('.progress .bar').css('width', 0).end();
|
||||
},
|
||||
|
||||
progressUpdated: function (i, file, progress) {
|
||||
|
||||
uploads[file.name].find('.progress .bar').css('width', '' + progress + '%');
|
||||
},
|
||||
|
||||
uploadFinished: function (i, file, response) {
|
||||
|
||||
afterUpload(response.code && response.msg, file);
|
||||
},
|
||||
|
||||
afterAll: function () {
|
||||
|
||||
refresh();
|
||||
},
|
||||
|
||||
error: function (err, file) {
|
||||
|
||||
afterUpload(err, file);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
init();
|
||||
});
|
120
src/_h5ai/client/js/inc/ext/filter.js
Normal file
120
src/_h5ai/client/js/inc/ext/filter.js
Normal file
|
@ -0,0 +1,120 @@
|
|||
|
||||
modulejs.define('ext/filter', ['_', '$', 'core/settings', 'core/resource'], function (_, $, allsettings, resource) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false
|
||||
}, allsettings.filter),
|
||||
|
||||
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"/>',
|
||||
|
||||
$filter, $input, $noMatch,
|
||||
|
||||
filter = function (re) {
|
||||
|
||||
var match = [],
|
||||
noMatch = [],
|
||||
duration = 200;
|
||||
|
||||
if (re) {
|
||||
$('#extended .entry').each(function () {
|
||||
|
||||
var label = $(this).find('.label').text();
|
||||
|
||||
if (label.match(re)) {
|
||||
match.push(this);
|
||||
} else {
|
||||
noMatch.push(this);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
match = $('#extended .entry');
|
||||
}
|
||||
|
||||
if ($(match).length) {
|
||||
$noMatch.hide();
|
||||
} else {
|
||||
setTimeout(function () { $noMatch.show(); }, duration);
|
||||
}
|
||||
$(match).fadeIn(duration);
|
||||
$(noMatch).fadeOut(duration);
|
||||
},
|
||||
|
||||
escapeRegExp = function (sequence) {
|
||||
|
||||
return sequence.replace(/[\-\[\]{}()*+?.,\\$\^|#\s]/g, '\\$&');
|
||||
},
|
||||
|
||||
parseFilterSequence = function (sequence) {
|
||||
|
||||
if (sequence.substr(0, 3) === 're:') {
|
||||
return new RegExp(sequence.substr(3));
|
||||
}
|
||||
|
||||
sequence = $.map($.trim(sequence).split(/\s+/), function (part) {
|
||||
|
||||
return _.map(part.split(''), function (char) {
|
||||
|
||||
return escapeRegExp(char);
|
||||
}).join('.*?');
|
||||
}).join('|');
|
||||
|
||||
return new RegExp(sequence, 'i');
|
||||
},
|
||||
|
||||
update = function () {
|
||||
|
||||
var val = $input.val();
|
||||
|
||||
if (val) {
|
||||
filter(parseFilterSequence(val));
|
||||
$filter.addClass('current');
|
||||
} else {
|
||||
filter();
|
||||
$filter.removeClass('current');
|
||||
}
|
||||
},
|
||||
|
||||
init = function () {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
$filter = $(template).appendTo('#navbar');
|
||||
$input = $filter.find('input');
|
||||
$noMatch = $(noMatchTemplate).appendTo('#extended');
|
||||
|
||||
$filter
|
||||
.on('click', function () {
|
||||
|
||||
$input.focus();
|
||||
});
|
||||
|
||||
$input
|
||||
.on('focus', function () {
|
||||
|
||||
$filter.addClass('current');
|
||||
})
|
||||
.on('blur keyup', update);
|
||||
|
||||
$(document)
|
||||
.on('keydown', function (event) {
|
||||
|
||||
if (event.which === 27) {
|
||||
$input.attr('value','').blur();
|
||||
}
|
||||
})
|
||||
.on('keypress', function (event) {
|
||||
|
||||
$input.focus();
|
||||
});
|
||||
};
|
||||
|
||||
init();
|
||||
});
|
10
src/_h5ai/client/js/inc/ext/folderstatus.js
Normal file
10
src/_h5ai/client/js/inc/ext/folderstatus.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
|
||||
modulejs.define('ext/folderstatus', ['_', 'core/settings'], function (_, allsettings) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false,
|
||||
folders: {}
|
||||
}, allsettings.folderstatus);
|
||||
|
||||
return settings.enabled ? settings.folders : {};
|
||||
});
|
28
src/_h5ai/client/js/inc/ext/google-analytics.js
Normal file
28
src/_h5ai/client/js/inc/ext/google-analytics.js
Normal file
|
@ -0,0 +1,28 @@
|
|||
|
||||
modulejs.define('ext/google-analytics', ['_', 'core/settings'], function (_, allsettings) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false,
|
||||
gaq: []
|
||||
}, allsettings['google-analytics']),
|
||||
|
||||
init = function () {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
window._gaq = settings.gaq;
|
||||
|
||||
var strScript = 'script',
|
||||
doc = document,
|
||||
newScriptTag = doc.createElement(strScript),
|
||||
firstScriptTag = doc.getElementsByTagName(strScript)[0];
|
||||
|
||||
newScriptTag.async = true;
|
||||
newScriptTag.src = ('https:' === location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||
firstScriptTag.parentNode.insertBefore(newScriptTag, firstScriptTag);
|
||||
};
|
||||
|
||||
init();
|
||||
});
|
175
src/_h5ai/client/js/inc/ext/l10n.js
Normal file
175
src/_h5ai/client/js/inc/ext/l10n.js
Normal file
|
@ -0,0 +1,175 @@
|
|||
|
||||
modulejs.define('ext/l10n', ['_', '$', 'core/settings', 'core/langs', 'core/format', 'core/store', 'core/event'], function (_, $, allsettings, langs, format, store, event) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false,
|
||||
lang: 'en',
|
||||
useBrowserLang: true
|
||||
}, allsettings.l10n),
|
||||
|
||||
defaultTranslations = {
|
||||
isoCode: 'en',
|
||||
lang: 'english',
|
||||
details: 'details',
|
||||
list: "list",
|
||||
grid: "grid",
|
||||
icons: 'icons',
|
||||
name: 'Name',
|
||||
lastModified: 'Last modified',
|
||||
size: 'Size',
|
||||
parentDirectory: 'Parent Directory',
|
||||
empty: 'empty',
|
||||
folders: 'folders',
|
||||
files: 'files',
|
||||
download: 'download',
|
||||
noMatch: 'no match',
|
||||
dateFormat: 'YYYY-MM-DD HH:mm',
|
||||
filter: 'filter'
|
||||
},
|
||||
|
||||
template = '<span id="langSelector">' +
|
||||
'<span class="l10n-isoCode"/> - <span class="l10n-lang"/>' +
|
||||
'<span class="langOptions"><ul/></span>' +
|
||||
'</span>',
|
||||
langOptionTemplate = '<li class="langOption"/>',
|
||||
|
||||
storekey = 'h5ai.language',
|
||||
|
||||
loaded = {
|
||||
en: _.extend({}, defaultTranslations)
|
||||
},
|
||||
currentLang = loaded.en,
|
||||
|
||||
update = function (lang) {
|
||||
|
||||
if (lang) {
|
||||
currentLang = lang;
|
||||
}
|
||||
|
||||
$.each(currentLang, function (key, value) {
|
||||
$('.l10n-' + key).text(value);
|
||||
});
|
||||
$('.langOption').removeClass('current');
|
||||
$('.langOption.' + currentLang.isoCode).addClass('current');
|
||||
|
||||
format.setDefaultDateFormat(currentLang.dateFormat);
|
||||
|
||||
$('#extended .entry .date').each(function () {
|
||||
|
||||
var $this = $(this);
|
||||
|
||||
$this.text(format.formatDate($this.data('time')));
|
||||
});
|
||||
|
||||
$('#filter input').attr('placeholder', currentLang.filter);
|
||||
},
|
||||
|
||||
loadLanguage = function (isoCode, callback) {
|
||||
|
||||
if (loaded[isoCode]) {
|
||||
|
||||
callback(loaded[isoCode]);
|
||||
} else {
|
||||
|
||||
$.ajax({
|
||||
url: allsettings.h5aiAbsHref + 'l10n/' + isoCode + '.json',
|
||||
dataType: 'json',
|
||||
success: function (json) {
|
||||
|
||||
loaded[isoCode] = _.extend({}, defaultTranslations, json, {isoCode: isoCode});
|
||||
callback(loaded[isoCode]);
|
||||
},
|
||||
error: function () {
|
||||
|
||||
loaded[isoCode] = _.extend({}, defaultTranslations, {isoCode: isoCode});
|
||||
callback(loaded[isoCode]);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
localize = function (langs, isoCode, useBrowserLang) {
|
||||
|
||||
var storedIsoCode = store.get(storekey);
|
||||
|
||||
if (langs[storedIsoCode]) {
|
||||
isoCode = storedIsoCode;
|
||||
} else if (useBrowserLang) {
|
||||
var browserLang = navigator.language || navigator.browserLanguage;
|
||||
if (browserLang) {
|
||||
if (langs[browserLang]) {
|
||||
isoCode = browserLang;
|
||||
} else if (browserLang.length > 2 && langs[browserLang.substr(0, 2)]) {
|
||||
isoCode = browserLang.substr(0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!langs[isoCode]) {
|
||||
isoCode = 'en';
|
||||
}
|
||||
|
||||
loadLanguage(isoCode, update);
|
||||
},
|
||||
|
||||
initLangSelector = function (langs) {
|
||||
|
||||
var $langSelector = $(template).appendTo('#bottombar .right'),
|
||||
$langOptions = $langSelector.find('.langOptions'),
|
||||
$ul = $langOptions.find('ul'),
|
||||
isoCodes = [];
|
||||
|
||||
$.each(langs, function (isoCode) {
|
||||
isoCodes.push(isoCode);
|
||||
});
|
||||
isoCodes.sort();
|
||||
|
||||
$.each(isoCodes, function (idx, isoCode) {
|
||||
$(langOptionTemplate)
|
||||
.addClass(isoCode)
|
||||
.text(isoCode + ' - ' + (_.isString(langs[isoCode]) ? langs[isoCode] : langs[isoCode].lang))
|
||||
.appendTo($ul)
|
||||
.click(function () {
|
||||
store.put(storekey, isoCode);
|
||||
localize(langs, isoCode, false);
|
||||
});
|
||||
});
|
||||
$langOptions
|
||||
.append($ul)
|
||||
.scrollpanel();
|
||||
|
||||
$langSelector.hover(
|
||||
function () {
|
||||
$langOptions
|
||||
.css('top', '-' + $langOptions.outerHeight() + 'px')
|
||||
.stop(true, true)
|
||||
.fadeIn();
|
||||
|
||||
// needs to be updated twice for initial fade in rendering :/
|
||||
$langOptions.scrollpanel('update').scrollpanel('update');
|
||||
},
|
||||
function () {
|
||||
$langOptions
|
||||
.stop(true, true)
|
||||
.fadeOut();
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
init = function () {
|
||||
|
||||
if (!settings.enabled) {
|
||||
event.sub('ready', function () { update(); });
|
||||
return;
|
||||
}
|
||||
|
||||
initLangSelector(langs);
|
||||
|
||||
event.sub('ready', function () {
|
||||
|
||||
localize(langs, settings.lang, settings.useBrowserLang);
|
||||
});
|
||||
};
|
||||
|
||||
init();
|
||||
});
|
42
src/_h5ai/client/js/inc/ext/link-hover-states.js
Normal file
42
src/_h5ai/client/js/inc/ext/link-hover-states.js
Normal file
|
@ -0,0 +1,42 @@
|
|||
|
||||
modulejs.define('ext/link-hover-states', ['_', '$', 'core/settings'], function (_, $, allsettings) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false
|
||||
}, allsettings['link-hover-states']),
|
||||
|
||||
selector = "a[href^='/']",
|
||||
|
||||
selectLinks = function (href) {
|
||||
|
||||
return $(_.filter($(selector), function (el) {
|
||||
|
||||
return $(el).attr('href') === href;
|
||||
}));
|
||||
},
|
||||
|
||||
onMouseEnter = function () {
|
||||
|
||||
var href = $(this).attr('href');
|
||||
|
||||
selectLinks(href).addClass('hover');
|
||||
},
|
||||
|
||||
onMouseLeave = function () {
|
||||
|
||||
var href = $(this).attr('href');
|
||||
|
||||
selectLinks(href).removeClass('hover');
|
||||
},
|
||||
|
||||
init = function () {
|
||||
|
||||
if (settings.enabled) {
|
||||
$('body')
|
||||
.on('mouseenter', selector, onMouseEnter)
|
||||
.on('mouseleave', selector, onMouseLeave);
|
||||
}
|
||||
};
|
||||
|
||||
init();
|
||||
});
|
33
src/_h5ai/client/js/inc/ext/mode.js
Normal file
33
src/_h5ai/client/js/inc/ext/mode.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
|
||||
modulejs.define('ext/mode', ['_', '$', 'core/mode', 'core/settings'], function (_, $, mode, allsettings) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false,
|
||||
display: 0
|
||||
}, allsettings.mode),
|
||||
|
||||
init = function () {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
var info = '';
|
||||
|
||||
if (mode.id) {
|
||||
info += mode.id;
|
||||
}
|
||||
if (settings.display > 0 && mode.serverName) {
|
||||
info += (info ? ' on ' : '') + mode.serverName;
|
||||
}
|
||||
if (settings.display > 1 && mode.serverVersion) {
|
||||
info += (info ? '-' : '') + mode.serverVersion;
|
||||
}
|
||||
|
||||
if (info) {
|
||||
$('#h5ai-reference').append(' (' + info + ')');
|
||||
}
|
||||
};
|
||||
|
||||
init();
|
||||
});
|
31
src/_h5ai/client/js/inc/ext/piwik-analytics.js
Executable file
31
src/_h5ai/client/js/inc/ext/piwik-analytics.js
Executable file
|
@ -0,0 +1,31 @@
|
|||
|
||||
modulejs.define('ext/piwik-analytics', ['_', '$', 'core/settings'], function (_, $, allsettings) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false,
|
||||
baseURL: 'not-set',
|
||||
idSite: 0
|
||||
}, allsettings['piwik-analytics']),
|
||||
|
||||
init = function () {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
// reference: http://piwik.org/docs/javascript-tracking/
|
||||
|
||||
var pkBaseURL = (("https:" === document.location.protocol) ? "https://" : "http://") + settings.baseURL + '/';
|
||||
|
||||
$('<script/>').attr('src', pkBaseURL + 'piwik.js').appendTo('body');
|
||||
$(window).load(function () {
|
||||
/*global Piwik */
|
||||
|
||||
var piwikTracker = Piwik.getTracker(pkBaseURL + 'piwik.php', settings.idSite);
|
||||
piwikTracker.trackPageView();
|
||||
piwikTracker.enableLinkTracking();
|
||||
});
|
||||
};
|
||||
|
||||
init();
|
||||
});
|
285
src/_h5ai/client/js/inc/ext/preview-img.js
Normal file
285
src/_h5ai/client/js/inc/ext/preview-img.js
Normal file
|
@ -0,0 +1,285 @@
|
|||
|
||||
modulejs.define('ext/preview-img', ['_', '$', 'core/settings', 'core/resource', 'core/store', 'core/event', 'core/entry'], function (_, $, allsettings, resource, store, event, entry) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false,
|
||||
types: ['bmp', 'gif', 'ico', 'image', 'jpg', 'png', 'tiff']
|
||||
}, allsettings['preview-img']),
|
||||
|
||||
template = '<div id="pv-img-overlay" class="noSelection">' +
|
||||
'<div id="pv-img-content">' +
|
||||
'<img id="pv-img-image"/>' +
|
||||
'</div>' +
|
||||
'<div id="pv-img-close"/>' +
|
||||
'<div id="pv-img-prev"/>' +
|
||||
'<div id="pv-img-next"/>' +
|
||||
'<div id="pv-img-bottombar" class="clearfix">' +
|
||||
'<ul id="pv-img-buttons">' +
|
||||
'<li id="pv-img-bar-size" class="bar-left bar-label"/>' +
|
||||
'<li id="pv-img-bar-percent" class="bar-left bar-label"/>' +
|
||||
'<li id="pv-img-bar-label" class="bar-left bar-label"/>' +
|
||||
'<li id="pv-img-bar-close" class="bar-right bar-button"><img src="' + resource.image('preview/close') + '"/></li>' +
|
||||
'<li id="pv-img-bar-original" class="bar-right"><a class="bar-button" target="_blank"><img src="' + resource.image('preview/raw') + '"/></a></li>' +
|
||||
'<li id="pv-img-bar-fullscreen" class="bar-right bar-button"><img src="' + resource.image('preview/fullscreen') + '"/></li>' +
|
||||
'<li id="pv-img-bar-next" class="bar-right bar-button"><img src="' + resource.image('preview/next') + '"/></li>' +
|
||||
'<li id="pv-img-bar-idx" class="bar-right bar-label"/>' +
|
||||
'<li id="pv-img-bar-prev" class="bar-right bar-button"><img src="' + resource.image('preview/prev') + '"/></li>' +
|
||||
'</ul>' +
|
||||
'</div>' +
|
||||
'</div>',
|
||||
|
||||
storekey = 'h5ai.preview-img.isFullscreen',
|
||||
|
||||
currentEntries = [],
|
||||
currentIdx = 0,
|
||||
isFullscreen = store.get(storekey) || false,
|
||||
|
||||
adjustSize = function () {
|
||||
|
||||
var rect = $(window).fracs('viewport'),
|
||||
$container = $('#pv-img-content'),
|
||||
$img = $('#pv-img-image'),
|
||||
margin = isFullscreen ? 0 : 20,
|
||||
barheight = isFullscreen ? 0 : 31;
|
||||
|
||||
$container.css({
|
||||
width: rect.width - 2 * margin,
|
||||
height: rect.height - 2 * margin - barheight,
|
||||
left: margin,
|
||||
top: margin
|
||||
});
|
||||
|
||||
var lr = ($container.width() - $img.width()) / 2,
|
||||
tb = ($container.height() - $img.height()) / 2;
|
||||
|
||||
$img.css({
|
||||
margin: '' + tb + 'px ' + lr + 'px'
|
||||
});
|
||||
|
||||
rect = $img.fracs('rect');
|
||||
if (!rect) {
|
||||
return;
|
||||
}
|
||||
rect = rect.relativeTo($('#pv-img-overlay').fracs('rect'));
|
||||
|
||||
$('#pv-img-prev').css({
|
||||
left: rect.left,
|
||||
top: rect.top,
|
||||
width: rect.width / 2,
|
||||
height: rect.height
|
||||
});
|
||||
$('#pv-img-next').css({
|
||||
left: rect.left + rect.width / 2,
|
||||
top: rect.top,
|
||||
width: rect.width / 2,
|
||||
height: rect.height
|
||||
});
|
||||
|
||||
if (isFullscreen) {
|
||||
$('#pv-img-overlay').addClass('fullscreen');
|
||||
$('#pv-img-bar-fullscreen').find('img').attr('src', resource.image('preview/no-fullscreen'));
|
||||
$('#pv-img-bottombar').fadeOut(400);
|
||||
} else {
|
||||
$('#pv-img-overlay').removeClass('fullscreen');
|
||||
$('#pv-img-bar-fullscreen').find('img').attr('src', resource.image('preview/fullscreen'));
|
||||
$('#pv-img-bottombar').fadeIn(200);
|
||||
}
|
||||
},
|
||||
|
||||
preloadImg = function (src, callback) {
|
||||
|
||||
var $hidden = $('<div><img/></div>')
|
||||
.css({
|
||||
position: 'absolute',
|
||||
overflow: 'hidden',
|
||||
width: 0,
|
||||
height: 0
|
||||
})
|
||||
.appendTo('body'),
|
||||
$img = $hidden.find('img')
|
||||
.one('load', function () {
|
||||
|
||||
var width = $img.width(),
|
||||
height = $img.height();
|
||||
|
||||
$hidden.remove();
|
||||
|
||||
callback(width, height);
|
||||
// setTimeout(function () { callback(width, height); }, 1000); // for testing
|
||||
})
|
||||
.attr('src', src);
|
||||
},
|
||||
|
||||
onIndexChange = function (idx) {
|
||||
|
||||
currentIdx = (idx + currentEntries.length) % currentEntries.length;
|
||||
|
||||
var $container = $('#pv-img-content'),
|
||||
$img = $('#pv-img-image'),
|
||||
src = currentEntries[currentIdx].absHref,
|
||||
spinnerTimeout = setTimeout(function () {
|
||||
|
||||
$container.spin({
|
||||
length: 12,
|
||||
width: 4,
|
||||
radius: 24,
|
||||
color: '#ccc',
|
||||
shadow: true
|
||||
});
|
||||
}, 200);
|
||||
|
||||
preloadImg(src, function (width, height) {
|
||||
|
||||
clearTimeout(spinnerTimeout);
|
||||
$container.spin(false);
|
||||
|
||||
$img.fadeOut(100, function () {
|
||||
|
||||
$img.attr('src', src).fadeIn(200);
|
||||
|
||||
// small timeout, so $img is visible and therefore $img.width is available
|
||||
setTimeout(function () {
|
||||
adjustSize();
|
||||
$('#pv-img-bar-percent').text('' + (100 * $img.width() / width).toFixed(0) + '%');
|
||||
$('#pv-img-bar-label').text(currentEntries[currentIdx].label);
|
||||
$('#pv-img-bar-size').text('' + width + 'x' + height);
|
||||
$('#pv-img-bar-idx').text('' + (currentIdx + 1) + ' / ' + currentEntries.length);
|
||||
$('#pv-img-bar-original').find('a').attr('href', currentEntries[currentIdx].absHref);
|
||||
}, 1);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
onEnter = function (entries, idx) {
|
||||
|
||||
$(window).on('keydown', onKeydown);
|
||||
$('#pv-img-overlay').stop(true, true).fadeIn(200);
|
||||
|
||||
currentEntries = entries;
|
||||
onIndexChange(idx);
|
||||
},
|
||||
|
||||
onNext = function () {
|
||||
|
||||
onIndexChange(currentIdx + 1);
|
||||
},
|
||||
|
||||
onPrevious = function () {
|
||||
|
||||
onIndexChange(currentIdx - 1);
|
||||
},
|
||||
|
||||
onExit = function () {
|
||||
|
||||
$(window).off('keydown', onKeydown);
|
||||
$('#pv-img-overlay').stop(true, true).fadeOut(200);
|
||||
},
|
||||
|
||||
onFullscreen = function () {
|
||||
|
||||
isFullscreen = !isFullscreen;
|
||||
store.put(storekey, isFullscreen);
|
||||
|
||||
adjustSize();
|
||||
},
|
||||
|
||||
onKeydown = function (event) {
|
||||
|
||||
var key = event.which;
|
||||
|
||||
if (key === 27) { // esc
|
||||
onExit();
|
||||
} else if (key === 8 || key === 37 || key === 40) { // backspace, left, down
|
||||
onPrevious();
|
||||
} else if (key === 13 || key === 32 || key === 38 || key === 39) { // enter, space, up, right
|
||||
onNext();
|
||||
} else if (key === 70) { // f
|
||||
onFullscreen();
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
},
|
||||
|
||||
initEntry = function (entry) {
|
||||
|
||||
if (entry.$extended && _.indexOf(settings.types, entry.type) >= 0) {
|
||||
entry.$extended.find('a').on('click', function (event) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
var matchedEntries = _.compact(_.map($('#extended .entry'), function (entry) {
|
||||
|
||||
entry = $(entry).data('entry');
|
||||
return _.indexOf(settings.types, entry.type) >= 0 ? entry : null;
|
||||
}));
|
||||
|
||||
onEnter(matchedEntries, _.indexOf(matchedEntries, entry));
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
init = function (entry) {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
_.each(entry.content, initEntry);
|
||||
|
||||
$(template).appendTo('body');
|
||||
$('#pv-img-bar-prev, #pv-img-prev').on('click', onPrevious);
|
||||
$('#pv-img-bar-next, #pv-img-next').on('click', onNext);
|
||||
$('#pv-img-bar-close, #pv-img-close').on('click', onExit);
|
||||
$('#pv-img-bar-fullscreen').on('click', onFullscreen);
|
||||
|
||||
$('#pv-img-prev')
|
||||
.on('mouseenter', function () {
|
||||
$('#pv-img-bar-prev').addClass('hover');
|
||||
})
|
||||
.on('mouseleave', function () {
|
||||
$('#pv-img-bar-prev').removeClass('hover');
|
||||
});
|
||||
|
||||
$('#pv-img-next')
|
||||
.on('mouseenter', function () {
|
||||
$('#pv-img-bar-next').addClass('hover');
|
||||
})
|
||||
.on('mouseleave', function () {
|
||||
$('#pv-img-bar-next').removeClass('hover');
|
||||
});
|
||||
|
||||
$('#pv-img-close')
|
||||
.on('mouseenter', function () {
|
||||
$('#pv-img-bar-close').addClass('hover');
|
||||
})
|
||||
.on('mouseleave', function () {
|
||||
$('#pv-img-bar-close').removeClass('hover');
|
||||
});
|
||||
|
||||
$('#pv-img-overlay')
|
||||
.on('keydown', onKeydown)
|
||||
.on('mousemove', function (event) {
|
||||
|
||||
if (isFullscreen) {
|
||||
var rect = $('#pv-img-overlay').fracs('rect');
|
||||
|
||||
if (rect.bottom - event.pageY < 64) {
|
||||
$('#pv-img-bottombar').fadeIn(200);
|
||||
} else {
|
||||
$('#pv-img-bottombar').fadeOut(400);
|
||||
}
|
||||
}
|
||||
})
|
||||
.on('click mousedown mousemove keydown keypress', function (event) {
|
||||
|
||||
event.stopImmediatePropagation();
|
||||
});
|
||||
|
||||
event.sub('entry.created', initEntry);
|
||||
|
||||
$(window).on('resize load', adjustSize);
|
||||
};
|
||||
|
||||
init(entry);
|
||||
});
|
264
src/_h5ai/client/js/inc/ext/preview-txt.js
Normal file
264
src/_h5ai/client/js/inc/ext/preview-txt.js
Normal file
|
@ -0,0 +1,264 @@
|
|||
|
||||
modulejs.define('ext/preview-txt', ['_', '$', 'core/settings', 'core/resource', 'core/store', 'core/event', 'core/entry'], function (_, $, allsettings, resource, store, event, entry) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false,
|
||||
types: {
|
||||
authors: 'plain',
|
||||
copying: 'plain',
|
||||
c: 'c',
|
||||
cpp: 'cpp',
|
||||
css: 'css',
|
||||
h: 'c',
|
||||
hpp: 'cpp',
|
||||
install: 'plain',
|
||||
log: 'plain',
|
||||
java: 'java',
|
||||
makefile: 'xml',
|
||||
markdown: 'plain',
|
||||
// php: 'php',
|
||||
python: 'python',
|
||||
readme: 'plain',
|
||||
rb: 'ruby',
|
||||
rtf: 'plain',
|
||||
script: 'shell',
|
||||
text: 'plain',
|
||||
js: 'js',
|
||||
xml: 'xml'
|
||||
}
|
||||
}, allsettings['preview-txt']),
|
||||
|
||||
template = '<div id="pv-txt-overlay" class="noSelection">' +
|
||||
'<div id="pv-txt-close"/>' +
|
||||
'<div id="pv-txt-content">' +
|
||||
'<div id="pv-txt-text"/>' +
|
||||
'</div>' +
|
||||
'<div id="pv-txt-bottombar" class="clearfix">' +
|
||||
'<ul id="pv-txt-buttons">' +
|
||||
'<li id="pv-txt-bar-size" class="bar-left bar-label"/>' +
|
||||
'<li id="pv-txt-bar-label" class="bar-left bar-label"/>' +
|
||||
'<li id="pv-txt-bar-close" class="bar-right bar-button"><img src="' + resource.image('preview/close') + '"/></li>' +
|
||||
'<li id="pv-txt-bar-original" class="bar-right"><a class="bar-button" target="_blank"><img src="' + resource.image('preview/raw') + '"/></a></li>' +
|
||||
'<li id="pv-txt-bar-next" class="bar-right bar-button"><img src="' + resource.image('preview/next') + '"/></li>' +
|
||||
'<li id="pv-txt-bar-idx" class="bar-right bar-label"/>' +
|
||||
'<li id="pv-txt-bar-prev" class="bar-right bar-button"><img src="' + resource.image('preview/prev') + '"/></li>' +
|
||||
'</ul>' +
|
||||
'</div>' +
|
||||
'</div>',
|
||||
|
||||
templateText = '<pre id="pv-txt-text"/>',
|
||||
templateMarkdown = '<div id="pv-txt-text" class="markdown"/>',
|
||||
|
||||
currentEntries = [],
|
||||
currentIdx = 0,
|
||||
|
||||
loadScript = function (url, globalId, callback) {
|
||||
|
||||
if (window[globalId]) {
|
||||
callback(window[globalId]);
|
||||
} else {
|
||||
$.ajax({
|
||||
url: url,
|
||||
dataType: 'script',
|
||||
complete: function () {
|
||||
|
||||
callback(window[globalId]);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
loadSyntaxhighlighter = function (callback) {
|
||||
|
||||
loadScript(allsettings.h5aiAbsHref + 'js/syntaxhighlighter.js', 'SyntaxHighlighter', callback);
|
||||
},
|
||||
loadMarkdown = function (callback) {
|
||||
|
||||
loadScript(allsettings.h5aiAbsHref + 'js/markdown.js', 'markdown', callback);
|
||||
},
|
||||
|
||||
adjustSize = function () {
|
||||
|
||||
var rect = $(window).fracs('viewport'),
|
||||
$container = $('#pv-txt-content'),
|
||||
margin = 20,
|
||||
barheight = 31;
|
||||
|
||||
$container.css({
|
||||
// width: rect.width - 2 * margin,
|
||||
height: rect.height - 2 * margin - barheight - 32,
|
||||
// left: margin,
|
||||
top: margin
|
||||
});
|
||||
},
|
||||
|
||||
preloadText = function (absHref, callback) {
|
||||
|
||||
$.ajax({
|
||||
url: absHref,
|
||||
dataType: 'text',
|
||||
success: function (content) {
|
||||
|
||||
callback(content);
|
||||
// setTimeout(function () { callback(content); }, 1000); // for testing
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
|
||||
callback('[ajax error] ' + textStatus);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
onIndexChange = function (idx) {
|
||||
|
||||
currentIdx = (idx + currentEntries.length) % currentEntries.length;
|
||||
|
||||
var $container = $('#pv-txt-content'),
|
||||
$text = $('#pv-txt-text'),
|
||||
current = currentEntries[currentIdx],
|
||||
spinnerTimeout = setTimeout(function () {
|
||||
|
||||
$container.spin({
|
||||
length: 12,
|
||||
width: 4,
|
||||
radius: 24,
|
||||
color: '#ccc',
|
||||
shadow: true
|
||||
});
|
||||
}, 200);
|
||||
|
||||
preloadText(current.absHref, function (content) {
|
||||
|
||||
clearTimeout(spinnerTimeout);
|
||||
$container.spin(false);
|
||||
|
||||
$text.fadeOut(100, function () {
|
||||
|
||||
var $nText;
|
||||
|
||||
if (current.type === 'markdown') {
|
||||
$nText = $(templateMarkdown).hide();
|
||||
$text.replaceWith($nText);
|
||||
|
||||
loadMarkdown(function (md) {
|
||||
|
||||
if (md) {
|
||||
$nText.html(md.toHTML(content));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$nText = $(templateText).hide().addClass('toolbar: false; brush:').addClass(settings.types[current.type] || 'plain').text(content);
|
||||
$text.replaceWith($nText);
|
||||
|
||||
loadSyntaxhighlighter(function (sh) {
|
||||
|
||||
if (sh) {
|
||||
sh.highlight({}, $nText[0]);
|
||||
}
|
||||
});
|
||||
}
|
||||
$nText.fadeIn(200);
|
||||
|
||||
adjustSize();
|
||||
$('#pv-txt-bar-label').text(current.label);
|
||||
$('#pv-txt-bar-size').text('' + current.size + ' bytes');
|
||||
$('#pv-txt-bar-idx').text('' + (currentIdx + 1) + ' / ' + currentEntries.length);
|
||||
$('#pv-txt-bar-original').find('a').attr('href', current.absHref);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
onEnter = function (entries, idx) {
|
||||
|
||||
$(window).on('keydown', onKeydown);
|
||||
$('#pv-txt-overlay').stop(true, true).fadeIn(200);
|
||||
|
||||
currentEntries = entries;
|
||||
onIndexChange(idx);
|
||||
},
|
||||
|
||||
onNext = function () {
|
||||
|
||||
onIndexChange(currentIdx + 1);
|
||||
},
|
||||
|
||||
onPrevious = function () {
|
||||
|
||||
onIndexChange(currentIdx - 1);
|
||||
},
|
||||
|
||||
onExit = function () {
|
||||
|
||||
$(window).off('keydown', onKeydown);
|
||||
$('#pv-txt-overlay').stop(true, true).fadeOut(200);
|
||||
},
|
||||
|
||||
onKeydown = function (event) {
|
||||
|
||||
var key = event.which;
|
||||
|
||||
if (key === 27) { // esc
|
||||
onExit();
|
||||
} else if (key === 8 || key === 37 || key === 40) { // backspace, left, down
|
||||
onPrevious();
|
||||
} else if (key === 13 || key === 32 || key === 38 || key === 39) { // enter, space, up, right
|
||||
onNext();
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
},
|
||||
|
||||
initEntry = function (entry) {
|
||||
|
||||
if (entry.$extended && _.indexOf(_.keys(settings.types), entry.type) >= 0) {
|
||||
entry.$extended.find('a').on('click', function (event) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
var matchedEntries = _.compact(_.map($('#extended .entry'), function (entry) {
|
||||
|
||||
entry = $(entry).data('entry');
|
||||
return _.indexOf(_.keys(settings.types), entry.type) >= 0 ? entry : null;
|
||||
}));
|
||||
|
||||
onEnter(matchedEntries, _.indexOf(matchedEntries, entry));
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
init = function (entry) {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
_.each(entry.content, initEntry);
|
||||
|
||||
$(template).appendTo('body');
|
||||
$('#pv-txt-bar-prev').on('click', onPrevious);
|
||||
$('#pv-txt-bar-next').on('click', onNext);
|
||||
$('#pv-txt-bar-close, #pv-txt-close').on('click', onExit);
|
||||
|
||||
$('#pv-txt-close')
|
||||
.on('mouseenter', function () {
|
||||
$('#pv-txt-bar-close').addClass('hover');
|
||||
})
|
||||
.on('mouseleave', function () {
|
||||
$('#pv-txt-bar-close').removeClass('hover');
|
||||
});
|
||||
|
||||
|
||||
$('#pv-txt-overlay')
|
||||
.on('keydown', onKeydown)
|
||||
.on('click mousedown mousemove keydown keypress', function (event) {
|
||||
|
||||
event.stopImmediatePropagation();
|
||||
});
|
||||
|
||||
event.sub('entry.created', initEntry);
|
||||
|
||||
$(window).on('resize load', adjustSize);
|
||||
};
|
||||
|
||||
init(entry);
|
||||
});
|
54
src/_h5ai/client/js/inc/ext/qrcode.js
Normal file
54
src/_h5ai/client/js/inc/ext/qrcode.js
Normal file
|
@ -0,0 +1,54 @@
|
|||
|
||||
modulejs.define('ext/qrcode', ['_', '$', 'modernizr', 'core/settings', 'core/event'], function (_, $, modernizr, allsettings, event) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false,
|
||||
size: 150
|
||||
}, allsettings.qrcode),
|
||||
|
||||
template = '<div id="qrcode"/>',
|
||||
|
||||
$qrcode, hideTimeoutId,
|
||||
|
||||
update = function (entry) {
|
||||
|
||||
$qrcode.empty().qrcode({
|
||||
render: modernizr.canvas ? 'canvas' : 'div',
|
||||
width: settings.size,
|
||||
height: settings.size,
|
||||
color: '#333',
|
||||
text: 'http://' + document.domain + entry.absHref
|
||||
});
|
||||
},
|
||||
|
||||
onMouseenter = function (entry) {
|
||||
|
||||
if (!entry.isFolder()) {
|
||||
update(entry);
|
||||
clearTimeout(hideTimeoutId);
|
||||
$qrcode.stop(true, true).fadeIn(400);
|
||||
}
|
||||
},
|
||||
|
||||
onMouseleave = function (entry) {
|
||||
|
||||
hideTimeoutId = setTimeout(function () {
|
||||
|
||||
$qrcode.stop(true, true).fadeOut(400);
|
||||
}, 200);
|
||||
},
|
||||
|
||||
init = function () {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
$qrcode = $(template).appendTo('body');
|
||||
|
||||
event.sub('entry.mouseenter', onMouseenter);
|
||||
event.sub('entry.mouseleave', onMouseleave);
|
||||
};
|
||||
|
||||
init();
|
||||
});
|
135
src/_h5ai/client/js/inc/ext/select.js
Normal file
135
src/_h5ai/client/js/inc/ext/select.js
Normal file
|
@ -0,0 +1,135 @@
|
|||
|
||||
modulejs.define('ext/select', ['_', '$', 'core/settings', 'core/event'], function (_, $, allsettings, event) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false
|
||||
}, allsettings.select),
|
||||
|
||||
x = 0, y = 0,
|
||||
l = 0, t = 0, w = 0, h = 0,
|
||||
shrink = 1/3,
|
||||
$document = $(document),
|
||||
$selectionRect = $('<div id="selection-rect"/>'),
|
||||
|
||||
publish = function () {
|
||||
|
||||
var entries = _.map($('#extended .entry.selected'), function (entryElement) {
|
||||
|
||||
return $(entryElement).data('entry');
|
||||
});
|
||||
|
||||
event.pub('selection', entries);
|
||||
},
|
||||
|
||||
selectionUpdate = function (event) {
|
||||
|
||||
l = Math.min(x, event.pageX);
|
||||
t = Math.min(y, event.pageY);
|
||||
w = Math.abs(x - event.pageX);
|
||||
h = Math.abs(y - event.pageY);
|
||||
|
||||
event.preventDefault();
|
||||
$selectionRect
|
||||
.stop(true, true)
|
||||
.css({left: l, top: t, width: w, height: h, opacity: 1})
|
||||
.show();
|
||||
|
||||
var selRect = $selectionRect.fracs('rect');
|
||||
$('#extended .entry').removeClass('selecting').each(function () {
|
||||
|
||||
var $entry = $(this),
|
||||
rect = $entry.find('a').fracs('rect'),
|
||||
inter = selRect.intersection(rect);
|
||||
if (inter && !$entry.hasClass('folder-parent')) {
|
||||
$entry.addClass('selecting');
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
selectionEnd = function (event) {
|
||||
|
||||
event.preventDefault();
|
||||
$document.off('mousemove', selectionUpdate);
|
||||
$('#extended .entry.selecting.selected').removeClass('selecting').removeClass('selected');
|
||||
$('#extended .entry.selecting').removeClass('selecting').addClass('selected');
|
||||
publish();
|
||||
|
||||
$selectionRect
|
||||
.stop(true, true)
|
||||
.animate(
|
||||
{
|
||||
left: l + w * 0.5 * shrink,
|
||||
top: t + h * 0.5 * shrink,
|
||||
width: w * (1 - shrink),
|
||||
height: h * (1 - shrink),
|
||||
opacity: 0
|
||||
},
|
||||
300,
|
||||
function () {
|
||||
$selectionRect.hide();
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
selectionStart = function (event) {
|
||||
|
||||
var view = $(document).fracs('viewport');
|
||||
|
||||
x = event.pageX;
|
||||
y = event.pageY;
|
||||
|
||||
// only on left button and don't block the scrollbars
|
||||
if (event.button !== 0 || x >= view.right || y >= view.bottom) {
|
||||
return;
|
||||
}
|
||||
|
||||
$(':focus').blur();
|
||||
if (!event.ctrlKey && !event.metaKey) {
|
||||
$('#extended .entry').removeClass('selected');
|
||||
publish();
|
||||
}
|
||||
|
||||
$document
|
||||
.on('mousemove', selectionUpdate)
|
||||
.one('mouseup', selectionEnd);
|
||||
|
||||
selectionUpdate(event);
|
||||
},
|
||||
|
||||
noSelection = function (event) {
|
||||
|
||||
event.stopImmediatePropagation();
|
||||
return false;
|
||||
},
|
||||
|
||||
noSelectionUnlessCtrl = function (event) {
|
||||
|
||||
if (!event.ctrlKey && !event.metaKey) {
|
||||
noSelection(event);
|
||||
}
|
||||
},
|
||||
|
||||
init = function () {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
$selectionRect.hide().appendTo('body');
|
||||
|
||||
event.sub('entry.removed', function (entry) {
|
||||
|
||||
if (entry.$extended && entry.$extended.hasClass('selected')) {
|
||||
entry.$extended.removeClass('selected');
|
||||
publish();
|
||||
}
|
||||
});
|
||||
|
||||
$document
|
||||
.on('mousedown', '.noSelection', noSelection)
|
||||
.on('mousedown', '.noSelectionUnlessCtrl,input,a', noSelectionUnlessCtrl)
|
||||
.on('mousedown', selectionStart);
|
||||
};
|
||||
|
||||
init();
|
||||
});
|
151
src/_h5ai/client/js/inc/ext/sort.js
Normal file
151
src/_h5ai/client/js/inc/ext/sort.js
Normal file
|
@ -0,0 +1,151 @@
|
|||
|
||||
modulejs.define('ext/sort', ['_', '$', 'core/settings', 'core/resource', 'core/event', 'core/store'], function (_, $, allsettings, resource, event, store) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false,
|
||||
order: 'na'
|
||||
}, allsettings.sort),
|
||||
|
||||
storekey = 'h5ai.sortorder',
|
||||
|
||||
type = function (entry) {
|
||||
|
||||
var $entry = $(entry);
|
||||
|
||||
if ($entry.hasClass('folder-parent')) {
|
||||
return 0;
|
||||
} else if ($entry.hasClass('folder')) {
|
||||
return 1;
|
||||
}
|
||||
return 2;
|
||||
},
|
||||
|
||||
cmpFn = function (rev, getVal) {
|
||||
|
||||
return function (entry1, entry2) {
|
||||
|
||||
var res, val1, val2;
|
||||
|
||||
res = type(entry1) - type(entry2);
|
||||
if (res !== 0) {
|
||||
return res;
|
||||
}
|
||||
|
||||
val1 = getVal(entry1);
|
||||
val2 = getVal(entry2);
|
||||
if (val1 < val2) {
|
||||
return rev ? 1 : -1;
|
||||
} else if (val1 > val2) {
|
||||
return rev ? -1 : 1;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
},
|
||||
|
||||
getName = function (entry) {
|
||||
|
||||
return $(entry).find('.label').text().toLowerCase();
|
||||
},
|
||||
getTime = function (entry) {
|
||||
|
||||
return $(entry).find('.date').data('time');
|
||||
},
|
||||
getSize = function (entry) {
|
||||
|
||||
return $(entry).find('.size').data('bytes');
|
||||
},
|
||||
|
||||
$all, orders,
|
||||
|
||||
sortBy = function (id) {
|
||||
|
||||
var order = orders[id];
|
||||
|
||||
store.put(storekey, id);
|
||||
|
||||
$all.removeClass('ascending').removeClass('descending');
|
||||
order.head.addClass(order.clas);
|
||||
$('#extended .entry').detach().sort(order.fn).appendTo('#extended > ul');
|
||||
},
|
||||
|
||||
onContentChanged = function (entry) {
|
||||
|
||||
sortBy(store.get(storekey) || settings.order);
|
||||
},
|
||||
|
||||
init = function () {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
var $ascending = $('<img src="' + resource.image('ascending') + '" class="sort ascending" alt="ascending" />'),
|
||||
$descending = $('<img src="' + resource.image('descending') + '" class="sort descending" alt="descending" />'),
|
||||
$header = $('#extended li.header'),
|
||||
$label = $header.find('a.label'),
|
||||
$date = $header.find('a.date'),
|
||||
$size = $header.find('a.size');
|
||||
|
||||
$all = $header.find('a.label,a.date,a.size');
|
||||
orders = {
|
||||
na: {
|
||||
head: $label,
|
||||
clas: 'ascending',
|
||||
fn: cmpFn(false, getName)
|
||||
},
|
||||
nd: {
|
||||
head: $label,
|
||||
clas: 'descending',
|
||||
fn: cmpFn(true, getName)
|
||||
},
|
||||
da: {
|
||||
head: $date,
|
||||
clas: 'ascending',
|
||||
fn: cmpFn(false, getTime)
|
||||
},
|
||||
dd: {
|
||||
head: $date,
|
||||
clas: 'descending',
|
||||
fn: cmpFn(true, getTime)
|
||||
},
|
||||
sa: {
|
||||
head: $size,
|
||||
clas: 'ascending',
|
||||
fn: cmpFn(false, getSize)
|
||||
},
|
||||
sd: {
|
||||
head: $size,
|
||||
clas: 'descending',
|
||||
fn: cmpFn(true, getSize)
|
||||
}
|
||||
};
|
||||
|
||||
sortBy(store.get(storekey) || settings.order);
|
||||
|
||||
$label
|
||||
.append($ascending.clone()).append($descending.clone())
|
||||
.click(function (event) {
|
||||
sortBy('n' + ($label.hasClass('ascending') ? 'd' : 'a'));
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
$date
|
||||
.prepend($ascending.clone()).prepend($descending.clone())
|
||||
.click(function (event) {
|
||||
sortBy('d' + ($date.hasClass('ascending') ? 'd' : 'a'));
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
$size
|
||||
.prepend($ascending.clone()).prepend($descending.clone())
|
||||
.click(function (event) {
|
||||
sortBy('s' + ($size.hasClass('ascending') ? 'd' : 'a'));
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
event.sub('entry.changed', onContentChanged);
|
||||
event.sub('entry.created', onContentChanged);
|
||||
};
|
||||
|
||||
init();
|
||||
});
|
93
src/_h5ai/client/js/inc/ext/statusbar.js
Normal file
93
src/_h5ai/client/js/inc/ext/statusbar.js
Normal file
|
@ -0,0 +1,93 @@
|
|||
|
||||
modulejs.define('ext/statusbar', ['_', '$', 'core/settings', 'core/format', 'core/event', 'core/entry'], function (_, $, allsettings, format, event, entry) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false
|
||||
}, allsettings.statusbar),
|
||||
|
||||
template = '<span class="statusbar">' +
|
||||
'<span class="status default">' +
|
||||
'<span class="folderTotal"/> <span class="l10n-folders"/>' +
|
||||
'<span class="sep"/>' +
|
||||
'<span class="fileTotal"/> <span class="l10n-files"/>' +
|
||||
'</span>' +
|
||||
'<span class="status dynamic"/>' +
|
||||
'</span>',
|
||||
sepTemplate = '<span class="sep"/>',
|
||||
|
||||
$statusDynamic,
|
||||
$statusDefault,
|
||||
|
||||
update = function (html) {
|
||||
|
||||
if (html) {
|
||||
$statusDefault.hide();
|
||||
$statusDynamic.empty().append(html).show();
|
||||
} else {
|
||||
$statusDynamic.empty().hide();
|
||||
$statusDefault.show();
|
||||
}
|
||||
},
|
||||
|
||||
init = function (entry) {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
var $statusbar = $(template),
|
||||
$folderTotal = $statusbar.find('.folderTotal'),
|
||||
$fileTotal = $statusbar.find('.fileTotal');
|
||||
|
||||
$statusDefault = $statusbar.find('.status.default');
|
||||
$statusDynamic = $statusbar.find('.status.dynamic');
|
||||
|
||||
var stats = entry.getStats();
|
||||
$folderTotal.text(stats.folders);
|
||||
$fileTotal.text(stats.files);
|
||||
|
||||
update();
|
||||
|
||||
event.sub('statusbar', update);
|
||||
$('#bottombar > .center').append($statusbar);
|
||||
|
||||
event.sub('entry.created', function () {
|
||||
|
||||
var stats = entry.getStats();
|
||||
$folderTotal.text(stats.folders);
|
||||
$fileTotal.text(stats.files);
|
||||
});
|
||||
|
||||
event.sub('entry.removed', function () {
|
||||
|
||||
var stats = entry.getStats();
|
||||
$folderTotal.text(stats.folders);
|
||||
$fileTotal.text(stats.files);
|
||||
});
|
||||
|
||||
event.sub('entry.mouseenter', function (entry) {
|
||||
|
||||
if (entry.isParentFolder) {
|
||||
return;
|
||||
}
|
||||
|
||||
var $span = $('<span/>').append(entry.label);
|
||||
|
||||
if (_.isNumber(entry.time)) {
|
||||
$span.append(sepTemplate).append(format.formatDate(entry.time));
|
||||
}
|
||||
if (_.isNumber(entry.size)) {
|
||||
$span.append(sepTemplate).append(format.formatSize(entry.size));
|
||||
}
|
||||
|
||||
update($span);
|
||||
});
|
||||
|
||||
event.sub('entry.mouseleave', function (entry) {
|
||||
|
||||
update();
|
||||
});
|
||||
};
|
||||
|
||||
init(entry);
|
||||
});
|
61
src/_h5ai/client/js/inc/ext/thumbnails.js
Normal file
61
src/_h5ai/client/js/inc/ext/thumbnails.js
Normal file
|
@ -0,0 +1,61 @@
|
|||
|
||||
modulejs.define('ext/thumbnails', ['_', 'core/settings', 'core/entry', 'core/event', 'core/ajax'], function (_, allsettings, entry, event, ajax) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false,
|
||||
img: ['bmp', 'gif', 'ico', 'image', 'jpg', 'png', 'tiff'],
|
||||
mov: ['video'],
|
||||
doc: ['pdf', 'ps'],
|
||||
delay: 1000
|
||||
}, allsettings.thumbnails),
|
||||
|
||||
checkEntry = function (entry) {
|
||||
|
||||
if (entry.$extended) {
|
||||
|
||||
var type = null;
|
||||
|
||||
if (_.indexOf(settings.img, entry.type) >= 0) {
|
||||
type = 'img';
|
||||
} else if (_.indexOf(settings.mov, entry.type) >= 0) {
|
||||
type = 'mov';
|
||||
} else if (_.indexOf(settings.doc, entry.type) >= 0) {
|
||||
type = 'doc';
|
||||
}
|
||||
|
||||
if (type) {
|
||||
ajax.getThumbSrcSmall(type, entry.absHref, function (src) {
|
||||
|
||||
if (src) {
|
||||
entry.$extended.find('.icon.small img').addClass('thumb').attr('src', src);
|
||||
}
|
||||
});
|
||||
ajax.getThumbSrcBig(type, entry.absHref, function (src) {
|
||||
|
||||
if (src) {
|
||||
entry.$extended.find('.icon.big img').addClass('thumb').attr('src', src);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
init = function (entry) {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
setTimeout(function () {
|
||||
|
||||
_.each(entry.content, checkEntry);
|
||||
}, settings.delay);
|
||||
|
||||
event.sub('entry.created', function (entry) {
|
||||
|
||||
checkEntry(entry);
|
||||
});
|
||||
};
|
||||
|
||||
init(entry);
|
||||
});
|
25
src/_h5ai/client/js/inc/ext/title.js
Normal file
25
src/_h5ai/client/js/inc/ext/title.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
|
||||
modulejs.define('ext/title', ['_', 'core/settings', 'core/entry'], function (_, allsettings, entry) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false
|
||||
}, allsettings.title),
|
||||
|
||||
init = function (entry) {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
var labels = _.pluck(entry.getCrumb(), 'label'),
|
||||
title = labels.join(' > ');
|
||||
|
||||
if (labels.length > 1) {
|
||||
title = labels[labels.length - 1] + ' - ' + title;
|
||||
}
|
||||
|
||||
document.title = title;
|
||||
};
|
||||
|
||||
init(entry);
|
||||
});
|
245
src/_h5ai/client/js/inc/ext/tree.js
Normal file
245
src/_h5ai/client/js/inc/ext/tree.js
Normal file
|
@ -0,0 +1,245 @@
|
|||
|
||||
modulejs.define('ext/tree', ['_', '$', 'core/settings', 'core/resource', 'core/event', 'core/entry', 'core/parser'], function (_, $, allsettings, resource, event, entry, parser) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false,
|
||||
slide: true
|
||||
}, allsettings.tree),
|
||||
|
||||
template = '<div class="entry">' +
|
||||
'<span class="indicator none">' +
|
||||
'<img src="' + resource.image('tree') + '"/>' +
|
||||
'</span>' +
|
||||
'<a>' +
|
||||
'<span class="icon"><img/></span>' +
|
||||
'<span class="label"/>' +
|
||||
'</a>' +
|
||||
'</span>',
|
||||
statusHintTemplate = '<span class="hint"/>',
|
||||
|
||||
// updates the tree for this single entry
|
||||
update = function (entry) {
|
||||
|
||||
var $html = $(template),
|
||||
$indicator = $html.find('.indicator'),
|
||||
$a = $html.find('a'),
|
||||
$img = $html.find('.icon img'),
|
||||
$label = $html.find('.label');
|
||||
|
||||
$html
|
||||
.addClass(entry.isFolder() ? 'folder' : 'file')
|
||||
.data('entry', entry)
|
||||
.data('status', entry.status);
|
||||
|
||||
$a.attr('href', entry.absHref);
|
||||
$img.attr('src', resource.icon(entry.type));
|
||||
$label.text(entry.label);
|
||||
|
||||
if (entry.isFolder()) {
|
||||
|
||||
var subfolders = entry.getSubfolders();
|
||||
|
||||
// indicator
|
||||
if (!entry.status || (entry.status === 'h5ai' && !entry.isContentFetched) || subfolders.length) {
|
||||
|
||||
$indicator.removeClass('none');
|
||||
|
||||
if (!entry.status || (entry.status === 'h5ai' && !entry.isContentFetched)) {
|
||||
$indicator.addClass('unknown');
|
||||
} else if (entry.isContentVisible) {
|
||||
$indicator.addClass('open');
|
||||
} else {
|
||||
$indicator.addClass('close');
|
||||
}
|
||||
}
|
||||
|
||||
// is it the domain?
|
||||
if (entry.isDomain()) {
|
||||
$html.addClass('domain');
|
||||
$img.attr('src', resource.icon('folder-home'));
|
||||
}
|
||||
|
||||
// is it the root?
|
||||
if (entry.isRoot()) {
|
||||
$html.addClass('root');
|
||||
$img.attr('src', resource.icon('folder-home'));
|
||||
}
|
||||
|
||||
// is it the current folder?
|
||||
if (entry.isCurrentFolder()) {
|
||||
$html.addClass('current');
|
||||
$img.attr('src', resource.icon('folder-open'));
|
||||
}
|
||||
|
||||
// does it have subfolders?
|
||||
if (subfolders.length) {
|
||||
var $ul = $('<ul class="content" />').appendTo($html);
|
||||
_.each(subfolders, function (e) {
|
||||
$('<li />').append(update(e)).appendTo($ul);
|
||||
});
|
||||
if (!entry.isContentVisible) {
|
||||
$ul.hide();
|
||||
}
|
||||
}
|
||||
|
||||
// reflect folder status
|
||||
if (_.isNumber(entry.status)) {
|
||||
if (entry.status === 200) {
|
||||
$img.attr('src', resource.icon('folder-page'));
|
||||
} else {
|
||||
$html.addClass('error');
|
||||
$a.append($(statusHintTemplate).text(entry.status));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (entry.$tree) {
|
||||
entry.$tree.replaceWith($html);
|
||||
}
|
||||
entry.$tree = $html;
|
||||
|
||||
return $html;
|
||||
},
|
||||
|
||||
createOnIndicatorClick = function (parser) {
|
||||
|
||||
var $tree = $('#tree'),
|
||||
slide = function (entry, $indicator, $content, down) {
|
||||
|
||||
entry.isContentVisible = down;
|
||||
$indicator.removeClass('open close').addClass(down ? 'open' : 'close');
|
||||
$tree.scrollpanel('update', true);
|
||||
$content[down ? 'slideDown' : 'slideUp'](function () {
|
||||
|
||||
$tree.scrollpanel('update');
|
||||
});
|
||||
};
|
||||
|
||||
return function () {
|
||||
|
||||
var $indicator = $(this),
|
||||
$entry = $indicator.closest('.entry'),
|
||||
entry = $entry.data('entry'),
|
||||
$content = $entry.find('> ul.content');
|
||||
|
||||
if ($indicator.hasClass('unknown')) {
|
||||
|
||||
entry.fetchContent(parser, function (entry) {
|
||||
|
||||
entry.isContentVisible = false;
|
||||
|
||||
var $entry = update(entry),
|
||||
$indicator = $entry.find('> .indicator'),
|
||||
$content = $entry.find('> ul.content');
|
||||
|
||||
if (!$indicator.hasClass('none')) {
|
||||
slide(entry, $indicator, $content, true);
|
||||
}
|
||||
});
|
||||
|
||||
} else if ($indicator.hasClass('open')) {
|
||||
|
||||
slide(entry, $indicator, $content, false);
|
||||
|
||||
} else if ($indicator.hasClass('close')) {
|
||||
|
||||
slide(entry, $indicator, $content, true);
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
shiftTree = function (forceVisible, dontAnimate) {
|
||||
|
||||
var $tree = $("#tree"),
|
||||
$extended = $("#extended"),
|
||||
left = ((settings.slide && $tree.outerWidth() < $extended.offset().left) || forceVisible || !$extended.is(':visible')) ? 0 : 18 - $tree.outerWidth();
|
||||
|
||||
if (dontAnimate) {
|
||||
$tree.stop().css({ left: left });
|
||||
} else {
|
||||
$tree.stop().animate({ left: left });
|
||||
}
|
||||
},
|
||||
|
||||
fetchTree = function (entry, parser, callback) {
|
||||
|
||||
entry.isContentVisible = true;
|
||||
entry.fetchContent(parser, function (entry) {
|
||||
|
||||
if (entry.parent) {
|
||||
fetchTree(entry.parent, parser, callback);
|
||||
} else {
|
||||
callback(entry);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
adjustSpacing = function () {
|
||||
|
||||
var $tree = $('#tree'),
|
||||
winHeight = $(window).height(),
|
||||
navHeight = $('#topbar').outerHeight(),
|
||||
footerHeight = $('#bottombar').outerHeight();
|
||||
|
||||
$tree.css({
|
||||
top: navHeight,
|
||||
height: winHeight - navHeight - footerHeight - 16
|
||||
});
|
||||
|
||||
$tree.scrollpanel('update');
|
||||
},
|
||||
|
||||
onContentChanged = function (entry) {
|
||||
|
||||
while (entry.parent) {
|
||||
entry = entry.parent;
|
||||
}
|
||||
|
||||
update(entry);
|
||||
},
|
||||
|
||||
// creates the complete tree from entry down to the root
|
||||
init = function (entry, parser) {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
var $tree = $('<div id="tree" />')
|
||||
.appendTo('body')
|
||||
.scrollpanel()
|
||||
.on('click', '.indicator', createOnIndicatorClick(parser))
|
||||
.on('mouseenter', function () {
|
||||
|
||||
shiftTree(true);
|
||||
})
|
||||
.on('mouseleave', function () {
|
||||
|
||||
shiftTree();
|
||||
});
|
||||
|
||||
fetchTree(entry, parser, function (root) {
|
||||
|
||||
$tree
|
||||
.find('.sp-container').append(update(root)).end()
|
||||
.show();
|
||||
|
||||
adjustSpacing();
|
||||
shiftTree(false, true);
|
||||
});
|
||||
|
||||
event.sub('ready', adjustSpacing);
|
||||
event.sub('entry.changed', onContentChanged);
|
||||
event.sub('entry.created', onContentChanged);
|
||||
event.sub('entry.removed', onContentChanged);
|
||||
|
||||
$(window).on('resize', function () {
|
||||
|
||||
adjustSpacing();
|
||||
shiftTree();
|
||||
});
|
||||
};
|
||||
|
||||
init(entry, parser);
|
||||
});
|
29
src/_h5ai/client/js/inc/h5ai-info.js
Normal file
29
src/_h5ai/client/js/inc/h5ai-info.js
Normal file
|
@ -0,0 +1,29 @@
|
|||
|
||||
modulejs.define('h5ai-info', ['$', 'core/ajax'], function ($, ajax) {
|
||||
|
||||
var setCheckResult = function (id, result) {
|
||||
|
||||
var $result = $(id).find('.test-result');
|
||||
|
||||
if (result) {
|
||||
$result.addClass('test-passed').text('yes');
|
||||
} else {
|
||||
$result.addClass('test-failed').text('no');
|
||||
}
|
||||
},
|
||||
|
||||
init = function () {
|
||||
|
||||
ajax.getChecks(function (json) {
|
||||
|
||||
if (json) {
|
||||
$('.test').each(function () {
|
||||
|
||||
setCheckResult(this, json[$(this).data('id')]);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
init();
|
||||
});
|
20
src/_h5ai/client/js/inc/h5ai-main.js
Normal file
20
src/_h5ai/client/js/inc/h5ai-main.js
Normal file
|
@ -0,0 +1,20 @@
|
|||
|
||||
modulejs.define('h5ai-main', ['_', 'core/event', 'core/settings'], function (_, event, settings) {
|
||||
|
||||
event.pub('beforeView');
|
||||
|
||||
modulejs.require('view/extended');
|
||||
modulejs.require('view/spacing');
|
||||
modulejs.require('view/viewmode');
|
||||
|
||||
event.pub('beforeExt');
|
||||
|
||||
_.each(modulejs.state(), function (state, id) {
|
||||
|
||||
if (/^ext\/.+/.test(id)) {
|
||||
modulejs.require(id);
|
||||
}
|
||||
});
|
||||
|
||||
event.pub('ready');
|
||||
});
|
344
src/_h5ai/client/js/inc/model/entry.js
Normal file
344
src/_h5ai/client/js/inc/model/entry.js
Normal file
|
@ -0,0 +1,344 @@
|
|||
|
||||
modulejs.define('model/entry', ['_', 'core/types', 'core/ajax', 'core/event', 'core/settings'], function (_, types, ajax, event, settings) {
|
||||
|
||||
var doc = document,
|
||||
domain = doc.domain,
|
||||
|
||||
forceEncoding = function (href) {
|
||||
|
||||
return href
|
||||
.replace(/\/+/g, '/')
|
||||
.replace(/ /g, '%20')
|
||||
.replace(/'/g, '%27')
|
||||
.replace(/\[/g, '%5B')
|
||||
.replace(/\]/g, '%5D')
|
||||
.replace(/\(/g, '%28')
|
||||
.replace(/\)/g, '%29')
|
||||
.replace(/\+/g, '%2B')
|
||||
.replace(/\=/g, '%3D');
|
||||
},
|
||||
|
||||
|
||||
location = (function () {
|
||||
|
||||
var rePrePathname = /.*:\/\/[^\/]*/,
|
||||
rePostPathname = /[^\/]*$/,
|
||||
|
||||
uriToPathname = function (uri) {
|
||||
|
||||
return uri.replace(rePrePathname, '').replace(rePostPathname, '');
|
||||
},
|
||||
|
||||
testpathname = '/a b',
|
||||
a = doc.createElement('a'),
|
||||
isDecoded, location;
|
||||
|
||||
a.href = testpathname;
|
||||
isDecoded = uriToPathname(a.href) === testpathname;
|
||||
|
||||
a.href = doc.location.href;
|
||||
location = uriToPathname(a.href);
|
||||
|
||||
if (isDecoded) {
|
||||
location = encodeURIComponent(location).replace(/%2F/ig, '/');
|
||||
}
|
||||
|
||||
return forceEncoding(location);
|
||||
}()),
|
||||
|
||||
folderstatus = (function () {
|
||||
|
||||
try { return modulejs.require('ext/folderstatus'); } catch (e) {}
|
||||
return {};
|
||||
}()),
|
||||
|
||||
|
||||
|
||||
// utils
|
||||
|
||||
reEndsWithSlash = /\/$/,
|
||||
|
||||
|
||||
startsWith = function (sequence, part) {
|
||||
|
||||
return sequence.length >= part.length && sequence.slice(0, part.length) === part;
|
||||
},
|
||||
|
||||
|
||||
createLabel = function (sequence) {
|
||||
|
||||
sequence = sequence.replace(reEndsWithSlash, '');
|
||||
try { sequence = decodeURIComponent(sequence); } catch (e) {}
|
||||
return sequence;
|
||||
},
|
||||
|
||||
|
||||
reSplitPath = /^(.*\/)([^\/]+\/?)$/,
|
||||
|
||||
splitPath = function (sequence) {
|
||||
|
||||
if (sequence === '/') {
|
||||
return { parent: null, name: '/' };
|
||||
}
|
||||
|
||||
var match = reSplitPath.exec(sequence);
|
||||
if (match) {
|
||||
var split = { parent: match[1], name: match[2] };
|
||||
|
||||
if (split.parent && !startsWith(split.parent, settings.rootAbsHref)) {
|
||||
split.parent = null;
|
||||
}
|
||||
return split;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
ajaxRequest = function (self, parser, callback) {
|
||||
|
||||
ajax.getStatus(self.absHref, parser, function (response) {
|
||||
|
||||
self.status = response.status;
|
||||
if (parser && response.status === 'h5ai') {
|
||||
parser.parse(self.absHref, response.content);
|
||||
}
|
||||
callback(self);
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
|
||||
// Cache
|
||||
|
||||
cache = {},
|
||||
|
||||
getEntry = function (absHref, time, size, status, isContentFetched) {
|
||||
|
||||
absHref = forceEncoding(absHref || location);
|
||||
|
||||
if (!startsWith(absHref, settings.rootAbsHref)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var created = !cache[absHref],
|
||||
changed = false;
|
||||
|
||||
var self = cache[absHref] || new Entry(absHref);
|
||||
|
||||
if (_.isNumber(time)) {
|
||||
if (self.time !== time) {
|
||||
changed = true;
|
||||
}
|
||||
self.time = time;
|
||||
}
|
||||
if (_.isNumber(size)) {
|
||||
if (self.size !== size) {
|
||||
changed = true;
|
||||
}
|
||||
self.size = size;
|
||||
}
|
||||
if (status) {
|
||||
if (self.status !== status) {
|
||||
changed = true;
|
||||
}
|
||||
self.status = status;
|
||||
}
|
||||
if (isContentFetched) {
|
||||
self.isContentFetched = true;
|
||||
}
|
||||
|
||||
if (created) {
|
||||
event.pub('entry.created', self);
|
||||
} else if (changed) {
|
||||
event.pub('entry.changed', self);
|
||||
}
|
||||
|
||||
return self;
|
||||
},
|
||||
|
||||
removeEntry = function (absHref) {
|
||||
|
||||
absHref = forceEncoding(absHref || location);
|
||||
|
||||
var self = cache[absHref];
|
||||
|
||||
if (self) {
|
||||
delete cache[absHref];
|
||||
if (self.parent) {
|
||||
delete self.parent.content[self.absHref];
|
||||
}
|
||||
_.each(self.content, function (entry) {
|
||||
|
||||
removeEntry(entry.absHref);
|
||||
});
|
||||
|
||||
event.pub('entry.removed', self);
|
||||
}
|
||||
},
|
||||
|
||||
fetchStatus = function (absHref, callback) {
|
||||
|
||||
var self = getEntry(absHref);
|
||||
|
||||
if (self.status || !self.isFolder()) {
|
||||
callback(self);
|
||||
} else if (folderstatus[absHref]) {
|
||||
self.status = folderstatus[absHref];
|
||||
callback(self);
|
||||
} else {
|
||||
ajaxRequest(self, null, callback);
|
||||
}
|
||||
},
|
||||
|
||||
fetchContent = function (absHref, parser, callback) {
|
||||
|
||||
var self = getEntry(absHref);
|
||||
|
||||
if (self.isContentFetched) {
|
||||
callback(self);
|
||||
} else {
|
||||
fetchStatus(absHref, function (self) {
|
||||
|
||||
self.isContentFetched = true;
|
||||
if (self.status === 'h5ai') {
|
||||
ajaxRequest(self, parser, callback);
|
||||
} else {
|
||||
callback(self);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Entry
|
||||
|
||||
var Entry = function (absHref) {
|
||||
|
||||
var split = splitPath(absHref);
|
||||
|
||||
cache[absHref] = this;
|
||||
|
||||
this.absHref = absHref;
|
||||
this.type = types.getType(absHref);
|
||||
this.label = createLabel(absHref === '/' ? domain : split.name);
|
||||
this.time = null;
|
||||
this.size = null;
|
||||
this.parent = null;
|
||||
this.status = null;
|
||||
this.content = {};
|
||||
|
||||
if (split.parent) {
|
||||
this.parent = getEntry(split.parent);
|
||||
this.parent.content[this.absHref] = this;
|
||||
if (_.keys(this.parent.content).length > 1) {
|
||||
this.parent.isContentFetched = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
_.extend(Entry.prototype, {
|
||||
|
||||
isFolder: function () {
|
||||
|
||||
return reEndsWithSlash.test(this.absHref);
|
||||
},
|
||||
|
||||
isCurrentFolder: function () {
|
||||
|
||||
return this.absHref === location;
|
||||
},
|
||||
|
||||
isInCurrentFolder: function () {
|
||||
|
||||
return !!this.parent && this.parent.isCurrentFolder();
|
||||
},
|
||||
|
||||
isDomain: function () {
|
||||
|
||||
return this.absHref === '/';
|
||||
},
|
||||
|
||||
isRoot: function () {
|
||||
|
||||
return this.absHref === settings.rootAbsHref;
|
||||
},
|
||||
|
||||
isH5ai: function () {
|
||||
|
||||
return this.absHref === settings.h5aiAbsHref;
|
||||
},
|
||||
|
||||
isEmpty: function () {
|
||||
|
||||
return _.keys(this.content).length === 0;
|
||||
},
|
||||
|
||||
fetchStatus: function (callback) {
|
||||
|
||||
return fetchStatus(this.absHref, callback);
|
||||
},
|
||||
|
||||
fetchContent: function (parser, callback) {
|
||||
|
||||
return fetchContent(this.absHref, parser, callback);
|
||||
},
|
||||
|
||||
getCrumb: function () {
|
||||
|
||||
var entry = this,
|
||||
crumb = [entry];
|
||||
|
||||
while (entry.parent) {
|
||||
entry = entry.parent;
|
||||
crumb.unshift(entry);
|
||||
}
|
||||
|
||||
return crumb;
|
||||
},
|
||||
|
||||
getSubfolders: function () {
|
||||
|
||||
return _.sortBy(_.filter(this.content, function (entry) {
|
||||
|
||||
return entry.isFolder();
|
||||
}), function (entry) {
|
||||
|
||||
return entry.label.toLowerCase();
|
||||
});
|
||||
},
|
||||
|
||||
getStats: function () {
|
||||
|
||||
var folders = 0,
|
||||
files = 0;
|
||||
|
||||
_.each(this.content, function (entry) {
|
||||
|
||||
if (entry.isFolder()) {
|
||||
folders += 1;
|
||||
} else {
|
||||
files += 1;
|
||||
}
|
||||
});
|
||||
|
||||
var depth = 0,
|
||||
entry = this;
|
||||
|
||||
while (entry.parent) {
|
||||
depth += 1;
|
||||
entry = entry.parent;
|
||||
}
|
||||
|
||||
return {
|
||||
folders: folders,
|
||||
files: files,
|
||||
depth: depth
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
get: getEntry,
|
||||
remove: removeEntry
|
||||
};
|
||||
});
|
47
src/_h5ai/client/js/inc/parser/apache-autoindex.js
Normal file
47
src/_h5ai/client/js/inc/parser/apache-autoindex.js
Normal file
|
@ -0,0 +1,47 @@
|
|||
|
||||
modulejs.define('parser/apache-autoindex', ['_', '$', 'core/mode', 'core/settings', 'core/format', 'model/entry'], function (_, $, mode, settings, format, Entry) {
|
||||
|
||||
var parseTableRow = function (absHref, tr) {
|
||||
|
||||
var $tds = $(tr).find('td'),
|
||||
$a = $tds.eq(1).find('a'),
|
||||
label = $a.text(),
|
||||
time = format.parseDate($tds.eq(2).text(), ['YYYY-MM-DD HH:mm', 'DD-MMM-YYYY HH:mm']),
|
||||
size = format.parseSize($tds.eq(3).text());
|
||||
|
||||
absHref = absHref + $a.attr('href');
|
||||
|
||||
return label === 'Parent Directory' ? null : Entry.get(absHref, time, size);
|
||||
},
|
||||
|
||||
parseTable = function (absHref, table) {
|
||||
|
||||
return _.compact(_.map($(table).find('td').closest('tr'), function (tr) {
|
||||
|
||||
return parseTableRow(absHref, tr);
|
||||
}));
|
||||
},
|
||||
|
||||
parse = function (absHref, html) {
|
||||
|
||||
var id = '#data-apache-autoindex',
|
||||
$html = $(html),
|
||||
$id = $html.filter(id);
|
||||
|
||||
if (!$id.length) {
|
||||
$id = $html.find(id);
|
||||
}
|
||||
|
||||
return parseTable(absHref, $id.find('table'));
|
||||
};
|
||||
|
||||
mode.id = 'aai';
|
||||
mode.dataType = 'apache-autoindex';
|
||||
mode.serverName = 'apache';
|
||||
mode.serverVersion = null;
|
||||
|
||||
return {
|
||||
dataType: 'apache-autoindex',
|
||||
parse: parse
|
||||
};
|
||||
});
|
49
src/_h5ai/client/js/inc/parser/generic-json.js
Normal file
49
src/_h5ai/client/js/inc/parser/generic-json.js
Normal file
|
@ -0,0 +1,49 @@
|
|||
|
||||
modulejs.define('parser/generic-json', ['_', '$', 'core/mode', 'core/settings', 'model/entry'], function (_, $, mode, settings, Entry) {
|
||||
|
||||
var parseJson = function (absHref, json) {
|
||||
|
||||
mode.id = json.id;
|
||||
mode.serverName = json.serverName;
|
||||
mode.serverVersion = json.serverVersion;
|
||||
|
||||
if (!settings.custom) {
|
||||
settings.custom = {};
|
||||
}
|
||||
if (_.has(json, 'customHeader')) {
|
||||
settings.custom.header = json.customHeader;
|
||||
}
|
||||
if (_.has(json, 'customFooter')) {
|
||||
settings.custom.footer = json.customFooter;
|
||||
}
|
||||
return _.map(json.entries, function (jsonEntry) {
|
||||
|
||||
return Entry.get(jsonEntry.absHref, jsonEntry.time, jsonEntry.size, jsonEntry.status, jsonEntry.content);
|
||||
});
|
||||
},
|
||||
|
||||
parseJsonStr = function (absHref, jsonStr) {
|
||||
|
||||
return parseJson(absHref, JSON.parse($.trim(jsonStr) || '{}'));
|
||||
},
|
||||
|
||||
parse = function (absHref, html) {
|
||||
|
||||
var id = '#data-generic-json',
|
||||
$html = $(html),
|
||||
$id = $html.filter(id);
|
||||
|
||||
if (!$id.length) {
|
||||
$id = $html.find(id);
|
||||
}
|
||||
|
||||
return parseJsonStr(absHref, $id.text());
|
||||
};
|
||||
|
||||
mode.dataType = 'generic-json';
|
||||
|
||||
return {
|
||||
dataType: 'generic-json',
|
||||
parse: parse
|
||||
};
|
||||
});
|
162
src/_h5ai/client/js/inc/view/extended.js
Normal file
162
src/_h5ai/client/js/inc/view/extended.js
Normal file
|
@ -0,0 +1,162 @@
|
|||
|
||||
modulejs.define('view/extended', ['_', '$', 'core/settings', 'core/resource', 'core/format', 'core/event', 'core/entry'], function (_, $, allsettings, resource, format, event, entry) {
|
||||
|
||||
var settings = _.extend({
|
||||
modes: ['details', 'icons'],
|
||||
setParentFolderLabels: false,
|
||||
binaryPrefix: false
|
||||
}, allsettings.view),
|
||||
|
||||
template = '<li class="entry">' +
|
||||
'<a>' +
|
||||
'<span class="icon small"><img/></span>' +
|
||||
'<span class="icon big"><img/></span>' +
|
||||
'<span class="label"/>' +
|
||||
'<span class="date"/>' +
|
||||
'<span class="size"/>' +
|
||||
'</a>' +
|
||||
'</li>',
|
||||
hintTemplate = '<span class="hint"/>',
|
||||
listTemplate = '<ul>' +
|
||||
'<li class="header">' +
|
||||
'<a class="icon"/>' +
|
||||
'<a class="label" href="#"><span class="l10n-name"></span></a>' +
|
||||
'<a class="date" href="#"><span class="l10n-lastModified"></span></a>' +
|
||||
'<a class="size" href="#"><span class="l10n-size"></span></a>' +
|
||||
'</li>' +
|
||||
'</ul>',
|
||||
emptyTemplate = '<div class="empty l10n-empty"/>',
|
||||
|
||||
// updates this single entry
|
||||
update = function (entry, force) {
|
||||
|
||||
if (!force && entry.$extended && entry.status && entry.$extended.data('status') === entry.status) {
|
||||
return entry.$extended;
|
||||
}
|
||||
|
||||
var $html = $(template),
|
||||
$a = $html.find('a'),
|
||||
$imgSmall = $html.find('.icon.small img'),
|
||||
$imgBig = $html.find('.icon.big img'),
|
||||
$label = $html.find('.label'),
|
||||
$date = $html.find('.date'),
|
||||
$size = $html.find('.size');
|
||||
// escapedHref = entry.absHref.replace(/'/g, "%27").replace(/"/g, "%22");
|
||||
|
||||
$html
|
||||
.addClass(entry.isFolder() ? 'folder' : 'file')
|
||||
.data('entry', entry)
|
||||
.data('status', entry.status);
|
||||
|
||||
$a.attr('href', entry.absHref);
|
||||
$imgSmall.attr('src', resource.icon(entry.type)).attr('alt', entry.type);
|
||||
$imgBig.attr('src', resource.icon(entry.type, true)).attr('alt', entry.type);
|
||||
$label.text(entry.label);
|
||||
$date.data('time', entry.time).text(format.formatDate(entry.time));
|
||||
$size.data('bytes', entry.size).text(format.formatSize(entry.size));
|
||||
|
||||
if (entry.isFolder() && _.isNumber(entry.status)) {
|
||||
if (entry.status === 200) {
|
||||
$html.addClass('page');
|
||||
$imgSmall.attr('src', resource.icon('folder-page'));
|
||||
$imgBig.attr('src', resource.icon('folder-page', true));
|
||||
} else {
|
||||
$html.addClass('error');
|
||||
$label.append($(hintTemplate).text(' ' + entry.status + ' '));
|
||||
}
|
||||
}
|
||||
|
||||
if (entry.isParentFolder) {
|
||||
$imgSmall.attr('src', resource.icon('folder-parent'));
|
||||
$imgBig.attr('src', resource.icon('folder-parent', true));
|
||||
if (!settings.setParentFolderLabels) {
|
||||
$label.addClass('l10n-parentDirectory');
|
||||
}
|
||||
$html.addClass('folder-parent');
|
||||
}
|
||||
|
||||
if (entry.$extended) {
|
||||
entry.$extended.replaceWith($html);
|
||||
}
|
||||
entry.$extended = $html;
|
||||
|
||||
return $html;
|
||||
},
|
||||
|
||||
onMouseenter = function () {
|
||||
|
||||
var entry = $(this).closest('.entry').data('entry');
|
||||
event.pub('entry.mouseenter', entry);
|
||||
},
|
||||
|
||||
onMouseleave = function () {
|
||||
|
||||
var entry = $(this).closest('.entry').data('entry');
|
||||
event.pub('entry.mouseleave', entry);
|
||||
},
|
||||
|
||||
// creates the view for entry content
|
||||
init = function (entry) {
|
||||
|
||||
var $extended = $('#extended'),
|
||||
$ul = $(listTemplate),
|
||||
$emtpy = $(emptyTemplate);
|
||||
|
||||
format.setDefaultMetric(settings.binaryPrefix);
|
||||
|
||||
if (entry.parent) {
|
||||
$ul.append(update(entry.parent));
|
||||
}
|
||||
|
||||
_.each(entry.content, function (e) {
|
||||
|
||||
$ul.append(update(e));
|
||||
|
||||
e.fetchStatus(function (e) {
|
||||
|
||||
update(e);
|
||||
});
|
||||
});
|
||||
|
||||
$extended.append($ul);
|
||||
$extended.append($emtpy);
|
||||
|
||||
if (!entry.isEmpty()) {
|
||||
$emtpy.hide();
|
||||
}
|
||||
|
||||
$extended
|
||||
.on('mouseenter', '.entry a', onMouseenter)
|
||||
.on('mouseleave', '.entry a', onMouseleave);
|
||||
|
||||
event.sub('entry.changed', function (entry) {
|
||||
|
||||
if (entry.isInCurrentFolder() && entry.$extended) {
|
||||
update(entry, true);
|
||||
}
|
||||
});
|
||||
|
||||
event.sub('entry.created', function (entry) {
|
||||
|
||||
if (entry.isInCurrentFolder() && !entry.$extended) {
|
||||
update(entry, true).hide().appendTo($ul).slideDown(400);
|
||||
$emtpy.slideUp(400);
|
||||
}
|
||||
});
|
||||
|
||||
event.sub('entry.removed', function (entry) {
|
||||
|
||||
if (entry.isInCurrentFolder() && entry.$extended) {
|
||||
entry.$extended.slideUp(400, function () {
|
||||
entry.$extended.remove();
|
||||
|
||||
if (entry.parent.isEmpty()) {
|
||||
$emtpy.slideDown(400);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
init(entry);
|
||||
});
|
33
src/_h5ai/client/js/inc/view/spacing.js
Normal file
33
src/_h5ai/client/js/inc/view/spacing.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
|
||||
modulejs.define('view/spacing', ['_', '$', 'core/settings', 'core/event'], function (_, $, allsettings, event) {
|
||||
|
||||
var settings = _.extend({
|
||||
maxWidth: 960,
|
||||
top: 50,
|
||||
right: "auto",
|
||||
bottom: 50,
|
||||
left: "auto"
|
||||
}, allsettings.spacing),
|
||||
|
||||
adjustSpacing = function () {
|
||||
|
||||
$('#content').css({
|
||||
'margin-top': settings.top + $('#topbar').outerHeight(),
|
||||
'margin-bottom': settings.bottom + $('#bottombar').outerHeight()
|
||||
});
|
||||
},
|
||||
|
||||
init = function () {
|
||||
|
||||
$('#content').css({
|
||||
'max-width': settings.maxWidth,
|
||||
'margin-right': settings.right,
|
||||
'margin-left': settings.left
|
||||
});
|
||||
|
||||
event.sub('ready', adjustSpacing);
|
||||
$(window).on('resize', adjustSpacing);
|
||||
};
|
||||
|
||||
init();
|
||||
});
|
61
src/_h5ai/client/js/inc/view/viewmode.js
Normal file
61
src/_h5ai/client/js/inc/view/viewmode.js
Normal file
|
@ -0,0 +1,61 @@
|
|||
|
||||
modulejs.define('view/viewmode', ['_', '$', 'core/settings', 'core/resource', 'core/store'], function (_, $, allsettings, resource, store) {
|
||||
|
||||
var defaults = {
|
||||
modes: ['details', 'list', 'grid', 'icons'],
|
||||
setParentFolderLabels: false
|
||||
},
|
||||
|
||||
settings = _.extend({}, defaults, allsettings.view),
|
||||
|
||||
storekey = 'h5ai.viewmode',
|
||||
|
||||
template = '<li id="view-[MODE]" class="view">' +
|
||||
'<a href="#">' +
|
||||
'<img src="' + resource.image('view-[MODE]') + '" alt="view-[MODE]"/>' +
|
||||
'<span class="l10n-[MODE]"/>' +
|
||||
'</a>' +
|
||||
'</li>',
|
||||
|
||||
update = function (viewmode) {
|
||||
|
||||
var $extended = $('#extended');
|
||||
|
||||
viewmode = _.indexOf(settings.modes, viewmode) >= 0 ? viewmode : settings.modes[0];
|
||||
store.put(storekey, viewmode);
|
||||
|
||||
_.each(defaults.modes, function (mode) {
|
||||
if (mode === viewmode) {
|
||||
$('#view-' + mode).addClass('current');
|
||||
$extended.addClass('view-' + mode).show();
|
||||
} else {
|
||||
$('#view-' + mode).removeClass('current');
|
||||
$extended.removeClass('view-' + mode);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
init = function () {
|
||||
|
||||
var $navbar = $('#navbar');
|
||||
|
||||
settings.modes = _.intersection(settings.modes, defaults.modes);
|
||||
|
||||
if (settings.modes.length > 1) {
|
||||
_.each(defaults.modes.reverse(), function (mode) {
|
||||
if (_.indexOf(settings.modes, mode) >= 0) {
|
||||
$(template.replace(/\[MODE\]/g, mode))
|
||||
.appendTo($navbar)
|
||||
.on('click', 'a', function (event) {
|
||||
update(mode);
|
||||
event.preventDefault();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
update(store.get(storekey));
|
||||
};
|
||||
|
||||
init();
|
||||
});
|
788
src/_h5ai/client/js/lib/amplify-1.1.0.js
Normal file
788
src/_h5ai/client/js/lib/amplify-1.1.0.js
Normal file
|
@ -0,0 +1,788 @@
|
|||
/*!
|
||||
* AmplifyJS 1.1.0 - Core, Store, Request
|
||||
*
|
||||
* Copyright 2011 appendTo LLC. (http://appendto.com/team)
|
||||
* Dual licensed under the MIT or GPL licenses.
|
||||
* http://appendto.com/open-source-licenses
|
||||
*
|
||||
* http://amplifyjs.com
|
||||
*/
|
||||
/*!
|
||||
* Amplify Core 1.1.0
|
||||
*
|
||||
* Copyright 2011 appendTo LLC. (http://appendto.com/team)
|
||||
* Dual licensed under the MIT or GPL licenses.
|
||||
* http://appendto.com/open-source-licenses
|
||||
*
|
||||
* http://amplifyjs.com
|
||||
*/
|
||||
(function( global, undefined ) {
|
||||
|
||||
var slice = [].slice,
|
||||
subscriptions = {};
|
||||
|
||||
var amplify = global.amplify = {
|
||||
publish: function( topic ) {
|
||||
var args = slice.call( arguments, 1 ),
|
||||
topicSubscriptions,
|
||||
subscription,
|
||||
length,
|
||||
i = 0,
|
||||
ret;
|
||||
|
||||
if ( !subscriptions[ topic ] ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
topicSubscriptions = subscriptions[ topic ].slice();
|
||||
for ( length = topicSubscriptions.length; i < length; i++ ) {
|
||||
subscription = topicSubscriptions[ i ];
|
||||
ret = subscription.callback.apply( subscription.context, args );
|
||||
if ( ret === false ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret !== false;
|
||||
},
|
||||
|
||||
subscribe: function( topic, context, callback, priority ) {
|
||||
if ( arguments.length === 3 && typeof callback === "number" ) {
|
||||
priority = callback;
|
||||
callback = context;
|
||||
context = null;
|
||||
}
|
||||
if ( arguments.length === 2 ) {
|
||||
callback = context;
|
||||
context = null;
|
||||
}
|
||||
priority = priority || 10;
|
||||
|
||||
var topicIndex = 0,
|
||||
topics = topic.split( /\s/ ),
|
||||
topicLength = topics.length,
|
||||
added;
|
||||
for ( ; topicIndex < topicLength; topicIndex++ ) {
|
||||
topic = topics[ topicIndex ];
|
||||
added = false;
|
||||
if ( !subscriptions[ topic ] ) {
|
||||
subscriptions[ topic ] = [];
|
||||
}
|
||||
|
||||
var i = subscriptions[ topic ].length - 1,
|
||||
subscriptionInfo = {
|
||||
callback: callback,
|
||||
context: context,
|
||||
priority: priority
|
||||
};
|
||||
|
||||
for ( ; i >= 0; i-- ) {
|
||||
if ( subscriptions[ topic ][ i ].priority <= priority ) {
|
||||
subscriptions[ topic ].splice( i + 1, 0, subscriptionInfo );
|
||||
added = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !added ) {
|
||||
subscriptions[ topic ].unshift( subscriptionInfo );
|
||||
}
|
||||
}
|
||||
|
||||
return callback;
|
||||
},
|
||||
|
||||
unsubscribe: function( topic, callback ) {
|
||||
if ( !subscriptions[ topic ] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var length = subscriptions[ topic ].length,
|
||||
i = 0;
|
||||
|
||||
for ( ; i < length; i++ ) {
|
||||
if ( subscriptions[ topic ][ i ].callback === callback ) {
|
||||
subscriptions[ topic ].splice( i, 1 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}( this ) );
|
||||
/*!
|
||||
* Amplify Store - Persistent Client-Side Storage 1.1.0
|
||||
*
|
||||
* Copyright 2011 appendTo LLC. (http://appendto.com/team)
|
||||
* Dual licensed under the MIT or GPL licenses.
|
||||
* http://appendto.com/open-source-licenses
|
||||
*
|
||||
* http://amplifyjs.com
|
||||
*/
|
||||
(function( amplify, undefined ) {
|
||||
|
||||
var store = amplify.store = function( key, value, options, type ) {
|
||||
var type = store.type;
|
||||
if ( options && options.type && options.type in store.types ) {
|
||||
type = options.type;
|
||||
}
|
||||
return store.types[ type ]( key, value, options || {} );
|
||||
};
|
||||
|
||||
store.types = {};
|
||||
store.type = null;
|
||||
store.addType = function( type, storage ) {
|
||||
if ( !store.type ) {
|
||||
store.type = type;
|
||||
}
|
||||
|
||||
store.types[ type ] = storage;
|
||||
store[ type ] = function( key, value, options ) {
|
||||
options = options || {};
|
||||
options.type = type;
|
||||
return store( key, value, options );
|
||||
};
|
||||
}
|
||||
store.error = function() {
|
||||
return "amplify.store quota exceeded";
|
||||
};
|
||||
|
||||
var rprefix = /^__amplify__/;
|
||||
function createFromStorageInterface( storageType, storage ) {
|
||||
store.addType( storageType, function( key, value, options ) {
|
||||
var storedValue, parsed, i, remove,
|
||||
ret = value,
|
||||
now = (new Date()).getTime();
|
||||
|
||||
if ( !key ) {
|
||||
ret = {};
|
||||
remove = [];
|
||||
i = 0;
|
||||
try {
|
||||
// accessing the length property works around a localStorage bug
|
||||
// in Firefox 4.0 where the keys don't update cross-page
|
||||
// we assign to key just to avoid Closure Compiler from removing
|
||||
// the access as "useless code"
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=662511
|
||||
key = storage.length;
|
||||
|
||||
while ( key = storage.key( i++ ) ) {
|
||||
if ( rprefix.test( key ) ) {
|
||||
parsed = JSON.parse( storage.getItem( key ) );
|
||||
if ( parsed.expires && parsed.expires <= now ) {
|
||||
remove.push( key );
|
||||
} else {
|
||||
ret[ key.replace( rprefix, "" ) ] = parsed.data;
|
||||
}
|
||||
}
|
||||
}
|
||||
while ( key = remove.pop() ) {
|
||||
storage.removeItem( key );
|
||||
}
|
||||
} catch ( error ) {}
|
||||
return ret;
|
||||
}
|
||||
|
||||
// protect against name collisions with direct storage
|
||||
key = "__amplify__" + key;
|
||||
|
||||
if ( value === undefined ) {
|
||||
storedValue = storage.getItem( key );
|
||||
parsed = storedValue ? JSON.parse( storedValue ) : { expires: -1 };
|
||||
if ( parsed.expires && parsed.expires <= now ) {
|
||||
storage.removeItem( key );
|
||||
} else {
|
||||
return parsed.data;
|
||||
}
|
||||
} else {
|
||||
if ( value === null ) {
|
||||
storage.removeItem( key );
|
||||
} else {
|
||||
parsed = JSON.stringify({
|
||||
data: value,
|
||||
expires: options.expires ? now + options.expires : null
|
||||
});
|
||||
try {
|
||||
storage.setItem( key, parsed );
|
||||
// quota exceeded
|
||||
} catch( error ) {
|
||||
// expire old data and try again
|
||||
store[ storageType ]();
|
||||
try {
|
||||
storage.setItem( key, parsed );
|
||||
} catch( error ) {
|
||||
throw store.error();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
});
|
||||
}
|
||||
|
||||
// localStorage + sessionStorage
|
||||
// IE 8+, Firefox 3.5+, Safari 4+, Chrome 4+, Opera 10.5+, iPhone 2+, Android 2+
|
||||
for ( var webStorageType in { localStorage: 1, sessionStorage: 1 } ) {
|
||||
// try/catch for file protocol in Firefox
|
||||
try {
|
||||
if ( window[ webStorageType ].getItem ) {
|
||||
createFromStorageInterface( webStorageType, window[ webStorageType ] );
|
||||
}
|
||||
} catch( e ) {}
|
||||
}
|
||||
|
||||
// globalStorage
|
||||
// non-standard: Firefox 2+
|
||||
// https://developer.mozilla.org/en/dom/storage#globalStorage
|
||||
if ( window.globalStorage ) {
|
||||
// try/catch for file protocol in Firefox
|
||||
try {
|
||||
createFromStorageInterface( "globalStorage",
|
||||
window.globalStorage[ window.location.hostname ] );
|
||||
// Firefox 2.0 and 3.0 have sessionStorage and globalStorage
|
||||
// make sure we default to globalStorage
|
||||
// but don't default to globalStorage in 3.5+ which also has localStorage
|
||||
if ( store.type === "sessionStorage" ) {
|
||||
store.type = "globalStorage";
|
||||
}
|
||||
} catch( e ) {}
|
||||
}
|
||||
|
||||
// userData
|
||||
// non-standard: IE 5+
|
||||
// http://msdn.microsoft.com/en-us/library/ms531424(v=vs.85).aspx
|
||||
(function() {
|
||||
// IE 9 has quirks in userData that are a huge pain
|
||||
// rather than finding a way to detect these quirks
|
||||
// we just don't register userData if we have localStorage
|
||||
if ( store.types.localStorage ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// append to html instead of body so we can do this from the head
|
||||
var div = document.createElement( "div" ),
|
||||
attrKey = "amplify";
|
||||
div.style.display = "none";
|
||||
document.getElementsByTagName( "head" )[ 0 ].appendChild( div );
|
||||
|
||||
// we can't feature detect userData support
|
||||
// so just try and see if it fails
|
||||
// surprisingly, even just adding the behavior isn't enough for a failure
|
||||
// so we need to load the data as well
|
||||
try {
|
||||
div.addBehavior( "#default#userdata" );
|
||||
div.load( attrKey );
|
||||
} catch( e ) {
|
||||
div.parentNode.removeChild( div );
|
||||
return;
|
||||
}
|
||||
|
||||
store.addType( "userData", function( key, value, options ) {
|
||||
div.load( attrKey );
|
||||
var attr, parsed, prevValue, i, remove,
|
||||
ret = value,
|
||||
now = (new Date()).getTime();
|
||||
|
||||
if ( !key ) {
|
||||
ret = {};
|
||||
remove = [];
|
||||
i = 0;
|
||||
while ( attr = div.XMLDocument.documentElement.attributes[ i++ ] ) {
|
||||
parsed = JSON.parse( attr.value );
|
||||
if ( parsed.expires && parsed.expires <= now ) {
|
||||
remove.push( attr.name );
|
||||
} else {
|
||||
ret[ attr.name ] = parsed.data;
|
||||
}
|
||||
}
|
||||
while ( key = remove.pop() ) {
|
||||
div.removeAttribute( key );
|
||||
}
|
||||
div.save( attrKey );
|
||||
return ret;
|
||||
}
|
||||
|
||||
// convert invalid characters to dashes
|
||||
// http://www.w3.org/TR/REC-xml/#NT-Name
|
||||
// simplified to assume the starting character is valid
|
||||
// also removed colon as it is invalid in HTML attribute names
|
||||
key = key.replace( /[^-._0-9A-Za-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u37f-\u1fff\u200c-\u200d\u203f\u2040\u2070-\u218f]/g, "-" );
|
||||
|
||||
if ( value === undefined ) {
|
||||
attr = div.getAttribute( key );
|
||||
parsed = attr ? JSON.parse( attr ) : { expires: -1 };
|
||||
if ( parsed.expires && parsed.expires <= now ) {
|
||||
div.removeAttribute( key );
|
||||
} else {
|
||||
return parsed.data;
|
||||
}
|
||||
} else {
|
||||
if ( value === null ) {
|
||||
div.removeAttribute( key );
|
||||
} else {
|
||||
// we need to get the previous value in case we need to rollback
|
||||
prevValue = div.getAttribute( key );
|
||||
parsed = JSON.stringify({
|
||||
data: value,
|
||||
expires: (options.expires ? (now + options.expires) : null)
|
||||
});
|
||||
div.setAttribute( key, parsed );
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
div.save( attrKey );
|
||||
// quota exceeded
|
||||
} catch ( error ) {
|
||||
// roll the value back to the previous value
|
||||
if ( prevValue === null ) {
|
||||
div.removeAttribute( key );
|
||||
} else {
|
||||
div.setAttribute( key, prevValue );
|
||||
}
|
||||
|
||||
// expire old data and try again
|
||||
store.userData();
|
||||
try {
|
||||
div.setAttribute( key, parsed );
|
||||
div.save( attrKey );
|
||||
} catch ( error ) {
|
||||
// roll the value back to the previous value
|
||||
if ( prevValue === null ) {
|
||||
div.removeAttribute( key );
|
||||
} else {
|
||||
div.setAttribute( key, prevValue );
|
||||
}
|
||||
throw store.error();
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
});
|
||||
}() );
|
||||
|
||||
// in-memory storage
|
||||
// fallback for all browsers to enable the API even if we can't persist data
|
||||
(function() {
|
||||
var memory = {},
|
||||
timeout = {};
|
||||
|
||||
function copy( obj ) {
|
||||
return obj === undefined ? undefined : JSON.parse( JSON.stringify( obj ) );
|
||||
}
|
||||
|
||||
store.addType( "memory", function( key, value, options ) {
|
||||
if ( !key ) {
|
||||
return copy( memory );
|
||||
}
|
||||
|
||||
if ( value === undefined ) {
|
||||
return copy( memory[ key ] );
|
||||
}
|
||||
|
||||
if ( timeout[ key ] ) {
|
||||
clearTimeout( timeout[ key ] );
|
||||
delete timeout[ key ];
|
||||
}
|
||||
|
||||
if ( value === null ) {
|
||||
delete memory[ key ];
|
||||
return null;
|
||||
}
|
||||
|
||||
memory[ key ] = value;
|
||||
if ( options.expires ) {
|
||||
timeout[ key ] = setTimeout(function() {
|
||||
delete memory[ key ];
|
||||
delete timeout[ key ];
|
||||
}, options.expires );
|
||||
}
|
||||
|
||||
return value;
|
||||
});
|
||||
}() );
|
||||
|
||||
}( this.amplify = this.amplify || {} ) );
|
||||
/*!
|
||||
* Amplify Request 1.1.0
|
||||
*
|
||||
* Copyright 2011 appendTo LLC. (http://appendto.com/team)
|
||||
* Dual licensed under the MIT or GPL licenses.
|
||||
* http://appendto.com/open-source-licenses
|
||||
*
|
||||
* http://amplifyjs.com
|
||||
*/
|
||||
(function( amplify, undefined ) {
|
||||
|
||||
function noop() {}
|
||||
function isFunction( obj ) {
|
||||
return ({}).toString.call( obj ) === "[object Function]";
|
||||
}
|
||||
|
||||
function async( fn ) {
|
||||
var isAsync = false;
|
||||
setTimeout(function() {
|
||||
isAsync = true;
|
||||
}, 1 );
|
||||
return function() {
|
||||
var that = this,
|
||||
args = arguments;
|
||||
if ( isAsync ) {
|
||||
fn.apply( that, args );
|
||||
} else {
|
||||
setTimeout(function() {
|
||||
fn.apply( that, args );
|
||||
}, 1 );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
amplify.request = function( resourceId, data, callback ) {
|
||||
// default to an empty hash just so we can handle a missing resourceId
|
||||
// in one place
|
||||
var settings = resourceId || {};
|
||||
|
||||
if ( typeof settings === "string" ) {
|
||||
if ( isFunction( data ) ) {
|
||||
callback = data;
|
||||
data = {};
|
||||
}
|
||||
settings = {
|
||||
resourceId: resourceId,
|
||||
data: data || {},
|
||||
success: callback
|
||||
};
|
||||
}
|
||||
|
||||
var request = { abort: noop },
|
||||
resource = amplify.request.resources[ settings.resourceId ],
|
||||
success = settings.success || noop,
|
||||
error = settings.error || noop;
|
||||
settings.success = async( function( data, status ) {
|
||||
status = status || "success";
|
||||
amplify.publish( "request.success", settings, data, status );
|
||||
amplify.publish( "request.complete", settings, data, status );
|
||||
success( data, status );
|
||||
});
|
||||
settings.error = async( function( data, status ) {
|
||||
status = status || "error";
|
||||
amplify.publish( "request.error", settings, data, status );
|
||||
amplify.publish( "request.complete", settings, data, status );
|
||||
error( data, status );
|
||||
});
|
||||
|
||||
if ( !resource ) {
|
||||
if ( !settings.resourceId ) {
|
||||
throw "amplify.request: no resourceId provided";
|
||||
}
|
||||
throw "amplify.request: unknown resourceId: " + settings.resourceId;
|
||||
}
|
||||
|
||||
if ( !amplify.publish( "request.before", settings ) ) {
|
||||
settings.error( null, "abort" );
|
||||
return;
|
||||
}
|
||||
|
||||
amplify.request.resources[ settings.resourceId ]( settings, request );
|
||||
return request;
|
||||
};
|
||||
|
||||
amplify.request.types = {};
|
||||
amplify.request.resources = {};
|
||||
amplify.request.define = function( resourceId, type, settings ) {
|
||||
if ( typeof type === "string" ) {
|
||||
if ( !( type in amplify.request.types ) ) {
|
||||
throw "amplify.request.define: unknown type: " + type;
|
||||
}
|
||||
|
||||
settings.resourceId = resourceId;
|
||||
amplify.request.resources[ resourceId ] =
|
||||
amplify.request.types[ type ]( settings );
|
||||
} else {
|
||||
// no pre-processor or settings for one-off types (don't invoke)
|
||||
amplify.request.resources[ resourceId ] = type;
|
||||
}
|
||||
};
|
||||
|
||||
}( amplify ) );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
(function( amplify, $, undefined ) {
|
||||
|
||||
var xhrProps = [ "status", "statusText", "responseText", "responseXML", "readyState" ],
|
||||
rurlData = /\{([^\}]+)\}/g;
|
||||
|
||||
amplify.request.types.ajax = function( defnSettings ) {
|
||||
defnSettings = $.extend({
|
||||
type: "GET"
|
||||
}, defnSettings );
|
||||
|
||||
return function( settings, request ) {
|
||||
var xhr,
|
||||
url = defnSettings.url,
|
||||
abort = request.abort,
|
||||
ajaxSettings = $.extend( true, {}, defnSettings, { data: settings.data } ),
|
||||
aborted = false,
|
||||
ampXHR = {
|
||||
readyState: 0,
|
||||
setRequestHeader: function( name, value ) {
|
||||
return xhr.setRequestHeader( name, value );
|
||||
},
|
||||
getAllResponseHeaders: function() {
|
||||
return xhr.getAllResponseHeaders();
|
||||
},
|
||||
getResponseHeader: function( key ) {
|
||||
return xhr.getResponseHeader( key );
|
||||
},
|
||||
overrideMimeType: function( type ) {
|
||||
return xhr.overrideMideType( type );
|
||||
},
|
||||
abort: function() {
|
||||
aborted = true;
|
||||
try {
|
||||
xhr.abort();
|
||||
// IE 7 throws an error when trying to abort
|
||||
} catch( e ) {}
|
||||
handleResponse( null, "abort" );
|
||||
},
|
||||
success: function( data, status ) {
|
||||
settings.success( data, status );
|
||||
},
|
||||
error: function( data, status ) {
|
||||
settings.error( data, status );
|
||||
}
|
||||
};
|
||||
|
||||
amplify.publish( "request.ajax.preprocess",
|
||||
defnSettings, settings, ajaxSettings, ampXHR );
|
||||
|
||||
$.extend( ajaxSettings, {
|
||||
success: function( data, status ) {
|
||||
handleResponse( data, status );
|
||||
},
|
||||
error: function( _xhr, status ) {
|
||||
handleResponse( null, status );
|
||||
},
|
||||
beforeSend: function( _xhr, _ajaxSettings ) {
|
||||
xhr = _xhr;
|
||||
ajaxSettings = _ajaxSettings;
|
||||
var ret = defnSettings.beforeSend ?
|
||||
defnSettings.beforeSend.call( this, ampXHR, ajaxSettings ) : true;
|
||||
return ret && amplify.publish( "request.before.ajax",
|
||||
defnSettings, settings, ajaxSettings, ampXHR );
|
||||
}
|
||||
});
|
||||
$.ajax( ajaxSettings );
|
||||
|
||||
function handleResponse( data, status ) {
|
||||
$.each( xhrProps, function( i, key ) {
|
||||
try {
|
||||
ampXHR[ key ] = xhr[ key ];
|
||||
} catch( e ) {}
|
||||
});
|
||||
// Playbook returns "HTTP/1.1 200 OK"
|
||||
// TODO: something also returns "OK", what?
|
||||
if ( /OK$/.test( ampXHR.statusText ) ) {
|
||||
ampXHR.statusText = "success";
|
||||
}
|
||||
if ( data === undefined ) {
|
||||
// TODO: add support for ajax errors with data
|
||||
data = null;
|
||||
}
|
||||
if ( aborted ) {
|
||||
status = "abort";
|
||||
}
|
||||
if ( /timeout|error|abort/.test( status ) ) {
|
||||
ampXHR.error( data, status );
|
||||
} else {
|
||||
ampXHR.success( data, status );
|
||||
}
|
||||
// avoid handling a response multiple times
|
||||
// this can happen if a request is aborted
|
||||
// TODO: figure out if this breaks polling or multi-part responses
|
||||
handleResponse = $.noop;
|
||||
}
|
||||
|
||||
request.abort = function() {
|
||||
ampXHR.abort();
|
||||
abort.call( this );
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
amplify.subscribe( "request.ajax.preprocess", function( defnSettings, settings, ajaxSettings ) {
|
||||
var mappedKeys = [],
|
||||
data = ajaxSettings.data;
|
||||
|
||||
if ( typeof data === "string" ) {
|
||||
return;
|
||||
}
|
||||
|
||||
data = $.extend( true, {}, defnSettings.data, data );
|
||||
|
||||
ajaxSettings.url = ajaxSettings.url.replace( rurlData, function ( m, key ) {
|
||||
if ( key in data ) {
|
||||
mappedKeys.push( key );
|
||||
return data[ key ];
|
||||
}
|
||||
});
|
||||
|
||||
// We delete the keys later so duplicates are still replaced
|
||||
$.each( mappedKeys, function ( i, key ) {
|
||||
delete data[ key ];
|
||||
});
|
||||
|
||||
ajaxSettings.data = data;
|
||||
});
|
||||
|
||||
|
||||
|
||||
amplify.subscribe( "request.ajax.preprocess", function( defnSettings, settings, ajaxSettings ) {
|
||||
var data = ajaxSettings.data,
|
||||
dataMap = defnSettings.dataMap;
|
||||
|
||||
if ( !dataMap || typeof data === "string" ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( $.isFunction( dataMap ) ) {
|
||||
ajaxSettings.data = dataMap( data );
|
||||
} else {
|
||||
$.each( defnSettings.dataMap, function( orig, replace ) {
|
||||
if ( orig in data ) {
|
||||
data[ replace ] = data[ orig ];
|
||||
delete data[ orig ];
|
||||
}
|
||||
});
|
||||
ajaxSettings.data = data;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
var cache = amplify.request.cache = {
|
||||
_key: function( resourceId, url, data ) {
|
||||
data = url + data;
|
||||
var length = data.length,
|
||||
i = 0,
|
||||
checksum = chunk();
|
||||
|
||||
while ( i < length ) {
|
||||
checksum ^= chunk();
|
||||
}
|
||||
|
||||
function chunk() {
|
||||
return data.charCodeAt( i++ ) << 24 |
|
||||
data.charCodeAt( i++ ) << 16 |
|
||||
data.charCodeAt( i++ ) << 8 |
|
||||
data.charCodeAt( i++ ) << 0;
|
||||
}
|
||||
|
||||
return "request-" + resourceId + "-" + checksum;
|
||||
},
|
||||
|
||||
_default: (function() {
|
||||
var memoryStore = {};
|
||||
return function( resource, settings, ajaxSettings, ampXHR ) {
|
||||
// data is already converted to a string by the time we get here
|
||||
var cacheKey = cache._key( settings.resourceId,
|
||||
ajaxSettings.url, ajaxSettings.data ),
|
||||
duration = resource.cache;
|
||||
|
||||
if ( cacheKey in memoryStore ) {
|
||||
ampXHR.success( memoryStore[ cacheKey ] );
|
||||
return false;
|
||||
}
|
||||
var success = ampXHR.success;
|
||||
ampXHR.success = function( data ) {
|
||||
memoryStore[ cacheKey ] = data;
|
||||
if ( typeof duration === "number" ) {
|
||||
setTimeout(function() {
|
||||
delete memoryStore[ cacheKey ];
|
||||
}, duration );
|
||||
}
|
||||
success.apply( this, arguments );
|
||||
};
|
||||
};
|
||||
}())
|
||||
};
|
||||
|
||||
if ( amplify.store ) {
|
||||
$.each( amplify.store.types, function( type ) {
|
||||
cache[ type ] = function( resource, settings, ajaxSettings, ampXHR ) {
|
||||
var cacheKey = cache._key( settings.resourceId,
|
||||
ajaxSettings.url, ajaxSettings.data ),
|
||||
cached = amplify.store[ type ]( cacheKey );
|
||||
|
||||
if ( cached ) {
|
||||
ajaxSettings.success( cached );
|
||||
return false;
|
||||
}
|
||||
var success = ampXHR.success;
|
||||
ampXHR.success = function( data ) {
|
||||
amplify.store[ type ]( cacheKey, data, { expires: resource.cache.expires } );
|
||||
success.apply( this, arguments );
|
||||
};
|
||||
};
|
||||
});
|
||||
cache.persist = cache[ amplify.store.type ];
|
||||
}
|
||||
|
||||
amplify.subscribe( "request.before.ajax", function( resource ) {
|
||||
var cacheType = resource.cache;
|
||||
if ( cacheType ) {
|
||||
// normalize between objects and strings/booleans/numbers
|
||||
cacheType = cacheType.type || cacheType;
|
||||
return cache[ cacheType in cache ? cacheType : "_default" ]
|
||||
.apply( this, arguments );
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
amplify.request.decoders = {
|
||||
// http://labs.omniti.com/labs/jsend
|
||||
jsend: function( data, status, ampXHR, success, error ) {
|
||||
if ( data.status === "success" ) {
|
||||
success( data.data );
|
||||
} else if ( data.status === "fail" ) {
|
||||
error( data.data, "fail" );
|
||||
} else if ( data.status === "error" ) {
|
||||
delete data.status;
|
||||
error( data, "error" );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
amplify.subscribe( "request.before.ajax", function( resource, settings, ajaxSettings, ampXHR ) {
|
||||
var _success = ampXHR.success,
|
||||
_error = ampXHR.error,
|
||||
decoder = $.isFunction( resource.decoder )
|
||||
? resource.decoder
|
||||
: resource.decoder in amplify.request.decoders
|
||||
? amplify.request.decoders[ resource.decoder ]
|
||||
: amplify.request.decoders._default;
|
||||
|
||||
if ( !decoder ) {
|
||||
return;
|
||||
}
|
||||
|
||||
function success( data, status ) {
|
||||
_success( data, status );
|
||||
}
|
||||
function error( data, status ) {
|
||||
_error( data, status );
|
||||
}
|
||||
ampXHR.success = function( data, status ) {
|
||||
decoder( data, status, ampXHR, success, error );
|
||||
};
|
||||
ampXHR.error = function( data, status ) {
|
||||
decoder( data, status, ampXHR, success, error );
|
||||
};
|
||||
});
|
||||
|
||||
}( amplify, jQuery ) );
|
137
src/_h5ai/client/js/lib/base64.js
Normal file
137
src/_h5ai/client/js/lib/base64.js
Normal file
|
@ -0,0 +1,137 @@
|
|||
|
||||
/*
|
||||
* taken from here:
|
||||
* http://www.webtoolkit.info/javascript-base64.html
|
||||
* with minor modifications
|
||||
*/
|
||||
var Base64 = {
|
||||
|
||||
// private property
|
||||
_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
|
||||
|
||||
// public method for encoding
|
||||
encode : function (input) {
|
||||
var output = "";
|
||||
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
|
||||
var i = 0;
|
||||
|
||||
input = Base64._utf8_encode(input);
|
||||
|
||||
while (i < input.length) {
|
||||
|
||||
chr1 = input.charCodeAt(i++);
|
||||
chr2 = input.charCodeAt(i++);
|
||||
chr3 = input.charCodeAt(i++);
|
||||
|
||||
enc1 = chr1 >> 2;
|
||||
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
|
||||
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
|
||||
enc4 = chr3 & 63;
|
||||
|
||||
if (isNaN(chr2)) {
|
||||
enc3 = enc4 = 64;
|
||||
} else if (isNaN(chr3)) {
|
||||
enc4 = 64;
|
||||
}
|
||||
|
||||
output = output +
|
||||
this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
|
||||
this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
|
||||
|
||||
}
|
||||
|
||||
return output;
|
||||
},
|
||||
|
||||
// public method for decoding
|
||||
decode : function (input) {
|
||||
var output = "";
|
||||
var chr1, chr2, chr3;
|
||||
var enc1, enc2, enc3, enc4;
|
||||
var i = 0;
|
||||
|
||||
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
|
||||
|
||||
while (i < input.length) {
|
||||
|
||||
enc1 = this._keyStr.indexOf(input.charAt(i++));
|
||||
enc2 = this._keyStr.indexOf(input.charAt(i++));
|
||||
enc3 = this._keyStr.indexOf(input.charAt(i++));
|
||||
enc4 = this._keyStr.indexOf(input.charAt(i++));
|
||||
|
||||
chr1 = (enc1 << 2) | (enc2 >> 4);
|
||||
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
|
||||
chr3 = ((enc3 & 3) << 6) | enc4;
|
||||
|
||||
output = output + String.fromCharCode(chr1);
|
||||
|
||||
if (enc3 != 64) {
|
||||
output = output + String.fromCharCode(chr2);
|
||||
}
|
||||
if (enc4 != 64) {
|
||||
output = output + String.fromCharCode(chr3);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return Base64._utf8_decode(output);
|
||||
},
|
||||
|
||||
// private method for UTF-8 encoding
|
||||
_utf8_encode : function (string) {
|
||||
string = string.replace(/\r\n/g,"\n");
|
||||
var utftext = "";
|
||||
|
||||
for (var n = 0; n < string.length; n++) {
|
||||
|
||||
var c = string.charCodeAt(n);
|
||||
|
||||
if (c < 128) {
|
||||
utftext += String.fromCharCode(c);
|
||||
}
|
||||
else if((c > 127) && (c < 2048)) {
|
||||
utftext += String.fromCharCode((c >> 6) | 192);
|
||||
utftext += String.fromCharCode((c & 63) | 128);
|
||||
}
|
||||
else {
|
||||
utftext += String.fromCharCode((c >> 12) | 224);
|
||||
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
|
||||
utftext += String.fromCharCode((c & 63) | 128);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return utftext;
|
||||
},
|
||||
|
||||
// private method for UTF-8 decoding
|
||||
_utf8_decode : function (utftext) {
|
||||
var string = "";
|
||||
var i = 0;
|
||||
var c = c1 = c2 = 0;
|
||||
|
||||
while ( i < utftext.length ) {
|
||||
|
||||
c = utftext.charCodeAt(i);
|
||||
|
||||
if (c < 128) {
|
||||
string += String.fromCharCode(c);
|
||||
i++;
|
||||
}
|
||||
else if((c > 191) && (c < 224)) {
|
||||
c2 = utftext.charCodeAt(i+1);
|
||||
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
|
||||
i += 2;
|
||||
}
|
||||
else {
|
||||
c2 = utftext.charCodeAt(i+1);
|
||||
c3 = utftext.charCodeAt(i+2);
|
||||
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
|
||||
i += 3;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return string;
|
||||
}
|
||||
}
|
9440
src/_h5ai/client/js/lib/jquery-1.8.2.js
vendored
Normal file
9440
src/_h5ai/client/js/lib/jquery-1.8.2.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
424
src/_h5ai/client/js/lib/jquery.filedrop-0.1.0.js
Executable file
424
src/_h5ai/client/js/lib/jquery.filedrop-0.1.0.js
Executable file
|
@ -0,0 +1,424 @@
|
|||
/*
|
||||
* Default text - jQuery plugin for html5 dragging files from desktop to browser
|
||||
*
|
||||
* Author: Weixi Yen
|
||||
*
|
||||
* Email: [Firstname][Lastname]@gmail.com
|
||||
*
|
||||
* Copyright (c) 2010 Resopollution
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*
|
||||
* Project home:
|
||||
* http://www.github.com/weixiyen/jquery-filedrop
|
||||
*
|
||||
* Version: 0.1.0
|
||||
*
|
||||
* Features:
|
||||
* Allows sending of extra parameters with file.
|
||||
* Works with Firefox 3.6+
|
||||
* Future-compliant with HTML5 spec (will work with Webkit browsers and IE9)
|
||||
* Usage:
|
||||
* See README at project homepage
|
||||
*
|
||||
*/
|
||||
;(function($) {
|
||||
|
||||
jQuery.event.props.push("dataTransfer");
|
||||
|
||||
var default_opts = {
|
||||
fallback_id: '',
|
||||
url: '',
|
||||
refresh: 1000,
|
||||
paramname: 'userfile',
|
||||
allowedfiletypes:[],
|
||||
maxfiles: 25, // Ignored if queuefiles is set > 0
|
||||
maxfilesize: 1, // MB file size limit
|
||||
queuefiles: 0, // Max files before queueing (for large volume uploads)
|
||||
queuewait: 200, // Queue wait time if full
|
||||
data: {},
|
||||
headers: {},
|
||||
drop: empty,
|
||||
dragEnter: empty,
|
||||
dragOver: empty,
|
||||
dragLeave: empty,
|
||||
docEnter: empty,
|
||||
docOver: empty,
|
||||
docLeave: empty,
|
||||
beforeEach: empty,
|
||||
afterAll: empty,
|
||||
rename: empty,
|
||||
error: function(err, file, i) {
|
||||
alert(err);
|
||||
},
|
||||
uploadStarted: empty,
|
||||
uploadFinished: empty,
|
||||
progressUpdated: empty,
|
||||
speedUpdated: empty
|
||||
},
|
||||
errors = ["BrowserNotSupported", "TooManyFiles", "FileTooLarge", "FileTypeNotAllowed"],
|
||||
doc_leave_timer, stop_loop = false,
|
||||
files_count = 0,
|
||||
files;
|
||||
|
||||
$.fn.filedrop = function(options) {
|
||||
var opts = $.extend({}, default_opts, options);
|
||||
|
||||
this.on('drop', drop).on('dragenter', dragEnter).on('dragover', dragOver).on('dragleave', dragLeave);
|
||||
$(document).on('drop', docDrop).on('dragenter', docEnter).on('dragover', docOver).on('dragleave', docLeave);
|
||||
|
||||
$('#' + opts.fallback_id).change(function(e) {
|
||||
opts.drop(e);
|
||||
files = e.target.files;
|
||||
files_count = files.length;
|
||||
upload();
|
||||
});
|
||||
|
||||
function drop(e) {
|
||||
opts.drop(e);
|
||||
files = e.dataTransfer.files;
|
||||
if (files === null || files === undefined) {
|
||||
opts.error(errors[0]);
|
||||
return false;
|
||||
}
|
||||
files_count = files.length;
|
||||
upload();
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
function getBuilder(filename, filedata, mime, boundary) {
|
||||
var dashdash = '--',
|
||||
crlf = '\r\n',
|
||||
builder = '';
|
||||
|
||||
if (opts.data) {
|
||||
var params = $.param(opts.data).split(/&/);
|
||||
|
||||
$.each(params, function() {
|
||||
var pair = this.split(/=/, 2);
|
||||
var name = decodeURIComponent(pair[0]);
|
||||
var val = decodeURIComponent(pair[1]);
|
||||
|
||||
builder += dashdash;
|
||||
builder += boundary;
|
||||
builder += crlf;
|
||||
builder += 'Content-Disposition: form-data; name="' + name + '"';
|
||||
builder += crlf;
|
||||
builder += crlf;
|
||||
builder += val;
|
||||
builder += crlf;
|
||||
});
|
||||
}
|
||||
|
||||
builder += dashdash;
|
||||
builder += boundary;
|
||||
builder += crlf;
|
||||
builder += 'Content-Disposition: form-data; name="' + opts.paramname + '"';
|
||||
builder += '; filename="' + filename + '"';
|
||||
builder += crlf;
|
||||
|
||||
builder += 'Content-Type: ' + mime;
|
||||
builder += crlf;
|
||||
builder += crlf;
|
||||
|
||||
builder += filedata;
|
||||
builder += crlf;
|
||||
|
||||
builder += dashdash;
|
||||
builder += boundary;
|
||||
builder += dashdash;
|
||||
builder += crlf;
|
||||
return builder;
|
||||
}
|
||||
|
||||
function progress(e) {
|
||||
if (e.lengthComputable) {
|
||||
var percentage = Math.round((e.loaded * 100) / e.total);
|
||||
if (this.currentProgress != percentage) {
|
||||
|
||||
this.currentProgress = percentage;
|
||||
opts.progressUpdated(this.index, this.file, this.currentProgress);
|
||||
|
||||
var elapsed = new Date().getTime();
|
||||
var diffTime = elapsed - this.currentStart;
|
||||
if (diffTime >= opts.refresh) {
|
||||
var diffData = e.loaded - this.startData;
|
||||
var speed = diffData / diffTime; // KB per second
|
||||
opts.speedUpdated(this.index, this.file, speed);
|
||||
this.startData = e.loaded;
|
||||
this.currentStart = elapsed;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Respond to an upload
|
||||
function upload() {
|
||||
|
||||
stop_loop = false;
|
||||
|
||||
if (!files) {
|
||||
opts.error(errors[0]);
|
||||
return false;
|
||||
}
|
||||
if(opts.allowedfiletypes.push && opts.allowedfiletypes.length){
|
||||
for(var fileIndex = files.length;fileIndex--;){
|
||||
if(!files[fileIndex].type || $.inArray(files[fileIndex].type, opts.allowedfiletypes) < 0){
|
||||
opts.error(errors[3]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var filesDone = 0,
|
||||
filesRejected = 0;
|
||||
|
||||
if (files_count > opts.maxfiles && opts.queuefiles === 0) {
|
||||
opts.error(errors[1]);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Define queues to manage upload process
|
||||
var workQueue = [];
|
||||
var processingQueue = [];
|
||||
var doneQueue = [];
|
||||
|
||||
// Add everything to the workQueue
|
||||
for (var i = 0; i < files_count; i++) {
|
||||
workQueue.push(i);
|
||||
}
|
||||
|
||||
// Helper function to enable pause of processing to wait
|
||||
// for in process queue to complete
|
||||
var pause = function(timeout) {
|
||||
setTimeout(process, timeout);
|
||||
return;
|
||||
}
|
||||
|
||||
// Process an upload, recursive
|
||||
var process = function() {
|
||||
|
||||
var fileIndex;
|
||||
|
||||
if (stop_loop) return false;
|
||||
|
||||
// Check to see if are in queue mode
|
||||
if (opts.queuefiles > 0 && processingQueue.length >= opts.queuefiles) {
|
||||
|
||||
return pause(opts.queuewait);
|
||||
|
||||
} else {
|
||||
|
||||
// Take first thing off work queue
|
||||
fileIndex = workQueue[0];
|
||||
workQueue.splice(0, 1);
|
||||
|
||||
// Add to processing queue
|
||||
processingQueue.push(fileIndex);
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
if (beforeEach(files[fileIndex]) != false) {
|
||||
if (fileIndex === files_count) return;
|
||||
var reader = new FileReader(),
|
||||
max_file_size = 1048576 * opts.maxfilesize;
|
||||
|
||||
reader.index = fileIndex;
|
||||
if (files[fileIndex].size > max_file_size) {
|
||||
opts.error(errors[2], files[fileIndex], fileIndex);
|
||||
// Remove from queue
|
||||
processingQueue.forEach(function(value, key) {
|
||||
if (value === fileIndex) processingQueue.splice(key, 1);
|
||||
});
|
||||
filesRejected++;
|
||||
return true;
|
||||
}
|
||||
reader.onloadend = send;
|
||||
reader.readAsBinaryString(files[fileIndex]);
|
||||
|
||||
} else {
|
||||
filesRejected++;
|
||||
}
|
||||
} catch (err) {
|
||||
// Remove from queue
|
||||
processingQueue.forEach(function(value, key) {
|
||||
if (value === fileIndex) processingQueue.splice(key, 1);
|
||||
});
|
||||
opts.error(errors[0]);
|
||||
return false;
|
||||
}
|
||||
|
||||
// If we still have work to do,
|
||||
if (workQueue.length > 0) {
|
||||
process();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
var send = function(e) {
|
||||
|
||||
var fileIndex = ((typeof(e.srcElement) === "undefined") ? e.target : e.srcElement).index
|
||||
|
||||
// Sometimes the index is not attached to the
|
||||
// event object. Find it by size. Hack for sure.
|
||||
if (e.target.index == undefined) {
|
||||
e.target.index = getIndexBySize(e.total);
|
||||
}
|
||||
|
||||
var xhr = new XMLHttpRequest(),
|
||||
upload = xhr.upload,
|
||||
file = files[e.target.index],
|
||||
index = e.target.index,
|
||||
start_time = new Date().getTime(),
|
||||
boundary = '------multipartformboundary' + (new Date).getTime(),
|
||||
builder;
|
||||
|
||||
newName = rename(file.name);
|
||||
mime = file.type
|
||||
if (typeof newName === "string") {
|
||||
builder = getBuilder(newName, e.target.result, mime, boundary);
|
||||
} else {
|
||||
builder = getBuilder(file.name, e.target.result, mime, boundary);
|
||||
}
|
||||
|
||||
upload.index = index;
|
||||
upload.file = file;
|
||||
upload.downloadStartTime = start_time;
|
||||
upload.currentStart = start_time;
|
||||
upload.currentProgress = 0;
|
||||
upload.startData = 0;
|
||||
upload.addEventListener("progress", progress, false);
|
||||
|
||||
xhr.open("POST", opts.url, true);
|
||||
xhr.setRequestHeader('content-type', 'multipart/form-data; boundary=' + boundary);
|
||||
|
||||
// Add headers
|
||||
$.each(opts.headers, function(k, v) {
|
||||
xhr.setRequestHeader(k, v);
|
||||
});
|
||||
|
||||
xhr.sendAsBinary(builder);
|
||||
|
||||
opts.uploadStarted(index, file, files_count);
|
||||
|
||||
xhr.onload = function() {
|
||||
if (xhr.responseText) {
|
||||
var now = new Date().getTime(),
|
||||
timeDiff = now - start_time,
|
||||
result = opts.uploadFinished(index, file, jQuery.parseJSON(xhr.responseText), timeDiff, xhr);
|
||||
filesDone++;
|
||||
|
||||
// Remove from processing queue
|
||||
processingQueue.forEach(function(value, key) {
|
||||
if (value === fileIndex) processingQueue.splice(key, 1);
|
||||
});
|
||||
|
||||
// Add to donequeue
|
||||
doneQueue.push(fileIndex);
|
||||
|
||||
if (filesDone == files_count - filesRejected) {
|
||||
afterAll();
|
||||
}
|
||||
if (result === false) stop_loop = true;
|
||||
}
|
||||
|
||||
//Pass any errors to the error option
|
||||
if(xhr.status != 200){
|
||||
opts.error(xhr.statusText);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// Initiate the processing loop
|
||||
process();
|
||||
|
||||
}
|
||||
|
||||
function getIndexBySize(size) {
|
||||
for (var i = 0; i < files_count; i++) {
|
||||
if (files[i].size == size) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function rename(name) {
|
||||
return opts.rename(name);
|
||||
}
|
||||
|
||||
function beforeEach(file) {
|
||||
return opts.beforeEach(file);
|
||||
}
|
||||
|
||||
function afterAll() {
|
||||
return opts.afterAll();
|
||||
}
|
||||
|
||||
function dragEnter(e) {
|
||||
clearTimeout(doc_leave_timer);
|
||||
e.preventDefault();
|
||||
opts.dragEnter(e);
|
||||
}
|
||||
|
||||
function dragOver(e) {
|
||||
clearTimeout(doc_leave_timer);
|
||||
e.preventDefault();
|
||||
opts.docOver(e);
|
||||
opts.dragOver(e);
|
||||
}
|
||||
|
||||
function dragLeave(e) {
|
||||
clearTimeout(doc_leave_timer);
|
||||
opts.dragLeave(e);
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
function docDrop(e) {
|
||||
e.preventDefault();
|
||||
opts.docLeave(e);
|
||||
return false;
|
||||
}
|
||||
|
||||
function docEnter(e) {
|
||||
clearTimeout(doc_leave_timer);
|
||||
e.preventDefault();
|
||||
opts.docEnter(e);
|
||||
return false;
|
||||
}
|
||||
|
||||
function docOver(e) {
|
||||
clearTimeout(doc_leave_timer);
|
||||
e.preventDefault();
|
||||
opts.docOver(e);
|
||||
return false;
|
||||
}
|
||||
|
||||
function docLeave(e) {
|
||||
doc_leave_timer = setTimeout(function() {
|
||||
opts.docLeave(e);
|
||||
}, 200);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
function empty() {}
|
||||
|
||||
try {
|
||||
if (XMLHttpRequest.prototype.sendAsBinary) return;
|
||||
XMLHttpRequest.prototype.sendAsBinary = function(datastr) {
|
||||
function byteValue(x) {
|
||||
return x.charCodeAt(0) & 0xff;
|
||||
}
|
||||
var ords = Array.prototype.map.call(datastr, byteValue);
|
||||
var ui8a = new Uint8Array(ords);
|
||||
this.send(ui8a.buffer);
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
})(jQuery);
|
1073
src/_h5ai/client/js/lib/jquery.fracs-0.11.js
Normal file
1073
src/_h5ai/client/js/lib/jquery.fracs-0.11.js
Normal file
File diff suppressed because it is too large
Load diff
84
src/_h5ai/client/js/lib/jquery.mousewheel-3.0.6.js
Normal file
84
src/_h5ai/client/js/lib/jquery.mousewheel-3.0.6.js
Normal file
|
@ -0,0 +1,84 @@
|
|||
/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net)
|
||||
* Licensed under the MIT License (LICENSE.txt).
|
||||
*
|
||||
* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
|
||||
* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
|
||||
* Thanks to: Seamus Leahy for adding deltaX and deltaY
|
||||
*
|
||||
* Version: 3.0.6
|
||||
*
|
||||
* Requires: 1.2.2+
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
var types = ['DOMMouseScroll', 'mousewheel'];
|
||||
|
||||
if ($.event.fixHooks) {
|
||||
for ( var i=types.length; i; ) {
|
||||
$.event.fixHooks[ types[--i] ] = $.event.mouseHooks;
|
||||
}
|
||||
}
|
||||
|
||||
$.event.special.mousewheel = {
|
||||
setup: function() {
|
||||
if ( this.addEventListener ) {
|
||||
for ( var i=types.length; i; ) {
|
||||
this.addEventListener( types[--i], handler, false );
|
||||
}
|
||||
} else {
|
||||
this.onmousewheel = handler;
|
||||
}
|
||||
},
|
||||
|
||||
teardown: function() {
|
||||
if ( this.removeEventListener ) {
|
||||
for ( var i=types.length; i; ) {
|
||||
this.removeEventListener( types[--i], handler, false );
|
||||
}
|
||||
} else {
|
||||
this.onmousewheel = null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.extend({
|
||||
mousewheel: function(fn) {
|
||||
return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
|
||||
},
|
||||
|
||||
unmousewheel: function(fn) {
|
||||
return this.unbind("mousewheel", fn);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function handler(event) {
|
||||
var orgEvent = event || window.event, args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true, deltaX = 0, deltaY = 0;
|
||||
event = $.event.fix(orgEvent);
|
||||
event.type = "mousewheel";
|
||||
|
||||
// Old school scrollwheel delta
|
||||
if ( orgEvent.wheelDelta ) { delta = orgEvent.wheelDelta/120; }
|
||||
if ( orgEvent.detail ) { delta = -orgEvent.detail/3; }
|
||||
|
||||
// New school multidimensional scroll (touchpads) deltas
|
||||
deltaY = delta;
|
||||
|
||||
// Gecko
|
||||
if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
|
||||
deltaY = 0;
|
||||
deltaX = -1*delta;
|
||||
}
|
||||
|
||||
// Webkit
|
||||
if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY/120; }
|
||||
if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = -1*orgEvent.wheelDeltaX/120; }
|
||||
|
||||
// Add event and delta to the front of the arguments
|
||||
args.unshift(event, delta, deltaX, deltaY);
|
||||
|
||||
return ($.event.dispatch || $.event.handle).apply(this, args);
|
||||
}
|
||||
|
||||
})(jQuery);
|
1577
src/_h5ai/client/js/lib/jquery.qrcode-0.2.js
Normal file
1577
src/_h5ai/client/js/lib/jquery.qrcode-0.2.js
Normal file
File diff suppressed because it is too large
Load diff
243
src/_h5ai/client/js/lib/jquery.scrollpanel-0.1.js
Normal file
243
src/_h5ai/client/js/lib/jquery.scrollpanel-0.1.js
Normal file
|
@ -0,0 +1,243 @@
|
|||
/*! jQuery.scrollpanel 0.1 - //larsjung.de/scrollpanel - MIT License */
|
||||
|
||||
(function ($) {
|
||||
'use strict';
|
||||
|
||||
var $window = $(window),
|
||||
|
||||
name = 'scrollpanel',
|
||||
|
||||
defaults = {
|
||||
prefix: 'sp-'
|
||||
},
|
||||
|
||||
// Scrollpanel
|
||||
// ===========
|
||||
ScrollPanel = function (element, options) {
|
||||
|
||||
var self = this;
|
||||
|
||||
// Main reference.
|
||||
self.$el = $(element);
|
||||
|
||||
self.settings = $.extend({}, defaults, options);
|
||||
var prefix = self.settings.prefix;
|
||||
|
||||
// Mouse offset on drag start.
|
||||
self.mouseOffsetY = 0;
|
||||
// Interval ID for automatic scrollbar updates.
|
||||
self.updateId = 0;
|
||||
|
||||
// Proxy to easily bind and unbind this method.
|
||||
self.scrollProxy = $.proxy(self.scroll, self);
|
||||
|
||||
// Make content space relative, if not already.
|
||||
if (!self.$el.css('position') || self.$el.css('position') === 'static') {
|
||||
self.$el.css('position', 'relative');
|
||||
}
|
||||
|
||||
|
||||
// Create scrollbar.
|
||||
self.$scrollbar = $('<div class="' + prefix + 'scrollbar" />');
|
||||
self.$thumb = $('<div class="' + prefix + 'thumb" />').appendTo(self.$scrollbar);
|
||||
|
||||
// Wrap element's content and add scrollbar.
|
||||
self.$el
|
||||
.addClass(prefix + 'host')
|
||||
.wrapInner('<div class="' + prefix + 'viewport"><div class="' + prefix + 'container" /></div>')
|
||||
.append(self.$scrollbar);
|
||||
|
||||
// // Get references.
|
||||
self.$viewport = self.$el.find('> .' + prefix + 'viewport');
|
||||
self.$container = self.$viewport.find('> .' + prefix + 'container');
|
||||
|
||||
|
||||
// Host
|
||||
// ----
|
||||
self.$el
|
||||
|
||||
// Handle mouse wheel.
|
||||
.on('mousewheel', function (event, delta, deltaX, deltaY) {
|
||||
|
||||
self.$viewport.scrollTop(self.$viewport.scrollTop() - 50 * deltaY);
|
||||
self.update();
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
})
|
||||
|
||||
// Handle scrolling.
|
||||
.on('scroll', function () {
|
||||
|
||||
self.update();
|
||||
});
|
||||
|
||||
|
||||
// Viewport
|
||||
// --------
|
||||
self.$viewport
|
||||
|
||||
// Basic styling.
|
||||
.css({
|
||||
paddingRight: self.$scrollbar.outerWidth(true),
|
||||
height: self.$el.height(),
|
||||
overflow: 'hidden'
|
||||
});
|
||||
|
||||
|
||||
// Container
|
||||
// ---------
|
||||
self.$container
|
||||
|
||||
// Basic styling.
|
||||
.css({
|
||||
overflow: 'hidden'
|
||||
});
|
||||
|
||||
|
||||
// Srollbar
|
||||
// --------
|
||||
self.$scrollbar
|
||||
|
||||
// Basic styling.
|
||||
.css({
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
right: 0,
|
||||
overflow: 'hidden'
|
||||
})
|
||||
|
||||
// Handle mouse buttons.
|
||||
.on('mousedown', function (event) {
|
||||
|
||||
self.mouseOffsetY = self.$thumb.outerHeight() / 2;
|
||||
self.onMousedown(event);
|
||||
})
|
||||
|
||||
// Disable selection.
|
||||
.each(function () {
|
||||
|
||||
self.onselectstart = function () {
|
||||
|
||||
return false;
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
// Scrollbar Thumb
|
||||
// ---------------
|
||||
self.$thumb
|
||||
|
||||
// Basic styling.
|
||||
.css({
|
||||
position: 'absolute',
|
||||
left: 0,
|
||||
width: '100%'
|
||||
})
|
||||
|
||||
// Handle mouse buttons.
|
||||
.on('mousedown', function (event) {
|
||||
|
||||
self.mouseOffsetY = event.pageY - self.$thumb.offset().top;
|
||||
self.onMousedown(event);
|
||||
});
|
||||
|
||||
// Initial update.
|
||||
self.update();
|
||||
};
|
||||
|
||||
// Scrollpanel methods
|
||||
// ===================
|
||||
$.extend(ScrollPanel.prototype, {
|
||||
|
||||
// Rerender scrollbar.
|
||||
update: function (repeat) {
|
||||
|
||||
var self = this;
|
||||
|
||||
if (self.updateId && !repeat) {
|
||||
clearInterval(self.updateId);
|
||||
self.updateId = 0;
|
||||
} else if (!self.updateId && repeat) {
|
||||
self.updateId = setInterval(function() {
|
||||
self.update(true);
|
||||
}, 50);
|
||||
}
|
||||
|
||||
self.$viewport.css('height', self.$el.height());
|
||||
|
||||
var visibleHeight = self.$el.height(),
|
||||
contentHeight = self.$container.outerHeight(),
|
||||
scrollTop = self.$viewport.scrollTop(),
|
||||
scrollTopFrac = scrollTop / contentHeight,
|
||||
visVertFrac = Math.min(visibleHeight / contentHeight, 1),
|
||||
scrollbarHeight = self.$scrollbar.height();
|
||||
|
||||
if (visVertFrac < 1) {
|
||||
self.$scrollbar
|
||||
.css({
|
||||
height: self.$el.innerHeight() + scrollbarHeight - self.$scrollbar.outerHeight(true)
|
||||
})
|
||||
.fadeIn(50);
|
||||
self.$thumb
|
||||
.css({
|
||||
top: scrollbarHeight * scrollTopFrac,
|
||||
height: scrollbarHeight * visVertFrac
|
||||
});
|
||||
} else {
|
||||
self.$scrollbar.fadeOut(50);
|
||||
}
|
||||
},
|
||||
|
||||
// Scroll content according to mouse position.
|
||||
scroll: function (event) {
|
||||
|
||||
var self = this,
|
||||
clickFrac = (event.pageY - self.$scrollbar.offset().top - self.mouseOffsetY) / self.$scrollbar.height();
|
||||
|
||||
self.$viewport.scrollTop(self.$container.outerHeight() * clickFrac);
|
||||
self.update();
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
},
|
||||
|
||||
// Handle mousedown events on scrollbar.
|
||||
onMousedown: function (event) {
|
||||
|
||||
var self = this;
|
||||
|
||||
self.scroll(event);
|
||||
self.$scrollbar.addClass('active');
|
||||
$window
|
||||
.on('mousemove', self.scrollProxy)
|
||||
.one('mouseup', function (event) {
|
||||
|
||||
self.$scrollbar.removeClass('active');
|
||||
$window.off('mousemove', self.scrollProxy);
|
||||
self.scroll(event);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Register the plug in
|
||||
// --------------------
|
||||
$.fn[name] = function (options, options2) {
|
||||
|
||||
return this.each(function () {
|
||||
|
||||
var $this = $(this),
|
||||
scrollpanel = $this.data(name);
|
||||
|
||||
if (!scrollpanel) {
|
||||
scrollpanel = new ScrollPanel(this, options);
|
||||
scrollpanel.update();
|
||||
$this.data(name, scrollpanel);
|
||||
}
|
||||
|
||||
if (options === 'update') {
|
||||
scrollpanel.update(options2);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
}(jQuery));
|
21
src/_h5ai/client/js/lib/jquery.spin-1.2.6.js
Normal file
21
src/_h5ai/client/js/lib/jquery.spin-1.2.6.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
|
||||
(function ($) {
|
||||
|
||||
$.fn.spin = function (options) {
|
||||
|
||||
return this.each(function () {
|
||||
|
||||
var $this = $(this),
|
||||
data = $this.data();
|
||||
|
||||
if (data.spinner) {
|
||||
data.spinner.stop();
|
||||
delete data.spinner;
|
||||
}
|
||||
|
||||
if (options !== false) {
|
||||
data.spinner = new Spinner($.extend({color: $this.css('color')}, options)).spin(this);
|
||||
}
|
||||
});
|
||||
};
|
||||
}(jQuery));
|
487
src/_h5ai/client/js/lib/json2-2011.10.19.js
Normal file
487
src/_h5ai/client/js/lib/json2-2011.10.19.js
Normal file
|
@ -0,0 +1,487 @@
|
|||
/*
|
||||
json2.js
|
||||
2011-10-19
|
||||
|
||||
Public Domain.
|
||||
|
||||
NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
|
||||
|
||||
See http://www.JSON.org/js.html
|
||||
|
||||
|
||||
This code should be minified before deployment.
|
||||
See http://javascript.crockford.com/jsmin.html
|
||||
|
||||
USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
|
||||
NOT CONTROL.
|
||||
|
||||
|
||||
This file creates a global JSON object containing two methods: stringify
|
||||
and parse.
|
||||
|
||||
JSON.stringify(value, replacer, space)
|
||||
value any JavaScript value, usually an object or array.
|
||||
|
||||
replacer an optional parameter that determines how object
|
||||
values are stringified for objects. It can be a
|
||||
function or an array of strings.
|
||||
|
||||
space an optional parameter that specifies the indentation
|
||||
of nested structures. If it is omitted, the text will
|
||||
be packed without extra whitespace. If it is a number,
|
||||
it will specify the number of spaces to indent at each
|
||||
level. If it is a string (such as '\t' or ' '),
|
||||
it contains the characters used to indent at each level.
|
||||
|
||||
This method produces a JSON text from a JavaScript value.
|
||||
|
||||
When an object value is found, if the object contains a toJSON
|
||||
method, its toJSON method will be called and the result will be
|
||||
stringified. A toJSON method does not serialize: it returns the
|
||||
value represented by the name/value pair that should be serialized,
|
||||
or undefined if nothing should be serialized. The toJSON method
|
||||
will be passed the key associated with the value, and this will be
|
||||
bound to the value
|
||||
|
||||
For example, this would serialize Dates as ISO strings.
|
||||
|
||||
Date.prototype.toJSON = function (key) {
|
||||
function f(n) {
|
||||
// Format integers to have at least two digits.
|
||||
return n < 10 ? '0' + n : n;
|
||||
}
|
||||
|
||||
return this.getUTCFullYear() + '-' +
|
||||
f(this.getUTCMonth() + 1) + '-' +
|
||||
f(this.getUTCDate()) + 'T' +
|
||||
f(this.getUTCHours()) + ':' +
|
||||
f(this.getUTCMinutes()) + ':' +
|
||||
f(this.getUTCSeconds()) + 'Z';
|
||||
};
|
||||
|
||||
You can provide an optional replacer method. It will be passed the
|
||||
key and value of each member, with this bound to the containing
|
||||
object. The value that is returned from your method will be
|
||||
serialized. If your method returns undefined, then the member will
|
||||
be excluded from the serialization.
|
||||
|
||||
If the replacer parameter is an array of strings, then it will be
|
||||
used to select the members to be serialized. It filters the results
|
||||
such that only members with keys listed in the replacer array are
|
||||
stringified.
|
||||
|
||||
Values that do not have JSON representations, such as undefined or
|
||||
functions, will not be serialized. Such values in objects will be
|
||||
dropped; in arrays they will be replaced with null. You can use
|
||||
a replacer function to replace those with JSON values.
|
||||
JSON.stringify(undefined) returns undefined.
|
||||
|
||||
The optional space parameter produces a stringification of the
|
||||
value that is filled with line breaks and indentation to make it
|
||||
easier to read.
|
||||
|
||||
If the space parameter is a non-empty string, then that string will
|
||||
be used for indentation. If the space parameter is a number, then
|
||||
the indentation will be that many spaces.
|
||||
|
||||
Example:
|
||||
|
||||
text = JSON.stringify(['e', {pluribus: 'unum'}]);
|
||||
// text is '["e",{"pluribus":"unum"}]'
|
||||
|
||||
|
||||
text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
|
||||
// text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
|
||||
|
||||
text = JSON.stringify([new Date()], function (key, value) {
|
||||
return this[key] instanceof Date ?
|
||||
'Date(' + this[key] + ')' : value;
|
||||
});
|
||||
// text is '["Date(---current time---)"]'
|
||||
|
||||
|
||||
JSON.parse(text, reviver)
|
||||
This method parses a JSON text to produce an object or array.
|
||||
It can throw a SyntaxError exception.
|
||||
|
||||
The optional reviver parameter is a function that can filter and
|
||||
transform the results. It receives each of the keys and values,
|
||||
and its return value is used instead of the original value.
|
||||
If it returns what it received, then the structure is not modified.
|
||||
If it returns undefined then the member is deleted.
|
||||
|
||||
Example:
|
||||
|
||||
// Parse the text. Values that look like ISO date strings will
|
||||
// be converted to Date objects.
|
||||
|
||||
myData = JSON.parse(text, function (key, value) {
|
||||
var a;
|
||||
if (typeof value === 'string') {
|
||||
a =
|
||||
/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
|
||||
if (a) {
|
||||
return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
|
||||
+a[5], +a[6]));
|
||||
}
|
||||
}
|
||||
return value;
|
||||
});
|
||||
|
||||
myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
|
||||
var d;
|
||||
if (typeof value === 'string' &&
|
||||
value.slice(0, 5) === 'Date(' &&
|
||||
value.slice(-1) === ')') {
|
||||
d = new Date(value.slice(5, -1));
|
||||
if (d) {
|
||||
return d;
|
||||
}
|
||||
}
|
||||
return value;
|
||||
});
|
||||
|
||||
|
||||
This is a reference implementation. You are free to copy, modify, or
|
||||
redistribute.
|
||||
*/
|
||||
|
||||
/*jslint evil: true, regexp: true */
|
||||
|
||||
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
|
||||
call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
|
||||
getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
|
||||
lastIndex, length, parse, prototype, push, replace, slice, stringify,
|
||||
test, toJSON, toString, valueOf
|
||||
*/
|
||||
|
||||
|
||||
// Create a JSON object only if one does not already exist. We create the
|
||||
// methods in a closure to avoid creating global variables.
|
||||
|
||||
var JSON;
|
||||
if (!JSON) {
|
||||
JSON = {};
|
||||
}
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
function f(n) {
|
||||
// Format integers to have at least two digits.
|
||||
return n < 10 ? '0' + n : n;
|
||||
}
|
||||
|
||||
if (typeof Date.prototype.toJSON !== 'function') {
|
||||
|
||||
Date.prototype.toJSON = function (key) {
|
||||
|
||||
return isFinite(this.valueOf())
|
||||
? this.getUTCFullYear() + '-' +
|
||||
f(this.getUTCMonth() + 1) + '-' +
|
||||
f(this.getUTCDate()) + 'T' +
|
||||
f(this.getUTCHours()) + ':' +
|
||||
f(this.getUTCMinutes()) + ':' +
|
||||
f(this.getUTCSeconds()) + 'Z'
|
||||
: null;
|
||||
};
|
||||
|
||||
String.prototype.toJSON =
|
||||
Number.prototype.toJSON =
|
||||
Boolean.prototype.toJSON = function (key) {
|
||||
return this.valueOf();
|
||||
};
|
||||
}
|
||||
|
||||
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
||||
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
||||
gap,
|
||||
indent,
|
||||
meta = { // table of character substitutions
|
||||
'\b': '\\b',
|
||||
'\t': '\\t',
|
||||
'\n': '\\n',
|
||||
'\f': '\\f',
|
||||
'\r': '\\r',
|
||||
'"' : '\\"',
|
||||
'\\': '\\\\'
|
||||
},
|
||||
rep;
|
||||
|
||||
|
||||
function quote(string) {
|
||||
|
||||
// If the string contains no control characters, no quote characters, and no
|
||||
// backslash characters, then we can safely slap some quotes around it.
|
||||
// Otherwise we must also replace the offending characters with safe escape
|
||||
// sequences.
|
||||
|
||||
escapable.lastIndex = 0;
|
||||
return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
|
||||
var c = meta[a];
|
||||
return typeof c === 'string'
|
||||
? c
|
||||
: '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
|
||||
}) + '"' : '"' + string + '"';
|
||||
}
|
||||
|
||||
|
||||
function str(key, holder) {
|
||||
|
||||
// Produce a string from holder[key].
|
||||
|
||||
var i, // The loop counter.
|
||||
k, // The member key.
|
||||
v, // The member value.
|
||||
length,
|
||||
mind = gap,
|
||||
partial,
|
||||
value = holder[key];
|
||||
|
||||
// If the value has a toJSON method, call it to obtain a replacement value.
|
||||
|
||||
if (value && typeof value === 'object' &&
|
||||
typeof value.toJSON === 'function') {
|
||||
value = value.toJSON(key);
|
||||
}
|
||||
|
||||
// If we were called with a replacer function, then call the replacer to
|
||||
// obtain a replacement value.
|
||||
|
||||
if (typeof rep === 'function') {
|
||||
value = rep.call(holder, key, value);
|
||||
}
|
||||
|
||||
// What happens next depends on the value's type.
|
||||
|
||||
switch (typeof value) {
|
||||
case 'string':
|
||||
return quote(value);
|
||||
|
||||
case 'number':
|
||||
|
||||
// JSON numbers must be finite. Encode non-finite numbers as null.
|
||||
|
||||
return isFinite(value) ? String(value) : 'null';
|
||||
|
||||
case 'boolean':
|
||||
case 'null':
|
||||
|
||||
// If the value is a boolean or null, convert it to a string. Note:
|
||||
// typeof null does not produce 'null'. The case is included here in
|
||||
// the remote chance that this gets fixed someday.
|
||||
|
||||
return String(value);
|
||||
|
||||
// If the type is 'object', we might be dealing with an object or an array or
|
||||
// null.
|
||||
|
||||
case 'object':
|
||||
|
||||
// Due to a specification blunder in ECMAScript, typeof null is 'object',
|
||||
// so watch out for that case.
|
||||
|
||||
if (!value) {
|
||||
return 'null';
|
||||
}
|
||||
|
||||
// Make an array to hold the partial results of stringifying this object value.
|
||||
|
||||
gap += indent;
|
||||
partial = [];
|
||||
|
||||
// Is the value an array?
|
||||
|
||||
if (Object.prototype.toString.apply(value) === '[object Array]') {
|
||||
|
||||
// The value is an array. Stringify every element. Use null as a placeholder
|
||||
// for non-JSON values.
|
||||
|
||||
length = value.length;
|
||||
for (i = 0; i < length; i += 1) {
|
||||
partial[i] = str(i, value) || 'null';
|
||||
}
|
||||
|
||||
// Join all of the elements together, separated with commas, and wrap them in
|
||||
// brackets.
|
||||
|
||||
v = partial.length === 0
|
||||
? '[]'
|
||||
: gap
|
||||
? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']'
|
||||
: '[' + partial.join(',') + ']';
|
||||
gap = mind;
|
||||
return v;
|
||||
}
|
||||
|
||||
// If the replacer is an array, use it to select the members to be stringified.
|
||||
|
||||
if (rep && typeof rep === 'object') {
|
||||
length = rep.length;
|
||||
for (i = 0; i < length; i += 1) {
|
||||
if (typeof rep[i] === 'string') {
|
||||
k = rep[i];
|
||||
v = str(k, value);
|
||||
if (v) {
|
||||
partial.push(quote(k) + (gap ? ': ' : ':') + v);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
// Otherwise, iterate through all of the keys in the object.
|
||||
|
||||
for (k in value) {
|
||||
if (Object.prototype.hasOwnProperty.call(value, k)) {
|
||||
v = str(k, value);
|
||||
if (v) {
|
||||
partial.push(quote(k) + (gap ? ': ' : ':') + v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Join all of the member texts together, separated with commas,
|
||||
// and wrap them in braces.
|
||||
|
||||
v = partial.length === 0
|
||||
? '{}'
|
||||
: gap
|
||||
? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}'
|
||||
: '{' + partial.join(',') + '}';
|
||||
gap = mind;
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
||||
// If the JSON object does not yet have a stringify method, give it one.
|
||||
|
||||
if (typeof JSON.stringify !== 'function') {
|
||||
JSON.stringify = function (value, replacer, space) {
|
||||
|
||||
// The stringify method takes a value and an optional replacer, and an optional
|
||||
// space parameter, and returns a JSON text. The replacer can be a function
|
||||
// that can replace values, or an array of strings that will select the keys.
|
||||
// A default replacer method can be provided. Use of the space parameter can
|
||||
// produce text that is more easily readable.
|
||||
|
||||
var i;
|
||||
gap = '';
|
||||
indent = '';
|
||||
|
||||
// If the space parameter is a number, make an indent string containing that
|
||||
// many spaces.
|
||||
|
||||
if (typeof space === 'number') {
|
||||
for (i = 0; i < space; i += 1) {
|
||||
indent += ' ';
|
||||
}
|
||||
|
||||
// If the space parameter is a string, it will be used as the indent string.
|
||||
|
||||
} else if (typeof space === 'string') {
|
||||
indent = space;
|
||||
}
|
||||
|
||||
// If there is a replacer, it must be a function or an array.
|
||||
// Otherwise, throw an error.
|
||||
|
||||
rep = replacer;
|
||||
if (replacer && typeof replacer !== 'function' &&
|
||||
(typeof replacer !== 'object' ||
|
||||
typeof replacer.length !== 'number')) {
|
||||
throw new Error('JSON.stringify');
|
||||
}
|
||||
|
||||
// Make a fake root object containing our value under the key of ''.
|
||||
// Return the result of stringifying the value.
|
||||
|
||||
return str('', {'': value});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// If the JSON object does not yet have a parse method, give it one.
|
||||
|
||||
if (typeof JSON.parse !== 'function') {
|
||||
JSON.parse = function (text, reviver) {
|
||||
|
||||
// The parse method takes a text and an optional reviver function, and returns
|
||||
// a JavaScript value if the text is a valid JSON text.
|
||||
|
||||
var j;
|
||||
|
||||
function walk(holder, key) {
|
||||
|
||||
// The walk method is used to recursively walk the resulting structure so
|
||||
// that modifications can be made.
|
||||
|
||||
var k, v, value = holder[key];
|
||||
if (value && typeof value === 'object') {
|
||||
for (k in value) {
|
||||
if (Object.prototype.hasOwnProperty.call(value, k)) {
|
||||
v = walk(value, k);
|
||||
if (v !== undefined) {
|
||||
value[k] = v;
|
||||
} else {
|
||||
delete value[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return reviver.call(holder, key, value);
|
||||
}
|
||||
|
||||
|
||||
// Parsing happens in four stages. In the first stage, we replace certain
|
||||
// Unicode characters with escape sequences. JavaScript handles many characters
|
||||
// incorrectly, either silently deleting them, or treating them as line endings.
|
||||
|
||||
text = String(text);
|
||||
cx.lastIndex = 0;
|
||||
if (cx.test(text)) {
|
||||
text = text.replace(cx, function (a) {
|
||||
return '\\u' +
|
||||
('0000' + a.charCodeAt(0).toString(16)).slice(-4);
|
||||
});
|
||||
}
|
||||
|
||||
// In the second stage, we run the text against regular expressions that look
|
||||
// for non-JSON patterns. We are especially concerned with '()' and 'new'
|
||||
// because they can cause invocation, and '=' because it can cause mutation.
|
||||
// But just to be safe, we want to reject all unexpected forms.
|
||||
|
||||
// We split the second stage into 4 regexp operations in order to work around
|
||||
// crippling inefficiencies in IE's and Safari's regexp engines. First we
|
||||
// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
|
||||
// replace all simple value tokens with ']' characters. Third, we delete all
|
||||
// open brackets that follow a colon or comma or that begin the text. Finally,
|
||||
// we look to see that the remaining characters are only whitespace or ']' or
|
||||
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
|
||||
|
||||
if (/^[\],:{}\s]*$/
|
||||
.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
|
||||
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
|
||||
.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
|
||||
|
||||
// In the third stage we use the eval function to compile the text into a
|
||||
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
|
||||
// in JavaScript: it can begin a block or an object literal. We wrap the text
|
||||
// in parens to eliminate the ambiguity.
|
||||
|
||||
j = eval('(' + text + ')');
|
||||
|
||||
// In the optional fourth stage, we recursively walk the new structure, passing
|
||||
// each name/value pair to a reviver function for possible transformation.
|
||||
|
||||
return typeof reviver === 'function'
|
||||
? walk({'': j}, '')
|
||||
: j;
|
||||
}
|
||||
|
||||
// If the text is not JSON parseable, then a SyntaxError is thrown.
|
||||
|
||||
throw new SyntaxError('JSON.parse');
|
||||
};
|
||||
}
|
||||
}());
|
1616
src/_h5ai/client/js/lib/markdown-0.4.0.js
Normal file
1616
src/_h5ai/client/js/lib/markdown-0.4.0.js
Normal file
File diff suppressed because it is too large
Load diff
404
src/_h5ai/client/js/lib/modernizr-2.6.2.js
vendored
Normal file
404
src/_h5ai/client/js/lib/modernizr-2.6.2.js
vendored
Normal file
|
@ -0,0 +1,404 @@
|
|||
/* Modernizr 2.6.2 (Custom Build) | MIT & BSD
|
||||
* Build: http://modernizr.com/download/#-opacity-rgba-canvas-history-audio-video-shiv-cssclasses-prefixes
|
||||
*/
|
||||
;
|
||||
|
||||
|
||||
|
||||
window.Modernizr = (function( window, document, undefined ) {
|
||||
|
||||
var version = '2.6.2',
|
||||
|
||||
Modernizr = {},
|
||||
|
||||
enableClasses = true,
|
||||
|
||||
docElement = document.documentElement,
|
||||
|
||||
mod = 'modernizr',
|
||||
modElem = document.createElement(mod),
|
||||
mStyle = modElem.style,
|
||||
|
||||
inputElem ,
|
||||
|
||||
|
||||
toString = {}.toString,
|
||||
|
||||
prefixes = ' -webkit- -moz- -o- -ms- '.split(' '),
|
||||
|
||||
|
||||
|
||||
tests = {},
|
||||
inputs = {},
|
||||
attrs = {},
|
||||
|
||||
classes = [],
|
||||
|
||||
slice = classes.slice,
|
||||
|
||||
featureName,
|
||||
|
||||
|
||||
|
||||
_hasOwnProperty = ({}).hasOwnProperty, hasOwnProp;
|
||||
|
||||
if ( !is(_hasOwnProperty, 'undefined') && !is(_hasOwnProperty.call, 'undefined') ) {
|
||||
hasOwnProp = function (object, property) {
|
||||
return _hasOwnProperty.call(object, property);
|
||||
};
|
||||
}
|
||||
else {
|
||||
hasOwnProp = function (object, property) {
|
||||
return ((property in object) && is(object.constructor.prototype[property], 'undefined'));
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
if (!Function.prototype.bind) {
|
||||
Function.prototype.bind = function bind(that) {
|
||||
|
||||
var target = this;
|
||||
|
||||
if (typeof target != "function") {
|
||||
throw new TypeError();
|
||||
}
|
||||
|
||||
var args = slice.call(arguments, 1),
|
||||
bound = function () {
|
||||
|
||||
if (this instanceof bound) {
|
||||
|
||||
var F = function(){};
|
||||
F.prototype = target.prototype;
|
||||
var self = new F();
|
||||
|
||||
var result = target.apply(
|
||||
self,
|
||||
args.concat(slice.call(arguments))
|
||||
);
|
||||
if (Object(result) === result) {
|
||||
return result;
|
||||
}
|
||||
return self;
|
||||
|
||||
} else {
|
||||
|
||||
return target.apply(
|
||||
that,
|
||||
args.concat(slice.call(arguments))
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
return bound;
|
||||
};
|
||||
}
|
||||
|
||||
function setCss( str ) {
|
||||
mStyle.cssText = str;
|
||||
}
|
||||
|
||||
function setCssAll( str1, str2 ) {
|
||||
return setCss(prefixes.join(str1 + ';') + ( str2 || '' ));
|
||||
}
|
||||
|
||||
function is( obj, type ) {
|
||||
return typeof obj === type;
|
||||
}
|
||||
|
||||
function contains( str, substr ) {
|
||||
return !!~('' + str).indexOf(substr);
|
||||
}
|
||||
|
||||
|
||||
function testDOMProps( props, obj, elem ) {
|
||||
for ( var i in props ) {
|
||||
var item = obj[props[i]];
|
||||
if ( item !== undefined) {
|
||||
|
||||
if (elem === false) return props[i];
|
||||
|
||||
if (is(item, 'function')){
|
||||
return item.bind(elem || obj);
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} tests['canvas'] = function() {
|
||||
var elem = document.createElement('canvas');
|
||||
return !!(elem.getContext && elem.getContext('2d'));
|
||||
};
|
||||
|
||||
tests['history'] = function() {
|
||||
return !!(window.history && history.pushState);
|
||||
}; tests['rgba'] = function() {
|
||||
setCss('background-color:rgba(150,255,150,.5)');
|
||||
|
||||
return contains(mStyle.backgroundColor, 'rgba');
|
||||
}; tests['opacity'] = function() {
|
||||
setCssAll('opacity:.55');
|
||||
|
||||
return (/^0.55$/).test(mStyle.opacity);
|
||||
};
|
||||
|
||||
|
||||
tests['video'] = function() {
|
||||
var elem = document.createElement('video'),
|
||||
bool = false;
|
||||
|
||||
try {
|
||||
if ( bool = !!elem.canPlayType ) {
|
||||
bool = new Boolean(bool);
|
||||
bool.ogg = elem.canPlayType('video/ogg; codecs="theora"') .replace(/^no$/,'');
|
||||
|
||||
bool.h264 = elem.canPlayType('video/mp4; codecs="avc1.42E01E"') .replace(/^no$/,'');
|
||||
|
||||
bool.webm = elem.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,'');
|
||||
}
|
||||
|
||||
} catch(e) { }
|
||||
|
||||
return bool;
|
||||
};
|
||||
|
||||
tests['audio'] = function() {
|
||||
var elem = document.createElement('audio'),
|
||||
bool = false;
|
||||
|
||||
try {
|
||||
if ( bool = !!elem.canPlayType ) {
|
||||
bool = new Boolean(bool);
|
||||
bool.ogg = elem.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,'');
|
||||
bool.mp3 = elem.canPlayType('audio/mpeg;') .replace(/^no$/,'');
|
||||
|
||||
bool.wav = elem.canPlayType('audio/wav; codecs="1"') .replace(/^no$/,'');
|
||||
bool.m4a = ( elem.canPlayType('audio/x-m4a;') ||
|
||||
elem.canPlayType('audio/aac;')) .replace(/^no$/,'');
|
||||
}
|
||||
} catch(e) { }
|
||||
|
||||
return bool;
|
||||
}; for ( var feature in tests ) {
|
||||
if ( hasOwnProp(tests, feature) ) {
|
||||
featureName = feature.toLowerCase();
|
||||
Modernizr[featureName] = tests[feature]();
|
||||
|
||||
classes.push((Modernizr[featureName] ? '' : 'no-') + featureName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Modernizr.addTest = function ( feature, test ) {
|
||||
if ( typeof feature == 'object' ) {
|
||||
for ( var key in feature ) {
|
||||
if ( hasOwnProp( feature, key ) ) {
|
||||
Modernizr.addTest( key, feature[ key ] );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
feature = feature.toLowerCase();
|
||||
|
||||
if ( Modernizr[feature] !== undefined ) {
|
||||
return Modernizr;
|
||||
}
|
||||
|
||||
test = typeof test == 'function' ? test() : test;
|
||||
|
||||
if (typeof enableClasses !== "undefined" && enableClasses) {
|
||||
docElement.className += ' ' + (test ? '' : 'no-') + feature;
|
||||
}
|
||||
Modernizr[feature] = test;
|
||||
|
||||
}
|
||||
|
||||
return Modernizr;
|
||||
};
|
||||
|
||||
|
||||
setCss('');
|
||||
modElem = inputElem = null;
|
||||
|
||||
;(function(window, document) {
|
||||
var options = window.html5 || {};
|
||||
|
||||
var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i;
|
||||
|
||||
var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i;
|
||||
|
||||
var supportsHtml5Styles;
|
||||
|
||||
var expando = '_html5shiv';
|
||||
|
||||
var expanID = 0;
|
||||
|
||||
var expandoData = {};
|
||||
|
||||
var supportsUnknownElements;
|
||||
|
||||
(function() {
|
||||
try {
|
||||
var a = document.createElement('a');
|
||||
a.innerHTML = '<xyz></xyz>';
|
||||
supportsHtml5Styles = ('hidden' in a);
|
||||
|
||||
supportsUnknownElements = a.childNodes.length == 1 || (function() {
|
||||
(document.createElement)('a');
|
||||
var frag = document.createDocumentFragment();
|
||||
return (
|
||||
typeof frag.cloneNode == 'undefined' ||
|
||||
typeof frag.createDocumentFragment == 'undefined' ||
|
||||
typeof frag.createElement == 'undefined'
|
||||
);
|
||||
}());
|
||||
} catch(e) {
|
||||
supportsHtml5Styles = true;
|
||||
supportsUnknownElements = true;
|
||||
}
|
||||
|
||||
}()); function addStyleSheet(ownerDocument, cssText) {
|
||||
var p = ownerDocument.createElement('p'),
|
||||
parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement;
|
||||
|
||||
p.innerHTML = 'x<style>' + cssText + '</style>';
|
||||
return parent.insertBefore(p.lastChild, parent.firstChild);
|
||||
}
|
||||
|
||||
function getElements() {
|
||||
var elements = html5.elements;
|
||||
return typeof elements == 'string' ? elements.split(' ') : elements;
|
||||
}
|
||||
|
||||
function getExpandoData(ownerDocument) {
|
||||
var data = expandoData[ownerDocument[expando]];
|
||||
if (!data) {
|
||||
data = {};
|
||||
expanID++;
|
||||
ownerDocument[expando] = expanID;
|
||||
expandoData[expanID] = data;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
function createElement(nodeName, ownerDocument, data){
|
||||
if (!ownerDocument) {
|
||||
ownerDocument = document;
|
||||
}
|
||||
if(supportsUnknownElements){
|
||||
return ownerDocument.createElement(nodeName);
|
||||
}
|
||||
if (!data) {
|
||||
data = getExpandoData(ownerDocument);
|
||||
}
|
||||
var node;
|
||||
|
||||
if (data.cache[nodeName]) {
|
||||
node = data.cache[nodeName].cloneNode();
|
||||
} else if (saveClones.test(nodeName)) {
|
||||
node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode();
|
||||
} else {
|
||||
node = data.createElem(nodeName);
|
||||
}
|
||||
|
||||
return node.canHaveChildren && !reSkip.test(nodeName) ? data.frag.appendChild(node) : node;
|
||||
}
|
||||
|
||||
function createDocumentFragment(ownerDocument, data){
|
||||
if (!ownerDocument) {
|
||||
ownerDocument = document;
|
||||
}
|
||||
if(supportsUnknownElements){
|
||||
return ownerDocument.createDocumentFragment();
|
||||
}
|
||||
data = data || getExpandoData(ownerDocument);
|
||||
var clone = data.frag.cloneNode(),
|
||||
i = 0,
|
||||
elems = getElements(),
|
||||
l = elems.length;
|
||||
for(;i<l;i++){
|
||||
clone.createElement(elems[i]);
|
||||
}
|
||||
return clone;
|
||||
}
|
||||
|
||||
function shivMethods(ownerDocument, data) {
|
||||
if (!data.cache) {
|
||||
data.cache = {};
|
||||
data.createElem = ownerDocument.createElement;
|
||||
data.createFrag = ownerDocument.createDocumentFragment;
|
||||
data.frag = data.createFrag();
|
||||
}
|
||||
|
||||
|
||||
ownerDocument.createElement = function(nodeName) {
|
||||
if (!html5.shivMethods) {
|
||||
return data.createElem(nodeName);
|
||||
}
|
||||
return createElement(nodeName, ownerDocument, data);
|
||||
};
|
||||
|
||||
ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' +
|
||||
'var n=f.cloneNode(),c=n.createElement;' +
|
||||
'h.shivMethods&&(' +
|
||||
getElements().join().replace(/\w+/g, function(nodeName) {
|
||||
data.createElem(nodeName);
|
||||
data.frag.createElement(nodeName);
|
||||
return 'c("' + nodeName + '")';
|
||||
}) +
|
||||
');return n}'
|
||||
)(html5, data.frag);
|
||||
} function shivDocument(ownerDocument) {
|
||||
if (!ownerDocument) {
|
||||
ownerDocument = document;
|
||||
}
|
||||
var data = getExpandoData(ownerDocument);
|
||||
|
||||
if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) {
|
||||
data.hasCSS = !!addStyleSheet(ownerDocument,
|
||||
'article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}' +
|
||||
'mark{background:#FF0;color:#000}'
|
||||
);
|
||||
}
|
||||
if (!supportsUnknownElements) {
|
||||
shivMethods(ownerDocument, data);
|
||||
}
|
||||
return ownerDocument;
|
||||
} var html5 = {
|
||||
|
||||
'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video',
|
||||
|
||||
'shivCSS': (options.shivCSS !== false),
|
||||
|
||||
'supportsUnknownElements': supportsUnknownElements,
|
||||
|
||||
'shivMethods': (options.shivMethods !== false),
|
||||
|
||||
'type': 'default',
|
||||
|
||||
'shivDocument': shivDocument,
|
||||
|
||||
createElement: createElement,
|
||||
|
||||
createDocumentFragment: createDocumentFragment
|
||||
}; window.html5 = html5;
|
||||
|
||||
shivDocument(document);
|
||||
|
||||
}(this, document));
|
||||
|
||||
Modernizr._version = version;
|
||||
|
||||
Modernizr._prefixes = prefixes;
|
||||
docElement.className = docElement.className.replace(/(^|\s)no-js(\s|$)/, '$1$2') +
|
||||
|
||||
(enableClasses ? ' js ' + classes.join(' ') : '');
|
||||
|
||||
return Modernizr;
|
||||
|
||||
})(this, this.document);
|
||||
;
|
247
src/_h5ai/client/js/lib/modulejs-0.2.js
Normal file
247
src/_h5ai/client/js/lib/modulejs-0.2.js
Normal file
|
@ -0,0 +1,247 @@
|
|||
/*! modulejs 0.2 - //larsjung.de/modulejs - MIT License */
|
||||
|
||||
(function (global, name) {
|
||||
'use strict';
|
||||
|
||||
|
||||
var objProto = Object.prototype,
|
||||
arrayForEach = Array.prototype.forEach,
|
||||
isType = function (arg, type) {
|
||||
|
||||
return objProto.toString.call(arg) === '[object ' + type + ']';
|
||||
},
|
||||
isString = function (arg) {
|
||||
|
||||
return isType(arg, 'String');
|
||||
},
|
||||
isFunction = function (arg) {
|
||||
|
||||
return isType(arg, 'Function');
|
||||
},
|
||||
isArray = Array.isArray || function (arg) {
|
||||
|
||||
return isType(arg, 'Array');
|
||||
},
|
||||
isObject = function (arg) {
|
||||
|
||||
return arg === new Object(arg);
|
||||
},
|
||||
has = function (arg, id) {
|
||||
|
||||
return objProto.hasOwnProperty.call(arg, id);
|
||||
},
|
||||
each = function (obj, iterator, context) {
|
||||
|
||||
if (arrayForEach && obj.forEach === arrayForEach) {
|
||||
obj.forEach(iterator, context);
|
||||
} else if (obj.length === +obj.length) {
|
||||
for (var i = 0, l = obj.length; i < l; i += 1) {
|
||||
iterator.call(context, obj[i], i, obj);
|
||||
}
|
||||
} else {
|
||||
for (var key in obj) {
|
||||
if (has(obj, key)) {
|
||||
iterator.call(context, obj[key], key, obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
contains = function (array, item) {
|
||||
|
||||
for (var i = 0, l = array.length; i < l; i += 1) {
|
||||
if (array[i] === item) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
uniq = function (array) {
|
||||
|
||||
var elements = {},
|
||||
result = [];
|
||||
|
||||
each(array, function (el) {
|
||||
|
||||
if (!has(elements, el)) {
|
||||
result.push(el);
|
||||
elements[el] = 1;
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
},
|
||||
err = function (condition, code, message) {
|
||||
|
||||
if (condition) {
|
||||
throw {
|
||||
code: code,
|
||||
msg: message,
|
||||
toString: function () {
|
||||
return name + ' error ' + code + ': ' + message;
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
// Module definitions.
|
||||
definitions = {},
|
||||
|
||||
// Module instances.
|
||||
instances = {},
|
||||
|
||||
resolve = function (id, cold, stack) {
|
||||
|
||||
err(!isString(id), 31, 'id must be a string "' + id + '"');
|
||||
|
||||
if (!cold && has(instances, id)) {
|
||||
return instances[id];
|
||||
}
|
||||
|
||||
var def = definitions[id];
|
||||
err(!def, 32, 'id not defined "' + id + '"');
|
||||
|
||||
stack = (stack || []).slice(0);
|
||||
stack.push(id);
|
||||
|
||||
var deps = [];
|
||||
|
||||
each(def.deps, function (depId, idx) {
|
||||
|
||||
err(contains(stack, depId), 33, 'cyclic dependencies: ' + stack + ' & ' + depId);
|
||||
|
||||
if (cold) {
|
||||
deps = deps.concat(resolve(depId, cold, stack));
|
||||
deps.push(depId);
|
||||
} else {
|
||||
deps[idx] = resolve(depId, cold, stack);
|
||||
}
|
||||
});
|
||||
|
||||
if (cold) {
|
||||
return uniq(deps);
|
||||
}
|
||||
|
||||
var obj = def.fn.apply(global, deps);
|
||||
instances[id] = obj;
|
||||
return obj;
|
||||
},
|
||||
|
||||
|
||||
|
||||
// Public methods
|
||||
// --------------
|
||||
|
||||
// ### define
|
||||
// Defines a module for `id: String`, optional `deps: Array[String]`,
|
||||
// `arg: Object/function`.
|
||||
define = function (id, deps, arg) {
|
||||
|
||||
// sort arguments
|
||||
if (arg === undefined) {
|
||||
arg = deps;
|
||||
deps = [];
|
||||
}
|
||||
// check arguments
|
||||
err(!isString(id), 11, 'id must be a string "' + id + '"');
|
||||
err(definitions[id], 12, 'id already defined "' + id + '"');
|
||||
err(!isArray(deps), 13, 'dependencies for "' + id + '" must be an array "' + deps + '"');
|
||||
err(!isObject(arg) && !isFunction(arg), 14, 'arg for "' + id + '" must be object or function "' + arg + '"');
|
||||
|
||||
// accept definition
|
||||
definitions[id] = {
|
||||
id: id,
|
||||
deps: deps,
|
||||
fn: isFunction(arg) ? arg : function () { return arg; }
|
||||
};
|
||||
},
|
||||
|
||||
// ### require
|
||||
// Returns an instance for `id`.
|
||||
require = function (id) {
|
||||
|
||||
return resolve(id);
|
||||
},
|
||||
|
||||
// ### state
|
||||
// Returns an object that holds infos about the current definitions and dependencies.
|
||||
state = function () {
|
||||
|
||||
var res = {};
|
||||
|
||||
each(definitions, function (def, id) {
|
||||
|
||||
res[id] = {
|
||||
|
||||
// direct dependencies
|
||||
deps: def.deps.slice(0),
|
||||
|
||||
// transitive dependencies
|
||||
reqs: resolve(id, true),
|
||||
|
||||
// already initiated/required
|
||||
init: has(instances, id)
|
||||
};
|
||||
});
|
||||
|
||||
each(definitions, function (def, id) {
|
||||
|
||||
var inv = [];
|
||||
each(definitions, function (def2, id2) {
|
||||
|
||||
if (contains(res[id2].reqs, id)) {
|
||||
inv.push(id2);
|
||||
}
|
||||
});
|
||||
|
||||
// all inverse dependencies
|
||||
res[id].reqd = inv;
|
||||
});
|
||||
|
||||
return res;
|
||||
},
|
||||
|
||||
// ### log
|
||||
// Returns a string that displays module dependencies.
|
||||
log = function (inv) {
|
||||
|
||||
var out = '\n';
|
||||
|
||||
each(state(), function (st, id) {
|
||||
|
||||
var list = inv ? st.reqd : st.reqs;
|
||||
out += (st.init ? '* ' : ' ') + id + ' -> [ ' + list.join(', ') + ' ]\n';
|
||||
});
|
||||
|
||||
return out;
|
||||
};
|
||||
|
||||
|
||||
// Register Public API
|
||||
// -------------------
|
||||
global[name] = {
|
||||
define: define,
|
||||
require: require,
|
||||
state: state,
|
||||
log: log
|
||||
};
|
||||
|
||||
// Uncomment to run internal tests.
|
||||
/*
|
||||
if (global[name.toUpperCase()] === true) {
|
||||
global[name.toUpperCase()] = {
|
||||
isString: isString,
|
||||
isFunction: isFunction,
|
||||
isArray: isArray,
|
||||
isObject: isObject,
|
||||
has: has,
|
||||
each: each,
|
||||
contains: contains,
|
||||
uniq: uniq,
|
||||
err: err,
|
||||
definitions: definitions,
|
||||
instances: instances,
|
||||
resolve: resolve
|
||||
};
|
||||
} // */
|
||||
|
||||
}(this, 'modulejs'));
|
1213
src/_h5ai/client/js/lib/moment-1.7.2.js
Normal file
1213
src/_h5ai/client/js/lib/moment-1.7.2.js
Normal file
File diff suppressed because it is too large
Load diff
59
src/_h5ai/client/js/lib/sh/shBrushAS3.js
vendored
Normal file
59
src/_h5ai/client/js/lib/sh/shBrushAS3.js
vendored
Normal file
|
@ -0,0 +1,59 @@
|
|||
/**
|
||||
* SyntaxHighlighter
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter
|
||||
*
|
||||
* SyntaxHighlighter is donationware. If you are using it, please donate.
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
|
||||
*
|
||||
* @version
|
||||
* 3.0.83 (July 02 2010)
|
||||
*
|
||||
* @copyright
|
||||
* Copyright (C) 2004-2010 Alex Gorbatchev.
|
||||
*
|
||||
* @license
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
*/
|
||||
;(function()
|
||||
{
|
||||
// CommonJS
|
||||
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
||||
|
||||
function Brush()
|
||||
{
|
||||
// Created by Peter Atoria @ http://iAtoria.com
|
||||
|
||||
var inits = 'class interface function package';
|
||||
|
||||
var keywords = '-Infinity ...rest Array as AS3 Boolean break case catch const continue Date decodeURI ' +
|
||||
'decodeURIComponent default delete do dynamic each else encodeURI encodeURIComponent escape ' +
|
||||
'extends false final finally flash_proxy for get if implements import in include Infinity ' +
|
||||
'instanceof int internal is isFinite isNaN isXMLName label namespace NaN native new null ' +
|
||||
'Null Number Object object_proxy override parseFloat parseInt private protected public ' +
|
||||
'return set static String super switch this throw true try typeof uint undefined unescape ' +
|
||||
'use void while with'
|
||||
;
|
||||
|
||||
this.regexList = [
|
||||
{ regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
|
||||
{ regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
|
||||
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
|
||||
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
|
||||
{ regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers
|
||||
{ regex: new RegExp(this.getKeywords(inits), 'gm'), css: 'color3' }, // initializations
|
||||
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords
|
||||
{ regex: new RegExp('var', 'gm'), css: 'variable' }, // variable
|
||||
{ regex: new RegExp('trace', 'gm'), css: 'color1' } // trace
|
||||
];
|
||||
|
||||
this.forHtmlScript(SyntaxHighlighter.regexLib.scriptScriptTags);
|
||||
};
|
||||
|
||||
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
||||
Brush.aliases = ['actionscript3', 'as3'];
|
||||
|
||||
SyntaxHighlighter.brushes.AS3 = Brush;
|
||||
|
||||
// CommonJS
|
||||
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
||||
})();
|
75
src/_h5ai/client/js/lib/sh/shBrushAppleScript.js
vendored
Normal file
75
src/_h5ai/client/js/lib/sh/shBrushAppleScript.js
vendored
Normal file
File diff suppressed because one or more lines are too long
59
src/_h5ai/client/js/lib/sh/shBrushBash.js
vendored
Normal file
59
src/_h5ai/client/js/lib/sh/shBrushBash.js
vendored
Normal file
|
@ -0,0 +1,59 @@
|
|||
/**
|
||||
* SyntaxHighlighter
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter
|
||||
*
|
||||
* SyntaxHighlighter is donationware. If you are using it, please donate.
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
|
||||
*
|
||||
* @version
|
||||
* 3.0.83 (July 02 2010)
|
||||
*
|
||||
* @copyright
|
||||
* Copyright (C) 2004-2010 Alex Gorbatchev.
|
||||
*
|
||||
* @license
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
*/
|
||||
;(function()
|
||||
{
|
||||
// CommonJS
|
||||
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
||||
|
||||
function Brush()
|
||||
{
|
||||
var keywords = 'if fi then elif else for do done until while break continue case function return in eq ne ge le';
|
||||
var commands = 'alias apropos awk basename bash bc bg builtin bzip2 cal cat cd cfdisk chgrp chmod chown chroot' +
|
||||
'cksum clear cmp comm command cp cron crontab csplit cut date dc dd ddrescue declare df ' +
|
||||
'diff diff3 dig dir dircolors dirname dirs du echo egrep eject enable env ethtool eval ' +
|
||||
'exec exit expand export expr false fdformat fdisk fg fgrep file find fmt fold format ' +
|
||||
'free fsck ftp gawk getopts grep groups gzip hash head history hostname id ifconfig ' +
|
||||
'import install join kill less let ln local locate logname logout look lpc lpr lprint ' +
|
||||
'lprintd lprintq lprm ls lsof make man mkdir mkfifo mkisofs mknod more mount mtools ' +
|
||||
'mv netstat nice nl nohup nslookup open op passwd paste pathchk ping popd pr printcap ' +
|
||||
'printenv printf ps pushd pwd quota quotacheck quotactl ram rcp read readonly renice ' +
|
||||
'remsync rm rmdir rsync screen scp sdiff sed select seq set sftp shift shopt shutdown ' +
|
||||
'sleep sort source split ssh strace su sudo sum symlink sync tail tar tee test time ' +
|
||||
'times touch top traceroute trap tr true tsort tty type ulimit umask umount unalias ' +
|
||||
'uname unexpand uniq units unset unshar useradd usermod users uuencode uudecode v vdir ' +
|
||||
'vi watch wc whereis which who whoami Wget xargs yes'
|
||||
;
|
||||
|
||||
this.regexList = [
|
||||
{ regex: /^#!.*$/gm, css: 'preprocessor bold' },
|
||||
{ regex: /\/[\w-\/]+/gm, css: 'plain' },
|
||||
{ regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, // one line comments
|
||||
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
|
||||
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
|
||||
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords
|
||||
{ regex: new RegExp(this.getKeywords(commands), 'gm'), css: 'functions' } // commands
|
||||
];
|
||||
}
|
||||
|
||||
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
||||
Brush.aliases = ['bash', 'shell'];
|
||||
|
||||
SyntaxHighlighter.brushes.Bash = Brush;
|
||||
|
||||
// CommonJS
|
||||
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
||||
})();
|
65
src/_h5ai/client/js/lib/sh/shBrushCSharp.js
vendored
Normal file
65
src/_h5ai/client/js/lib/sh/shBrushCSharp.js
vendored
Normal file
|
@ -0,0 +1,65 @@
|
|||
/**
|
||||
* SyntaxHighlighter
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter
|
||||
*
|
||||
* SyntaxHighlighter is donationware. If you are using it, please donate.
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
|
||||
*
|
||||
* @version
|
||||
* 3.0.83 (July 02 2010)
|
||||
*
|
||||
* @copyright
|
||||
* Copyright (C) 2004-2010 Alex Gorbatchev.
|
||||
*
|
||||
* @license
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
*/
|
||||
;(function()
|
||||
{
|
||||
// CommonJS
|
||||
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
||||
|
||||
function Brush()
|
||||
{
|
||||
var keywords = 'abstract as base bool break byte case catch char checked class const ' +
|
||||
'continue decimal default delegate do double else enum event explicit ' +
|
||||
'extern false finally fixed float for foreach get goto if implicit in int ' +
|
||||
'interface internal is lock long namespace new null object operator out ' +
|
||||
'override params private protected public readonly ref return sbyte sealed set ' +
|
||||
'short sizeof stackalloc static string struct switch this throw true try ' +
|
||||
'typeof uint ulong unchecked unsafe ushort using virtual void while';
|
||||
|
||||
function fixComments(match, regexInfo)
|
||||
{
|
||||
var css = (match[0].indexOf("///") == 0)
|
||||
? 'color1'
|
||||
: 'comments'
|
||||
;
|
||||
|
||||
return [new SyntaxHighlighter.Match(match[0], match.index, css)];
|
||||
}
|
||||
|
||||
this.regexList = [
|
||||
{ regex: SyntaxHighlighter.regexLib.singleLineCComments, func : fixComments }, // one line comments
|
||||
{ regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
|
||||
{ regex: /@"(?:[^"]|"")*"/g, css: 'string' }, // @-quoted strings
|
||||
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
|
||||
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
|
||||
{ regex: /^\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion
|
||||
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // c# keyword
|
||||
{ regex: /\bpartial(?=\s+(?:class|interface|struct)\b)/g, css: 'keyword' }, // contextual keyword: 'partial'
|
||||
{ regex: /\byield(?=\s+(?:return|break)\b)/g, css: 'keyword' } // contextual keyword: 'yield'
|
||||
];
|
||||
|
||||
this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
|
||||
};
|
||||
|
||||
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
||||
Brush.aliases = ['c#', 'c-sharp', 'csharp'];
|
||||
|
||||
SyntaxHighlighter.brushes.CSharp = Brush;
|
||||
|
||||
// CommonJS
|
||||
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
||||
})();
|
||||
|
100
src/_h5ai/client/js/lib/sh/shBrushColdFusion.js
vendored
Normal file
100
src/_h5ai/client/js/lib/sh/shBrushColdFusion.js
vendored
Normal file
|
@ -0,0 +1,100 @@
|
|||
/**
|
||||
* SyntaxHighlighter
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter
|
||||
*
|
||||
* SyntaxHighlighter is donationware. If you are using it, please donate.
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
|
||||
*
|
||||
* @version
|
||||
* 3.0.83 (July 02 2010)
|
||||
*
|
||||
* @copyright
|
||||
* Copyright (C) 2004-2010 Alex Gorbatchev.
|
||||
*
|
||||
* @license
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
*/
|
||||
;(function()
|
||||
{
|
||||
// CommonJS
|
||||
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
||||
|
||||
function Brush()
|
||||
{
|
||||
// Contributed by Jen
|
||||
// http://www.jensbits.com/2009/05/14/coldfusion-brush-for-syntaxhighlighter-plus
|
||||
|
||||
var funcs = 'Abs ACos AddSOAPRequestHeader AddSOAPResponseHeader AjaxLink AjaxOnLoad ArrayAppend ArrayAvg ArrayClear ArrayDeleteAt ' +
|
||||
'ArrayInsertAt ArrayIsDefined ArrayIsEmpty ArrayLen ArrayMax ArrayMin ArraySet ArraySort ArraySum ArraySwap ArrayToList ' +
|
||||
'Asc ASin Atn BinaryDecode BinaryEncode BitAnd BitMaskClear BitMaskRead BitMaskSet BitNot BitOr BitSHLN BitSHRN BitXor ' +
|
||||
'Ceiling CharsetDecode CharsetEncode Chr CJustify Compare CompareNoCase Cos CreateDate CreateDateTime CreateObject ' +
|
||||
'CreateODBCDate CreateODBCDateTime CreateODBCTime CreateTime CreateTimeSpan CreateUUID DateAdd DateCompare DateConvert ' +
|
||||
'DateDiff DateFormat DatePart Day DayOfWeek DayOfWeekAsString DayOfYear DaysInMonth DaysInYear DE DecimalFormat DecrementValue ' +
|
||||
'Decrypt DecryptBinary DeleteClientVariable DeserializeJSON DirectoryExists DollarFormat DotNetToCFType Duplicate Encrypt ' +
|
||||
'EncryptBinary Evaluate Exp ExpandPath FileClose FileCopy FileDelete FileExists FileIsEOF FileMove FileOpen FileRead ' +
|
||||
'FileReadBinary FileReadLine FileSetAccessMode FileSetAttribute FileSetLastModified FileWrite Find FindNoCase FindOneOf ' +
|
||||
'FirstDayOfMonth Fix FormatBaseN GenerateSecretKey GetAuthUser GetBaseTagData GetBaseTagList GetBaseTemplatePath ' +
|
||||
'GetClientVariablesList GetComponentMetaData GetContextRoot GetCurrentTemplatePath GetDirectoryFromPath GetEncoding ' +
|
||||
'GetException GetFileFromPath GetFileInfo GetFunctionList GetGatewayHelper GetHttpRequestData GetHttpTimeString ' +
|
||||
'GetK2ServerDocCount GetK2ServerDocCountLimit GetLocale GetLocaleDisplayName GetLocalHostIP GetMetaData GetMetricData ' +
|
||||
'GetPageContext GetPrinterInfo GetProfileSections GetProfileString GetReadableImageFormats GetSOAPRequest GetSOAPRequestHeader ' +
|
||||
'GetSOAPResponse GetSOAPResponseHeader GetTempDirectory GetTempFile GetTemplatePath GetTickCount GetTimeZoneInfo GetToken ' +
|
||||
'GetUserRoles GetWriteableImageFormats Hash Hour HTMLCodeFormat HTMLEditFormat IIf ImageAddBorder ImageBlur ImageClearRect ' +
|
||||
'ImageCopy ImageCrop ImageDrawArc ImageDrawBeveledRect ImageDrawCubicCurve ImageDrawLine ImageDrawLines ImageDrawOval ' +
|
||||
'ImageDrawPoint ImageDrawQuadraticCurve ImageDrawRect ImageDrawRoundRect ImageDrawText ImageFlip ImageGetBlob ImageGetBufferedImage ' +
|
||||
'ImageGetEXIFTag ImageGetHeight ImageGetIPTCTag ImageGetWidth ImageGrayscale ImageInfo ImageNegative ImageNew ImageOverlay ImagePaste ' +
|
||||
'ImageRead ImageReadBase64 ImageResize ImageRotate ImageRotateDrawingAxis ImageScaleToFit ImageSetAntialiasing ImageSetBackgroundColor ' +
|
||||
'ImageSetDrawingColor ImageSetDrawingStroke ImageSetDrawingTransparency ImageSharpen ImageShear ImageShearDrawingAxis ImageTranslate ' +
|
||||
'ImageTranslateDrawingAxis ImageWrite ImageWriteBase64 ImageXORDrawingMode IncrementValue InputBaseN Insert Int IsArray IsBinary ' +
|
||||
'IsBoolean IsCustomFunction IsDate IsDDX IsDebugMode IsDefined IsImage IsImageFile IsInstanceOf IsJSON IsLeapYear IsLocalHost ' +
|
||||
'IsNumeric IsNumericDate IsObject IsPDFFile IsPDFObject IsQuery IsSimpleValue IsSOAPRequest IsStruct IsUserInAnyRole IsUserInRole ' +
|
||||
'IsUserLoggedIn IsValid IsWDDX IsXML IsXmlAttribute IsXmlDoc IsXmlElem IsXmlNode IsXmlRoot JavaCast JSStringFormat LCase Left Len ' +
|
||||
'ListAppend ListChangeDelims ListContains ListContainsNoCase ListDeleteAt ListFind ListFindNoCase ListFirst ListGetAt ListInsertAt ' +
|
||||
'ListLast ListLen ListPrepend ListQualify ListRest ListSetAt ListSort ListToArray ListValueCount ListValueCountNoCase LJustify Log ' +
|
||||
'Log10 LSCurrencyFormat LSDateFormat LSEuroCurrencyFormat LSIsCurrency LSIsDate LSIsNumeric LSNumberFormat LSParseCurrency LSParseDateTime ' +
|
||||
'LSParseEuroCurrency LSParseNumber LSTimeFormat LTrim Max Mid Min Minute Month MonthAsString Now NumberFormat ParagraphFormat ParseDateTime ' +
|
||||
'Pi PrecisionEvaluate PreserveSingleQuotes Quarter QueryAddColumn QueryAddRow QueryConvertForGrid QueryNew QuerySetCell QuotedValueList Rand ' +
|
||||
'Randomize RandRange REFind REFindNoCase ReleaseComObject REMatch REMatchNoCase RemoveChars RepeatString Replace ReplaceList ReplaceNoCase ' +
|
||||
'REReplace REReplaceNoCase Reverse Right RJustify Round RTrim Second SendGatewayMessage SerializeJSON SetEncoding SetLocale SetProfileString ' +
|
||||
'SetVariable Sgn Sin Sleep SpanExcluding SpanIncluding Sqr StripCR StructAppend StructClear StructCopy StructCount StructDelete StructFind ' +
|
||||
'StructFindKey StructFindValue StructGet StructInsert StructIsEmpty StructKeyArray StructKeyExists StructKeyList StructKeyList StructNew ' +
|
||||
'StructSort StructUpdate Tan TimeFormat ToBase64 ToBinary ToScript ToString Trim UCase URLDecode URLEncodedFormat URLSessionFormat Val ' +
|
||||
'ValueList VerifyClient Week Wrap Wrap WriteOutput XmlChildPos XmlElemNew XmlFormat XmlGetNodeType XmlNew XmlParse XmlSearch XmlTransform ' +
|
||||
'XmlValidate Year YesNoFormat';
|
||||
|
||||
var keywords = 'cfabort cfajaximport cfajaxproxy cfapplet cfapplication cfargument cfassociate cfbreak cfcache cfcalendar ' +
|
||||
'cfcase cfcatch cfchart cfchartdata cfchartseries cfcol cfcollection cfcomponent cfcontent cfcookie cfdbinfo ' +
|
||||
'cfdefaultcase cfdirectory cfdiv cfdocument cfdocumentitem cfdocumentsection cfdump cfelse cfelseif cferror ' +
|
||||
'cfexchangecalendar cfexchangeconnection cfexchangecontact cfexchangefilter cfexchangemail cfexchangetask ' +
|
||||
'cfexecute cfexit cffeed cffile cfflush cfform cfformgroup cfformitem cfftp cffunction cfgrid cfgridcolumn ' +
|
||||
'cfgridrow cfgridupdate cfheader cfhtmlhead cfhttp cfhttpparam cfif cfimage cfimport cfinclude cfindex ' +
|
||||
'cfinput cfinsert cfinterface cfinvoke cfinvokeargument cflayout cflayoutarea cfldap cflocation cflock cflog ' +
|
||||
'cflogin cfloginuser cflogout cfloop cfmail cfmailparam cfmailpart cfmenu cfmenuitem cfmodule cfNTauthenticate ' +
|
||||
'cfobject cfobjectcache cfoutput cfparam cfpdf cfpdfform cfpdfformparam cfpdfparam cfpdfsubform cfpod cfpop ' +
|
||||
'cfpresentation cfpresentationslide cfpresenter cfprint cfprocessingdirective cfprocparam cfprocresult ' +
|
||||
'cfproperty cfquery cfqueryparam cfregistry cfreport cfreportparam cfrethrow cfreturn cfsavecontent cfschedule ' +
|
||||
'cfscript cfsearch cfselect cfset cfsetting cfsilent cfslider cfsprydataset cfstoredproc cfswitch cftable ' +
|
||||
'cftextarea cfthread cfthrow cftimer cftooltip cftrace cftransaction cftree cftreeitem cftry cfupdate cfwddx ' +
|
||||
'cfwindow cfxml cfzip cfzipparam';
|
||||
|
||||
var operators = 'all and any between cross in join like not null or outer some';
|
||||
|
||||
this.regexList = [
|
||||
{ regex: new RegExp('--(.*)$', 'gm'), css: 'comments' }, // one line and multiline comments
|
||||
{ regex: SyntaxHighlighter.regexLib.xmlComments, css: 'comments' }, // single quoted strings
|
||||
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
|
||||
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
|
||||
{ regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }, // functions
|
||||
{ regex: new RegExp(this.getKeywords(operators), 'gmi'), css: 'color1' }, // operators and such
|
||||
{ regex: new RegExp(this.getKeywords(keywords), 'gmi'), css: 'keyword' } // keyword
|
||||
];
|
||||
}
|
||||
|
||||
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
||||
Brush.aliases = ['coldfusion','cf'];
|
||||
|
||||
SyntaxHighlighter.brushes.ColdFusion = Brush;
|
||||
|
||||
// CommonJS
|
||||
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
||||
})();
|
97
src/_h5ai/client/js/lib/sh/shBrushCpp.js
vendored
Normal file
97
src/_h5ai/client/js/lib/sh/shBrushCpp.js
vendored
Normal file
|
@ -0,0 +1,97 @@
|
|||
/**
|
||||
* SyntaxHighlighter
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter
|
||||
*
|
||||
* SyntaxHighlighter is donationware. If you are using it, please donate.
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
|
||||
*
|
||||
* @version
|
||||
* 3.0.83 (July 02 2010)
|
||||
*
|
||||
* @copyright
|
||||
* Copyright (C) 2004-2010 Alex Gorbatchev.
|
||||
*
|
||||
* @license
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
*/
|
||||
;(function()
|
||||
{
|
||||
// CommonJS
|
||||
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
||||
|
||||
function Brush()
|
||||
{
|
||||
// Copyright 2006 Shin, YoungJin
|
||||
|
||||
var datatypes = 'ATOM BOOL BOOLEAN BYTE CHAR COLORREF DWORD DWORDLONG DWORD_PTR ' +
|
||||
'DWORD32 DWORD64 FLOAT HACCEL HALF_PTR HANDLE HBITMAP HBRUSH ' +
|
||||
'HCOLORSPACE HCONV HCONVLIST HCURSOR HDC HDDEDATA HDESK HDROP HDWP ' +
|
||||
'HENHMETAFILE HFILE HFONT HGDIOBJ HGLOBAL HHOOK HICON HINSTANCE HKEY ' +
|
||||
'HKL HLOCAL HMENU HMETAFILE HMODULE HMONITOR HPALETTE HPEN HRESULT ' +
|
||||
'HRGN HRSRC HSZ HWINSTA HWND INT INT_PTR INT32 INT64 LANGID LCID LCTYPE ' +
|
||||
'LGRPID LONG LONGLONG LONG_PTR LONG32 LONG64 LPARAM LPBOOL LPBYTE LPCOLORREF ' +
|
||||
'LPCSTR LPCTSTR LPCVOID LPCWSTR LPDWORD LPHANDLE LPINT LPLONG LPSTR LPTSTR ' +
|
||||
'LPVOID LPWORD LPWSTR LRESULT PBOOL PBOOLEAN PBYTE PCHAR PCSTR PCTSTR PCWSTR ' +
|
||||
'PDWORDLONG PDWORD_PTR PDWORD32 PDWORD64 PFLOAT PHALF_PTR PHANDLE PHKEY PINT ' +
|
||||
'PINT_PTR PINT32 PINT64 PLCID PLONG PLONGLONG PLONG_PTR PLONG32 PLONG64 POINTER_32 ' +
|
||||
'POINTER_64 PSHORT PSIZE_T PSSIZE_T PSTR PTBYTE PTCHAR PTSTR PUCHAR PUHALF_PTR ' +
|
||||
'PUINT PUINT_PTR PUINT32 PUINT64 PULONG PULONGLONG PULONG_PTR PULONG32 PULONG64 ' +
|
||||
'PUSHORT PVOID PWCHAR PWORD PWSTR SC_HANDLE SC_LOCK SERVICE_STATUS_HANDLE SHORT ' +
|
||||
'SIZE_T SSIZE_T TBYTE TCHAR UCHAR UHALF_PTR UINT UINT_PTR UINT32 UINT64 ULONG ' +
|
||||
'ULONGLONG ULONG_PTR ULONG32 ULONG64 USHORT USN VOID WCHAR WORD WPARAM WPARAM WPARAM ' +
|
||||
'char bool short int __int32 __int64 __int8 __int16 long float double __wchar_t ' +
|
||||
'clock_t _complex _dev_t _diskfree_t div_t ldiv_t _exception _EXCEPTION_POINTERS ' +
|
||||
'FILE _finddata_t _finddatai64_t _wfinddata_t _wfinddatai64_t __finddata64_t ' +
|
||||
'__wfinddata64_t _FPIEEE_RECORD fpos_t _HEAPINFO _HFILE lconv intptr_t ' +
|
||||
'jmp_buf mbstate_t _off_t _onexit_t _PNH ptrdiff_t _purecall_handler ' +
|
||||
'sig_atomic_t size_t _stat __stat64 _stati64 terminate_function ' +
|
||||
'time_t __time64_t _timeb __timeb64 tm uintptr_t _utimbuf ' +
|
||||
'va_list wchar_t wctrans_t wctype_t wint_t signed';
|
||||
|
||||
var keywords = 'break case catch class const __finally __exception __try ' +
|
||||
'const_cast continue private public protected __declspec ' +
|
||||
'default delete deprecated dllexport dllimport do dynamic_cast ' +
|
||||
'else enum explicit extern if for friend goto inline ' +
|
||||
'mutable naked namespace new noinline noreturn nothrow ' +
|
||||
'register reinterpret_cast return selectany ' +
|
||||
'sizeof static static_cast struct switch template this ' +
|
||||
'thread throw true false try typedef typeid typename union ' +
|
||||
'using uuid virtual void volatile whcar_t while';
|
||||
|
||||
var functions = 'assert isalnum isalpha iscntrl isdigit isgraph islower isprint' +
|
||||
'ispunct isspace isupper isxdigit tolower toupper errno localeconv ' +
|
||||
'setlocale acos asin atan atan2 ceil cos cosh exp fabs floor fmod ' +
|
||||
'frexp ldexp log log10 modf pow sin sinh sqrt tan tanh jmp_buf ' +
|
||||
'longjmp setjmp raise signal sig_atomic_t va_arg va_end va_start ' +
|
||||
'clearerr fclose feof ferror fflush fgetc fgetpos fgets fopen ' +
|
||||
'fprintf fputc fputs fread freopen fscanf fseek fsetpos ftell ' +
|
||||
'fwrite getc getchar gets perror printf putc putchar puts remove ' +
|
||||
'rename rewind scanf setbuf setvbuf sprintf sscanf tmpfile tmpnam ' +
|
||||
'ungetc vfprintf vprintf vsprintf abort abs atexit atof atoi atol ' +
|
||||
'bsearch calloc div exit free getenv labs ldiv malloc mblen mbstowcs ' +
|
||||
'mbtowc qsort rand realloc srand strtod strtol strtoul system ' +
|
||||
'wcstombs wctomb memchr memcmp memcpy memmove memset strcat strchr ' +
|
||||
'strcmp strcoll strcpy strcspn strerror strlen strncat strncmp ' +
|
||||
'strncpy strpbrk strrchr strspn strstr strtok strxfrm asctime ' +
|
||||
'clock ctime difftime gmtime localtime mktime strftime time';
|
||||
|
||||
this.regexList = [
|
||||
{ regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
|
||||
{ regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
|
||||
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
|
||||
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
|
||||
{ regex: /^ *#.*/gm, css: 'preprocessor' },
|
||||
{ regex: new RegExp(this.getKeywords(datatypes), 'gm'), css: 'color1 bold' },
|
||||
{ regex: new RegExp(this.getKeywords(functions), 'gm'), css: 'functions bold' },
|
||||
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword bold' }
|
||||
];
|
||||
};
|
||||
|
||||
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
||||
Brush.aliases = ['cpp', 'c'];
|
||||
|
||||
SyntaxHighlighter.brushes.Cpp = Brush;
|
||||
|
||||
// CommonJS
|
||||
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
||||
})();
|
91
src/_h5ai/client/js/lib/sh/shBrushCss.js
vendored
Normal file
91
src/_h5ai/client/js/lib/sh/shBrushCss.js
vendored
Normal file
|
@ -0,0 +1,91 @@
|
|||
/**
|
||||
* SyntaxHighlighter
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter
|
||||
*
|
||||
* SyntaxHighlighter is donationware. If you are using it, please donate.
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
|
||||
*
|
||||
* @version
|
||||
* 3.0.83 (July 02 2010)
|
||||
*
|
||||
* @copyright
|
||||
* Copyright (C) 2004-2010 Alex Gorbatchev.
|
||||
*
|
||||
* @license
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
*/
|
||||
;(function()
|
||||
{
|
||||
// CommonJS
|
||||
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
||||
|
||||
function Brush()
|
||||
{
|
||||
function getKeywordsCSS(str)
|
||||
{
|
||||
return '\\b([a-z_]|)' + str.replace(/ /g, '(?=:)\\b|\\b([a-z_\\*]|\\*|)') + '(?=:)\\b';
|
||||
};
|
||||
|
||||
function getValuesCSS(str)
|
||||
{
|
||||
return '\\b' + str.replace(/ /g, '(?!-)(?!:)\\b|\\b()') + '\:\\b';
|
||||
};
|
||||
|
||||
var keywords = 'ascent azimuth background-attachment background-color background-image background-position ' +
|
||||
'background-repeat background baseline bbox border-collapse border-color border-spacing border-style border-top ' +
|
||||
'border-right border-bottom border-left border-top-color border-right-color border-bottom-color border-left-color ' +
|
||||
'border-top-style border-right-style border-bottom-style border-left-style border-top-width border-right-width ' +
|
||||
'border-bottom-width border-left-width border-width border bottom cap-height caption-side centerline clear clip color ' +
|
||||
'content counter-increment counter-reset cue-after cue-before cue cursor definition-src descent direction display ' +
|
||||
'elevation empty-cells float font-size-adjust font-family font-size font-stretch font-style font-variant font-weight font ' +
|
||||
'height left letter-spacing line-height list-style-image list-style-position list-style-type list-style margin-top ' +
|
||||
'margin-right margin-bottom margin-left margin marker-offset marks mathline max-height max-width min-height min-width orphans ' +
|
||||
'outline-color outline-style outline-width outline overflow padding-top padding-right padding-bottom padding-left padding page ' +
|
||||
'page-break-after page-break-before page-break-inside pause pause-after pause-before pitch pitch-range play-during position ' +
|
||||
'quotes right richness size slope src speak-header speak-numeral speak-punctuation speak speech-rate stemh stemv stress ' +
|
||||
'table-layout text-align top text-decoration text-indent text-shadow text-transform unicode-bidi unicode-range units-per-em ' +
|
||||
'vertical-align visibility voice-family volume white-space widows width widths word-spacing x-height z-index';
|
||||
|
||||
var values = 'above absolute all always aqua armenian attr aural auto avoid baseline behind below bidi-override black blink block blue bold bolder '+
|
||||
'both bottom braille capitalize caption center center-left center-right circle close-quote code collapse compact condensed '+
|
||||
'continuous counter counters crop cross crosshair cursive dashed decimal decimal-leading-zero default digits disc dotted double '+
|
||||
'embed embossed e-resize expanded extra-condensed extra-expanded fantasy far-left far-right fast faster fixed format fuchsia '+
|
||||
'gray green groove handheld hebrew help hidden hide high higher icon inline-table inline inset inside invert italic '+
|
||||
'justify landscape large larger left-side left leftwards level lighter lime line-through list-item local loud lower-alpha '+
|
||||
'lowercase lower-greek lower-latin lower-roman lower low ltr marker maroon medium message-box middle mix move narrower '+
|
||||
'navy ne-resize no-close-quote none no-open-quote no-repeat normal nowrap n-resize nw-resize oblique olive once open-quote outset '+
|
||||
'outside overline pointer portrait pre print projection purple red relative repeat repeat-x repeat-y rgb ridge right right-side '+
|
||||
'rightwards rtl run-in screen scroll semi-condensed semi-expanded separate se-resize show silent silver slower slow '+
|
||||
'small small-caps small-caption smaller soft solid speech spell-out square s-resize static status-bar sub super sw-resize '+
|
||||
'table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group teal '+
|
||||
'text-bottom text-top thick thin top transparent tty tv ultra-condensed ultra-expanded underline upper-alpha uppercase upper-latin '+
|
||||
'upper-roman url visible wait white wider w-resize x-fast x-high x-large x-loud x-low x-slow x-small x-soft xx-large xx-small yellow';
|
||||
|
||||
var fonts = '[mM]onospace [tT]ahoma [vV]erdana [aA]rial [hH]elvetica [sS]ans-serif [sS]erif [cC]ourier mono sans serif';
|
||||
|
||||
this.regexList = [
|
||||
{ regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
|
||||
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
|
||||
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
|
||||
{ regex: /\#[a-fA-F0-9]{3,6}/g, css: 'value' }, // html colors
|
||||
{ regex: /(-?\d+)(\.\d+)?(px|em|pt|\:|\%|)/g, css: 'value' }, // sizes
|
||||
{ regex: /!important/g, css: 'color3' }, // !important
|
||||
{ regex: new RegExp(getKeywordsCSS(keywords), 'gm'), css: 'keyword' }, // keywords
|
||||
{ regex: new RegExp(getValuesCSS(values), 'g'), css: 'value' }, // values
|
||||
{ regex: new RegExp(this.getKeywords(fonts), 'g'), css: 'color1' } // fonts
|
||||
];
|
||||
|
||||
this.forHtmlScript({
|
||||
left: /(<|<)\s*style.*?(>|>)/gi,
|
||||
right: /(<|<)\/\s*style\s*(>|>)/gi
|
||||
});
|
||||
};
|
||||
|
||||
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
||||
Brush.aliases = ['css'];
|
||||
|
||||
SyntaxHighlighter.brushes.CSS = Brush;
|
||||
|
||||
// CommonJS
|
||||
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
||||
})();
|
55
src/_h5ai/client/js/lib/sh/shBrushDelphi.js
vendored
Normal file
55
src/_h5ai/client/js/lib/sh/shBrushDelphi.js
vendored
Normal file
|
@ -0,0 +1,55 @@
|
|||
/**
|
||||
* SyntaxHighlighter
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter
|
||||
*
|
||||
* SyntaxHighlighter is donationware. If you are using it, please donate.
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
|
||||
*
|
||||
* @version
|
||||
* 3.0.83 (July 02 2010)
|
||||
*
|
||||
* @copyright
|
||||
* Copyright (C) 2004-2010 Alex Gorbatchev.
|
||||
*
|
||||
* @license
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
*/
|
||||
;(function()
|
||||
{
|
||||
// CommonJS
|
||||
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
||||
|
||||
function Brush()
|
||||
{
|
||||
var keywords = 'abs addr and ansichar ansistring array as asm begin boolean byte cardinal ' +
|
||||
'case char class comp const constructor currency destructor div do double ' +
|
||||
'downto else end except exports extended false file finalization finally ' +
|
||||
'for function goto if implementation in inherited int64 initialization ' +
|
||||
'integer interface is label library longint longword mod nil not object ' +
|
||||
'of on or packed pansichar pansistring pchar pcurrency pdatetime pextended ' +
|
||||
'pint64 pointer private procedure program property pshortstring pstring ' +
|
||||
'pvariant pwidechar pwidestring protected public published raise real real48 ' +
|
||||
'record repeat set shl shortint shortstring shr single smallint string then ' +
|
||||
'threadvar to true try type unit until uses val var varirnt while widechar ' +
|
||||
'widestring with word write writeln xor';
|
||||
|
||||
this.regexList = [
|
||||
{ regex: /\(\*[\s\S]*?\*\)/gm, css: 'comments' }, // multiline comments (* *)
|
||||
{ regex: /{(?!\$)[\s\S]*?}/gm, css: 'comments' }, // multiline comments { }
|
||||
{ regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line
|
||||
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
|
||||
{ regex: /\{\$[a-zA-Z]+ .+\}/g, css: 'color1' }, // compiler Directives and Region tags
|
||||
{ regex: /\b[\d\.]+\b/g, css: 'value' }, // numbers 12345
|
||||
{ regex: /\$[a-zA-Z0-9]+\b/g, css: 'value' }, // numbers $F5D3
|
||||
{ regex: new RegExp(this.getKeywords(keywords), 'gmi'), css: 'keyword' } // keyword
|
||||
];
|
||||
};
|
||||
|
||||
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
||||
Brush.aliases = ['delphi', 'pascal', 'pas'];
|
||||
|
||||
SyntaxHighlighter.brushes.Delphi = Brush;
|
||||
|
||||
// CommonJS
|
||||
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
||||
})();
|
41
src/_h5ai/client/js/lib/sh/shBrushDiff.js
vendored
Normal file
41
src/_h5ai/client/js/lib/sh/shBrushDiff.js
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
/**
|
||||
* SyntaxHighlighter
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter
|
||||
*
|
||||
* SyntaxHighlighter is donationware. If you are using it, please donate.
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
|
||||
*
|
||||
* @version
|
||||
* 3.0.83 (July 02 2010)
|
||||
*
|
||||
* @copyright
|
||||
* Copyright (C) 2004-2010 Alex Gorbatchev.
|
||||
*
|
||||
* @license
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
*/
|
||||
;(function()
|
||||
{
|
||||
// CommonJS
|
||||
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
||||
|
||||
function Brush()
|
||||
{
|
||||
this.regexList = [
|
||||
{ regex: /^\+\+\+.*$/gm, css: 'color2' },
|
||||
{ regex: /^\-\-\-.*$/gm, css: 'color2' },
|
||||
{ regex: /^\s.*$/gm, css: 'color1' },
|
||||
{ regex: /^@@.*@@$/gm, css: 'variable' },
|
||||
{ regex: /^\+[^\+]{1}.*$/gm, css: 'string' },
|
||||
{ regex: /^\-[^\-]{1}.*$/gm, css: 'comments' }
|
||||
];
|
||||
};
|
||||
|
||||
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
||||
Brush.aliases = ['diff', 'patch'];
|
||||
|
||||
SyntaxHighlighter.brushes.Diff = Brush;
|
||||
|
||||
// CommonJS
|
||||
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
||||
})();
|
52
src/_h5ai/client/js/lib/sh/shBrushErlang.js
vendored
Normal file
52
src/_h5ai/client/js/lib/sh/shBrushErlang.js
vendored
Normal file
|
@ -0,0 +1,52 @@
|
|||
/**
|
||||
* SyntaxHighlighter
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter
|
||||
*
|
||||
* SyntaxHighlighter is donationware. If you are using it, please donate.
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
|
||||
*
|
||||
* @version
|
||||
* 3.0.83 (July 02 2010)
|
||||
*
|
||||
* @copyright
|
||||
* Copyright (C) 2004-2010 Alex Gorbatchev.
|
||||
*
|
||||
* @license
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
*/
|
||||
;(function()
|
||||
{
|
||||
// CommonJS
|
||||
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
||||
|
||||
function Brush()
|
||||
{
|
||||
// Contributed by Jean-Lou Dupont
|
||||
// http://jldupont.blogspot.com/2009/06/erlang-syntax-highlighter.html
|
||||
|
||||
// According to: http://erlang.org/doc/reference_manual/introduction.html#1.5
|
||||
var keywords = 'after and andalso band begin bnot bor bsl bsr bxor '+
|
||||
'case catch cond div end fun if let not of or orelse '+
|
||||
'query receive rem try when xor'+
|
||||
// additional
|
||||
' module export import define';
|
||||
|
||||
this.regexList = [
|
||||
{ regex: new RegExp("[A-Z][A-Za-z0-9_]+", 'g'), css: 'constants' },
|
||||
{ regex: new RegExp("\\%.+", 'gm'), css: 'comments' },
|
||||
{ regex: new RegExp("\\?[A-Za-z0-9_]+", 'g'), css: 'preprocessor' },
|
||||
{ regex: new RegExp("[a-z0-9_]+:[a-z0-9_]+", 'g'), css: 'functions' },
|
||||
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' },
|
||||
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' },
|
||||
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }
|
||||
];
|
||||
};
|
||||
|
||||
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
||||
Brush.aliases = ['erl', 'erlang'];
|
||||
|
||||
SyntaxHighlighter.brushes.Erland = Brush;
|
||||
|
||||
// CommonJS
|
||||
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
||||
})();
|
67
src/_h5ai/client/js/lib/sh/shBrushGroovy.js
vendored
Normal file
67
src/_h5ai/client/js/lib/sh/shBrushGroovy.js
vendored
Normal file
|
@ -0,0 +1,67 @@
|
|||
/**
|
||||
* SyntaxHighlighter
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter
|
||||
*
|
||||
* SyntaxHighlighter is donationware. If you are using it, please donate.
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
|
||||
*
|
||||
* @version
|
||||
* 3.0.83 (July 02 2010)
|
||||
*
|
||||
* @copyright
|
||||
* Copyright (C) 2004-2010 Alex Gorbatchev.
|
||||
*
|
||||
* @license
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
*/
|
||||
;(function()
|
||||
{
|
||||
// CommonJS
|
||||
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
||||
|
||||
function Brush()
|
||||
{
|
||||
// Contributed by Andres Almiray
|
||||
// http://jroller.com/aalmiray/entry/nice_source_code_syntax_highlighter
|
||||
|
||||
var keywords = 'as assert break case catch class continue def default do else extends finally ' +
|
||||
'if in implements import instanceof interface new package property return switch ' +
|
||||
'throw throws try while public protected private static';
|
||||
var types = 'void boolean byte char short int long float double';
|
||||
var constants = 'null';
|
||||
var methods = 'allProperties count get size '+
|
||||
'collect each eachProperty eachPropertyName eachWithIndex find findAll ' +
|
||||
'findIndexOf grep inject max min reverseEach sort ' +
|
||||
'asImmutable asSynchronized flatten intersect join pop reverse subMap toList ' +
|
||||
'padRight padLeft contains eachMatch toCharacter toLong toUrl tokenize ' +
|
||||
'eachFile eachFileRecurse eachB yte eachLine readBytes readLine getText ' +
|
||||
'splitEachLine withReader append encodeBase64 decodeBase64 filterLine ' +
|
||||
'transformChar transformLine withOutputStream withPrintWriter withStream ' +
|
||||
'withStreams withWriter withWriterAppend write writeLine '+
|
||||
'dump inspect invokeMethod print println step times upto use waitForOrKill '+
|
||||
'getText';
|
||||
|
||||
this.regexList = [
|
||||
{ regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
|
||||
{ regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
|
||||
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
|
||||
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
|
||||
{ regex: /""".*"""/g, css: 'string' }, // GStrings
|
||||
{ regex: new RegExp('\\b([\\d]+(\\.[\\d]+)?|0x[a-f0-9]+)\\b', 'gi'), css: 'value' }, // numbers
|
||||
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // goovy keyword
|
||||
{ regex: new RegExp(this.getKeywords(types), 'gm'), css: 'color1' }, // goovy/java type
|
||||
{ regex: new RegExp(this.getKeywords(constants), 'gm'), css: 'constants' }, // constants
|
||||
{ regex: new RegExp(this.getKeywords(methods), 'gm'), css: 'functions' } // methods
|
||||
];
|
||||
|
||||
this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
|
||||
}
|
||||
|
||||
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
||||
Brush.aliases = ['groovy'];
|
||||
|
||||
SyntaxHighlighter.brushes.Groovy = Brush;
|
||||
|
||||
// CommonJS
|
||||
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
||||
})();
|
52
src/_h5ai/client/js/lib/sh/shBrushJScript.js
vendored
Normal file
52
src/_h5ai/client/js/lib/sh/shBrushJScript.js
vendored
Normal file
|
@ -0,0 +1,52 @@
|
|||
/**
|
||||
* SyntaxHighlighter
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter
|
||||
*
|
||||
* SyntaxHighlighter is donationware. If you are using it, please donate.
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
|
||||
*
|
||||
* @version
|
||||
* 3.0.83 (July 02 2010)
|
||||
*
|
||||
* @copyright
|
||||
* Copyright (C) 2004-2010 Alex Gorbatchev.
|
||||
*
|
||||
* @license
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
*/
|
||||
;(function()
|
||||
{
|
||||
// CommonJS
|
||||
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
||||
|
||||
function Brush()
|
||||
{
|
||||
var keywords = 'break case catch continue ' +
|
||||
'default delete do else false ' +
|
||||
'for function if in instanceof ' +
|
||||
'new null return super switch ' +
|
||||
'this throw true try typeof var while with'
|
||||
;
|
||||
|
||||
var r = SyntaxHighlighter.regexLib;
|
||||
|
||||
this.regexList = [
|
||||
{ regex: r.multiLineDoubleQuotedString, css: 'string' }, // double quoted strings
|
||||
{ regex: r.multiLineSingleQuotedString, css: 'string' }, // single quoted strings
|
||||
{ regex: r.singleLineCComments, css: 'comments' }, // one line comments
|
||||
{ regex: r.multiLineCComments, css: 'comments' }, // multiline comments
|
||||
{ regex: /\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion
|
||||
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keywords
|
||||
];
|
||||
|
||||
this.forHtmlScript(r.scriptScriptTags);
|
||||
};
|
||||
|
||||
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
||||
Brush.aliases = ['js', 'jscript', 'javascript'];
|
||||
|
||||
SyntaxHighlighter.brushes.JScript = Brush;
|
||||
|
||||
// CommonJS
|
||||
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
||||
})();
|
57
src/_h5ai/client/js/lib/sh/shBrushJava.js
vendored
Normal file
57
src/_h5ai/client/js/lib/sh/shBrushJava.js
vendored
Normal file
|
@ -0,0 +1,57 @@
|
|||
/**
|
||||
* SyntaxHighlighter
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter
|
||||
*
|
||||
* SyntaxHighlighter is donationware. If you are using it, please donate.
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
|
||||
*
|
||||
* @version
|
||||
* 3.0.83 (July 02 2010)
|
||||
*
|
||||
* @copyright
|
||||
* Copyright (C) 2004-2010 Alex Gorbatchev.
|
||||
*
|
||||
* @license
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
*/
|
||||
;(function()
|
||||
{
|
||||
// CommonJS
|
||||
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
||||
|
||||
function Brush()
|
||||
{
|
||||
var keywords = 'abstract assert boolean break byte case catch char class const ' +
|
||||
'continue default do double else enum extends ' +
|
||||
'false final finally float for goto if implements import ' +
|
||||
'instanceof int interface long native new null ' +
|
||||
'package private protected public return ' +
|
||||
'short static strictfp super switch synchronized this throw throws true ' +
|
||||
'transient try void volatile while';
|
||||
|
||||
this.regexList = [
|
||||
{ regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
|
||||
{ regex: /\/\*([^\*][\s\S]*)?\*\//gm, css: 'comments' }, // multiline comments
|
||||
{ regex: /\/\*(?!\*\/)\*[\s\S]*?\*\//gm, css: 'preprocessor' }, // documentation comments
|
||||
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
|
||||
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
|
||||
{ regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers
|
||||
{ regex: /(?!\@interface\b)\@[\$\w]+\b/g, css: 'color1' }, // annotation @anno
|
||||
{ regex: /\@interface\b/g, css: 'color2' }, // @interface keyword
|
||||
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // java keyword
|
||||
];
|
||||
|
||||
this.forHtmlScript({
|
||||
left : /(<|<)%[@!=]?/g,
|
||||
right : /%(>|>)/g
|
||||
});
|
||||
};
|
||||
|
||||
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
||||
Brush.aliases = ['java'];
|
||||
|
||||
SyntaxHighlighter.brushes.Java = Brush;
|
||||
|
||||
// CommonJS
|
||||
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
||||
})();
|
58
src/_h5ai/client/js/lib/sh/shBrushJavaFX.js
vendored
Normal file
58
src/_h5ai/client/js/lib/sh/shBrushJavaFX.js
vendored
Normal file
|
@ -0,0 +1,58 @@
|
|||
/**
|
||||
* SyntaxHighlighter
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter
|
||||
*
|
||||
* SyntaxHighlighter is donationware. If you are using it, please donate.
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
|
||||
*
|
||||
* @version
|
||||
* 3.0.83 (July 02 2010)
|
||||
*
|
||||
* @copyright
|
||||
* Copyright (C) 2004-2010 Alex Gorbatchev.
|
||||
*
|
||||
* @license
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
*/
|
||||
;(function()
|
||||
{
|
||||
// CommonJS
|
||||
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
||||
|
||||
function Brush()
|
||||
{
|
||||
// Contributed by Patrick Webster
|
||||
// http://patrickwebster.blogspot.com/2009/04/javafx-brush-for-syntaxhighlighter.html
|
||||
var datatypes = 'Boolean Byte Character Double Duration '
|
||||
+ 'Float Integer Long Number Short String Void'
|
||||
;
|
||||
|
||||
var keywords = 'abstract after and as assert at before bind bound break catch class '
|
||||
+ 'continue def delete else exclusive extends false finally first for from '
|
||||
+ 'function if import in indexof init insert instanceof into inverse last '
|
||||
+ 'lazy mixin mod nativearray new not null on or override package postinit '
|
||||
+ 'protected public public-init public-read replace return reverse sizeof '
|
||||
+ 'step super then this throw true try tween typeof var where while with '
|
||||
+ 'attribute let private readonly static trigger'
|
||||
;
|
||||
|
||||
this.regexList = [
|
||||
{ regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' },
|
||||
{ regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' },
|
||||
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' },
|
||||
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' },
|
||||
{ regex: /(-?\.?)(\b(\d*\.?\d+|\d+\.?\d*)(e[+-]?\d+)?|0x[a-f\d]+)\b\.?/gi, css: 'color2' }, // numbers
|
||||
{ regex: new RegExp(this.getKeywords(datatypes), 'gm'), css: 'variable' }, // datatypes
|
||||
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }
|
||||
];
|
||||
this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
|
||||
};
|
||||
|
||||
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
||||
Brush.aliases = ['jfx', 'javafx'];
|
||||
|
||||
SyntaxHighlighter.brushes.JavaFX = Brush;
|
||||
|
||||
// CommonJS
|
||||
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
||||
})();
|
72
src/_h5ai/client/js/lib/sh/shBrushPerl.js
vendored
Normal file
72
src/_h5ai/client/js/lib/sh/shBrushPerl.js
vendored
Normal file
|
@ -0,0 +1,72 @@
|
|||
/**
|
||||
* SyntaxHighlighter
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter
|
||||
*
|
||||
* SyntaxHighlighter is donationware. If you are using it, please donate.
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
|
||||
*
|
||||
* @version
|
||||
* 3.0.83 (July 02 2010)
|
||||
*
|
||||
* @copyright
|
||||
* Copyright (C) 2004-2010 Alex Gorbatchev.
|
||||
*
|
||||
* @license
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
*/
|
||||
;(function()
|
||||
{
|
||||
// CommonJS
|
||||
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
||||
|
||||
function Brush()
|
||||
{
|
||||
// Contributed by David Simmons-Duffin and Marty Kube
|
||||
|
||||
var funcs =
|
||||
'abs accept alarm atan2 bind binmode chdir chmod chomp chop chown chr ' +
|
||||
'chroot close closedir connect cos crypt defined delete each endgrent ' +
|
||||
'endhostent endnetent endprotoent endpwent endservent eof exec exists ' +
|
||||
'exp fcntl fileno flock fork format formline getc getgrent getgrgid ' +
|
||||
'getgrnam gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr ' +
|
||||
'getnetbyname getnetent getpeername getpgrp getppid getpriority ' +
|
||||
'getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid ' +
|
||||
'getservbyname getservbyport getservent getsockname getsockopt glob ' +
|
||||
'gmtime grep hex index int ioctl join keys kill lc lcfirst length link ' +
|
||||
'listen localtime lock log lstat map mkdir msgctl msgget msgrcv msgsnd ' +
|
||||
'oct open opendir ord pack pipe pop pos print printf prototype push ' +
|
||||
'quotemeta rand read readdir readline readlink readpipe recv rename ' +
|
||||
'reset reverse rewinddir rindex rmdir scalar seek seekdir select semctl ' +
|
||||
'semget semop send setgrent sethostent setnetent setpgrp setpriority ' +
|
||||
'setprotoent setpwent setservent setsockopt shift shmctl shmget shmread ' +
|
||||
'shmwrite shutdown sin sleep socket socketpair sort splice split sprintf ' +
|
||||
'sqrt srand stat study substr symlink syscall sysopen sysread sysseek ' +
|
||||
'system syswrite tell telldir time times tr truncate uc ucfirst umask ' +
|
||||
'undef unlink unpack unshift utime values vec wait waitpid warn write';
|
||||
|
||||
var keywords =
|
||||
'bless caller continue dbmclose dbmopen die do dump else elsif eval exit ' +
|
||||
'for foreach goto if import last local my next no our package redo ref ' +
|
||||
'require return sub tie tied unless untie until use wantarray while';
|
||||
|
||||
this.regexList = [
|
||||
{ regex: new RegExp('#[^!].*$', 'gm'), css: 'comments' },
|
||||
{ regex: new RegExp('^\\s*#!.*$', 'gm'), css: 'preprocessor' }, // shebang
|
||||
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' },
|
||||
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' },
|
||||
{ regex: new RegExp('(\\$|@|%)\\w+', 'g'), css: 'variable' },
|
||||
{ regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' },
|
||||
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }
|
||||
];
|
||||
|
||||
this.forHtmlScript(SyntaxHighlighter.regexLib.phpScriptTags);
|
||||
}
|
||||
|
||||
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
||||
Brush.aliases = ['perl', 'Perl', 'pl'];
|
||||
|
||||
SyntaxHighlighter.brushes.Perl = Brush;
|
||||
|
||||
// CommonJS
|
||||
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
||||
})();
|
88
src/_h5ai/client/js/lib/sh/shBrushPhp.js
vendored
Normal file
88
src/_h5ai/client/js/lib/sh/shBrushPhp.js
vendored
Normal file
|
@ -0,0 +1,88 @@
|
|||
/**
|
||||
* SyntaxHighlighter
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter
|
||||
*
|
||||
* SyntaxHighlighter is donationware. If you are using it, please donate.
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
|
||||
*
|
||||
* @version
|
||||
* 3.0.83 (July 02 2010)
|
||||
*
|
||||
* @copyright
|
||||
* Copyright (C) 2004-2010 Alex Gorbatchev.
|
||||
*
|
||||
* @license
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
*/
|
||||
;(function()
|
||||
{
|
||||
// CommonJS
|
||||
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
||||
|
||||
function Brush()
|
||||
{
|
||||
var funcs = 'abs acos acosh addcslashes addslashes ' +
|
||||
'array_change_key_case array_chunk array_combine array_count_values array_diff '+
|
||||
'array_diff_assoc array_diff_key array_diff_uassoc array_diff_ukey array_fill '+
|
||||
'array_filter array_flip array_intersect array_intersect_assoc array_intersect_key '+
|
||||
'array_intersect_uassoc array_intersect_ukey array_key_exists array_keys array_map '+
|
||||
'array_merge array_merge_recursive array_multisort array_pad array_pop array_product '+
|
||||
'array_push array_rand array_reduce array_reverse array_search array_shift '+
|
||||
'array_slice array_splice array_sum array_udiff array_udiff_assoc '+
|
||||
'array_udiff_uassoc array_uintersect array_uintersect_assoc '+
|
||||
'array_uintersect_uassoc array_unique array_unshift array_values array_walk '+
|
||||
'array_walk_recursive atan atan2 atanh base64_decode base64_encode base_convert '+
|
||||
'basename bcadd bccomp bcdiv bcmod bcmul bindec bindtextdomain bzclose bzcompress '+
|
||||
'bzdecompress bzerrno bzerror bzerrstr bzflush bzopen bzread bzwrite ceil chdir '+
|
||||
'checkdate checkdnsrr chgrp chmod chop chown chr chroot chunk_split class_exists '+
|
||||
'closedir closelog copy cos cosh count count_chars date decbin dechex decoct '+
|
||||
'deg2rad delete ebcdic2ascii echo empty end ereg ereg_replace eregi eregi_replace error_log '+
|
||||
'error_reporting escapeshellarg escapeshellcmd eval exec exit exp explode extension_loaded '+
|
||||
'feof fflush fgetc fgetcsv fgets fgetss file_exists file_get_contents file_put_contents '+
|
||||
'fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype '+
|
||||
'floatval flock floor flush fmod fnmatch fopen fpassthru fprintf fputcsv fputs fread fscanf '+
|
||||
'fseek fsockopen fstat ftell ftok getallheaders getcwd getdate getenv gethostbyaddr gethostbyname '+
|
||||
'gethostbynamel getimagesize getlastmod getmxrr getmygid getmyinode getmypid getmyuid getopt '+
|
||||
'getprotobyname getprotobynumber getrandmax getrusage getservbyname getservbyport gettext '+
|
||||
'gettimeofday gettype glob gmdate gmmktime ini_alter ini_get ini_get_all ini_restore ini_set '+
|
||||
'interface_exists intval ip2long is_a is_array is_bool is_callable is_dir is_double '+
|
||||
'is_executable is_file is_finite is_float is_infinite is_int is_integer is_link is_long '+
|
||||
'is_nan is_null is_numeric is_object is_readable is_real is_resource is_scalar is_soap_fault '+
|
||||
'is_string is_subclass_of is_uploaded_file is_writable is_writeable mkdir mktime nl2br '+
|
||||
'parse_ini_file parse_str parse_url passthru pathinfo print readlink realpath rewind rewinddir rmdir '+
|
||||
'round str_ireplace str_pad str_repeat str_replace str_rot13 str_shuffle str_split '+
|
||||
'str_word_count strcasecmp strchr strcmp strcoll strcspn strftime strip_tags stripcslashes '+
|
||||
'stripos stripslashes stristr strlen strnatcasecmp strnatcmp strncasecmp strncmp strpbrk '+
|
||||
'strpos strptime strrchr strrev strripos strrpos strspn strstr strtok strtolower strtotime '+
|
||||
'strtoupper strtr strval substr substr_compare';
|
||||
|
||||
var keywords = 'abstract and array as break case catch cfunction class clone const continue declare default die do ' +
|
||||
'else elseif enddeclare endfor endforeach endif endswitch endwhile extends final for foreach ' +
|
||||
'function include include_once global goto if implements interface instanceof namespace new ' +
|
||||
'old_function or private protected public return require require_once static switch ' +
|
||||
'throw try use var while xor ';
|
||||
|
||||
var constants = '__FILE__ __LINE__ __METHOD__ __FUNCTION__ __CLASS__';
|
||||
|
||||
this.regexList = [
|
||||
{ regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
|
||||
{ regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
|
||||
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
|
||||
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
|
||||
{ regex: /\$\w+/g, css: 'variable' }, // variables
|
||||
{ regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }, // common functions
|
||||
{ regex: new RegExp(this.getKeywords(constants), 'gmi'), css: 'constants' }, // constants
|
||||
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keyword
|
||||
];
|
||||
|
||||
this.forHtmlScript(SyntaxHighlighter.regexLib.phpScriptTags);
|
||||
};
|
||||
|
||||
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
||||
Brush.aliases = ['php'];
|
||||
|
||||
SyntaxHighlighter.brushes.Php = Brush;
|
||||
|
||||
// CommonJS
|
||||
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
||||
})();
|
33
src/_h5ai/client/js/lib/sh/shBrushPlain.js
vendored
Normal file
33
src/_h5ai/client/js/lib/sh/shBrushPlain.js
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* SyntaxHighlighter
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter
|
||||
*
|
||||
* SyntaxHighlighter is donationware. If you are using it, please donate.
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
|
||||
*
|
||||
* @version
|
||||
* 3.0.83 (July 02 2010)
|
||||
*
|
||||
* @copyright
|
||||
* Copyright (C) 2004-2010 Alex Gorbatchev.
|
||||
*
|
||||
* @license
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
*/
|
||||
;(function()
|
||||
{
|
||||
// CommonJS
|
||||
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
||||
|
||||
function Brush()
|
||||
{
|
||||
};
|
||||
|
||||
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
||||
Brush.aliases = ['text', 'plain'];
|
||||
|
||||
SyntaxHighlighter.brushes.Plain = Brush;
|
||||
|
||||
// CommonJS
|
||||
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
||||
})();
|
74
src/_h5ai/client/js/lib/sh/shBrushPowerShell.js
vendored
Normal file
74
src/_h5ai/client/js/lib/sh/shBrushPowerShell.js
vendored
Normal file
|
@ -0,0 +1,74 @@
|
|||
/**
|
||||
* SyntaxHighlighter
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter
|
||||
*
|
||||
* SyntaxHighlighter is donationware. If you are using it, please donate.
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
|
||||
*
|
||||
* @version
|
||||
* 3.0.83 (July 02 2010)
|
||||
*
|
||||
* @copyright
|
||||
* Copyright (C) 2004-2010 Alex Gorbatchev.
|
||||
*
|
||||
* @license
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
*/
|
||||
;(function()
|
||||
{
|
||||
// CommonJS
|
||||
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
||||
|
||||
function Brush()
|
||||
{
|
||||
// Contributes by B.v.Zanten, Getronics
|
||||
// http://confluence.atlassian.com/display/CONFEXT/New+Code+Macro
|
||||
|
||||
var keywords = 'Add-Content Add-History Add-Member Add-PSSnapin Clear(-Content)? Clear-Item ' +
|
||||
'Clear-ItemProperty Clear-Variable Compare-Object ConvertFrom-SecureString Convert-Path ' +
|
||||
'ConvertTo-Html ConvertTo-SecureString Copy(-Item)? Copy-ItemProperty Export-Alias ' +
|
||||
'Export-Clixml Export-Console Export-Csv ForEach(-Object)? Format-Custom Format-List ' +
|
||||
'Format-Table Format-Wide Get-Acl Get-Alias Get-AuthenticodeSignature Get-ChildItem Get-Command ' +
|
||||
'Get-Content Get-Credential Get-Culture Get-Date Get-EventLog Get-ExecutionPolicy ' +
|
||||
'Get-Help Get-History Get-Host Get-Item Get-ItemProperty Get-Location Get-Member ' +
|
||||
'Get-PfxCertificate Get-Process Get-PSDrive Get-PSProvider Get-PSSnapin Get-Service ' +
|
||||
'Get-TraceSource Get-UICulture Get-Unique Get-Variable Get-WmiObject Group-Object ' +
|
||||
'Import-Alias Import-Clixml Import-Csv Invoke-Expression Invoke-History Invoke-Item ' +
|
||||
'Join-Path Measure-Command Measure-Object Move(-Item)? Move-ItemProperty New-Alias ' +
|
||||
'New-Item New-ItemProperty New-Object New-PSDrive New-Service New-TimeSpan ' +
|
||||
'New-Variable Out-Default Out-File Out-Host Out-Null Out-Printer Out-String Pop-Location ' +
|
||||
'Push-Location Read-Host Remove-Item Remove-ItemProperty Remove-PSDrive Remove-PSSnapin ' +
|
||||
'Remove-Variable Rename-Item Rename-ItemProperty Resolve-Path Restart-Service Resume-Service ' +
|
||||
'Select-Object Select-String Set-Acl Set-Alias Set-AuthenticodeSignature Set-Content ' +
|
||||
'Set-Date Set-ExecutionPolicy Set-Item Set-ItemProperty Set-Location Set-PSDebug ' +
|
||||
'Set-Service Set-TraceSource Set(-Variable)? Sort-Object Split-Path Start-Service ' +
|
||||
'Start-Sleep Start-Transcript Stop-Process Stop-Service Stop-Transcript Suspend-Service ' +
|
||||
'Tee-Object Test-Path Trace-Command Update-FormatData Update-TypeData Where(-Object)? ' +
|
||||
'Write-Debug Write-Error Write(-Host)? Write-Output Write-Progress Write-Verbose Write-Warning';
|
||||
var alias = 'ac asnp clc cli clp clv cpi cpp cvpa diff epal epcsv fc fl ' +
|
||||
'ft fw gal gc gci gcm gdr ghy gi gl gm gp gps group gsv ' +
|
||||
'gsnp gu gv gwmi iex ihy ii ipal ipcsv mi mp nal ndr ni nv oh rdr ' +
|
||||
'ri rni rnp rp rsnp rv rvpa sal sasv sc select si sl sleep sort sp ' +
|
||||
'spps spsv sv tee cat cd cp h history kill lp ls ' +
|
||||
'mount mv popd ps pushd pwd r rm rmdir echo cls chdir del dir ' +
|
||||
'erase rd ren type % \\?';
|
||||
|
||||
this.regexList = [
|
||||
{ regex: /#.*$/gm, css: 'comments' }, // one line comments
|
||||
{ regex: /\$[a-zA-Z0-9]+\b/g, css: 'value' }, // variables $Computer1
|
||||
{ regex: /\-[a-zA-Z]+\b/g, css: 'keyword' }, // Operators -not -and -eq
|
||||
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
|
||||
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
|
||||
{ regex: new RegExp(this.getKeywords(keywords), 'gmi'), css: 'keyword' },
|
||||
{ regex: new RegExp(this.getKeywords(alias), 'gmi'), css: 'keyword' }
|
||||
];
|
||||
};
|
||||
|
||||
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
||||
Brush.aliases = ['powershell', 'ps'];
|
||||
|
||||
SyntaxHighlighter.brushes.PowerShell = Brush;
|
||||
|
||||
// CommonJS
|
||||
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
||||
})();
|
64
src/_h5ai/client/js/lib/sh/shBrushPython.js
vendored
Normal file
64
src/_h5ai/client/js/lib/sh/shBrushPython.js
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
/**
|
||||
* SyntaxHighlighter
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter
|
||||
*
|
||||
* SyntaxHighlighter is donationware. If you are using it, please donate.
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
|
||||
*
|
||||
* @version
|
||||
* 3.0.83 (July 02 2010)
|
||||
*
|
||||
* @copyright
|
||||
* Copyright (C) 2004-2010 Alex Gorbatchev.
|
||||
*
|
||||
* @license
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
*/
|
||||
;(function()
|
||||
{
|
||||
// CommonJS
|
||||
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
||||
|
||||
function Brush()
|
||||
{
|
||||
// Contributed by Gheorghe Milas and Ahmad Sherif
|
||||
|
||||
var keywords = 'and assert break class continue def del elif else ' +
|
||||
'except exec finally for from global if import in is ' +
|
||||
'lambda not or pass print raise return try yield while';
|
||||
|
||||
var funcs = '__import__ abs all any apply basestring bin bool buffer callable ' +
|
||||
'chr classmethod cmp coerce compile complex delattr dict dir ' +
|
||||
'divmod enumerate eval execfile file filter float format frozenset ' +
|
||||
'getattr globals hasattr hash help hex id input int intern ' +
|
||||
'isinstance issubclass iter len list locals long map max min next ' +
|
||||
'object oct open ord pow print property range raw_input reduce ' +
|
||||
'reload repr reversed round set setattr slice sorted staticmethod ' +
|
||||
'str sum super tuple type type unichr unicode vars xrange zip';
|
||||
|
||||
var special = 'None True False self cls class_';
|
||||
|
||||
this.regexList = [
|
||||
{ regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' },
|
||||
{ regex: /^\s*@\w+/gm, css: 'decorator' },
|
||||
{ regex: /(['\"]{3})([^\1])*?\1/gm, css: 'comments' },
|
||||
{ regex: /"(?!")(?:\.|\\\"|[^\""\n])*"/gm, css: 'string' },
|
||||
{ regex: /'(?!')(?:\.|(\\\')|[^\''\n])*'/gm, css: 'string' },
|
||||
{ regex: /\+|\-|\*|\/|\%|=|==/gm, css: 'keyword' },
|
||||
{ regex: /\b\d+\.?\w*/g, css: 'value' },
|
||||
{ regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' },
|
||||
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' },
|
||||
{ regex: new RegExp(this.getKeywords(special), 'gm'), css: 'color1' }
|
||||
];
|
||||
|
||||
this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
|
||||
};
|
||||
|
||||
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
||||
Brush.aliases = ['py', 'python'];
|
||||
|
||||
SyntaxHighlighter.brushes.Python = Brush;
|
||||
|
||||
// CommonJS
|
||||
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
||||
})();
|
55
src/_h5ai/client/js/lib/sh/shBrushRuby.js
vendored
Normal file
55
src/_h5ai/client/js/lib/sh/shBrushRuby.js
vendored
Normal file
|
@ -0,0 +1,55 @@
|
|||
/**
|
||||
* SyntaxHighlighter
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter
|
||||
*
|
||||
* SyntaxHighlighter is donationware. If you are using it, please donate.
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
|
||||
*
|
||||
* @version
|
||||
* 3.0.83 (July 02 2010)
|
||||
*
|
||||
* @copyright
|
||||
* Copyright (C) 2004-2010 Alex Gorbatchev.
|
||||
*
|
||||
* @license
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
*/
|
||||
;(function()
|
||||
{
|
||||
// CommonJS
|
||||
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
||||
|
||||
function Brush()
|
||||
{
|
||||
// Contributed by Erik Peterson.
|
||||
|
||||
var keywords = 'alias and BEGIN begin break case class def define_method defined do each else elsif ' +
|
||||
'END end ensure false for if in module new next nil not or raise redo rescue retry return ' +
|
||||
'self super then throw true undef unless until when while yield';
|
||||
|
||||
var builtins = 'Array Bignum Binding Class Continuation Dir Exception FalseClass File::Stat File Fixnum Fload ' +
|
||||
'Hash Integer IO MatchData Method Module NilClass Numeric Object Proc Range Regexp String Struct::TMS Symbol ' +
|
||||
'ThreadGroup Thread Time TrueClass';
|
||||
|
||||
this.regexList = [
|
||||
{ regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, // one line comments
|
||||
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
|
||||
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
|
||||
{ regex: /\b[A-Z0-9_]+\b/g, css: 'constants' }, // constants
|
||||
{ regex: /:[a-z][A-Za-z0-9_]*/g, css: 'color2' }, // symbols
|
||||
{ regex: /(\$|@@|@)\w+/g, css: 'variable bold' }, // $global, @instance, and @@class variables
|
||||
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords
|
||||
{ regex: new RegExp(this.getKeywords(builtins), 'gm'), css: 'color1' } // builtins
|
||||
];
|
||||
|
||||
this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
|
||||
};
|
||||
|
||||
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
||||
Brush.aliases = ['ruby', 'rails', 'ror', 'rb'];
|
||||
|
||||
SyntaxHighlighter.brushes.Ruby = Brush;
|
||||
|
||||
// CommonJS
|
||||
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
||||
})();
|
94
src/_h5ai/client/js/lib/sh/shBrushSass.js
vendored
Normal file
94
src/_h5ai/client/js/lib/sh/shBrushSass.js
vendored
Normal file
|
@ -0,0 +1,94 @@
|
|||
/**
|
||||
* SyntaxHighlighter
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter
|
||||
*
|
||||
* SyntaxHighlighter is donationware. If you are using it, please donate.
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
|
||||
*
|
||||
* @version
|
||||
* 3.0.83 (July 02 2010)
|
||||
*
|
||||
* @copyright
|
||||
* Copyright (C) 2004-2010 Alex Gorbatchev.
|
||||
*
|
||||
* @license
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
*/
|
||||
;(function()
|
||||
{
|
||||
// CommonJS
|
||||
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
||||
|
||||
function Brush()
|
||||
{
|
||||
function getKeywordsCSS(str)
|
||||
{
|
||||
return '\\b([a-z_]|)' + str.replace(/ /g, '(?=:)\\b|\\b([a-z_\\*]|\\*|)') + '(?=:)\\b';
|
||||
};
|
||||
|
||||
function getValuesCSS(str)
|
||||
{
|
||||
return '\\b' + str.replace(/ /g, '(?!-)(?!:)\\b|\\b()') + '\:\\b';
|
||||
};
|
||||
|
||||
var keywords = 'ascent azimuth background-attachment background-color background-image background-position ' +
|
||||
'background-repeat background baseline bbox border-collapse border-color border-spacing border-style border-top ' +
|
||||
'border-right border-bottom border-left border-top-color border-right-color border-bottom-color border-left-color ' +
|
||||
'border-top-style border-right-style border-bottom-style border-left-style border-top-width border-right-width ' +
|
||||
'border-bottom-width border-left-width border-width border bottom cap-height caption-side centerline clear clip color ' +
|
||||
'content counter-increment counter-reset cue-after cue-before cue cursor definition-src descent direction display ' +
|
||||
'elevation empty-cells float font-size-adjust font-family font-size font-stretch font-style font-variant font-weight font ' +
|
||||
'height left letter-spacing line-height list-style-image list-style-position list-style-type list-style margin-top ' +
|
||||
'margin-right margin-bottom margin-left margin marker-offset marks mathline max-height max-width min-height min-width orphans ' +
|
||||
'outline-color outline-style outline-width outline overflow padding-top padding-right padding-bottom padding-left padding page ' +
|
||||
'page-break-after page-break-before page-break-inside pause pause-after pause-before pitch pitch-range play-during position ' +
|
||||
'quotes right richness size slope src speak-header speak-numeral speak-punctuation speak speech-rate stemh stemv stress ' +
|
||||
'table-layout text-align top text-decoration text-indent text-shadow text-transform unicode-bidi unicode-range units-per-em ' +
|
||||
'vertical-align visibility voice-family volume white-space widows width widths word-spacing x-height z-index';
|
||||
|
||||
var values = 'above absolute all always aqua armenian attr aural auto avoid baseline behind below bidi-override black blink block blue bold bolder '+
|
||||
'both bottom braille capitalize caption center center-left center-right circle close-quote code collapse compact condensed '+
|
||||
'continuous counter counters crop cross crosshair cursive dashed decimal decimal-leading-zero digits disc dotted double '+
|
||||
'embed embossed e-resize expanded extra-condensed extra-expanded fantasy far-left far-right fast faster fixed format fuchsia '+
|
||||
'gray green groove handheld hebrew help hidden hide high higher icon inline-table inline inset inside invert italic '+
|
||||
'justify landscape large larger left-side left leftwards level lighter lime line-through list-item local loud lower-alpha '+
|
||||
'lowercase lower-greek lower-latin lower-roman lower low ltr marker maroon medium message-box middle mix move narrower '+
|
||||
'navy ne-resize no-close-quote none no-open-quote no-repeat normal nowrap n-resize nw-resize oblique olive once open-quote outset '+
|
||||
'outside overline pointer portrait pre print projection purple red relative repeat repeat-x repeat-y rgb ridge right right-side '+
|
||||
'rightwards rtl run-in screen scroll semi-condensed semi-expanded separate se-resize show silent silver slower slow '+
|
||||
'small small-caps small-caption smaller soft solid speech spell-out square s-resize static status-bar sub super sw-resize '+
|
||||
'table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group teal '+
|
||||
'text-bottom text-top thick thin top transparent tty tv ultra-condensed ultra-expanded underline upper-alpha uppercase upper-latin '+
|
||||
'upper-roman url visible wait white wider w-resize x-fast x-high x-large x-loud x-low x-slow x-small x-soft xx-large xx-small yellow';
|
||||
|
||||
var fonts = '[mM]onospace [tT]ahoma [vV]erdana [aA]rial [hH]elvetica [sS]ans-serif [sS]erif [cC]ourier mono sans serif';
|
||||
|
||||
var statements = '!important !default';
|
||||
var preprocessor = '@import @extend @debug @warn @if @for @while @mixin @include';
|
||||
|
||||
var r = SyntaxHighlighter.regexLib;
|
||||
|
||||
this.regexList = [
|
||||
{ regex: r.multiLineCComments, css: 'comments' }, // multiline comments
|
||||
{ regex: r.singleLineCComments, css: 'comments' }, // singleline comments
|
||||
{ regex: r.doubleQuotedString, css: 'string' }, // double quoted strings
|
||||
{ regex: r.singleQuotedString, css: 'string' }, // single quoted strings
|
||||
{ regex: /\#[a-fA-F0-9]{3,6}/g, css: 'value' }, // html colors
|
||||
{ regex: /\b(-?\d+)(\.\d+)?(px|em|pt|\:|\%|)\b/g, css: 'value' }, // sizes
|
||||
{ regex: /\$\w+/g, css: 'variable' }, // variables
|
||||
{ regex: new RegExp(this.getKeywords(statements), 'g'), css: 'color3' }, // statements
|
||||
{ regex: new RegExp(this.getKeywords(preprocessor), 'g'), css: 'preprocessor' }, // preprocessor
|
||||
{ regex: new RegExp(getKeywordsCSS(keywords), 'gm'), css: 'keyword' }, // keywords
|
||||
{ regex: new RegExp(getValuesCSS(values), 'g'), css: 'value' }, // values
|
||||
{ regex: new RegExp(this.getKeywords(fonts), 'g'), css: 'color1' } // fonts
|
||||
];
|
||||
};
|
||||
|
||||
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
||||
Brush.aliases = ['sass', 'scss'];
|
||||
|
||||
SyntaxHighlighter.brushes.Sass = Brush;
|
||||
|
||||
// CommonJS
|
||||
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
||||
})();
|
51
src/_h5ai/client/js/lib/sh/shBrushScala.js
vendored
Normal file
51
src/_h5ai/client/js/lib/sh/shBrushScala.js
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
/**
|
||||
* SyntaxHighlighter
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter
|
||||
*
|
||||
* SyntaxHighlighter is donationware. If you are using it, please donate.
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
|
||||
*
|
||||
* @version
|
||||
* 3.0.83 (July 02 2010)
|
||||
*
|
||||
* @copyright
|
||||
* Copyright (C) 2004-2010 Alex Gorbatchev.
|
||||
*
|
||||
* @license
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
*/
|
||||
;(function()
|
||||
{
|
||||
// CommonJS
|
||||
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
||||
|
||||
function Brush()
|
||||
{
|
||||
// Contributed by Yegor Jbanov and David Bernard.
|
||||
|
||||
var keywords = 'val sealed case def true trait implicit forSome import match object null finally super ' +
|
||||
'override try lazy for var catch throw type extends class while with new final yield abstract ' +
|
||||
'else do if return protected private this package false';
|
||||
|
||||
var keyops = '[_:=><%#@]+';
|
||||
|
||||
this.regexList = [
|
||||
{ regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
|
||||
{ regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
|
||||
{ regex: SyntaxHighlighter.regexLib.multiLineSingleQuotedString, css: 'string' }, // multi-line strings
|
||||
{ regex: SyntaxHighlighter.regexLib.multiLineDoubleQuotedString, css: 'string' }, // double-quoted string
|
||||
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
|
||||
{ regex: /0x[a-f0-9]+|\d+(\.\d+)?/gi, css: 'value' }, // numbers
|
||||
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords
|
||||
{ regex: new RegExp(keyops, 'gm'), css: 'keyword' } // scala keyword
|
||||
];
|
||||
}
|
||||
|
||||
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
||||
Brush.aliases = ['scala'];
|
||||
|
||||
SyntaxHighlighter.brushes.Scala = Brush;
|
||||
|
||||
// CommonJS
|
||||
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
||||
})();
|
66
src/_h5ai/client/js/lib/sh/shBrushSql.js
vendored
Normal file
66
src/_h5ai/client/js/lib/sh/shBrushSql.js
vendored
Normal file
|
@ -0,0 +1,66 @@
|
|||
/**
|
||||
* SyntaxHighlighter
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter
|
||||
*
|
||||
* SyntaxHighlighter is donationware. If you are using it, please donate.
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
|
||||
*
|
||||
* @version
|
||||
* 3.0.83 (July 02 2010)
|
||||
*
|
||||
* @copyright
|
||||
* Copyright (C) 2004-2010 Alex Gorbatchev.
|
||||
*
|
||||
* @license
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
*/
|
||||
;(function()
|
||||
{
|
||||
// CommonJS
|
||||
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
||||
|
||||
function Brush()
|
||||
{
|
||||
var funcs = 'abs avg case cast coalesce convert count current_timestamp ' +
|
||||
'current_user day isnull left lower month nullif replace right ' +
|
||||
'session_user space substring sum system_user upper user year';
|
||||
|
||||
var keywords = 'absolute action add after alter as asc at authorization begin bigint ' +
|
||||
'binary bit by cascade char character check checkpoint close collate ' +
|
||||
'column commit committed connect connection constraint contains continue ' +
|
||||
'create cube current current_date current_time cursor database date ' +
|
||||
'deallocate dec decimal declare default delete desc distinct double drop ' +
|
||||
'dynamic else end end-exec escape except exec execute false fetch first ' +
|
||||
'float for force foreign forward free from full function global goto grant ' +
|
||||
'group grouping having hour ignore index inner insensitive insert instead ' +
|
||||
'int integer intersect into is isolation key last level load local max min ' +
|
||||
'minute modify move name national nchar next no numeric of off on only ' +
|
||||
'open option order out output partial password precision prepare primary ' +
|
||||
'prior privileges procedure public read real references relative repeatable ' +
|
||||
'restrict return returns revoke rollback rollup rows rule schema scroll ' +
|
||||
'second section select sequence serializable set size smallint static ' +
|
||||
'statistics table temp temporary then time timestamp to top transaction ' +
|
||||
'translation trigger true truncate uncommitted union unique update values ' +
|
||||
'varchar varying view when where with work';
|
||||
|
||||
var operators = 'all and any between cross in join like not null or outer some';
|
||||
|
||||
this.regexList = [
|
||||
{ regex: /--(.*)$/gm, css: 'comments' }, // one line and multiline comments
|
||||
{ regex: SyntaxHighlighter.regexLib.multiLineDoubleQuotedString, css: 'string' }, // double quoted strings
|
||||
{ regex: SyntaxHighlighter.regexLib.multiLineSingleQuotedString, css: 'string' }, // single quoted strings
|
||||
{ regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'color2' }, // functions
|
||||
{ regex: new RegExp(this.getKeywords(operators), 'gmi'), css: 'color1' }, // operators and such
|
||||
{ regex: new RegExp(this.getKeywords(keywords), 'gmi'), css: 'keyword' } // keyword
|
||||
];
|
||||
};
|
||||
|
||||
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
||||
Brush.aliases = ['sql'];
|
||||
|
||||
SyntaxHighlighter.brushes.Sql = Brush;
|
||||
|
||||
// CommonJS
|
||||
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
||||
})();
|
||||
|
56
src/_h5ai/client/js/lib/sh/shBrushVb.js
vendored
Normal file
56
src/_h5ai/client/js/lib/sh/shBrushVb.js
vendored
Normal file
|
@ -0,0 +1,56 @@
|
|||
/**
|
||||
* SyntaxHighlighter
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter
|
||||
*
|
||||
* SyntaxHighlighter is donationware. If you are using it, please donate.
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
|
||||
*
|
||||
* @version
|
||||
* 3.0.83 (July 02 2010)
|
||||
*
|
||||
* @copyright
|
||||
* Copyright (C) 2004-2010 Alex Gorbatchev.
|
||||
*
|
||||
* @license
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
*/
|
||||
;(function()
|
||||
{
|
||||
// CommonJS
|
||||
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
||||
|
||||
function Brush()
|
||||
{
|
||||
var keywords = 'AddHandler AddressOf AndAlso Alias And Ansi As Assembly Auto ' +
|
||||
'Boolean ByRef Byte ByVal Call Case Catch CBool CByte CChar CDate ' +
|
||||
'CDec CDbl Char CInt Class CLng CObj Const CShort CSng CStr CType ' +
|
||||
'Date Decimal Declare Default Delegate Dim DirectCast Do Double Each ' +
|
||||
'Else ElseIf End Enum Erase Error Event Exit False Finally For Friend ' +
|
||||
'Function Get GetType GoSub GoTo Handles If Implements Imports In ' +
|
||||
'Inherits Integer Interface Is Let Lib Like Long Loop Me Mod Module ' +
|
||||
'MustInherit MustOverride MyBase MyClass Namespace New Next Not Nothing ' +
|
||||
'NotInheritable NotOverridable Object On Option Optional Or OrElse ' +
|
||||
'Overloads Overridable Overrides ParamArray Preserve Private Property ' +
|
||||
'Protected Public RaiseEvent ReadOnly ReDim REM RemoveHandler Resume ' +
|
||||
'Return Select Set Shadows Shared Short Single Static Step Stop String ' +
|
||||
'Structure Sub SyncLock Then Throw To True Try TypeOf Unicode Until ' +
|
||||
'Variant When While With WithEvents WriteOnly Xor';
|
||||
|
||||
this.regexList = [
|
||||
{ regex: /'.*$/gm, css: 'comments' }, // one line comments
|
||||
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
|
||||
{ regex: /^\s*#.*$/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion
|
||||
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // vb keyword
|
||||
];
|
||||
|
||||
this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
|
||||
};
|
||||
|
||||
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
||||
Brush.aliases = ['vb', 'vbnet'];
|
||||
|
||||
SyntaxHighlighter.brushes.Vb = Brush;
|
||||
|
||||
// CommonJS
|
||||
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
||||
})();
|
69
src/_h5ai/client/js/lib/sh/shBrushXml.js
vendored
Normal file
69
src/_h5ai/client/js/lib/sh/shBrushXml.js
vendored
Normal file
|
@ -0,0 +1,69 @@
|
|||
/**
|
||||
* SyntaxHighlighter
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter
|
||||
*
|
||||
* SyntaxHighlighter is donationware. If you are using it, please donate.
|
||||
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
|
||||
*
|
||||
* @version
|
||||
* 3.0.83 (July 02 2010)
|
||||
*
|
||||
* @copyright
|
||||
* Copyright (C) 2004-2010 Alex Gorbatchev.
|
||||
*
|
||||
* @license
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
*/
|
||||
;(function()
|
||||
{
|
||||
// CommonJS
|
||||
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
|
||||
|
||||
function Brush()
|
||||
{
|
||||
function process(match, regexInfo)
|
||||
{
|
||||
var constructor = SyntaxHighlighter.Match,
|
||||
code = match[0],
|
||||
tag = new XRegExp('(<|<)[\\s\\/\\?]*(?<name>[:\\w-\\.]+)', 'xg').exec(code),
|
||||
result = []
|
||||
;
|
||||
|
||||
if (match.attributes != null)
|
||||
{
|
||||
var attributes,
|
||||
regex = new XRegExp('(?<name> [\\w:\\-\\.]+)' +
|
||||
'\\s*=\\s*' +
|
||||
'(?<value> ".*?"|\'.*?\'|\\w+)',
|
||||
'xg');
|
||||
|
||||
while ((attributes = regex.exec(code)) != null)
|
||||
{
|
||||
result.push(new constructor(attributes.name, match.index + attributes.index, 'color1'));
|
||||
result.push(new constructor(attributes.value, match.index + attributes.index + attributes[0].indexOf(attributes.value), 'string'));
|
||||
}
|
||||
}
|
||||
|
||||
if (tag != null)
|
||||
result.push(
|
||||
new constructor(tag.name, match.index + tag[0].indexOf(tag.name), 'keyword')
|
||||
);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
this.regexList = [
|
||||
{ regex: new XRegExp('(\\<|<)\\!\\[[\\w\\s]*?\\[(.|\\s)*?\\]\\](\\>|>)', 'gm'), css: 'color2' }, // <![ ... [ ... ]]>
|
||||
{ regex: SyntaxHighlighter.regexLib.xmlComments, css: 'comments' }, // <!-- ... -->
|
||||
{ regex: new XRegExp('(<|<)[\\s\\/\\?]*(\\w+)(?<attributes>.*?)[\\s\\/\\?]*(>|>)', 'sg'), func: process }
|
||||
];
|
||||
};
|
||||
|
||||
Brush.prototype = new SyntaxHighlighter.Highlighter();
|
||||
Brush.aliases = ['xml', 'xhtml', 'xslt', 'html'];
|
||||
|
||||
SyntaxHighlighter.brushes.Xml = Brush;
|
||||
|
||||
// CommonJS
|
||||
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
|
||||
})();
|
17
src/_h5ai/client/js/lib/sh/shCore.js
vendored
Normal file
17
src/_h5ai/client/js/lib/sh/shCore.js
vendored
Normal file
File diff suppressed because one or more lines are too long
320
src/_h5ai/client/js/lib/spin-1.2.7.js
Normal file
320
src/_h5ai/client/js/lib/spin-1.2.7.js
Normal file
|
@ -0,0 +1,320 @@
|
|||
//fgnass.github.com/spin.js#v1.2.7
|
||||
!function(window, document, undefined) {
|
||||
|
||||
/**
|
||||
* Copyright (c) 2011 Felix Gnass [fgnass at neteye dot de]
|
||||
* Licensed under the MIT license
|
||||
*/
|
||||
|
||||
var prefixes = ['webkit', 'Moz', 'ms', 'O'] /* Vendor prefixes */
|
||||
, animations = {} /* Animation rules keyed by their name */
|
||||
, useCssAnimations
|
||||
|
||||
/**
|
||||
* Utility function to create elements. If no tag name is given,
|
||||
* a DIV is created. Optionally properties can be passed.
|
||||
*/
|
||||
function createEl(tag, prop) {
|
||||
var el = document.createElement(tag || 'div')
|
||||
, n
|
||||
|
||||
for(n in prop) el[n] = prop[n]
|
||||
return el
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends children and returns the parent.
|
||||
*/
|
||||
function ins(parent /* child1, child2, ...*/) {
|
||||
for (var i=1, n=arguments.length; i<n; i++)
|
||||
parent.appendChild(arguments[i])
|
||||
|
||||
return parent
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert a new stylesheet to hold the @keyframe or VML rules.
|
||||
*/
|
||||
var sheet = function() {
|
||||
var el = createEl('style', {type : 'text/css'})
|
||||
ins(document.getElementsByTagName('head')[0], el)
|
||||
return el.sheet || el.styleSheet
|
||||
}()
|
||||
|
||||
/**
|
||||
* Creates an opacity keyframe animation rule and returns its name.
|
||||
* Since most mobile Webkits have timing issues with animation-delay,
|
||||
* we create separate rules for each line/segment.
|
||||
*/
|
||||
function addAnimation(alpha, trail, i, lines) {
|
||||
var name = ['opacity', trail, ~~(alpha*100), i, lines].join('-')
|
||||
, start = 0.01 + i/lines*100
|
||||
, z = Math.max(1 - (1-alpha) / trail * (100-start), alpha)
|
||||
, prefix = useCssAnimations.substring(0, useCssAnimations.indexOf('Animation')).toLowerCase()
|
||||
, pre = prefix && '-'+prefix+'-' || ''
|
||||
|
||||
if (!animations[name]) {
|
||||
sheet.insertRule(
|
||||
'@' + pre + 'keyframes ' + name + '{' +
|
||||
'0%{opacity:' + z + '}' +
|
||||
start + '%{opacity:' + alpha + '}' +
|
||||
(start+0.01) + '%{opacity:1}' +
|
||||
(start+trail) % 100 + '%{opacity:' + alpha + '}' +
|
||||
'100%{opacity:' + z + '}' +
|
||||
'}', sheet.cssRules.length)
|
||||
|
||||
animations[name] = 1
|
||||
}
|
||||
return name
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries various vendor prefixes and returns the first supported property.
|
||||
**/
|
||||
function vendor(el, prop) {
|
||||
var s = el.style
|
||||
, pp
|
||||
, i
|
||||
|
||||
if(s[prop] !== undefined) return prop
|
||||
prop = prop.charAt(0).toUpperCase() + prop.slice(1)
|
||||
for(i=0; i<prefixes.length; i++) {
|
||||
pp = prefixes[i]+prop
|
||||
if(s[pp] !== undefined) return pp
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets multiple style properties at once.
|
||||
*/
|
||||
function css(el, prop) {
|
||||
for (var n in prop)
|
||||
el.style[vendor(el, n)||n] = prop[n]
|
||||
|
||||
return el
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills in default values.
|
||||
*/
|
||||
function merge(obj) {
|
||||
for (var i=1; i < arguments.length; i++) {
|
||||
var def = arguments[i]
|
||||
for (var n in def)
|
||||
if (obj[n] === undefined) obj[n] = def[n]
|
||||
}
|
||||
return obj
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the absolute page-offset of the given element.
|
||||
*/
|
||||
function pos(el) {
|
||||
var o = { x:el.offsetLeft, y:el.offsetTop }
|
||||
while((el = el.offsetParent))
|
||||
o.x+=el.offsetLeft, o.y+=el.offsetTop
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
var defaults = {
|
||||
lines: 12, // The number of lines to draw
|
||||
length: 7, // The length of each line
|
||||
width: 5, // The line thickness
|
||||
radius: 10, // The radius of the inner circle
|
||||
rotate: 0, // Rotation offset
|
||||
corners: 1, // Roundness (0..1)
|
||||
color: '#000', // #rgb or #rrggbb
|
||||
speed: 1, // Rounds per second
|
||||
trail: 100, // Afterglow percentage
|
||||
opacity: 1/4, // Opacity of the lines
|
||||
fps: 20, // Frames per second when using setTimeout()
|
||||
zIndex: 2e9, // Use a high z-index by default
|
||||
className: 'spinner', // CSS class to assign to the element
|
||||
top: 'auto', // center vertically
|
||||
left: 'auto', // center horizontally
|
||||
position: 'relative' // element position
|
||||
}
|
||||
|
||||
/** The constructor */
|
||||
var Spinner = function Spinner(o) {
|
||||
if (!this.spin) return new Spinner(o)
|
||||
this.opts = merge(o || {}, Spinner.defaults, defaults)
|
||||
}
|
||||
|
||||
Spinner.defaults = {}
|
||||
|
||||
merge(Spinner.prototype, {
|
||||
spin: function(target) {
|
||||
this.stop()
|
||||
var self = this
|
||||
, o = self.opts
|
||||
, el = self.el = css(createEl(0, {className: o.className}), {position: o.position, width: 0, zIndex: o.zIndex})
|
||||
, mid = o.radius+o.length+o.width
|
||||
, ep // element position
|
||||
, tp // target position
|
||||
|
||||
if (target) {
|
||||
target.insertBefore(el, target.firstChild||null)
|
||||
tp = pos(target)
|
||||
ep = pos(el)
|
||||
css(el, {
|
||||
left: (o.left == 'auto' ? tp.x-ep.x + (target.offsetWidth >> 1) : parseInt(o.left, 10) + mid) + 'px',
|
||||
top: (o.top == 'auto' ? tp.y-ep.y + (target.offsetHeight >> 1) : parseInt(o.top, 10) + mid) + 'px'
|
||||
})
|
||||
}
|
||||
|
||||
el.setAttribute('aria-role', 'progressbar')
|
||||
self.lines(el, self.opts)
|
||||
|
||||
if (!useCssAnimations) {
|
||||
// No CSS animation support, use setTimeout() instead
|
||||
var i = 0
|
||||
, fps = o.fps
|
||||
, f = fps/o.speed
|
||||
, ostep = (1-o.opacity) / (f*o.trail / 100)
|
||||
, astep = f/o.lines
|
||||
|
||||
;(function anim() {
|
||||
i++;
|
||||
for (var s=o.lines; s; s--) {
|
||||
var alpha = Math.max(1-(i+s*astep)%f * ostep, o.opacity)
|
||||
self.opacity(el, o.lines-s, alpha, o)
|
||||
}
|
||||
self.timeout = self.el && setTimeout(anim, ~~(1000/fps))
|
||||
})()
|
||||
}
|
||||
return self
|
||||
},
|
||||
|
||||
stop: function() {
|
||||
var el = this.el
|
||||
if (el) {
|
||||
clearTimeout(this.timeout)
|
||||
if (el.parentNode) el.parentNode.removeChild(el)
|
||||
this.el = undefined
|
||||
}
|
||||
return this
|
||||
},
|
||||
|
||||
lines: function(el, o) {
|
||||
var i = 0
|
||||
, seg
|
||||
|
||||
function fill(color, shadow) {
|
||||
return css(createEl(), {
|
||||
position: 'absolute',
|
||||
width: (o.length+o.width) + 'px',
|
||||
height: o.width + 'px',
|
||||
background: color,
|
||||
boxShadow: shadow,
|
||||
transformOrigin: 'left',
|
||||
transform: 'rotate(' + ~~(360/o.lines*i+o.rotate) + 'deg) translate(' + o.radius+'px' +',0)',
|
||||
borderRadius: (o.corners * o.width>>1) + 'px'
|
||||
})
|
||||
}
|
||||
|
||||
for (; i < o.lines; i++) {
|
||||
seg = css(createEl(), {
|
||||
position: 'absolute',
|
||||
top: 1+~(o.width/2) + 'px',
|
||||
transform: o.hwaccel ? 'translate3d(0,0,0)' : '',
|
||||
opacity: o.opacity,
|
||||
animation: useCssAnimations && addAnimation(o.opacity, o.trail, i, o.lines) + ' ' + 1/o.speed + 's linear infinite'
|
||||
})
|
||||
|
||||
if (o.shadow) ins(seg, css(fill('#000', '0 0 4px ' + '#000'), {top: 2+'px'}))
|
||||
|
||||
ins(el, ins(seg, fill(o.color, '0 0 1px rgba(0,0,0,.1)')))
|
||||
}
|
||||
return el
|
||||
},
|
||||
|
||||
opacity: function(el, i, val) {
|
||||
if (i < el.childNodes.length) el.childNodes[i].style.opacity = val
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// VML rendering for IE
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Check and init VML support
|
||||
*/
|
||||
;(function() {
|
||||
|
||||
function vml(tag, attr) {
|
||||
return createEl('<' + tag + ' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">', attr)
|
||||
}
|
||||
|
||||
var s = css(createEl('group'), {behavior: 'url(#default#VML)'})
|
||||
|
||||
if (!vendor(s, 'transform') && s.adj) {
|
||||
|
||||
// VML support detected. Insert CSS rule ...
|
||||
sheet.addRule('.spin-vml', 'behavior:url(#default#VML)')
|
||||
|
||||
Spinner.prototype.lines = function(el, o) {
|
||||
var r = o.length+o.width
|
||||
, s = 2*r
|
||||
|
||||
function grp() {
|
||||
return css(
|
||||
vml('group', {
|
||||
coordsize: s + ' ' + s,
|
||||
coordorigin: -r + ' ' + -r
|
||||
}),
|
||||
{ width: s, height: s }
|
||||
)
|
||||
}
|
||||
|
||||
var margin = -(o.width+o.length)*2 + 'px'
|
||||
, g = css(grp(), {position: 'absolute', top: margin, left: margin})
|
||||
, i
|
||||
|
||||
function seg(i, dx, filter) {
|
||||
ins(g,
|
||||
ins(css(grp(), {rotation: 360 / o.lines * i + 'deg', left: ~~dx}),
|
||||
ins(css(vml('roundrect', {arcsize: o.corners}), {
|
||||
width: r,
|
||||
height: o.width,
|
||||
left: o.radius,
|
||||
top: -o.width>>1,
|
||||
filter: filter
|
||||
}),
|
||||
vml('fill', {color: o.color, opacity: o.opacity}),
|
||||
vml('stroke', {opacity: 0}) // transparent stroke to fix color bleeding upon opacity change
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
if (o.shadow)
|
||||
for (i = 1; i <= o.lines; i++)
|
||||
seg(i, -2, 'progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)')
|
||||
|
||||
for (i = 1; i <= o.lines; i++) seg(i)
|
||||
return ins(el, g)
|
||||
}
|
||||
|
||||
Spinner.prototype.opacity = function(el, i, val, o) {
|
||||
var c = el.firstChild
|
||||
o = o.shadow && o.lines || 0
|
||||
if (c && i+o < c.childNodes.length) {
|
||||
c = c.childNodes[i+o]; c = c && c.firstChild; c = c && c.firstChild
|
||||
if (c) c.opacity = val
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
useCssAnimations = vendor(s, 'animation')
|
||||
})()
|
||||
|
||||
if (typeof define == 'function' && define.amd)
|
||||
define(function() { return Spinner })
|
||||
else
|
||||
window.Spinner = Spinner
|
||||
|
||||
}(window, document);
|
1189
src/_h5ai/client/js/lib/underscore-1.4.1.js
Normal file
1189
src/_h5ai/client/js/lib/underscore-1.4.1.js
Normal file
File diff suppressed because it is too large
Load diff
2
src/_h5ai/client/js/markdown.js
Normal file
2
src/_h5ai/client/js/markdown.js
Normal file
|
@ -0,0 +1,2 @@
|
|||
|
||||
// @include "lib/markdown-*.js"
|
90
src/_h5ai/client/js/scripts.js
Normal file
90
src/_h5ai/client/js/scripts.js
Normal file
|
@ -0,0 +1,90 @@
|
|||
|
||||
// jQuery libs
|
||||
// -----------
|
||||
// @include "lib/jquery-*.js"
|
||||
// @include "lib/jquery.*.js"
|
||||
|
||||
// other libs
|
||||
// ----------
|
||||
// @include "lib/modernizr-*.js"
|
||||
// @include "lib/underscore-*.js"
|
||||
// @include "lib/amplify-*.js"
|
||||
// @include "lib/modulejs-*.js"
|
||||
// @include "lib/moment-*.js"
|
||||
// @include "lib/json2-*.js"
|
||||
// @include "lib/base64.js"
|
||||
// @include "lib/spin-*.js"
|
||||
|
||||
// h5ai
|
||||
// ----
|
||||
(function ($) {
|
||||
'use strict';
|
||||
|
||||
// @include "inc/**/*.js"
|
||||
|
||||
var $scriptTag = $('script[src$="scripts.js"]'),
|
||||
globalConfigHref = $scriptTag.attr('src').replace(/scripts.js$/, '../../conf/config.json'),
|
||||
localConfigHref = $scriptTag.data('config') || './_h5ai.config.json',
|
||||
|
||||
parse = function (response) {
|
||||
|
||||
return response.replace ? JSON.parse(response.replace(/\/\*[\s\S]*?\*\/|\/\/.*?(\n|$)/g, '')) : {};
|
||||
},
|
||||
|
||||
extendLevel1 = function (a, b) {
|
||||
|
||||
$.each(b, function (key) {
|
||||
|
||||
$.extend(a[key], b[key]);
|
||||
});
|
||||
},
|
||||
|
||||
loadConfig = function (callback) {
|
||||
|
||||
var ajaxOpts = {
|
||||
dataType: 'text'
|
||||
},
|
||||
config = {
|
||||
options: {},
|
||||
types: {},
|
||||
langs: {}
|
||||
};
|
||||
|
||||
$.ajax(globalConfigHref, ajaxOpts).always(function (g) {
|
||||
|
||||
extendLevel1(config, parse(g));
|
||||
if (localConfigHref === 'ignore') {
|
||||
callback(config);
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax(localConfigHref, ajaxOpts).always(function (l) {
|
||||
|
||||
extendLevel1(config, parse(l));
|
||||
callback(config);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
run = function (config) {
|
||||
/*global amplify, Base64, jQuery, Modernizr, moment, _ */
|
||||
|
||||
// `jQuery`, `moment` and `underscore` are itself functions,
|
||||
// so they have to be wrapped to not be handled as constructors.
|
||||
modulejs.define('config', config);
|
||||
modulejs.define('amplify', amplify);
|
||||
modulejs.define('base64', Base64);
|
||||
modulejs.define('$', function () { return jQuery; });
|
||||
modulejs.define('modernizr', Modernizr);
|
||||
modulejs.define('moment', function () { return moment; });
|
||||
modulejs.define('_', function () { return _; });
|
||||
|
||||
$(function () {
|
||||
|
||||
modulejs.require($('body').attr('id'));
|
||||
});
|
||||
};
|
||||
|
||||
loadConfig(run);
|
||||
|
||||
}(jQuery));
|
3
src/_h5ai/client/js/syntaxhighlighter.js
Normal file
3
src/_h5ai/client/js/syntaxhighlighter.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
|
||||
// @include "lib/sh/shCore.js"
|
||||
// @include "lib/sh/shBrush*.js"
|
Loading…
Add table
Add a link
Reference in a new issue