Static site for www.olane.uk
This is a 100% static site - there's no build. It's hosted on github pages via the master branch.
Chrome extension to replace web page dates and prices with a localised version.
Static site for www.olane.uk
This is a 100% static site - there's no build. It's hosted on github pages via the master branch.
Currently the program ignores <iframe>
s, but still converts other tags, like <script>
and <style>
, that do not contain data that is displayed to the user and therefore should not be converted.
For example, on this page when you run the conversion, a string that looks like a price in a <style>
tag containing CSS for social media buttons is converted, breaking the CSS and the appearance of the social media buttons as a result.
Ignoring these tags would also have the added benefit of making the program run faster.
We should create a list of all tags that should be ignored, then implement this.
As a minimum we should start with <script>
and <style>
.
This bug has always been present, but I didn't see it until I made the currency acronym detection case-insensitive, which has in fact turned out to be a great way to discover several bugs.
On this page, for example: http://www.theverge.com/2012/8/2/3215238/the-vergecast-is-live-today-1-30-pdt-4-30-edt-8-30-gmt-9-30-bst?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+ThisIsMyNextPodcast+%28The+Vergecast%29
Tried setting the hoverStyle's z index higher than the image it appears behind, but it didn't make a difference. There isn't an upper limit to CSS z-indexes, is there?
Eg. "BST (UTC+0100)"
The options page looks fine right now, but it would be nice to make it match the look of the default Chrome settings page a bit more. However, I'm reluctant to do that manually because there are plans to add some default styling to extension's options pages. Doesn't seem very active though, so I'm not sure how far off it is.
Additionally, the interface could be easier to use. I'm not sure a drop-down is the right way to choose between hundreds of time zones, maybe an auto-completing text box and some validation? We could use Chosen for this.
To specify the list of URLs it would also be great to have something like this, where there are separate text boxes for each URL and a button to add a new one. Again, reluctant to do this manually because it may be supported by default in future, but we could be waiting a while.
Currently the script is run when the extension's icon is pressed.
If we decide to continue with this, it would probably be best to make a second click restore the page.
Alternatively, if it isn't too slow, the script could run on every page, or just a user specified list (common foreign shops, blogs, podcasts etc.)
The method Chrome uses for language translation of showing a bar when the page is in a foreign language wont work, because basically every page ever has a dollar sign on it so it'll get annoying.
If it runs on every page or a list of pages, the extension's icon should display a popup with a button in it to reset the page to the original.
It would be trivial to just add an optional opening parenthesis before and an optional closing one after, but this would mean that strings like "8:32 (GMT" would be valid.
This could be a good thing, converting times where people have typed sloppily, but it could introduce more bugs.
It would be more difficult to enforce having either both parentheses or neither. I'm not sure you can do this with regular expressions, apart from having the entire list of acronyms in there twice, once with parentheses around and once without. This seems like it would run at half the speed, and would also not be very scalable (do we add the list a third time to support square brackets?)
Other solutions, like incrementing a counter for every opening parenthesis and decrementing it for every closing one and checking if the total for the string is zero also sound slow, and overkill for a relatively rare format.
It seems like the best solution is to just support unmatched parentheses, but then if we add square brackets in future it would allow strings like "10:32 [GMT)".
Again, debatable whether this is a good thing or not. I'm leaning towards just allowing them unmatched, and reconsidering if it causes any problems.
Due to cross-domain security restrictions you can't manipulate the content of an iframe on another domain, so we can't convert the prices and times. However, you can read the contents, so we could still check if there are prices and times within an iframe, and show a message to the user saying that they could not be converted.
Optionally also have a link to open the iframe's url in a new tab so that it can be converted there. This might not be the best idea, most stuff in iframes would look weird on its own.
Also, currently the extension is ignoring all iframes, but I'm pretty sure you can manipulate the DOM of iframes on the same domain as the parent page, so if there's a demand for it we could add support for this.
Essential if we decide to run on every page.
Even if not, it would make it easier to stay on the free API plan, exchange rates don't change much in an hour.
Can use localStorage for this.
This means there is still an 'original time' popup, with the same value as the converted one.
This is not a huge problem, but it would be pretty easy to fix and would be nicer if times and prices that are already in the user's locale just don't get converted at all.
List of time zones needs sorting alphabetically.
Currently just highlighted in red. The mouseover box should be small and visually simple, displaying only the original text.
£10 million et al. will be harder to implement, might just stick with purely numerical values initially, with more options in a 0.2 release or something.
To restore the page to its original state the second time the user presses the button, the entire body element is replaced with an earlier version saved with jQuery.
I thought that this would preserve all scripts and event handlers, but on Google Reader (and presumably other sites) all interaction stops working.
Not sure what the solution is to this - it's not as though it's being replaced from a string of HTML, it's the original DOM element saved with $('body');
. You could just make the second press reload the page, but then you may as well not have it at all.
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.