refactor
This commit is contained in:
parent
1c33c598a3
commit
50dbd920f9
@ -296,6 +296,13 @@
|
|||||||
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);
|
||||||
},
|
},
|
||||||
@ -1868,7 +1875,7 @@
|
|||||||
return watcher.refresh();
|
return watcher.refresh();
|
||||||
},
|
},
|
||||||
watch: function(thread, id) {
|
watch: function(thread, id) {
|
||||||
var el, props, span, watched, _name;
|
var el, props, watched, _name;
|
||||||
el = $('span.filetitle');
|
el = $('span.filetitle');
|
||||||
if (!el.textContent) {
|
if (!el.textContent) {
|
||||||
el = $('blockquote');
|
el = $('blockquote');
|
||||||
@ -1876,11 +1883,8 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
span = $.el('span', {
|
|
||||||
innerHTML: el.innerHTML.replace(/<br>/g, ' ')
|
|
||||||
});
|
|
||||||
props = {
|
props = {
|
||||||
textContent: "/" + g.BOARD + "/ - " + span.textContent.slice(0, 25),
|
textContent: "/" + g.BOARD + "/ - " + ($.innerText(el).slice(0, 25)),
|
||||||
href: "/" + g.BOARD + "/res/" + id
|
href: "/" + g.BOARD + "/res/" + id
|
||||||
};
|
};
|
||||||
watched = $.get('watched', {});
|
watched = $.get('watched', {});
|
||||||
@ -2066,7 +2070,7 @@
|
|||||||
};
|
};
|
||||||
titlePost = {
|
titlePost = {
|
||||||
init: function() {
|
init: function() {
|
||||||
var el, span;
|
var el;
|
||||||
el = $('span.filetitle');
|
el = $('span.filetitle');
|
||||||
if (!el.textContent) {
|
if (!el.textContent) {
|
||||||
el = $('blockquote');
|
el = $('blockquote');
|
||||||
@ -2074,10 +2078,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
span = $.el('span', {
|
return d.title = "/" + g.BOARD + "/ - " + ($.innerText(el));
|
||||||
innerHTML: el.innerHTML.replace(/<br>/g, ' ')
|
|
||||||
});
|
|
||||||
return d.title = "/" + g.BOARD + "/ - " + span.textContent;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
quoteBacklink = {
|
quoteBacklink = {
|
||||||
|
|||||||
@ -206,6 +206,9 @@ $.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) ->
|
||||||
@ -1540,10 +1543,8 @@ watcher =
|
|||||||
el = $ 'blockquote'
|
el = $ 'blockquote'
|
||||||
if not el.textContent
|
if not el.textContent
|
||||||
return
|
return
|
||||||
span = $.el 'span',
|
|
||||||
innerHTML: el.innerHTML.replace /<br>/g, ' '
|
|
||||||
props =
|
props =
|
||||||
textContent: "/#{g.BOARD}/ - #{span.textContent[...25]}"
|
textContent: "/#{g.BOARD}/ - #{$.innerText(el)[...25]}"
|
||||||
href: "/#{g.BOARD}/res/#{id}"
|
href: "/#{g.BOARD}/res/#{id}"
|
||||||
|
|
||||||
watched = $.get 'watched', {}
|
watched = $.get 'watched', {}
|
||||||
@ -1659,9 +1660,7 @@ titlePost =
|
|||||||
el = $ 'blockquote'
|
el = $ 'blockquote'
|
||||||
if not el.textContent
|
if not el.textContent
|
||||||
return
|
return
|
||||||
span = $.el 'span',
|
d.title = "/#{g.BOARD}/ - #{$.innerText el}"
|
||||||
innerHTML: el.innerHTML.replace /<br>/g, ' '
|
|
||||||
d.title = "/#{g.BOARD}/ - #{span.textContent}"
|
|
||||||
|
|
||||||
quoteBacklink =
|
quoteBacklink =
|
||||||
init: ->
|
init: ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user