Archive for the ‘javascript’ Category
Google Chrome Promoted on the Most Valuable Online Property
Google’s new browser Google Chrome is being promoted on arguably the most valuable property on the web – Google Homepage.
The browser itself is “google cool” with Javascript applications performing much better. Flash performance seems a bit sluggish. Need a password manager and status bar perhaps, and a Linux version of course.
The open source project behind Chrome is called Chromium. The rendering engine is Webkit, and Javascript “monkey” is a new JS virtual machine V8.
Internet Explorer’s Trailing Comma Woes
Internet Explorer is notorious for breaking on trailing commas in JavaScript array declaration. e.g.
var obj = {
a: 1,
b: 2,
};
fails on IE, while all other browsers just ignore the innocuous trailing comma after second element.
Weeding out these commas from JavaScript code is absolute PITA. However, here is a regular expression search string I wrote to search such instances in the code.
,\s*\n+\s*[\}\)\]]
Even better,
,\s*\n+(\s*\/\/.*\n)*\s*[\}\)\]]
matches multiple new lines and comments.
Safari on Windows Crashes Too Often
I’m not much of a fan of Apple softwares on Windows. I like iTunes though, even if it’s a bit bulky. I’ve tried using Safari on Windows for its super pleasing font rendering, aesthetics and, of late, some testing on WebKit/KHTML. However, it crashes just too often to be of any serious use and, of course, doesn’t have any DOM inspector. It has a barely usable JavaScript console though.
On a side-note, I’ve read that Safari can work on Linux under Wine. I’ll give it a try sometime. Now, if only I could run iTunes under Wine 🙂 .
Compiling Greasemonkey Scripts to xpi (Firefox Extension)
This page has a tool to create a Firefox extension (.xpi) from a greasemonkey script.
http://arantius.com/misc/greasemonkey/script-compiler
Bulls**t
This fscking awesome greasemonkey script to uncensor the Internet. Ingenious.
Need Firefox extension to open xls in Google Spreadsheet
I need one Firefox extension/greasemonkey script to add an option to open xls/doc links directly in Google docs & spreadsheets. This is something Google itself should be providing like they do in Gmail. Perhaps, I’ll write one myself in case I can’t find it.
[Update]– Whooaa! Same day Google releases its Firefox toolbar (beta) with this exact same functionality I’m looking for and have blogged. Now, is it just one wish a day, or – I want to be king 😀 , please.
Quick Proxy Browsing
When: Your ISP is stupid enough to block sites it shouldn’t.
How: Create a bookmarklet of the following JavaScript code. All the line breaks below needed to be removed for this to work.
javascript:void((function(){window.location.href=
'http://www.boxofprox.com/index.php?q='+base64_encode(window.location.href);})());
function%20base64_encode(str){
var%20alnum='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._';
var%20out='';var%20t,x,y,z;for(var%20i=0;i<str.length;i+=3){t=Math.min(3,str.length-i);
if(t==1){x=str.charCodeAt(i);out+=alnum.charAt((x>>2));
out+=alnum.charAt(((x&0X00000003)<<4));out+='--';}
else%20if(t==2){x=str.charCodeAt(i);y=str.charCodeAt(i+1);
out+=alnum.charAt((x>>2));out+=alnum.charAt((((x&0X00000003)<<4)|(y>>4)));
out+=alnum.charAt(((y&0X0000000f)<<2));out+='-';}
else{x=str.charCodeAt(i);y=str.charCodeAt(i+1);z=str.charCodeAt(i+2);
out+=alnum.charAt((x>>2));out+=alnum.charAt((((x&0x00000003)<<4)|(y>>4)));
out+=alnum.charAt((((y&0X0000000f)<<2)|(z>>6)));out+=alnum.charAt((z&0X0000003f));}}
return%20out;}
This little code lets one browse with a base64 encoded url to bypass any phrase blocks. Use it on your own risk etc. Thanks ‘someone unknown’ for base64 encoding function.