Lezhin AP Features

Adds search on AP and grabbing vertical cover for Lezhin manhwa

  1. // ==UserScript==
  2. // @name Lezhin AP Features
  3. // @namespace https://greasyfork.org/en/users/689482-quin15
  4. // @version 1.2.0
  5. // @description Adds search on AP and grabbing vertical cover for Lezhin manhwa
  6. // @author Quin15
  7. // @match https://www.lezhin.com/ko/comic/*
  8. // @match https://www.lezhin.com/en/comic/*
  9. // @match https://www.lezhinus.com/en/comic/*
  10. // @icon https://www.google.com/s2/favicons?domain=lezhin.com
  11. // @grant none
  12. // ==/UserScript==
  13.  
  14. var appendButtons = function() {
  15. var btnCont = document.createElement('div');
  16. btnCont.className = "comicInfo__btns";
  17. document.querySelector('.comicInfo__detail').appendChild(btnCont);
  18.  
  19. var searchAP = document.createElement('a')
  20. searchAP.className = "comicInfo__btnView";
  21. searchAP.style = "margin-left: 0px;flex: 0 0 auto;width: 48.7%;padding: 0px 8px;cursor: pointer;line-height: 42px;";
  22. searchAP.innerHTML = `<img src="https://www.anime-planet.com/favicon.ico" style="float:left;height:30px;margin-top:6px"><p style="font-size: 14px;white-space: break-spaces;line-height: 15px;vertical-align: middle;display: inline-block;width: calc(100% - 30px);">Search On AP</p>`;
  23. btnCont.appendChild(searchAP);
  24. searchAP.addEventListener("click", function() {open(encodeURI("https://www.anime-planet.com/manga/all?name=" + document.querySelector('h2.comicInfo__title').innerText), "")});
  25.  
  26. var coverImg = document.createElement('a')
  27. coverImg.className = "comicInfo__btnView";
  28. coverImg.style = "flex: 0 0 auto;width: 48.7%;padding: 0px 8px;cursor: pointer;line-height: 42px;";
  29. coverImg.innerHTML = `<img src="` + document.querySelector('picture img').srcset.replace(" 2x", '') + `" style="float:left;height:30px;margin-top:6px"><p style="font-size: 14px;white-space: break-spaces;line-height: 15px;vertical-align: middle;display: inline-block;width: calc(100% - 30px);">Open Cover Image</p>`;
  30. btnCont.appendChild(coverImg);
  31. coverImg.addEventListener("click", function() {open(document.querySelector('picture img').srcset.replace(" 2x", '').replace(/\&width\=.*/, ""), "")});
  32. }
  33.  
  34. var checkElems = function() {
  35. if (document.querySelector('.episode__img')) {
  36. setTimeout(appendButtons, 1000);
  37. } else {
  38. setTimeout(checkElems, 100);
  39. };
  40. };
  41.  
  42. checkElems();