- From: Denis Tea via cvs-syncmail <cvsmail@w3.org>
- Date: Thu, 29 Nov 2007 14:12:01 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2006/unicorn/tabtastic In directory hutz:/tmp/cvs-serv30684/tabtastic Modified Files: addclasskillclass.js attachevent.js Log Message: Multithreading Index: addclasskillclass.js =================================================================== RCS file: /sources/public/2006/unicorn/tabtastic/addclasskillclass.js,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- addclasskillclass.js 31 Aug 2006 09:09:32 -0000 1.1.1.1 +++ addclasskillclass.js 29 Nov 2007 14:11:59 -0000 1.2 @@ -1,14 +1,14 @@ -//*** This code is copyright 2002-2003 by Gavin Kistner and Refinery; www.refinery.com -//*** It is covered under the license viewable at http://phrogz.net/JS/_ReuseLicense.txt -//*** Reuse or modification is free provided you abide by the terms of that license. -//*** (Including the first two lines above in your source code satisfies the conditions.) - -//***Adds a new class to an object, preserving existing classes -function AddClass(obj,cName){ KillClass(obj,cName); return obj && (obj.className+=(obj.className.length>0?' ':'')+cName); } - -//***Removes a particular class from an object, preserving other existing classes. -function KillClass(obj,cName){ return obj && (obj.className=obj.className.replace(new RegExp("^"+cName+"\\b\\s*|\\s*\\b"+cName+"\\b",'g'),'')); } - -//***Returns true if the object has the class assigned, false otherwise. -function HasClass(obj,cName){ return (!obj || !obj.className)?false:(new RegExp("\\b"+cName+"\\b")).test(obj.className) } - +//*** This code is copyright 2002-2003 by Gavin Kistner and Refinery; www.refinery.com +//*** It is covered under the license viewable at http://phrogz.net/JS/_ReuseLicense.txt +//*** Reuse or modification is free provided you abide by the terms of that license. +//*** (Including the first two lines above in your source code satisfies the conditions.) + +//***Adds a new class to an object, preserving existing classes +function AddClass(obj,cName){ KillClass(obj,cName); return obj && (obj.className+=(obj.className.length>0?' ':'')+cName); } + +//***Removes a particular class from an object, preserving other existing classes. +function KillClass(obj,cName){ return obj && (obj.className=obj.className.replace(new RegExp("^"+cName+"\\b\\s*|\\s*\\b"+cName+"\\b",'g'),'')); } + +//***Returns true if the object has the class assigned, false otherwise. +function HasClass(obj,cName){ return (!obj || !obj.className)?false:(new RegExp("\\b"+cName+"\\b")).test(obj.className) } + Index: attachevent.js =================================================================== RCS file: /sources/public/2006/unicorn/tabtastic/attachevent.js,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- attachevent.js 31 Aug 2006 09:09:32 -0000 1.1.1.1 +++ attachevent.js 29 Nov 2007 14:11:59 -0000 1.2 @@ -1,34 +1,34 @@ -//*** This code is copyright 2003 by Gavin Kistner, gavin@refinery.com -//*** It is covered under the license viewable at http://phrogz.net/JS/_ReuseLicense.txt -//*** Reuse or modification is free provided you abide by the terms of that license. -//*** (Including the first two lines above in your source code satisfies the conditions.) - - -//***Cross browser attach event function. For 'evt' pass a string value with the leading "on" omitted -//***e.g. AttachEvent(window,'load',MyFunctionNameWithoutParenthesis,false); - -function AttachEvent(obj,evt,fnc,useCapture){ - if (!useCapture) useCapture=false; - if (obj.addEventListener){ - obj.addEventListener(evt,fnc,useCapture); - return true; - } else if (obj.attachEvent) return obj.attachEvent("on"+evt,fnc); - else{ - MyAttachEvent(obj,evt,fnc); - obj['on'+evt]=function(){ MyFireEvent(obj,evt) }; - } -} - -//The following are for browsers like NS4 or IE5Mac which don't support either -//attachEvent or addEventListener -function MyAttachEvent(obj,evt,fnc){ - if (!obj.myEvents) obj.myEvents={}; - if (!obj.myEvents[evt]) obj.myEvents[evt]=[]; - var evts = obj.myEvents[evt]; - evts[evts.length]=fnc; -} -function MyFireEvent(obj,evt){ - if (!obj || !obj.myEvents || !obj.myEvents[evt]) return; - var evts = obj.myEvents[evt]; - for (var i=0,len=evts.length;i<len;i++) evts[i](); -} +//*** This code is copyright 2003 by Gavin Kistner, gavin@refinery.com +//*** It is covered under the license viewable at http://phrogz.net/JS/_ReuseLicense.txt +//*** Reuse or modification is free provided you abide by the terms of that license. +//*** (Including the first two lines above in your source code satisfies the conditions.) + + +//***Cross browser attach event function. For 'evt' pass a string value with the leading "on" omitted +//***e.g. AttachEvent(window,'load',MyFunctionNameWithoutParenthesis,false); + +function AttachEvent(obj,evt,fnc,useCapture){ + if (!useCapture) useCapture=false; + if (obj.addEventListener){ + obj.addEventListener(evt,fnc,useCapture); + return true; + } else if (obj.attachEvent) return obj.attachEvent("on"+evt,fnc); + else{ + MyAttachEvent(obj,evt,fnc); + obj['on'+evt]=function(){ MyFireEvent(obj,evt) }; + } +} + +//The following are for browsers like NS4 or IE5Mac which don't support either +//attachEvent or addEventListener +function MyAttachEvent(obj,evt,fnc){ + if (!obj.myEvents) obj.myEvents={}; + if (!obj.myEvents[evt]) obj.myEvents[evt]=[]; + var evts = obj.myEvents[evt]; + evts[evts.length]=fnc; +} +function MyFireEvent(obj,evt){ + if (!obj || !obj.myEvents || !obj.myEvents[evt]) return; + var evts = obj.myEvents[evt]; + for (var i=0,len=evts.length;i<len;i++) evts[i](); +}
Received on Thursday, 29 November 2007 14:12:14 UTC