Posts Tagged ‘chrome’
Links^2 – September 13th, 2010
Monday, September 13th, 2010- The Official Guide to HTML5 Boilerplate
- Stylebot – a Chrome extension that lets you customize any site’s CSS, like Firefox’s Stylish, or a Greasemonkey for CSS. Great WYSIWYG UI.
- Firefox 4.0 beta 5 – I’ve been using FF 4 since beta 2, and I’m very pleased. In order to have all add-ons skip the version check, go to the url
about:config, create a new boolean key namedextensions.checkCompatibility.4.0bwith the value offalse. Restart FF and most of the add-ons will work. - CSS3 Playground - Yet another CSS3 WYSIWYG
- SmartGit – A UI client for Git. Available for Mac/Windows/Linux
Bug: Chrome’s for..in Loop Messes the Order of the Indexes
Tuesday, July 13th, 2010Yes. I know I should never rely on for..in loop order, but when it comes to inconsistency of browsers it can be annoying.
I found it out when I wanted to fetch the first key of an object, but got different results on chrome (incorrect result) and other browsers.
Code:
console.log("wordsAsKeys");
var wordsAsKeys={ words:"value",as:"value",keys:"value" };
for (var k in wordsAsKeys) console.log(k);
console.log("numbersAsKeys");
var numbersAsKeys={ "3":"value","2":"value","1":"value" };
for (var k in numbersAsKeys) console.log(k);
console.log("mixedKeys");
var mixedKeys={ "3":"value",words:"value","1":"value" };
for (var k in mixedKeys) console.log(k);
The Result:
Firefox / Safari / IE:
wordsAsKeys words as keys numbersAsKeys 3 2 1 mixedKeys 3 words 1
Chrome:
wordsAsKeys words as keys numbersAsKeys 1 2 3 mixedKeys 1 3 words
As you can see, the second and third loops enumerate on an object with numbers as indexes. What Google Chrome seem to do is treat the object as an Array, which outputs the numeric indexes first, in ascending order.
To me, it looks like a bug that may create inconsistency. Google & Chromium team – please fix it :)
Greasemonkey’s GM_getValue/GM_setValue functions for Google Chrome
Tuesday, June 29th, 2010[ Update, Mar 16th, 2011: Firefox 4's Greasemonkey changed GM_getValue and it doesn't support .toString() anymore, code updated accordingly. Added GM_deleteValue ]
As there’s no implementation for GM_getValue/setValue in user scripts (Greasemonkey) for Google Chrome, it makes a lot of user scripts unsupported.
Here’s a little code that brings the support of these methods to Chrome, by saving data in localStorage (HTML5′s way to store data on client side).
Include it in your Greasemonkey script to have it working on Chrome.
if (!this.GM_getValue || (this.GM_getValue.toString && this.GM_getValue.toString().indexOf("not supported")>-1)) {
this.GM_getValue=function (key,def) {
return localStorage[key] || def;
};
this.GM_setValue=function (key,value) {
return localStorage[key]=value;
};
this.GM_deleteValue=function (key) {
return delete localStorage[key];
};
}
This makes Google Reader Filter available for Chrome.