Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions css/zerobin.css
Original file line number Diff line number Diff line change
Expand Up @@ -365,4 +365,25 @@ pre a:hover {
color:#64B9C6;
}

/*
pre {
counter-reset: lines;
}

pre .line {
counter-increment: lines;
}

pre .line::before {
content: counter(lines); text-align: right;
display: inline-block; width: 2em;
padding-right: 0.5em; margin-right: 0.5em;
color: #BBB; border-right: solid 1px;
}
*/
pre ol {
list-style:decimal outside none;
}
pre ol li {
font-weight: normal; vertical-align:top;
}
12 changes: 11 additions & 1 deletion js/zerobin.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,13 @@ function applySyntaxColoring()
$('div#cleartext').css('padding','0'); // Remove white padding around code box.
}

function addLineNumbers() {
cleartext = $('div#cleartext > pre > code');
newtext = cleartext.html()
.replace( /(\r?\n)/g, "</li>$1<li class=\"line\">");
newtext = "<ol><li class=\"line\">" + newtext + "</li></ol>";
cleartext.html(newtext);
}

/**
* Show decrypted text in the display area, including discussion (if open)
Expand All @@ -203,7 +210,10 @@ function displayMessages(key, comments) {

// comments[0] is the paste itself.

if (comments[0].meta.syntaxcoloring) applySyntaxColoring();
if (comments[0].meta.syntaxcoloring) {
applySyntaxColoring();
addLineNumbers();
}

// Display paste expiration.
if (comments[0].meta.expire_date) $('div#remainingtime').removeClass('foryoureyesonly').text('This document will expire in '+secondsToHuman(comments[0].meta.remaining_time)+'.').show();
Expand Down