﻿<?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>Ladysign Dev Blog &#187; javascript</title>
	<atom:link href="http://www.ladysign-apps.com/blog/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ladysign-apps.com/blog</link>
	<description>Girls can code.</description>
	<lastBuildDate>Mon, 01 Feb 2010 09:44:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Mash-ups with YQL</title>
		<link>http://www.ladysign-apps.com/blog/code/javascript/mash-ups-with-yql/</link>
		<comments>http://www.ladysign-apps.com/blog/code/javascript/mash-ups-with-yql/#comments</comments>
		<pubDate>Sat, 07 Nov 2009 11:00:32 +0000</pubDate>
		<dc:creator>Lee</dc:creator>
				<category><![CDATA[YUI Library]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[corizon]]></category>
		<category><![CDATA[mash-ups]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[yql]]></category>

		<guid isPermaLink="false">http://www.ladysign-apps.com/blog/?p=923</guid>
		<description><![CDATA[<h5>&#8230;and why Corizon mashups suck.</h5>
<p><strong>Difficulty:</strong> 2 out of 5 stars<br />
It was because of working with Corizon that I became more interested in creating Mas[......]</p>]]></description>
			<content:encoded><![CDATA[<h5>&#8230;and why Corizon mashups suck.</h5>
<p><strong>Difficulty:</strong> 2 out of 5 stars<br />
It was because of working with Corizon that I became more interested in creating Mash-ups*.<br />
During the last 2 years, I&#8217;ve seen a lot of mash-up tools, From the easy (&#8221;Lego-like&#8221;) Popfly from Microsoft which is recently discontinued, to large handy API&#8217;s or serverside Java frameworks; such as the nice but heavy <a title="SiteMesh" href="http://www.opensymphony.com/sitemesh/" id="i2v4">SiteMesh</a> framework.<br />
But it was the <a href="http://www.corizon.com/">Corizon mash-up</a> toolkit that I started to realize, coding mash-ups can have it&#8217;s ups and downs.</p>
<p>In my opinion creating a mash-up should be easy &amp; fast. Not buggy and heavy (running 2 or 3 Tomcat servers in the background *kuch*). Also it&#8217;s an unwritten rule that for a mash-up you should not first destroy and rebuild it&#8217;s components before you gonna mix them up. This means you can only mash-up content what&#8217;s in your maintenance and when one of your components changes, your mash-up is broken.<br />
It&#8217;s not a wonder that I became extremely positive about YQL, when I first saw this working.<br />
And now, after <a href="http://www.fronteers.nl">Fronteers 2009</a>, where I had a presentation and talk with <a href="http://icant.co.uk">Chris Heilmann</a> from Yahoo.</p>
<p>With YQL (Yahoo Query Language), you can make the same mash-ups, client or serverside and you don&#8217;t need thousands lines of code.<br />
<b>Why you should use YQL for a mash-up?</b></p>
<ul>
<li>You won’t use your own bandwidth, but the bandwidth from Yahoo.</li>
<li>It’s easy, just the basic SQL knowledge is required.</li>
<li>It’s lightweight.</li>
<li>It’s fast.</li>
</ul>
<p>But like every Mashup tool, there are also downside&#8217;s. So it&#8217;s good to consider:</p>
<p><b>Why you shouldn&#8217;t use YQL for a mash-up?</b></p>
<ul>
<li>When one of the including components is slow or has timeouts, you result object will be <strong>null</strong>.</li>
</ul>
<h5>Mash-ups with YQL</h5>
<p>Ok enough with the theory. Let&#8217;s practice with a simple YQL mash-up. As you might know, I like videogames. So I want to have a website with the release dates of games on my website, which I can watch on YouTube. Fokzine Games (<a href="http://games.fok.nl/overzicht.php?action=release">http://games.fok.nl/overzicht.php?action=release</a>) has a nice game release list.</p>
<ul>
<li>For using this tutorial, you will need a Yahoo Developer Account, which you can create for free. </li>
<li>Unless you like to write full XPath lines without any help,<br />
you’ll also need <a title="Mozilla Firefox" href="http://www.mozilla-europe.org/nl/firefox/" id="me3x">Mozilla Firefox</a> browser with the <a title="Firebug" href="https://addons.mozilla.org/en-US/firefox/addon/1843" id="f_1b">Firebug</a> plugin installed.</li>
</ul>
<ol>
<li><b>Register your Yahoo Dev account.</b><br />
Go to the below URL, register your Yahoo account and login<br />
to the YQL console:&nbsp;<a href="http://developer.yahoo.com/yql/console/" target="_blank">http://developer.yahoo.com/yql</a>
</li>
<li><b>Query the content.</b><br />
YQL is quite similar to SQL. To query content (the videogame<br />
release list) from an external website, I will select all the HTML nodes from an URL. With Xpath I can point to the part of the website I will need. (Now you’ll need Firebug, inspect the website, till you’ll reach the table tag of the release list. – In top of your Firebug screen, you will see the full Xpath line.<br />
– Just right click, and “Copy Xpath”. This will be your YQL query for selecting the table tag on Fok.nl Game Release Page:</p>
<pre class="brush: sql;">
select * from html where url ='http://games.fok.nl/overzicht.php?action=release' and xpath ='//*[@id=&quot;itemtext&quot;]'
//or select the tr tag on Fok.nl Game Release page
//(note that I removed “tbody” from the xpath line to make it work)
select * from html where url ='http://games.fok.nl/overzicht.php?action=release' and xpath ='/html/body/div[4]/table/tr/td[2]/div[2]/div/table/tr'
</pre>
<p>Hit enter (or press “Test”) and you can switch between formatted view or tree view to see the result. Result can be in XML of JSON.<br />
Also note that you can copy the REST URL Query, from the console:<br />
<strong><br />
http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%20%3D%20&#8242;http%3A%2F%2Fgames.fok.nl%2Foverzicht.php%3Faction%3Drelease&#8217;%20and%20xpath%20%3D%20&#8242;%2Fhtml%2Fbody%2Fdiv%5B4%5D%2Ftable%2Ftr%2Ftd%5B2%5D%2Fdiv%5B2%5D%2Fdiv%2Ftable%2Ftr&#8217;&amp;format=xml<br />
</strong><br />
<img src="yql.jpg" alt="YQL Console" />
</li>
<li>
<b>How the retrieved XML looks like:</b></p>
<pre class="brush: xml;">&lt;query xmlns:yahoo=&quot;http://www.yahooapis.com/v1/base.rng&quot;yahoo:count=&quot;50&quot; yahoo:created=&quot;2009-09-25T12:14:12Z&quot;yahoo:lang=&quot;en-US&quot; yahoo:updated=&quot;2009-09-25T12:14:12Z&quot;
yahoo:uri=&quot;http://query.yahooapis.com/v1/yql?q=select+*+from+html+where+url+%3D+%27http%3A%2F%2Fgames.fok.nl%2Foverzicht.php%3Faction%3Drelease%27+and+xpath+%3D+%27%2Fhtml%2Fbody%2Fdiv%5B4%5D%2Ftable%2Ftr%2Ftd%5B2%5D%2Fdiv%5B2%5D%2Fdiv%2Ftable%2Ftr%27&quot;&gt;
&lt;diagnostics&gt;
&lt;publiclyCallable&gt;true&lt;/publiclyCallable&gt;
&lt;url execution-time=&quot;263&quot; proxy=&quot;DEFAULT&quot;&gt;&lt;![CDATA[http://games.fok.nl/overzicht.php?action=release]]&gt;&lt;/url&gt;
&lt;user-time&gt;272&lt;/user-time&gt;
&lt;service-time&gt;263&lt;/service-time&gt;
&lt;build-version&gt;3130&lt;/build-version&gt;
&lt;/diagnostics&gt;
&lt;results&gt;
 &lt;tr bgcolor=&quot;#E0E0E0&quot;&gt;
  &lt;td&gt;
   &lt;img alt=&quot;PC&quot; src=&quot;http://images.fok.nl/ads/games/IB_PC.png&quot;/&gt;
  &lt;/td&gt;
  &lt;td&gt;
   &lt;p&gt;29-09-2009&lt;/p&gt;
  &lt;/td&gt;
  &lt;td&gt;
   &lt;a class=&quot;invisiblelink&quot; href=&quot;gameinfo.php?gameid=9985&quot;&gt;Tales of Monkey Island episode 3&lt;/a&gt;
  &lt;/td&gt;
 &lt;/tr&gt;
  ..
&lt;/results&gt;
&lt;/query&gt;</pre>
<p><b>How your JSON (Javascript object looks like:</b></p>
<pre class="brush: jscript;">releaseList({
 &quot;query&quot;:{
 &quot;count&quot;:&quot;50&quot;,
 &quot;created&quot;:&quot;2009-09-25T12:10:17Z&quot;,
 &quot;lang&quot;:&quot;en-US&quot;,
 &quot;updated&quot;:&quot;2009-09-25T12:10:17Z&quot;,
 &quot;uri&quot;:&quot;http://query.yahooapis.com/v1/yql?q=select+*+from+html+where+url+%3D+%27http%3A%2F%2Fgames.fok.nl%2Foverzicht.php%3Faction%3Drelease%27+and+xpath+%3D+%27%2Fhtml%2Fbody%2Fdiv%5B4%5D%2Ftable%2Ftr%2Ftd%5B2%5D%2Fdiv%5B2%5D%2Fdiv%2Ftable%2Ftr%27&quot;,
 &quot;diagnostics&quot;:{
  &quot;publiclyCallable&quot;:&quot;true&quot;,
  &quot;url&quot;:{
   &quot;execution-time&quot;:&quot;28&quot;,
   &quot;proxy&quot;:&quot;DEFAULT&quot;,
   &quot;content&quot;:&quot;http://games.fok.nl/overzicht.php?action=release&quot;
  },
 &quot;user-time&quot;:&quot;36&quot;,
 &quot;service-time&quot;:&quot;28&quot;,
 &quot;build-version&quot;:&quot;3130&quot;
 },
&quot;results&quot;:{
 &quot;tr&quot;:[{
 &quot;bgcolor&quot;:&quot;#E0E0E0&quot;,
 &quot;td&quot;:[.. ]
 }
..
 ]
}}});</pre>
</li>
<li><b>Use the YQL widget.</b><br />
Create a new HTML page. In this page, you&#8217;ll include the YQL JS Widget:<br />
<a href="http://github.com/sh1mmer/dotnet-yql-tutorial/blob/master/yql_js_widget.js" target="_blank">http://github.com/sh1mmer/dotnet-yql-tutorial/blob/master/yql_js_widget.js</a><br />
This is a pre-made Javascript widget. If you check out the links on the end of this article, you can check out other implementations as well. (Such as Dojo-YQL or JQuery YQL).<br />
For this article, we will use vanilla Javascript.</li>
<li><b>Create the Mash-up.</b><br />
The only think what you&#8217;ll need now is the logic to implement the previous made YQL query, to have the YQL results in your Document Object Model (DOM).<br />
With the Firebug plug-in, you can check the &#8220;Net&#8221; tab, to see if the correct object is retrieved. You can walk through the results, and implement it in your Javascript to do fancy things with it.</li>
<pre class="brush: xml;">
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;YQL - Game Release&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;yql-js-widget.js&quot; &gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
var config = {};
var format = '&lt;li class=&quot;{td[0].img.alt}&quot;&gt;{td[1].p} - &lt;a href=&quot;http://games.fok.nl/{td[2].a.href}&quot; target=&quot;_blank&quot;&gt;{td[2].a.content}&lt;/a&gt; - &lt;a href=&quot;http://www.youtube.com/results?search_query={td[2].a.content}&quot; target=&quot;_blank&quot;&gt;Watch on YouTube&lt;/a&gt;&lt;/li&gt;';
var gameQuery = &quot;select * from html where url = 'http://games.fok.nl/overzicht.php?action=release' and xpath = '/html/body/div[4]/table/tr/td[2]/div[2]/div/table/tr'&quot;;
yqlWidget.push(gameQuery, config, format, &quot;widgetContainer&quot;);
yqlWidget.render();
&lt;/script&gt;&lt;ul id=&quot;widgetContainer&quot;&gt;&lt;/ul&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>Well that&#8217;s it. See how easy it is to create a nice Mash-up? As long as you can reach the DOM, you can mash-up everything. Below my article, I&#8217;ve written some nice links. If you liked my article or you would like to discuss with me about YQL or Mash-up technologies; feel free to add me on <a title="LinkedIn" href="http://www.linkedin.com/in/leeboonstra" id="a93_">LinkedIn</a> or <a title="Twitter" href="http://twitter.com/ladysign" id="e:f5">Twitter</a>.</p>
<ul>
<li>YQL Community:<a href="http://github.com/yql/" target="_blank"> http://github.com/yql/</a></li>
<li>YQL video by Jonathan LeBlanc: <a href="http://developer.yahoo.com/yui/theater/video.php?v=leblanc-yql" target="_blank">http://developer.yahoo.com/yui/theater/video.php?v=leblanc-yql</a></li>
</ul>
<h6>* In webdevelopment, a mashup is a web page or application that combines<br />
data or functionality from two or more external sources to create a new<br />
service. An example of a Mash-up is a Google Map combined with Wikipedia<br />
town information and a (accuweather.com) Weather indicator.</h6>
</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.ladysign-apps.com/blog/code/javascript/mash-ups-with-yql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Invoke a Java Servlet with Javascript</title>
		<link>http://www.ladysign-apps.com/blog/code/javascript/invoke-a-java-servlet-with-javascript/</link>
		<comments>http://www.ladysign-apps.com/blog/code/javascript/invoke-a-java-servlet-with-javascript/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 15:05:31 +0000</pubDate>
		<dc:creator>Lee</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[request]]></category>
		<category><![CDATA[servlet]]></category>

		<guid isPermaLink="false">http://ladysign-apps.com/blog/?p=830</guid>
		<description><![CDATA[<p><strong>Difficulty:</strong> 3 out of 5 stars<br />
It is possible to invoke a Java Servlet from your Javascript.<br />
Just implement this code. Please see the comments in the fu[......]</p>]]></description>
			<content:encoded><![CDATA[<p><strong>Difficulty:</strong> 3 out of 5 stars<br />
It is possible to invoke a Java Servlet from your Javascript.<br />
Just implement this code. Please see the comments in the function.</p>
<pre class="brush: jscript;">var request;
/*
 * doRequest
 * param servletName - Javascript String, Servlet name (as implemented in your config)
 * param servletArguments - Javascript String, any parameters
 */
function doSomeRequest(servletName, servletArguments){
    var servlet = servletName;
    var arg = servletArguments;
    var req = servlet + &quot;?&quot; + arg;

    addRequest(req);
    request.onreadystatechange = function(){
        //do something with the response
    }
}

function addRequest(req) {
    try {   //create a request for netscape, mozilla, opera, etc.
        request = new XMLHttpRequest();
    }catch (e) {

        try {    //create a request for internet explorer
            request = new ActiveXObject(&quot;Microsoft.XMLHTTP&quot;);
        }catch (e) {   //do some error-handling
            alert(&quot;XMLHttpRequest error: &quot; + e);
        }
    }

    request.open(&quot;GET&quot;, req, true);   //prepare the request
    request.send(null);   //send it
    return request;   //return the request
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ladysign-apps.com/blog/code/javascript/invoke-a-java-servlet-with-javascript/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cookies in Javascript</title>
		<link>http://www.ladysign-apps.com/blog/code/javascript/cookies-in-javascript/</link>
		<comments>http://www.ladysign-apps.com/blog/code/javascript/cookies-in-javascript/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 15:10:00 +0000</pubDate>
		<dc:creator>Lee</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[cookies]]></category>

		<guid isPermaLink="false">http://ladysign-apps.com/blog/?p=791</guid>
		<description><![CDATA[<p><strong>Difficulty:</strong> 2 out of 5 stars<br />
A cookie (also tracking cookie, browser cookie, and HTTP cookie) is a small string of text stored on a user&#8217;s compu[......]</p>]]></description>
			<content:encoded><![CDATA[<p><strong>Difficulty:</strong> 2 out of 5 stars<br />
A cookie (also tracking cookie, browser cookie, and HTTP cookie) is a small string of text stored on a user&#8217;s computer by a web browser. A cookie consists of one or more name-value pairs containing bits of information.<br />
Beside the name/value pair, a cookie may also contain an expiration date, a path, a domain name, and whether the cookie is intended only for encrypted connections. These pieces of data follow the name=newvalue pair and are separated by semicolons. For example, a cookie can be created by the server by sending a line </p>
<pre class="brush: jscript;">Set-Cookie: name=newvalue; expires=date; path=/; domain=.example.org.</pre>
<p>With Javascript you can also set cookies. It&#8217;s not hard at all. I think it&#8217;s useful for folding/unfolding or hiding/displaying CSS content. This part of Javascript I wrote for setting, getting and deleting a cookie:</p>
<pre class="brush: jscript;">/*
* Set the cookie
* @param name - the name of the cookie variable
* @param value - the value of the variable which will be saved in the cookie.
* @expires - the
*/
function setCookie(name, value, expires) {
	var today = new Date();  //set new date object
	var defaultDays = 30;
	today.setTime(today.getTime());
	if (expires) {
		expires = expires * 1000 * 60 * 60 * 24;
	}else{
		expires = defaultDays * 1000 * 60 * 60 * 24;
	}

	document.cookie = name + &quot;=&quot; + escape(value) +
        &quot;; path=/&quot; + ((expires == null) ? &quot;&quot; : &quot;; expires=&quot; +
        expires.toGMTString());
}

/*
 * Get Cookie
 * @param: name of the cookie variable you would like to retrieve
 */
function getCookie(name) {
	var cookieValue = null;
	var startPos = document.cookie.indexOf(name+&quot;=&quot;);
	var lengthVal = startPos + name.length + 1;

	if((startPos)&amp;&amp;(startPos&gt;0)&amp;&amp;
        (name == document.cookie.substring(0, name.length))){
		var endPos = document.cookie.indexOf( &quot;;&quot;, lengthVal);

		if (endPos == -1){
			endPos = document.cookie.length;
		}
		cookieValue = unescape(
                   document.cookie.substring(lengthVal, endPos)
                );
	}

	return cookieValue;
}

/*
 * Delete Cookie
 * @param delete the cookie variable by passing the name
 */
function delCookie(name) {
    document.cookie = name +
    &quot;=; expires=Thu, 01-Jan-70 00:00:01 GMT&quot; + &quot;; path=/&quot;;
} </pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ladysign-apps.com/blog/code/javascript/cookies-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mootools and jQuery conflicts in Joomla 1.5</title>
		<link>http://www.ladysign-apps.com/blog/code/javascript/mootools-jquery-conflicts-in-joomla-1-5/</link>
		<comments>http://www.ladysign-apps.com/blog/code/javascript/mootools-jquery-conflicts-in-joomla-1-5/#comments</comments>
		<pubDate>Sun, 28 Jun 2009 11:52:07 +0000</pubDate>
		<dc:creator>Lee</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[conflicts]]></category>
		<category><![CDATA[Joomla]]></category>
		<category><![CDATA[Mootools]]></category>
		<category><![CDATA[template head]]></category>

		<guid isPermaLink="false">http://ladysign-apps.com/blog/?p=780</guid>
		<description><![CDATA[<p><strong>Difficulty:</strong> 2 out of 5 stars</p>
<p>Yes, Mootools and jQuery can conflict each other, when you load both on your page.<br />
Ofcourse, they can use same method nam[......]</p>]]></description>
			<content:encoded><![CDATA[<p><strong>Difficulty:</strong> 2 out of 5 stars</p>
<p>Yes, Mootools and jQuery can conflict each other, when you load both on your page.<br />
Ofcourse, they can use same method names, therefore one of both could break.<br />
In my case, I received in Joomla 1.5 errors for removing handlers.</p>
<p>See, I&#8217;m a fan of jQuery, that doesn&#8217;t say that I dislike MooTools, but when you create a nice Template for Joomla 1.5 and you decide to use jQuery, the hell breaks open when implementing:</p>
<pre class="brush: xml;">&lt;jdoc:include type=&quot;head&quot; /&gt;</pre>
<p>This, is because Joomla 1.5 uses MooTools and Caption javascript frameworks, for the backend admin panel, but also some components may require it.<br />
In this case I would say, fuck it. &#8211; I want to have my own choice of which framework I would like to use.<br />
So stick together with jQuery and wrote the following lines in the top of my index.php template:</p>
<pre class="brush: php;">$headerstuff = $this-&gt;getHeadData();
$headerstuff['scripts'] = array();
$this-&gt;setHeadData($headerstuff);</pre>
<p>Goodbye MooTools and Caption frameworks. &#8211; My conflicts are solved!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ladysign-apps.com/blog/code/javascript/mootools-jquery-conflicts-in-joomla-1-5/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>jQuery for IE7Pro userscripts or Greasemonkey</title>
		<link>http://www.ladysign-apps.com/blog/code/javascript/jquery-for-ie7pro-userscripts-or-greasemonkey/</link>
		<comments>http://www.ladysign-apps.com/blog/code/javascript/jquery-for-ie7pro-userscripts-or-greasemonkey/#comments</comments>
		<pubDate>Wed, 20 May 2009 14:12:18 +0000</pubDate>
		<dc:creator>Lee</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[greasemonkey]]></category>
		<category><![CDATA[IE7PRO]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[userscripts]]></category>

		<guid isPermaLink="false">http://ladysign-apps.com/blog/?p=705</guid>
		<description><![CDATA[<p><strong>Difficulty:</strong> 1 out of 5 stars</p>
<p>Some weeks ago I made a <a href="http://ladysign-apps.com/blog/archives/522">blog post, about IE7Pro userscripts</a>, the Greasemonkey-like plugin for Internet Explorer 7.<br />
I&#821[......]</p>]]></description>
			<content:encoded><![CDATA[<p><strong>Difficulty:</strong> 1 out of 5 stars</p>
<p>Some weeks ago I made a <a href="http://ladysign-apps.com/blog/archives/522">blog post, about IE7Pro userscripts</a>, the Greasemonkey-like plugin for Internet Explorer 7.<br />
I&#8217;m still deeply in love with userscripts for both IE7Pro and Greasemonkey, but what a waste of time for spending<br />
hours on writing big userscripts with DOM javascripting to extend that &#8220;untouchable&#8221; website/webapplication.<br />
This should be different! Why not use jQuery for IE7Pro userscripts.</p>
<p>The idea is to load first the jQuery script and then the userscript.<br />
Unfortunately a javascript include script like this will not work:</p>
<pre class="brush: jscript;">
//load jQuery
inc(&quot;jquery.js&quot;);

/* jsHandler.js */
function inc(filename)
{
  var body = document.getElementsByTagName('body').item(0);
  script = document.createElement('script');
  script.src = filename;
  script.type = 'text/javascript';
  body.appendChild(script)
}
</pre>
<p>However, it&#8217;s still very easy to let jQuery run for userscripts.<br />
First <a href="http://docs.jquery.com/Downloading_jQuery">download the latest jQuery</a> lib.</p>
<p><strong>Incase of IE7Pro:</strong><br />
Rename the downloaded jQuery script to: <strong>jquery.ieuser.js</strong> and place it<br />
in the userscript folder. (<strong>path\IEPro\userscripts</strong>).</p>
<p>Open the jquery.ieuser.js file and add the following comment block on the top of javascript lib file:</p>
<pre class="brush: jscript;">
// ==UserScript==
// @name           jQuery
// @namespace      jQuery
// @include        *
// ==/UserScript==
</pre>
<p>Now you can reload the jQuery file from the preferences &#8211; userscript screen in IE7Pro, and enable jQuery.<br />
To test it, create a new userscript with the following jQuery code. As soon as it runs, you know<br />
that you can use jQuery for every page.</p>
<pre class="brush: jscript;">
// ==UserScript==
// @name           Test
// @namespace      Test
// @include        *
// @author Lee Boonstra
// ==/UserScript==

$(document).ready(function(){
  alert(&quot;jQuery in userscripts do work!&quot;);
});
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ladysign-apps.com/blog/code/javascript/jquery-for-ie7pro-userscripts-or-greasemonkey/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
