2018-10-06 20:20:40 -07:00
|
|
|
function toggle_parent(target) {
|
2019-05-01 18:03:39 -07:00
|
|
|
body = target.parentNode.parentNode.children[1];
|
|
|
|
if (body.style.display === null || body.style.display === "") {
|
|
|
|
target.innerHTML = "[ + ]";
|
|
|
|
body.style.display = "none";
|
|
|
|
} else {
|
|
|
|
target.innerHTML = "[ - ]";
|
|
|
|
body.style.display = "";
|
|
|
|
}
|
2018-10-06 20:20:40 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
function toggle_comments(target) {
|
2019-05-01 18:03:39 -07:00
|
|
|
body = target.parentNode.parentNode.parentNode.children[1];
|
|
|
|
if (body.style.display === null || body.style.display === "") {
|
|
|
|
target.innerHTML = "[ + ]";
|
|
|
|
body.style.display = "none";
|
|
|
|
} else {
|
|
|
|
target.innerHTML = "[ - ]";
|
|
|
|
body.style.display = "";
|
|
|
|
}
|
2018-10-06 20:20:40 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
function swap_comments(source) {
|
2019-05-01 18:03:39 -07:00
|
|
|
if (source == "youtube") {
|
|
|
|
get_youtube_comments();
|
|
|
|
} else if (source == "reddit") {
|
|
|
|
get_reddit_comments();
|
|
|
|
}
|
2018-10-06 20:20:40 -07:00
|
|
|
}
|
|
|
|
|
2019-05-01 18:03:39 -07:00
|
|
|
String.prototype.supplant = function (o) {
|
|
|
|
return this.replace(/{([^{}]*)}/g, function (a, b) {
|
|
|
|
var r = o[b];
|
|
|
|
return typeof r === "string" || typeof r === "number" ? r : a;
|
|
|
|
});
|
2018-10-06 20:20:40 -07:00
|
|
|
};
|
2018-10-15 09:15:23 -07:00
|
|
|
|
2019-02-16 12:24:15 -08:00
|
|
|
function show_youtube_replies(target, inner_text, sub_text) {
|
2019-05-01 18:03:39 -07:00
|
|
|
body = target.parentNode.parentNode.children[1];
|
|
|
|
body.style.display = "";
|
2018-10-15 09:15:23 -07:00
|
|
|
|
2019-05-01 18:03:39 -07:00
|
|
|
target.innerHTML = inner_text;
|
|
|
|
target.setAttribute("onclick", "hide_youtube_replies(this, \'" + inner_text + "\', \'" + sub_text + "\')");
|
2018-10-15 09:15:23 -07:00
|
|
|
}
|
|
|
|
|
2019-02-16 12:24:15 -08:00
|
|
|
function hide_youtube_replies(target, inner_text, sub_text) {
|
2019-05-01 18:03:39 -07:00
|
|
|
body = target.parentNode.parentNode.children[1];
|
|
|
|
body.style.display = "none";
|
2018-10-15 09:15:23 -07:00
|
|
|
|
2019-05-01 18:03:39 -07:00
|
|
|
target.innerHTML = sub_text;
|
|
|
|
target.setAttribute("onclick", "show_youtube_replies(this, \'" + inner_text + "\', \'" + sub_text + "\')");
|
2018-10-15 09:15:23 -07:00
|
|
|
}
|