<?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>GreaseMonkey Archives - The Story of David Kaspar</title>
	<atom:link href="https://blog.davidkaspar.com/archives/category/greasemonkey/feed" rel="self" type="application/rss+xml" />
	<link>https://blog.davidkaspar.com/archives/category/greasemonkey</link>
	<description>Online journal and ponderings about the Internet, gadgets and photography.</description>
	<lastBuildDate>Fri, 02 Dec 2005 17:40:52 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>

<image>
	<url>https://blog.davidkaspar.com/wp-content/uploads/2020/05/chubby.gif</url>
	<title>GreaseMonkey Archives - The Story of David Kaspar</title>
	<link>https://blog.davidkaspar.com/archives/category/greasemonkey</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Firefox 1.5 and Greasemonkey 0.6.4: where is my DOMParser</title>
		<link>https://blog.davidkaspar.com/archives/2005/12/firefox-1-5-and-greasemonkey-0-6-4-where-is-my-domparser.php</link>
					<comments>https://blog.davidkaspar.com/archives/2005/12/firefox-1-5-and-greasemonkey-0-6-4-where-is-my-domparser.php#comments</comments>
		
		<dc:creator><![CDATA[David Kaspar]]></dc:creator>
		<pubDate>Fri, 02 Dec 2005 17:40:52 +0000</pubDate>
				<category><![CDATA[GreaseMonkey]]></category>
		<category><![CDATA[greasemonkey firefox js javascript]]></category>
		<guid isPermaLink="false">https://davidkaspar.com/wp/2005/12/02/firefox-1-5-and-greasemonkey-0-6-4-where-is-my-domparser/</guid>

					<description><![CDATA[<p>The good news is that Firefox 1.5 is out and for it there is also the newest Greasemonkey 0.6.4. The bad news is that this combination breaks a lot of existing user scripts. There is a WiKi up that gives a helping hand at upgrading scripts but it is not complete (covers mainly XPCNativeWrappers, you &#8230; <a href="https://blog.davidkaspar.com/archives/2005/12/firefox-1-5-and-greasemonkey-0-6-4-where-is-my-domparser.php" class="more-link">Continue reading<span class="screen-reader-text"> "Firefox 1.5 and Greasemonkey 0.6.4: where is my DOMParser"</span></a></p>
<p>The post <a href="https://blog.davidkaspar.com/archives/2005/12/firefox-1-5-and-greasemonkey-0-6-4-where-is-my-domparser.php">Firefox 1.5 and Greasemonkey 0.6.4: where is my DOMParser</a> appeared first on <a href="https://blog.davidkaspar.com">The Story of David Kaspar</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>The good news is that Firefox 1.5 is out and for it there is also the newest Greasemonkey 0.6.4.<br />
The bad news is that this combination breaks a lot of existing <a href="http://www.userscripts.org/">user scripts</a>. There is a <a href="http://dunck.us/collab/GreaseMonkeyUserScripts?action=show&amp;redirect=GreasemonkeyUserScripts#head-4ac4d1e80f8bbd66bf4f1fbea77ea2390b6a2870">WiKi</a> up that gives a helping hand at upgrading scripts but it is not complete (covers mainly XPCNativeWrappers, you know the unsafeWindow thingy).<br />
I was quite surprised that the <a href="http://blog.davidkaspar.com/archives/2005/10/imdb-ratings-and-links-for-myvuecom.php">IMDB ratings for MyVue.com</a> stopped working. It was specifically the DOMParser that stops working with the cryptic error message &#8216;DOMParser is not a constructor&#8217;.<br />
The instinctive thing would be to use responseXML instead of responseText but only until you remind your self that the GM_xmlhttpRequest implementation returns the same string for both functions (instead of the correct DOM object for responseXML).<br />
I was just about to dive into manual parsing of the XML response with regexp and indexOf goodness but was literally saved by boogs from the <a href="http://greaseblog.blogspot.com/">Greaseblog</a>.<br />
He pointed me to the little known &#8220;new XML()&#8221; of <a href="http://developer.mozilla.org/presentations/xtech2005/e4x/">Mozilla E4X</a>. It can parse XML text strings and provide DOM like interface so it is good enough for the job.<br />
There are some oddities of course. When first using it you will get a <em>xml is a reserved identifier</em> error. Don&#8217;t ask why but the xml declaration has to be stripped out from the top of your xml document. Achieve this with <code>responseText.replace(/&lt;\?xml version="1.0"\?&gt;/,'')</code>.<br />
To get to a node use the following syntax: <code>xmlDoc..foo[0]</code> (for the first instance of foo tag). I found more information on the EX4 syntax at the <a href="http://www.linkwerk.com/pub/javascript/e4x/e4x-tester/">E4X Expression Tester</a>.<br />
Now get busy fixing those old Greasemonkey scripts!<br />
<u>Update</u><br />
Turns out that you can use XPCNativeWrapper to instantiate a new DOMParser (and other missing objects like XMLSerializer, HTMLBodyElement, &#8230;) like so:<br />
<code>var dp = new XPCNativeWrapper(window, "DOMParser").DOMParser</code>.<br />
I am not sure about the security implications of doing this.</p>
<p>The post <a href="https://blog.davidkaspar.com/archives/2005/12/firefox-1-5-and-greasemonkey-0-6-4-where-is-my-domparser.php">Firefox 1.5 and Greasemonkey 0.6.4: where is my DOMParser</a> appeared first on <a href="https://blog.davidkaspar.com">The Story of David Kaspar</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.davidkaspar.com/archives/2005/12/firefox-1-5-and-greasemonkey-0-6-4-where-is-my-domparser.php/feed</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>IMDb ratings and links for MyVue.com</title>
		<link>https://blog.davidkaspar.com/archives/2005/10/imdb-ratings-and-links-for-myvue-com.php</link>
					<comments>https://blog.davidkaspar.com/archives/2005/10/imdb-ratings-and-links-for-myvue-com.php#comments</comments>
		
		<dc:creator><![CDATA[David Kaspar]]></dc:creator>
		<pubDate>Wed, 12 Oct 2005 08:59:20 +0000</pubDate>
				<category><![CDATA[GreaseMonkey]]></category>
		<category><![CDATA[cinema]]></category>
		<category><![CDATA[greasemonkey]]></category>
		<category><![CDATA[imdb]]></category>
		<category><![CDATA[myvue]]></category>
		<category><![CDATA[uk]]></category>
		<category><![CDATA[vue]]></category>
		<guid isPermaLink="false">https://davidkaspar.com/wp/2005/10/12/imdb-ratings-and-links-for-myvue-com/</guid>

					<description><![CDATA[<p>Aren&#8217;t these wonderful Internet times that we are living in? Things are moving quickly to the ever so popular Web 2.0 and one can spot changes all around: recent blog oriented purchases, easily mixing together information from various web sites and all things are best in three. As a frequent visitor of the local cinema &#8230; <a href="https://blog.davidkaspar.com/archives/2005/10/imdb-ratings-and-links-for-myvue-com.php" class="more-link">Continue reading<span class="screen-reader-text"> "IMDb ratings and links for MyVue.com"</span></a></p>
<p>The post <a href="https://blog.davidkaspar.com/archives/2005/10/imdb-ratings-and-links-for-myvue-com.php">IMDb ratings and links for MyVue.com</a> appeared first on <a href="https://blog.davidkaspar.com">The Story of David Kaspar</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Aren&#8217;t these wonderful Internet times that we are living in? Things are moving quickly to the ever so popular Web 2.0 and one can spot changes all around: recent <a href="http://networks.silicon.com/webwatch/0,39024667,39153170,00.htm" title="VeriSign purchases weblo.gs">blog oriented</a> <a href="http://networks.silicon.com/webwatch/0,39024667,39153145,00.htm" title="AOL purchases Weblogs.com">purchases</a>, easily mixing together information from various web sites and all things are best in three.<br />
As a frequent visitor of the local cinema (Vue) I always cross check all showing movies at IMDb to see what people say about them. This involves a lot of copying and pasting and switching between browsers (actually tabs).<br />
This is very 1999 and I thought that writing a GM script that pulls information from IMDb and displays it directly at MyVue.com was much more 2005.<br />
<img decoding="async" src="http://blog.davidkaspar.com/images/gm_imdb4vue.gif"class="framedalignleft"  title="IMDB for vue MyVue.com" width="224" height="185" border="0"><a href="http://www.davidkaspar.com/gm/ImdbRatings4Vue.user.js" title="Install this script">ImdbRatings4Vue.user.js</a> was born.<br />
To use this script you should ideally be using Firefox 1.0.x. You will also have to install the <a href="http://greasemonkey.mozdev.org/">GreaseMonkey engine</a>. Once that is done, right click on <a href="http://www.davidkaspar.com/gm/ImdbRatings4Vue.user.js" title="Install this script">ImdbRatings4Vue.user.js</a> and choose &#8220;Install user script&#8221;.<br />
GreaseMonkey scripts are also supported* by other browsers like <a href="http://www.opera.com/">Opera</a> (which is freeware nowadays by the way) and by the <a href="http://www.reifysoft.com/turnabout.php">Turnabout plug-in</a> for Internet Explorer 6 for Windows.<br />
*I have only tested the script on GreaseMonkey 0.5.3 running on Firefox 1.0.7.<br class="clr"/></p>
<p>The post <a href="https://blog.davidkaspar.com/archives/2005/10/imdb-ratings-and-links-for-myvue-com.php">IMDb ratings and links for MyVue.com</a> appeared first on <a href="https://blog.davidkaspar.com">The Story of David Kaspar</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.davidkaspar.com/archives/2005/10/imdb-ratings-and-links-for-myvue-com.php/feed</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>showModalDialog in Firefox and frames</title>
		<link>https://blog.davidkaspar.com/archives/2005/10/showmodaldialog-in-firefox-and-frames.php</link>
					<comments>https://blog.davidkaspar.com/archives/2005/10/showmodaldialog-in-firefox-and-frames.php#comments</comments>
		
		<dc:creator><![CDATA[David Kaspar]]></dc:creator>
		<pubDate>Wed, 05 Oct 2005 08:45:41 +0000</pubDate>
				<category><![CDATA[GreaseMonkey]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[greasemonkey]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[webdev]]></category>
		<guid isPermaLink="false">https://davidkaspar.com/wp/2005/10/05/showmodaldialog-in-firefox-and-frames/</guid>

					<description><![CDATA[<p>I use Firefox exclusively and every now and then I come across a site that is crippled. This means that parts of it will not work in Firefox because the site is using some kind of IE only functionality. One example is the function showModalDialog. This will create a modal pop-up when using IE but &#8230; <a href="https://blog.davidkaspar.com/archives/2005/10/showmodaldialog-in-firefox-and-frames.php" class="more-link">Continue reading<span class="screen-reader-text"> "showModalDialog in Firefox and frames"</span></a></p>
<p>The post <a href="https://blog.davidkaspar.com/archives/2005/10/showmodaldialog-in-firefox-and-frames.php">showModalDialog in Firefox and frames</a> appeared first on <a href="https://blog.davidkaspar.com">The Story of David Kaspar</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>I use Firefox exclusively and every now and then I come across a site that is crippled. This means that parts of it will not work in Firefox because the site is using some kind of IE only functionality.<br />
One example is the function <i>showModalDialog</i>. This will create a modal pop-up when using IE but because it is not a W3C standard, it is not implemented in Firefox (Mozilla) and will just cause a JavaScript error.<br />
<a href="http://greasemonkey.mozdev.org/">Greasemonkey</a> is a very powerful extension for the Firefox browser that lets you inject your own JavaScript into any web page. This includes overriding any present functionality.<br />
While this can be used to bypass poor security implementations a far better use is to <a href="http://userscripts.org/tag/usability" title="Fix usability errors">fix usability errors</a> or <a href="http://blog.davidkaspar.com/archives/2005/10/imdb-ratings-and-links-for-myvuecom.php" title="IMDb Ratings in MyVue.com">mash together information from different sites</a>.<br />
I present you my first Greasemonkey script. It is a workaround for <i>showModaldialog</i> by replacing it with a standard <i>confirm</i> dialog: &#8220;Are you sure?&#8221;.</p>
<blockquote><p>//&nbsp;Author:&nbsp;David&nbsp;Kaspar<br />
//&nbsp;==UserScript==<br />
//&nbsp;@name&nbsp;showModaDialogFix<br />
//&nbsp;@description&nbsp;Implement&nbsp;show&nbsp;modal&nbsp;dialog&nbsp;in&nbsp;Firefox<br />
//&nbsp;@include&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;http://&lt;enter&nbsp;your&nbsp;site(s)&nbsp;here&gt;<br />
//&nbsp;==/UserScript==<br />
window.showModalDialog&nbsp;=&nbsp;function()&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;window.confirm(&quot;Are&nbsp;you&nbsp;sure?&quot;);<br />
}</p></blockquote>
<p><a href="http://www.davidkaspar.com/gm/showModalDialogPatch.user.js"><br />
Install the script</a><br />
If the site you are visting is using frames, you may have to use the below version and insert the name of the frame that is calling the showModalDialog function:</p>
<blockquote><p>if&nbsp;(window.frames.frameNameHere)&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;window.frames.frameNameHere.showModalDialog&nbsp;=&nbsp;function()&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;window.confirm(&quot;Are&nbsp;you&nbsp;sure?&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
}</p></blockquote>
<p><u>Update 04/05/2007</u><br />
No progress with Firefox modal windows so instead a work-around: forced focus on pop-up.<br />
During the latest cross browser compatibility push at our company, a team member devised this work-around and it works sufficiently in all browsers we tested (IE6, IE7, FireFox 2, Safari, Opera).<br />
The idea is to force focus on the pop-up window. This is achieved with the javascript function window.focus().<br />
This method will not work if the user has JS switched off but since JS is a basic requirement for our services, we can expect JS to always be on.</p>
<p>The post <a href="https://blog.davidkaspar.com/archives/2005/10/showmodaldialog-in-firefox-and-frames.php">showModalDialog in Firefox and frames</a> appeared first on <a href="https://blog.davidkaspar.com">The Story of David Kaspar</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.davidkaspar.com/archives/2005/10/showmodaldialog-in-firefox-and-frames.php/feed</wfw:commentRss>
			<slash:comments>29</slash:comments>
		
		
			</item>
	</channel>
</rss>
