Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I made a similar Greasemonkey custom script #5

Open
foriequal0 opened this issue Jun 24, 2020 · 0 comments
Open

I made a similar Greasemonkey custom script #5

foriequal0 opened this issue Jun 24, 2020 · 0 comments

Comments

@foriequal0
Copy link

Thank you for making an awesome Too Wide!. It has eased my eyes countless times.
There were some features that I hoped to have such as persistence (now it does have), but I was shy to contribute to your work.
While I was inspired by your previous version, I've made a Grease monkey custom script for myself.
https://gist.github.com/foriequal0/12794f45f5ef60249e8ba36f978dfaa4
I'm wondering whether you might be interested in some experimental approaches that mine has.

  1. It travels the DOM and make a heuristic decision based on getClientRects and text lengths. (although it has some false positive such as a lenovo website)
  2. It iteratively clamps the root document to match the target width for complex and poorly responsive documents.
  3. The target width is calculated with relative to the text size (in my script, it is 50em), not fixed pixel width.
  4. It applies following css to the document
:root {
  max-width: ${width}px;
  position: absolute;
  left: calc(50% - ${width}px / 2);
  transform: translate(calc(${width}px / 2 - 50%));
}`

It makes some difference on some elements that have position: fixed.
position: absolute & left & transform
image
Too wide!
image
Page: https://ko.wikipedia.org/wiki/%EA%B7%80%EC%9D%B8_%EC%9D%B4%EB%A1%A0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant