refactor
This commit is contained in:
parent
12b042c268
commit
10d222c8d6
@ -58,7 +58,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var $, $$, DAY, Favicon, HOUR, MINUTE, NAMESPACE, Recaptcha, SECOND, Time, anonymize, conf, config, cooldown, d, expandComment, expandThread, firstRun, g, imgExpand, imgGif, imgHover, imgPreloading, key, keybinds, log, main, nav, nodeInserted, options, qr, quoteBacklink, quoteInline, quoteOP, quotePreview, redirect, replyHiding, reportButton, revealSpoilers, sauce, threadHiding, threadStats, threading, titlePost, ui, unread, updater, val, watcher, _ref;
|
var $, $$, DAY, Favicon, HOUR, MINUTE, NAMESPACE, Recaptcha, SECOND, Time, anonymize, conf, config, cooldown, d, expandComment, expandThread, firstRun, g, getTitle, imgExpand, imgGif, imgHover, imgPreloading, key, keybinds, log, main, nav, nodeInserted, options, qr, quoteBacklink, quoteInline, quoteOP, quotePreview, redirect, replyHiding, reportButton, revealSpoilers, sauce, threadHiding, threadStats, threading, titlePost, ui, unread, updater, val, watcher, _ref;
|
||||||
var __slice = Array.prototype.slice;
|
var __slice = Array.prototype.slice;
|
||||||
config = {
|
config = {
|
||||||
main: {
|
main: {
|
||||||
@ -300,13 +300,6 @@
|
|||||||
return object;
|
return object;
|
||||||
};
|
};
|
||||||
$.extend($, {
|
$.extend($, {
|
||||||
innerText: function(el) {
|
|
||||||
var span;
|
|
||||||
span = $.el('span', {
|
|
||||||
innerHTML: el.innerHTML.replace(/<br>/g, ' ')
|
|
||||||
});
|
|
||||||
return span.textContent;
|
|
||||||
},
|
|
||||||
id: function(id) {
|
id: function(id) {
|
||||||
return d.getElementById(id);
|
return d.getElementById(id);
|
||||||
},
|
},
|
||||||
@ -1894,17 +1887,10 @@
|
|||||||
return watcher.refresh();
|
return watcher.refresh();
|
||||||
},
|
},
|
||||||
watch: function(thread, id) {
|
watch: function(thread, id) {
|
||||||
var el, props, watched, _name;
|
var props, watched, _name;
|
||||||
el = $('span.filetitle', thread);
|
|
||||||
if (!el.textContent) {
|
|
||||||
el = $('blockquote', thread);
|
|
||||||
if (!el.textContent) {
|
|
||||||
el = $('span.postername', thread);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
props = {
|
props = {
|
||||||
href: "/" + g.BOARD + "/res/" + id,
|
href: "/" + g.BOARD + "/res/" + id,
|
||||||
textContent: "/" + g.BOARD + "/ - " + ($.innerText(el).slice(0, 25))
|
textContent: getTitle(thread)
|
||||||
};
|
};
|
||||||
watched = $.get('watched', {});
|
watched = $.get('watched', {});
|
||||||
watched[_name = g.BOARD] || (watched[_name] = {});
|
watched[_name = g.BOARD] || (watched[_name] = {});
|
||||||
@ -2087,17 +2073,23 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
getTitle = function(thread) {
|
||||||
|
var el, span;
|
||||||
|
el = $('span.filetitle', thread);
|
||||||
|
if (!el.textContent) {
|
||||||
|
el = $('blockquote', thread);
|
||||||
|
if (!el.textContent) {
|
||||||
|
el = $('span.postername', thread);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
span = $.el('span', {
|
||||||
|
innerHTML: el.innerHTML.replace(/<br>/g, ' ')
|
||||||
|
});
|
||||||
|
return "/" + g.BOARD + "/ - " + span.textContent;
|
||||||
|
};
|
||||||
titlePost = {
|
titlePost = {
|
||||||
init: function() {
|
init: function() {
|
||||||
var el;
|
return d.title = getTitle();
|
||||||
el = $('span.filetitle');
|
|
||||||
if (!el.textContent) {
|
|
||||||
el = $('blockquote');
|
|
||||||
if (!el.textContent) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return d.title = "/" + g.BOARD + "/ - " + ($.innerText(el));
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
quoteBacklink = {
|
quoteBacklink = {
|
||||||
|
|||||||
@ -210,9 +210,6 @@ $.extend = (object, properties) ->
|
|||||||
object
|
object
|
||||||
|
|
||||||
$.extend $,
|
$.extend $,
|
||||||
innerText: (el) ->
|
|
||||||
span = $.el 'span', innerHTML: el.innerHTML.replace /<br>/g, ' '
|
|
||||||
span.textContent
|
|
||||||
id: (id) ->
|
id: (id) ->
|
||||||
d.getElementById id
|
d.getElementById id
|
||||||
globalEval: (code) ->
|
globalEval: (code) ->
|
||||||
@ -1558,14 +1555,9 @@ watcher =
|
|||||||
watcher.refresh()
|
watcher.refresh()
|
||||||
|
|
||||||
watch: (thread, id) ->
|
watch: (thread, id) ->
|
||||||
el = $ 'span.filetitle', thread
|
|
||||||
if not el.textContent
|
|
||||||
el = $ 'blockquote', thread
|
|
||||||
if not el.textContent
|
|
||||||
el = $ 'span.postername', thread
|
|
||||||
props =
|
props =
|
||||||
href: "/#{g.BOARD}/res/#{id}"
|
href: "/#{g.BOARD}/res/#{id}"
|
||||||
textContent: "/#{g.BOARD}/ - #{$.innerText(el)[...25]}"
|
textContent: getTitle thread
|
||||||
|
|
||||||
watched = $.get 'watched', {}
|
watched = $.get 'watched', {}
|
||||||
watched[g.BOARD] or= {}
|
watched[g.BOARD] or= {}
|
||||||
@ -1673,14 +1665,18 @@ Time =
|
|||||||
P: -> if Time.date.getHours() < 12 then 'am' else 'pm'
|
P: -> if Time.date.getHours() < 12 then 'am' else 'pm'
|
||||||
y: -> Time.date.getFullYear() - 2000
|
y: -> Time.date.getFullYear() - 2000
|
||||||
|
|
||||||
|
getTitle = (thread) ->
|
||||||
|
el = $ 'span.filetitle', thread
|
||||||
|
if not el.textContent
|
||||||
|
el = $ 'blockquote', thread
|
||||||
|
if not el.textContent
|
||||||
|
el = $ 'span.postername', thread
|
||||||
|
span = $.el 'span', innerHTML: el.innerHTML.replace /<br>/g, ' '
|
||||||
|
"/#{g.BOARD}/ - #{span.textContent}"
|
||||||
|
|
||||||
titlePost =
|
titlePost =
|
||||||
init: ->
|
init: ->
|
||||||
el = $ 'span.filetitle'
|
d.title = getTitle()
|
||||||
if not el.textContent
|
|
||||||
el = $ 'blockquote'
|
|
||||||
if not el.textContent
|
|
||||||
return
|
|
||||||
d.title = "/#{g.BOARD}/ - #{$.innerText el}"
|
|
||||||
|
|
||||||
quoteBacklink =
|
quoteBacklink =
|
||||||
init: ->
|
init: ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user