OZONE Asylum
Forums
DHTML/Javascript
20 Liners - April 08 - Split Screen
This page's ID:
30163
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
[b]poi[/b]: I think it would be possible to shave 2 lines by inlining the chain() function and changing the object property iteration with a forEach() on an array: [code] "set,clearRect,save,translate,rotate,drawImage,scale,restore,fillRect,moveTo,lineTo,beginPath,closePath,stroke,fill,arc" .split(",") .forEach( function (chainThat) { CanvasRenderingContext2D.prototype[chainThat] = function(func) { return function() { return func.apply( this, arguments )||this; }; }(CanvasRenderingContext2D.prototype[chainThat]); }); [/code] It looks fugly but hey, it's a single line! (wrapped so that this table doesn't explode) :) [url=http://magnetiq.com/][img]http://magnetiq.com/exports/oa_sig.gif[/img][/url] [small](Edited by [url=http://www.ozoneasylum.com/user/6682]MaGnA[/url] on 05-01-2008 19:06)[/small] [small](Edited by [url=http://www.ozoneasylum.com/user/6682]MaGnA[/url] on 05-01-2008 19:21)[/small]
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »