Greasy Fork

Search for Live-Actions\Doramas\All Related Entries + Correct Watch Order + Copy Entry Title

Will open websites on new tabs to search for Live-Actions\Doramas\All Related Entries + Correct Watch Order and can Copy An Entry Title

目前为 2020-07-25 提交的版本。查看 最新版本

// ==UserScript==
// @name         Search for Live-Actions\Doramas\All Related Entries + Correct Watch Order + Copy Entry Title
// @namespace
// @version      1.2
// @description  Will open websites on new tabs to search for Live-Actions\Doramas\All Related Entries + Correct Watch Order and can Copy An Entry Title
// @author       hacker09
// @match        https://myanimelist.net/anime/*
// @match        https://myanimelist.net/anime.php?id=*
// @grant        none
// @namespace    Search for Live-Actions\Doramas\All Related Entries + Correct Watch Order + Copy Entry Title
// ==/UserScript==
//The lines below are the beginning of the function
(function() {
  //Find and Select the entry title
  var titleElem = document.querySelector("#contentWrapper .h1 span[itemprop='name']");
  var header = titleElem.parentElement;
  //The line below specify what should/can be copied to be searched on the websites a-z A-Z 0-9 and add a + symbol on the search url
  var title = titleElem.firstChild.textContent.replace(/[^a-zA-Z0-9]+/g, "+");
  //The line below specify what should/can be copied to the clipboard a-z A-Z 0-9 . : ¹ ² ³ " ! - ° _ and add a space between the title words
  var copytitlewithsymbols1click = titleElem.firstChild.textContent.replace(/[^a-zA-Z0-9.:¹²³"!-°_♥()=,?*&★+;'%[]☆†◯*½@√]+/g, " ");
  //The line below specify what should/can be copied to the clipboard a-z A-Z 0-9 and add a space between the title words
  var copytitlewithoutsymbols2clicks = titleElem.firstChild.textContent.replace(/[^a-zA-Z0-9]+/g, " ");
  //The line below creates an "a" element so the buttons will appear
  var findButton = document.createElement("a");
  var chiakiButton = document.createElement("a");
  var copyButton = document.createElement("a");
  //The line below detects the anime id to be added on chiaki website
  var animeid = location.pathname.match(/\d+/)[0]
  //The line below also can detect the anime id to be added on chiaki website,but this line isn't being used on this script, I'm leaving the code here for my own purposes,maybe someone will also benefit from it
  //  console.log(window.location.pathname.split( '/' )[2]);

  //The lines below will detect the single mouse click and copy the entry title with symbols to the clipboard
  copyButton.addEventListener("click",()=>{navigator.clipboard.writeText(copytitlewithsymbols1click)});
  //The lines below will detect the double mouse click and copy the entry title without symbols to the clipboard
  copyButton.addEventListener("dblclick",()=>{navigator.clipboard.writeText(copytitlewithoutsymbols2clicks)});
  //The line below detects a mouse hover on the button and show the text Copy Entry Title
  copyButton.setAttribute("title", "1 Click To Copy Entry Title (+ Symbols) or 2 Clicks To Copy Entry Title (No Symbols)");
  //The lines below are the CSS for the copy button
  copyButton.setAttribute("style", "margin-left: 13px;height: 10px;width: 10px;background-size: cover;display: inline-block;transform: scale(1.8);vertical-align: top;margin-top: 7px;");
  //The lines below are the copy button image converted to DATA URI
  copyButton.style.backgroundImage = "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAQAAAAm93DmAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAAAHdElNRQfkBhcOBQkNughZAAADCUlEQVRIx6XWS2hcVRzH8c90Jklji5qkmKipolFb2iBDQSw+KhXBRbEKLYqIiCi+4kLoJrgQfKAgiChN8UEXCr6KFVxUcFFQa6TpWDNGKUpcqKAMTU2lNdpEZ66LmTtz53FnbvQ3i5lz7r3f+/v//mcOJyWibPlrk11uNiCJin70lgnHIY909OoQ3GSvrc5KhGOFftdb53OnKCDT4G/Ey9bhmO8UpTrgAqtsMuRWcx7xt3pgpdzTcqY879cE/gJpV3nVqB1edwQ1D5X8unQJ/JWw4LIeskfKmD35msMKrtd6a2WiL6rTvBm/hfFXn5u1aKX+8kwmgrvauC3ObpPckq894wDZCjIvSyCIdinUdd52m34Z6dhPr8322hkx0aSwKed6yqUCn/jIHy09lgx7zGqDduP9msvWwM2uwQH3OhFb8HoPWk17ZAjcqEfRm2VcqzdnyVSdR5CNCjPsxVI8rlJ0LfxBu8tZxgHLSrXBcUIhMho0YUcnYHsd94ZSZHyeF1wZl2E0q3i9YpX7DVZsZFzsdjMdgNhgq+66mcC0Q0oWPO0dl+kSWONZQ0aJLutWwDVec23TbMF2OQRmzVYKHjcU6XwscGV5W2xQv75ow7KkpRrdtQb+4nF36GqYnTQpkZqBgX32N3Q/8E8yXOumUFRsNZ1NAFzOOvzPDm+0XXdz3CAlcNh7lpIDz/eS0bYm7vazT5OXHLTOL6JSuzuaHRaMuUVP25Knlpdh4jWXrOT/qdbrsLvNiwKLywOucJc7G3abeuAhLzodGQ/oxp9xwAs96ZK2Vd1gysdV3AXukXbGsbgMF/zUIaaCuervDd61DV84HOdw3gO26InFleRNV0cjRvCDJ/weB1TdQpOo5KTPPCcXTkSBqfLum+9IydbuznnUt87UnguB8+hxuYPJNikMG8D3viwPQxsh8KiT+oyZkUtwcuUi4/ootyJaUwic9oH7jNrvKwsdgIGMja7AER82XkxVM1lrwrZl/RW/8bDJxszTVE7/pxy0aNg5CaCBOfvschR15xP+BXLUxMa/tU5OAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIwLTA2LTIzVDE0OjA1OjAzKzAwOjAw5sMT7QAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMC0wNi0yM1QxNDowNTowMyswMDowMJeeq1EAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAAAAElFTkSuQmCC)";
  //The lines below are the CSS for the copy button
  titleElem.setAttribute("style", "display: inline-block;");

  //The line below defines where the button should appear
  header.appendChild(copyButton);
  //********************************************************************************************************************************************************************
  //The lines below will detect the mouse click, copy/open and search for the anime title
  findButton.addEventListener("click",()=>{
    navigator.clipboard.writeText(copytitlewithsymbols1click).then(()=>{
        window.open("https://www.imdb.com/find?q="+title, "_blank");
        window.open("http://asianwiki.com/index.php?title=Special%3ASearch&search="+title, "_blank");
        window.open("https://mydramalist.com/search?q="+title, "_blank");
        window.open("https://myanimelist.net/clubs.php?cid=5450", "_blank");
    });
});
  //The line below detects a mouse hover on the button and show the text Find Live-Actions
  findButton.setAttribute("title", "Find Live-Actions + Copy Entry Title");
  //The lines below are the CSS for the findButton
  findButton.setAttribute("style", "margin-left: 15px;height: 10px;width: 10px;background-size: cover;display: inline-block;transform: scale(1.8);vertical-align: top;margin-top: 7px;");
  //The lines below are the copy button image converted to DATA URI
  findButton.style.backgroundImage = "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAQAAAAm93DmAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAAAHdElNRQfkBhcOEyPKmXRYAAACrElEQVRIx+3U32uVdRzA8de2s01d82wQ2GhotNYYSgqlzhSpIVhasF1IkP9ABbsLcdqFuIu6KOxyN120C5EIEemHlLSIkOEyWkRSHofb9NDaGQo7nZ7mtm8X6WmLneec7XTp+7n58nwe3t/P5/t5Pl8eUC4VBSMN2rRpUitr3FXXRavfZqMjhmSF/DPlU4clV5Nhwit6bXbHZd8Z85ekVjttk/CFE4ZWlttaJ0Wy+m1XveQAXnZBMOHQSnQJJy1I6cY6B7zrvDOeuBdd7y05GV2lCw+LpOzGbhfMCiKjduTjlXpErtlSmm6Tn2R1o9stwVde86wWVUtqeE8woKYU4RFBP3a5KedogZ42+9GMvcV1DYbcsd0anwiOx/yhbwpOFRfulPWlavtEvtEY8+VTpg1rWD5YmV+1qXPFXc+p9bHbMcIbUh7TVEzYhDG0mzMSW0tOWr2HiwlrESFlyGiscEGkqlCfE/lVFkn0WWsqVlil3l25YsJxtCIrK56kjW77vVjJV2XsuNfdpPoYYZsWv/qtmPC6y7bag6QB78fMQpd1LvqjmDByWsIb6s3JmBYK6LZ5Vdo5JbDe54JjqFlydS2m0TlBXyk66DAh6/VFeS+lQb9g0IZShRyS8ae3l52Drc4KfvB0zJwvQ5drgit6tHtIpQoJjTq8Y0Iw6BknfKDV4x4pVbnFgBnBpG+d8aGzvjcjuKXPBgmnBSlpP+speNb/ocZepwybEpmVkzboeP6e3mzMghHTZh0rVflPC9rt0alDi7pF7580acSjXnJzpcrlaZaS8SIO/j/KCkfNG/dCXtm76E5YFWv0mTORzzJr//1Q1aqEcy4JDnjeLz5TZ79RX5cjZN4l8w7qVGefTT4yXF7RUK3XjCC4qPnfAy6HhE67TDovXX5+D7jP32Dw0Zd65WyaAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIwLTA2LTIzVDE0OjE5OjI4KzAwOjAwfVN/JAAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMC0wNi0yM1QxNDoxOToyOCswMDowMAwOx5gAAAAASUVORK5CYII=)";
  //The lines below are the CSS for the copy button
  titleElem.setAttribute("style", "display: inline-block;");

  //The line below defines where the button should appear
  header.appendChild(findButton);
  //********************************************************************************************************************************************************************
  //The line below detects the mouse click, and search for related anime entries on MAL and shows the correct watch order for the whole anime
  chiakiButton.setAttribute("href", "https://chiaki.site/?/tools/watch_order/id/"+animeid);
  //The line below specifies that the link should be opened on a new tab
  chiakiButton.setAttribute("target", "_blank");
  //The line below detects a mouse hover on the button and show the text Find Live-Actions
  chiakiButton.setAttribute("title", "Find Related Entries + Correct Watch Order");
  //The lines below are the CSS for the chiakiButton
  chiakiButton.setAttribute("style", "margin-left: 15px;height: 10px;width: 10px;background-size: cover;display: inline-block;transform: scale(1.8);vertical-align: top;margin-top: 7px;");
  //The lines below are the copy button image converted to DATA URI
  chiakiButton.style.backgroundImage = "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAACuFBMVEUAAADfceHPce3tcdfxcdTJcfL0cdLucdbTcevucdbNce/hceDhceDQce3tcdfkcd7LcfDycdPncdvNce/Pce7KcfHeceLNce7ycdPtcdfLcfDycdPgceHLcfDPce7KcfHTcerpcdrkcd7LcfDycdTacebKcfHXcejncdvKcfHucdbRcezscdjPce3JcfLeceLPce3tcdfeceLzcdL0cdLKcfLNce/YcebycdPscdfXcefZcebRcezUcenxcdTYcebkcd3ycdPycdPLcfDncdvqcdnKcfHaceXicd/Mce/ScevdcePfceHTcerpcdnaceXicd/ycdPrcdjwcdTbceTUcenocdrxcdTrcdjwcdTycdPaceXzcdLJcfHzcdLhceDzcdLycdPzcdLWcejycdPLcfDTcerjcd7eceLWcejXcefKcfHycdPXcefJcfL0cdHJcfHdcePacebScezVcenqcdrMcfDgceHiceDYcefncdzQce3Pce7lcd3vcdXvcdbcceXkcd/XcejscdjTcerocdvycdTOce/xuO/tcdfxcdXfcePrcdj32/jzuO7rcdnUcev87fvhle7////65PnopvD12/nmleruuPHhg+fkpvLppe7zr+r44Pn2zvT2yvPwvfP1xvHmpvHKcfHklOzxpunsnunkjOnunufrlebfeubrjOPxlOLrg+D99v352/fqufX40/TsuPPssvHLcfHejO3ag+3onuzchOzWeuzspOvfhOnnjOXniOTieePretzqdtvtdtn66fvy0vjwyfbzyvTytO3uru3Tdu3plejnkejxoufig+bhf+bmg+TtiODogeDtetr41/bquPTwwfPzwfHjnvD2we/1vO71uOzlmezvoujjh+fwnOXlf+Loet798vz02/rz0/j10/bvwfTqq+/tjODxg9vR2o3mAAAAcXRSTlMAIffvQiEh+OHhwWpC/Pz28/Py8O3m5eHd1cvLt7KqmJeXlZOTkIWFg2pgVElDQTUlJRG2Ukr5+fn28/Pw8PDn5+fl4ODg2tra1dXLy8rKw8PDwMC0sLCwqqqZl5eNjYqGg2tpaWBgVE5JQDU1IBERuWcZwdEAAAR5SURBVEjHjZT1XxNxGMe/bFPGpqKA0t0oInZ3d3d3KzEOpoBKeAic3hgxNlJKOqS7u+zu+Dd87ry9bgLbfH5+f557f7/P8z00oma5n7O3EhgbcThGfIGVzXn3WUhDjbsyz8na0myTsSFn4kTOUv7mbftsnC95XFMbmOlqv8bQz+/+/du3b93y8fF5FOq7jO945rKa9tOdpk72g6Jwmg8N9fX1vReweIXzdJ1R+PVxrtaCyfNpnu0P/L2ABUt2HBHqzB7Zf6bl+seAg88IPsDb23vD3gkjvjHvmNnjp2P50PydO15bHC/+43Ps5lTgR/soea9p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jv19cee166jp1kf9hsXXFYajD2vk3Oh/1g1QWi31uBfn+UmDmd5SF3peMxwsd2/3XQdd9GkSbpcPVPzA4dPzbgK7dWXJ8/N9uBuPa4u8HsOObjxPEcAfwDz04J8RzQksQAAAABJRU5ErkJggg==)";
  //The lines below are the CSS for the copy button
  titleElem.setAttribute("style", "display: inline-block;");

  //The line below defines where the button should appear
  header.appendChild(chiakiButton);
  //The line below is closing the whole function
})();