forked from tastytea/userscripts
rbb24_expand_comments: Do not crash if loadmore is not present.
This commit is contained in:
parent
6181ee3935
commit
0abd12cae3
|
@ -2,7 +2,7 @@
|
|||
// @name Expand rbb24.de comments
|
||||
// @description Loads all comments under articles on rbb24.de and expands them.
|
||||
// @description:de Lädt alle kommentare unter artikeln auf rbb24.de und klappt sie aus.
|
||||
// @version 2019.06.07.5
|
||||
// @version 2019.06.07.6
|
||||
// @author tastytea
|
||||
// @copyright 2019, tastytea (https://tastytea.de/)
|
||||
// @license GPL-3.0-only
|
||||
|
@ -18,22 +18,22 @@
|
|||
|
||||
function expand_comments()
|
||||
{
|
||||
const loadmore = document.getElementsByClassName("load_more_comments")[0];
|
||||
const showall = document.getElementsByClassName("show_all")[0];
|
||||
const loadmore = document.getElementsByClassName("load_more_comments");
|
||||
const showall = document.getElementsByClassName("show_all");
|
||||
|
||||
if (loadmore === undefined)
|
||||
if (loadmore.length > 0)
|
||||
{
|
||||
loadmore.click();
|
||||
loadmore[0].click();
|
||||
}
|
||||
|
||||
if (showall === undefined) // Cancel if we are not on an article page.
|
||||
if (showall.length === 0) // Cancel if we are not on an article page.
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
setTimeout(function() // Wait for comments to load.
|
||||
{
|
||||
showall.click();
|
||||
showall[0].click();
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue