QOAL / localisetime

A web extension for localising times found in web pages
GNU General Public License v3.0
14 stars 0 forks source link

Detect website timezone, offer conversion? #4

Closed lee-b closed 4 years ago

lee-b commented 4 years ago

This is a great augmentation for many sites. Thanks for building it.

Could I suggest also detecting which timezone a site is in, and (optionally) translating local times given (without timezone info)? The Date: header sent in responses includes timezone information, for example.

Even just a right-click->convert timezone->From CST/From BST/etc. would be helpful, or an option to set the local timezone for certain sites and auto-convert them.

QOAL commented 4 years ago

Hello,

The first suggestion of auto-detecting use page headers is a no-go, mostly because all page headers must use GMT for their times. I'm not aware of any way of automatically detecting a timezone on a webpage, and even then user generated content could be for any timezone, so it wouldn't be fool proof across the whole internet.

Both of your second suggestions have crossed my mind, so I'd like to see them happen too! I've only very briefly looked into context menus and options pages for web extensions but that's certainly the way forward here. I'll have a fiddle.

QOAL commented 4 years ago

I've just pushed 1.7 to a new branch (ecf6173), if you'd like to take it for a spin.

It added a button to the toolbar which you can select the source time zone from. I did look at using the context menu, however populating a submenu with ~50 entries is not a good look. I also tried adding an in page UI, but I felt it wasn't the cleanest thing to do. This could feature could be expanded on by having an option to remember a time zone for a domain, and then use it on page load etc. (I think there's a little issue with Chrome, my simple way of checking if the extension can run on the page doesn't seem to work.)

lee-b commented 4 years ago

Ah, that's great! Thanks. I'll try it out and get back to you :)

Although... seems I can't just install the zip downloaded from github like I'd hoped. A bit of reading tells me I need a manifest.json or something *.chrome, and some sort of signature.

Any chance you could build an xpi? :)

I did some trawling through RFCs re: the date header, because I'd seen a Date:.*CST header on a news site before making this ticket. Seems you're right, and that site is wrong. It's a pity, but.. oh well :)

QOAL commented 4 years ago

You can load it by decompressing the zip, clicking "load unpacked", then navigate into the extension's folder and click select folder.

Please use the latest commit (1.7.1) 0720231 as it fixes compatibility with Chrome. (Oops!)