June 9th, 2009 . by Sajeev
check your browser version and type with below javascript. Browzor.versoion will give the version of the browser used.
JavaScript:
-
Browzor = {
-
version: (navigator.userAgent.match(/.+(?:rv|it|ra|ie|me)[\/: ]([\d.]+)/i) || [])[1],
-
IE : !!(window.attachEvent && !window.opera),
-
Mozilla: /mozilla/i.test(navigator.userAgent) && !/(compatible|webkit)/i.test( navigator.userAgent),
-
Netscape : !!document.layers,
-
Opera : !!window.opera,
-
WebKit : /AppleWebKit/i.test(navigator.userAgent),
-
Gecko : /gecko/i.test(navigator.userAgent) && ! /KHTML/i.test(navigator.userAgent),
-
Chrome: /chrome/i.test(navigator.userAgent),
-
MobileSafari : !!navigator.userAgent.match(/Apple.*Mobile.*Safari/),
-
Safari: /webkit/i.test( navigator.userAgent) && !/chrome/i.test(navigator.userAgent)
-
}
Posted in Technical, javascript | No Comments »
June 8th, 2009 . by Sajeev
This is really happy news of flash/flex developers. Skyfire says it can play both Flash 10 and Silverlight 2.0. Not sure how happy Adobe will be though, they’ve always resisted full Flash on mobile for “performance” reasons.
check for more details..
Posted in Graphical, Technical | No Comments »
June 3rd, 2009 . by Sajeev
This is some pretty impressive interactive technology:
Project Natal
Mr Spielberg said he had always stated that "the main barrier stopping people getting into video games was the complexity of a games controller," and that Natal was "a whole new world".
This is really true, I am not at all interested in playing game because of the same reason. And this technology seems to be really impressive. Hope to experience this in near future.
Posted in Technical | No Comments »
May 28th, 2009 . by Sajeev
Movie Name: Seetha (1960)
Singer: Susheela P
Music Director: Dakshina Murthy
Lyrics: Abhaya Dev
Year: 1960
Director: Kunjako M
Actors: Kushala Kumari, Latheef PA, Prem Nazir
Pattu padi urakam njan thamarappo paithale
Kettu kettu nee urangen karalinte kaathale
Karalinte kaathale
Ninnalee pulmadam poomeda yayeda (2)
Kanna nee enikku samraajyam kai vanneda
Vanneda (pattu padi)
Rajavaayi theerum nee oru kalam omane (2)
Marakkathe annu samjatham sree ramane
Ramane (pattu padi)
Rari raro rariro rariraro rariro
Posted in Uncategorized | No Comments »
April 6th, 2009 . by Sajeev
Check the syntax for window.setTimeout for mozilla and IE, u can see that it is different in both the browzor. Below is the one method, which will help in unifying this for both browzors.
Syntax
timeoutID = JavaScript.doLater(thisArg, func, delay, [, arg1[, arg2[, ...]]]);
JavaScript:
-
JavaScript = {
-
/*
-
* queue for later call
-
* target - target type object where method exist
-
* method - method to execute after delay milliseconds
-
* delay - is the number of milliseconds that the function call should be delayed by (default 0)
-
* use - JavaScript.doLater(this, method);
-
*/
-
doLater : function(target, method, delay)
-
{
-
delay = delay || 0;
-
var parameters = (Browzor.IE) ? [target, method] : [JavaScript.createProxy(target, method), delay];
-
for(var i = 3; i <arguments.length; i++) {
-
parameters.push(arguments[i]);
-
}
-
if(Browzor.IE) return window.setTimeout(JavaScript.createProxy.apply(JavaScript, parameters), delay);
-
else return window.setTimeout.apply(window, parameters);
-
}
-
}
Posted in Ajax, javascript | No Comments »
Below method can solve the problem of scoping issues with methods and passing parameters for a Delegated events
JavaScript:
-
JavaScript = {
-
/*
-
* delegate proxy method.
-
* target - target type object where method exist
-
* method - method to execute
-
* use - JavaScript.createProxy(this, method, [parameter,[...]]);
-
*/
-
createProxy : function(target, method)
-
{
-
if(!method || !target)return;
-
//array of all parameters if any
-
var parameters = [];
-
for(var i = 2; i <arguments.length; i++) {
-
parameters.push(arguments[i]);
-
}
-
// delegate method which will be executed
-
var proxy = function()
-
{
-
var actualParameters = [];
-
for(var i = 0; i <arguments.length; i++) {
-
actualParameters.push(arguments[i]);
-
}
-
return method.apply(target, actualParameters.concat(parameters));
-
};
-
return proxy;
-
}
-
}
Posted in Ajax, javascript | Comments Off
December 16th, 2008 . by Sajeev
This will help u get the name of the function in javascript but won’t work for anonyms functions
JavaScript:
-
Function.prototype.getName = function(){
-
var m = this.toString().match(/^\s*function\s+([^\s\(]+)/);
-
return m ? m[1].trim() : null;
-
};
Posted in javascript | 1 Comment »
December 16th, 2008 . by Sajeev
JavaScript:
-
/*
-
* String trim
-
*/
-
String.prototype.trim = function (chars){
-
return this.rtrim(chars).ltrim(chars);
-
};
-
/*
-
* String left trim
-
*/
-
String.prototype.ltrim = function (chars){
-
chars = chars || "\\s";
-
return this.replace(new RegExp("^[" + chars + "]+", "g"), "");
-
};
-
/*
-
* String right trim
-
*/
-
String.prototype.rtrim = function rtrim(chars){
-
chars = chars || "\\s";
-
return this.replace(new RegExp("[" + chars + "]+$", "g"), "");
-
};
Posted in javascript | No Comments »
December 16th, 2008 . by Sajeev
The presence of whitespace in DOM will become a problem in Mozilla. This will occurs in cases like, when u create html in server side like jsp and injecting the output as string into DOM node. IE will automatically ignore all the whitespace but not Mozilla!. This method can do this for you.
JavaScript:
-
function ignoreWhiteSpace(stringXml) {
-
if(typeof stringXml != 'string')return;
-
stringXml = stringXml.trim("\\t\\n\\r\\s");
-
stringXml = stringXml.replace(/<!--[\S\s]*?-->/g,"");
-
/*
-
* \s includes non-breaking spaces (and also some other characters).
-
*/
-
//stringXml = stringXml.replace(/>[\t\n\r\x20]+</g,"><");
-
stringXml = stringXml.replace(/>[\t\n\r\x20]*(.*?)[\t\n\r\x20]*</g,">$1<");
-
return stringXml;
-
}
See: https://developer.mozilla.org/en/Whitespace_in_the_DOM
Posted in javascript | No Comments »
December 16th, 2008 . by Sajeev
Use this safe method to append class name to an existing node in DOM. This method will append both class and className attribute.
JavaScript:
-
function appendClass (node, classname){
-
var newClassName;
-
var appendName;
-
if(typeof classname == "string" && classname.trim().length> 0)
-
{
-
appendName = classname.trim();
-
}else if(typeof classname == 'object' && classname.constructor == Array && classname.length> 0){
-
appendName = classname.join(" ");
-
}else
-
{
-
return;
-
}
-
newClassName = node.className ? (node.className + " " + appendName) : (appendName);
-
node.setAttribute("class", newClassName);
-
node.setAttribute("className", newClassName);
-
}
Posted in Ajax, javascript | No Comments »