Merge ascii.php into Makai.
This commit is contained in:
parent
09399a411b
commit
e49c940032
5 changed files with 406 additions and 408 deletions
406
public/ascii.php
406
public/ascii.php
|
@ -1,406 +1,2 @@
|
|||
<?php
|
||||
$table = [
|
||||
// Control characters
|
||||
['Null character', 'NUL'],
|
||||
['Start of heading', 'SOH'],
|
||||
['Start of text', 'STX'],
|
||||
['End of text', 'ETX'],
|
||||
['End of transmission', 'EOT'],
|
||||
['Enquiry', 'ENQ'],
|
||||
['Acknowledgement', 'ACK'],
|
||||
['Bell', 'BEL'],
|
||||
['Backspace', 'BS' ],
|
||||
['Horizontal tab', 'HT' ],
|
||||
['Line feed', 'LF' ],
|
||||
['Vertical tab', 'VT' ],
|
||||
['Form feed', 'FF' ],
|
||||
['Carriage return', 'CR' ],
|
||||
['Shift out/X-On', 'SO' ],
|
||||
['Shift in/X-Off', 'SI' ],
|
||||
['Delta line escape', 'DLE'],
|
||||
['Device control 1 (often XON)', 'DC1'],
|
||||
['Device control 2', 'DC2'],
|
||||
['Device control 3 (often XOFF)', 'DC3'],
|
||||
['Device control 4', 'DC4'],
|
||||
['Negative acknowledgement', 'NAK'],
|
||||
['Synchronous idle', 'SYN'],
|
||||
['End of transmit block', 'ETB'],
|
||||
['Cancel', 'CAN'],
|
||||
['End of medium', 'EM' ],
|
||||
['Substitute', 'SUB'],
|
||||
['Escape', 'ESC'],
|
||||
['File separator', 'FS' ],
|
||||
['Group separator', 'GS' ],
|
||||
['Record separator', 'RS' ],
|
||||
['Unit separator', 'US' ],
|
||||
|
||||
// Printable characters
|
||||
['Space'],
|
||||
['Excalamation mark'],
|
||||
['Double quotes', 'quot'],
|
||||
['Hash'],
|
||||
['Dollar'],
|
||||
['Percent'],
|
||||
['Ampersand', 'amp'],
|
||||
['Single quote'],
|
||||
['Open parenthesis'],
|
||||
['Close parenthesis'],
|
||||
['Asterisk'],
|
||||
['Plus'],
|
||||
['Comma'],
|
||||
['Hyphen'],
|
||||
['Period'],
|
||||
['Slash'],
|
||||
['Zero'],
|
||||
['One'],
|
||||
['Two'],
|
||||
['Three'],
|
||||
['Four'],
|
||||
['Five'],
|
||||
['Six'],
|
||||
['Seven'],
|
||||
['Eight'],
|
||||
['Nine'],
|
||||
['Colon'],
|
||||
['Semicolon'],
|
||||
['Less than', 'lt'],
|
||||
['Equals'],
|
||||
['Greater than', 'gt'],
|
||||
['Question mark'],
|
||||
['At symbol'],
|
||||
['Uppercase A'],
|
||||
['Uppercase B'],
|
||||
['Uppercase C'],
|
||||
['Uppercase D'],
|
||||
['Uppercase E'],
|
||||
['Uppercase F'],
|
||||
['Uppercase G'],
|
||||
['Uppercase H'],
|
||||
['Uppercase I'],
|
||||
['Uppercase J'],
|
||||
['Uppercase K'],
|
||||
['Uppercase L'],
|
||||
['Uppercase M'],
|
||||
['Uppercase N'],
|
||||
['Uppercase O'],
|
||||
['Uppercase P'],
|
||||
['Uppercase Q'],
|
||||
['Uppercase R'],
|
||||
['Uppercase S'],
|
||||
['Uppercase T'],
|
||||
['Uppercase U'],
|
||||
['Uppercase V'],
|
||||
['Uppercase W'],
|
||||
['Uppercase X'],
|
||||
['Uppercase Y'],
|
||||
['Uppercase Z'],
|
||||
['Opening bracket'],
|
||||
['Backslash'],
|
||||
['Closing bracket'],
|
||||
['Caret'],
|
||||
['Underscore'],
|
||||
['Accent grave'],
|
||||
['Lowercase a'],
|
||||
['Lowercase b'],
|
||||
['Lowercase c'],
|
||||
['Lowercase d'],
|
||||
['Lowercase e'],
|
||||
['Lowercase f'],
|
||||
['Lowercase g'],
|
||||
['Lowercase h'],
|
||||
['Lowercase i'],
|
||||
['Lowercase j'],
|
||||
['Lowercase k'],
|
||||
['Lowercase l'],
|
||||
['Lowercase m'],
|
||||
['Lowercase n'],
|
||||
['Lowercase o'],
|
||||
['Lowercase p'],
|
||||
['Lowercase q'],
|
||||
['Lowercase r'],
|
||||
['Lowercase s'],
|
||||
['Lowercase t'],
|
||||
['Lowercase u'],
|
||||
['Lowercase v'],
|
||||
['Lowercase w'],
|
||||
['Lowercase x'],
|
||||
['Lowercase y'],
|
||||
['Lowercase z'],
|
||||
['Opening curly brace'],
|
||||
['Vertical bar'],
|
||||
['Closing curly brace'],
|
||||
['Tilde'],
|
||||
|
||||
// Delete
|
||||
['Delete', 'DEL'],
|
||||
];
|
||||
?>
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>US-ASCII Table</title>
|
||||
<style type="text/css">
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
outline-style: none !important;
|
||||
}
|
||||
html, body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
body {
|
||||
font: 12px/20px Tahoma, Geneva, 'Dejavu Sans', Arial, Helvetica, sans-serif;
|
||||
background-color: #ddd;
|
||||
color: #000;
|
||||
}
|
||||
pre, code {
|
||||
font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;
|
||||
}
|
||||
.wrap {
|
||||
margin-bottom: calc(100vh - 70px);
|
||||
}
|
||||
.hidden {
|
||||
display: none !important;
|
||||
visibility: hidden !important;
|
||||
}
|
||||
.invisible {
|
||||
opacity: 0;
|
||||
}
|
||||
.chars {
|
||||
text-align: center;
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.char {
|
||||
display: inline-flex;
|
||||
flex-direction: column;
|
||||
border: 2px solid #000;
|
||||
border-radius: 5px;
|
||||
overflow: hidden;
|
||||
width: 200px;
|
||||
text-align: left;
|
||||
margin: 2px;
|
||||
background-color: #eee;
|
||||
cursor: pointer !important;
|
||||
transition: background-color .1s;
|
||||
}
|
||||
.char:hover,
|
||||
.char:focus {
|
||||
background-color: #fff;
|
||||
}
|
||||
.char:active {
|
||||
background-color: #ddd;
|
||||
}
|
||||
.char-print {
|
||||
white-space: pre;
|
||||
font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;
|
||||
font-size: 2.5em;
|
||||
text-align: center;
|
||||
padding: 10px;
|
||||
pointer-events: none;
|
||||
}
|
||||
.char-desc {
|
||||
text-align: center;
|
||||
font-size: 1.2em;
|
||||
padding: 0 5px 5px;
|
||||
pointer-events: none;
|
||||
}
|
||||
.char-misc {
|
||||
display: flex;
|
||||
justify-content: space-evenly;
|
||||
border-top: 1px solid #111;
|
||||
}
|
||||
.char-misc-item {
|
||||
flex: 1 1 auto;
|
||||
padding: 2px 5px;
|
||||
transition: background-color .1s;
|
||||
background-color: #eee;
|
||||
}
|
||||
.char-misc-item:not(:last-child) {
|
||||
border-right: 1px solid #111;
|
||||
}
|
||||
.char-misc-item:hover,
|
||||
.char-misc-item:focus {
|
||||
background-color: #fff;
|
||||
}
|
||||
.char-misc-item:active {
|
||||
background-color: #ddd;
|
||||
}
|
||||
.char-misc-item-head {
|
||||
font-variant: small-caps;
|
||||
}
|
||||
.char-misc-item-value {
|
||||
font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;
|
||||
text-align: right;
|
||||
}
|
||||
.search {
|
||||
margin: 0 auto;
|
||||
padding-top: 10px;
|
||||
max-width: 1200px;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1000;
|
||||
background-image: linear-gradient(180deg, #ddd 51px, transparent);
|
||||
}
|
||||
.search-box {
|
||||
border: 1px solid #000;
|
||||
border-radius: 5px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.search-box input {
|
||||
border-width: 0;
|
||||
background-color: #fff;
|
||||
color: #000;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font-size: 2em;
|
||||
padding: 5px;
|
||||
}
|
||||
.search-hint {
|
||||
font-size: .9em;
|
||||
padding: 0 5px;
|
||||
transition: opacity .2s;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrap">
|
||||
<div class="search">
|
||||
<div class="search-box">
|
||||
<input type="search" id="search" placeholder="Filter..." autocomplete="off"/>
|
||||
</div>
|
||||
<div class="search-hint js-invisible-on-scroll">
|
||||
Type <em><code>printable</code></em> for all printable characters, or <em><code>control</code></em> for all control characters.
|
||||
</div>
|
||||
</div>
|
||||
<div class="chars"><?php
|
||||
foreach($table as $code => $info):
|
||||
$isPrintable = ($code > 31 && $code < 127);
|
||||
$print = $isPrintable ? chr($code) : $info[1];
|
||||
$attrs = ['data-key-code' => $code, 'data-key-desc' => $info[0], 'data-key-print' => $print, 'data-copy' => $print];
|
||||
$attrStr = '';
|
||||
|
||||
if($isPrintable && isset($info[1]))
|
||||
$attrs['data-key-html'] = $info[1];
|
||||
|
||||
foreach($attrs as $name => $value)
|
||||
$attrStr .= $name . '="' . htmlentities($value) . '" ';
|
||||
?><div class="char" <?=trim($attrStr);?>>
|
||||
<div class="char-print"><?=$print;?></div>
|
||||
<div class="char-desc"><?=$info[0];?></div>
|
||||
<div class="char-misc">
|
||||
<div class="char-misc-item" data-copy="<?=$code;?>">
|
||||
<div class="char-misc-item-head">Decimal</div>
|
||||
<div class="char-misc-item-value"><?=$code;?></div>
|
||||
</div>
|
||||
<div class="char-misc-item" data-copy="<?=decoct($code);?>">
|
||||
<div class="char-misc-item-head">Octal</div>
|
||||
<div class="char-misc-item-value"><?=decoct($code);?></div>
|
||||
</div>
|
||||
<div class="char-misc-item" data-copy="<?=dechex($code);?>">
|
||||
<div class="char-misc-item-head">Hex</div>
|
||||
<div class="char-misc-item-value"><?=dechex($code);?></div>
|
||||
</div>
|
||||
<?php if(isset($attrs['data-key-html'])): ?>
|
||||
<div class="char-misc-item" data-copy="&<?=$attrs['data-key-html'];?>;">
|
||||
<div class="char-misc-item-head">HTML</div>
|
||||
<div class="char-misc-item-value">&<?=$attrs['data-key-html'];?>;</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div><?php endforeach; ?></div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var chars = document.getElementsByClassName('char'),
|
||||
search = document.getElementById('search');
|
||||
|
||||
function charsFilter(filter) {
|
||||
if(!filter) {
|
||||
for(var i = 0; i < chars.length; ++i)
|
||||
chars[i].classList.remove('hidden');
|
||||
return;
|
||||
}
|
||||
|
||||
filter = filter.toLowerCase();
|
||||
|
||||
for(var i = 0; i < chars.length; ++i) {
|
||||
var chr = chars[i],
|
||||
code = (chr.dataset.keyCode || 0).toString().toLowerCase(),
|
||||
print = (chr.dataset.keyPrint || "\0").toString().toLowerCase(),
|
||||
desc = (chr.dataset.keyDesc || '').toString().toLowerCase(),
|
||||
html = (chr.dataset.keyHtml || "\0").toString().toLowerCase(),
|
||||
codeInt = parseInt(code),
|
||||
isMatch = (filter === 'printable' && (codeInt > 31 && codeInt < 127))
|
||||
|| (filter === 'control' && (codeInt < 32 || codeInt === 127))
|
||||
|| code == filter || print == filter
|
||||
|| html == filter || desc.indexOf(filter) >= 0;
|
||||
chr.classList[isMatch ? 'remove' : 'add']('hidden');
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener('scroll', function() {
|
||||
var hidden = document.getElementsByClassName('js-hidden-on-scroll'),
|
||||
invisible = document.getElementsByClassName('js-invisible-on-scroll'),
|
||||
atTop = window.scrollY === 0;
|
||||
|
||||
for(var i = 0; i < hidden.length; ++i)
|
||||
hidden[i].classList[atTop ? 'remove' : 'add']('hidden');
|
||||
for(var i = 0; i < invisible.length; ++i)
|
||||
invisible[i].classList[atTop ? 'remove' : 'add']('invisible');
|
||||
});
|
||||
search.addEventListener('keyup', function() {
|
||||
location.hash = search.value.trim();
|
||||
});
|
||||
window.addEventListener('hashchange', function() {
|
||||
charsFilter(decodeURIComponent((location.hash || '#').substring(1)));
|
||||
});
|
||||
if(location.hash.length > 0) {
|
||||
search.value = location.hash.substring(1).trim();
|
||||
charsFilter(search.value);
|
||||
}
|
||||
|
||||
for(var i = 0; i < chars.length; ++i) {
|
||||
chars[i].addEventListener('click', function(ev) {
|
||||
var target = ev.target;
|
||||
|
||||
while(target !== null && typeof target.dataset.copy === 'undefined') {
|
||||
target = target.parentNode || null;
|
||||
|
||||
if(target.classList.contains('char'))
|
||||
break;
|
||||
}
|
||||
|
||||
if(target === null || typeof target.dataset.copy === 'undefined')
|
||||
return;
|
||||
|
||||
// Clipboard interactions are fucking horrendous
|
||||
/*if(document.execCommand) {
|
||||
/*var clipfriend = document.createElement('input');
|
||||
clipfriend.type = 'text';
|
||||
clipfriend.value = target.dataset.copy;
|
||||
clipfriend.className = 'hidden';
|
||||
document.body.appendChild(clipfriend);
|
||||
clipfriend.select();
|
||||
clipfriend.setSelectionRange(0, clipfriend.value.length);
|
||||
document.execCommand('copy');
|
||||
document.body.removeChild(clipfriend);
|
||||
} else {*/
|
||||
var doCopy = function() { navigator.clipboard.writeText(target.dataset.copy); };
|
||||
|
||||
if(typeof window.mozInnerScreenX !== 'undefined')
|
||||
doCopy();
|
||||
else
|
||||
navigator.permissions.query({name: 'clipboard-write'}).then(function(res) {
|
||||
if(res.state === 'granted' || res.state === 'prompt')
|
||||
doCopy();
|
||||
});
|
||||
//}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
require_once __DIR__ . '/index.php';
|
||||
|
|
|
@ -15,8 +15,16 @@ html {
|
|||
scrollbar-color: #4a3650 #111;
|
||||
}
|
||||
|
||||
pre, code {
|
||||
font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none !important;
|
||||
visibility: hidden !important;
|
||||
}
|
||||
.invisible {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
/* an attempt to replicate scrollbar-color for chromosome */
|
||||
|
@ -51,6 +59,9 @@ body {
|
|||
overflow: hidden;
|
||||
transition: height .5s;
|
||||
}
|
||||
.header-minimal .header {
|
||||
height: auto;
|
||||
}
|
||||
@media (max-width: 700px) {
|
||||
.header { height: auto; }
|
||||
}
|
||||
|
@ -90,6 +101,9 @@ body {
|
|||
align-items: flex-end;
|
||||
padding: 10px;
|
||||
}
|
||||
.header-minimal .header-foreground {
|
||||
align-items: center;
|
||||
}
|
||||
@media (max-width: 700px) {
|
||||
.header-foreground {
|
||||
justify-content: center;
|
||||
|
@ -135,6 +149,9 @@ body {
|
|||
flex: 0 0 auto;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.header-minimal .header-menu {
|
||||
margin-top: 0;
|
||||
}
|
||||
.index .header-menu,
|
||||
.fullscreen-header .header-menu,
|
||||
.now-playing .header-menu {
|
||||
|
@ -1003,3 +1020,104 @@ body {
|
|||
.ob-blog .ob-continue:active {
|
||||
background-color: #191919;
|
||||
}
|
||||
|
||||
.ascii-wrap {
|
||||
margin-bottom: calc(100vh - 70px);
|
||||
}
|
||||
.ascii-chars {
|
||||
text-align: center;
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.ascii-char {
|
||||
display: inline-flex;
|
||||
flex-direction: column;
|
||||
border: 2px solid #4a3650;
|
||||
border-radius: 5px;
|
||||
overflow: hidden;
|
||||
width: 200px;
|
||||
text-align: left;
|
||||
margin: 2px;
|
||||
background-color: #333;
|
||||
cursor: pointer !important;
|
||||
transition: background-color .1s;
|
||||
}
|
||||
.ascii-char:hover,
|
||||
.ascii-char:focus {
|
||||
background-color: #444;
|
||||
}
|
||||
.ascii-char:active {
|
||||
background-color: #222;
|
||||
}
|
||||
.ascii-char-print {
|
||||
white-space: pre;
|
||||
font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;
|
||||
font-size: 2.5em;
|
||||
text-align: center;
|
||||
padding: 10px;
|
||||
pointer-events: none;
|
||||
}
|
||||
.ascii-char-desc {
|
||||
text-align: center;
|
||||
font-size: 1.2em;
|
||||
padding: 0 5px 5px;
|
||||
pointer-events: none;
|
||||
}
|
||||
.ascii-char-misc {
|
||||
display: flex;
|
||||
justify-content: space-evenly;
|
||||
border-top: 1px solid #4a3650;
|
||||
}
|
||||
.ascii-char-misc-item {
|
||||
flex: 1 1 auto;
|
||||
padding: 2px 5px;
|
||||
transition: background-color .1s;
|
||||
background-color: #444;
|
||||
}
|
||||
.ascii-char-misc-item:not(:last-child) {
|
||||
border-right: 1px solid #4a3650;
|
||||
}
|
||||
.ascii-char-misc-item:hover,
|
||||
.ascii-char-misc-item:focus {
|
||||
background-color: #666;
|
||||
}
|
||||
.ascii-char-misc-item:active {
|
||||
background-color: #555;
|
||||
}
|
||||
.ascii-char-misc-item-head {
|
||||
font-variant: small-caps;
|
||||
}
|
||||
.ascii-char-misc-item-value {
|
||||
font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;
|
||||
text-align: right;
|
||||
}
|
||||
.ascii-search {
|
||||
padding-top: 10px;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1000;
|
||||
background-image: linear-gradient(180deg, #4a3650 51px, transparent);
|
||||
}
|
||||
.ascii-search-box {
|
||||
border: 1px solid #000;
|
||||
border-radius: 5px;
|
||||
overflow: hidden;
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.ascii-search-box input {
|
||||
border-width: 0;
|
||||
background-color: #111;
|
||||
color: #fff;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font-size: 2em;
|
||||
padding: 5px;
|
||||
}
|
||||
.ascii-search-hint {
|
||||
font-size: .9em;
|
||||
padding: 0 5px;
|
||||
transition: opacity .2s;
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ define('MKI_REDIRS', [
|
|||
'/contact.html' => '/contact',
|
||||
'/nintendo' => '/contact',
|
||||
'/nintendo.php' => '/contact',
|
||||
'/ascii.php' => '/ascii',
|
||||
]);
|
||||
|
||||
$router = new HttpFx;
|
||||
|
@ -174,6 +175,10 @@ $router->get('/projects', function() use ($ctx) {
|
|||
]);
|
||||
});
|
||||
|
||||
$router->get('/ascii', function() use ($ctx) {
|
||||
return $ctx->getTemplating()->render('ascii');
|
||||
});
|
||||
|
||||
$router->get('/ssh.php', function() {
|
||||
$query = '';
|
||||
|
||||
|
|
279
tpl/ascii.php
Normal file
279
tpl/ascii.php
Normal file
|
@ -0,0 +1,279 @@
|
|||
<?php
|
||||
$self->extends('home/master');
|
||||
|
||||
$self->header_title = 'flash.moe / ascii table';
|
||||
$self->header_minimal = true;
|
||||
|
||||
$self->block('container', function($self) {
|
||||
$table = [
|
||||
// Control characters
|
||||
['Null character', 'NUL'],
|
||||
['Start of heading', 'SOH'],
|
||||
['Start of text', 'STX'],
|
||||
['End of text', 'ETX'],
|
||||
['End of transmission', 'EOT'],
|
||||
['Enquiry', 'ENQ'],
|
||||
['Acknowledgement', 'ACK'],
|
||||
['Bell', 'BEL'],
|
||||
['Backspace', 'BS' ],
|
||||
['Horizontal tab', 'HT' ],
|
||||
['Line feed', 'LF' ],
|
||||
['Vertical tab', 'VT' ],
|
||||
['Form feed', 'FF' ],
|
||||
['Carriage return', 'CR' ],
|
||||
['Shift out/X-On', 'SO' ],
|
||||
['Shift in/X-Off', 'SI' ],
|
||||
['Delta line escape', 'DLE'],
|
||||
['Device control 1 (often XON)', 'DC1'],
|
||||
['Device control 2', 'DC2'],
|
||||
['Device control 3 (often XOFF)', 'DC3'],
|
||||
['Device control 4', 'DC4'],
|
||||
['Negative acknowledgement', 'NAK'],
|
||||
['Synchronous idle', 'SYN'],
|
||||
['End of transmit block', 'ETB'],
|
||||
['Cancel', 'CAN'],
|
||||
['End of medium', 'EM' ],
|
||||
['Substitute', 'SUB'],
|
||||
['Escape', 'ESC'],
|
||||
['File separator', 'FS' ],
|
||||
['Group separator', 'GS' ],
|
||||
['Record separator', 'RS' ],
|
||||
['Unit separator', 'US' ],
|
||||
|
||||
// Printable characters
|
||||
['Space'],
|
||||
['Excalamation mark'],
|
||||
['Double quotes', 'quot'],
|
||||
['Hash'],
|
||||
['Dollar'],
|
||||
['Percent'],
|
||||
['Ampersand', 'amp'],
|
||||
['Single quote'],
|
||||
['Open parenthesis'],
|
||||
['Close parenthesis'],
|
||||
['Asterisk'],
|
||||
['Plus'],
|
||||
['Comma'],
|
||||
['Hyphen'],
|
||||
['Period'],
|
||||
['Slash'],
|
||||
['Zero'],
|
||||
['One'],
|
||||
['Two'],
|
||||
['Three'],
|
||||
['Four'],
|
||||
['Five'],
|
||||
['Six'],
|
||||
['Seven'],
|
||||
['Eight'],
|
||||
['Nine'],
|
||||
['Colon'],
|
||||
['Semicolon'],
|
||||
['Less than', 'lt'],
|
||||
['Equals'],
|
||||
['Greater than', 'gt'],
|
||||
['Question mark'],
|
||||
['At symbol'],
|
||||
['Uppercase A'],
|
||||
['Uppercase B'],
|
||||
['Uppercase C'],
|
||||
['Uppercase D'],
|
||||
['Uppercase E'],
|
||||
['Uppercase F'],
|
||||
['Uppercase G'],
|
||||
['Uppercase H'],
|
||||
['Uppercase I'],
|
||||
['Uppercase J'],
|
||||
['Uppercase K'],
|
||||
['Uppercase L'],
|
||||
['Uppercase M'],
|
||||
['Uppercase N'],
|
||||
['Uppercase O'],
|
||||
['Uppercase P'],
|
||||
['Uppercase Q'],
|
||||
['Uppercase R'],
|
||||
['Uppercase S'],
|
||||
['Uppercase T'],
|
||||
['Uppercase U'],
|
||||
['Uppercase V'],
|
||||
['Uppercase W'],
|
||||
['Uppercase X'],
|
||||
['Uppercase Y'],
|
||||
['Uppercase Z'],
|
||||
['Opening bracket'],
|
||||
['Backslash'],
|
||||
['Closing bracket'],
|
||||
['Caret'],
|
||||
['Underscore'],
|
||||
['Accent grave'],
|
||||
['Lowercase a'],
|
||||
['Lowercase b'],
|
||||
['Lowercase c'],
|
||||
['Lowercase d'],
|
||||
['Lowercase e'],
|
||||
['Lowercase f'],
|
||||
['Lowercase g'],
|
||||
['Lowercase h'],
|
||||
['Lowercase i'],
|
||||
['Lowercase j'],
|
||||
['Lowercase k'],
|
||||
['Lowercase l'],
|
||||
['Lowercase m'],
|
||||
['Lowercase n'],
|
||||
['Lowercase o'],
|
||||
['Lowercase p'],
|
||||
['Lowercase q'],
|
||||
['Lowercase r'],
|
||||
['Lowercase s'],
|
||||
['Lowercase t'],
|
||||
['Lowercase u'],
|
||||
['Lowercase v'],
|
||||
['Lowercase w'],
|
||||
['Lowercase x'],
|
||||
['Lowercase y'],
|
||||
['Lowercase z'],
|
||||
['Opening curly brace'],
|
||||
['Vertical bar'],
|
||||
['Closing curly brace'],
|
||||
['Tilde'],
|
||||
|
||||
// Delete
|
||||
['Delete', 'DEL'],
|
||||
];
|
||||
?>
|
||||
<div class="ascii-wrap">
|
||||
<div class="ascii-search">
|
||||
<div class="ascii-search-box">
|
||||
<input type="search" id="search" placeholder="Filter..." autocomplete="off"/>
|
||||
</div>
|
||||
<div class="ascii-search-hint js-invisible-on-scroll">
|
||||
Type <em><code>printable</code></em> for all printable characters, or <em><code>control</code></em> for all control characters.
|
||||
</div>
|
||||
</div>
|
||||
<div class="ascii-chars"><?php
|
||||
foreach($table as $code => $info):
|
||||
$isPrintable = ($code > 31 && $code < 127);
|
||||
$print = $isPrintable ? chr($code) : $info[1];
|
||||
$attrs = ['data-key-code' => $code, 'data-key-desc' => $info[0], 'data-key-print' => $print, 'data-copy' => $print];
|
||||
$attrStr = '';
|
||||
|
||||
if($isPrintable && isset($info[1]))
|
||||
$attrs['data-key-html'] = $info[1];
|
||||
|
||||
foreach($attrs as $name => $value)
|
||||
$attrStr .= $name . '="' . htmlentities($value) . '" ';
|
||||
?><div class="ascii-char" <?=trim($attrStr);?>>
|
||||
<div class="ascii-char-print"><?=$print;?></div>
|
||||
<div class="ascii-char-desc"><?=$info[0];?></div>
|
||||
<div class="ascii-char-misc">
|
||||
<div class="ascii-char-misc-item" data-copy="<?=$code;?>">
|
||||
<div class="ascii-char-misc-item-head">Decimal</div>
|
||||
<div class="ascii-char-misc-item-value"><?=$code;?></div>
|
||||
</div>
|
||||
<div class="ascii-char-misc-item" data-copy="<?=decoct($code);?>">
|
||||
<div class="ascii-char-misc-item-head">Octal</div>
|
||||
<div class="ascii-char-misc-item-value"><?=decoct($code);?></div>
|
||||
</div>
|
||||
<div class="ascii-char-misc-item" data-copy="<?=dechex($code);?>">
|
||||
<div class="ascii-char-misc-item-head">Hex</div>
|
||||
<div class="ascii-char-misc-item-value"><?=dechex($code);?></div>
|
||||
</div>
|
||||
<?php if(isset($attrs['data-key-html'])): ?>
|
||||
<div class="ascii-char-misc-item" data-copy="&<?=$attrs['data-key-html'];?>;">
|
||||
<div class="ascii-char-misc-item-head">HTML</div>
|
||||
<div class="ascii-char-misc-item-value">&<?=$attrs['data-key-html'];?>;</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div><?php endforeach; ?></div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var chars = document.getElementsByClassName('ascii-char'),
|
||||
search = document.getElementById('search');
|
||||
|
||||
function charsFilter(filter) {
|
||||
if(!filter) {
|
||||
for(var i = 0; i < chars.length; ++i)
|
||||
chars[i].classList.remove('hidden');
|
||||
return;
|
||||
}
|
||||
|
||||
filter = filter.toLowerCase();
|
||||
|
||||
for(var i = 0; i < chars.length; ++i) {
|
||||
var chr = chars[i],
|
||||
code = (chr.dataset.keyCode || 0).toString().toLowerCase(),
|
||||
print = (chr.dataset.keyPrint || "\0").toString().toLowerCase(),
|
||||
desc = (chr.dataset.keyDesc || '').toString().toLowerCase(),
|
||||
html = (chr.dataset.keyHtml || "\0").toString().toLowerCase(),
|
||||
codeInt = parseInt(code),
|
||||
isMatch = (filter === 'printable' && (codeInt > 31 && codeInt < 127))
|
||||
|| (filter === 'control' && (codeInt < 32 || codeInt === 127))
|
||||
|| code == filter || print == filter
|
||||
|| html == filter || desc.indexOf(filter) >= 0;
|
||||
chr.classList[isMatch ? 'remove' : 'add']('hidden');
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener('scroll', function() {
|
||||
var hidden = document.getElementsByClassName('js-hidden-on-scroll'),
|
||||
invisible = document.getElementsByClassName('js-invisible-on-scroll'),
|
||||
atTop = window.scrollY === 0;
|
||||
|
||||
for(var i = 0; i < hidden.length; ++i)
|
||||
hidden[i].classList[atTop ? 'remove' : 'add']('hidden');
|
||||
for(var i = 0; i < invisible.length; ++i)
|
||||
invisible[i].classList[atTop ? 'remove' : 'add']('invisible');
|
||||
});
|
||||
search.addEventListener('keyup', function() {
|
||||
location.hash = search.value.trim();
|
||||
});
|
||||
window.addEventListener('hashchange', function() {
|
||||
charsFilter(decodeURIComponent((location.hash || '#').substring(1)));
|
||||
});
|
||||
if(location.hash.length > 0) {
|
||||
search.value = location.hash.substring(1).trim();
|
||||
charsFilter(search.value);
|
||||
}
|
||||
|
||||
for(var i = 0; i < chars.length; ++i) {
|
||||
chars[i].addEventListener('click', function(ev) {
|
||||
var target = ev.target;
|
||||
|
||||
while(target !== null && typeof target.dataset.copy === 'undefined') {
|
||||
target = target.parentNode || null;
|
||||
|
||||
if(target.classList.contains('char'))
|
||||
break;
|
||||
}
|
||||
|
||||
if(target === null || typeof target.dataset.copy === 'undefined')
|
||||
return;
|
||||
|
||||
// Clipboard interactions are fucking horrendous
|
||||
/*if(document.execCommand) {
|
||||
/*var clipfriend = document.createElement('input');
|
||||
clipfriend.type = 'text';
|
||||
clipfriend.value = target.dataset.copy;
|
||||
clipfriend.className = 'hidden';
|
||||
document.body.appendChild(clipfriend);
|
||||
clipfriend.select();
|
||||
clipfriend.setSelectionRange(0, clipfriend.value.length);
|
||||
document.execCommand('copy');
|
||||
document.body.removeChild(clipfriend);
|
||||
} else {*/
|
||||
var doCopy = function() { navigator.clipboard.writeText(target.dataset.copy); };
|
||||
|
||||
if(typeof window.mozInnerScreenX !== 'undefined')
|
||||
doCopy();
|
||||
else
|
||||
navigator.permissions.query({name: 'clipboard-write'}).then(function(res) {
|
||||
if(res.state === 'granted' || res.state === 'prompt')
|
||||
doCopy();
|
||||
});
|
||||
//}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
});
|
|
@ -8,15 +8,15 @@
|
|||
<link href="/assets/sprite.css" type="text/css" rel="stylesheet"/>
|
||||
<link href="/assets/fonts/electrolize/style.css" type="text/css" rel="stylesheet"/>
|
||||
</head>
|
||||
<body class="<?php if(isset($self->header_is_index)) { echo 'index ';} if(isset($self->header_full)) { echo 'fullscreen-header ';} if(isset($self->header_now_playing)) { echo 'now-playing ';} ?>">
|
||||
<body class="<?php if(isset($self->header_is_index)) { echo 'index ';} if(isset($self->header_full)) { echo 'fullscreen-header ';} if(isset($self->header_now_playing)) { echo 'now-playing ';} if(isset($self->header_minimal)) { echo 'header-minimal ';} ?>">
|
||||
<div class="header">
|
||||
<div class="header-background">
|
||||
<img src="<?=($self->header_bgs[array_rand($self->header_bgs)]);?>" alt=""/>
|
||||
</div>
|
||||
<div class="header-foreground"<?php if(isset($self->header_offset) && $self->header_offset > 0) echo " style=\"padding-bottom: {$self->header_offset}px\""; ?>>
|
||||
<a class="header-logo" href="/">
|
||||
<div class="header-flash">flash</div>
|
||||
<div class="header-wave">wave</div>
|
||||
<div class="header-flash"><?=($self->header_logo_flash ?? 'flash');?></div>
|
||||
<div class="header-wave"><?=($self->header_logo_wave ?? 'wave');?></div>
|
||||
</a>
|
||||
<div class="header-right">
|
||||
<div class="header-now-playing header-now-playing-hidden">
|
||||
|
|
Loading…
Reference in a new issue