Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Multi-page viewer question

 
post Aug 22 2019, 07:27
Post #1
SpawnedOverlord



CGDCT addict
***
Group: Gold Star Club
Posts: 151
Joined: 7-June 16


Is there a way to make the viewer stop showing the filenames near the mouse every time you hover the mouse over a new page?

Like this:

[files.catbox.moe] https://files.catbox.moe/4f4m2z.png

It's kinda annoying when you're trying to read tiny Japanese texts and it keeps blocking it...

This post has been edited by SpawnedOverlord: Aug 22 2019, 07:32
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Aug 22 2019, 23:57
Post #2
blue penguin



in umbra, igitur, pugnabimus
***********
Group: Gold Star Club
Posts: 10,046
Joined: 24-March 12
Level 500 (Godslayer)


Something like
CODE
for <element in DOM>
if el.hasattr('hover'):
    el.removeAttribute('hover')
would work.

P.S. you will need a less drunk coder to actually write a script (IMG:[invalid] style_emoticons/default/smile.gif)
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Aug 23 2019, 00:33
Post #3
Mayriad



SUPER ★ BUSY ★ TIME
*******
Group: Global Mods
Posts: 2,061
Joined: 18-December 10
Level 135 (Lord)


It is a bit of a hassle. The tooltips come from the title property of imgs, and these are obviously dynamically loaded in MPV, so you will probably need to do something like adding an observer to dynamically remove the title property from newly loaded images.

Adding "div.mi0 > a > img { pointer-events: none; }" to global CSS will disable these tooltips instantly, but then the "left click to go to next image" feature will be disabled for these images as well, and you can only click the tiny anchor strip at the bottom of each image to go to next.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Aug 23 2019, 01:06
Post #4
Shank



Roll for Initiative
**********
Group: Global Mods
Posts: 9,039
Joined: 19-May 12
Level 500 (Ponyslayer)


QUOTE(mayriad @ Aug 22 2019, 23:33) *

It is a bit of a hassle. The tooltips come from the title property of imgs, and these are obviously dynamically loaded in MPV, so you will probably need to do something like adding an observer to dynamically remove the title property from newly loaded images.

Adding "div.mi0 > a > img { pointer-events: none; }" to global CSS will disable these tooltips instantly, but then the "left click to go to next image" feature will be disabled for these images as well, and you can only click the tiny anchor strip at the bottom of each image to go to next.


I'm not a coder so please feel free to laugh me off if this is a stupid/impossible idea,
Is it possible to just set the title="whatever" to title=""? Or even just remove title="whatever" altogether?


Trying through the console setting title="" was enough to stop it in a chromium browser

This post has been edited by Ubershank: Aug 23 2019, 01:09
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Aug 23 2019, 01:23
Post #5
Mayriad



SUPER ★ BUSY ★ TIME
*******
Group: Global Mods
Posts: 2,061
Joined: 18-December 10
Level 135 (Lord)


I'm also not a coder so please feel free to laugh me off as well.
QUOTE(Ubershank @ Aug 23 2019, 01:06) *
I'm not a coder so please feel free to laugh me off if this is a stupid/impossible idea,
Is it possible to just set the title="whatever" to title=""? Or even just remove title="whatever" altogether?
Trying through the console setting title="" was enough to stop it in a chromium browser

Yes, you can just do "element.removeAttribute('title')". The problem is you cannot do this right away, because the a and img elements are only created and appended to div.mi0 on demand (mainly as you scroll down), and you have to set up something like an observer to automatically do this to newly loaded images.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Aug 23 2019, 01:58
Post #6
Shank



Roll for Initiative
**********
Group: Global Mods
Posts: 9,039
Joined: 19-May 12
Level 500 (Ponyslayer)


QUOTE(mayriad @ Aug 23 2019, 00:23) *

I'm also not a coder so please feel free to laugh me off as well.

Yes, you can just do "element.removeAttribute('title')". The problem is you cannot do this right away, because the a and img elements are only created and appended to div.mi0 on demand (mainly as you scroll down), and you have to set up something like an observer to automatically do this to newly loaded images.



I don't claim to have a clue on to what that means lol. By observer, do you mean something that repeatedly checks to see if something has changed, and reapplies the script when it does? I'm not asking because I hope to make something that works, but just out of curiosity.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Aug 23 2019, 19:57
Post #7
Mayriad



SUPER ★ BUSY ★ TIME
*******
Group: Global Mods
Posts: 2,061
Joined: 18-December 10
Level 135 (Lord)


QUOTE(Ubershank @ Aug 23 2019, 01:58) *
By observer, do you mean something that repeatedly checks to see if something has changed, and reapplies the script when it does? I'm not asking because I hope to make something that works, but just out of curiosity.

Yes, except the mutation observer just reapplies the callback function (named "onSubtreeChange" in the code below) instead of the whole script. This is how it works:

CODE
// ==UserScript==
// @name            EH Hidden MPV Tooltips
// @namespace       https://github.com/Mayriad
// @version         1.0.0
// @author          Mayriad
// @description     Disables the filename tooltips on main images in MPV
// @include         https://e*hentai.org/mpv/*
// @run-at          document-end
// ==/UserScript==

/* global MutationObserver */

;(function () {
  const onSubtreeChange = function (mutations) {
    for (const mutation of mutations) {
      if (mutation.addedNodes.length === 0) {
        // Do nothing when the images get dynamically removed.
        continue
      }
      for (const addedNode of mutation.addedNodes) {
        // Remove the title attribute from div.mi0 > a > img[id ^= "imgsrc_"] to remove the tooltip when a is loaded.
        if (addedNode.nodeName === 'A') {
          const mainImage = addedNode.querySelector('img[id ^= "imgsrc_"]')
          if (mainImage !== null) {
            mainImage.removeAttribute('title')
          }
        }
      }
    }
  }
  const mpvObserver = new MutationObserver(onSubtreeChange)
  mpvObserver.observe(document.getElementById('pane_images_inner'), { childList: true, subtree: true })
})()

Aaannnd I have completed the feature request. Do you guys think people (besides OP) will need this feature though? I do not, but I would add this to my master script if it is deemed helpful enough.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Aug 23 2019, 20:24
Post #8
Shank



Roll for Initiative
**********
Group: Global Mods
Posts: 9,039
Joined: 19-May 12
Level 500 (Ponyslayer)


QUOTE(mayriad @ Aug 23 2019, 18:57) *

Yes, except the mutation observer just reapplies the callback function (named "onSubtreeChange" in the code below) instead of the whole script. This is how it works:


Cheers for the info (IMG:[invalid] style_emoticons/default/smile.gif)

QUOTE(mayriad @ Aug 23 2019, 18:57) *

Aaannnd I have completed the feature request. Do you guys think people (besides OP) will need this feature though? I do not, but I would add this to my master script if it is deemed helpful enough.


I'll be using it occasionally, since one of my computers it isn't convenient to use the keyboard to navigate.

User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Aug 25 2019, 09:17
Post #9
SpawnedOverlord



CGDCT addict
***
Group: Gold Star Club
Posts: 151
Joined: 7-June 16


QUOTE(mayriad @ Aug 23 2019, 14:57) *

Aaannnd I have completed the feature request. Do you guys think people (besides OP) will need this feature though? I do not, but I would add this to my master script if it is deemed helpful enough.


It's one of those things no one thinks is useful, until you deploy it.
And thanks for your hark work!
User is offlineProfile CardPM
Go to the top of the page
+Quote Post


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 


Lo-Fi Version Time is now: 2nd April 2025 - 19:29