Giter VIP home page Giter VIP logo

Comments (11)

elmart avatar elmart commented on August 22, 2024

I'm having this same problem. Really annoying. But, after some investigation, I've realized the problem doesn't show up because of using the zoom, but more specifically, because of having an initial default zoom.

I mean, if you, as I, use the typical trick to set an initial zoom level (a user stylesheet, as described here), then you get the wrong behaviour.

But, if you remove the user stylesheet, then this extension behaves well, even if you use zoom once the page has loaded. Below is a screenshot of the same page above, with two zoom-in levels applied.

screen shot 2

So, that doesn't fix the problem yet, if you (like me) want to have a default zoom level. But, while a fix is available, it's perhaps worth knowing you can just disable your user stylesheet to have vimari working well.

Because you also have a user stylesheet, don't you? ;-)

from vimari.

joshvoigts avatar joshvoigts commented on August 22, 2024

Yeah, I did realize that I could disable the stylesheet, I'm actually using ZoomBySite which is probably interfering with it. It would definitely be a nice limitation to overcome. Google Chrome's built in zooming remembers your zoom level per site, but Safari doesn't which is kind of a pain since you have to re-zoom-in each time you go to the same site.

from vimari.

elmart avatar elmart commented on August 22, 2024

I've been browsing the source and am pretty sure this could have an easy solution just if it were possible to find out the initial zoom level by means of javascript.

In injected.js, line 23, you can read:

currentZoomLevel = 100

That's a global var that never gets touched again.
I've modified it locally to 150, which is the zoom level my user stylesheet sets, and it works perfectly.

So, the ideal thing should be to be able to, at that point in code, dynamically determine current zoom level through javascript, and setting that var to the proper value.

Unfortunately, I've been looking for a way to do that, and it seems currently it's impossible. There seems to be no javascript API to access that.

I've opened a question in the Safari developer forum: https://devforums.apple.com/thread/213645?tstart=0
Let's see if somebody answers. It seems a very slow forum.

from vimari.

guyht avatar guyht commented on August 22, 2024

Setting the zoom level in injected.js will work for a page with a set zoom level, but not if you change the zoom level once the page is loaded. A better place to check would be

https://github.com/guyht/vimari/blob/299671dcc184b94f4cf4ed808cbbb28cb557a831/vimari.safariextension/linkHints.js#L334

which is where the link hints are actually rendered.

Actually detecting the zoom... so far google is not showing up much :(

from vimari.

elmart avatar elmart commented on August 22, 2024

Well, yes, what you (@guyht) say was what seemed logical to me at first: to adjust the zoom factor when rendering link hints.

But, for reasons I don't understand quite well right now, it works ok for me if the initial zoom level is correctly set.
It seems that changing zoom after page load (through Cmd+,Cmd-,Cmd0) doesn't affect what can be seen through javascript, nor rendering calculations.

It's as if.... javascript was operating in one coordinate system, and the zoom level changed by Cmd keys operated in another, completely orthogonal/independent from the first one. Which would be the reason why you can't access the current zoom level through javascript.

Really weird. That's why I opened that question at the dev forum. To see if somebody knows if there are two different, non related, zoom mechanisms, which, to me, would be the only logical explanation to this all.

Anyhow, I'm a bit confused now. I will recheck what I've said to see if it really holds.

from vimari.

guyht avatar guyht commented on August 22, 2024

@eliseomarmol I think what you said initially was correct, I was just mentioning that if we want it to keep up with zoom changes post page load we will need to update it in linkHints.js

from vimari.

joshvoigts avatar joshvoigts commented on August 22, 2024

I know that he ZoomBySite extension uses the javascript zoom level because it intercepts the cmd + and cmd - to adjust the zoom level. I can't say the same for a user defined style sheet though which probably initially uses the javascript zoom level and then afterwards changes are made using safari's zoom.

from vimari.

elmart avatar elmart commented on August 22, 2024

I've had no luck by now.

This StackOverflow question was the best info I got. I tried several things mentioned there:

  • document.width / document.body.clientWidth did the trick for some sites, but not all (failed for those with no doctype, for example).
  • I tried using this code, with no luck either.

In fact, this project seems like authoritative to this respect, and there, it says that recent browser changes make this endeavour nearly impossible. I think we should perhaps contact tombigel, to get high-quality and updated info regarding this incredibly confusing but apparently simple matter. Maybe it's impossible for all browsers in general, but we only need webkit here...

from vimari.

guyht avatar guyht commented on August 22, 2024

How do people generally use the zoom level? Is it set per site, or is it constant across all sites? If the latter then we could add an option to vimari to manually set the zoom level,

from vimari.

joshvoigts avatar joshvoigts commented on August 22, 2024

I tend to set different zoom levels across different sites depending on how the site is laid out (some sites don't allow a lot of flexibility this way). Chrome remembers zoom levels for each domain, but Safari doesn't seem to do this unfortunately, hence the ZoomBySite extension.

from vimari.

danielcompton avatar danielcompton commented on August 22, 2024

Is this still an issue? I'm not totally clear on what the issue is, and what the prerequisites are to trigger it.

It looks like Safari 12/13's zoom does work per-site. I can see that the link hints don't line up if you have them open before zooming, but cancelling and then pressing f again make them show up aligned.

We might be able to detect zoom events and make the links re-display, but I'm not sure if that's the issue being described here?

from vimari.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.