// ==UserScript== // @name Mangadex Thumbnail Preview // @namespace https://github.com/kvnxiao // @version 0.1.2 // @description Thumbnail preview addon for Mangadex // @author Kevin Xiao // @match https://mangadex.org/follows // @grant none // @require https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.min.js // @downloadURL none // ==/UserScript== "use strict"; // convert html nodelist to js array function toArray(obj) { const array = []; for (let i of obj) { array.push(i) } return array; } // create div for vue to bind to const body = document.getElementsByTagName("body")[0]; const div = document.createElement("div"); const vueId = "vue-addon"; div.id = vueId; body.appendChild(div); // retrieve manga anchor links const p = document.getElementsByClassName("chapter-container")[0]; const rows = p.getElementsByClassName( "col col-md-3 row no-gutters flex-nowrap align-items-start p-2 font-weight-bold border-bottom" ); const links = toArray(p.getElementsByTagName("a")).filter(it => it.getAttribute("href").startsWith("/title/") ); // instantiate an eventbus to communicate from webpage to vue instances Vue.prototype.$eventbus = new Vue(); const HOVER_EVENT = "hover" const LEAVE_EVENT = "leave" const HoverThumb = { template: `