summaryrefslogtreecommitdiff
path: root/index.cgi
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2010-10-05 16:48:22 +0200
committerYorhel <git@yorhel.nl>2010-10-05 16:48:22 +0200
commitb124ecc13dd416a0e3b4fe3a7652c3ee1893dd50 (patch)
tree79f9445021592596e3587e4cd26018ea743d385f /index.cgi
parent5e9f6e92c8ac9715c8cfb7bc60e1ba49b141c2a8 (diff)
Some more formatting improvements
And put back the popular listing because I couldn't live without after all.
Diffstat (limited to 'index.cgi')
-rwxr-xr-xindex.cgi8
1 files changed, 6 insertions, 2 deletions
diff --git a/index.cgi b/index.cgi
index 2869865..096307c 100755
--- a/index.cgi
+++ b/index.cgi
@@ -165,9 +165,13 @@ sub unpaste {
sub form {
+ my $q = $db->prepare('SELECT syntax FROM pastes GROUP BY syntax ORDER BY count(*) DESC LIMIT 7');
+ $q->execute();
+ my @l = map qq|<a href="#" onclick="return setsyn(this)">$_->{syntax}</a>|, @{$q->fetchall_arrayref({})};
+
my @syn = map qq|<a href="#" onclick="return setsyn(this)">$_</a>|, @syntax;
use utf8;
- html(sprintf <<'__', join(' ', @syn));
+ html(sprintf <<'__', join(' ', @l), join(' ', @syn));
<form enctype="multipart/form-data" accept-charset="utf-8" method="post" action="/">
<table>
<tr><td colspan="2" class="header"><h1>Blicky.net nopaste</h1></tr>
@@ -182,7 +186,7 @@ sub form {
<legend>▾ Formatting</legend>
<input type="checkbox" id="w" name="w" value="1" /> <label for="w">allow line wrapping</label><br />
<input type="checkbox" id="c" name="c" value="1" checked="checked" /> <label for="c">make URLs clickable</label><br />
- <i>Syntax highlighting:</i> <input type="text" name="s" id="s" size="10" value="nosyntax" /> <i><a href="#" onclick="return showall()">Show options &raquo;</a></i>
+ <i>Syntax highlighting:</i> <input type="text" name="s" id="s" size="10" value="nosyntax" /> <i>Popular: <b class="syntax">%s</b> | <a href="#" onclick="return showall()">Show all &raquo;</a></i>
<div id="syntax" style="display: none">%s</div>
</fieldset>
</td></tr>