mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-03-20 04:20:00 +01:00
Removes aai.
This commit is contained in:
parent
e43d43933a
commit
70f4500232
@ -20,8 +20,6 @@ modulejs.define('core/server', ['$', '_', 'config'], function ($, _, config) {
|
||||
callback();
|
||||
}
|
||||
});
|
||||
} else if (server.backend === 'aai') {
|
||||
return modulejs.require('core/server-request-mock-aai')(data, callback);
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
@ -30,121 +28,3 @@ modulejs.define('core/server', ['$', '_', 'config'], function ($, _, config) {
|
||||
|
||||
return server;
|
||||
});
|
||||
|
||||
|
||||
|
||||
modulejs.define('core/server-request-mock-aai', ['$', '_', 'core/settings', 'core/format'], function ($, _, allsettings, format) {
|
||||
|
||||
var loadText = function (href) {
|
||||
|
||||
var deferred = $.Deferred();
|
||||
|
||||
$.ajax(href, {dataType: 'text'}).always(function (content) {
|
||||
|
||||
content = content.replace ? content : null;
|
||||
deferred.resolve(content);
|
||||
});
|
||||
|
||||
return deferred;
|
||||
},
|
||||
|
||||
loadJson = function (href) {
|
||||
|
||||
var deferred = $.Deferred();
|
||||
|
||||
loadText(href).always(function (content) {
|
||||
|
||||
var json = content.replace ? JSON.parse(content.replace(/\/\*[\s\S]*?\*\/|\/\/.*?(\n|$)/g, '')) : {};
|
||||
deferred.resolve(json);
|
||||
});
|
||||
|
||||
return deferred;
|
||||
},
|
||||
|
||||
parse = function (absHref, html) {
|
||||
|
||||
html = '<div id="body-mock">' + html.replace(/^[\s\S]*<body.*?>|<\/body>[\s\S]*$/g, '') + '</div>';
|
||||
var $table = $(html).find('#data-apache-autoindex table');
|
||||
|
||||
return _.compact(_.map($table.find('td').closest('tr'), function (tr) {
|
||||
|
||||
var $tds = $(tr).find('td'),
|
||||
$a = $tds.eq(1).find('a');
|
||||
|
||||
return $a.text() === 'Parent Directory' ? null : {
|
||||
absHref: absHref + $a.attr('href'),
|
||||
time: format.parseDate($tds.eq(2).text(), ['YYYY-MM-DD HH:mm', 'DD-MMM-YYYY HH:mm']),
|
||||
size: format.parseSize($tds.eq(3).text())
|
||||
};
|
||||
}));
|
||||
};
|
||||
|
||||
return function (data, callback) {
|
||||
|
||||
if (data.action === 'get' && data.l10n === true) {
|
||||
|
||||
var isoCodes = data.l10nCodes.split(':');
|
||||
var isoCode = data.l10nCodes.split(':')[0];
|
||||
loadJson(allsettings.h5aiAbsHref + 'conf/l10n/' + isoCode + '.json').done(function (json) {
|
||||
|
||||
var result = {code: 0, l10n: {}};
|
||||
|
||||
if (json) {
|
||||
result.l10n[isoCode] = json;
|
||||
}
|
||||
callback(result);
|
||||
});
|
||||
|
||||
} else if (data.action === 'get' && data.custom === true) {
|
||||
|
||||
$.when(
|
||||
loadText('_h5ai.header.html'),
|
||||
loadText('_h5ai.footer.html')
|
||||
).done(function (header, footer) {
|
||||
|
||||
callback({
|
||||
code: 0,
|
||||
custom: {
|
||||
header: header,
|
||||
footer: footer
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
} else if (data.action === 'get' && data.entries === true) {
|
||||
|
||||
var absHref = data.entriesHref,
|
||||
what = data.entriesWhat,
|
||||
magicSequence = '=h5ai=',
|
||||
reContentType = /^text\/html;h5ai=/;
|
||||
|
||||
$.ajax({
|
||||
url: absHref,
|
||||
type: what === 0 ? 'HEAD' : 'GET',
|
||||
complete: function (xhr) {
|
||||
|
||||
var entries = [],
|
||||
status = xhr.status;
|
||||
|
||||
if (status === 200 && reContentType.test(xhr.getResponseHeader('Content-Type'))) {
|
||||
status = magicSequence;
|
||||
}
|
||||
|
||||
if (status === magicSequence && what > 0) {
|
||||
entries = parse(absHref, xhr.responseText);
|
||||
}
|
||||
entries.push({absHref: absHref, status: status, content: what > 0});
|
||||
|
||||
callback({
|
||||
code: 0,
|
||||
entries: entries
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
callback();
|
||||
}
|
||||
};
|
||||
});
|
||||
|
@ -39,52 +39,13 @@
|
||||
|
||||
$(function () { modulejs.require('info'); });
|
||||
|
||||
} else if (mode === 'php') {
|
||||
} else {
|
||||
|
||||
$.getJSON('.', {action: 'get', options: true, types: true, langs: true, server: true}, function (config) {
|
||||
|
||||
modulejs.define('config', config);
|
||||
$(function () { modulejs.require('main'); });
|
||||
});
|
||||
|
||||
} else if (mode === 'aai') {
|
||||
|
||||
var src = $script.attr('src'),
|
||||
appHref = src.substr(0, src.length - filename.length),
|
||||
loadJson = function (href) {
|
||||
|
||||
var deferred = $.Deferred();
|
||||
|
||||
$.ajax(href, {dataType: 'text'}).always(function (content) {
|
||||
|
||||
var json = content.replace ? JSON.parse(content.replace(/\/\*[\s\S]*?\*\/|\/\/.*?(\n|$)/g, '')) : {};
|
||||
deferred.resolve(json);
|
||||
});
|
||||
|
||||
return deferred;
|
||||
};
|
||||
|
||||
$.when(
|
||||
loadJson(appHref + 'conf/options.json'),
|
||||
loadJson(appHref + 'conf/types.json'),
|
||||
loadJson(appHref + 'conf/langs.json')
|
||||
).done(function (options, types, langs) {
|
||||
|
||||
var config = {
|
||||
options: options,
|
||||
types: types,
|
||||
langs: langs,
|
||||
server: {
|
||||
backend: mode,
|
||||
api: false,
|
||||
name: 'apache',
|
||||
version: null
|
||||
}
|
||||
};
|
||||
|
||||
modulejs.define('config', config);
|
||||
$(function () { modulejs.require('main'); });
|
||||
});
|
||||
}
|
||||
|
||||
}());
|
||||
|
@ -1,23 +0,0 @@
|
||||
################################
|
||||
# {{pkg.name}} {{pkg.version}}
|
||||
# customized .htaccess
|
||||
################################
|
||||
|
||||
Options +Indexes
|
||||
Options +FollowSymLinks
|
||||
|
||||
HeaderName /_{{pkg.name}}/server/aai/header.html
|
||||
ReadmeName /_{{pkg.name}}/server/aai/footer.html
|
||||
|
||||
IndexIgnore _{{pkg.name}}*
|
||||
|
||||
IndexOptions Charset=UTF-8
|
||||
IndexOptions FancyIndexing
|
||||
IndexOptions FoldersFirst
|
||||
IndexOptions HTMLTable
|
||||
IndexOptions NameWidth=*
|
||||
IndexOptions SuppressDescription
|
||||
IndexOptions SuppressHTMLPreamble
|
||||
IndexOptions SuppressRules
|
||||
IndexOptions Type=text/html;{{pkg.name}}={{pkg.version}}
|
||||
IndexOptions XHTML
|
@ -1,3 +0,0 @@
|
||||
|
||||
// generated code ends here
|
||||
|</div></body></html>
|
@ -1,45 +0,0 @@
|
||||
|
||||
- var href = "/_{{pkg.name}}/"
|
||||
|
||||
doctype 5
|
||||
//if lt IE 9
|
||||
<html class="no-js oldie" lang="en">
|
||||
//[if gt IE 8]><!
|
||||
|<html class="no-js" lang="en">
|
||||
//<![endif]
|
||||
|
||||
head
|
||||
meta( charset="utf-8" )
|
||||
meta( http-equiv="X-UA-Compatible", content="IE=edge,chrome=1" )
|
||||
title index · styled with {{pkg.name}} {{pkg.version}} ({{pkg.url}})
|
||||
meta( name="description", content="index styled with {{pkg.name}} {{pkg.version}} ({{pkg.url}})" )
|
||||
meta( name="viewport", content="width=device-width" )
|
||||
link( rel="shortcut icon", href="#{href}client/images/app-16x16.ico" )
|
||||
link( rel="apple-touch-icon", type="image/png", href="#{href}client/images/app-48x48.png" )
|
||||
link( rel="stylesheet", href="//fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic,700italic|Ubuntu:400,700,400italic,700italic" )
|
||||
link( rel="stylesheet", href="#{href}client/css/styles.css" )
|
||||
script( src="#{href}client/js/scripts.js", data-mode="aai" )
|
||||
|
||||
|<body id="h5ai-main">
|
||||
|
||||
div#topbar.clearfix
|
||||
ul#navbar
|
||||
|
||||
div#content
|
||||
div#extended.clearfix
|
||||
|
||||
div#bottombar.clearfix
|
||||
span.left
|
||||
a#h5ai-reference( href="{{pkg.url}}", title="{{pkg.name}} · {{pkg.description}}" )
|
||||
| {{pkg.name}} {{pkg.version}}
|
||||
span.hideOnJs.noJsMsg
|
||||
| ⚡ JavaScript is disabled! ⚡
|
||||
span.oldBrowser
|
||||
| ⚡ Some features disabled! Works best in
|
||||
a( href="http://browsehappy.com" ) modern browsers
|
||||
| . ⚡
|
||||
span.right
|
||||
span.center
|
||||
|
||||
|<div id="data-apache-autoindex" class="hideOnJs">
|
||||
// The following code was generated by Apache's autoindex module.
|
Loading…
x
Reference in New Issue
Block a user