<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>strayorange &#187; javascript</title>
	<atom:link href="http://www.strayorange.com/blog/tag/javascript/feed" rel="self" type="application/rss+xml" />
	<link>http://www.strayorange.com/blog</link>
	<description>The most passionate and reliable Lorem Ipsum providers in the world</description>
	<lastBuildDate>Sun, 29 Jan 2012 22:28:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Drag&amp;drop not really working properly in ImageTweak</title>
		<link>http://www.strayorange.com/blog/247-dragdrop-not-really-working-properly-in-imagetweak</link>
		<comments>http://www.strayorange.com/blog/247-dragdrop-not-really-working-properly-in-imagetweak#comments</comments>
		<pubDate>Mon, 23 Nov 2009 11:36:36 +0000</pubDate>
		<dc:creator>CAFxX</dc:creator>
				<category><![CDATA[CAFxX]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[imagetweak]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mozilla]]></category>

		<guid isPermaLink="false">http://www.strayorange.com/blog/?p=247</guid>
		<description><![CDATA[When I released ImageTweak 0.19 I wrote in the changelog that the main change was the support for proper image drag&#38;drop. It actually works correctly but this change had the side effect of changing the normal mouse pointer used by ImageTweak to indicate that you&#8217;re moving an image around the window. I noticed this before [...]]]></description>
			<content:encoded><![CDATA[<p>When I released ImageTweak 0.19 I wrote in the changelog that the main change was the support for proper image drag&amp;drop.</p>
<p>It actually works correctly but this change had the side effect of changing the normal mouse pointer used by ImageTweak to indicate that you&#8217;re moving an image around the window. I noticed this before releasing the update, but it seemed like a minor annoyance worth the additional functionality. I actually tried to fix it but found no way, and since there were a lot of people writing negative reviews on AMO for the lack of drag&amp;drop support I decided to release it without fixing it.</p>
<p>Fast forward some weeks, and it turns out that actually the new behaviour is quite confusing and many are complaining about the mouse pointer showing the &#8220;forbidden&#8221; shape while moving the image. Fewer than they were complaining before about the lack of drag&amp;drop, but still&#8230;</p>
<p>So I set out to find a solution for this problem but apparently there&#8217;s no way to freely control the mouse pointer shape during a drap&amp;drop operation. The only thing that comes closer is setting the mozCursor property of the DOMDataTransfer interface to &#8220;default&#8221;, but that works only on win32 and simply switch the cursor from &#8220;forbidden&#8221; to the default arrow.</p>
<p>I&#8217;m therefore pretty much stuck in a fix: I have to fix this problem but I have no idea of how. If you know how to do this, or know somebody that might help me in fixing this, please let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.strayorange.com/blog/247-dragdrop-not-really-working-properly-in-imagetweak/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ImageTweak 0.19: proper drag&amp;drop</title>
		<link>http://www.strayorange.com/blog/169-imagetweak-0-19-proper-dragdrop</link>
		<comments>http://www.strayorange.com/blog/169-imagetweak-0-19-proper-dragdrop#comments</comments>
		<pubDate>Wed, 16 Sep 2009 05:50:11 +0000</pubDate>
		<dc:creator>CAFxX</dc:creator>
				<category><![CDATA[CAFxX]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[imagetweak]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mozilla]]></category>

		<guid isPermaLink="false">http://www.strayorange.com/blog/?p=169</guid>
		<description><![CDATA[A few months and a complete change of location (I&#8217;m in Helsinki right now!) later, ImageTweak is going to reach version 0.19. I had to scrape all the work I already did for 0.19 because I hit a few roadblocks, and so I had to start over with a minor but longstanding bug: proper drag&#38;drop [...]]]></description>
			<content:encoded><![CDATA[<p>A few months and a complete change of location (I&#8217;m in Helsinki right now!) later, ImageTweak is going to reach version 0.19.</p>
<p>I had to scrape all the work I already did for 0.19 because I hit a few roadblocks, and so I had to start over with a minor but longstanding bug: proper drag&amp;drop support. What it means is that you won&#8217;t have to hold CTRL anymore when performing drag&amp;drop. The price is that I had to drop support for firefox 2.x and 3.0.x.</p>
<p>I just added it on AMO. As soon as it gets reviewed it will be available for <a href="https://addons.mozilla.org/en-US/firefox/addon/3683/">download</a>.</p>
<p>p.s. I also enabled donations on AMO, so if you feel like it please <a href="https://addons.mozilla.org/en-US/firefox/addons/contribute/3683">support the development of ImageTweak</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.strayorange.com/blog/169-imagetweak-0-19-proper-dragdrop/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>HTML5 Web Sockets API reloaded</title>
		<link>http://www.strayorange.com/blog/164-html5-web-sockets-api-reloaded</link>
		<comments>http://www.strayorange.com/blog/164-html5-web-sockets-api-reloaded#comments</comments>
		<pubDate>Thu, 10 Sep 2009 15:17:59 +0000</pubDate>
		<dc:creator>CAFxX</dc:creator>
				<category><![CDATA[CAFxX]]></category>
		<category><![CDATA[dht]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mozilla]]></category>
		<category><![CDATA[whatwg]]></category>

		<guid isPermaLink="false">http://www.strayorange.com/blog/?p=164</guid>
		<description><![CDATA[One of the most exciting upcoming features of HTML5 is the ability to open persistent bidirectional sockets to a remote host. As far as I know, one of the early proposals was about allowing web applications almost complete control over sockets, including the ability to create raw sockets and to listen for incoming connections exactly [...]]]></description>
			<content:encoded><![CDATA[<p>One of the most exciting upcoming features of HTML5 is the ability to <a href="http://dev.w3.org/html5/websockets/">open persistent bidirectional sockets to a remote host</a>.</p>
<p>As far as I know, <a href="http://www.w3.org/TR/2008/WD-html5-20080122/#network">one of the early proposals</a> was about allowing web applications almost complete control over sockets, including the ability to create raw sockets and to listen for incoming connections exactly like a typical network daemon/server, but this proposal was later scraped because of <a href="http://cometdaily.com/2008/07/04/html5-websocket/">security implications</a>.</p>
<p>Fast forward to today and the Web Sockets API, even if still under development, are starting to get a stable shape and they will probably be implemented soon by the most forward-looking browser vendors.</p>
<p>The problem is, though, that the original proposal got crampled along the way and therefore there won&#8217;t be any means to create peer-to-peer connections between users, something that could enable <a href="http://www.strayorange.com/blog/56-a-dht-for-mozilla">all kinds of cool distributed systems</a>.</p>
<p>That is, unless someone does something: what I&#8217;m thinking about right now is a kind of wrapper/extension around the Web Sockets API that does simply a few things:</p>
<ol>
<li>allows a web application to register for incoming connections</li>
<li>opens up the required ports on the firewall/NAT</li>
<li>when a connection arrives, perform the handshaking required by the ws:// protocol and forwards a WebSocket object representing the connection to the application</li>
</ol>
<p>Talking IDL, that would mean (the WebSocket interface is the current WHATWG proposal, while WebSocketListener is my addition):</p>
<pre>[Constructor(in DOMString url, optional in DOMString protocol)]
interface WebSocket {
  readonly attribute DOMString URL;

  // ready state
  const unsigned short CONNECTING = 0;
  const unsigned short OPEN = 1;
  const unsigned short CLOSED = 2;
  readonly attribute unsigned short readyState;
  readonly attribute unsigned long bufferedAmount;

  // networking
           attribute Function onopen;
           attribute Function onmessage;
           attribute Function onclose;
  boolean send(in DOMString data);
  void close();
};

[Constructor(optional in short port, optional in DOMString protocol)]
interface WebSocketListener {
  readonly attribute short port;

  // ready state
  const unsigned short OPENING = 0;
  const unsigned short LISTENING = 1;
  const unsigned short CLOSED = 2;
  readonly attribute unsigned short readyState;

  // networking
           attribute Function onconnection;
  void close();
};</pre>
<p>Talking about the Mozilla platform, points 1 and 3 are straightforward (once the Web Sockets API has been implemented), whereas point 2 will be platform-dependent and, therefore, trickier. Nevertheless, I think that all of this can be handled (with some work) by a Firefox extension.</p>
<p>Once Firefox will gain Web Sockets support I&#8217;ll definitely try to see if it is possible to add it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.strayorange.com/blog/164-html5-web-sockets-api-reloaded/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ImageTweak: over 2 millions downloads and counting</title>
		<link>http://www.strayorange.com/blog/139-imagetweak-over-2-millions-downloads-and-counting</link>
		<comments>http://www.strayorange.com/blog/139-imagetweak-over-2-millions-downloads-and-counting#comments</comments>
		<pubDate>Tue, 05 May 2009 15:45:05 +0000</pubDate>
		<dc:creator>CAFxX</dc:creator>
				<category><![CDATA[CAFxX]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[imagetweak]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mozilla]]></category>

		<guid isPermaLink="false">http://www.strayorange.com/blog/139-imagetweak-over-2-millions-downloads-and-counting</guid>
		<description><![CDATA[I just noticed that ImageTweak passed the 2M downloads mark and is steadily above 200K active daily users. That&#8217;s quite something! A big thanks to all my users (well, maybe not really all of them). Just in case someone is wondering: I&#8217;m open to new contributors for ImageTweak. It really isn&#8217;t a big codebase, but [...]]]></description>
			<content:encoded><![CDATA[<p>I just noticed that <a href="https://addons.mozilla.org/en-US/firefox/addon/3683">ImageTweak</a> <a href="https://addons.mozilla.org/en-US/statistics/addon/3683">passed the 2M downloads mark</a> and is steadily above 200K active daily users. That&#8217;s quite something! A big thanks to all my users (well, maybe <a href="http://www.strayorange.com/blog/64-teh-interwebs-r-fun">not really all of them</a>).<br />
Just in case someone is wondering: I&#8217;m open to new contributors for ImageTweak. It really isn&#8217;t a big codebase, but it needs maintenance and further development&#8230; if you know javascript (and possibly a little about developing Firefox extensions) and you&#8217;re willing to contribute please leave a comment here.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.strayorange.com/blog/139-imagetweak-over-2-millions-downloads-and-counting/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A DHT for Mozilla?</title>
		<link>http://www.strayorange.com/blog/56-a-dht-for-mozilla</link>
		<comments>http://www.strayorange.com/blog/56-a-dht-for-mozilla#comments</comments>
		<pubDate>Wed, 01 Apr 2009 14:19:19 +0000</pubDate>
		<dc:creator>CAFxX</dc:creator>
				<category><![CDATA[CAFxX]]></category>
		<category><![CDATA[dht]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mozilla]]></category>
		<category><![CDATA[songbird]]></category>

		<guid isPermaLink="false">http://www.strayorange.com/blog/?p=56</guid>
		<description><![CDATA[I&#8217;ve been thinking in the last few days about writing a DHT implementation for Mozilla, some kind of generic library (packaged as an add-on) that may be used in a tons of different ways, like: a distributed version of Weave (for Firefox) a shared cache/proxy/CDN system (that would allow users to reach otherwise unreachable resources, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been thinking in the last few days about writing a DHT implementation for Mozilla, some kind of generic library (packaged as an add-on) that may be used in a tons of different ways, like:</p>
<ul>
<li>a distributed version of Weave (for Firefox)</li>
<li>a shared cache/proxy/CDN system (that would allow users to reach otherwise unreachable resources, be it because of server downtime or because of censorship policies)</li>
<li>a file sharing platform (for Songbird: imagine being able to see in your library not only your songs, but also everyone else&#8217;s)</li>
<li>a distributed computing platform (more on this in a later post)</li>
<li>the Next Big Thing™</li>
</ul>
<p>BTW, much of this is partly already implemented in any bittorrent client (and the rest is already <a href="http://www.bittorrent.org/beps/bep_0009.html">on track</a>), what&#8217;s needed is just glueing the pieces together. As soon as my exams are over I&#8217;ll give it a try&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.strayorange.com/blog/56-a-dht-for-mozilla/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>ImageTweak 0.19 will come, sooner or later</title>
		<link>http://www.strayorange.com/blog/22-imagetweak-019-will-come-sooner-or-later</link>
		<comments>http://www.strayorange.com/blog/22-imagetweak-019-will-come-sooner-or-later#comments</comments>
		<pubDate>Sat, 28 Mar 2009 09:25:31 +0000</pubDate>
		<dc:creator>CAFxX</dc:creator>
				<category><![CDATA[CAFxX]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[imagetweak]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mozilla]]></category>

		<guid isPermaLink="false">http://www.strayorange.com/blog/?p=22</guid>
		<description><![CDATA[I&#8217;ve been working (right now I&#8217;m busy with my university exams!) on ImageTweak (IT) 0.19, and that&#8217;s coming along quite nicely. What reamins to be done is to fix the zoom-on-pointer behaviour that broke with the moving viewport merge, to clean up quite a lot of code, localize everything and then test it. If you&#8217;re [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working (right now I&#8217;m busy with my university exams!) on <a href="http://cafxx.strayorange.com/ImageTweak">ImageTweak</a> (IT) 0.19, and that&#8217;s coming along quite nicely.</p>
<p><span id="more-22"></span>What reamins to be done is to fix the zoom-on-pointer behaviour that broke with the moving viewport merge, to clean up quite a lot of code, localize everything and then test it. If you&#8217;re willing to try it out, this is the link to to the <a href="http://cafxx.strayorange.com/files/ImageTweak.trunk.debug.xpi">latest trunk debug build</a>.</p>
<p>Now, if only I could find out what&#8217;s wrong with the zoom-on-pointer code&#8230;</p>
<pre>ImageTweak.Document.prototype.PerformZoom = function PerformZoom(delta, px, py) {
/**/	ImageTweak.Helper.log("&gt;");
/**/	ImageTweak.Helper.log("delta " + delta + " px " + px + " py " + py);
	this.ConvertToFree();
	var imgZoomFactor = ImageTweak.GetPref("ZoomFactor");
	var imgZoomNew = Math.pow( imgZoomFactor, Math.round( delta + Math.log(this.Zoom) / Math.log(imgZoomFactor) ) );
	if ( imgZoomNew &lt;= this.ZoomMax ) {
		var imgZoomRatio = imgZoomNew / this.Zoom;
		var imgZoomDirRatio = imgZoomRatio * ( delta &lt; 0 ? -1 : 1 );
		if ( typeof(px) != "undefined" &amp;&amp; ImageTweak.GetPref("ZoomOnPointer") /* &amp;&amp; imgZoomNew &gt;= this.FitZoom() */ ) {
			//this.FreeLeft += ( imgZoomRatio - 1 ) * ( px - this.Helper.Clip( Coordinates.imgLeft, -this.ImageMax, 0 ) );
			//this.FreeTop += ( imgZoomRatio - 1 ) * ( py - this.Helper.Clip( Coordinates.imgTop, -this.ImageMax, 0 ) );
			px -= this.Window.innerWidth / 2;
			py -= this.Window.innerHeight / 2;
		} else {
			px = 0;
			py = 0;
		}
		this.FreeLeft = px * ( imgZoomRatio - 1 ) + this.Window.scrollX;
		this.FreeTop = py * ( imgZoomRatio - 1 ) + this.Window.scrollY;
		this.Zoom = imgZoomNew;
/**/		ImageTweak.Helper.log( "Zoom " + this.Zoom + " FreeLeft " + this.FreeLeft + " FreeTop " + this.FreeTop );
		this.Repaint();
	}
/**/	ImageTweak.Helper.log("&lt;");
};</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.strayorange.com/blog/22-imagetweak-019-will-come-sooner-or-later/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

