-
Notifications
You must be signed in to change notification settings - Fork 15
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
Does not convert 'F' unit #8
Comments
|
@getsnoopy could this be added as an option (pretty please), although it not being "scientifically correct". Similar to #14 usually people on reddit, and some recipe sites, only write out 100F instead of the correct 100°F |
Well the correct formatting would be |
Yep, I think it would be best as an optional setting for those who are not as strict with their units :) For now I just wrote my own lazy TamperMonkey script that does the same: // ==UserScript==
// @name F->C convert
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Crude conversion of **F into Celsius equivalent
// @author You
// @match *://*/*
// @grant none
// ==/UserScript==
(function () {
'use strict';
const regex = /(\d+)F/gi;
const fahrenheitToCelsius = fahrenheit => (fahrenheit - 32) * 5/9;
var convertUnits = function () {
let paragraphs = document.querySelectorAll("p");
function farenheitReplace(match, p1, p2) {
return p1 + 'F【'+ Math.round(fahrenheitToCelsius(p1)*10)/10 + 'C】';
}
for (let i = 0; i < paragraphs.length; i++) {
paragraphs[i].innerHTML = paragraphs[i].innerHTML.replace(regex, farenheitReplace);
}
}
convertUnits();
})(); |
Hello and thanks for this extension!
Many Murkans fail to understand that their temperature unit is "degrees Fahrenheit" and just say things liek
100F
instead of100°F
. This extension does notice or convert these. could that be fixed?Thanks!
The text was updated successfully, but these errors were encountered: