Skip to content

Instantly share code, notes, and snippets.

@Multimodcrafter
Created April 30, 2020 12:56
Show Gist options
  • Select an option

  • Save Multimodcrafter/5ed673bea68bbe5158a24bda293187ac to your computer and use it in GitHub Desktop.

Select an option

Save Multimodcrafter/5ed673bea68bbe5158a24bda293187ac to your computer and use it in GitHub Desktop.
function filter() {
return this.id.includes("suggested") || this.id.includes("mentioned") || this.id.includes("supplementary");
}
function book() {
patel = false;
if(!patel) return $(this).children().eq(0).html().includes("Y.N. Patt and S.J. Patel");
else return $(this).children().eq(0).html().includes("D. Harris and S. Harris");
}
function unique(list) {
var result = [];
$.each(list, function(i, e) {
if ($.inArray(e, result) == -1) result.push(e);
});
return result;
}
function removeStuff() {
$("h4").filter(filter).next().remove();
$("h4").remove();
$("h2").remove();
$("li").filter(book).remove();
let seen = [];
$("div.li").each(function() {
let str = this.innerText;
if(str.endsWith("”")) {
str = str.substring(0,str.length - 1);
}
if(str.endsWith(".")) {
str = str.substring(0,str.length - 1);
}
if(seen.includes(str)) {
$(this).parent().remove();
} else {
seen.push(str);
}
});
}
(function () {
function loadScript(url, callback) {
var script = document.createElement("script")
script.type = "text/javascript";
if (script.readyState) { //IE
script.onreadystatechange = function () {
if (script.readyState == "loaded" || script.readyState == "complete") {
script.onreadystatechange = null;
callback();
}
};
} else { //Others
script.onload = function () {
callback();
};
}
script.src = url;
document.getElementsByTagName("head")[0].appendChild(script);
}
loadScript("https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js", function () {
removeStuff();
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment