Metric default for book edit and entry

TalkHacking LibraryThing

Join LibraryThing to post.

Metric default for book edit and entry

1Keeline
Jul 17, 2025, 11:43 am

Another feature that has been requested for a while is an ability to default to metric units for length and weight. A conversion link is on the edit book page and the blank manual form. However, clicking it each time is tedious. So I have a TamperMonkey User Script that will call that function after the page loads.

convertPhysDescUnits(1); /* convert to metric */
convertPhysDescUnits(0); /* convert to English */

It seems to work as desired but I'd like to have some test it before putting it on something like GreasyFork as a storage. If you know some Javascript, look it over. It shouldn't have anything dangerous in it.

Once it is installed and active, each time an edit book or blank add book form is viewed, that function will be called to make the conversion. It won't change existing unit preferences in a book record. But it will save some clicking.

The script is 169 lines with lots of comments.

In Tamper Monkey you can turn a script on or off for testing or preference. You can also uninstall if it is not right for you.

If there is interest, I will provide a hosted link to a version of the code. I just want to be sure it is working well before putting it in a repository.

James

2Keeline
Jul 20, 2025, 1:03 am

Here is the promised script. It works for me on Chrome on the Mac with the TamperMonkey script.

You will need to download the Javascript (right-ckick save as) and then carefully copy the script into the TamperMonkey plugin while viewing an LT page.

There are instructions in the PDF.

Installation will be easier when this is distributed on GreasyFork but I first want to be sure several people use it and don't find issues before I distribute it in that fashion.

https://Keeline.com/pics/LT-Metric-1.0.js MD5: 5a2faf70d6b1a2e14f1160481048f48b

https://Keeline.com/pics/LT-Metric-1.0.pdf MD5: 743fc2669b1cfda9198a44f8ec784005

I hope this works for you and is useful. Be sure to read the documentation in the PDF.

James

3ngoomie
Jul 20, 2025, 1:42 am

Seems to work well on Firefox using Tampermonkey on desktop (Linux). Might see if I can give it a try on mobile Firefox later as well.