Skip to content

Commit

Permalink
Fixed bugs with duplicate buttons and links
Browse files Browse the repository at this point in the history
  • Loading branch information
Malanavi committed Apr 17, 2023
1 parent 40653ad commit 2a5bb73
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Watch and download on Shikimori",
"version": "1.1.0",
"version": "1.1.1",

"description": "The addon adds the ability to watch and download anime on the Shikimori website.",
"icons": {
Expand Down
10 changes: 9 additions & 1 deletion scripts/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@ class Player {
static async #onViewChanged() {
const match = Shikimori.isAnimePage(window.location);
if (match) {
if (document.querySelector(".open-player-button")) {
document.querySelector(".open-player-button").remove();
}
if (document.querySelector(".block-with-player")) {
document.querySelector(".block-with-player").remove();
}

this.playerAdded = false;

if (document.querySelectorAll(".subheadline")[0].textContent.includes("Information")) {
this.lang = "eng"
}
Expand All @@ -37,7 +45,7 @@ class Player {

static #createOpenButton(player) {
const button = document.createElement("div");
button.className = "watch-online";
button.className = "watch-online open-player-button";

const line = document.createElement("div");
line.className = "line";
Expand Down
6 changes: 5 additions & 1 deletion scripts/torrent.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ class Torrent {
static async #onViewChanged() {
const match = Shikimori.isAnimePage(window.location);
if (match) {
if (document.querySelector(".rutracker-link")) {
document.querySelector(".rutracker-link").remove();
}

const animeId = match.groups.id;

const nameOfAnime = Shikimori.getNameOfAnime(animeId);
Expand Down Expand Up @@ -59,7 +63,7 @@ class Torrent {

static #createBlock(link) {
const block = document.createElement("div");
block.className = "b-external_link rutracker b-menu-line";
block.className = "b-external_link rutracker b-menu-line rutracker-link";

block.appendChild(link);

Expand Down

0 comments on commit 2a5bb73

Please sign in to comment.