Skip to content

Instantly share code, notes, and snippets.

@ewasion
Last active May 18, 2018 11:47
Show Gist options
  • Save ewasion/31a1312ea2bef778bb6b8cc635352609 to your computer and use it in GitHub Desktop.
Save ewasion/31a1312ea2bef778bb6b8cc635352609 to your computer and use it in GitHub Desktop.
AB Multi Audio
// ==UserScript==
// @name AB Multi Audio
// @namespace https://github.com/ewasion
// @version 0.1.1
// @description Adds a "Multi Audio" field to torrent info
// @author Eva
// @homepage https://github.com/ewasion
// @icon https://animebytes.tv/favicon.ico
// @updateURL https://gist.github.com/ewasion/31a1312ea2bef778bb6b8cc635352609/raw/ab-multi-audio.user.js
// @downloadURL https://gist.github.com/ewasion/31a1312ea2bef778bb6b8cc635352609/raw/ab-multi-audio.user.js
// @grant none
// @match https://animebytes.tv/torrents*
// @license GPL-3.0
// @run-at document-end
// ==/UserScript==
document.querySelectorAll('[id$="_mediainfo"] td:nth-of-type(3) table:first-child tbody').forEach(mediainfo => {
mediainfo.querySelectorAll('tr td:last-child').forEach(lang => {
if(lang.innerText.match(/^(?!English|Japanese)[A-Z]/) != null) {
let torrent = mediainfo.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.previousElementSibling.firstElementChild.firstElementChild.nextElementSibling;
if(torrent.dataset.multiAudio == null) {
torrent.dataset.multiAudio = '';
torrent.innerHTML += ' | <span data-multi-audio="">Multi Audio</span>';
}
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment