remove a ton of js
This commit is contained in:
parent
a3689f1a98
commit
f4e915e37c
|
@ -1,40 +1,34 @@
|
|||
<?php
|
||||
|
||||
$tags = file("../taglines.txt");
|
||||
$fonts = __DIR__."/fonts/";
|
||||
|
||||
if (isset($_GET["count"])) { // get number of taglines
|
||||
$tags = file("../taglines.txt");
|
||||
echo count($tags);
|
||||
}
|
||||
|
||||
elseif (isset($_GET["key"])) { // get specified tagline (with bounds checking)
|
||||
echo $tags[$_GET["key"] >= count($tags) ? array_rand($tags) : intval($_GET["key"])];
|
||||
$tags = file("../taglines.txt");
|
||||
$i = intval($_GET["key"]);
|
||||
echo $tags[$i >= count($tags) ? array_rand($tags) : $i];
|
||||
}
|
||||
|
||||
elseif (isset($_GET["fonts"])) { // get list of fonts
|
||||
$fonts = __DIR__."/fonts/";
|
||||
echo json_encode(array_map(function ($f) {
|
||||
return basename($f, ".flf");
|
||||
}, glob("$fonts*.flf")));
|
||||
}
|
||||
|
||||
elseif (isset($_GET["text"])) { // run figlet
|
||||
$fonts = __DIR__."/fonts/";
|
||||
echo shell_exec(
|
||||
"/usr/bin/figlet -d $fonts -w 120 -f " .
|
||||
escapeshellarg($_GET["font"] ?? "standard") . " " .
|
||||
"/usr/bin/figlet -d $fonts -w 80 -f " .
|
||||
escapeshellarg($_GET["font"] ?? "standard") . " -- " .
|
||||
escapeshellarg($_GET["text"])
|
||||
);
|
||||
}
|
||||
|
||||
elseif (isset($_GET["users"])) {
|
||||
$users = [];
|
||||
foreach (scandir("/home") as $user) {
|
||||
if (!is_dir("/home/$user/public_html")) continue;
|
||||
$users[] = $user;
|
||||
}
|
||||
// usort($users, function($a, $b) { return filemtime($a) - filemtime($b); } );
|
||||
echo json_encode($users);
|
||||
}
|
||||
|
||||
else { // get a random tagline
|
||||
$tags = file("../taglines.txt");
|
||||
echo $tags[array_rand($tags)];
|
||||
}
|
||||
|
||||
|
|
|
@ -72,12 +72,6 @@ weechat setup
|
|||
<li><a href="https://weechat.org/scripts/source/grep.py.html/">grep.py</a> - quickly search history and buffers with <code>/grep</code></li>
|
||||
</ul>
|
||||
|
||||
<h3>plugins</h3>
|
||||
|
||||
<p>plugins include the likes of <a href="https://github.com/wee-slack/wee-slack">weechat-slack</a> and the irc plugin.</p>
|
||||
|
||||
<p>unless you need slack support, you should be ok without additional plugins</p>
|
||||
|
||||
<h3>the rest of my configs</h3>
|
||||
|
||||
<p>you can find the rest of my configs <a href="https://tildegit.org/ben/dotfiles/src/branch/master/weechat/.weechat">here</a>.</p>
|
||||
|
|
|
@ -36,13 +36,6 @@ these scripts can be managed with the built in `/script` tool. press i, then ent
|
|||
* [grep.py](https://weechat.org/scripts/source/grep.py.html/) - quickly search history and buffers with `/grep`
|
||||
|
||||
|
||||
### plugins
|
||||
|
||||
plugins include the likes of [weechat-slack](https://github.com/wee-slack/wee-slack) and the irc plugin.
|
||||
|
||||
unless you need slack support, you should be ok without additional plugins
|
||||
|
||||
|
||||
### the rest of my configs
|
||||
|
||||
you can find the rest of my configs [here](https://tildegit.org/ben/dotfiles/src/branch/master/weechat/.weechat).
|
||||
|
|
62
index.php
62
index.php
|
@ -21,12 +21,6 @@
|
|||
|
||||
<link rel="stylesheet" href="https://tilde.team/~ben/gruvbox/gruvbox.css">
|
||||
<link rel="stylesheet" href="https://tilde.team/css/fork-awesome.css">
|
||||
|
||||
<style>
|
||||
[v-cloak] {
|
||||
display: none
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
@ -36,11 +30,8 @@
|
|||
<p><a href="https://tilde.team/"><- back to tilde team</a></p>
|
||||
</div>
|
||||
<h1>~ben</h1>
|
||||
<p v-cloak>{{ tagline }}
|
||||
<button @click="getnewtagline">
|
||||
<i class="fa fa-refresh"></i>
|
||||
</button>
|
||||
</p>
|
||||
<?php $taglines = file("taglines.txt"); ?>
|
||||
<p><?=$taglines[array_rand($taglines)]?></p>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
|
@ -58,48 +49,61 @@
|
|||
|
||||
<?php include "mypages.php"; ?>
|
||||
|
||||
<div v-cloak v-if="fonts.length > 0">
|
||||
<div>
|
||||
<hr>
|
||||
<strong>
|
||||
<h3>play with some ascii art</h3>
|
||||
</strong>
|
||||
<form>
|
||||
<div>
|
||||
<label for="font-selector">pick a font</label>
|
||||
<select v-model="font" id="font-selector" @change="updateOutput">
|
||||
<option v-for="font in fonts" :value="font">{{ font }}</option>
|
||||
<label for="font">pick a font</label>
|
||||
<select id="font">
|
||||
<?php $figfonts = array_map(function($f) { return basename($f, ".flf"); }, glob("api/fonts/*.flf"));
|
||||
foreach ($figfonts as $font): ?>
|
||||
<option<?=$font == "slant" ? ' selected="selected"' : ""?> value="<?=$font?>"><?=$font?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="asciiinput">type here</label>
|
||||
<input v-model="text" id="asciiinput" @input="updateOutput" placeholder="type here">
|
||||
<label for="input">type here</label>
|
||||
<input id="input" value="make ascii art">
|
||||
</div>
|
||||
|
||||
<div v-if="output">
|
||||
<pre>{{ output }}</pre>
|
||||
<div>
|
||||
<pre id="output"></pre>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<div v-cloak>
|
||||
<img :src="yesnoimg" :alt="yesno">
|
||||
<h3>should u do it</h3>
|
||||
<strong>{{ yesno }}</strong>
|
||||
</div>
|
||||
<button @click="getyesno">find out</button>
|
||||
|
||||
<h3>page hits as of jan 2020</h3>
|
||||
<script type="text/javascript" src="counter/gcount.php?page=index">
|
||||
|
||||
</main>
|
||||
|
||||
<script src="js/es6-promise.auto.min.js"></script>
|
||||
<script src="js/vue.js"></script>
|
||||
<script src="js/axios.min.js"></script>
|
||||
<script src="js/app.js"></script>
|
||||
<script>
|
||||
var font = document.getElementById("font");
|
||||
var input = document.getElementById("input");
|
||||
var output = document.getElementById("output");
|
||||
|
||||
font.addEventListener("change", figlet);
|
||||
input.addEventListener("input", figlet);
|
||||
|
||||
function figlet() {
|
||||
var xmlHttp = new XMLHttpRequest();
|
||||
xmlHttp.onreadystatechange = function() {
|
||||
if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
|
||||
output.innerHTML = xmlHttp.responseText;
|
||||
};
|
||||
xmlHttp.open("GET", `api/?font=${font.value}&text=${input.value}`, true);
|
||||
xmlHttp.send(null);
|
||||
}
|
||||
figlet();
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
|
|
44
js/app.js
44
js/app.js
|
@ -1,44 +0,0 @@
|
|||
var vm = new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
text: 'make ascii art',
|
||||
output: '',
|
||||
font: 'slant',
|
||||
fonts: [],
|
||||
yesno: '',
|
||||
yesnoimg: '',
|
||||
tagline: ''
|
||||
},
|
||||
created: function () {
|
||||
axios.get(
|
||||
'api/?fonts'
|
||||
).then(function (response) {
|
||||
vm.fonts = response.data
|
||||
})
|
||||
this.getnewtagline()
|
||||
this.updateOutput()
|
||||
},
|
||||
methods: {
|
||||
updateOutput: function () {
|
||||
axios.get(
|
||||
'api/?text=' + this.text + '&font=' + this.font
|
||||
).then(function (response) {
|
||||
vm.output = response.data
|
||||
})
|
||||
},
|
||||
getyesno: function () {
|
||||
axios.get(
|
||||
'https://yesno.wtf/api'
|
||||
).then(function (response) {
|
||||
response = response.data
|
||||
vm.yesno = response.answer
|
||||
vm.yesnoimg = response.image
|
||||
})
|
||||
},
|
||||
getnewtagline: function () {
|
||||
axios.get('api/').then(function (response) {
|
||||
vm.tagline = response.data
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue