soselo/index.php

110 lines
2.7 KiB
PHP

<?php require 'base.php' ?>
<!DOCTYPE html>
<html>
<head>
<title>Soselo - Panel</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="fonts/forkawesome/css/fork-awesome.min.css">
<script type="application/javascript" src="js/dayjs.min.js"></script>
<script type="application/javascript" src="js/relativeTime.js"></script>
<script type="application/javascript" src="js/updateLocale.js"></script>
</head>
<body>
<script>window.vars = [];</script>
<script>
window.consts = {
'instance_config': {
'mastodon': {
'musthave': ['instance_url','psql_host','psql_port','psql_db',
'psql_username','psql_password','redis_host','redis_port','api_authkey'],
},
}
};
window.view = {};
window.cache = {};
</script>
<script>
function apcontrol_title(str) {
document.title = `Soselo - ${str}`;
}
</script>
<?php require 'css/base.php' ?>
<main>
<?php foreach (scandir('./views') as $t): ?>
<?php if (!in_array($t,['.','..']) && substr($t, -4) === '.php'): ?>
<div id="window-<?php echo substr($t, 0, -4) ?>"
class="window hidden">
<?php require './views/'.$t ?>
</div>
<?php endif ?>
<?php endforeach ?>
</main>
<div id="toast-container"></div>
<?php require 'js/base.php' ?>
<script>
async function hashProcessor(initial) {
console.log(`EVENT hash-changed (no_fire_change: ${window.hash_argument_nofirechange})`);
if (window.hash_argument_nofirechange === true) {
delete window.hash_argument_nofirechange;
return;
}
var args = window.location.hash.substring(1).trim().split('/');
if (args.length > 0 && args[0].trim() === '')
args = [];
if (args.length === 0) {
window.location.hash = '#home';
return;
}
initial = initial || false;
const processArgs = function() {
if (document.getElementById('window-'+args[0]) !== null) {
if (window['load__'+args[0]] !== undefined) {
E.class.removeAll('.window', 'hidden');
E.class.addAll('.window', 'hidden');
document.getElementById('window-'+args[0]).classList.remove('hidden');
document.body.className = args[0];
window['load__'+args[0]](args);
}
if (window['title__'+args[0]] !== undefined)
window['title__'+args[0]]();
else apcontrol_title('Panel');
}
};
processArgs();
}
window.onhashchange = function(e) { hashProcessor() }
window.onload = function(e) {
dayjs.extend(window.dayjs_plugin_relativeTime);
dayjs.extend(window.dayjs_plugin_updateLocale);
dayjs.updateLocale('en', {
relativeTime: {
future: "in %s",
past: "%s ago",
s: '%d s',
m: "1 m",
mm: "%d m",
h: "1 h",
hh: "%d h",
d: "1 d",
dd: "%d d",
M: "1 M",
MM: "%s M",
y: "1 Y",
yy: "%s Y"
}
});
hashProcessor();
}
</script>
</body>
</html>