Start backlinking work
This commit is contained in:
parent
e323e97a90
commit
68ffc27a72
27
4chan_x.js
27
4chan_x.js
@ -58,7 +58,7 @@
|
||||
*/
|
||||
|
||||
(function() {
|
||||
var $, $$, Favicon, NAMESPACE, Recaptcha, anonymize, config, d, expandComment, expandThread, g, imageHover, imgExpand, imgGif, imgPreloading, keybinds, localize, log, main, nav, nodeInserted, options, qr, quickReport, quotePreview, redirect, replyHiding, sauce, threadHiding, threading, titlePost, ui, unread, updater, watcher, _config, _ref;
|
||||
var $, $$, Favicon, NAMESPACE, Recaptcha, anonymize, config, d, expandComment, expandThread, g, imageHover, imgExpand, imgGif, imgPreloading, keybinds, localize, log, main, nav, nodeInserted, options, qr, quickReport, quoteBacklink, quotePreview, redirect, replyHiding, sauce, threadHiding, threading, titlePost, ui, unread, updater, watcher, _config, _ref;
|
||||
var __slice = Array.prototype.slice;
|
||||
if (typeof console !== "undefined" && console !== null) {
|
||||
log = function(arg) {
|
||||
@ -84,6 +84,7 @@
|
||||
'Post in Title': [true, 'Show the op\'s post in the tab title'],
|
||||
'Quick Reply': [true, 'Reply without leaving the page'],
|
||||
'Quick Report': [true, 'Add quick report buttons'],
|
||||
'Quote Backlinks': [false, 'Add quote backlinks'],
|
||||
'Quote Preview': [false, 'Show quote content on hover'],
|
||||
'Reply Hiding': [true, 'Hide single replies'],
|
||||
'Sauce': [true, 'Add sauce to images'],
|
||||
@ -1675,6 +1676,25 @@
|
||||
}
|
||||
}
|
||||
};
|
||||
quoteBacklink = {
|
||||
init: function() {
|
||||
return g.callbacks.push(quoteBacklink.node);
|
||||
},
|
||||
node: function(root) {
|
||||
var el, id, link, quote, _i, _len, _ref, _results;
|
||||
_ref = $$('a.quotelink', root);
|
||||
_results = [];
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
quote = _ref[_i];
|
||||
_results.push((el = d.getElementById(quote.textContent.slice(2))) ? (id = quote.parentNode.parentNode.parentNode.id, link = $.el('a', {
|
||||
href: '#' + id,
|
||||
className: 'backlink',
|
||||
textContent: '>>' + id
|
||||
}), el.className !== 'op' ? $.before($('br, blockquote', el), link) : void 0) : void 0);
|
||||
}
|
||||
return _results;
|
||||
}
|
||||
};
|
||||
quotePreview = {
|
||||
init: function() {
|
||||
var preview;
|
||||
@ -1688,7 +1708,7 @@
|
||||
},
|
||||
node: function(root) {
|
||||
var quote, _i, _len, _ref, _results;
|
||||
_ref = $$('a.quotelink', root);
|
||||
_ref = $$('a.quotelink, a.backlink', root);
|
||||
_results = [];
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
quote = _ref[_i];
|
||||
@ -2229,6 +2249,9 @@
|
||||
if ($.config('Quick Report')) {
|
||||
quickReport.init();
|
||||
}
|
||||
if ($.config('Quote Backlinks')) {
|
||||
quoteBacklink.init();
|
||||
}
|
||||
if ($.config('Quote Preview')) {
|
||||
quotePreview.init();
|
||||
}
|
||||
|
||||
@ -28,6 +28,7 @@ config =
|
||||
'Post in Title': [true, 'Show the op\'s post in the tab title']
|
||||
'Quick Reply': [true, 'Reply without leaving the page']
|
||||
'Quick Report': [true, 'Add quick report buttons']
|
||||
'Quote Backlinks': [false, 'Add quote backlinks']
|
||||
'Quote Preview': [false, 'Show quote content on hover']
|
||||
'Reply Hiding': [true, 'Hide single replies']
|
||||
'Sauce': [true, 'Add sauce to images']
|
||||
@ -1340,6 +1341,20 @@ titlePost =
|
||||
if tc = $('span.filetitle').textContent or $('blockquote').textContent
|
||||
d.title = "/#{g.BOARD}/ - #{tc}"
|
||||
|
||||
quoteBacklink =
|
||||
init: ->
|
||||
g.callbacks.push quoteBacklink.node
|
||||
node: (root) ->
|
||||
for quote in $$ 'a.quotelink', root
|
||||
if el = d.getElementById quote.textContent[2..]
|
||||
id = quote.parentNode.parentNode.parentNode.id
|
||||
link = $.el 'a'
|
||||
href: '#'+id
|
||||
className: 'backlink'
|
||||
textContent: '>>'+id
|
||||
unless el.className is 'op'
|
||||
$.before $('br, blockquote', el), link
|
||||
|
||||
quotePreview =
|
||||
init: ->
|
||||
g.callbacks.push quotePreview.node
|
||||
@ -1349,7 +1364,7 @@ quotePreview =
|
||||
$.hide preview
|
||||
$.append d.body, preview
|
||||
node: (root) ->
|
||||
for quote in $$ 'a.quotelink', root
|
||||
for quote in $$ 'a.quotelink, a.backlink', root
|
||||
$.bind quote, 'mouseover', quotePreview.mouseover
|
||||
$.bind quote, 'mousemove', ui.hover
|
||||
$.bind quote, 'mouseout', ui.hoverend
|
||||
@ -1734,6 +1749,9 @@ main =
|
||||
if $.config 'Quick Report'
|
||||
quickReport.init()
|
||||
|
||||
if $.config 'Quote Backlinks'
|
||||
quoteBacklink.init()
|
||||
|
||||
if $.config 'Quote Preview'
|
||||
quotePreview.init()
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user