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() {
|
(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;
|
var __slice = Array.prototype.slice;
|
||||||
if (typeof console !== "undefined" && console !== null) {
|
if (typeof console !== "undefined" && console !== null) {
|
||||||
log = function(arg) {
|
log = function(arg) {
|
||||||
@ -84,6 +84,7 @@
|
|||||||
'Post in Title': [true, 'Show the op\'s post in the tab title'],
|
'Post in Title': [true, 'Show the op\'s post in the tab title'],
|
||||||
'Quick Reply': [true, 'Reply without leaving the page'],
|
'Quick Reply': [true, 'Reply without leaving the page'],
|
||||||
'Quick Report': [true, 'Add quick report buttons'],
|
'Quick Report': [true, 'Add quick report buttons'],
|
||||||
|
'Quote Backlinks': [false, 'Add quote backlinks'],
|
||||||
'Quote Preview': [false, 'Show quote content on hover'],
|
'Quote Preview': [false, 'Show quote content on hover'],
|
||||||
'Reply Hiding': [true, 'Hide single replies'],
|
'Reply Hiding': [true, 'Hide single replies'],
|
||||||
'Sauce': [true, 'Add sauce to images'],
|
'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 = {
|
quotePreview = {
|
||||||
init: function() {
|
init: function() {
|
||||||
var preview;
|
var preview;
|
||||||
@ -1688,7 +1708,7 @@
|
|||||||
},
|
},
|
||||||
node: function(root) {
|
node: function(root) {
|
||||||
var quote, _i, _len, _ref, _results;
|
var quote, _i, _len, _ref, _results;
|
||||||
_ref = $$('a.quotelink', root);
|
_ref = $$('a.quotelink, a.backlink', root);
|
||||||
_results = [];
|
_results = [];
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
quote = _ref[_i];
|
quote = _ref[_i];
|
||||||
@ -2229,6 +2249,9 @@
|
|||||||
if ($.config('Quick Report')) {
|
if ($.config('Quick Report')) {
|
||||||
quickReport.init();
|
quickReport.init();
|
||||||
}
|
}
|
||||||
|
if ($.config('Quote Backlinks')) {
|
||||||
|
quoteBacklink.init();
|
||||||
|
}
|
||||||
if ($.config('Quote Preview')) {
|
if ($.config('Quote Preview')) {
|
||||||
quotePreview.init();
|
quotePreview.init();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,6 +28,7 @@ config =
|
|||||||
'Post in Title': [true, 'Show the op\'s post in the tab title']
|
'Post in Title': [true, 'Show the op\'s post in the tab title']
|
||||||
'Quick Reply': [true, 'Reply without leaving the page']
|
'Quick Reply': [true, 'Reply without leaving the page']
|
||||||
'Quick Report': [true, 'Add quick report buttons']
|
'Quick Report': [true, 'Add quick report buttons']
|
||||||
|
'Quote Backlinks': [false, 'Add quote backlinks']
|
||||||
'Quote Preview': [false, 'Show quote content on hover']
|
'Quote Preview': [false, 'Show quote content on hover']
|
||||||
'Reply Hiding': [true, 'Hide single replies']
|
'Reply Hiding': [true, 'Hide single replies']
|
||||||
'Sauce': [true, 'Add sauce to images']
|
'Sauce': [true, 'Add sauce to images']
|
||||||
@ -1340,6 +1341,20 @@ titlePost =
|
|||||||
if tc = $('span.filetitle').textContent or $('blockquote').textContent
|
if tc = $('span.filetitle').textContent or $('blockquote').textContent
|
||||||
d.title = "/#{g.BOARD}/ - #{tc}"
|
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 =
|
quotePreview =
|
||||||
init: ->
|
init: ->
|
||||||
g.callbacks.push quotePreview.node
|
g.callbacks.push quotePreview.node
|
||||||
@ -1349,7 +1364,7 @@ quotePreview =
|
|||||||
$.hide preview
|
$.hide preview
|
||||||
$.append d.body, preview
|
$.append d.body, preview
|
||||||
node: (root) ->
|
node: (root) ->
|
||||||
for quote in $$ 'a.quotelink', root
|
for quote in $$ 'a.quotelink, a.backlink', root
|
||||||
$.bind quote, 'mouseover', quotePreview.mouseover
|
$.bind quote, 'mouseover', quotePreview.mouseover
|
||||||
$.bind quote, 'mousemove', ui.hover
|
$.bind quote, 'mousemove', ui.hover
|
||||||
$.bind quote, 'mouseout', ui.hoverend
|
$.bind quote, 'mouseout', ui.hoverend
|
||||||
@ -1734,6 +1749,9 @@ main =
|
|||||||
if $.config 'Quick Report'
|
if $.config 'Quick Report'
|
||||||
quickReport.init()
|
quickReport.init()
|
||||||
|
|
||||||
|
if $.config 'Quote Backlinks'
|
||||||
|
quoteBacklink.init()
|
||||||
|
|
||||||
if $.config 'Quote Preview'
|
if $.config 'Quote Preview'
|
||||||
quotePreview.init()
|
quotePreview.init()
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user