Skip to content

Instantly share code, notes, and snippets.

@oc013
Forked from hugoboos/trakt-remove-history.js
Created September 23, 2024 05:20
Show Gist options
  • Save oc013/f0e2c2c3034c972abbc772790f69985e to your computer and use it in GitHub Desktop.
Save oc013/f0e2c2c3034c972abbc772790f69985e to your computer and use it in GitHub Desktop.
Remove history from Trakt
// ==UserScript==
// @name Trakt History Remover
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Clear all trakt history
// @author You
// @match https://trakt.tv/users/*/history
// @grant none
// ==/UserScript==
function waitForJQuery() {
if (typeof unsafeWindow.jQuery !== "undefined") {
main();
} else {
setTimeout(waitForJQuery, 100);
}
}
function main() {
let $ = unsafeWindow.jQuery;
const gridItem = $(".posters .grid-item");
let index = 0;
const interval = setInterval(function () {
if (index === gridItem.length) {
clearInterval(interval);
window.location.reload(); // refresh the page
return;
}
const $this = $(gridItem[index]);
unsafeWindow.historyRemove($this, $this.data("history-id"));
index++;
}, 1500);
}
(function () {
"use strict";
waitForJQuery();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment