<?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; jquery</title>
	<atom:link href="http://www.ladysign-apps.com/blog/category/code/jquery-code/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ladysign-apps.com/blog</link>
	<description>Girls can code.</description>
	<lastBuildDate>Mon, 12 Dec 2011 16:58:15 +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>Semicolons after javascript statements</title>
		<link>http://www.ladysign-apps.com/blog/code/javascript/semicolons-after-javascript-statements/</link>
		<comments>http://www.ladysign-apps.com/blog/code/javascript/semicolons-after-javascript-statements/#comments</comments>
		<pubDate>Mon, 12 Dec 2011 14:16:06 +0000</pubDate>
		<dc:creator>Lee</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.ladysign-apps.com/blog/?p=1030</guid>
		<description><![CDATA[<p>According to Javascript; the semicolon after a statement (for example a function), is optional.<br />
However, it&#8217;s much better to end your line with [......]</p><p class='read-more'><a href='http://www.ladysign-apps.com/blog/code/javascript/semicolons-after-javascript-statements/'>继续阅读</a></p>]]></description>
			<content:encoded><![CDATA[<p>According to Javascript; the semicolon after a statement (for example a function), is optional.<br />
However, it&#8217;s much better to end your line with a semicolon. A validator like JSLint for example, will throw a warning, even though<br />
the browser won&#8217;t, and accepts it.</p>
<p>See below, which strange things can happen when you won&#8217;t end your line with a semicolon.<br />
Javascript errors because of the order of javascript functions mixed with jQuery plugins&#8230;<br />
<a href="http://jsfiddle.net/bpsuW/11/">http://jsfiddle.net/bpsuW/11/</a></p>
<p>foo is a simple javascript function.<br />
Baz is a simple self running jQuery plugin. (because of the parentheses surrounding it).</p>
<p><code>foo = function(){<br />
    alert("function 1");<br />
}</p>
<p>(function(){<br />
    $.fn.Baz = function(opt){<br />
        alert("function 2");<br />
    }<br />
 })(jQuery)<br />
</code></p>
<p>See below the script, without strange javascript errors.<br />
<a href="http://jsfiddle.net/bpsuW/10/">http://jsfiddle.net/bpsuW/10/</a></p>
<p>The answer is really logical.<br />
Because there is no semicolon, the jQuery plugin (Baz) will directly execute, because of the parentheses.<br />
Like it&#8217;s a parameter of the javascript function you wrote before. (foo), and then throws errors.<br />
So:</p>
<p><code>foo(Baz)</code></p>
<p>When you mix your jQuery plugins with native javascript classes and functions in different orders; these kind of errors can happen.<br />
This scenario above shows you why you should <strong>always</strong> end your statements with a semicolon.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ladysign-apps.com/blog/code/javascript/semicolons-after-javascript-statements/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jQuery does not load 3G iphone safari</title>
		<link>http://www.ladysign-apps.com/blog/code/javascript/jquery-does-not-load-3g-iphone-safari/</link>
		<comments>http://www.ladysign-apps.com/blog/code/javascript/jquery-does-not-load-3g-iphone-safari/#comments</comments>
		<pubDate>Wed, 17 Aug 2011 09:25:39 +0000</pubDate>
		<dc:creator>Lee</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[3G]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[jquery mobile]]></category>
		<category><![CDATA[O2]]></category>
		<category><![CDATA[parse errors]]></category>
		<category><![CDATA[safari]]></category>
		<category><![CDATA[t-mobile]]></category>

		<guid isPermaLink="false">http://www.ladysign-apps.com/blog/?p=1017</guid>
		<description><![CDATA[<p><strong>Difficulty:</strong> 3 out of 5 stars</p>
<p>Today I found out a very strange thing&#8230; My jQuery Mobile website doesn&#8217;t work on iPhone Safari in 3G mode. In[......]</p><p class='read-more'><a href='http://www.ladysign-apps.com/blog/code/javascript/jquery-does-not-load-3g-iphone-safari/'>继续阅读</a></p>]]></description>
			<content:encoded><![CDATA[<p><strong>Difficulty:</strong> 3 out of 5 stars</p>
<p>Today I found out a very strange thing&#8230; My jQuery Mobile website doesn&#8217;t work on iPhone Safari in 3G mode. In WIFI mode my page is fully loaded, and jQuery Mobile works fine.<br />
I enabled debug messages on my iPhone. And then I found out that jquery.min.js gives me parse errors.</p>
<p><strong>Parse errors jQuery.min.js</strong><br />
From jQuery 1.5 and higher..  You&#8217;ll receive parse errors in jQuery and therefore also jQuery Mobile can not be loaded. &#8211; And probably also not the other scripts that use jQuery.</p>
<pre class="brush: jscript; title: ;">
javascript parse error line 3.
Can't find variable jQuery.
</pre>
<p>The problem seems to be with the mobile carrier&#8217;s transparent proxy. In this case T-Mobile / O2.<br />
I tethered my phone so that I could browse on 3G and the file downloaded is completely different from that downloaded through my wired connection. Also, the downloaded files MD5 sums didn&#8217;t match!</p>
<p>Check this:<br />
3G:</p>
<pre class="brush: jscript; title: ;">
H TTP/1.1 200 OK
C ontent-Encoding: gzip
S erver: Apache/2.2.9 (Unix) PHP/5.2.6
E tag: &quot;360ce-164ce-4a4b742e336c0&quot;
A ccept-Ranges: bytes
C ontent-Type: application/javascript
A ge: 1317
D ate: Thu, 16 Jun 2011 14:56:25 GMT
L ast-Modified: Thu, 02 Jun 2011 09:28:35 GMT
E xpires: Fri, 17 Jun 2011 14:56:25 GMT
T ransfer-Encoding: chunked
</pre>
<p>Wired:</p>
<pre class="brush: jscript; title: ;">
H TTP/1.1 200 OK
D ate: Thu, 16 Jun 2011 15:29:06 GMT
S erver: Apache/2.2.9 (Unix) PHP/5.2.6
L ast-Modified: Thu, 02 Jun 2011 09:28:35 GMT
E tag: &quot;360ce-164ce-4a4b742e336c0&quot;
A ccept-Ranges: bytes
C ontent-Length: 91342
K eep-Alive: timeout=5, max=100
C onnection: Keep-Alive
C ontent-Type: application/javascript
</pre>
<p><strong>How to solve?</strong><br />
Don&#8217;t serve your jQuery file yourself but use a CDN like google:<br />
<strong>http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js</strong></p>
<p>This did the trick!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ladysign-apps.com/blog/code/javascript/jquery-does-not-load-3g-iphone-safari/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Nice search field</title>
		<link>http://www.ladysign-apps.com/blog/code/css/nice-search-field/</link>
		<comments>http://www.ladysign-apps.com/blog/code/css/nice-search-field/#comments</comments>
		<pubDate>Wed, 02 Feb 2011 10:21:46 +0000</pubDate>
		<dc:creator>Lee</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[searchinput]]></category>

		<guid isPermaLink="false">http://www.ladysign-apps.com/blog/?p=1003</guid>
		<description><![CDATA[<p><strong>Difficulty:</strong> 3 out of 5 stars</p>
<p>Advanced HTML5 search field with placeholder and fallback for the other browsers.<br />
Styling with gradient + radius + image [......]</p><p class='read-more'><a href='http://www.ladysign-apps.com/blog/code/css/nice-search-field/'>继续阅读</a></p>]]></description>
			<content:encoded><![CDATA[<p><strong>Difficulty:</strong> 3 out of 5 stars</p>
<p>Advanced HTML5 search field with placeholder and fallback for the other browsers.<br />
Styling with gradient + radius + image in field.<br />
With JS logics: Search on input string and search on enter.</p>
<p>HTML:</p>
<pre class="brush: xml; title: ;">
&lt;fieldset class=&quot;search&quot;&gt;&lt;div class=&quot;inputsearchgroup&quot;&gt;
&lt;span class=&quot;search_icon&quot;&gt;&lt;/span&gt;
&lt;input type=&quot;hidden&quot; name=&quot;url&quot; value=&quot;search.php&quot;&gt;
&lt;input class=&quot;search&quot; type=&quot;search&quot; placeholder=&quot;Search...&quot; name=&quot;search&quot;&gt;&lt;/div&gt;
&lt;button class=&quot;smallradius submit&quot;&gt;Search&lt;/button&gt;
&lt;/fieldset&gt;
</pre>
<p>CSS:</p>
<pre class="brush: css; title: ;">
fieldset.search {
	border: none;
	padding: 0;
	position: relative;
}

fieldset.search input {
    -webkit-appearance: none;
    -webkit-box-sizing: content-box;
    background: none;
    background: -webkit-gradient(linear, left top, left bottom, from(rgba(250, 250, 250, 1)), to(rgba(250, 250, 250, 0)), color-stop(.3,rgba(250, 250, 250, 0))););
    background-image: -moz-linear-gradient(rgba(250, 250, 250, 1) 0%, rgba(255, 255, 255, 0) 30%);
    border: 1px solid #f2f2f3;
    float: left;
    margin-right: 5px;
    padding: 10px 0 10px 44px;
    background-color: #fff;
}

fieldset.search div.inputsearchgroup {
	position: relative;
	float: left;
}

fieldset.search div.inputsearchgroup span.search_icon {
	background: url(icon_search_glass.png) no-repeat 10px 7px;
	display: inline-block;
	position: absolute;
	top: 0;
	left: 0;
	width: 37px;
	height: 33px;
}

/*
 * CSS3
 */
.smallradius {
	-moz-border-radius: 3px;
	-webkit-border-radius: 3px;
	border-radius: 3px;
}
</pre>
<p>JS:</p>
<pre class="brush: jscript; title: ;">
(function(){
	/*
	 * jQuery PlaceHolder + Search Submit
	 * it submits the search query on enter button and on search button.
	 * place holder functionality for browsers which don't support placeholder
	 * @author Lee Boonstra
	 * @since 21 jan 2011
	 * @version 1.0
	 *
	 * @uses jQuery 1.2.6, &lt;http://www.jquery.com&gt; or higher
	 */
	$.fn.SearchInput = function(){
		var strSavedString = &quot;&quot;;

		/*
		 * Does the browser support placeholder attribute?
		 * @return boolean
		 */
		function isBrowserSupport(){
			var i = document.createElement(&quot;input&quot;);
			return &quot;placeholder&quot; in i;
		}
		return this.each(function(){
			var button = $(this).parent().parent().find('.submit');
			var url = $(this).parent().find('input[name|=url]').val();
			var e = $(this);

			var strPlaceHolderText = e.attr(&quot;placeholder&quot;);

			if(e.val().length == 0){
				e.val(strPlaceHolderText);
			}

			/*
			 * On field focus remove placeholder if there is no written text in it.
			 * @return void
			 */
			e.focus(function(){
				strSavedString = e.val();
				if (strSavedString === strPlaceHolderText) {
					e.val(&quot;&quot;);
				}
			});

			/*
			 * Save the written text in a variable
			 * @return void
			 */
			e.change(function(){
				strSavedString = e.val();
			});

			/*
			 * While leaving the focus of the field, put the placeholder back
			 * or the written text.
			 * @return void
			 */
			e.blur(function(){
				if(isBrowserSupport()===false){
					if(strSavedString !== strPlaceHolderText &amp;&amp; strSavedString !== &quot;&quot;){
						e.val(strSavedString);
					} else {
						e.val(strPlaceHolderText);
					}
				}
			});

			/*
			 * Search if the key is enter or button has been clicked,
			 * if there's a input hidden url and the input is not empty and does not contain the    placeholder
			 */
			function search(ev){
				if (ev.keyCode === 13 &amp;&amp; strSavedString !== strPlaceHolderText &amp;&amp; strSavedString !== &quot;&quot; &amp;&amp; url !== null) {
					window.location.href = url + &quot;?q=&quot; + strSavedString;
				}
				if(ev===&quot;click&quot; &amp;&amp; strSavedString !== strPlaceHolderText &amp;&amp; strSavedString !== &quot;&quot; &amp;&amp; url !== null){
					window.location.href = url + &quot;?q=&quot; + strSavedString;
				}
			}

			/*
			 * Submit the query
			 */
			e.keyup(function(ev){
				search(ev);
			})
			button.click(function(){
				search(&quot;click&quot;);
			});

		});

	};
})(jQuery);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ladysign-apps.com/blog/code/css/nice-search-field/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><p class='read-more'><a href='http://www.ladysign-apps.com/blog/code/javascript/mootools-jquery-conflicts-in-joomla-1-5/'>继续阅读</a></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; title: ;">&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; title: ;">$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>5</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><p class='read-more'><a href='http://www.ladysign-apps.com/blog/code/javascript/jquery-for-ie7pro-userscripts-or-greasemonkey/'>继续阅读</a></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; title: ;">
//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; title: ;">
// ==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; title: ;">
// ==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>

