2014-09-23 22:52:06 -04:00
|
|
|
;(function() {
|
2014-09-24 00:25:34 -04:00
|
|
|
var inline = function(e) {
|
|
|
|
e.preventDefault()
|
|
|
|
|
|
|
|
var postNum = this.textContent.slice(2)
|
|
|
|
|
|
|
|
var $clone = $('#inline_' + postNum)
|
|
|
|
if ($clone.length)
|
|
|
|
return $clone.remove()
|
|
|
|
|
|
|
|
var OP = location.pathname.match(/(\d+).html/)[1]
|
|
|
|
var selector = postNum === OP
|
|
|
|
? '.op .body'
|
|
|
|
: '#reply_' + postNum + ' .body'
|
|
|
|
|
|
|
|
var link = {
|
|
|
|
postNum: postNum,
|
|
|
|
node: this
|
|
|
|
}
|
|
|
|
var $target = $(selector)
|
|
|
|
if ($target.length)
|
|
|
|
add(link, $target)
|
|
|
|
else
|
|
|
|
$.get(this.pathname, function(data) {
|
|
|
|
var $target = $(data).find(selector)
|
|
|
|
add(link, $target)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
var add = function(link, $target) {
|
|
|
|
var $clone = $target.clone(true)
|
|
|
|
$clone.attr({
|
|
|
|
"class": 'inline',
|
|
|
|
id: 'inline_' + link.postNum
|
|
|
|
})
|
|
|
|
$clone.insertAfter(link.node)
|
|
|
|
}
|
2014-09-23 22:52:06 -04:00
|
|
|
|
|
|
|
$('head').append(
|
|
|
|
'<style>' +
|
|
|
|
'.inline {' +
|
|
|
|
' border: 1px dashed black;' +
|
|
|
|
' margin-left: 1em;' +
|
|
|
|
' padding: 1em;' +
|
|
|
|
'}' +
|
|
|
|
'</style>')
|
|
|
|
|
2014-09-24 00:25:34 -04:00
|
|
|
$('.body a').click(inline)
|
|
|
|
|
|
|
|
})()
|