<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>TutorBoy</title>
	
	<link>http://articles.tutorboy.com</link>
	<description>Log on to Techknowledgey</description>
	<lastBuildDate>Wed, 28 Mar 2012 11:04:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/TutorBoyArticles" /><feedburner:info uri="tutorboyarticles" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>TutorBoyArticles</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>JavaScript FullScreenAPI</title>
		<link>http://feedproxy.google.com/~r/TutorBoyArticles/~3/2W7LcU61mDI/</link>
		<comments>http://articles.tutorboy.com/2012/03/28/javascript-fullscreenapi/#comments</comments>
		<pubDate>Wed, 28 Mar 2012 10:59:55 +0000</pubDate>
		<dc:creator>Midhun Devasia</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[FullScreenAPI]]></category>

		<guid isPermaLink="false">http://articles.tutorboy.com/?p=3267</guid>
		<description><![CDATA[You can use the Browser full-screen using JavaScript. Firefox, Chrome and Safari support this feature, but IE and Opera are ...]]></description>
			<content:encoded><![CDATA[<p>You can use the Browser full-screen using JavaScript. Firefox, Chrome and Safari support this feature, but IE and Opera are not allowed to access this full-screen feature via JavaScript. <span id="more-3267"></span>The function call is different in each browsers. <code>mozRequestFullScreen</code> for mozilla and <code>webkitRequestFullScreen</code> for Safari n Chorme.</p>
<h2>JavaScript</h2>
<pre class="brush:js">        var obj = document.getElementById(&#039;fullScreenContainer&#039;);

        // Activate fullscreen
        if ((document.fullScreenElement &amp;&amp; document.fullScreenElement !== null) ||
        (!document.mozFullScreen &amp;&amp; !document.webkitIsFullScreen)) {
            if (obj.requestFullScreen) {
                obj.requestFullScreen();
            } else if (obj.mozRequestFullScreen) {
                obj.mozRequestFullScreen();
            } else if (obj.webkitRequestFullScreen) {
                obj.webkitRequestFullScreen();
            }
        }else {
            // Cancel FullScreen
            if (document.cancelFullScreen) {
                document.cancelFullScreen();
            } else if (document.mozCancelFullScreen) {
                document.mozCancelFullScreen();
            } else if (document.webkitCancelFullScreen) {
                document.webkitCancelFullScreen();
            }

        }</pre>
<p>The <code>fullScreenContainer</code> is the element id which you want to show in fullscreen mode. In Chrome the content will automatically comes to the center, but on Firefox it doesn&#8217;t.</p>
<p><a href="http://demo.tutorboy.com/articles/javascript_fullscreen.html">View Demo</a></p>
<img src="http://feeds.feedburner.com/~r/TutorBoyArticles/~4/2W7LcU61mDI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://articles.tutorboy.com/2012/03/28/javascript-fullscreenapi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://articles.tutorboy.com/2012/03/28/javascript-fullscreenapi/</feedburner:origLink></item>
		<item>
		<title>Sign in with Twitter Using TwitterOAuth</title>
		<link>http://feedproxy.google.com/~r/TutorBoyArticles/~3/KPNv5zrtPGQ/</link>
		<comments>http://articles.tutorboy.com/2012/03/09/sign-in-with-twitter-using-twitteroauth/#comments</comments>
		<pubDate>Fri, 09 Mar 2012 09:37:51 +0000</pubDate>
		<dc:creator>Midhun Devasia</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[OAuth]]></category>
		<category><![CDATA[Twitter API]]></category>

		<guid isPermaLink="false">http://articles.tutorboy.com/?p=3248</guid>
		<description><![CDATA[A simple explanation for the usage of Sign in Twitter feature with the TwitterOAuth PHP class. Instead of copy paste ...]]></description>
			<content:encoded><![CDATA[<p>A simple explanation for the usage of Sign in Twitter feature with the TwitterOAuth PHP class. Instead of copy paste the below code, take 5 minute to read the logic behind the Twitter OAuth flow.<span id="more-3248"></span> I&#8217;m using the TwitterOAuth Class file which is written by Abraham, you can download or read more about TwitterOAuth on his <a title="abraham / twitteroauth " href="https://github.com/abraham/twitteroauth" target="_blank">Git</a>. Okey, Let me explain the logic.</p>
<p><span><a href="http://demo.tutorboy.com/articles/twitterconnect/twitter_connect.php">VIEW DEMO</a></span><span>      <a href="https://github.com/midhundevasia/TwitterOAuthExample/zipball/master">DOWNLOAD</a></span>      <a href="https://github.com/midhundevasia/TwitterOAuthExample"> GIT </a></span></p>
<p>You need to create a Twitter Application and set the &#8220;Read and Write&#8221; permission in the settings tab.</p>
<p>Twitter OAuth is dealing with tokens and scecret keys, it doesn&#8217;t need username or passwords.<br />
So Copy the <code>CONSUMER_KEY</code> and <code>CONSUMER_SECRET</code> from the Application.</p>
<p>If we want to get all details of the user, we need to Authenticate the user to the Twitter App.</p>
<h2>STEP: 1</h2>
<p>We pass the CONSUMER_KEY and CONSUMER_SECRET to the TwitterOAuth Class to get the Authorize.</p>
<pre class="brush:php">$twitterConnect = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);//Will establish the connection with Twitter using KEYS</pre>
<p>And the 2nd thing is, need a <code>Request Token</code> to generate the Authorize URL.</p>
<pre class="brush:php">  $_SESSION[&#039;twitter_oauth&#039;] = $twitterToken = $twitterConnect-&gt;getRequestToken(CALLBACK_URL);</pre>
<p>The <code>CALLBACK_URL</code> is optional, but if you leave this as EMPTY, the CALLBACK_URL from the Twitter Application will be use.<br />
Note: If there is no <code>CALLBACK_URL</code> present in the Twitter App or in the Code, it will not work.<br />
The <code>$_SESSION['twitter_oauth'] </code> used for the future reference.<br />
<code>$twitterToken</code> is an array, which contains two values, <code>oauth_token</code> and <code>oauth_token_secret</code><br />
We will pass the <code>$twitterToken</code> to the next function<br />
ie</p>
<pre class="brush:php"> $twitter_login_url = $twitterConnect-&gt;getAuthorizeURL($twitterToken, true);</pre>
<p>To get the Login URL.</p>
<p>You can use this url in the Sign In With Twitter link . like <code>&lt;a href="&lt;?=$twitter_login_url?&gt;"&gt;Sign in with Twitter &lt;/a&gt;</code></p>
<p>So the user is about to login the with Twitter. Once he/she press the button it will redirected to the Twitter&#8217;s Auhorization page.<br />
If the user completed the login process successfuly on Twitter, it will redirected to our site, ie the url of the <code>CALLBACK_URL</code><br />
Twitter add a url param <code>oauth_token</code> along with the callback url, actualy we dont use it anywhere, but we use it for the successful login.</p>
<h2>STEP 2:</h2>
<p>The next step is to generate the access tokens using the <code>$twitterToken</code> ie <code>oauth_token</code> and <code>oauth_token_secret</code>.<br />
Here we are establising a new Twitter connection using the following temperory credentials</p>
<pre class="brush:php"> $twitterConnect = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $_SESSION[&#039;twitter_oauth&#039;][&#039;oauth_token&#039;], $_SESSION[&#039;twitter_oauth&#039;][&#039;oauth_token_secret&#039;]);</pre>
<p>with this <code>$twitterConnect</code> object we request access token</p>
<pre class="brush:php"> $_SESSION[&#039;twitter_access&#039;] = $token_credentials = $twitterConnect-&gt;getAccessToken($_REQUEST[&#039;oauth_verifier&#039;]);</pre>
<p><code>$token_credentials</code> is also an array with two keys, <code>oauth_token</code> and <code>oauth_token_secret</code> the names are same as above<br />
but here it know as <code>access tokens</code>.</p>
<p>You can save this access tokens in database or session variable to the feature use. Once you have this access tokens,<br />
you dont need to login the user each time. You can post or access informations without login into Twitter.<br />
This key is valid until the user press Reinvoke button from the users App settings panel.</p>
<p>Note: Dont call this step again, because the <code>Request Tokens</code> valid only once. That is the reason we are redirecting after the success.</p>
<h2>STEP 3:</h2>
<p>To get the user details, using the<br />
<code>CONSUMER_KEY</code>, <code>CONSUMER_SECRET</code> and <code> ACCESS TOKENS</code></p>
<pre class="brush:php">$twitterConnect = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $_SESSION[&#039;twitter_access&#039;][&#039;oauth_token&#039;], $_SESSION[&#039;twitter_access&#039;][&#039;oauth_token_secret&#039;]);
$content = $twitterConnect-&gt;get(&#039;account/verify_credentials&#039;);</pre>
<p>So the final code looks like</p>
<h2>Config.php</h2>
<pre class="brush:php">@session_start();
include(&#039;config.php&#039;);

if( isset( $_SESSION[&#039;twitter_oauth&#039;][&#039;oauth_token&#039;] ) &amp;&amp; isset( $_REQUEST[&#039;oauth_token&#039;] ) ) {
	$twitterConnect = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $_SESSION[&#039;twitter_oauth&#039;][&#039;oauth_token&#039;], $_SESSION[&#039;twitter_oauth&#039;][&#039;oauth_token_secret&#039;]);
	$_SESSION[&#039;twitter_access&#039;] = $token_credentials = $twitterConnect-&gt;getAccessToken($_REQUEST[&#039;oauth_verifier&#039;]);

	$_SESSION[&#039;twitter_status&#039;] = true;
	header(&#039;Location: twitter_connect.php&#039;);

}</pre>
<h2>callback.php</h2>
<pre class="brush:php">@session_start();
include(&#039;config.php&#039;);

if( isset( $_SESSION[&#039;twitter_oauth&#039;][&#039;oauth_token&#039;] ) &amp;&amp; isset( $_REQUEST[&#039;oauth_token&#039;] ) ) {
	$twitterConnect = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $_SESSION[&#039;twitter_oauth&#039;][&#039;oauth_token&#039;], $_SESSION[&#039;twitter_oauth&#039;][&#039;oauth_token_secret&#039;]);
	$_SESSION[&#039;twitter_access&#039;] = $token_credentials = $twitterConnect-&gt;getAccessToken($_REQUEST[&#039;oauth_verifier&#039;]);

	$_SESSION[&#039;twitter_status&#039;] = true;
	header(&#039;Location: twitter_connect.php&#039;);

}</pre>
<h2>twitter_connect.php</h2>
<pre class="brush:php">@session_start();
include(&#039;config.php&#039;);

// Clear all Twitter session
if ($_REQUEST[&#039;logout&#039;] == true) {
	unset( $_SESSION[&#039;twitter_oauth&#039;] );
	unset( $_SESSION[&#039;twitter_access&#039;] );
	unset( $_SESSION[&#039;twitter_status&#039;] );
}

if( !isset($_SESSION[&#039;twitter_oauth&#039;][&#039;oauth_token&#039;]) || $_SESSION[&#039;twitter_status&#039;] == false &amp;&amp; !isset( $_REQUEST[&#039;oauth_token&#039;] ) ) {

	$twitterConnect = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);
	$_SESSION[&#039;twitter_oauth&#039;] = $twitterToken = $twitterConnect-&gt;getRequestToken(CALLBACK_URL);
	$twitter_login_url = $twitterConnect-&gt;getAuthorizeURL($twitterToken, true);
	$_SESSION[&#039;twitter_status&#039;] = false;
}

// If it was a successfull authentication
if( isset($_SESSION[&#039;twitter_access&#039;][&#039;oauth_token&#039;]) &amp;&amp; isset($_SESSION[&#039;twitter_access&#039;][&#039;oauth_token_secret&#039;]) ) {

	$twitterConnect = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $_SESSION[&#039;twitter_access&#039;][&#039;oauth_token&#039;], $_SESSION[&#039;twitter_access&#039;][&#039;oauth_token_secret&#039;]);
	$content = $twitterConnect-&gt;get(&#039;account/verify_credentials&#039;);

}

if ( $twitter_login_url ) {

	echo &quot;&lt;a href=&#039;{$twitter_login_url}&#039; &gt;&lt;img src=&#039;sign-in-with-twitter-l.png&#039; /&gt;&lt;/a&gt;&quot;;

}</pre>
<h2>Screens</h2>
<p><img src="http://articles.tutorboy.com/content/uploads/2012/03/TwitterApp.jpg" alt="" title="TwitterApp" width="533" height="590" class="alignnone size-full wp-image-3260" /><img src="http://articles.tutorboy.com/content/uploads/2012/03/ApplicationDetails.jpg" alt="" title="ApplicationDetails" width="485" height="555" class="alignnone size-full wp-image-3259" /><img src="http://articles.tutorboy.com/content/uploads/2012/03/TwitterAuthentication.jpg" alt="" title="TwitterAuthentication" width="544" height="561" class="alignnone size-full wp-image-3261" /></p>
<img src="http://feeds.feedburner.com/~r/TutorBoyArticles/~4/KPNv5zrtPGQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://articles.tutorboy.com/2012/03/09/sign-in-with-twitter-using-twitteroauth/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://articles.tutorboy.com/2012/03/09/sign-in-with-twitter-using-twitteroauth/</feedburner:origLink></item>
		<item>
		<title>WordPress Custom Fields – Lost by Autosave??</title>
		<link>http://feedproxy.google.com/~r/TutorBoyArticles/~3/y1YffKUWrtE/</link>
		<comments>http://articles.tutorboy.com/2012/02/29/wordpress-custom-fields-lost-by-autosave/#comments</comments>
		<pubDate>Wed, 29 Feb 2012 14:21:43 +0000</pubDate>
		<dc:creator>Midhun Devasia</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Autosave]]></category>
		<category><![CDATA[Issue]]></category>

		<guid isPermaLink="false">http://articles.tutorboy.com/?p=3242</guid>
		<description><![CDATA[Issue:
I have added some custom fields to the add_meta_box and hooked a function to edit_post, publish_post, save_post. Everything is working ...]]></description>
			<content:encoded><![CDATA[<h2>Issue:</h2>
<p>I have added some custom fields to the <code>add_meta_box</code> and hooked a function to <code>edit_post, publish_post, save_post</code>. Everything is working fine, but unfortunately the <code>autosave</code> destroy all the efforts. I didn&#8217;t find any hook to control <code>autosave</code>.<span id="more-3242"></span></p>
<h2>Solution:</h2>
<p>I just added a <code>if condition</code> to my hook function. Many of them suggest to increase the autosave time to months/years etc. but I prefer this</p>
<p>This is the condition <img src='http://articles.tutorboy.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  a simple hack.</p>
<p><code>if ($_REQUEST['action'] == 'autosave') return;</code></p>
<p>So final script looks like below</p>
<h2>PHP Script:</h2>
<pre class="brush:php">add_action( &#039;save_post&#039;, &#039;save_request_data&#039; );
add_action( &#039;edit_post&#039;, &#039;save_request_data&#039; );

function save_request_data() {
	global $post;
        // Will return if it an Ajax Autosave action. We are safe now
	if ($_REQUEST[&#039;action&#039;] == &#039;autosave&#039;) return;

	// ALL YOUR CODES COMES HERE...
}</pre>
<p>Hope this will solve your problem with autosave. Thank you <img src='http://articles.tutorboy.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<img src="http://feeds.feedburner.com/~r/TutorBoyArticles/~4/y1YffKUWrtE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://articles.tutorboy.com/2012/02/29/wordpress-custom-fields-lost-by-autosave/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://articles.tutorboy.com/2012/02/29/wordpress-custom-fields-lost-by-autosave/</feedburner:origLink></item>
		<item>
		<title>Gmail style Scrollbar Using jQuery and CSS + MouseWheel</title>
		<link>http://feedproxy.google.com/~r/TutorBoyArticles/~3/AoUYFrckERk/</link>
		<comments>http://articles.tutorboy.com/2012/02/29/gmail-style-scrollbar-using-jquery-and-css-mousewheel/#comments</comments>
		<pubDate>Wed, 29 Feb 2012 06:40:41 +0000</pubDate>
		<dc:creator>Midhun Devasia</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[MouseWheel]]></category>

		<guid isPermaLink="false">http://articles.tutorboy.com/?p=3235</guid>
		<description><![CDATA[As per the request, here is an updated version of scrollbar with the Mouse Wheel feature. Now you can scroll using ...]]></description>
			<content:encoded><![CDATA[<p>As per the request, here is an updated version of <a title="Gmail style Scrollbar Using jQuery and CSS" href="http://articles.tutorboy.com/2011/11/14/gmail-style-scrollbar-using-jquery-and-css/">scrollbar</a> with the Mouse Wheel feature. Now you can scroll using the Mouse Wheel movement. <img src='http://articles.tutorboy.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> <span id="more-3235"></span></p>
<p>Previous Version you can find <a title="Gmail style Scrollbar Using jQuery and CSS" href="http://articles.tutorboy.com/2011/11/14/gmail-style-scrollbar-using-jquery-and-css/">here</a>. and also applicable for this <a title="Facebook/Twitter style Scrollbar Using jQuery and CSS" href="http://articles.tutorboy.com/2011/11/10/facebook-twitter-style-scrollbar/">(Facebook/Twitter style Scrollbar Using jQuery and CSS)</a>.</p>
<p><a href="http://demo.tutorboy.com/articles/Gmail_style_Scrollbar_Using_jQuery_CSS_MouseWheel.html">View Demo</a></p>
<p>Here am updating the complete JavaScript.</p>
<h2>JavaScript</h2>
<pre class="brush:js">$(document).ready(function(){

    var _offsetY = 0,
    _startY = 0,
    scrollStep = 10,
    isScrollBarClick = false,
    contentDiv,
    scrubber,
    scrollHeight,
    contentHeight,
    scrollFaceHeight,
    initPosition,
    initContentPos,
    moveVal,
    scrubberY = 0;

    element = document.getElementById(&quot;updateHolder&quot;);
    if (element.addEventListener)
        /** DOMMouseScroll is for mozilla. */
        element.addEventListener(&#039;DOMMouseScroll&#039;, wheel, false);
    /** IE/Opera. */
    element.onmousewheel = document.onmousewheel = wheel;

	// To resize the height of the scroll scrubber when scroll height increases.
	setScrubberHeight();

	contentDiv = document.getElementById(&#039;updateContainer&#039;);

	scrubber = $(&#039;#updateScollScrubber&#039;);

	scrollHeight = $(&#039;#updateScollBar&#039;).outerHeight();

	contentHeight = $(&#039;#updateContent&#039;).outerHeight();

	scrollFaceHeight = scrubber.outerHeight();

    initPosition = 0;

	initContentPos = $(&#039;#updateHolder&#039;).offset().top;

	// Calculate the movement ration with content height and scrollbar height
	moveVal = (contentHeight - scrollHeight)/(scrollHeight - scrollFaceHeight);

	$(&#039;#updateHolder&#039;).bind(&#039;mousewheel&#039;, wheel);

	$(&quot;#updateScollScrubber&quot;).mouseover(function() {
		// Enable Scrollbar only when the content height is greater then the view port area.
		isScrollBarClick = false;
		if(contentHeight &gt; scrollHeight) {
			// Show scrollbar on mouse over
			$(this).animate({opacity: 1});
			scrubber.bind(&quot;mousedown&quot;, onMouseDown);
		}
	}).mouseout(function() {
	    isScrollBarClick = false;
		if(contentHeight &gt; scrollHeight) {
			// Hide Scrollbar on mouse out.
			$(this).animate({opacity: 0.25});
			$(&#039;#updateHolder&#039;).unbind(&quot;mousemove&quot;, onMouseMove);
		    scrubber.unbind(&quot;mousedown&quot;, onMouseDown);
		}
	});

    $(&quot;#updateScollBar&quot;).mousedown(function(){
        isScrollBarClick = true;
    }).mouseout(function(){
        isScrollBarClick = false;
    }).mouseup(function(event) {
        if( isScrollBarClick == false )
             return;
        if ((event.pageY - initContentPos) &gt; (scrollHeight - scrubber.outerHeight())) {
            scrubber.css({top: (scrollHeight - scrubber.outerHeight())});
        }else{
            scrubber.css({top: (event.pageY - initContentPos) - 5});
        }
        $(&#039;#updateContent&#039;).css({top: ((initContentPos - scrubber.offset().top) * moveVal)});
    });

	function onMouseDown(event) {
		$(&#039;#updateHolder&#039;).bind(&quot;mousemove&quot;, onMouseMove);
		$(&#039;#updateHolder&#039;).bind(&quot;mouseup&quot;, onMouseUp);
		_offsetY = scrubber.offset().top;
		_startY = event.pageY + initContentPos;
		// Disable the text selection inside the update area. Otherwise the text will be selected while dragging on the scrollbar.
		contentDiv.onselectstart = function () { return false; } // ie
		contentDiv.onmousedown = function () { return false; } // mozilla
	}

	function onMouseMove(event) {

        isScrollBarClick = false;
		// Checking the upper and bottom limit of the scroll area
		if((scrubber.offset().top &gt;= initContentPos) &amp;&amp; (scrubber.offset().top  (initContentPos + scrollHeight - scrollFaceHeight)) {
				scrubber.css({top: (scrollHeight-scrollFaceHeight-2)});
				$(&#039;#updateContent&#039;).css({top: (scrollHeight - contentHeight + initPosition)});
			}
			$(&#039;#updateHolder&#039;).trigger(&#039;mouseup&#039;);
		}
	}

	function onMouseUp(event) {
		$(&#039;#updateHolder&#039;).unbind(&quot;mousemove&quot;, onMouseMove);
		contentDiv.onselectstart = function () { return true; } // ie
		contentDiv.onmousedown = function () { return true; } // mozilla
	}

	function setScrubberHeight() {
		cH = $(&#039;#updateContent&#039;).outerHeight();
		sH = $(&#039;#updateScollBar&#039;).outerHeight();
		if(cH &gt; sH) {
			// Set the min height of the scroll scrubber to 20
			if(sH / ( cH / sH ) &lt; 20) { 				$(&#039;#updateScollScrubber&#039;).css({height: 20 }); 			}else{ 				$(&#039;#updateScollScrubber&#039;).css({height: sH / ( cH / sH ) }); 			} 		} 	} 	function onMouseWheel(dir) {         scrubberY = scrubber.offset().top + (scrollStep * dir) - initContentPos;         if ((scrubberY) &gt; (scrollHeight - scrubber.outerHeight())) {
            scrubber.css({top: (scrollHeight - scrubber.outerHeight())});
        }else {
            if(scrubberY &lt; 0) scrubberY = 0;
            scrubber.css({top: scrubberY});
        }
        $(&#039;#updateContent&#039;).css({top: ((initContentPos - scrubber.offset().top) * moveVal)});
	}

	/** This is high-level function.
	 * It must react to delta being more/less than zero.
	 */
	function handle(delta) {
	        if (delta &lt; 0) {
			    onMouseWheel(1);
	        }
	        else {
			    onMouseWheel(-1);
	        }
	}

	/** Event handler for mouse wheel event.
	 */
	function wheel(event){
	        var delta = 0;
	        if (!event) /* For IE. */
	                event = window.event;
	        if (event.wheelDelta) { /* IE/Opera. */
	                delta = event.wheelDelta/120;
	        } else if (event.detail) { /** Mozilla case. */
	                /** In Mozilla, sign of delta is different than in IE.
	                 * Also, delta is multiple of 3.
	                 */
	                delta = -event.detail/3;
	        }
	        /** If delta is nonzero, handle it.
	         * Basically, delta is now positive if wheel was scrolled up,
	         * and negative, if wheel was scrolled down.
	         */
	        if (delta)
	                handle(delta);
	        /** Prevent default actions caused by mouse wheel.
	         * That might be ugly, but we handle scrolls somehow
	         * anyway, so don&#039;t bother here..
	         */
	        if (event.preventDefault)
	                event.preventDefault();
	        event.returnValue = false;
	}

});</pre>
<img src="http://feeds.feedburner.com/~r/TutorBoyArticles/~4/AoUYFrckERk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://articles.tutorboy.com/2012/02/29/gmail-style-scrollbar-using-jquery-and-css-mousewheel/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://articles.tutorboy.com/2012/02/29/gmail-style-scrollbar-using-jquery-and-css-mousewheel/</feedburner:origLink></item>
		<item>
		<title>Twitter Followbox Plugin In JavaScript</title>
		<link>http://feedproxy.google.com/~r/TutorBoyArticles/~3/JmCwfsDgVhE/</link>
		<comments>http://articles.tutorboy.com/2012/02/23/twitter-followbox-plugin-in-javascript/#comments</comments>
		<pubDate>Thu, 23 Feb 2012 09:10:02 +0000</pubDate>
		<dc:creator>Midhun Devasia</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[TwitterFollowbox]]></category>

		<guid isPermaLink="false">http://articles.tutorboy.com/?p=3222</guid>
		<description><![CDATA[It is JavaScript Plugin to show Twitter followers count and profile pics just like Facebook Likebox.
You can find the application ...]]></description>
			<content:encoded><![CDATA[<p><img class="size-full wp-image-3223 alignright" title="TwitterFollowersPlugin" src="http://articles.tutorboy.com/content/uploads/2012/02/TwitterFollowersPlugin.jpg" alt="" width="50%" height="50%" />It is JavaScript Plugin to show Twitter followers count and profile pics just like Facebook Likebox.<span id="more-3222"></span></p>
<p>You can find the application <a href="http://apps.tutorboy.com/twitterfollowbox/">here</a><br />
If you want to use this in your web site, just copy the following code and paste anywhere on your web page.</p>
<p>I just created this for fun, the disadvantages are, It can&#8217;t Identify the Twitter logged in user, because of that follow icon always show in the same color. </p>
<p>I will add more feature when Twitter publish those apis. </p>
<h1>Code</h1>
<pre class="brush:html">&lt;div class=&quot;twitter-follow-box&quot;&gt;&lt;/div&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://apps.tutorboy.com/twitterfollowbox/twitterfollowscript.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
TwitterBox.Init({
username : &#039;midhundevasia&#039;,
width : 350,
height : 244,
header : true,
});
&lt;/script&gt;</pre>
<img src="http://feeds.feedburner.com/~r/TutorBoyArticles/~4/JmCwfsDgVhE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://articles.tutorboy.com/2012/02/23/twitter-followbox-plugin-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://articles.tutorboy.com/2012/02/23/twitter-followbox-plugin-in-javascript/</feedburner:origLink></item>
		<item>
		<title>Simple CSS Selector In JavaScript</title>
		<link>http://feedproxy.google.com/~r/TutorBoyArticles/~3/6wY9PdiAnDM/</link>
		<comments>http://articles.tutorboy.com/2012/02/16/simple-css-selector-in-javascript/#comments</comments>
		<pubDate>Thu, 16 Feb 2012 12:36:14 +0000</pubDate>
		<dc:creator>Midhun Devasia</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Selectors]]></category>

		<guid isPermaLink="false">http://articles.tutorboy.com/?p=3217</guid>
		<description><![CDATA[Sometime you don&#8217;t wish to use JavaScript frameworks on simple web applications, but you hardly need a cross-browser CSS selector. ...]]></description>
			<content:encoded><![CDATA[<p>Sometime you don&#8217;t wish to use JavaScript frameworks on simple web applications, but you hardly need a cross-browser CSS selector. The following snippet help you to retrieve simple <code>ID</code>, <code>CLASS</code> notation and html <code>Tags</code>. This is a very basic version and you can contribute to this. <span id="more-3217"></span></p>
<pre class="brush:js">
// IDs and CLASS
$('#my_id, .css_class, .className, #another_id');
// HTML Tags
$('body, h1');
</pre>
<h1>JavaScript</h1>
<pre class="brush:js">

function $(selectors) {
	var result = new Array();
	if(!document.getElementsByTagName) return result;
	// Removing unwanted spaces
	selectors = selectors.replace(/\s*([^\w])\s*/g,"$1");
	// Extracting the selectors from the param
	selectors = selectors.split(",");
	// Store all dom elements
	var elements = document.getElementsByTagName('*');
	// Parse the selectors list
	for(var i = 0; (selector = selectors[i]) != null ; i++) {
		// If ID
		if(selector.indexOf("#") == 0) {
			selector = selector.split("#");
			result[result.length] = document.getElementById(selector[1]);
		}
		// If CLASS
		else if(selector.indexOf(".") == 0) {
			selector = selector.split(".");
			// If the browser support HTML 5
			if(document.getElementsByClassName) {
				result[result.length] = document.getElementsByClassName(selector[1]);
			}
			// for browsers such as IE
			else {
				var hasClassName = new RegExp("(?:^|\\s)" + selector[1] + "(?:$|\\s)");
				var element;
				// Parse all DOM elements
				for(var j = 0; (element = elements[j]) != null; j++ ) {
					if(element.className &#038;&#038; element.className.match(hasClassName)) {
						result[result.length] = element;	

					}
				}
			}
		}
		// If tag
		else {
			result[result.length] = document.getElementsByTagName(selector);
		}
	}
	return result;
}
</pre>
<img src="http://feeds.feedburner.com/~r/TutorBoyArticles/~4/6wY9PdiAnDM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://articles.tutorboy.com/2012/02/16/simple-css-selector-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://articles.tutorboy.com/2012/02/16/simple-css-selector-in-javascript/</feedburner:origLink></item>
		<item>
		<title>PHP Regular Expression to Split Lines</title>
		<link>http://feedproxy.google.com/~r/TutorBoyArticles/~3/x3qla4N9EFs/</link>
		<comments>http://articles.tutorboy.com/2012/01/18/php-regular-expression-to-split-lines/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 06:58:28 +0000</pubDate>
		<dc:creator>Midhun Devasia</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Regular Expression]]></category>
		<category><![CDATA[Split]]></category>

		<guid isPermaLink="false">http://articles.tutorboy.com/?p=3210</guid>
		<description><![CDATA[Last day I had tried a lot of methods to retrieve lines from a text file. In some methods, I ...]]></description>
			<content:encoded><![CDATA[<p>Last day I had tried a lot of methods to retrieve lines from a text file. In some methods, I got blank lines without any reason and sometimes it returns all lines as one.<span id="more-3210"></span> In Windows the end of line is <code>'\r\n' </code>, in Mac its <code>\r</code> and Unix its <code>\n</code>. PHP <code>explode</code> function will fail here to split line by line, because if we use <code>\n</code>, sometime you won&#8217;t get the expected results, and same in the case of <code>\r\n</code>. </p>
<p>Finally I tried to trim all <code>\r</code> from the file content then use preg_split function to split by <code>\n</code>. This works fine for me.</p>
<h2>PHP Code</h2>
<pre class="brush:php">
$file_content = file_get_contents('readme.txt');
// Removing all carriage returns
$file_content = preg_replace("/\r/", "", $file_content);
// Split lines with new line
$lines = preg_split("/\n/", $file_content);
</pre>
<p>If you have any other better solution for this problem, please share with me.</p>
<img src="http://feeds.feedburner.com/~r/TutorBoyArticles/~4/x3qla4N9EFs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://articles.tutorboy.com/2012/01/18/php-regular-expression-to-split-lines/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://articles.tutorboy.com/2012/01/18/php-regular-expression-to-split-lines/</feedburner:origLink></item>
		<item>
		<title>Gmail style Scrollbar Using jQuery and CSS</title>
		<link>http://feedproxy.google.com/~r/TutorBoyArticles/~3/fGGH80Tja70/</link>
		<comments>http://articles.tutorboy.com/2011/11/14/gmail-style-scrollbar-using-jquery-and-css/#comments</comments>
		<pubDate>Mon, 14 Nov 2011 08:10:31 +0000</pubDate>
		<dc:creator>Midhun Devasia</dc:creator>
				<category><![CDATA[CSS3]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://articles.tutorboy.com/?p=3171</guid>
		<description><![CDATA[ Scrollbar looks like in new Gmail theme. The code written in jQuery and CSS. 
1. The Scrollbar shows only ...]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-thumbnail wp-image-3176" title="gmail_scrollbar" src="http://articles.tutorboy.com/content/uploads/2011/11/gmail_scrollbar-150x150.jpg" alt="" width="150" height="150" /> Scrollbar looks like in new Gmail theme. The code written in jQuery and CSS. <span id="more-3171"></span></p>
<p>1. The Scrollbar shows only when the content is greater thatn the view port(ie content height).</p>
<p>2. The scroll scrubber height will change when the height of the scroll length increase/decrease.</p>
<p>3. No Mouse Wheel scroll features.</p>
<p>See also: <a title="Facebook/Twitter style Scrollbar Using jQuery and CSS" href="http://articles.tutorboy.com/2011/11/10/facebook-twitter-style-scrollbar/" target="_blank">Facebook/Twitter style Scrollbar Using jQuery and CSS</a></p>
<p><a href="http://demo.tutorboy.com/articles/Gmail_style_Scrollbar_Using_jQuery_CSS.htm" target="_blank">View Demo</a></p>
<h1>Step 1:</h1>
<pre class="brush:html">&lt;div id="updateHolder"&gt;
    &lt;div id="updateContainer"&gt;
    &lt;div id="updateContent"&gt;
    &lt;!-- You can add all your contents here --&gt;
     Dummy Text <img src='http://articles.tutorboy.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />
    &lt;/div&gt;
    &lt;!--// don't remove this: the scrollbar and scrollscrubber place holder --&gt;
    &lt;div id="updateScollBar"&gt;
        &lt;div id="updateScollScrubber"&gt;
        &lt;/div&gt;
    &lt;/div&gt;
    &lt;!-- scrollbar end //--&gt;
    &lt;/div&gt;&lt;!-- end of updateContainer //--&gt;
&lt;/div&gt;&lt;!-- end of updateHolder //--&gt;</pre>
<h1>Step 2:</h1>
<p>Copy paste the CSS to your style sheet. For customization please edit the width and height in the specified lines.</p>
<pre class="brush:css">#updateHolder {
    width: 300px;  /* &lt;= For Width: change the width value */
    color: #333;
    margin-top: 10px;
    overflow: hidden;
    border:1px solid #CCCCCC;
}

#updateContainer {
    background-color: white;
    position: relative;
    cursor: pointer;

}

#updateContent {
    background: #fff;
    position: absolute;
    padding-right: 12px;
}

#updateScollBar {
    background: #F2F2F2;
    border-left: 1px solid #DADADA;
    position: absolute;
    width: 10px;
    right: 0;
    bottom: 0;
    cursor: default;
    zoom: 1;
    filter: alpha(opacity=25); /* For IE8 and earlier */
    opacity: 0.25;
}

#updateScollScrubber {
    background-color: 909090;
    width: 9px;
    height: 100px;
    position: absolute;
    border-left:1px solid #676767;
    border-top:1px solid #676767;

}

#updateScollBar, #updateContainer, #updateHolder {
    height: 500px; /* &lt;= For Height: change the height value */
}</pre>
<h1>Step 3:</h1>
<p>Add the following jQuery script to your header or footer section.</p>
<pre class="brush:js">$(function(){

	_offsetY = 0;
	_startY = 0;

	// To resize the height of the scroll scrubber when scroll height increases.
	setScrubberHeight();

	var contentDiv = document.getElementById('updateContainer');
	scrubber = $('#updateScollScrubber');
	scrollHeight = $('#updateScollBar').outerHeight();
	contentHeight = $('#updateContent').outerHeight();
	scrollFaceHeight = scrubber.outerHeight();

	initPosition = 0;
	initContentPos = $('#updateHolder').offset().top;
	// Calculate the movement ration with content height and scrollbar height
	moveVal = (contentHeight - scrollHeight)/(scrollHeight - scrollFaceHeight);

	$("#updateScollBar").mouseenter(function() {
		// Enable Scrollbar only when the content height is greater then the view port area.
		if(contentHeight &gt; scrollHeight) {
			// Show scrollbar on mouse over
			$(this).animate({opacity: 1});
			scrubber.bind("mousedown", onMouseDown);
		}

	}).mouseleave(function() {

		if(contentHeight &gt; scrollHeight) {
			// Hide Scrollbar on mouse out.
			$(this).animate({opacity: 0.25});
			$('#updateHolder').unbind("mousemove", onMouseMove);
			  scrubber.unbind("mousedown", onMouseDown);
		}
	});

	function onMouseDown(event) {
		$('#updateHolder').bind("mousemove", onMouseMove);
		$('#updateHolder').bind("mouseup", onMouseUp);
		_offsetY = scrubber.offset().top;
		_startY = event.pageY + initContentPos;
		// Disable the text selection inside the update area. Otherwise the text will be selected while dragging on the scrollbar.
		contentDiv.onselectstart = function () { return false; } // ie
		contentDiv.onmousedown = function () { return false; } // mozilla
	}

	function onMouseMove(event) {

		// Checking the upper and bottom limit of the scroll area
		if((scrubber.offset().top &gt;= initContentPos) &amp;&amp; (scrubber.offset().top &lt;= (initContentPos+scrollHeight - scrollFaceHeight))) {
			// Move the scrubber on mouse drag
			scrubber.css({top: (_offsetY + event.pageY - _startY)});
			// Move the content area according to the scrubber movement.
			$('#updateContent').css({top: ((initContentPos - scrubber.offset().top) * moveVal)});
		}else{
			// Reset when upper and lower limits are excced.
			if(scrubber.offset().top &lt;= initContentPos){
				scrubber.css({top: 0});
				$('#updateContent').css({top: 0});
			}

			if(scrubber.offset().top &gt; (initContentPos + scrollHeight - scrollFaceHeight)) {

				scrubber.css({top: (scrollHeight-scrollFaceHeight-2)});
				$('#updateContent').css({top: (scrollHeight - contentHeight + initPosition)});
			}

			$('#updateHolder').trigger('mouseup');
		}

	}

	function onMouseUp(event) {
		$('#updateHolder').unbind("mousemove", onMouseMove);
		contentDiv.onselectstart = function () { return true; } // ie
		contentDiv.onmousedown = function () { return true; } // mozilla
	}

	function setScrubberHeight() {
		cH = $('#updateContent').outerHeight();
		sH = $('#updateScollBar').outerHeight();

		if(cH &gt; sH) {
			// Set the min height of the scroll scrubber to 20
			if(sH / ( cH / sH ) &lt; 20) {
				$('#updateScollScrubber').css({height: 20 });
			}else{
				$('#updateScollScrubber').css({height: sH / ( cH / sH ) });
			}
		}
	}

});</pre>
<img src="http://feeds.feedburner.com/~r/TutorBoyArticles/~4/fGGH80Tja70" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://articles.tutorboy.com/2011/11/14/gmail-style-scrollbar-using-jquery-and-css/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		<feedburner:origLink>http://articles.tutorboy.com/2011/11/14/gmail-style-scrollbar-using-jquery-and-css/</feedburner:origLink></item>
		<item>
		<title>Facebook/Twitter style Scrollbar Using jQuery and CSS</title>
		<link>http://feedproxy.google.com/~r/TutorBoyArticles/~3/9VQD4y6ObA0/</link>
		<comments>http://articles.tutorboy.com/2011/11/10/facebook-twitter-style-scrollbar/#comments</comments>
		<pubDate>Thu, 10 Nov 2011 19:16:23 +0000</pubDate>
		<dc:creator>Midhun Devasia</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://articles.tutorboy.com/?p=3158</guid>
		<description><![CDATA[The Facebook and Twitter have their own scrollbars styles. Are you looking for the same thing?]]></description>
			<content:encoded><![CDATA[<p>The Facebook and Twitter have their own scrollbars styles. Are you looking for the same thing? Here is the code which is written in jQuery and CSS. <span id="more-3158"></span>Because of some limitation I&#8217;m unable to add Mouse Wheel function in this version. If you want to implement this script in you web application, copy paste the code and edit the width and height in <code>CSS</code> code of the content area. No need to change anything on the script. Default width is <code>300px</code> and height is <code>500px</code>.</p>
<p><a href="http://demo.tutorboy.com/articles/facebook-twitter-style-scrollbar.html"> View Demo </a><br />
<img class="alignright size-full wp-image-3160" title="Facebook_Twitter_Scrollbar" src="http://articles.tutorboy.com/content/uploads/2011/11/Facebook_Twitter_Scrollbar.jpg" alt="" width="580" height="200" /></p>
<blockquote><p>The scroll scrubber height will change when the height of the content increases, and the minimum height of the scrubber is <code>20px</code>. The scrollbar will show when the mouse moves over the content area.</p></blockquote>
<h1>Step 1:</h1>
<p>Just keep the structure of the HTML element as same as here. Put all your contents in the <code>DIV</code> called <code>&lt;div id="updateContent"&gt;</code></p>
<pre class="brush: html">&lt;!--// Update Holder --&gt;
	&lt;div id="updateHolder"&gt;
            &lt;div id="updateContainer"&gt;
			&lt;div id="updateContent"&gt;
			&lt;!-- //// You can add all your contents here ////--&gt;
			 &lt;/div&gt;
			&lt;!--// don't remove this: the scrollbar and scrollscrubber place holder --&gt;
			&lt;div id="updateScollBar"&gt;
				&lt;div id="updateScollScrubber"&gt;
				&lt;/div&gt;
			&lt;/div&gt;
			&lt;!-- scrollbar end //--&gt;
            &lt;/div&gt;&lt;!-- end of updateContainer //--&gt;
        &lt;/div&gt;&lt;!-- end of updateHolder //--&gt;</pre>
<h1>Step 2:</h1>
<p>Add the CSS to your style file, and edit the <code>Width</code> and <code>Height</code> in the specified area.</p>
<pre class="brush: css"> #updateHolder {
		background-color: green;
		width: 300px;  /* &lt;= For Width: change the width value */
		color: #333;
		margin-top: 10px;
		overflow: hidden;
	    }

	    #updateContainer {
		background-color: white;
		position: relative;
		cursor: pointer;
	    }

	    #updateContent {
		width: 100%;
		background: #F2F4F8;
		position: absolute;
	    }

	    #updateScollBar {
		background: none;
		position: absolute;
		width: 10px;
		right: 0;
		bottom: 0;
		cursor: default;
	    }

	    #updateScollScrubber {
		display: none;
		background-color: black;
		zoom: 1;
		filter: alpha(opacity=40); /* For IE8 and earlier */
		opacity: 0.4;
		width: 8px;
		height: 100px;
		-moz-border-radius: 7px; /* Firefox */
		-webkit-border-radius: 7px; /* Safari, Chrome */
		border-radius: 7px; /* CSS3 */
		position: absolute;
	    }

	    #updateScollBar, #updateContainer, #updateHolder {
		height: 500px; /* &lt;= For Height: change the height value */
	    }</pre>
<h1>Step: 3</h1>
<p>Add the following jQuery script any where on the html page.</p>
<pre class="brush: js">$(function(){

	_offsetY = 0;
	_startY = 0;

	// To resize the height of the scroll scrubber when scroll height increases.
	setScrubberHeight();

	var contentDiv = document.getElementById('updateContainer');
	scrubber = $('#updateScollScrubber');
	scrollHeight = $('#updateScollBar').outerHeight();
	contentHeight = $('#updateContent').outerHeight();
	scrollFaceHeight = scrubber.outerHeight();

	initPosition = 0;
	initContentPos = $('#updateHolder').offset().top;
	// Calculate the movement ration with content height and scrollbar height
	moveVal = (contentHeight - scrollHeight)/(scrollHeight - scrollFaceHeight);

	$("#updateContainer").mouseenter(function() {
		// Enable Scrollbar only when the content height is greater then the view port area.
		if(contentHeight &gt; scrollHeight) {
			// Show scrollbar on mouse over
			scrubber.fadeToggle("fast");
			scrubber.bind("mousedown", onMouseDown);
		}

	}).mouseleave(function() {

		if(contentHeight &gt; scrollHeight) {
			// Hide Scrollbar on mouse out.
			scrubber.fadeToggle("slow");
			$('#updateHolder').unbind("mousemove", onMouseMove);
			  scrubber.unbind("mousedown", onMouseDown);
		}
	});

	function onMouseDown(event) {
		$('#updateHolder').bind("mousemove", onMouseMove);
		$('#updateHolder').bind("mouseup", onMouseUp);
		_offsetY = scrubber.offset().top;
		_startY = event.pageY + initContentPos;
		// Disable the text selection inside the update area. Otherwise the text will be selected while dragging on the scrollbar.
		contentDiv.onselectstart = function () { return false; } // ie
		contentDiv.onmousedown = function () { return false; } // mozilla
	}

	function onMouseMove(event) {

		// Checking the upper and bottom limit of the scroll area
		if((scrubber.offset().top &gt;= initContentPos) &amp;&amp; (scrubber.offset().top  (initContentPos + scrollHeight - scrollFaceHeight)) {

				scrubber.css({top: (scrollHeight-scrollFaceHeight-1)});
				$('#updateContent').css({top: (scrollHeight - contentHeight + initPosition)});
			}

			$('#updateHolder').trigger('mouseup');
		}

	}

	function onMouseUp(event) {
		$('#updateHolder').unbind("mousemove", onMouseMove);
		contentDiv.onselectstart = function () { return true; } // ie
		contentDiv.onmousedown = function () { return true; } // mozilla
	}

	function setScrubberHeight() {
		cH = $('#updateContent').outerHeight();
		sH = $('#updateScollBar').outerHeight();

		if(cH &gt; sH) {
			// Set the min height of the scroll scrubber to 20
			if(sH / ( cH / sH ) &lt; 20) {
				$('#updateScollScrubber').css({height: 20 });
			}else{
				$('#updateScollScrubber').css({height: sH / ( cH / sH ) });
			}
		}
	}

});</pre>
<p><a href="http://demo.tutorboy.com/articles/facebook-twitter-style-scrollbar.html"> View Demo </a></p>
<img src="http://feeds.feedburner.com/~r/TutorBoyArticles/~4/9VQD4y6ObA0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://articles.tutorboy.com/2011/11/10/facebook-twitter-style-scrollbar/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://articles.tutorboy.com/2011/11/10/facebook-twitter-style-scrollbar/</feedburner:origLink></item>
		<item>
		<title>SEO Friendly Breadcrumb for WordPress</title>
		<link>http://feedproxy.google.com/~r/TutorBoyArticles/~3/GpVGxY-l-_A/</link>
		<comments>http://articles.tutorboy.com/2011/11/04/seo-friendly-breadcrumb-wordpress/#comments</comments>
		<pubDate>Fri, 04 Nov 2011 19:52:43 +0000</pubDate>
		<dc:creator>Midhun Devasia</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Breadcrumb]]></category>
		<category><![CDATA[SEO]]></category>

		<guid isPermaLink="false">http://articles.tutorboy.com/?p=3145</guid>
		<description><![CDATA[Last day I wrote about the SEO Friendly Breadcrumb Format, I have implemented those formats in my WordPress site. And ...]]></description>
			<content:encoded><![CDATA[<p>Last day I wrote about the <a title="SEO Friendly Breadcrumb Format" href="http://articles.tutorboy.com/2011/11/03/breadcrumb-format/" target="_blank">SEO Friendly Breadcrumb Format</a>, I have implemented those formats in my WordPress site. And here is the code which is written for WordPress.</p>
<h2>Add this PHP code at the end of functions.php file from the theme folder</h2>
<pre class="brush:php">&lt;?php

if ( ! function_exists( 'breadcrumbs' ) ) :
function breadcrumbs() {

	$delimiter = '&amp;rsaquo;';
	$home = 'Home';

	echo '&lt;div xmlns:v="http://rdf.data-vocabulary.org/#" class="breadcrumb"&gt;';

	global $post;
	echo '	&lt;span typeof="v:Breadcrumb"&gt;
 			&lt;a rel="v:url" property="v:title" href="'.get_bloginfo('url').'"&gt;'.$home.'&lt;/a&gt;
			&lt;/span&gt; '; 

	$cats = get_the_category();
	if ($cats) {
	  foreach($cats as $cat) {
	  	echo $delimiter . "&lt;span typeof=\"v:Breadcrumb\"&gt;
	    			&lt;a rel=\"v:url\" property=\"v:title\" href=\"".get_category_link($cat-&gt;term_id)."\" &gt;$cat-&gt;name&lt;/a&gt;
	    		&lt;/span&gt;";
	  }
	}

	$posttags = get_the_tags();
	if ($posttags) {
	  foreach($posttags as $tag) {
	  	echo $delimiter . "&lt;span typeof=\"v:Breadcrumb\"&gt;
	    			&lt;a rel=\"v:url\" property=\"v:title\" href=\"".get_tag_link($tag-&gt;term_id)."\" &gt;$tag-&gt;name&lt;/a&gt;
	    		&lt;/span&gt;";
	  }
	}

	echo '&lt;/div&gt;';

}
endif;

?&gt;</pre>
<p>The above code will generate the breadcrumb from the post categories and post tags values of the current post. The parent category will be show at the first then its child, and finally add if any tag presents.</p>
<h2>Add the following function call in your single.php file.</h2>
<pre class="brush:php">&lt;?php breadcrumbs(); ?&gt;</pre>
<p>Place this code above the <code>the_title()</code> function or below <code>the_content()</code> function calls.</p>
<h2>Add the following CSS in you Style.css</h2>
<pre class="brush:css">/* BreadCrumbs CSS*/
.breadcrumb {
	font-size: 11px;
}
.breadcrumb a {
	color: gray;
	text-decoration: none;
}
.breadcrumb a:hover {
	color: #178A00;
}</pre>
<p>So now your WordPress blog&#8217;s breadcrumb is Search Engine Optimized. You can see the results from your next post onward. Its so simple <img src='http://articles.tutorboy.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Also See : <a title="SEO Friendly Breadcrumb Format" href="http://articles.tutorboy.com/2011/11/03/breadcrumb-format/" target="_blank">SEO Friendly Breadcrumb Format</a></p>
<img src="http://feeds.feedburner.com/~r/TutorBoyArticles/~4/GpVGxY-l-_A" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://articles.tutorboy.com/2011/11/04/seo-friendly-breadcrumb-wordpress/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		<feedburner:origLink>http://articles.tutorboy.com/2011/11/04/seo-friendly-breadcrumb-wordpress/</feedburner:origLink></item>
	</channel>
</rss>

