VNDB Cover Preview

Previews covers in vndb.org searches when hovering over the respective hyperlinks.

< 脚本 VNDB Cover Preview 的反馈

评价:好评 - 脚本运行良好

§
发布于:2022-06-05
编辑于:2022-06-05

(contribution) Reduce the number of requests

Thanks for the useful script.

If you apply the following changes you can prevent the script from requesting resources that it doesn't need.
Uses domparser to parse the dom instead of jquery. Also switched to querySelector which is a nicer way to find the node that you need.

  //....This is around line ~80

  $.ajax({
     url: pagelink,
     dataType: 'text',
     success: function (data) {
        // Convert the HTML string into a document object
        var parser = new DOMParser();
        let dataDOC = parser.parseFromString(data, 'text/html');

       // Grab character image
       if (pagelink.search(CharacterLinkTest) != -1){
           var imagelink = dataDOC.querySelector(".charimg img").src;
       }
       // Grab visual novel cover
       else{
           var imagelink = dataDOC.querySelector(".vnimg img").src;
       }

   //....script continues

Kuro_scripts作者
§
发布于:2022-06-05

Thanks for the contribution! This is nice. Gonna add it in. :>

发布留言

登录以发布留言。