<?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>Agrafix Webdesign Blog &#187; Javascript</title>
	<atom:link href="http://blog.agrafix.net/category/programmieren/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.agrafix.net</link>
	<description>Programmieren, Technik und Internet</description>
	<lastBuildDate>Tue, 07 Feb 2012 10:56:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>ReTI IDE &amp; Simulator (Technische Informatik)</title>
		<link>http://blog.agrafix.net/2012/01/reti-ide-simulator-technische-informatik/</link>
		<comments>http://blog.agrafix.net/2012/01/reti-ide-simulator-technische-informatik/#comments</comments>
		<pubDate>Sat, 14 Jan 2012 12:29:29 +0000</pubDate>
		<dc:creator>agrafix</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Projekte]]></category>
		<category><![CDATA[asm]]></category>
		<category><![CDATA[ide]]></category>
		<category><![CDATA[prozessor]]></category>
		<category><![CDATA[reti]]></category>
		<category><![CDATA[simulator]]></category>

		<guid isPermaLink="false">http://blog.agrafix.net/?p=533</guid>
		<description><![CDATA[Da ich aktuell an der Veranstaltung Technische Informatik an der Uni teilnehme war es im letzten Übungsblatt Aufgabe Programm-Code für einen einfachen Prozessor (ReTI oder auch RESA) zu schreiben. Das vorgeschlagene Tool dafür (Neumi) kann entsprechenden Programm-Code zwar super visualisieren, ist allerdings beim &#8220;coden&#8221; nicht sehr hilfreich da es kein vernünftiges Feedback bei Fehlern gibt [...]<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://blog.agrafix.net/2012/01/reti-ide-simulator-technische-informatik/' addthis:title='ReTI IDE &#38; Simulator (Technische Informatik) ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>
<em>Keine ähnlichen Beiträge vorhanden</em>]]></description>
			<content:encoded><![CDATA[<p>Da ich aktuell an der Veranstaltung Technische Informatik an der Uni teilnehme war es im letzten Übungsblatt Aufgabe Programm-Code für einen einfachen Prozessor (ReTI oder auch RESA) zu schreiben. Das vorgeschlagene Tool dafür (<a href="http://abs.informatik.uni-freiburg.de/teaching/Neumi/" title="Neumi">Neumi</a>) kann entsprechenden Programm-Code zwar super visualisieren, ist allerdings beim &#8220;coden&#8221; nicht sehr hilfreich da es kein vernünftiges Feedback bei Fehlern gibt und es auch keine gute Eingabemaske für den Code gibt. Deshalb hab ich mich hingesetzt und eine kleine HTML-JavaScript-IDE mit einer ReTI-Simulation in PHP zusammengebaut. Das ganze ist unter <a href="http://reti.agrafix.net/index.php" title="ReTI IDE &#038; Simulator">reti.agrafix.net</a> zu finden! Ich habe auch eine kleine Dokumentation dazu geschrieben, es sollte sich also alles von selbst erklären.<br />
Ein paar Worte vielleicht noch zur &#8220;Simulation&#8221;: Die Simulation ist eher ein Debugger, da der Code nicht assembliert sondern direkt interpretiert wird. Das ist notwendig um zielgenaues Feedback bei (Laufzeit-)Fehlern zu geben. Deshalb ist es nicht möglich auf Speicherzellen zuzugreifen, die Anweisungen/Befehle enthalten. (Mit dieser Einschränkung konnte man dennoch alle Aufgabenstellungen bis jetzt lösen <img src='http://blog.agrafix.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  ) Solange man das also nicht benötigt, kann der Simulator den korrekten Endspeicherzustand berechnen.</p>
<p><a href="http://reti.agrafix.net/" title="ReTI IDE &#038; Simulator">Zur ReTI IDE &#038; Simulator</a></p>
<p>Für die HTML-JavaScript-IDE bzw. dessen Code-Editor habe ich übrigens auf das <a href="http://codemirror.net/" title="CodeMirror">CodeMirror 2</a> Framework gebaut. Super Framework, leider muss man erstmal ein bisschen Dokumentation lesen bis man damit zu guten Ergebnisen kommt!</p>
<img src="http://blog.agrafix.net/?ak_action=api_record_view&id=533&type=feed" alt="" /><div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://blog.agrafix.net/2012/01/reti-ide-simulator-technische-informatik/' addthis:title='ReTI IDE &amp; Simulator (Technische Informatik) ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div><p><em>Keine ähnlichen Beiträge vorhanden</em></p>]]></content:encoded>
			<wfw:commentRss>http://blog.agrafix.net/2012/01/reti-ide-simulator-technische-informatik/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Keep your scope &#8211; jQuery.proxy</title>
		<link>http://blog.agrafix.net/2012/01/keep-your-scope-jquery-proxy/</link>
		<comments>http://blog.agrafix.net/2012/01/keep-your-scope-jquery-proxy/#comments</comments>
		<pubDate>Tue, 10 Jan 2012 09:16:07 +0000</pubDate>
		<dc:creator>agrafix</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[scope]]></category>

		<guid isPermaLink="false">http://blog.agrafix.net/?p=520</guid>
		<description><![CDATA[Wer kennt das nicht, man arbeitet mit jQuery und einem click-Event, und &#8220;verliert&#8221; dadurch bei Objekten das &#8220;this&#8221;. Kleines Beispiel: 1 2 3 4 5 6 7 8 9 10 11 function MyObject&#40;&#41; &#123; this.hello = &#34;Hello&#34;; &#125; &#160; MyObject.prototype.clickHandler = function&#40;event&#41; &#123; alert&#40;this.hello&#41;; &#125;; &#160; var obj = new MyObject&#40;&#41;; &#160; $&#40;'#clickMe'&#41;.click&#40;obj.clickHandler&#41;; Wenn man [...]<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://blog.agrafix.net/2012/01/keep-your-scope-jquery-proxy/' addthis:title='Keep your scope &#8211; jQuery.proxy ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>
<strong>Ähnliche Beiträge:</strong><ol>
<li><a href='http://blog.agrafix.net/2011/10/javascript-timers-mit-jquery/' rel='bookmark' title='JavaScript Timers mit jQuery'>JavaScript Timers mit jQuery</a></li>
<li><a href='http://blog.agrafix.net/2011/02/jquery-in-greasemonkey/' rel='bookmark' title='jQuery in Greasemonkey'>jQuery in Greasemonkey</a></li>
<li><a href='http://blog.agrafix.net/2011/10/ajax-und-der-vor-und-zuruck-button/' rel='bookmark' title='AJAX und der &#8220;Vor&#8221; und &#8220;Zurück&#8221; Button'>AJAX und der &#8220;Vor&#8221; und &#8220;Zurück&#8221; Button</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Wer kennt das nicht, man arbeitet mit<a href="http://jquery.com/" target="_blank" title="jQuery JavaScript Framework"> jQuery </a>und einem click-Event, und &#8220;verliert&#8221; dadurch bei Objekten das &#8220;this&#8221;. Kleines Beispiel:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> MyObject<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">hello</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;Hello&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
MyObject.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">clickHandler</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">hello</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> obj <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> MyObject<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#clickMe'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span>obj.<span style="color: #660066;">clickHandler</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Wenn man jetzt auf ein gedachtes Element mit der ID &#8220;clickMe&#8221; klickt, dann erscheint eine Fehlermeldung in JavaScript bzw. eine Alert-Box mit dem Inhalt &#8220;undefined&#8221; &#8211; obwohl <em>this.hello</em> eigentlich doch <em>&#8220;Hello&#8221;</em> sein sollte? Bei den<a href="http://jquery.com/" target="_blank" title="jQuery JavaScript Framework"> jQuery </a>Event-Handlern &#8220;verliert&#8221; die Funktion ihr aktuelles Scope und das <em>this</em> zeigt dann auf den Sender des Events, in diesem Fall auf das Element mit der ID &#8220;clickMe&#8221;. Das ist zwar oft gewünscht, da man dieses nun zB mit <em>$(this).text(&#8216;Ich wurde geklicked&#8217;);</em> weiterverarbeiten kann, ist aber in meinem Beispiel oben sehr ungünstig. Deshalb bietet die jQuery-Library eine Funktion <em>jQuery.proxy</em>, welche eine Proxy-Funktion generiert mit der wir das Scope einer Funktion selbst beeinflussen können. Ersetzen wir Zeile 11 also mit folgendem:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>11
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#clickMe'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">proxy</span><span style="color: #009900;">&#40;</span>obj.<span style="color: #660066;">clickHandler</span><span style="color: #339933;">,</span> obj<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Nun zeigt das <em>this</em> wärend unserem clickHandler-Aufruf wieder auf das eigentliche Objekt und eine Alert-Box mit dem Inhalt &#8220;Hello&#8221; erscheint. Möchte man nun trotzdem auf das auslösende Element für das Event zugreifen, schafft</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> calledBy <span style="color: #339933;">=</span> event.<span style="color: #660066;">target</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// beispiel</span>
$<span style="color: #009900;">&#40;</span>calledBy<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">text</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Link geklickt!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>abhilfe! Natürlich kann man auch seine eigene Proxy-Funktion mit direct-calling bauen, was aber den Code schon deutlich unübersichtlicher macht, allerdings viel mehr Flexibilität bietet (wieder Bezug auf 1. Beispielcode):</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>11
12
13
14
15
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#clickMe'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>o<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		o.<span style="color: #660066;">clickHandler</span><span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span>obj<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Es lohnt sich also immer auch mal unter &#8220;Misc&#8221; bzw. &#8220;Utilities&#8221; in der <a href="http://api.jquery.com/jQuery.proxy/" title="jQuery.proxy">Dokumentation einer Library</a> nachsehen <img src='http://blog.agrafix.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<img src="http://blog.agrafix.net/?ak_action=api_record_view&id=520&type=feed" alt="" /><div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://blog.agrafix.net/2012/01/keep-your-scope-jquery-proxy/' addthis:title='Keep your scope &#8211; jQuery.proxy ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div><p><strong>Ähnliche Beiträge:</strong><ol>
<li><a href='http://blog.agrafix.net/2011/10/javascript-timers-mit-jquery/' rel='bookmark' title='JavaScript Timers mit jQuery'>JavaScript Timers mit jQuery</a></li>
<li><a href='http://blog.agrafix.net/2011/02/jquery-in-greasemonkey/' rel='bookmark' title='jQuery in Greasemonkey'>jQuery in Greasemonkey</a></li>
<li><a href='http://blog.agrafix.net/2011/10/ajax-und-der-vor-und-zuruck-button/' rel='bookmark' title='AJAX und der &#8220;Vor&#8221; und &#8220;Zurück&#8221; Button'>AJAX und der &#8220;Vor&#8221; und &#8220;Zurück&#8221; Button</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.agrafix.net/2012/01/keep-your-scope-jquery-proxy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML5 WebSocket</title>
		<link>http://blog.agrafix.net/2011/11/html5-websocket/</link>
		<comments>http://blog.agrafix.net/2011/11/html5-websocket/#comments</comments>
		<pubDate>Fri, 25 Nov 2011 11:08:57 +0000</pubDate>
		<dc:creator>agrafix</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[TCP]]></category>
		<category><![CDATA[WebSocket]]></category>

		<guid isPermaLink="false">http://blog.agrafix.net/?p=482</guid>
		<description><![CDATA[HTML5 unterstützt jetzt das Aufbauen von &#8220;WebSocket&#8221;-Verbindungen. Eine WebSocket Verbindung basiert ähnlich wie HTTP auf dem TCP Protokoll, baut aber eine &#8220;dauerhafte&#8221; Verbindung auf. Die Vorteile gegenüber HTTP ist, dass eine Aktion des Servers keine vorhergehende Anfrage des Clients mehr erfordert, wodurch der Server neue Informationen fasst in Echtzeit ausliefern kann. Dadurch kann man eine [...]<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://blog.agrafix.net/2011/11/html5-websocket/' addthis:title='HTML5 WebSocket ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>
<strong>Ähnliche Beiträge:</strong><ol>
<li><a href='http://blog.agrafix.net/2011/11/sprechblasen-mit-html5-canvas-und-javascript/' rel='bookmark' title='Sprechblasen mit HTML5, Canvas und JavaScript'>Sprechblasen mit HTML5, Canvas und JavaScript</a></li>
<li><a href='http://blog.agrafix.net/2011/10/javascript-und-geolocation/' rel='bookmark' title='JavaScript und Geolocation'>JavaScript und Geolocation</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>HTML5 unterstützt jetzt das Aufbauen von &#8220;WebSocket&#8221;-Verbindungen. Eine WebSocket Verbindung basiert ähnlich wie HTTP auf dem TCP Protokoll, baut aber eine &#8220;dauerhafte&#8221; Verbindung auf. Die Vorteile gegenüber HTTP ist, dass eine Aktion des Servers keine vorhergehende Anfrage des Clients mehr erfordert, wodurch der Server neue Informationen fasst in Echtzeit ausliefern kann. Dadurch kann man eine Menge Traffic und viele unnötige HTTP-Requests sparen, die etwa ein AJAX-JavaScript sonst schicken würde um neue Informationen zu erhalten.<br />
Technisch gesehen baut bei einer WebSocket-Verbindung der Browser mit dem Server eine Verbindung auf, die nach einen Handshake dann bestehen bleibt und über die dann Binär- und Textdaten geschickt werden können.</p>
<p>Leider hat das Protokoll im Handshake einige Sicherheitsprobleme (gehabt?) und sich deshalb ständig verändert. Dieser Artikel bezieht sich also auf die Aktuellste Version (<a href="https://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-17" title="17" target="_blank">17</a>). Diese wird derzeit von der aktuellsten Chrome Version und anderen Webkit Browsern unterstützt, in Firefox und Opera ist WebSocket wegen der Sicherheitsprobleme derzeit deaktiviert.</p>
<p>Um HTML5 WebSocket zu verwenden ist zunächst ein WebSocket-Server nötig. Ich habe hier nach einer PHP-Variante gesucht und habe dann nach einer Weile folgenden gefunden: <a href="https://github.com/lemmingzshadow/php-websocket" title="PHP-WebSocket" target="_blank">php-websocket</a>. Diesen sollte man sich laden und dann kann man ihn per</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">php <span style="color: #660033;">-q</span> php-websocket<span style="color: #000000; font-weight: bold;">/</span>server<span style="color: #000000; font-weight: bold;">/</span>server.php</pre></div></div>

<p> starten. Jetzt ist ein WebSocket-Server auf &#8220;localhost:8000&#8243; zu erreichen. Dort sind derzeit zwei Module geladen, einmal das Modul &#8220;echo&#8221; und einmal das Modul &#8220;chat&#8221;. (Ich werde mich hier nicht mit der Entwicklung eines WebSocket-Server weiter befassen) Das &#8220;echo&#8221; Modul nimmt einfach Anfragen entgegen und schickt diese dann an alle Verbundenen Sockets weiter.</p>
<p>Nun kümmern wir uns um die HTML5-Seite von WebSocket, dem User-Frontend. Dafür bauen wir uns erstmal eine einfache HTML5 Seite:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #00bbdd;">&lt;!DOCTYPE html&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">html</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">meta</span> <span style="color: #000066;">charset</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;UTF-8&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">title</span>&gt;</span>HTML5 WebSocket Test<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">title</span>&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;!-- jQuery 1.6.4 zur DOM-Manipulation --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;jquery-1.6.4.min.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;!-- meine eigene Wrapper-Library für WebSocket Verbindungen, siehe unten --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;websocketlib.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span>
// hier wird dann das WebSocket-Script reinkommen, siehe unten
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;float:right;width:40%;&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>Log<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;logbox&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>Chatbox<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;chatbox&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>Say something<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">form</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'chat'</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'text'</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">''</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'message'</span> <span style="color: #66cc66;">/</span>&gt;</span>
	 <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'submit'</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'Sagen'</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">form</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">html</span>&gt;</span></pre></div></div>

<p>Für die einfache Verwendung des WebSockets habe ich mir eine kleine Wrapper-Library (<b>websocketlib.js</b>) programmiert:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">/**
 * Small wrapper library for HTML5 WebSocket
 * 
 * @author Alexander Thiemann &lt;mail@agrafix.net&gt;
 * @version 1.0
 * 
 * @param string WebSocket host, eg. ws://localhost:8010/echo
 * @param function Function to be called when socket is connected
 * @param function Function to be called when socket recieves data, takes 1 argument message
 * @param function Function to be called for logging purposes, takes 1 argument log-message
 * 
 * @see http://blog.agrafix.net/2011/11/html5-websocket/
 */</span>
<span style="color: #003366; font-weight: bold;">var</span> WebSocketLib <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
	init<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>host<span style="color: #339933;">,</span> onConnect<span style="color: #339933;">,</span> onRecv<span style="color: #339933;">,</span> onLog<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">socket</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> WebSocket<span style="color: #009900;">&#40;</span>host<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">onLog</span> <span style="color: #339933;">=</span> onLog<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">onRecv</span> <span style="color: #339933;">=</span> onRecv<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">onConnect</span> <span style="color: #339933;">=</span> onConnect<span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">onLog</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Initializing Socket. State: '</span> <span style="color: #339933;">+</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">socket</span>.<span style="color: #660066;">readyState</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">socket</span>.<span style="color: #660066;">onopen</span> <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>._onOpen<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">socket</span>.<span style="color: #660066;">onmessage</span> <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>._onMessage<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">socket</span>.<span style="color: #660066;">onclose</span> <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>._onClose<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
	send<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>message<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		WebSocketLib.<span style="color: #660066;">socket</span>.<span style="color: #660066;">send</span><span style="color: #009900;">&#40;</span>message<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
	_onClose<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		WebSocketLib.<span style="color: #660066;">onLog</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Socket Closed.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
	_onMessage<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>msg<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		WebSocketLib.<span style="color: #660066;">onLog</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Recieved new Message from Server: '</span> <span style="color: #339933;">+</span> msg.<span style="color: #660066;">data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		WebSocketLib.<span style="color: #660066;">onRecv</span><span style="color: #009900;">&#40;</span>msg.<span style="color: #660066;">data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
	_onOpen<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		WebSocketLib.<span style="color: #660066;">onLog</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Socket is Ready. State: '</span> <span style="color: #339933;">+</span> WebSocketLib.<span style="color: #660066;">socket</span>.<span style="color: #660066;">readyState</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>WebSocketLib.<span style="color: #660066;">socket</span>.<span style="color: #660066;">readyState</span> <span style="color: #339933;">==</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			WebSocketLib.<span style="color: #660066;">onConnect</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>	
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Ich denke dort ist alles relativ selbsterklärend. Das WebSocket ist wirklich sehr leicht zu verwenden! Um diese Wrapper-Library zu verwenden, bauen wir in obiges HTML-Grundgerüst bei &#8220;<em>// hier wird dann das WebSocket-Script reinkommen, siehe unten</em>&#8221; folgendes ein:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	WebSocketLib.<span style="color: #660066;">init</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'ws://localhost:8010/echo'</span><span style="color: #339933;">,</span> 
	<span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		sockReady<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
	<span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>t<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#chatbox'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">append</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;p&gt;&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">text</span><span style="color: #009900;">&#40;</span>t<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
	<span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>t<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#logbox'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">append</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;p&gt;&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">text</span><span style="color: #009900;">&#40;</span>t<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">function</span> sockReady<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#chat'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">submit</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			e.<span style="color: #660066;">preventDefault</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #003366; font-weight: bold;">var</span> input <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'input[name=&quot;message&quot;]'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			WebSocketLib.<span style="color: #660066;">send</span><span style="color: #009900;">&#40;</span>input.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			input.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Zuerst warten wir, bis unser HTML-Dokument im Browser aufgebaut ist. Dann geben wir in Zeile 2 an, wo unser WebSocket-Server läuft. Die Funktion in Zeile 4 wird aufgerufen, sobald das WebSocket verbunden ist. Die Funktion Zeile 6-8 wird aufgerufen, wenn eine Nachricht zurückgegeben wird. Die Funktion Zeile 9-11 wird bei Log-Ereignissen (Hauptsächlich zum Debuggen) aufgerufen. Mit WebSocketLib.send(&#8220;Nachricht&#8221;) in Zeile 19 schicken wir eine Nachricht an den Server.</p>
<p>Wenn nun alles vorbereitet ist, der WebSocket-Server gestartet ist (siehe oben), können wir einem Browser, der WebSocket unterstützt (siehe oben), unsere HTML-Seite aufrufen. Die Log-Ausgabe im HTML-Fenster sieht wie folgt aus:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Initializing Socket. State: 0
Socket is Ready. State: 1</pre></div></div>

<p>Im Consolenfenster des PHP-Server sehen wir:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">2011-11-25 11:26:47 [info] [client 127.0.0.1:30601] Connected
2011-11-25 11:26:47 [info] [client 127.0.0.1:30601] Performing handshake
2011-11-25 11:26:47 [info] [client 127.0.0.1:30601] Handshake sent</pre></div></div>

<p>Die Verbindung ist nun also aufgebaut. Jetzt sollten wir den &#8220;echo&#8221;-Server testen. Wir tippen etwas in das Textfeld und schicken es ab. Der Log sagt:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Recieved new Message from Server: test</pre></div></div>

<p>Und unter &#8220;Chat&#8221; steht jetzt &#8220;test&#8221;. Hat soweit also funktioniert! Jetzt können wir ein neues Browserfenster aufmachen, wieder den Verbindungsvorgang abwarten und dann dort eine Nachricht verschicken. Diese erscheint dann in allen verbundenen Client-Fenstern.</p>
<p>Eigentlich ziemlich einfach zu verwenden, und es öffnet viele neue Möglichkeiten vorallem in Kombination mit Canvas für HTML5-Multiplayer-Games&#8230; hoffen wir also, dass es bald von allen Browser voll unterstützt wird! <img src='http://blog.agrafix.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<img src="http://blog.agrafix.net/?ak_action=api_record_view&id=482&type=feed" alt="" /><div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://blog.agrafix.net/2011/11/html5-websocket/' addthis:title='HTML5 WebSocket ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div><p><strong>Ähnliche Beiträge:</strong><ol>
<li><a href='http://blog.agrafix.net/2011/11/sprechblasen-mit-html5-canvas-und-javascript/' rel='bookmark' title='Sprechblasen mit HTML5, Canvas und JavaScript'>Sprechblasen mit HTML5, Canvas und JavaScript</a></li>
<li><a href='http://blog.agrafix.net/2011/10/javascript-und-geolocation/' rel='bookmark' title='JavaScript und Geolocation'>JavaScript und Geolocation</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.agrafix.net/2011/11/html5-websocket/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sprechblasen mit HTML5, Canvas und JavaScript</title>
		<link>http://blog.agrafix.net/2011/11/sprechblasen-mit-html5-canvas-und-javascript/</link>
		<comments>http://blog.agrafix.net/2011/11/sprechblasen-mit-html5-canvas-und-javascript/#comments</comments>
		<pubDate>Fri, 18 Nov 2011 04:42:54 +0000</pubDate>
		<dc:creator>agrafix</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[bubble]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[speech]]></category>
		<category><![CDATA[speechbubble]]></category>
		<category><![CDATA[sprechblase]]></category>

		<guid isPermaLink="false">http://blog.agrafix.net/?p=478</guid>
		<description><![CDATA[Mit HTML5, Canvas und JavaScript kann man mittlerweile eine Menge schöner Grafiken direkt im Browser rendern. Da ich neulich eine flexible Sprechblase benötigt habe, hier der Code dafür: /** * Draw a speech bubble on an HTML5-Canvas * * @author Alexander Thiemann &#60;mail@agrafix.net&#62; * @license CC BY-SA 2.0 * * @param ctx Canvas 2d context [...]<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://blog.agrafix.net/2011/11/sprechblasen-mit-html5-canvas-und-javascript/' addthis:title='Sprechblasen mit HTML5, Canvas und JavaScript ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>
<strong>Ähnliche Beiträge:</strong><ol>
<li><a href='http://blog.agrafix.net/2011/11/html5-websocket/' rel='bookmark' title='HTML5 WebSocket'>HTML5 WebSocket</a></li>
<li><a href='http://blog.agrafix.net/2009/08/in_array-fur-javascript/' rel='bookmark' title='in_array() für Javascript'>in_array() für Javascript</a></li>
<li><a href='http://blog.agrafix.net/2011/10/javascript-und-geolocation/' rel='bookmark' title='JavaScript und Geolocation'>JavaScript und Geolocation</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Mit HTML5, Canvas und JavaScript kann man mittlerweile eine Menge schöner Grafiken direkt im Browser rendern. Da ich neulich eine flexible Sprechblase benötigt habe, hier der Code dafür:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">/**
 * Draw a speech bubble on an HTML5-Canvas
 *
 * @author Alexander Thiemann &lt;mail@agrafix.net&gt;
 * @license CC BY-SA 2.0
 * 
 * @param ctx Canvas 2d context
 * @param text Text for the speech bubble
 * @param x bottom left x-coordinate of speech bubble
 * @param y bottom left y-coordinate of speech bubble
 *
 */</span>
<span style="color: #003366; font-weight: bold;">function</span> speechBubble<span style="color: #009900;">&#40;</span>ctx<span style="color: #339933;">,</span> text<span style="color: #339933;">,</span> x<span style="color: #339933;">,</span> y<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> messure <span style="color: #339933;">=</span> ctx.<span style="color: #660066;">measureText</span><span style="color: #009900;">&#40;</span>text<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">var</span> w <span style="color: #339933;">=</span> messure.<span style="color: #660066;">width</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> h <span style="color: #339933;">=</span> <span style="color: #CC0000;">20</span><span style="color: #339933;">;</span>
&nbsp;
	ctx.<span style="color: #660066;">beginPath</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	ctx.<span style="color: #660066;">strokeStyle</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;black&quot;</span><span style="color: #339933;">;</span>
	ctx.<span style="color: #660066;">lineWidth</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;1&quot;</span><span style="color: #339933;">;</span>
	ctx.<span style="color: #660066;">fillStyle</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;rgba(255, 255, 255, 0.8)&quot;</span><span style="color: #339933;">;</span>
&nbsp;
	ctx.<span style="color: #660066;">moveTo</span><span style="color: #009900;">&#40;</span>x<span style="color: #339933;">,</span> y<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	ctx.<span style="color: #660066;">lineTo</span><span style="color: #009900;">&#40;</span>x <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span>w<span style="color: #339933;">*</span><span style="color: #CC0000;">0.2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> y<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	ctx.<span style="color: #660066;">lineTo</span><span style="color: #009900;">&#40;</span>x <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span>w<span style="color: #339933;">*</span><span style="color: #CC0000;">0.2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> y<span style="color: #339933;">+</span><span style="color: #CC0000;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	ctx.<span style="color: #660066;">lineTo</span><span style="color: #009900;">&#40;</span>x <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span>w<span style="color: #339933;">*</span><span style="color: #CC0000;">0.3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> y<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	ctx.<span style="color: #660066;">lineTo</span><span style="color: #009900;">&#40;</span>x <span style="color: #339933;">+</span> w<span style="color: #339933;">,</span> y<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	ctx.<span style="color: #660066;">quadraticCurveTo</span><span style="color: #009900;">&#40;</span>x <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span>w<span style="color: #339933;">*</span><span style="color: #CC0000;">1.1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> y<span style="color: #339933;">,</span> x <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span>w<span style="color: #339933;">*</span><span style="color: #CC0000;">1.1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> y<span style="color: #339933;">-</span><span style="color: #009900;">&#40;</span>h<span style="color: #339933;">*</span><span style="color: #CC0000;">0.2</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// corner: right-bottom</span>
&nbsp;
	ctx.<span style="color: #660066;">lineTo</span><span style="color: #009900;">&#40;</span>x <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span>w<span style="color: #339933;">*</span><span style="color: #CC0000;">1.1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> y<span style="color: #339933;">-</span><span style="color: #009900;">&#40;</span>h<span style="color: #339933;">*</span><span style="color: #CC0000;">0.8</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// right</span>
&nbsp;
	ctx.<span style="color: #660066;">quadraticCurveTo</span><span style="color: #009900;">&#40;</span>x <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span>w<span style="color: #339933;">*</span><span style="color: #CC0000;">1.1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> y<span style="color: #339933;">-</span>h<span style="color: #339933;">,</span> x <span style="color: #339933;">+</span> w<span style="color: #339933;">,</span> y<span style="color: #339933;">-</span>h<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// corner: right-top</span>
&nbsp;
	ctx.<span style="color: #660066;">lineTo</span><span style="color: #009900;">&#40;</span>x<span style="color: #339933;">,</span> y<span style="color: #339933;">-</span>h<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// top</span>
&nbsp;
	ctx.<span style="color: #660066;">quadraticCurveTo</span><span style="color: #009900;">&#40;</span>x <span style="color: #339933;">-</span> <span style="color: #009900;">&#40;</span>w<span style="color: #339933;">*</span><span style="color: #CC0000;">0.1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> y<span style="color: #339933;">-</span>h<span style="color: #339933;">,</span> x <span style="color: #339933;">-</span> <span style="color: #009900;">&#40;</span>w<span style="color: #339933;">*</span><span style="color: #CC0000;">0.1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> y<span style="color: #339933;">-</span><span style="color: #009900;">&#40;</span>h<span style="color: #339933;">*</span><span style="color: #CC0000;">0.8</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// corner: left-top</span>
&nbsp;
	ctx.<span style="color: #660066;">lineTo</span><span style="color: #009900;">&#40;</span>x <span style="color: #339933;">-</span> <span style="color: #009900;">&#40;</span>w<span style="color: #339933;">*</span><span style="color: #CC0000;">0.1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> y<span style="color: #339933;">-</span><span style="color: #009900;">&#40;</span>h<span style="color: #339933;">*</span><span style="color: #CC0000;">0.2</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// left</span>
&nbsp;
	ctx.<span style="color: #660066;">quadraticCurveTo</span><span style="color: #009900;">&#40;</span>x <span style="color: #339933;">-</span> <span style="color: #009900;">&#40;</span>w<span style="color: #339933;">*</span><span style="color: #CC0000;">0.1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> y<span style="color: #339933;">,</span> x<span style="color: #339933;">,</span> y<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// corner: left-bottom</span>
&nbsp;
	ctx.<span style="color: #660066;">fill</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	ctx.<span style="color: #660066;">stroke</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	ctx.<span style="color: #660066;">closePath</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	ctx.<span style="color: #660066;">textAlign</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'left'</span><span style="color: #339933;">;</span>
	ctx.<span style="color: #660066;">fillStyle</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'#000'</span><span style="color: #339933;">;</span>
	ctx.<span style="color: #660066;">fillText</span><span style="color: #009900;">&#40;</span>text<span style="color: #339933;">,</span> x<span style="color: #339933;">,</span> y<span style="color: #339933;">-</span><span style="color: #CC0000;">6</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Verwendung:<br />
<em>HTML</em></p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;canvas id=&quot;bubble&quot;&gt;&lt;/canvas&gt;</pre></div></div>

<p><em>JavaScript</em></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> ctx <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;bubble&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">getContext</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'2d'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
speechBubble<span style="color: #009900;">&#40;</span>ctx<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Das hier ist ein Test!&quot;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">5</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">40</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Das Resultat:<br />
<a href="http://blog.agrafix.net/wp-content/uploads/2011/11/canvasSpeechBubble.png" rel="lightbox[478]" title="HTML5 Canvas Sprechblase"><img src="http://blog.agrafix.net/wp-content/uploads/2011/11/canvasSpeechBubble.png" alt="Realisiert mit HTML5, Canvas und JavaScript" title="HTML5 Canvas Sprechblase" width="125" height="67" class="alignnone size-full wp-image-479" /></a></p>
<p>Ziemlich schick, oder? <img src='http://blog.agrafix.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<img src="http://blog.agrafix.net/?ak_action=api_record_view&id=478&type=feed" alt="" /><div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://blog.agrafix.net/2011/11/sprechblasen-mit-html5-canvas-und-javascript/' addthis:title='Sprechblasen mit HTML5, Canvas und JavaScript ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div><p><strong>Ähnliche Beiträge:</strong><ol>
<li><a href='http://blog.agrafix.net/2011/11/html5-websocket/' rel='bookmark' title='HTML5 WebSocket'>HTML5 WebSocket</a></li>
<li><a href='http://blog.agrafix.net/2009/08/in_array-fur-javascript/' rel='bookmark' title='in_array() für Javascript'>in_array() für Javascript</a></li>
<li><a href='http://blog.agrafix.net/2011/10/javascript-und-geolocation/' rel='bookmark' title='JavaScript und Geolocation'>JavaScript und Geolocation</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.agrafix.net/2011/11/sprechblasen-mit-html5-canvas-und-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AJAX und der &#8220;Vor&#8221; und &#8220;Zurück&#8221; Button</title>
		<link>http://blog.agrafix.net/2011/10/ajax-und-der-vor-und-zuruck-button/</link>
		<comments>http://blog.agrafix.net/2011/10/ajax-und-der-vor-und-zuruck-button/#comments</comments>
		<pubDate>Mon, 17 Oct 2011 07:18:29 +0000</pubDate>
		<dc:creator>agrafix</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[history]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[navigator]]></category>

		<guid isPermaLink="false">http://blog.agrafix.net/?p=451</guid>
		<description><![CDATA[Kleiner Hinweis: Dieser Blogpost nimmt an, das jQuery verwendet wird Dank AJAX kann man eine Menge Traffic einsparen &#8211; allerdings hat AJAX leider ein paar Nachteile: Die Browsernavigation, also die &#8220;Vor&#8221; und &#8220;Zurück&#8221; Knöpfe des Browsers, funktionieren nicht mehr. Hier mal ein Beispiel: HTML: &#60;a href=&#34;/content.html&#34;&#62;Inhalt ändern&#60;/a&#62; &#60;div id=&#34;content&#34;&#62;Hier ist Inhalt 1&#60;/div&#62; JavaScript: $&#40;&#34;a&#34;&#41;.live&#40;&#34;click&#34;, function [...]<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://blog.agrafix.net/2011/10/ajax-und-der-vor-und-zuruck-button/' addthis:title='AJAX und der &#8220;Vor&#8221; und &#8220;Zurück&#8221; Button ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>
<strong>Ähnliche Beiträge:</strong><ol>
<li><a href='http://blog.agrafix.net/2011/10/javascript-timers-mit-jquery/' rel='bookmark' title='JavaScript Timers mit jQuery'>JavaScript Timers mit jQuery</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Kleiner Hinweis: Dieser Blogpost nimmt an, das<a href="http://jquery.com/" target="_blank" title="jQuery JavaScript Framework"> jQuery </a>verwendet wird <img src='http://blog.agrafix.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Dank AJAX kann man eine Menge Traffic einsparen &#8211; allerdings hat AJAX leider ein paar Nachteile: Die Browsernavigation, also die &#8220;Vor&#8221; und &#8220;Zurück&#8221; Knöpfe des Browsers, funktionieren nicht mehr.<br />
Hier mal ein Beispiel:</p>
<p><strong>HTML:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/content.html&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Inhalt ändern<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;content&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Hier ist Inhalt 1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p><strong>JavaScript:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;a&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">live</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;click&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    e.<span style="color: #660066;">preventDefault</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#content'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">load</span><span style="color: #009900;">&#40;</span>e.<span style="color: #660066;">target</span>.<span style="color: #660066;">href</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #006600; font-style: italic;">// nothing here yet ;)</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Klickt man nun auf &#8220;Inhalt ändern&#8221;, erscheint der Inhalt von <em>content.html</em> im <em>content</em>-div. Wenn jetzt der Benutzer allerdings wieder <em>&#8220;Hier ist Inhalt 1&#8243;</em> sehen möchte, kann er nicht den &#8220;Zurück&#8221;-Button seines Browsers verwenden.</p>
<p>Um dieses Problem zu lösen gibt es zwei Möglichkeiten:</p>
<ul>
<li>Einen hash an die aktuelle URL anhängen, etwa so: /#!content.html</li>
<li>Das HTML5 window.history-Objekt bemühen</li>
</ul>
<p>Da die zweite Methode leider (noch) nicht von jedem Browser unterstützt wird, aber die wesentlich hübschere Methode ist, habe ich mir ein Objekt geschrieben, was beides kann!</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">/**
 * navigatorHistory
 *
 * Fixes navigator history for ajax-based sites
 *
 * @author agrafix &lt;mail@agrafix.net&gt;
 */</span>
<span style="color: #003366; font-weight: bold;">var</span> navigatorHistory <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #006600; font-style: italic;">/**
	 * Title of site
	 */</span>
	siteTitle<span style="color: #339933;">:</span> <span style="color: #3366CC;">''</span><span style="color: #339933;">,</span>
&nbsp;
	<span style="color: #006600; font-style: italic;">/**
	 * function to load content, needs to be set before hook()-call
	 */</span>
	loaderFunc<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span>
&nbsp;
	<span style="color: #006600; font-style: italic;">/**
	 * check if the browser supports pushState
	 */</span>
	isSupported <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> <span style="color: #009900;">&#40;</span>window.<span style="color: #660066;">history</span>.<span style="color: #660066;">pushState</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">'function'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
	<span style="color: #006600; font-style: italic;">/**
	 * add url to history
	 */</span>
	add <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>url<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">isSupported</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
			window.<span style="color: #660066;">history</span>
					.<span style="color: #660066;">pushState</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">siteTitle</span><span style="color: #339933;">,</span> url<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
			window.<span style="color: #660066;">location</span>.<span style="color: #660066;">hash</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;#!&quot;</span> <span style="color: #339933;">+</span> url<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
	<span style="color: #006600; font-style: italic;">/**
	 * listen for back-forward button events
	 */</span>
	hook <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">loaderFunc</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;No loaderFunc defined!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">return</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">isSupported</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #006600; font-style: italic;">// doesn't work with jquery, no idea why :O</span>
			window.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;popstate&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				navigatorHistory.<span style="color: #660066;">loaderFunc</span><span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">location</span>.<span style="color: #660066;">pathname</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
			$<span style="color: #009900;">&#40;</span>window<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'hashchange'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #003366; font-weight: bold;">var</span> location <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>window.<span style="color: #660066;">location</span>.<span style="color: #660066;">hash</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/^#!/</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				navigatorHistory.<span style="color: #660066;">loaderFunc</span><span style="color: #009900;">&#40;</span>location<span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Die Benutzung in Verbindung mit dem obigen HTML-Schnipsel ist denkbar einfach:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// funktion zum laden der Seiten definieren</span>
navigatorHistory.<span style="color: #660066;">loaderFunc</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>url<span style="color: #339933;">,</span> nohistory<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>nohistory<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		navigatorHistory.<span style="color: #660066;">add</span><span style="color: #009900;">&#40;</span>url<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#content'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">load</span><span style="color: #009900;">&#40;</span>url<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// seiten titel</span>
navigatorHistory.<span style="color: #660066;">siteTitle</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;Deine Seite&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// auf vor bzw. zurück-button klicks hören</span>
navigatorHistory.<span style="color: #660066;">hook</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// die eigentliche ajax-funktion</span>
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;a&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">live</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;click&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    e.<span style="color: #660066;">preventDefault</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	navigatorHistory.<span style="color: #660066;">loaderFunc</span><span style="color: #009900;">&#40;</span>e.<span style="color: #660066;">target</span>.<span style="color: #660066;">href</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Eigentlich relativ einfach einzubauen und es macht eine Seite deutlich benutzerfreundlicher!</p>
<img src="http://blog.agrafix.net/?ak_action=api_record_view&id=451&type=feed" alt="" /><div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://blog.agrafix.net/2011/10/ajax-und-der-vor-und-zuruck-button/' addthis:title='AJAX und der &#8220;Vor&#8221; und &#8220;Zurück&#8221; Button ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div><p><strong>Ähnliche Beiträge:</strong><ol>
<li><a href='http://blog.agrafix.net/2011/10/javascript-timers-mit-jquery/' rel='bookmark' title='JavaScript Timers mit jQuery'>JavaScript Timers mit jQuery</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.agrafix.net/2011/10/ajax-und-der-vor-und-zuruck-button/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unix-Timestamp in JavaScript formatieren</title>
		<link>http://blog.agrafix.net/2011/10/unix-timestamp-in-javascript-formatieren/</link>
		<comments>http://blog.agrafix.net/2011/10/unix-timestamp-in-javascript-formatieren/#comments</comments>
		<pubDate>Sun, 16 Oct 2011 00:33:59 +0000</pubDate>
		<dc:creator>agrafix</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[format]]></category>
		<category><![CDATA[time]]></category>
		<category><![CDATA[timestamp]]></category>

		<guid isPermaLink="false">http://blog.agrafix.net/?p=449</guid>
		<description><![CDATA[Um ein Unix-Timestamp mit JavaScript zu formatieren, habe ich mir folgendes Objekt geschrieben: var timeFormat = &#123; /** * Output format. * * d - current day * m - current month * Y - current Year * * H - current hour (24 hour system) * i - current minute * s - current [...]<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://blog.agrafix.net/2011/10/unix-timestamp-in-javascript-formatieren/' addthis:title='Unix-Timestamp in JavaScript formatieren ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>
<strong>Ähnliche Beiträge:</strong><ol>
<li><a href='http://blog.agrafix.net/2011/10/javascript-und-geolocation/' rel='bookmark' title='JavaScript und Geolocation'>JavaScript und Geolocation</a></li>
<li><a href='http://blog.agrafix.net/2009/08/in_array-fur-javascript/' rel='bookmark' title='in_array() für Javascript'>in_array() für Javascript</a></li>
<li><a href='http://blog.agrafix.net/2011/10/ajax-und-der-vor-und-zuruck-button/' rel='bookmark' title='AJAX und der &#8220;Vor&#8221; und &#8220;Zurück&#8221; Button'>AJAX und der &#8220;Vor&#8221; und &#8220;Zurück&#8221; Button</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Um ein Unix-Timestamp mit JavaScript zu formatieren, habe ich mir folgendes Objekt geschrieben:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> timeFormat <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #006600; font-style: italic;">/**
     * Output format.
     *
     * d - current day
     * m - current month
     * Y - current Year
     *
     * H - current hour (24 hour system)
     * i - current minute
     * s - current second
     */</span>
    displayFormat<span style="color: #339933;">:</span> <span style="color: #3366CC;">'d.m.Y - H:i:s'</span><span style="color: #339933;">,</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">/**
     * Format given unix-timestamp
     */</span>
    format<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>timestamp<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #006600; font-style: italic;">// convert unix timestamp to javascript date object</span>
        <span style="color: #003366; font-weight: bold;">var</span> d <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span>timestamp <span style="color: #339933;">*</span> <span style="color: #CC0000;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> output <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">displayFormat</span><span style="color: #339933;">;</span>
&nbsp;
        output <span style="color: #339933;">=</span> output.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/d/g</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">padZero</span><span style="color: #009900;">&#40;</span>d.<span style="color: #660066;">getDate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
            .<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/m/g</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">padZero</span><span style="color: #009900;">&#40;</span>d.<span style="color: #660066;">getMonth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
            .<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/Y/g</span><span style="color: #339933;">,</span> d.<span style="color: #660066;">getFullYear</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
            .<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/H/g</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">padZero</span><span style="color: #009900;">&#40;</span>d.<span style="color: #660066;">getHours</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
            .<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/i/g</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">padZero</span><span style="color: #009900;">&#40;</span>d.<span style="color: #660066;">getMinutes</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
            .<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/s/g</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">padZero</span><span style="color: #009900;">&#40;</span>d.<span style="color: #660066;">getSeconds</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
        <span style="color: #000066; font-weight: bold;">return</span> output<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">/**
     * add zero paddings to numbers smaller than 10
     */</span>
    padZero<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>number<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>number <span style="color: #339933;">&lt;</span> <span style="color: #CC0000;">10</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #3366CC;">&quot;0&quot;</span> <span style="color: #339933;">+</span> number.<span style="color: #660066;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #000066; font-weight: bold;">return</span> number<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Die Benutzung ist ziemlich einfach:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// schreibt 13.09.2011 - 13:30:23</span>
document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span>timeFormat.<span style="color: #660066;">format</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1318473023</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Man kann das Ausgabeformat über das <em>timeFormat.displayFormat</em> Feld steuern:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">timeFormat.<span style="color: #660066;">displayFormat</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'H:i'</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// gibt nur Stunden und Minuten aus</span>
document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span>timeFormat.<span style="color: #660066;">format</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1318473023</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// schreibt 13:30</span></pre></div></div>

<p>Wie bereits oben beschrieben sind folgende Zeichen möglich (auch mehrfach)</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">    <span style="color: #006600; font-style: italic;">/**
     * Ausgabeformat
     *
     * d - aktueller Tag
     * m - aktueller Monat
     * Y - aktuelles Jahr
     *
     * H - aktuelle Stunde
     * i - aktuelle Minute
     * s - aktuelle Sekunde
     */</span></pre></div></div>

<img src="http://blog.agrafix.net/?ak_action=api_record_view&id=449&type=feed" alt="" /><div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://blog.agrafix.net/2011/10/unix-timestamp-in-javascript-formatieren/' addthis:title='Unix-Timestamp in JavaScript formatieren ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div><p><strong>Ähnliche Beiträge:</strong><ol>
<li><a href='http://blog.agrafix.net/2011/10/javascript-und-geolocation/' rel='bookmark' title='JavaScript und Geolocation'>JavaScript und Geolocation</a></li>
<li><a href='http://blog.agrafix.net/2009/08/in_array-fur-javascript/' rel='bookmark' title='in_array() für Javascript'>in_array() für Javascript</a></li>
<li><a href='http://blog.agrafix.net/2011/10/ajax-und-der-vor-und-zuruck-button/' rel='bookmark' title='AJAX und der &#8220;Vor&#8221; und &#8220;Zurück&#8221; Button'>AJAX und der &#8220;Vor&#8221; und &#8220;Zurück&#8221; Button</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.agrafix.net/2011/10/unix-timestamp-in-javascript-formatieren/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaScript Timers mit jQuery</title>
		<link>http://blog.agrafix.net/2011/10/javascript-timers-mit-jquery/</link>
		<comments>http://blog.agrafix.net/2011/10/javascript-timers-mit-jquery/#comments</comments>
		<pubDate>Sat, 15 Oct 2011 01:02:28 +0000</pubDate>
		<dc:creator>agrafix</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[setInterval]]></category>
		<category><![CDATA[setTimeout]]></category>
		<category><![CDATA[Timers]]></category>

		<guid isPermaLink="false">http://blog.agrafix.net/?p=445</guid>
		<description><![CDATA[Timer in JavaScript zu realisieren ist eigentlich recht leicht, dazu braucht mal nur die Funktionen window.setTimeout bzw. window.setInterval mit entsprechenden Argumenten zu füttern. // funktion verzögert aufrufen function machWas&#40;&#41; &#123; alert&#40;'alert() mit 1000ms verzögerung!'&#41;; &#125; window.setTimeout&#40;machWas, 1000&#41;; &#160; // funktion alle X Millisekunden aufruden function machWasOft&#40;&#41; &#123; alert&#40;'alle 1000ms ein alert()'&#41;; &#125; window.setInterval&#40;machWasOft, 1000&#41;; Doch [...]<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://blog.agrafix.net/2011/10/javascript-timers-mit-jquery/' addthis:title='JavaScript Timers mit jQuery ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>
<strong>Ähnliche Beiträge:</strong><ol>
<li><a href='http://blog.agrafix.net/2012/01/keep-your-scope-jquery-proxy/' rel='bookmark' title='Keep your scope &#8211; jQuery.proxy'>Keep your scope &#8211; jQuery.proxy</a></li>
<li><a href='http://blog.agrafix.net/2009/08/in_array-fur-javascript/' rel='bookmark' title='in_array() für Javascript'>in_array() für Javascript</a></li>
<li><a href='http://blog.agrafix.net/2011/10/javascript-und-geolocation/' rel='bookmark' title='JavaScript und Geolocation'>JavaScript und Geolocation</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Timer in JavaScript zu realisieren ist eigentlich recht leicht, dazu braucht mal nur die Funktionen window.setTimeout bzw. window.setInterval mit entsprechenden Argumenten zu füttern.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// funktion verzögert aufrufen</span>
<span style="color: #003366; font-weight: bold;">function</span> machWas<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'alert() mit 1000ms verzögerung!'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
window.<span style="color: #660066;">setTimeout</span><span style="color: #009900;">&#40;</span>machWas<span style="color: #339933;">,</span> <span style="color: #CC0000;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// funktion alle X Millisekunden aufruden</span>
<span style="color: #003366; font-weight: bold;">function</span> machWasOft<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'alle 1000ms ein alert()'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
window.<span style="color: #660066;">setInterval</span><span style="color: #009900;">&#40;</span>machWasOft<span style="color: #339933;">,</span> <span style="color: #CC0000;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Doch was ist, wenn ich jetzt einen solchen Timer ändern oder abbrechen möchte? Das ist eigentlich auch nicht schwer &#8211; die Funktionen setTimeout/setInterval geben ein Objekt zurück über das sie sich wieder beenden lassen.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> x <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">function</span> machWasAbbrechbarOft<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    x <span style="color: #339933;">+=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>x <span style="color: #339933;">&gt;</span> <span style="color: #CC0000;">200</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        window.<span style="color: #660066;">clearInterval</span><span style="color: #009900;">&#40;</span>running<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// beende das &quot;Interval&quot; nach 201 Ausführungen</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #003366; font-weight: bold;">var</span> running <span style="color: #339933;">=</span> window.<span style="color: #660066;">setInterval</span><span style="color: #009900;">&#40;</span>machWasAbbrechbarOft<span style="color: #339933;">,</span> <span style="color: #CC0000;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Das funktioniert in kleinen JavaScript Codes sicher ohne Probleme, wenn man allerdings an einem großem JavaScript Projekt arbeitet, macht es die Arbeit nicht gerade leichter wenn man immer dieses Rückgabe-Objekt (im Beispiel <i>running</i>) irgendwo speichern muss, vorallem wenn man von überall im Code darauf zugreifen will.</p>
<p>Um dieses Problem zu lösen habe ich ein<a href="http://jquery.com/" target="_blank" title="jQuery JavaScript Framework"> jQuery </a>Timer Plugin gefunden. (Siehe <a href="http://plugins.jquery.com/project/timers" title="jQuery Timers" target="_blank">http://plugins.jquery.com/project/timers</a>) Wer an einem größerem JavaScript Projekt arbeitet, sollte meiner Meinung nach aufjedenfall auf ein Framework setzen &#8211;<a href="http://jquery.com/" target="_blank" title="jQuery JavaScript Framework"> jQuery </a>ist hier meine Wahl von daher bietet sich dieses Plugin an.</p>
<p>Mit diesem Plugin geht das &#8220;Interval&#8221; setzen dann wie folgt:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">everyTime</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1000</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;machWasOftAbbrechbar&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">// alle 1000ms</span>
  <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Hallo ich bin der '</span> <span style="color: #339933;">+</span> i <span style="color: #339933;">+</span> <span style="color: #3366CC;">'te Aufruf!'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// machWasOftAbbrechbar, hier die funktion die aufgerufen werden soll</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">200</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// 200 mal ausführen</span></pre></div></div>

<p>Der zweite Parameter, <i>machWasOftAbbrechbar</i>, stellt hierbei ein sogenanntes &#8220;label&#8221; dar, über das man den gestarten Timer dann wieder abbrechen kann:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">stopTime</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;machWasOftAbbrechbar&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// stoppe machWasOftAbbrechbar</span></pre></div></div>

<p>Viel mehr gibt&#8217;s eigentlich nicht dazu zu sagen &#8211; die Dokumentation dazu findet man, genau wie das Plugin selbst, unter <a href="http://plugins.jquery.com/project/timers" title="jQuery Timers" target="_blank">http://plugins.jquery.com/project/timers</a>.</p>
<img src="http://blog.agrafix.net/?ak_action=api_record_view&id=445&type=feed" alt="" /><div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://blog.agrafix.net/2011/10/javascript-timers-mit-jquery/' addthis:title='JavaScript Timers mit jQuery ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div><p><strong>Ähnliche Beiträge:</strong><ol>
<li><a href='http://blog.agrafix.net/2012/01/keep-your-scope-jquery-proxy/' rel='bookmark' title='Keep your scope &#8211; jQuery.proxy'>Keep your scope &#8211; jQuery.proxy</a></li>
<li><a href='http://blog.agrafix.net/2009/08/in_array-fur-javascript/' rel='bookmark' title='in_array() für Javascript'>in_array() für Javascript</a></li>
<li><a href='http://blog.agrafix.net/2011/10/javascript-und-geolocation/' rel='bookmark' title='JavaScript und Geolocation'>JavaScript und Geolocation</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.agrafix.net/2011/10/javascript-timers-mit-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaScript und Geolocation</title>
		<link>http://blog.agrafix.net/2011/10/javascript-und-geolocation/</link>
		<comments>http://blog.agrafix.net/2011/10/javascript-und-geolocation/#comments</comments>
		<pubDate>Fri, 14 Oct 2011 00:00:54 +0000</pubDate>
		<dc:creator>agrafix</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Programmieren]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[geo]]></category>
		<category><![CDATA[gps]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[mobile]]></category>

		<guid isPermaLink="false">http://blog.agrafix.net/?p=441</guid>
		<description><![CDATA[Seit Firefox 3.5, Opera 10.60 bzw. Safari/Webkit 5 ist es möglich per JavaScript mit Einverständniss des Benutzers seine Position zu ermitteln. Die Position wird dann entweder über eine angeschlossene GPS-Antenne oder über die verfügbaren WLans ermittelt. Die API dafür ist sehr leicht zu benutzen. Zunächst sollte geprüft werden ob der benutzte Browser Geolocation unterstützt. Das [...]<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://blog.agrafix.net/2011/10/javascript-und-geolocation/' addthis:title='JavaScript und Geolocation ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>
<strong>Ähnliche Beiträge:</strong><ol>
<li><a href='http://blog.agrafix.net/2009/08/in_array-fur-javascript/' rel='bookmark' title='in_array() für Javascript'>in_array() für Javascript</a></li>
<li><a href='http://blog.agrafix.net/2011/10/javascript-timers-mit-jquery/' rel='bookmark' title='JavaScript Timers mit jQuery'>JavaScript Timers mit jQuery</a></li>
<li><a href='http://blog.agrafix.net/2011/10/unix-timestamp-in-javascript-formatieren/' rel='bookmark' title='Unix-Timestamp in JavaScript formatieren'>Unix-Timestamp in JavaScript formatieren</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Seit Firefox 3.5, Opera 10.60 bzw. Safari/Webkit 5 ist es möglich per JavaScript mit Einverständniss des Benutzers seine Position zu ermitteln. Die Position wird dann entweder über eine angeschlossene GPS-Antenne oder über die verfügbaren WLans ermittelt. Die API dafür ist sehr leicht zu benutzen.</p>
<p>Zunächst sollte geprüft werden ob der benutzte Browser Geolocation unterstützt. Das geht wie folgt:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>navigator.<span style="color: #660066;">geolocation</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Sorry, dein Browser unterstützt keine Geolocation-API'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Jetzt ist es möglich die aktuelle Position abzufragen:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">navigator.<span style="color: #660066;">geolocation</span>.<span style="color: #660066;">getCurrentPosition</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>position<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>  
	<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Deine aktuelle Position ist: Lat: '</span> <span style="color: #339933;">+</span> position.<span style="color: #660066;">coords</span>.<span style="color: #660066;">latitude</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">' Long: '</span> <span style="color: #339933;">+</span> position.<span style="color: #660066;">coords</span>.<span style="color: #660066;">longitude</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>error<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Fehler beim finden der Position. Fehler: '</span> <span style="color: #339933;">+</span> error.<span style="color: #660066;">message</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>und bei jeder Änderung der Position erneut ein Event auszulösen:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> <span style="color: #339933;">=</span> locationHandler <span style="color: #339933;">=</span> navigator.<span style="color: #660066;">geolocation</span>.<span style="color: #660066;">watchPosition</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>position<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>  
	<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Deine neue Position ist: Lat: '</span> <span style="color: #339933;">+</span> position.<span style="color: #660066;">coords</span>.<span style="color: #660066;">latitude</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">' Long: '</span> <span style="color: #339933;">+</span> position.<span style="color: #660066;">coords</span>.<span style="color: #660066;">longitude</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>enableHighAccuracy<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span> maximumAge<span style="color: #339933;">:</span><span style="color: #CC0000;">120</span> <span style="color: #339933;">*</span> <span style="color: #CC0000;">1000</span><span style="color: #339933;">,</span> timeout<span style="color: #339933;">:</span><span style="color: #CC0000;">27000</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Hierbei kann man angeben</p>
<ul>
<li><i>enableHighAccuray:</i> ob man auf hohe Genauigkeit setzen möchte (sofern diese vom Gerät unterstützt wird)</li>
<li><i>maximumAge: (in ms)</i> wie alt die letzte Position maximal sein darf &#8211; je kleiner dieser Wert, desto öfterst wird auf dem Gerät die aktuelle Position abgefragt. </li>
<li><i>timeout: (in ms)</i> wann die Positionsbestimmung abgebrochen werden soll wenn sie nicht erfolgreich ist</li>
</ul>
<p>Wenn man die Positionsüberwachung wieder abbrechen will, hilft folgender API-Call weiter:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">navigator.<span style="color: #660066;">geolocation</span>.<span style="color: #660066;">clearWatch</span><span style="color: #009900;">&#40;</span>locationHandler<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Sehr nützlich, vorallem wenn man eine Webseite für Smartphones bastelt <img src='http://blog.agrafix.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<img src="http://blog.agrafix.net/?ak_action=api_record_view&id=441&type=feed" alt="" /><div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://blog.agrafix.net/2011/10/javascript-und-geolocation/' addthis:title='JavaScript und Geolocation ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div><p><strong>Ähnliche Beiträge:</strong><ol>
<li><a href='http://blog.agrafix.net/2009/08/in_array-fur-javascript/' rel='bookmark' title='in_array() für Javascript'>in_array() für Javascript</a></li>
<li><a href='http://blog.agrafix.net/2011/10/javascript-timers-mit-jquery/' rel='bookmark' title='JavaScript Timers mit jQuery'>JavaScript Timers mit jQuery</a></li>
<li><a href='http://blog.agrafix.net/2011/10/unix-timestamp-in-javascript-formatieren/' rel='bookmark' title='Unix-Timestamp in JavaScript formatieren'>Unix-Timestamp in JavaScript formatieren</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.agrafix.net/2011/10/javascript-und-geolocation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zippyshare Downloads Automatisieren *update*</title>
		<link>http://blog.agrafix.net/2011/02/zippyshare-downloads-automatisieren-update/</link>
		<comments>http://blog.agrafix.net/2011/02/zippyshare-downloads-automatisieren-update/#comments</comments>
		<pubDate>Wed, 16 Feb 2011 11:53:30 +0000</pubDate>
		<dc:creator>agrafix</dc:creator>
				<category><![CDATA[Autoit]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Programmieren]]></category>
		<category><![CDATA[downloadmanager]]></category>
		<category><![CDATA[zippyshare]]></category>

		<guid isPermaLink="false">http://blog.agrafix.net/2011/02/zippyshare-downloads-automatisieren-update/</guid>
		<description><![CDATA[Kurz nachdem ich den letzten Beitrag über zippyshare veröffentlicht habe, hat die Seite wieder umgestellt auf einen anderen &#8220;Schutz&#8221; der Downloadlinks. Diesmal ist es aber ziemlich einfach an diese zu geraten, man muss nur nach documents.getElementById(&#8216;dlbutton&#8217;).href = &#8220;&#8230;&#8221; suchen. Dort findet sich in Klammern ein einfacher mathematischer Ausdruck, der in fasst jeder Programmiersprache mit einem [...]<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://blog.agrafix.net/2011/02/zippyshare-downloads-automatisieren-update/' addthis:title='Zippyshare Downloads Automatisieren *update* ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>
<strong>Ähnliche Beiträge:</strong><ol>
<li><a href='http://blog.agrafix.net/2011/02/zippyshare-downloads-automatisieren/' rel='bookmark' title='Zippyshare Downloads automatisieren'>Zippyshare Downloads automatisieren</a></li>
<li><a href='http://blog.agrafix.net/2011/11/zippyshare-downloads-automatisieren-reloaded/' rel='bookmark' title='Zippyshare Downloads automatisieren [reloaded]'>Zippyshare Downloads automatisieren [reloaded]</a></li>
<li><a href='http://blog.agrafix.net/2011/01/visitor-stats-de-update/' rel='bookmark' title='Visitor-Stats.de Update'>Visitor-Stats.de Update</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Kurz nachdem ich den letzten Beitrag über zippyshare veröffentlicht habe, hat die Seite wieder umgestellt auf einen anderen &#8220;Schutz&#8221; der Downloadlinks. Diesmal ist es aber ziemlich einfach an diese zu geraten, man muss nur nach documents.getElementById(&#8216;dlbutton&#8217;).href = &#8220;&#8230;&#8221; suchen. Dort findet sich in Klammern ein einfacher mathematischer Ausdruck, der in fasst jeder Programmiersprache mit einem Einzeiler ausgeführt werden kann.</p>
<img src="http://blog.agrafix.net/?ak_action=api_record_view&id=423&type=feed" alt="" /><div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://blog.agrafix.net/2011/02/zippyshare-downloads-automatisieren-update/' addthis:title='Zippyshare Downloads Automatisieren *update* ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div><p><strong>Ähnliche Beiträge:</strong><ol>
<li><a href='http://blog.agrafix.net/2011/02/zippyshare-downloads-automatisieren/' rel='bookmark' title='Zippyshare Downloads automatisieren'>Zippyshare Downloads automatisieren</a></li>
<li><a href='http://blog.agrafix.net/2011/11/zippyshare-downloads-automatisieren-reloaded/' rel='bookmark' title='Zippyshare Downloads automatisieren [reloaded]'>Zippyshare Downloads automatisieren [reloaded]</a></li>
<li><a href='http://blog.agrafix.net/2011/01/visitor-stats-de-update/' rel='bookmark' title='Visitor-Stats.de Update'>Visitor-Stats.de Update</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.agrafix.net/2011/02/zippyshare-downloads-automatisieren-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zippyshare Downloads automatisieren</title>
		<link>http://blog.agrafix.net/2011/02/zippyshare-downloads-automatisieren/</link>
		<comments>http://blog.agrafix.net/2011/02/zippyshare-downloads-automatisieren/#comments</comments>
		<pubDate>Sat, 12 Feb 2011 21:57:09 +0000</pubDate>
		<dc:creator>agrafix</dc:creator>
				<category><![CDATA[Autoit]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Programmieren]]></category>
		<category><![CDATA[Projekte]]></category>
		<category><![CDATA[Webseiten]]></category>
		<category><![CDATA[downloadmanager]]></category>
		<category><![CDATA[evaluation]]></category>
		<category><![CDATA[parser]]></category>
		<category><![CDATA[regexp]]></category>
		<category><![CDATA[zipdata]]></category>
		<category><![CDATA[zippyshare]]></category>

		<guid isPermaLink="false">http://blog.agrafix.net/?p=418</guid>
		<description><![CDATA[Zur Zeit arbeite ich an einem Downloadmanager, der alle gängigen Download-Seiten unterstützen soll. Neulich hat zippyshare.com etwas eingebaut um genau diesen &#8220;automatischen&#8221; Downloads einen Riegel vorzuschieben: Der Download-Link wird jetzt per JavaScript &#8220;verschlüsselt&#8221;. Ich werde jetzt hier keinen Beispiel-Zippyshare-Downloadlink posten, das findet man mit etwas googlen schnell selbst Nun möchte ich erläutern, wie ich den [...]<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://blog.agrafix.net/2011/02/zippyshare-downloads-automatisieren/' addthis:title='Zippyshare Downloads automatisieren ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>
<strong>Ähnliche Beiträge:</strong><ol>
<li><a href='http://blog.agrafix.net/2011/11/zippyshare-downloads-automatisieren-reloaded/' rel='bookmark' title='Zippyshare Downloads automatisieren [reloaded]'>Zippyshare Downloads automatisieren [reloaded]</a></li>
<li><a href='http://blog.agrafix.net/2011/02/zippyshare-downloads-automatisieren-update/' rel='bookmark' title='Zippyshare Downloads Automatisieren *update*'>Zippyshare Downloads Automatisieren *update*</a></li>
<li><a href='http://blog.agrafix.net/2010/07/eigene-xor-funktion/' rel='bookmark' title='Eigene XOR Funktion'>Eigene XOR Funktion</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Zur Zeit arbeite ich an einem Downloadmanager, der alle gängigen Download-Seiten unterstützen soll. Neulich hat zippyshare.com etwas eingebaut um genau diesen &#8220;automatischen&#8221; Downloads einen Riegel vorzuschieben: Der Download-Link wird jetzt per JavaScript &#8220;verschlüsselt&#8221;. Ich werde jetzt hier keinen Beispiel-Zippyshare-Downloadlink posten, das findet man mit etwas googlen schnell selbst <img src='http://blog.agrafix.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Nun möchte ich erläutern, wie ich den Download-Link automatisch auslese:<br />
Zuerst entnehme ich der Seite per Regulärem Ausdruck die benötigten JavaScript Variablen:<br />
<i>xHTML-Code der Stelle</i></p>

<div class="wp_syntax"><div class="code"><pre class="xhtml" style="font-family:monospace;">&lt;script type=&quot;text/javascript&quot;&gt;
var zipdata = eval(eval(eval(((function() {var parzDiXdet= (((function() {var hutByDojpZ= eval(379);var BvLCmMYDEQB= ((function() {var qefrKDjxbJ= eval(51);var DKbCbnceoJN= ((((18+(3*3)))+((function() {var kzCDpmQUwq= eval(eval(43));var UoRHKeZvyaH= 23;return (kzCDpmQUwq+UoRHKeZvyaH)})())));return (qefrKDjxbJ+DKbCbnceoJN)})());return (hutByDojpZ+BvLCmMYDEQB)})())*eval((19*eval(29)+((eval((eval(3)*3))+(((function() {var fhYCresaSD= 0;var XRIVTZgfbzF= eval(2);return (fhYCresaSD+XRIVTZgfbzF)})())*eval(3)+1)))))+468);var MpIWcCCkdZo= (((function() {var ciqbBKFBYW= eval(80);var aAZRNKwkocE= 242;return (ciqbBKFBYW+aAZRNKwkocE)})())*(3*(8*eval(32)+(1*((function() {var yMgeUqevwX= ((function() {var CIechCiWBN= 0;var GoKsZmkLAMw= ((function() {var JYpKjwyxxu= 0;var YfDpdwhpscp= 2;return (JYpKjwyxxu+YfDpdwhpscp)})());return (CIechCiWBN+GoKsZmkLAMw)})());var FklyvoQTPho= eval(eval(2));return (yMgeUqevwX+FklyvoQTPho)})())))+eval(eval((1*((0+eval(2)))))))+261);return (parzDiXdet+MpIWcCCkdZo)})()))));
var fulllink = 'http://www123.zippyshare.com/d/123456789/'+zipdata+'/Alarmclock.mp3';
document.getElementById('dlbutton').href = fulllink;
&lt;/script&gt;</pre></div></div>

<p><i>Regexp zum auslesen</i></p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="font-weight: bold; color: #AA0000;">$aFind</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">StringRegExp</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$ZippySrc</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #9977BB;">&quot;&lt;script type=&quot;</span><span style="font-weight: bold; color: #9977BB;">&quot;text/javascript&quot;</span><span style="font-weight: bold; color: #9977BB;">&quot;&gt;\s*(var zipdata = .*;)\s*var fulllink = '(.*)';\s*document&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#41;</span></pre></div></div>

<p>Nun muss die Variable &#8220;zipdata&#8221; evaluiert werden. Dies mache ich wie folgt:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="font-style: italic; color: #009933;">;</span>
<span style="font-style: italic; color: #009933;">;</span>
<span style="font-style: italic; color: #009933;">; Evaluate zippyshare.com JavaScript</span>
<span style="font-style: italic; color: #009933;">;</span>
<span style="font-style: italic; color: #009933;">; Coded by www.agrafix.net</span>
<span style="font-style: italic; color: #009933;">;</span>
<span style="font-style: italic; color: #009933;">;</span>
<span style="color: #0000FF; font-weight: bold;">Func</span> _JSParse_Parse<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sJavaScript</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">For</span> <span style="font-weight: bold; color: #AA0000;">$_x</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span> <span style="color: #0000FF; font-weight: bold;">To</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">50</span>
&nbsp;
		<span style="color: #0000FF; font-weight: bold;">If</span> <span style="color: #000080; font-style: italic; font-weight: bold;">StringRegExp</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sJavaScript</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #9977BB;">&quot;var zipdata = ([0-9]*);&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span> <span style="color: #0000FF; font-weight: bold;">Then</span>
			<span style="color: #0000FF; font-weight: bold;">ExitLoop</span>
		<span style="color: #0000FF; font-weight: bold;">EndIf</span>
&nbsp;
		<span style="font-weight: bold; color: #AA0000;">$sJavaScript</span> <span style="color: #FF0000; font-weight: bold;">=</span> _JSParse_NumericVariableDeclarations<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sJavaScript</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="font-weight: bold; color: #AA0000;">$sJavaScript</span> <span style="color: #FF0000; font-weight: bold;">=</span> _JSParse_EvaluateEasyMath<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sJavaScript</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="font-weight: bold; color: #AA0000;">$sJavaScript</span> <span style="color: #FF0000; font-weight: bold;">=</span> _JSParse_SimpleEvals<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sJavaScript</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="font-weight: bold; color: #AA0000;">$sJavaScript</span> <span style="color: #FF0000; font-weight: bold;">=</span> _JSParse_SimpleFunctions<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sJavaScript</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">Next</span>
&nbsp;
	<span style="font-weight: bold; color: #AA0000;">$m</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">StringRegExp</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sJavaScript</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #9977BB;">&quot;var zipdata = ([0-9]*);&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
	<span style="color: #0000FF; font-weight: bold;">Return</span> <span style="font-weight: bold; color: #AA0000;">$m</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">EndFunc</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Func</span> _JSParse_SourceReplace<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$aArray</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #AA0000;">$sJavaScript</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">For</span> <span style="font-weight: bold; color: #AA0000;">$i</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span> <span style="color: #0000FF; font-weight: bold;">To</span> <span style="color: #000080; font-style: italic; font-weight: bold;">UBound</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$aArray</span><span style="color: #FF0000; font-weight: bold;">&#41;</span> <span style="color: #FF0000; font-weight: bold;">-</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span> <span style="color: #0000FF; font-weight: bold;">Step</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">2</span>
		<span style="font-weight: bold; color: #AA0000;">$sJavaScript</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">StringReplace</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sJavaScript</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #AA0000;">$aArray</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$i</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #AA0000;">$aArray</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$i</span><span style="color: #FF0000; font-weight: bold;">+</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="color: #0000FF; font-weight: bold;">Next</span>
&nbsp;
	<span style="color: #0000FF; font-weight: bold;">Return</span> <span style="font-weight: bold; color: #AA0000;">$sJavaScript</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Func</span> _JSParse_NumericVariableDeclarations<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sJavaScript</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
	<span style="font-weight: bold; color: #AA0000;">$aNumDeclarations</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">StringRegExp</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sJavaScript</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #9977BB;">&quot;var ([a-zA-Z0-9_-]*) ?= ([0-9]*);&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">3</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
	<span style="font-weight: bold; color: #AA0000;">$sJavaScript</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">StringRegExpReplace</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sJavaScript</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #9977BB;">&quot;var ([a-zA-Z0-9_-]*) ?= ([0-9]*);&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #9977BB;">&quot;&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
	<span style="font-weight: bold; color: #AA0000;">$sJavaScript</span> <span style="color: #FF0000; font-weight: bold;">=</span> _JSParse_SourceReplace<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$aNumDeclarations</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #AA0000;">$sJavaScript</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
	<span style="color: #0000FF; font-weight: bold;">Return</span> <span style="font-weight: bold; color: #AA0000;">$sJavaScript</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Func</span> _JSParse_EvaluateEasyMath<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sJavaScript</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
	<span style="color: #0000FF; font-weight: bold;">While</span> <span style="color: #000080; font-style: italic; font-weight: bold;">StringRegExp</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sJavaScript</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #9977BB;">&quot;\(([0-9]*?[+\-*/]?[0-9]*[+\-*/][0-9]*)\)&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
		<span style="font-weight: bold; color: #AA0000;">$aMatches</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">StringRegExp</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sJavaScript</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #9977BB;">&quot;\(([0-9]*?[+\-*/]?[0-9]*[+\-*/][0-9]*)\)&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">3</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
		<span style="color: #0000FF; font-weight: bold;">For</span> <span style="font-weight: bold; color: #AA0000;">$i</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span> <span style="color: #0000FF; font-weight: bold;">To</span> <span style="color: #000080; font-style: italic; font-weight: bold;">UBound</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$aMatches</span><span style="color: #FF0000; font-weight: bold;">&#41;</span> <span style="color: #FF0000; font-weight: bold;">-</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span>
			<span style="font-weight: bold; color: #AA0000;">$Result</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">Execute</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$aMatches</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$i</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
			<span style="font-weight: bold; color: #AA0000;">$sJavaScript</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">StringReplace</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sJavaScript</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #9977BB;">&quot;(&quot;</span> <span style="color: #FF0000; font-weight: bold;">&amp;</span> <span style="font-weight: bold; color: #AA0000;">$aMatches</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$i</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">&amp;</span> <span style="font-weight: bold; color: #9977BB;">&quot;)&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #AA0000;">$Result</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Next</span>
&nbsp;
	<span style="color: #0000FF; font-weight: bold;">WEnd</span>
&nbsp;
	<span style="color: #0000FF; font-weight: bold;">Return</span> <span style="font-weight: bold; color: #AA0000;">$sJavaScript</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">EndFunc</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Func</span> _JSParse_SimpleEvals<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sJavaScript</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
	<span style="color: #0000FF; font-weight: bold;">While</span> <span style="color: #000080; font-style: italic; font-weight: bold;">StringRegExp</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sJavaScript</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #9977BB;">&quot;eval\(([0-9]*)\)&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
		<span style="font-weight: bold; color: #AA0000;">$aMatches</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">StringRegExp</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sJavaScript</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #9977BB;">&quot;eval\(([0-9]*)\)&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">3</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
		<span style="color: #0000FF; font-weight: bold;">For</span> <span style="font-weight: bold; color: #AA0000;">$i</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span> <span style="color: #0000FF; font-weight: bold;">To</span> <span style="color: #000080; font-style: italic; font-weight: bold;">UBound</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$aMatches</span><span style="color: #FF0000; font-weight: bold;">&#41;</span> <span style="color: #FF0000; font-weight: bold;">-</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span>
			<span style="font-weight: bold; color: #AA0000;">$sJavaScript</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">StringReplace</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sJavaScript</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #9977BB;">&quot;eval(&quot;</span> <span style="color: #FF0000; font-weight: bold;">&amp;</span> <span style="font-weight: bold; color: #AA0000;">$aMatches</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$i</span><span style="color: #FF0000; font-weight: bold;">&#93;</span> <span style="color: #FF0000; font-weight: bold;">&amp;</span> <span style="font-weight: bold; color: #9977BB;">&quot;)&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #AA0000;">$aMatches</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="font-weight: bold; color: #AA0000;">$i</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
		<span style="color: #0000FF; font-weight: bold;">Next</span>
&nbsp;
	<span style="color: #0000FF; font-weight: bold;">WEnd</span>
&nbsp;
	<span style="font-weight: bold; color: #AA0000;">$sJavaScript</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">StringRegExpReplace</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sJavaScript</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #9977BB;">&quot;\(([0-9]{1,11})\)&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #9977BB;">&quot;$1&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
	<span style="color: #0000FF; font-weight: bold;">Return</span> <span style="font-weight: bold; color: #AA0000;">$sJavaScript</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Func</span> _JSParse_SimpleFunctions<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sJavaScript</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
	<span style="font-weight: bold; color: #AA0000;">$sJavaScript</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">StringRegExpReplace</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$sJavaScript</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #9977BB;">&quot;\(function\(\) {return ([0-9]*)}\)\(\)&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #9977BB;">&quot;$1&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
&nbsp;
	<span style="color: #0000FF; font-weight: bold;">Return</span> <span style="font-weight: bold; color: #AA0000;">$sJavaScript</span>
<span style="color: #0000FF; font-weight: bold;">EndFunc</span></pre></div></div>

<p>Nun muss ich die Funktion nur noch mit den obigen Werten aus meiner RegExp aufrufen, die JavaScript Variable &#8220;fulllink&#8221; anpassen und aufrufen:</p>

<div class="wp_syntax"><div class="code"><pre class="autoit" style="font-family:monospace;"><span style="font-weight: bold; color: #AA0000;">$url</span> <span style="color: #FF0000; font-weight: bold;">=</span> <span style="color: #000080; font-style: italic; font-weight: bold;">StringReplace</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$aFind</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #9977BB;">&quot;'+zipdata+'&quot;</span><span style="color: #FF0000; font-weight: bold;">,</span> _JSParse_Parse<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$aFind</span><span style="color: #FF0000; font-weight: bold;">&#91;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#93;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #000080; font-style: italic; font-weight: bold;">INetGet</span><span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="font-weight: bold; color: #AA0000;">$url</span><span style="color: #FF0000; font-weight: bold;">,</span> <span style="font-weight: bold; color: #9977BB;">&quot;Alarm.mp3&quot;</span><span style="color: #FF0000; font-weight: bold;">&#41;</span></pre></div></div>

<p>Das war&#8217;s auch schon. Alle Source-Codes sind in AutoIT. Natürlich ist _JSParse kein funktionierender JavaScript Parser, sondern einfach nur eine Funktionssammlung die eben diesen Zippyshare-JavaScript-Haufen evaluieren kann <img src='http://blog.agrafix.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Der obige Source-Code darf natürlich verwendet, verändert und verteilt werden, ich bitte legendlich um einen kleinen Hinweis auf den Ursprung (http://www.agrafix.net).</p>
<img src="http://blog.agrafix.net/?ak_action=api_record_view&id=418&type=feed" alt="" /><div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://blog.agrafix.net/2011/02/zippyshare-downloads-automatisieren/' addthis:title='Zippyshare Downloads automatisieren ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div><p><strong>Ähnliche Beiträge:</strong><ol>
<li><a href='http://blog.agrafix.net/2011/11/zippyshare-downloads-automatisieren-reloaded/' rel='bookmark' title='Zippyshare Downloads automatisieren [reloaded]'>Zippyshare Downloads automatisieren [reloaded]</a></li>
<li><a href='http://blog.agrafix.net/2011/02/zippyshare-downloads-automatisieren-update/' rel='bookmark' title='Zippyshare Downloads Automatisieren *update*'>Zippyshare Downloads Automatisieren *update*</a></li>
<li><a href='http://blog.agrafix.net/2010/07/eigene-xor-funktion/' rel='bookmark' title='Eigene XOR Funktion'>Eigene XOR Funktion</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.agrafix.net/2011/02/zippyshare-downloads-automatisieren/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

