limmlingg / i-m-a-converter Goto Github PK
View Code? Open in Web Editor NEWA chrome extension that automatically converts from Imperial units to Metric and vice versa
A chrome extension that automatically converts from Imperial units to Metric and vice versa
In the feet and inches test page, the title and highlight of the last measurement of 123'53" shows 123' only.
When I console.log() the regex matches in conversion.js
: extractFeetAndInchesNum(str)
, both 123 and 53 are detected. The conversion is also for 123'53".
This is likely caused by addFeetAndInchesTitles()
incorrectly calling setTitle()
in conversion.js
. Should be an easy fix.
For example: http://btobits.com/fixopaedia/fixdic44/tag_35_MsgType_.html
It reads '0'
, '1'
etc. as feet.
We should add a way to check if the number is enclosed by opening and closing quotation marks and not convert it.
Noticeable on sites like https://www.metric-conversions.org/temperature/fahrenheit-to-celsius.htm.
Can also be observed in the feet and inches test page.
When looking at the modified HTML, you can see that the title takes on a weird value:
title="<strange number carried over from somewhere> <f2ctag style="..........
When I console.log the title in the method, it gives me what I expect i.e. 212°F = 100°C
. Maybe something is wrong with my innerHTML.replace()? We might need to explore using a different method to do conversion.js
: setTitle()
.
For example: https://en.wikipedia.org/wiki/Fahrenheit, and a Google search for "fahrenheit".
Based on the console.log output, the extension successfully detects the temperatures and converts them. The issue is very likely because of the HTML between the number and the unit, so innerHTML.replace() doesn't work.
For instance, on Wikipedia, the temperature 32 °F is written as 32 °F
in HTML.
On Google, some site descriptions have the number in bold, but not the unit, or vice versa.
This issue will likely require major refactoring.
When a page updates, e.g. the user types in 10 °F
into the Google search bar, the unit translator should detect it and convert it too.
An easy way is to call addTemperatureTitles()
again when the browser detects that the page changed. However, this will probably cause issues for existing conversions as the <f2c>
tag will be applied twice to the same part in the HTML because of the innerHTML.replace()
in setTitles()
.
This issue likely requires some rewriting of setTitles()
or an extra step during parsing to check if the temperature already has the <f2c>
tag.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.