zombieFox / nightTab

A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks with nightTab.
https://zombiefox.github.io/nightTab/
GNU General Public License v3.0
1.71k stars 247 forks source link

Method to obtain background image source/URL for non-static background sources #434

Open MimikoM opened 8 months ago

MimikoM commented 8 months ago

What kind of feature request is this?

Feature improvements


Is your feature request related to a problem? Please describe.

Yes.

Background images from non-static source do not appear to have a method to obtain source image/URL.

In my case I have the background image set to a URL which automatically redirects to a random image each time nighttab is loaded (using this, specifically); I think this is also applicable to the built-in rotating image sources as well however. Regardless, the inability to access the source image prevents the user from having a way to save it, perform a reverse-image search on it (such as to find out who the artist is), etc. Sometimes I want to see more works from the artist of the current background image, but presently do not have a way to open that image or retain it in any way.


Describe the solution you'd like

A small button, icon, or other way of opening the current background image in a new window/tab. Copying the current background image's URL to the clipboard would also be acceptable.


Describe alternatives you've considered

Looked through page source and inspect element to try and see if the image source URL is accessible there, however I could not find any record of it. Can see HTTP GET request to the image URL that I provided in nighttab settings, but the response to this request is discarded by the browser immediately (response headers tab of inspector is completely blank) unless the inspector is already open on page load.

metruzanca commented 5 months ago

@MimikoM

Looked through page source and inspect element to try and see if the image source URL is accessible there, however I could not find any record of it. Can see HTTP GET request to the image URL that I provided in nighttab settings, but the response to this request is discarded by the browser immediately (response headers tab of inspector is completely blank) unless the inspector is already open on page load.

This is because the background is done via background image css property. You could extract it with getComputedStyle(document.documentElement).getPropertyValue('--theme-background-image') the only issue is that since the service you're using redirects to a new url, the browser internally follows the redirects and just never informs nighttab of them and just loads the image. Nighttab is as clueless as you are.