<?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>umkk.eu &#187; JSON</title>
	<atom:link href="http://umkk.eu/tag/json/feed/" rel="self" type="application/rss+xml" />
	<link>http://umkk.eu</link>
	<description>you can also go there !</description>
	<lastBuildDate>Fri, 25 Jun 2010 16:00:20 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>jQuery popups wizard, web 2.0 ideea and usability</title>
		<link>http://umkk.eu/jquery-popups-wizard-web-2-0-ideea-and-usability/10/</link>
		<comments>http://umkk.eu/jquery-popups-wizard-web-2-0-ideea-and-usability/10/#comments</comments>
		<pubDate>Fri, 23 Oct 2009 11:58:22 +0000</pubDate>
		<dc:creator>sergiu</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[dialog wizards]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[jquery dialog]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[web 2.0]]></category>

		<guid isPermaLink="false">http://umkk.eu/?p=199</guid>
		<description><![CDATA[in this post, which i'll try to keep it short i'll explain something about web 2.0 concept and how to make pop ups wizards with jQuery, by popup wizards i understand a series a popup, pretty much like the wizards on your desktop when you install an application.
Web 2.0 is more about user experience and [...]


Related posts:<ol><li><a href='http://umkk.eu/greasemonkey-create-a-options-panel-using-jquery/10/' rel='bookmark' title='Permanent Link: Greasemonkey, create a options panel using jQuery'>Greasemonkey, create a options panel using jQuery</a></li>
<li><a href='http://umkk.eu/autoupdate-on-greasemonkey-script/10/' rel='bookmark' title='Permanent Link: Autoupdate on greasemonkey script, example from &#8220;mousehunt improvements&#8221; script.'>Autoupdate on greasemonkey script, example from &#8220;mousehunt improvements&#8221; script.</a></li>
<li><a href='http://umkk.eu/greasemonkey-jquery-and-the-greatest-mouse-hunt-script/10/' rel='bookmark' title='Permanent Link: GreaseMonkey, Jquery and the greatest mouse hunt script.'>GreaseMonkey, Jquery and the greatest mouse hunt script.</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>in this post, which i'll try to keep it short i'll explain something about web 2.0 concept and how to make pop ups wizards with jQuery, by popup wizards i understand a series a popup, pretty much like the wizards on your desktop when you install an application.</p>
<p>Web 2.0 is more about user experience and seeing the web as a platform, make the user feel like he is using a very complex, fast and easy to use at the same time application, and for that wizards are great.</p>
<p>In this tutorial i will explain the basic concepts and give an basic wizard example for user authentication and sign up, here is how i wanted the wizard to work :</p>
<div id="attachment_201" class="wp-caption aligncenter" style="width: 573px"><a href="http://umkk.eu/wp-content/uploads/2009/10/2009-10-23_1227.png"><img class="size-full wp-image-201" title="Wizard steps" src="http://umkk.eu/wp-content/uploads/2009/10/2009-10-23_1227.png" alt="Wizard steps" width="563" height="361" /></a><p class="wp-caption-text">Wizard steps</p></div>
<p>this wizard will only have 3 pop ups, here they are, to be more clear :</p>
<div class="wp-caption aligncenter" style="width: 327px"><a href="http://content.screencast.com/users/rsergiu2003/folders/Jing/media/97faf5c9-ebc6-4b39-982a-a2493f241c39/2009-10-23_1300.png"><img title="Wizard starts" src="http://content.screencast.com/users/rsergiu2003/folders/Jing/media/97faf5c9-ebc6-4b39-982a-a2493f241c39/2009-10-23_1300.png" alt="Wizard starts" width="317" height="175" /></a><p class="wp-caption-text">Wizard starts</p></div>
<div class="wp-caption aligncenter" style="width: 329px"><a href="http://content.screencast.com/users/rsergiu2003/folders/Jing/media/5872c6ba-89fc-4a7f-9dfd-6331f9d54452/2009-10-23_1432.png"><img title="Login popup on wizard" src="http://content.screencast.com/users/rsergiu2003/folders/Jing/media/5872c6ba-89fc-4a7f-9dfd-6331f9d54452/2009-10-23_1432.png" alt="Login popup on wizard" width="319" height="210" /></a><p class="wp-caption-text">Login popup on wizard</p></div>
<p style="text-align: center;">
<div class="wp-caption aligncenter" style="width: 327px"><a href="http://content.screencast.com/users/rsergiu2003/folders/Jing/media/cfb00551-e914-42bd-9cf8-94a9eb3e2e77/2009-10-23_1433.png"><img title="Create account in wizard" src="http://content.screencast.com/users/rsergiu2003/folders/Jing/media/cfb00551-e914-42bd-9cf8-94a9eb3e2e77/2009-10-23_1433.png" alt="Create account in wizard" width="317" height="313" /></a><p class="wp-caption-text">Create account in wizard</p></div>
<p>As you can see each popup is clear and you can navigate back and forward between them.</p>
<p>Now, some of the advantages of using those wizards :</p>
<ul>
<li>no extra html is loaded when the page loads, all popups are loaded dinamicaly</li>
<li>no extra load on browser to create all the popups at load time</li>
<li>all have the same style</li>
<li>they are very easy to open (just call a function with the popup name)</li>
<li>they are stored in a xml file and very easy to change</li>
<li>they are very user frendly</li>
<li>popups are destroyed on close so no extra load on browser</li>
</ul>
<p>There are also a lot o feature that i want to implement but they are missing...</p>
<p>So here how it's done in a few easy steps</p>
<p>1. make sure that you added jquery, and jqueryUI with the dialog functionality</p>
<p>2. create a custom jQuery theme, just in case you want to change the design at a later date.</p>
<p>3. create the function that loads and shows a popup,<a href="http://umkk.eu/wp-content/uploads/2009/10/popupManager.js"> here is the entire file</a>. Just make sure that you change the APP_URL in the file with the url to your project.</p>
<p>4. Create the php file which will send the data to the client (in my case that file is index.php) also you can send more parameters to that if you want only name is mandatory in my case, the name must be the same as the .xml file in which the popup is stored (i'll show the xml file later). Here is the php code which wil generate the data for the javascript part, this is json data :</p>
<pre class="php">&nbsp;
<span style="color: #0000ff;">$content</span> = <a href="http://www.php.net/file_get_contents"><span style="color: #000066;">file_get_contents</span></a> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;popups/&quot;</span>.<span style="color: #0000ff;">$_POST</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'name'</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #ff0000;">&quot;.xml&quot;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #0000ff;">$xml</span> =  <span style="color: #000000; font-weight: bold;">new</span> SimpleXMLElement<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$content</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #0000ff;">$res</span> = <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #0000ff;">$res</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'count'</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #0000ff;">$vars</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'count'</span><span style="color: #66cc66;">&#93;</span>;
			<span style="color: #0000ff;">$res</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'title'</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #66cc66;">&#40;</span>string<span style="color: #66cc66;">&#41;</span><span style="color: #0000ff;">$xml</span>-&gt;<span style="color: #006600;">title</span>;
&nbsp;
			<span style="color: #0000ff;">$res</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'content'</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #66cc66;">&#40;</span>string<span style="color: #66cc66;">&#41;</span><span style="color: #0000ff;">$xml</span>-&gt;<span style="color: #006600;">body</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span>;
			<span style="color: #0000ff;">$res</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'content'</span><span style="color: #66cc66;">&#93;</span> = <a href="http://www.php.net/str_replace"><span style="color: #000066;">str_replace</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;{[&quot;</span>,<span style="color: #ff0000;">&quot;&lt;&quot;</span>,<span style="color: #0000ff;">$res</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'content'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #0000ff;">$res</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'content'</span><span style="color: #66cc66;">&#93;</span> = <a href="http://www.php.net/str_replace"><span style="color: #000066;">str_replace</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;]}&quot;</span>,<span style="color: #ff0000;">&quot;&gt;&quot;</span>,<span style="color: #0000ff;">$res</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'content'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #0000ff;">$res</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'buttons'</span><span style="color: #66cc66;">&#93;</span> = <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #b1b100;">foreach</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$xml</span>-&gt;<span style="color: #006600;">buttons</span>-&gt;<span style="color: #006600;">button</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$button</span><span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#123;</span>
				<span style="color: #0000ff;">$res</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'buttons'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span>=<a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;label&quot;</span>=&gt;trim<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>string<span style="color: #66cc66;">&#41;</span><span style="color: #0000ff;">$button</span>-&gt;<span style="color: #006600;">label</span><span style="color: #66cc66;">&#41;</span>,<span style="color: #ff0000;">&quot;action&quot;</span>=&gt;trim<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>string<span style="color: #66cc66;">&#41;</span><span style="color: #0000ff;">$button</span>-&gt;<span style="color: #006600;">action</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
&nbsp;
			<a href="http://www.php.net/die"><span style="color: #000066;">die</span></a><span style="color: #66cc66;">&#40;</span>json_encode<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$res</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;</pre>
<p>As you can see here the xml files are stored in a separate folder to make them easier to organize. Also you need to have the simpleXML (php extension) installed on your server but this is there on 99% of the cases, so no need to worry.</p>
<p>5. The last thing is the xml file that will store the popup, this is my login popup :</p>
<pre class="xml">&nbsp;
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">'1.0'</span> <span style="color: #000066;">standalone</span>=<span style="color: #ff0000;">'yes'</span><span style="font-weight: bold; color: black;">?&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;content<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;body<span style="font-weight: bold; color: black;">&gt;</span></span></span>
		{[div class='error' id='login_errors']}{[/div]}
		Enter your credentials here :
		{[form]}
			{[div class='form_line']}{[div class='form_label']}Username:{[/div]}{[input type='text' id='login_username' class='form_input'/]}{[/div]}
			{[div class='form_line']}{[div class='form_label']}Password:{[/div]}{[input type='password' id='login_password' class='form_input'/]}{[/div]}
		{[/form]}
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/body<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;title<span style="font-weight: bold; color: black;">&gt;</span></span></span>Login<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/title<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;buttons<span style="font-weight: bold; color: black;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;button<span style="font-weight: bold; color: black;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;label<span style="font-weight: bold; color: black;">&gt;</span></span></span>Login<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/label<span style="font-weight: bold; color: black;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;action<span style="font-weight: bold; color: black;">&gt;</span></span></span>
				data = new Object();
&nbsp;
				data.action = &quot;User::auth&quot;;
				data.username = $('#login_username').val();
				data.password = $('#login_password').val();
				data.ajax = 1;
&nbsp;
				$.post(APP_URL+&quot;index.php&quot;,data,function(data){
					$('#login_errors').html(data.content);
				},&quot;json&quot;);
			<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/action<span style="font-weight: bold; color: black;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/button<span style="font-weight: bold; color: black;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;button<span style="font-weight: bold; color: black;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;label<span style="font-weight: bold; color: black;">&gt;</span></span></span>Close<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/label<span style="font-weight: bold; color: black;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;action<span style="font-weight: bold; color: black;">&gt;</span></span></span>$(this).dialog('close')<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/action<span style="font-weight: bold; color: black;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/button<span style="font-weight: bold; color: black;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;button<span style="font-weight: bold; color: black;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;label<span style="font-weight: bold; color: black;">&gt;</span></span></span>Back<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/label<span style="font-weight: bold; color: black;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;action<span style="font-weight: bold; color: black;">&gt;</span></span></span>
				DialogsManager.getInstance().loadDialog('auth_method');
				$(this).dialog('close');
			<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/action<span style="font-weight: bold; color: black;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/button<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/buttons<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/content<span style="font-weight: bold; color: black;">&gt;</span></span></span>
&nbsp;</pre>
<p>One problem with this is that you can't use "&lt;" and "&gt;" in your xml so you need to replace them, i used "{[" and "]}" so a &lt;div&gt; now it's {[div]}.</p>
<p>And this is it, you should try it and let me know if there are any problems.</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-caring">
<ul class="socials">
		<li class="shr-comfeed">
			<a href="http://umkk.eu/jquery-popups-wizard-web-2-0-ideea-and-usability/10/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://umkk.eu/jquery-popups-wizard-web-2-0-ideea-and-usability/10/&amp;title=jQuery+popups+wizard%2C+web+2.0+ideea+and+usability" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://umkk.eu/jquery-popups-wizard-web-2-0-ideea-and-usability/10/&amp;title=jQuery+popups+wizard%2C+web+2.0+ideea+and+usability" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-diigo">
			<a href="http://www.diigo.com/post?url=http://umkk.eu/jquery-popups-wizard-web-2-0-ideea-and-usability/10/&amp;title=jQuery+popups+wizard%2C+web+2.0+ideea+and+usability&amp;desc=in%20this%20post%2C%20which%20i%27ll%20try%20to%20keep%20it%20short%20i%27ll%20explain%20something%20about%20web%202.0%20concept%20and%20how%20to%20make%20pop%20ups%20wizards%20with%20jQuery%2C%20by%20popup%20wizards%20i%20understand%20a%20series%20a%20popup%2C%20pretty%20much%20like%20the%20wizards%20on%20your%20desktop%20when%20you%20install%20an%20application.%0D%0A%0D%0AWeb%202.0%20is%20more%20about%20user%20experien" rel="nofollow" class="external" title="Post this on Diigo">Post this on Diigo</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://umkk.eu/jquery-popups-wizard-web-2-0-ideea-and-usability/10/&amp;t=jQuery+popups+wizard%2C+web+2.0+ideea+and+usability" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-gmail">
			<a href="https://mail.google.com/mail/?ui=2&amp;view=cm&amp;fs=1&amp;tf=1&amp;su=jQuery+popups+wizard%2C+web+2.0+ideea+and+usability&amp;body=Link: http://umkk.eu/jquery-popups-wizard-web-2-0-ideea-and-usability/10/ (sent via shareaholic)%0D%0A%0D%0A----%0D%0A in%20this%20post%2C%20which%20i%27ll%20try%20to%20keep%20it%20short%20i%27ll%20explain%20something%20about%20web%202.0%20concept%20and%20how%20to%20make%20pop%20ups%20wizards%20with%20jQuery%2C%20by%20popup%20wizards%20i%20understand%20a%20series%20a%20popup%2C%20pretty%20much%20like%20the%20wizards%20on%20your%20desktop%20when%20you%20install%20an%20application.%0D%0A%0D%0AWeb%202.0%20is%20more%20about%20user%20experien" rel="nofollow" class="external" title="Email this via Gmail">Email this via Gmail</a>
		</li>
		<li class="shr-googlebookmarks">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://umkk.eu/jquery-popups-wizard-web-2-0-ideea-and-usability/10/&amp;title=jQuery+popups+wizard%2C+web+2.0+ideea+and+usability" rel="nofollow" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://umkk.eu/jquery-popups-wizard-web-2-0-ideea-and-usability/10/&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-misterwong">
			<a href="http://www.mister-wong.com/addurl/?bm_url=http://umkk.eu/jquery-popups-wizard-web-2-0-ideea-and-usability/10/&amp;bm_description=jQuery+popups+wizard%2C+web+2.0+ideea+and+usability&amp;plugin=sexybookmarks" rel="nofollow" class="external" title="Add this to Mister Wong">Add this to Mister Wong</a>
		</li>
		<li class="shr-mixx">
			<a href="http://www.mixx.com/submit?page_url=http://umkk.eu/jquery-popups-wizard-web-2-0-ideea-and-usability/10/&amp;title=jQuery+popups+wizard%2C+web+2.0+ideea+and+usability" rel="nofollow" class="external" title="Share this on Mixx">Share this on Mixx</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://umkk.eu/jquery-popups-wizard-web-2-0-ideea-and-usability/10/&amp;title=jQuery+popups+wizard%2C+web+2.0+ideea+and+usability" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://umkk.eu/jquery-popups-wizard-web-2-0-ideea-and-usability/10/&amp;title=jQuery+popups+wizard%2C+web+2.0+ideea+and+usability" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-technorati">
			<a href="http://technorati.com/faves?add=http://umkk.eu/jquery-popups-wizard-web-2-0-ideea-and-usability/10/" rel="nofollow" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=jQuery+popups+wizard%2C+web+2.0+ideea+and+usability+-+http://b2l.me/6hn7q&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>



<p>Related posts:<ol><li><a href='http://umkk.eu/greasemonkey-create-a-options-panel-using-jquery/10/' rel='bookmark' title='Permanent Link: Greasemonkey, create a options panel using jQuery'>Greasemonkey, create a options panel using jQuery</a></li>
<li><a href='http://umkk.eu/autoupdate-on-greasemonkey-script/10/' rel='bookmark' title='Permanent Link: Autoupdate on greasemonkey script, example from &#8220;mousehunt improvements&#8221; script.'>Autoupdate on greasemonkey script, example from &#8220;mousehunt improvements&#8221; script.</a></li>
<li><a href='http://umkk.eu/greasemonkey-jquery-and-the-greatest-mouse-hunt-script/10/' rel='bookmark' title='Permanent Link: GreaseMonkey, Jquery and the greatest mouse hunt script.'>GreaseMonkey, Jquery and the greatest mouse hunt script.</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://umkk.eu/jquery-popups-wizard-web-2-0-ideea-and-usability/10/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Greasemonkey, create a options panel using jQuery</title>
		<link>http://umkk.eu/greasemonkey-create-a-options-panel-using-jquery/10/</link>
		<comments>http://umkk.eu/greasemonkey-create-a-options-panel-using-jquery/10/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 07:06:20 +0000</pubDate>
		<dc:creator>sergiu</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[greasemonkey]]></category>
		<category><![CDATA[javascript cookie]]></category>
		<category><![CDATA[javascript json]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[mousehunt]]></category>

		<guid isPermaLink="false">http://umkk.eu/?p=181</guid>
		<description><![CDATA[Hi, this tutorial is also based on the mouse hunt script "facebook mousehunt improvements" created by me, and in this one i will explain how to create an options panel (only check boxes at this time) and save it.
Here is my final result with this script :
If you want to try this, remember to load [...]


Related posts:<ol><li><a href='http://umkk.eu/greasemonkey-jquery-and-the-greatest-mouse-hunt-script/10/' rel='bookmark' title='Permanent Link: GreaseMonkey, Jquery and the greatest mouse hunt script.'>GreaseMonkey, Jquery and the greatest mouse hunt script.</a></li>
<li><a href='http://umkk.eu/autoupdate-on-greasemonkey-script/10/' rel='bookmark' title='Permanent Link: Autoupdate on greasemonkey script, example from &#8220;mousehunt improvements&#8221; script.'>Autoupdate on greasemonkey script, example from &#8220;mousehunt improvements&#8221; script.</a></li>
<li><a href='http://umkk.eu/jquery-popups-wizard-web-2-0-ideea-and-usability/10/' rel='bookmark' title='Permanent Link: jQuery popups wizard, web 2.0 ideea and usability'>jQuery popups wizard, web 2.0 ideea and usability</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div id="attachment_197" class="wp-caption aligncenter" style="width: 263px"><a href="http://umkk.eu/wp-content/uploads/2009/10/2009-10-22_1010.png"><img class="size-full wp-image-197" title="2009-10-22_1010" src="http://umkk.eu/wp-content/uploads/2009/10/2009-10-22_1010.png" alt="greasemonkey options panel with jquery" width="253" height="222" /></a><p class="wp-caption-text">greasemonkey options panel with jquery</p></div>
<p>Hi, this tutorial is also based on the mouse hunt script "facebook mousehunt improvements" created by me, and in this one i will explain how to create an options panel (only check boxes at this time) and save it.</p>
<p>Here is my final result with this script :</p>
<p>If you want to try this, remember to load jquery correctly as described in <a title="how to load jquery in greasemonkey" href="http://umkk.eu/greasemonkey-jquery-and-the-greatest-mouse-hunt-script/10/" target="_self">this post</a> at number #4.</p>
<p>First of all, the data is saved in a cookie as JSON, i have an object where i save all my data and i save that object as JSON on a cookie. Because javascript does not know to convert an object to a json string i used a class which does that, the class is not created by me, I just use it as it is, here is the fie : <a href="http://umkk.eu/wp-content/uploads/2009/10/json.js">json </a><br />
I copied the content of the file inside my script so i don't have to load it remotely, anyway it's just a line <img src='http://umkk.eu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> , so you should also copy this at the beginning of your greasemonkey script.</p>
<p>As i said the data is saved as cookie, here is the functions which will create, and read a cookie :</p>
<pre class="javascript"><span style="color: #003366; font-weight: bold;">function</span> createCookie<span style="color: #66cc66;">&#40;</span><span style="color: #000066;">name</span>,value,days<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>days<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
		<span style="color: #003366; font-weight: bold;">var</span> date = <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		date.<span style="color: #006600;">setTime</span><span style="color: #66cc66;">&#40;</span>date.<span style="color: #006600;">getTime</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>+<span style="color: #66cc66;">&#40;</span>days*<span style="color: #CC0000;">24</span>*<span style="color: #CC0000;">60</span>*<span style="color: #CC0000;">60</span>*<span style="color: #CC0000;">1000</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #003366; font-weight: bold;">var</span> expires = <span style="color: #3366CC;">&quot;; expires=&quot;</span>+date.<span style="color: #006600;">toGMTString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #003366; font-weight: bold;">var</span> expires = <span style="color: #3366CC;">&quot;&quot;</span>;
	document.<span style="color: #006600;">cookie</span> = <span style="color: #000066;">name</span>+<span style="color: #3366CC;">&quot;=&quot;</span>+value+expires+<span style="color: #3366CC;">&quot;; path=/&quot;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> readCookie<span style="color: #66cc66;">&#40;</span><span style="color: #000066;">name</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> nameEQ = <span style="color: #000066;">name</span> + <span style="color: #3366CC;">&quot;=&quot;</span>;
	<span style="color: #003366; font-weight: bold;">var</span> ca = document.<span style="color: #006600;">cookie</span>.<span style="color: #006600;">split</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">';'</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000066; font-weight: bold;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i=<span style="color: #CC0000;">0</span>;i &amp;lt; ca.<span style="color: #006600;">length</span>;i++<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
		<span style="color: #003366; font-weight: bold;">var</span> c = ca<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>;
		<span style="color: #000066; font-weight: bold;">while</span> <span style="color: #66cc66;">&#40;</span>c.<span style="color: #006600;">charAt</span><span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #66cc66;">&#41;</span>==<span style="color: #3366CC;">' '</span><span style="color: #66cc66;">&#41;</span> c = c.<span style="color: #006600;">substring</span><span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;">1</span>,c.<span style="color: #006600;">length</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>c.<span style="color: #006600;">indexOf</span><span style="color: #66cc66;">&#40;</span>nameEQ<span style="color: #66cc66;">&#41;</span> == <span style="color: #CC0000;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span> c.<span style="color: #006600;">substring</span><span style="color: #66cc66;">&#40;</span>nameEQ.<span style="color: #006600;">length</span>,c.<span style="color: #006600;">length</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">null</span>;
<span style="color: #66cc66;">&#125;</span></pre>
<p>Also in my program i read the cookie when the script starts so the data object "myData" in my case will be populated and available in the entire script :</p>
<pre class="javascript"><span style="color: #003366; font-weight: bold;">var</span> myData = <span style="color: #003366; font-weight: bold;">new</span> Object<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000066; font-weight: bold;">try</span> <span style="color: #66cc66;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>readCookie<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;gm_pl_data&quot;</span><span style="color: #66cc66;">&#41;</span>!=<span style="color: #003366; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		myData = JSON.<span style="color: #006600;">parse</span><span style="color: #66cc66;">&#40;</span>readCookie<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;gm_pl_data&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">else</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #009900; font-style: italic;">//if there is no cookie we initialize it</span>
		initCookie<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span><span style="color: #000066; font-weight: bold;">catch</span> <span style="color: #66cc66;">&#40;</span>err<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
	initCookie<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre>
<p>In my case gm_pl_data is the name of the cookie in which i save the data. Here is the initCookie() function, this will just initialize the objects inside the myData object :</p>
<pre class="javascript"><span style="color: #003366; font-weight: bold;">function</span> initCookie <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
	myData = <span style="color: #003366; font-weight: bold;">new</span> Object<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	myData.<span style="color: #006600;">allLogs</span> = <span style="color: #003366; font-weight: bold;">new</span> Object<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	myData.<span style="color: #006600;">allChese</span> = <span style="color: #003366; font-weight: bold;">new</span> Object<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
	savePersistentData<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #009900; font-style: italic;">//will be valid 1000000 days</span>
<span style="color: #003366; font-weight: bold;">function</span> savePersistentData <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
	createCookie<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;gm_pl_data&quot;</span>,JSON.<span style="color: #006600;">stringify</span><span style="color: #66cc66;">&#40;</span>myData<span style="color: #66cc66;">&#41;</span>,<span style="color: #CC0000;">1000000</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre>
<p>I let in there all my init objects so io can see how to initialize them if you have more.  You can also notice the savePersistentData function which will update the cookie and save the persistent data <img src='http://umkk.eu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>Until here we only had generic information about how data is saved and the functions which save the data. Now I'll go in more details for the actual options panel. The panel is actually a div in which you can enter any thing you want, but the values of the check boxes will be saved  and their status restored when the page reloads.</p>
<p>So here is how my panel looks like :</p>
<pre class="javascript">jQuery<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;#gm_pl_options_container&quot;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">append</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;Show the timer
&lt;input id=&quot;</span>gm_pl_check_show_timer<span style="color: #3366CC;">&quot; type=&quot;</span>checkbox<span style="color: #3366CC;">&quot; /&gt;
&quot;</span><span style="color: #66cc66;">&#41;</span>;
	jQuery<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;#gm_pl_options_container&quot;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">append</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;Automaticaly sound the horn
&lt;input id=&quot;</span>gm_pl_check_sound_horn<span style="color: #3366CC;">&quot; type=&quot;</span>checkbox<span style="color: #3366CC;">&quot; /&gt;
&quot;</span><span style="color: #66cc66;">&#41;</span>;
	jQuery<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;#gm_pl_options_container&quot;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">append</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;&lt;strong&gt;Kings rewared options&lt;/strong&gt;
&quot;</span><span style="color: #66cc66;">&#41;</span>;
	jQuery<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;#gm_pl_options_container&quot;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">append</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;Play youtube on kings reward
&lt;input id=&quot;</span>gm_pl_play_sound_on_reward<span style="color: #3366CC;">&quot; type=&quot;</span>checkbox<span style="color: #3366CC;">&quot; /&gt;
&quot;</span><span style="color: #66cc66;">&#41;</span>;
	jQuery<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;#gm_pl_options_container&quot;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">append</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;Play midi on kings reward
&lt;input id=&quot;</span>gm_pl_play_sound_midi_on_reward<span style="color: #3366CC;">&quot; type=&quot;</span>checkbox<span style="color: #3366CC;">&quot; /&gt;
&quot;</span><span style="color: #66cc66;">&#41;</span>;
	jQuery<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;#gm_pl_options_container&quot;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">append</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;Show alert on kings rewared
&lt;input id=&quot;</span>gm_pl_show_alert_on_reward<span style="color: #3366CC;">&quot; type=&quot;</span>checkbox<span style="color: #3366CC;">&quot; /&gt;
&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
	setOptions<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
jQuery<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;#gm_pl_options_container input&quot;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">click</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>saveOptions<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</pre>
<p>in this case the id of the div inside which i enter the options is "gm_pl_options_container", and i you can see that setOptions() is called, this will set the default options for the check boxes based on the myData object, here's the code :</p>
<pre class="javascript"><span style="color: #003366; font-weight: bold;">function</span> setOptions <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> myData<span style="color: #66cc66;">&#91;</span><span style="color: #3366CC;">&quot;options&quot;</span><span style="color: #66cc66;">&#93;</span> == <span style="color: #3366CC;">&quot;object&quot;</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">for</span><span style="color: #66cc66;">&#40;</span>i <span style="color: #000066; font-weight: bold;">in</span> myData<span style="color: #66cc66;">&#91;</span><span style="color: #3366CC;">&quot;options&quot;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			jQuery<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;#&quot;</span>+i<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">attr</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;checked&quot;</span>,myData<span style="color: #66cc66;">&#91;</span><span style="color: #3366CC;">&quot;options&quot;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre>
<p>In my case the options are saved in myData["options"] the myData object is the main script object and all the scripts data is saved there, not just the options.</p>
<p>And after the setOptions function is called we also have an intresting line, this will add an onclick function to each input on that div, and in this function we call saveOptions(), this function will get all the inputs in that div, and save the values in myData['options'] object, and also write the cookie to make sure that the values are not lost on page refresh :</p>
<pre class="javascript"><span style="color: #003366; font-weight: bold;">function</span> saveOptions <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>!<span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> myData<span style="color: #66cc66;">&#91;</span><span style="color: #3366CC;">&quot;options&quot;</span><span style="color: #66cc66;">&#93;</span> == <span style="color: #3366CC;">&quot;object&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		myData<span style="color: #66cc66;">&#91;</span><span style="color: #3366CC;">&quot;options&quot;</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #003366; font-weight: bold;">new</span> Object<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
	jQuery.<span style="color: #006600;">each</span><span style="color: #66cc66;">&#40;</span>jQuery<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;#gm_pl_options_container input&quot;</span><span style="color: #66cc66;">&#41;</span>,<span style="color: #003366; font-weight: bold;">function</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">checked</span> == <span style="color: #003366; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			myData<span style="color: #66cc66;">&#91;</span><span style="color: #3366CC;">&quot;options&quot;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">id</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #003366; font-weight: bold;">true</span>;
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #000066; font-weight: bold;">else</span>
		<span style="color: #66cc66;">&#123;</span>
			myData<span style="color: #66cc66;">&#91;</span><span style="color: #3366CC;">&quot;options&quot;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">id</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #003366; font-weight: bold;">false</span>;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
	savePersistentData<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre>
<p>Every thing you have to do now is use those options, there are 2 ways to do this, you can check the status of the check box or you can get the value from the myData['options'] object, they are the same, i use the object :</p>
<pre class="javascript"><span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>myData<span style="color: #66cc66;">&#91;</span><span style="color: #3366CC;">&quot;options&quot;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #3366CC;">'gm_pl_show_alert_on_reward'</span><span style="color: #66cc66;">&#93;</span> == <span style="color: #003366; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #000066;">alert</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;You have a king's reward!&quot;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span></pre>
<p>And this is it, if you have any questions let me know, and remember, if you use mouse hunt don't forget to use my script :<a href="http://userscripts.org/scripts/show/57446" target="_blank"> Facebook mousehunt improvements</a></p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-caring">
<ul class="socials">
		<li class="shr-comfeed">
			<a href="http://umkk.eu/greasemonkey-create-a-options-panel-using-jquery/10/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://umkk.eu/greasemonkey-create-a-options-panel-using-jquery/10/&amp;title=Greasemonkey%2C+create+a+options+panel+using+jQuery" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://umkk.eu/greasemonkey-create-a-options-panel-using-jquery/10/&amp;title=Greasemonkey%2C+create+a+options+panel+using+jQuery" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-diigo">
			<a href="http://www.diigo.com/post?url=http://umkk.eu/greasemonkey-create-a-options-panel-using-jquery/10/&amp;title=Greasemonkey%2C+create+a+options+panel+using+jQuery&amp;desc=%0D%0A%0D%0AHi%2C%20this%20tutorial%20is%20also%20based%20on%20the%20mouse%20hunt%20script%20%22facebook%20mousehunt%20improvements%22%20created%20by%20me%2C%20and%20in%20this%20one%20i%20will%20explain%20how%20to%20create%20an%20options%20panel%20%28only%20check%20boxes%20at%20this%20time%29%20and%20save%20it.%0D%0A%0D%0AHere%20is%20my%20final%20result%20with%20this%20script%20%3A%0D%0A%0D%0AIf%20you%20want%20to%20try%20this%2C%20remember%20" rel="nofollow" class="external" title="Post this on Diigo">Post this on Diigo</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://umkk.eu/greasemonkey-create-a-options-panel-using-jquery/10/&amp;t=Greasemonkey%2C+create+a+options+panel+using+jQuery" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-gmail">
			<a href="https://mail.google.com/mail/?ui=2&amp;view=cm&amp;fs=1&amp;tf=1&amp;su=Greasemonkey%2C+create+a+options+panel+using+jQuery&amp;body=Link: http://umkk.eu/greasemonkey-create-a-options-panel-using-jquery/10/ (sent via shareaholic)%0D%0A%0D%0A----%0D%0A %0D%0A%0D%0AHi%2C%20this%20tutorial%20is%20also%20based%20on%20the%20mouse%20hunt%20script%20%22facebook%20mousehunt%20improvements%22%20created%20by%20me%2C%20and%20in%20this%20one%20i%20will%20explain%20how%20to%20create%20an%20options%20panel%20%28only%20check%20boxes%20at%20this%20time%29%20and%20save%20it.%0D%0A%0D%0AHere%20is%20my%20final%20result%20with%20this%20script%20%3A%0D%0A%0D%0AIf%20you%20want%20to%20try%20this%2C%20remember%20" rel="nofollow" class="external" title="Email this via Gmail">Email this via Gmail</a>
		</li>
		<li class="shr-googlebookmarks">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://umkk.eu/greasemonkey-create-a-options-panel-using-jquery/10/&amp;title=Greasemonkey%2C+create+a+options+panel+using+jQuery" rel="nofollow" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://umkk.eu/greasemonkey-create-a-options-panel-using-jquery/10/&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-misterwong">
			<a href="http://www.mister-wong.com/addurl/?bm_url=http://umkk.eu/greasemonkey-create-a-options-panel-using-jquery/10/&amp;bm_description=Greasemonkey%2C+create+a+options+panel+using+jQuery&amp;plugin=sexybookmarks" rel="nofollow" class="external" title="Add this to Mister Wong">Add this to Mister Wong</a>
		</li>
		<li class="shr-mixx">
			<a href="http://www.mixx.com/submit?page_url=http://umkk.eu/greasemonkey-create-a-options-panel-using-jquery/10/&amp;title=Greasemonkey%2C+create+a+options+panel+using+jQuery" rel="nofollow" class="external" title="Share this on Mixx">Share this on Mixx</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://umkk.eu/greasemonkey-create-a-options-panel-using-jquery/10/&amp;title=Greasemonkey%2C+create+a+options+panel+using+jQuery" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://umkk.eu/greasemonkey-create-a-options-panel-using-jquery/10/&amp;title=Greasemonkey%2C+create+a+options+panel+using+jQuery" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-technorati">
			<a href="http://technorati.com/faves?add=http://umkk.eu/greasemonkey-create-a-options-panel-using-jquery/10/" rel="nofollow" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Greasemonkey%2C+create+a+options+panel+using+jQuery+-+http://b2l.me/6hn7t&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>



<p>Related posts:<ol><li><a href='http://umkk.eu/greasemonkey-jquery-and-the-greatest-mouse-hunt-script/10/' rel='bookmark' title='Permanent Link: GreaseMonkey, Jquery and the greatest mouse hunt script.'>GreaseMonkey, Jquery and the greatest mouse hunt script.</a></li>
<li><a href='http://umkk.eu/autoupdate-on-greasemonkey-script/10/' rel='bookmark' title='Permanent Link: Autoupdate on greasemonkey script, example from &#8220;mousehunt improvements&#8221; script.'>Autoupdate on greasemonkey script, example from &#8220;mousehunt improvements&#8221; script.</a></li>
<li><a href='http://umkk.eu/jquery-popups-wizard-web-2-0-ideea-and-usability/10/' rel='bookmark' title='Permanent Link: jQuery popups wizard, web 2.0 ideea and usability'>jQuery popups wizard, web 2.0 ideea and usability</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://umkk.eu/greasemonkey-create-a-options-panel-using-jquery/10/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
