initial commit

Signed-off-by: Martin Matous <m@matous.dev>
This commit is contained in:
Martin Matous 2022-03-31 20:59:21 +02:00
commit c4c0be94b0
Signed by: mmatous
GPG key ID: 8BED4CD352953224
7 changed files with 82 additions and 0 deletions

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
node_modules
package-lock.json
web-ext-artifacts

3
.web-extension-id Normal file
View file

@ -0,0 +1,3 @@
# This file was created by https://github.com/mozilla/web-ext
# Your auto-generated extension ID for addons.mozilla.org is:
{3bec3738-3f4b-4517-8396-59b3b5e6f6f7}

24
LICENSE Normal file
View file

@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org/>

21
README.md Normal file
View file

@ -0,0 +1,21 @@
# unfdom
Fix *.fandom.com gallery browsing.
Fandom's lightbox unnecessarily crops
images even on high enough screens while middle-click and opening in a new tab
redirect back to the page without opening the image.
Unfdom changes the latter and makes images open in a new tab.
## Build
```
web-ext build
web-ext sign --api-key=<API_KEY> --api-secret=<API_SECRET>
```
Both key and secret can be found after registering at http://addons.mozilla.org/.
## License
[The Unlicense](LICENSE)

17
manifest.json Normal file
View file

@ -0,0 +1,17 @@
{
"manifest_version": 2,
"name": "unfdom",
"version": "1.0",
"description": "Fix *.fandom.com gallery browsing",
"author": "Martin Matouš",
"homepage_url": "https://codeberg.org/mmatous/unfdom",
"content_scripts": [
{
"matches": ["https://*.fandom.com/*"],
"js": ["unf.js"]
}
]
}

5
package.json Normal file
View file

@ -0,0 +1,5 @@
{
"dependencies": {
"web-ext": "^6.8.0"
}
}

9
unf.js Normal file
View file

@ -0,0 +1,9 @@
const galleryElements = document.body.querySelectorAll('a.image.lightbox')
for (const elem of galleryElements) {
const thumb = elem.querySelector('img.thumbimage.lazyload')
const src = thumb.getAttribute('data-src')
const needle = '/latest'
const fullImage = src.substring(0, src.indexOf(needle) + needle.length)
elem.setAttribute('href', fullImage)
}