summaryrefslogtreecommitdiff
path: root/js/inline.js
diff options
context:
space:
mode:
authorJames Campos <james.r.campos@gmail.com>2014-09-23 19:52:06 -0700
committerczaks <marcin@6irc.net>2014-10-07 03:27:33 +0200
commitcb92ee048303a6d9065c2e7b9dd4f9532152db34 (patch)
tree7258f04771fd46557648adc03545ae4f4ffa256c /js/inline.js
parent93b30d682906a2d0aa6b3bbaaefdbb1aea192f00 (diff)
inline
Diffstat (limited to 'js/inline.js')
-rw-r--r--js/inline.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/js/inline.js b/js/inline.js
new file mode 100644
index 00000000..1130c68b
--- /dev/null
+++ b/js/inline.js
@@ -0,0 +1,34 @@
+;(function() {
+ $('.body a').click(inline)
+
+ $('head').append(
+ '<style>' +
+ '.inline {' +
+ ' border: 1px dashed black;' +
+ ' margin-left: 1em;' +
+ ' padding: 1em;' +
+ '}' +
+ '</style>')
+})()
+
+function inline(e) {
+ e.preventDefault()
+ var postNum = parseInt(this.textContent.slice(2))
+
+ var cloneID = 'inline_' + postNum
+ var $clone = $('#' + cloneID)
+ if ($clone.length)
+ return $clone.remove()
+
+ var OP = location.pathname.match(/(\d+).html/)[1]
+ var selector = postNum === OP
+ ? '.op .body'
+ : '#reply_' + postNum + ' .body'
+
+ $clone = $(selector).clone(true)
+ $clone.attr({
+ className: 'inline',
+ id: cloneID
+ })
+ $clone.insertAfter(this)
+}