Better Follows Tab - mangadex

Groups Manga, Adds Cover image, Adds button to hide read chapters

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        Better Follows Tab - mangadex
// @namespace   Violentmonkey Scripts
// @match       https://mangadex.org/follows*
// @grant       none
// @version     1.1
// @author      Slub77
// @description Groups Manga, Adds Cover image, Adds button to hide read chapters
// ==/UserScript==

window.imgError = function(image) {
  
    var MangaID = $(image).data("samid")
    var ImgTry = $(image).data("imgtype")
  
    image.onerror = "";
  
    if(ImgTry == "gif") { ImgTry = "jpeg"; }
    else if(ImgTry == "jpeg") { ImgTry = "png"; }
    else if(ImgTry == "png") { ImgTry = "jpg"; }
   
  
    $(image).replaceWith("<img src='https://mangadex.org/images/manga/"+MangaID+"."+ImgTry+"?' data-imgtype='"+ImgTry+"' data-samid='"+MangaID+"' class='samimg' style='width:100px;height:auto;;margin-left:auto;margin-right:auto' onerror='imgError(this);'>")
  
    return true;
}

function AddImages() {
  
  $("a.manga_title.text-truncate").each(function() {
  
  var MangaID = $(this).attr("href").split("/")  
  $(this).prepend("<img src='https://mangadex.org/images/manga/"+MangaID[2]+".gif?' data-imgtype='gif' data-samid='"+MangaID[2]+"' class='samimg' style='width:100px;height:auto;margin-left:auto;margin-right:auto' onerror='imgError(this);'>")
    
  })
  
  
}


function MergeChapterRows() {
  
  var NotFirstRow = false
  
  var LastRealChapter = false;
  
  var MangaTitles = {}
  
  $(".chapter-container > .row.no-gutters").each(function() {
    
    
  if(!NotFirstRow) { NotFirstRow = true} 
    
    else { 
      
    var MangaTrack = $($(this).find(".col-md-9 > div")[0]).data("manga-id")
    
    
    if(MangaTitles[MangaTrack] == undefined) {
          MangaTitles[MangaTrack] = $(this).find(".col-md-9")[0]
        $(this).find(".col-md-9 > div").removeClass("border-bottom")
    }
      
    else {
       var ChildChapter = $(this).find(".col-md-9 > div")
      
       $(ChildChapter).detach().appendTo(MangaTitles[MangaTrack]).removeClass("border-bottom");
      
       $(this).remove();
      
    }

    }
  
  })
  
   $(".chapter-container > .row.no-gutters .col-md-9 > div:first-child").each(function() { 
   
    $(this).css("border-top","1px solid rgba(0, 0, 0, 0.875)")
   
   })
  
  
 AddImages()
  
}

$( document ).ready(function() {
     MergeChapterRows()
  
    $("body").append('<div style="position: fixed; bottom: 10px; right: 50px; overflow-y: auto; border: solid 2px; border-radius: 10px; background-color: #1c1f23; padding: 10px; text-align: center;border-color:white;"><button style="background-color: #1c1f23; color: white; border-radius: 5px; border: solid 1px; padding: 4px;cursor:pointer;display: flex; justify-content: center; align-items: center;" onclick="HideReadSam()"> Toggle Read </button></div>')

});

window.SamHideToggle = true;

window.HideReadSam = function() {
  
  if(SamHideToggle) { 
     $(".chapter-row.no-gutters span.fa-eye").parent().parent().parent().attr('style','display:none !important');
    SamHideToggle = false;   
  }
 else {
  $(".chapter-row.no-gutters span.fa-eye").parent().parent().parent().attr('style','display:flex !important');
   SamHideToggle = true;
  }
  
}