<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-7142487369609798249</atom:id><lastBuildDate>Mon, 07 Oct 2024 03:27:15 +0000</lastBuildDate><category>Google</category><category>jquery</category><category>Javascript</category><category>Yahoo widgets Javascript</category><category>Yahoo widgets Javascript RSS</category><category>gadget</category><category>HTML</category><category>Radio</category><category>SlideShow</category><category>WordPress</category><category>YouTube api</category><category>authentication</category><category>blogger</category><category>problem</category><category>widget</category><title>World Of Widgets And Gadgets</title><description>Blog which will try to teach everybody how to create widgets using Yahoo Konfabulator, Google Gadgets, Wordpress Plugins, Blogger Plugins and Microsoft Gadgets.&#xa;My aim is to provide the best tutorials possible about these two subjects. They might be provided in form of links or reproduced on this site. If anybody wants to provide tutorials about javascript or widgets he/she is free to do so</description><link>http://widgetsgadgetsworld.blogspot.com/</link><managingEditor>noreply@blogger.com (Sudeep Mukherjee)</managingEditor><generator>Blogger</generator><openSearch:totalResults>10</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7142487369609798249.post-5402556728148999068</guid><pubDate>Mon, 22 Mar 2010 12:13:00 +0000</pubDate><atom:updated>2011-04-14T16:31:06.314+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Javascript</category><category domain="http://www.blogger.com/atom/ns#">jquery</category><category domain="http://www.blogger.com/atom/ns#">SlideShow</category><title>YouTube Video Feed Slide-Show Gadget With JQuery Part 2</title><description>This is the second part in my ongoing series of posts which will show you how to get You-Tube video feed and build a simple carousel or slide-show for yourself. If you have not read the first part, please make sure you do so &lt;a href=&quot;http://widgetsgadgetsworld.blogspot.com/2010/03/youtube-video-feed-slide-show-gadget.html&quot;&gt;here Part1&lt;/a&gt;.&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-large;&quot;&gt;Target For The Post&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
A Javascript class which uses jquery and the youtube class designed earlier to create a slide show or carousel in any document or website.&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-large;&quot;&gt;&lt;b&gt;Class To Design&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;&lt;b&gt;&lt;i&gt;tubeslider&lt;/i&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;i&gt;SlideTimer&lt;/i&gt;&lt;/b&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
tubeslider methods&lt;/div&gt;
&lt;div&gt;
&lt;ol&gt;
&lt;li&gt;&lt;b&gt;&lt;i&gt;initex(tube_data)&lt;/i&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;i&gt;start()&lt;/i&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;i&gt;stop()&lt;/i&gt;&lt;/b&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-large;&quot;&gt;tubeslider class variables&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&amp;nbsp;&amp;nbsp; 1.&amp;nbsp;this.timer_obj -----&amp;gt; stores the object of SlideTimer class&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;&amp;nbsp; 2. this.timer_interval -&amp;gt; stores the user-defined speed in milliseconds&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;&amp;nbsp; 3.&amp;nbsp;this.divid ----------&amp;gt; stores the original div given by the user where this slider will be created&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;&amp;nbsp; 4.&amp;nbsp;&amp;nbsp;this.slider ---------&amp;gt; stores the new div created by the program used to slide the images or videos&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;&amp;nbsp; 5.&amp;nbsp;&amp;nbsp;this.master --------&amp;gt; stores the string to identify the main div given by the user, for jQuery it has a # &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;infront of it&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-large;&quot;&gt;global variables&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&amp;nbsp;&amp;nbsp;1. var thumb_width -----&amp;gt; stores the thumb width&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;&amp;nbsp;2. var master_width -----&amp;gt; stores the mast_div width&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;&amp;nbsp;3. var thumb_height------&amp;gt; stores the thumb height&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-large;&quot;&gt;tubeslider constructor&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;&amp;nbsp; function(doc, divid, timer_interval)&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
parameter doc is for future use and is not used anywhere at present&lt;/div&gt;
&lt;div&gt;
divid is the id of the div where you want your slider or gadget to reside&lt;/div&gt;
&lt;div&gt;
timer_interval is the speed in which you want the slider to move&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
remove any previous instance of the SlideTimer class and attach the CSS stylesheet to the document.&lt;/div&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:javascript&quot;&gt; if (this.timer_obj != null &amp;amp;&amp;amp; this.timer_obj != undefined) {
        this.timer_obj.stop();
        delete this.timer_obj;
    }

    this.timer_obj = null;
    var slider_css = document.createElement(&#39;link&#39;);
    slider_css.rel = &#39;stylesheet&#39;
    slider_css.type = &#39;text/css&#39;;
    slider_css.href = &#39;youtubeslider.css&#39;;
    document.getElementsByTagName(&#39;head&#39;)[0].appendChild(slider_css);
&lt;/pre&gt;
&lt;/div&gt;
This function is the main function for this class, it receives the data in double dimension array called tube_data, then it initializes the thumb_width and height based on the data which is available and not the any random value, by default all the thumb size should be the same yet we search for the first legitimate thumb size and use it in our program.
&lt;br /&gt;
&lt;pre class=&quot;brush:javascript&quot;&gt;var j = 0;
        while (j &amp;lt; tube_data.length &amp;amp;&amp;amp; tube_data[j][&quot;thumb_url&quot;] == &#39;#&#39;) {
            j++;
        }
        if (j &amp;gt;= tube_data.length)
            return -1;
        var k = 0;
        for (var i_loop = 0; i_loop &amp;lt; tube_data.length; i_loop++) {
            if (tube_data[i_loop][&#39;thumb_url&#39;] != &#39;#&#39;)
                k++;
        }
        master_width = (parseInt(tube_data[j][&quot;thumb_width&quot;]) + 10) * (k);
        thumb_width = parseInt(tube_data[j][&quot;thumb_width&quot;]);
        thumb_height = parseInt(tube_data[j][&quot;thumb_height&quot;]);
&lt;/pre&gt;
Next we remove any previous divs inside the main div and create two divs one as the container for the slider and one for the player or the window where the video will be played when it is clicked. The div is also inside the main div thus it cannot be created outside the main div body.
Inside the player div there are two divs first one has a link when clicked it will close the window and the other one will house the player.
Then we create the slider div to house all the clickable thumbnails
&lt;br /&gt;
&lt;pre class=&quot;brush:javascript&quot;&gt;var temp2 = temp + &#39; &amp;gt; div&#39;;
        $(temp2).remove();
        $(temp).css(&#39;position&#39;, &#39;absolute&#39;);
        $(temp).append(&quot;&lt;div (parseint($(temp).css(&#39;height&#39;))=&quot;&quot; +=&quot;&quot; -=&quot;&quot; 50).tostring()=&quot;&quot; class=&quot;master&quot; id=&quot;&amp;quot; + this.divid + &amp;quot;master&amp;quot; +
        &amp;quot;&quot; px;height:&quot;=&quot;&quot; px;position:relative;overflow:hidden;&#39;=&quot;&quot; style=&quot;left: 24px; top: 24px; width: &amp;quot; + (parseInt($(temp).css(;&quot; width&#39;))=&quot;&quot;&gt;
&lt;/div&gt;
&quot;);

        $(temp).append(&quot;&lt;div (parseint($(temp).css(&#39;height&#39;))=&quot;&quot; (parseint($(temp).css(&#39;width&#39;))=&quot;&quot; +=&quot;&quot; -=&quot;&quot; 10).tostring()=&quot;&quot; 2).tostring()=&quot;&quot; 2)=&quot;&quot; class=&quot;playerwin&quot; id=&quot;&amp;quot; + this.divid + &amp;quot;_player&quot; px;height:&quot;=&quot;&quot; px;position:absolute;overflow:hidden;z-index:1;display:none;&#39;=&quot;&quot; px;width:&quot;=&quot;&quot; style=&quot;left: &amp;quot; + ((parseInt($(temp).css(; top: 1px;&quot; width&#39;))=&quot;&quot;&gt;
&lt;div id=&quot;&amp;quot; + this.divid +
        &amp;quot;_close&quot; style=&quot;height: 3%; text-align: right; width: 100%;&quot;&gt;
&quot; +
        &quot;&lt;a href=&quot;#&quot; style=&quot;height: 100%; text-align: right;&quot;&gt;Close Window&lt;/a&gt;&lt;/div&gt;
&quot; +
        &quot;&lt;div id=&quot;&amp;quot; + this.divid + &amp;quot;_ytapiplayer&quot; style=&quot;float: left; position: relative;&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
&quot;);
        var close_win = &#39;#&#39; + this.divid + &#39;_close&#39;;
        var temp_id2 = this.divid;
        $(close_win).click(function(event) {
            event.preventDefault();
            if (temp_id2.charAt(0) != &#39;#&#39;)
                temp_id2 = &#39;#&#39; + temp_id2 + &#39;_player&#39;;
            $(temp_id2).hide();

        });
        var master_id1 = &#39;#&#39; + this.divid + &#39;_player&#39;;
        var player_width1 = parseInt($(master_id1).css(&#39;width&#39;));
        var player_height1 = parseInt($(master_id1).css(&#39;height&#39;)) - 17;


        //div to show the text
        temp2 += &quot;:first&quot;;



        this.master = temp + &quot;master&quot;;

        this.slider = this.divid + &#39;_slider&#39;;
        $(this.master).addClass(&#39;master&#39;);
        $(this.master).append(&quot;&lt;div class=&quot;slider&quot; id=&quot;&amp;quot; + this.slider + &amp;quot;&quot; style=&quot;height: 100%; left: 0px; position: relative; width: &amp;quot; + master_width + &amp;quot;px;&quot;&gt;
&lt;/div&gt;
&quot;);

&lt;/pre&gt;
Next step is to create a image as link for the the videos which has been sent through tube_data, when we draw these images we must make sure that the url property has a valid url and not a # symbol, which signifies that the video has been blocked by the content provider.
&lt;br /&gt;
&lt;pre class=&quot;brush:javascript&quot;&gt; this.slider = &#39;#&#39; + this.slider;
        for (var i = 0; i &amp;lt; tube_data.length; i++) {
            if (tube_data[i][&quot;thumb_url&quot;] != &#39;#&#39;) {
                var div_tag = &quot;&lt;div id=&quot;&amp;quot; + this.divid + i.toString() +
            &amp;quot;&quot; style=&quot;float: left; height: &amp;quot; + parseInt(thumb_height) + &amp;quot;px; margin-left: 10px; overlow: hidden; position: relative; width: &amp;quot; + parseInt(thumb_width) + &amp;quot;px;&quot;&gt;
&quot;;
                var a_tag = &quot;&lt;a href=&quot;http://www.blogger.com/+%20tube_data[i][%22thumb_url%22]%20+&quot; style=&quot;text-decoration: none;&quot; target=&quot;_blank&quot;&gt;&quot;;
                var img_tag = &quot;&lt;img +=&quot;&quot; src=&quot;&amp;quot; + tube_data[i][&quot; style=&quot;height: &amp;quot; + thumb_height + &amp;quot;px; width: &amp;quot; + thumb_width + &amp;quot;px;&quot; thumb_img&#39;]=&quot;&quot; /&gt;&quot;;
                var ending_tags = &quot;&lt;/a&gt;&quot; + tube_data[i][&#39;thumb_title&#39;] + &quot;(vid &quot; + tube_data[i][&#39;vid&#39;] + &quot;)&quot; +
            &quot;&lt;/div&gt;&quot;;
                $(this.slider).append(div_tag + a_tag + img_tag + ending_tags);
            }

        }
&lt;/pre&gt;
After we have the slider ready to rumble the next thing is to create a timer object so that at a predefined interval the slider div is moved by a certain amount.
If mouse is hovered over the images it must stop the slide or the timer until the mouse moves out of the div. In this we use jquery $.hover() function which gives us the opportunity to declare two functions one is fired when mouse is moved over and the second is fired when the mouse is moved out. For ease of programming we have used anonymous functions.
&lt;br /&gt;
&lt;pre class=&quot;brush:javascript&quot;&gt;        var local_slider = this.slider;
        var local_master = this.master;
        var temp_del = this.slider + &quot; &amp;gt; div&quot;
        this.timer_obj = new SlideTimer(this.slider, this.master, this.timer_interval, this);
        var timer_obj_ref = this.timer_obj;

$(temp_del).hover(function() {
            timer_obj_ref.stop();
            var id_text = $(this).attr(&#39;id&#39;);
            if (id_text != undefined || id_text == &#39;&#39;) {
                var i = id_text.length - 1;

                var chr_txt = id_text.charAt(i);
                while (!isNaN(parseInt(chr_txt))) {
                    i--;
                    var chr_txt = id_text.charAt(i);
                }
                id_text = id_text.substr(0, (i + 1));
                var txt_div = &#39;#&#39; + id_text + &#39;_text&#39;;

                $(txt_div).css(&#39;display&#39;, &#39;block&#39;);
                $(txt_div).html(&quot;&lt;b&gt;&quot; + $(this).text() + &quot;&lt;/b&gt;&quot;);



            }

        },
        function() {
            timer_obj_ref.start();
            var id_text = $(this).attr(&#39;id&#39;);
            if (id_text != undefined || id_text == &#39;&#39;) {
                var i = id_text.length - 1;

                var chr_txt = id_text.charAt(i);
                while (!isNaN(parseInt(chr_txt))) {
                    i--;
                    var chr_txt = id_text.charAt(i);
                }
                id_text = id_text.substr(0, (i + 1));
                var txt_div = &#39;#&#39; + id_text + &#39;_text&#39;;
                $(txt_div).css(&#39;display&#39;, &#39;none&#39;);
            }

        });
&lt;/pre&gt;
&lt;br /&gt;
Lets say you want to watch some particular video, the logical thing will be to click on the image and it should play. To do so we must trap the click event and show the player div which we created earlier with the embedded player and the correct url.
&lt;br /&gt;
&lt;pre class=&quot;brush:javascript&quot;&gt;var master_id = this.divid;
        $(temp_del).click(function(event) {
            timer_obj_ref.stop();
            event.preventDefault();
            var vid_text = $(this).text();

            if (vid_text != undefined || vid_text == &#39;&#39;) {
                var i = vid_text.length - 1;
                var vid_mark1 = vid_text.indexOf(&#39;(vid&#39;);
                var vid_mark2 = -1;
                if (vid_mark1 != -1) {
                    vid_mark1 += 4;
                    vid_text = vid_text.substr(vid_mark1, ((vid_text.length - 1) - vid_mark1));
                }

                var playerid = &#39;#&#39; + master_id + &#39;_player&#39;;
                vid_text = vid_text.replace(/^\s+|\s+$/g, &quot;&quot;);

                var player_width = parseInt($(playerid).css(&#39;width&#39;));
                var player_height = parseInt($(playerid).css(&#39;height&#39;));

                var str_player = &#39;&amp;lt;object style=&quot;position:relative;display:block;top:15px;left:1px;height&#39; +
                (player_height - 17).toString() + &#39;px; width:&#39; + (player_width - 2).toString() + &#39;px&quot;&gt;&#39; +
                &#39;&amp;lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/&#39; + vid_text +
                &#39;?version=3&amp;iv_load_police=3&amp;autoplay=1&amp;color1=0xb1b1b1&amp;color2=0xcfcfcf&amp;feature=player_embedded&quot;&gt;&#39; +
                &#39;&amp;lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&#39; +
                &#39;&amp;lt;param name=&quot;allowScriptAccess&quot; value=&quot;always&quot;&gt;&#39; +
                &#39;&amp;lt;embed src=&quot;http://www.youtube.com/v/&#39; + vid_text +
                &#39;?version=3&amp;iv_load_police=3&amp;autoplay=1&amp;color1=0xb1b1b1&amp;color2=0xcfcfcf&amp;feature=player_embedded&quot; type=&quot;application/x-shockwave-flash&quot; allowfullscreen=&quot;true&quot; allowScriptAccess=&quot;always&quot; width=&quot;&#39; +
                 (player_width - 2).toString() + &#39;&quot; height=&quot;&#39; + (player_height - 17).toString() + &#39;&quot;&gt;&amp;lt;/object&gt;&#39;

                $(playerid).css(&#39;display&#39;, &#39;block&#39;);

                var player_div = &#39;#&#39; + master_id + &#39;_ytapiplayer&#39;;
                $(player_div).html(str_player);

            }
        });
&lt;/pre&gt;
&lt;br /&gt;
The next two functions are trivial, they just start or stops the slide action for the user, actually it starts or stops the timer through the timer object declared earlier.
&lt;br /&gt;
&lt;pre class=&quot;brush:javascript&quot;&gt;this.start = function() {
        if (this.timer_obj != null &amp;amp;&amp;amp; this.timer_obj != undefined)
            this.timer_obj.start();
    }
    this.stop = function() {
        if (this.timer_obj != null &amp;amp;&amp;amp; this.timer_obj != undefined)
            this.timer_obj.stop();
        delete (this.timer_obj);
        this.timer_obj = null;
    }
&lt;/pre&gt;
This is the complete code for our tubeslider class now comes the timer class which controls the timer object.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;

&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-large;&quot;&gt;&lt;b&gt;SlideTimer Variables&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&lt;b&gt;&lt;i&gt;1. this.slider = slider;&amp;nbsp;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&amp;nbsp;2. this.master = master;&amp;nbsp;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&amp;nbsp;3. this.obj = slide_obj;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&amp;nbsp;4. this.timer_interval = timer_interval;
    5. this.timerid = null;
&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-large;&quot;&gt;SlideTimer Methods&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;1. start()&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;2. stop()&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;3. slideImages()&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The first two methods are trivial they just initiate a setInterval function in the start method and clearInterval in the stop method. The only point to be noted is that setInterval creates an anonymous function which in turn calls the slideImages method.This is done in this way because a normal setInterval takes the function name only and does not allow you to prefix it with this to show a class method.&lt;br /&gt;
slideImages function uses the jQuery animate function to move the slider on the left by a fixed amount, if the whole slider has moved out of the screen i.e. it is no longer visible the start position is reintialized to the extreme left of the master div which we created in the earlier class as wrapper for the slider and player div.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:javascript&quot;&gt;



SlideTimer = function(slider, master, timer_interval, slide_obj) {

&amp;nbsp;&amp;nbsp; &amp;nbsp;this.slider = slider;

&amp;nbsp;&amp;nbsp; &amp;nbsp;this.master = master;

&amp;nbsp;&amp;nbsp; &amp;nbsp;this.obj = slide_obj;

&amp;nbsp;&amp;nbsp; &amp;nbsp;this.timer_interval = timer_interval;

&amp;nbsp;&amp;nbsp; &amp;nbsp;this.timerid = null;

&amp;nbsp;&amp;nbsp; &amp;nbsp;this.start = function() {

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; 

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;thisobject = this;

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.timerid = setInterval(function() { thisobject.slideImages(); }, this.timer_interval); //&quot;&#39; + slider + &#39;&quot;,&quot;&#39; + master + &#39;&quot;,&quot;&#39; + obj + &#39;&quot;)&#39;, 6000);



&amp;nbsp;&amp;nbsp; &amp;nbsp;}

&amp;nbsp;&amp;nbsp; &amp;nbsp;this.stop = function() {

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;clearInterval(this.timerid);

&amp;nbsp;&amp;nbsp; &amp;nbsp;}





&amp;nbsp;&amp;nbsp; &amp;nbsp;this.slideImages = function() {

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; 

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var left_attr = parseInt($(this.slider).css(&#39;left&#39;));

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var width_attr = parseInt($(this.master).css(&#39;width&#39;));

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var slider_width = parseInt($(this.slider).css(&#39;width&#39;));

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var animate_str = &#39;-=&#39; + thumb_width.toString();

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (left_attr &amp;gt; (1 - (slider_width - Math.ceil((thumb_width ))))) {

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;left_attr -= thumb_width;



&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;else {

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;left_attr = width_attr - (thumb_width * 2);

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$(this.slider).css(&#39;left&#39;, left_attr.toString() + &#39;px&#39;);

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}

&amp;nbsp;&amp;nbsp; &amp;nbsp; 

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$(this.slider).animate({ left: animate_str }, &#39;slow&#39;);

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; 



&amp;nbsp;&amp;nbsp; &amp;nbsp;}

}



&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
If you want to download the whole code please go to&amp;nbsp;&lt;a href=&quot;http://coolnerdblogger.com/mydownloads/YoutubeSlide/YouTubeSlide.php&quot;&gt;http://coolnerdblogger.com/mydownloads/YoutubeSlide/YouTubeSlide.php&lt;/a&gt;&lt;br /&gt;
If you want to test it out first then visit&lt;br /&gt;
&lt;a href=&quot;http://coolnerdblogger.com/mydownloads/YoutubeSlide/jQueryAndYouTube.html&quot;&gt;http://coolnerdblogger.com/mydownloads/YoutubeSlide/jQueryAndYouTube.html&lt;/a&gt;&lt;br /&gt;
For more updates subscribe to my feed and checkout the videos of these posts, the video for the first part is already online check it out.&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</description><link>http://widgetsgadgetsworld.blogspot.com/2010/03/youtube-video-feed-slide-show-gadget_22.html</link><author>noreply@blogger.com (Sudeep Mukherjee)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7142487369609798249.post-2257132063148552040</guid><pubDate>Thu, 18 Mar 2010 12:04:00 +0000</pubDate><atom:updated>2011-04-14T16:34:46.398+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Google</category><category domain="http://www.blogger.com/atom/ns#">Javascript</category><category domain="http://www.blogger.com/atom/ns#">jquery</category><category domain="http://www.blogger.com/atom/ns#">YouTube api</category><title>YouTube Video Feed Slide-Show Gadget With JQuery Part 1</title><description>This is the first part in what is going to be a two or three part tutorial dealing with using the YouTube Feed API to create a slide show of videos which you prefer, not some random images but based on the search criteria or playlist or uploaded videos by the user of your choice. &lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;font-size: medium;&quot;&gt;Target For This Post&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;Part 1:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
A java script class which can request a video feed from YouTube based on your selection criteria and then parse the feed returned to you. This will be done without any server-side script. The class can return an array which will have the following six attributes for each video.&lt;br /&gt;
&lt;br /&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;2&quot; cellspacing=&quot;0&quot; style=&quot;width: 571px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;       &lt;td valign=&quot;top&quot; width=&quot;250&quot;&gt;thumb_title&lt;/td&gt;        &lt;td valign=&quot;top&quot; width=&quot;419&quot;&gt;The title to be shown for the video&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td valign=&quot;top&quot; width=&quot;250&quot;&gt;thumb_img&lt;/td&gt;        &lt;td valign=&quot;top&quot; width=&quot;419&quot;&gt;The thumbnail which will represent the video&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td valign=&quot;top&quot; width=&quot;250&quot;&gt;thumb_height&lt;/td&gt;        &lt;td valign=&quot;top&quot; width=&quot;419&quot;&gt;The height of the thumbnail&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td valign=&quot;top&quot; width=&quot;250&quot;&gt;thumb_width&lt;/td&gt;        &lt;td valign=&quot;top&quot; width=&quot;419&quot;&gt;The width of the thumbnail&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td valign=&quot;top&quot; width=&quot;250&quot;&gt;thumb_url&lt;/td&gt;        &lt;td valign=&quot;top&quot; width=&quot;419&quot;&gt;The url of the video&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td valign=&quot;top&quot; width=&quot;250&quot;&gt;vid&lt;/td&gt;        &lt;td valign=&quot;top&quot; width=&quot;419&quot;&gt;Video Id used by youtube to identify a video uniquel&lt;b&gt;y&lt;/b&gt;&lt;/td&gt;     &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
This class will have the following major methods&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;getUploadedVideos (username, format) &lt;/li&gt;
&lt;li&gt;getSearchVideos(tag_txt, boolean_op, format) &lt;/li&gt;
&lt;li&gt;getPlayListVideos(username, playlist, format) &lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;startTubeSlideShow(player_div_id, seconds)&lt;/span&gt;&lt;/em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;stopTubeSlideShow()&lt;/span&gt;&lt;/em&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;strong&gt;&lt;span style=&quot;font-size: medium;&quot;&gt;Technology Used&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Google Data API’s &lt;/li&gt;
&lt;li&gt;jQuery &lt;/li&gt;
&lt;li&gt;Javascript &lt;/li&gt;
&lt;li&gt;HTML &lt;/li&gt;
&lt;/ol&gt;
Google Data API has been used to request video RSS feed from the google or you-tube sever. The format which I have used is json-in-script format. For more details about this format please click &lt;a href=&quot;http://code.google.com/apis/gdata/docs/json.html&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;. The Google Data API has a very rich and fulfilling&amp;nbsp; structure. It can be modified in any way you want. If you are using proxies and are interested in getting an XML RSS feed no problem just add alt=rss to your request url and you will get in pure RSS 2.0 format. To learn more about this API you can visit &lt;a href=&quot;http://code.google.com/apis/youtube/2.0/reference.html&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;div align=&quot;right&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;em&gt;courtesy Google&lt;/em&gt;&lt;/span&gt;&lt;/div&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;width: 605px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;       &lt;td valign=&quot;top&quot; width=&quot;105&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;Name&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;        &lt;td valign=&quot;top&quot; width=&quot;598&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;Definition&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td valign=&quot;top&quot; width=&quot;105&quot;&gt;&lt;a href=&quot;http://www.blogger.com/post-edit.g?blogID=7142487369609798249&amp;amp;postID=2257132063148552040&quot; name=&quot;altsp&quot;&gt;&lt;/a&gt;&lt;b&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;alt&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;        &lt;td valign=&quot;top&quot; width=&quot;698&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;The &lt;b&gt;alt&lt;/b&gt; parameter specifies the format of the feed to be returned. Valid values for this parameter are &lt;b&gt;atom&lt;/b&gt;, &lt;b&gt;rss&lt;/b&gt;, &lt;b&gt;json&lt;/b&gt;, &lt;b&gt;json-in-script&lt;/b&gt;, and &lt;b&gt;jsonc&lt;/b&gt;. The default value is &lt;b&gt;atom&lt;/b&gt; and this document only explains the format of Atom responses. For more information about using API responses in JavaScript, please see &lt;/span&gt;&lt;a href=&quot;http://code.google.com/apis/gdata/json.html&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;Using JSON with Google Data APIs&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;.              &lt;br /&gt;If you set the parameter value to &lt;b&gt;json-in-script&lt;/b&gt;, then you must also set the &lt;/span&gt;&lt;a href=&quot;http://code.google.com/apis/youtube/2.0/reference.html#callbacksp&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;callback&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt; parameter value to identify the callback function to which the API response will be sent.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td valign=&quot;top&quot; width=&quot;105&quot;&gt;&lt;a href=&quot;http://www.blogger.com/post-edit.g?blogID=7142487369609798249&amp;amp;postID=2257132063148552040&quot; name=&quot;authorsp&quot;&gt;&lt;/a&gt;&lt;b&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;author&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;        &lt;td valign=&quot;top&quot; width=&quot;698&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;In a search request, the &lt;b&gt;author&lt;/b&gt; parameter restricts the search to videos uploaded by a particular YouTube user. Note that if you use this parameter when requesting a standard feed, then YouTube will retrieve the standard feed and then filter the response to only include videos uploaded by the specified author. For example, if you request the &quot;Top Rated&quot; feed for user GoogleDevelopers, the API will retrieve the top-rated feed and return a response containing videos in that feed uploaded by user GoogleDevelopers. The API will not return a list of that user&#39;s videos ordered by rating.&amp;nbsp; &lt;br /&gt;In a request for a user activity feed, the &lt;b&gt;author&lt;/b&gt; parameter contains a comma-separated list of up to 20 YouTube usernames. The API response will contain activities performed by any of those users.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td valign=&quot;top&quot; width=&quot;105&quot;&gt;&lt;a href=&quot;http://www.blogger.com/post-edit.g?blogID=7142487369609798249&amp;amp;postID=2257132063148552040&quot; name=&quot;callbacksp&quot;&gt;&lt;/a&gt;&lt;b&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;callback&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;        &lt;td valign=&quot;top&quot; width=&quot;698&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;The &lt;b&gt;callback&lt;/b&gt; parameter identifies the callback function to which the API response will be sent. If the value of the &lt;/span&gt;&lt;a href=&quot;http://code.google.com/apis/youtube/2.0/reference.html#altsp&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;alt&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt; parameter is &lt;b&gt;jsonc&lt;/b&gt; or &lt;b&gt;json-in-script&lt;/b&gt;, and you specify a value for the &lt;b&gt;callback&lt;/b&gt; parameter, then the API response will be wrapped in a call to the specified function. This parameter is required if the value of the &lt;/span&gt;&lt;a href=&quot;http://code.google.com/apis/youtube/2.0/reference.html#altsp&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;alt&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt; parameter is &lt;b&gt;json-in-script&lt;/b&gt;.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td valign=&quot;top&quot; width=&quot;105&quot;&gt;&lt;a href=&quot;http://www.blogger.com/post-edit.g?blogID=7142487369609798249&amp;amp;postID=2257132063148552040&quot; name=&quot;max-resultssp&quot;&gt;&lt;/a&gt;&lt;b&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;max-results&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;        &lt;td valign=&quot;top&quot; width=&quot;698&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;The &lt;b&gt;max-results&lt;/b&gt; parameter specifies the maximum number of results that should be included in the result set. This parameter works in conjunction with the &lt;/span&gt;&lt;a href=&quot;http://code.google.com/apis/youtube/2.0/reference.html#start-indexsp&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;start-index&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt; parameter to determine which results to return. For example, to request the second set of 10 results – i.e. results 11-20 – set the &lt;b&gt;max-results&lt;/b&gt; parameter to &lt;b&gt;10&lt;/b&gt; and the &lt;/span&gt;&lt;a href=&quot;http://code.google.com/apis/youtube/2.0/reference.html#start-indexsp&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;start-index&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt; parameter to &lt;b&gt;11&lt;/b&gt;. The default value of this parameter is &lt;b&gt;25&lt;/b&gt;, and the maximum value is &lt;b&gt;50&lt;/b&gt;. However, for displaying lists of videos, we recommend that you set the &lt;b&gt;max-results&lt;/b&gt; parameter to &lt;b&gt;10&lt;/b&gt;.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td valign=&quot;top&quot; width=&quot;105&quot;&gt;&lt;a href=&quot;http://www.blogger.com/post-edit.g?blogID=7142487369609798249&amp;amp;postID=2257132063148552040&quot; name=&quot;prettyprintsp&quot;&gt;&lt;/a&gt;&lt;b&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;prettyprint&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;        &lt;td valign=&quot;top&quot; width=&quot;698&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;The &lt;b&gt;prettyprint&lt;/b&gt; parameter lets you request an XML response formatted with indentations and line breaks. Set the parameter&#39;s value to &lt;b&gt;true&lt;/b&gt; to have the response formatted as such. The default parameter value is &lt;b&gt;false&lt;/b&gt;.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td valign=&quot;top&quot; width=&quot;105&quot;&gt;&lt;a href=&quot;http://www.blogger.com/post-edit.g?blogID=7142487369609798249&amp;amp;postID=2257132063148552040&quot; name=&quot;start-indexsp&quot;&gt;&lt;/a&gt;&lt;b&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;start-index&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;        &lt;td valign=&quot;top&quot; width=&quot;698&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;The &lt;b&gt;start-index&lt;/b&gt; parameter specifies the index of the first matching result that should be included in the result set. This parameter uses a one-based index, meaning the first result is 1, the second result is 2 and so forth. This parameter works in conjunction with the &lt;/span&gt;&lt;a href=&quot;http://code.google.com/apis/youtube/2.0/reference.html#max-resultssp&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;max-results&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt; parameter to determine which results to return. For example, to request the second set of 10 results – i.e. results 11-20 – set the &lt;b&gt;start-index&lt;/b&gt; parameter to&lt;b&gt;11&lt;/b&gt; and the &lt;/span&gt;&lt;a href=&quot;http://code.google.com/apis/youtube/2.0/reference.html#max-resultssp&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;max-results&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt; parameter to &lt;b&gt;10&lt;/b&gt;.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td valign=&quot;top&quot; width=&quot;105&quot;&gt;&lt;a href=&quot;http://www.blogger.com/post-edit.g?blogID=7142487369609798249&amp;amp;postID=2257132063148552040&quot; name=&quot;strictsp&quot;&gt;&lt;/a&gt;&lt;b&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;strict&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;        &lt;td valign=&quot;top&quot; width=&quot;698&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;The &lt;b&gt;strict&lt;/b&gt; parameter can be used to instruct YouTube to reject an API request if the request contains invalid request parameters. The default API behavior is to ignore invalid request parameters. If you want YouTube to reject API requests that contain invalid parameters, set the &lt;b&gt;strict&lt;/b&gt;parameter value to &lt;b&gt;true&lt;/b&gt;. For example, YouTube would reject the following request because &quot;foo&quot; is not a valid request parameter.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;http://gdata.youtube.com/feeds/api/videos?foo=nonono&amp;amp;strict=true&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td valign=&quot;top&quot; width=&quot;105&quot;&gt;&lt;a href=&quot;http://www.blogger.com/post-edit.g?blogID=7142487369609798249&amp;amp;postID=2257132063148552040&quot; name=&quot;vsp&quot;&gt;&lt;/a&gt;&lt;b&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;v&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;        &lt;td valign=&quot;top&quot; width=&quot;698&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;The &lt;b&gt;v&lt;/b&gt; parameter specifies the version of the API that YouTube should use to handle the API request. Your request can specify the desired API version using either the &lt;b&gt;v&lt;/b&gt; parameter or the &lt;b&gt;GData-Version&lt;/b&gt; HTTP request header. All Google-provided client libraries always select a major API version. If your request does not specify an API version, YouTube will handle your request using API version 1. Please see the &lt;/span&gt;&lt;a href=&quot;http://code.google.com/apis/youtube/2.0/developers_guide_protocol.html#API_Versioning&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;API versioning&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;section for more information about specifying an API version.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
Say for instance you want to search for videos with a tag India the URL will be something like this&lt;br /&gt;
&lt;a href=&quot;http://gdata.youtube.com/feeds/videos?alt=json-in-script&amp;amp;callback=?&amp;amp;q=India&quot; title=&quot;http://gdata.youtube.com/feeds/videos?max-results=40&amp;amp;alt=json-in-script&amp;amp;callback=?&amp;amp;orderby=relevance&amp;amp;sortorder=descending&amp;amp;q=&quot;&gt;http://gdata.youtube.com/feeds/videos?alt=json-in-script&amp;amp;callback=?&amp;amp;q=India&lt;/a&gt;&lt;br /&gt;
In our case due to the use of jQuery which provides a call back for us we leave the callback value blank, but remember if you do not provide a question mark infront of the call back the computer will not make any request because of the strange way jQuery works.(I am not complaining).&lt;br /&gt;
jQuery has a method called &lt;a href=&quot;http://api.jquery.com/jQuery.getJSON/&quot; rel=&quot;tag&quot; target=&quot;_blank&quot;&gt;getJSON&lt;/a&gt;. This method is wonderful and my new favourite because if any feed returns JSON then you can use getJSON to make a cross domain XMLHTTPRequest without those proxies and server side code. Yes it does take advantage of a security hole in the browser. However I believe very soon such requests will become a common place occurrence if it is not already so.&lt;br /&gt;
Essentially I ask jquery to brig some result and then I parse it using javascript. Because getJSON can work Asynchronously therefore my whole website is not blocked and I can assign a call back function which is fired when the server returns the data. Again the beauty of javascript is I can use anonymous functions as a call back instead of separate functions.&lt;br /&gt;
&lt;h6&gt;







&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;






jQuery.getJSON( url, [ data ], [ callback(data, textStatus) ] )&lt;/span&gt;&lt;/h6&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;urlA string containing the URL to which the request is sent.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;dataA map or string that is sent to the server with the request.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;callback(data, textStatus)A callback function that is executed if the request succeeds.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
HTML has been used to create the front end and is inserted in the document as and when required by the various parts.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: medium;&quot;&gt;&lt;strong&gt;Short-coming&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
I have used few global variables to make my life easier, if you find any other method to overcome the problems please feel free to mail me.&lt;br /&gt;
The CSS is amateurish if not childish but the beauty of this code is you can change the CSS to suit your own fancies.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;span style=&quot;font-size: medium;&quot;&gt;&lt;strong&gt;simpleTube.js&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
This file has the code which connects with Google to request anything that you require&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;strong&gt;SimpleTube &lt;/strong&gt;this is the class which is has the functions dealing with playlist,search and uploaded videos.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;strong&gt;getUploadedVideos&lt;/strong&gt; Bring all the videos which are publicly available from a particular user&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre class=&quot;brush:javascript&quot;&gt;this.getUploadedVideos = function(username, format) { &amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var q = &quot;&lt;a href=&quot;http://gdata.youtube.com/feeds/api/users/%22&quot;&gt;http://gdata.youtube.com/feeds/api/users/&quot;&lt;/a&gt; + username + &quot;/uploads?alt=json-in-script&amp;amp;callback=?&quot; ;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (format == &#39;5&#39;) { 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; q += &quot;&amp;amp;format=5&quot;;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $.getJSON(q, function(json) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var htmlstr = &#39;&#39;; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tube_data = new Array(json.feed.entry.length);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $.each(json.feed.entry, function(i, pl_item) {
   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tube_data[i] = new Array(6);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (pl_item[&#39;app$control&#39;] != undefined &amp;amp;&amp;amp; pl_item[&#39;app$control&#39;][&#39;yt$state&#39;] != undefined) {
  
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var thumb = pl_item[&#39;app$control&#39;][&#39;yt$state&#39;][&#39;$t&#39;];
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var url = &#39;#&#39;;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;tube_data[i][&quot;thumb_url&quot;] = &#39;#&#39;;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;tube_data[i][&quot;vid&quot;] = pl_item[&#39;app$control&#39;][&#39;yt$state&#39;][&#39;$t&#39;];
  
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tube_data[i][&quot;thumb_title&quot;] = pl_item[&#39;title&#39;][&#39;$t&#39;];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tube_data[i][&quot;thumb_img&quot;] = pl_item[&#39;media$group&#39;][&#39;media$thumbnail&#39;][0][&#39;url&#39;];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tube_data[i][&quot;thumb_width&quot;] = pl_item[&#39;media$group&#39;][&#39;media$thumbnail&#39;][0][&#39;width&#39;];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tube_data[i][&quot;thumb_height&quot;] = pl_item[&#39;media$group&#39;][&#39;media$thumbnail&#39;][0][&#39;height&#39;];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;tube_data[i][&quot;thumb_url&quot;] = pl_item[&#39;media$group&#39;][&#39;media$player&#39;][0][&#39;url&#39;]
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var vid_1 = tube_data[i][&quot;thumb_url&quot;].search(&#39;v=&#39;);
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var vid_2 = tube_data[i][&quot;thumb_url&quot;].search(&#39;&amp;amp;feature&#39;);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var vid_len = vid_2 - (vid_1 + 2);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;tube_data[i][&quot;vid&quot;] = tube_data[i][&quot;thumb_url&quot;].substr(vid_1 + 2, vid_len);
  
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } 

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }); 


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });

  
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/pre&gt;
This function is the easiest one as it accepts a username and the format(I will explain it later). The username is the user whose video you want to watch. As long as there is no restriction placed by the uploader you can easily get all the videos. Once we get the videos we parse the JSON in a double dimension array. for the first part we will not do anything with this array in the next part I will show you how to use this array.
Format, if you place 5 as the format parameter then all the videos which cannot be embedded and are blocked or removed, are not included in the search, thus it brings only those videos which can be embedded.
&lt;br /&gt;
&lt;b&gt; $.getJSON(q, function(json) {&lt;/b&gt;&lt;br /&gt;
in this line I make a call to youtube for the videos and when the query returns with result the anonymous function gets called which has the result in the variable called json.
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;$.each(json.feed.entry, function(i, pl_item) {&lt;/b&gt;
&lt;br /&gt;
for each entry of the feed an anonymous function is called which has a counter i, incremented automatically and that particular entry in the variable called pl_item.
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;if (pl_item[&#39;app$control&#39;] != undefined &amp;amp;&amp;amp; pl_item[&#39;app$control&#39;][&#39;yt$state&#39;] != undefined) {&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
checks to make sure that the video thus available can be used and is not blocked or removed. If the video has a problem then the thumb_url property is given a value of  #. this will be used later to filter out the undesired content.
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;tube_data[i][&quot;vid&quot;] = pl_item[&#39;app$control&#39;][&#39;yt$state&#39;][&#39;$t&#39;];&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
this stores the reason if any for the video being not available.
If the video is usable then the five properties thumbnail width,height,and the src with video url and title are stored then we parse the url string for the VID or the video id used by youtube to uniquely identify a video and needed for loadind a video in a player.&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;getSearchVideos&lt;/b&gt; bring all the videos according to the tags and the boolean operator specified.
Three operators are possible and or and random. If you say rand or random then the number of tags and the tags are chosen randomly thus each time the video might be a bit different.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:javascript&quot;&gt;this.getSearchVideos = function(tag_txt, boolean_op, format) {
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var tag_arr = tag_txt.split(&#39;,&#39;);
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var q = &quot;http://gdata.youtube.com/feeds/videos?max-results=40&amp;amp;alt=json-in-script&amp;amp;callback=?&amp;amp;orderby=relevance&amp;amp;sortorder=descending&amp;amp;q=&quot;;

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var j = 0;

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var k = 0;

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var qstring = &#39;&#39;;
   &amp;nbsp; &amp;nbsp; &amp;nbsp;if (boolean_op == &#39;and&#39;) {

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;qstring = &quot;%22&quot; + tag_arr[0];

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;for (k = 1; k &amp;lt; tag_arr.length; k++) {

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;qstring += &quot;+&quot; + tag_arr[k];

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;qstring += &quot;%22&quot;;

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (boolean_op == &#39;or&#39;) {

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;qstring = tag_arr[0];

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;for (k = 1; k &amp;lt; tag_arr.length; k++) {

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;qstring += &quot;%7c&quot; + tag_arr[k];

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (boolean_op == &#39;rand&#39;) {
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var randomnumber = Math.floor(Math.random() * (tag_arr.length - 1)) + 1;
     &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;qstring = tag_arr[randomnumber];
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;for (k = 0; k &amp;lt;= randomnumber; k++) {
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;randomnumber = Math.floor(Math.random() * tag_arr.length);
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;qstring += &quot;%7c&quot; + tag_arr[randomnumber];

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}


&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;q = q + qstring;

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (format == &#39;5&#39;)

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;q += &quot;&amp;amp;format=5&quot;;
       &amp;nbsp;$.getJSON(q, function(data) {

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var htmlstr = &#39;&#39;;

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tube_data = new Array(data.feed.entry.length);

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$.each(data.feed.entry, function(i, feed_item) {

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tube_data[i] = new Array(6);

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (feed_item[&#39;app$control&#39;] != undefined &amp;amp;&amp;amp; feed_item[&#39;app$control&#39;][&#39;yt$state&#39;] != undefined) {

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var thumb = feed_item[&#39;app$control&#39;][&#39;yt$state&#39;][&#39;$t&#39;];

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var url = &#39;#&#39;;

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tube_data[i][&quot;thumb_url&quot;] = &#39;#&#39;;

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tube_data[i][&quot;vid&quot;] = feed_item[&#39;app$control&#39;][&#39;yt$state&#39;][&#39;$t&#39;];

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;else {

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tube_data[i][&quot;thumb_title&quot;] = feed_item[&#39;title&#39;][&#39;$t&#39;];
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tube_data[i][&quot;thumb_img&quot;] = feed_item[&#39;media$group&#39;][&#39;media$thumbnail&#39;][0][&#39;url&#39;];
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tube_data[i][&quot;thumb_width&quot;] = feed_item[&#39;media$group&#39;][&#39;media$thumbnail&#39;][0][&#39;width&#39;];
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tube_data[i][&quot;thumb_height&quot;] = feed_item[&#39;media$group&#39;][&#39;media$thumbnail&#39;][0][&#39;height&#39;];
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tube_data[i][&quot;thumb_url&quot;] = feed_item[&#39;media$group&#39;][&#39;media$player&#39;][0][&#39;url&#39;]
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var vid_1 = tube_data[i][&quot;thumb_url&quot;].search(&#39;v=&#39;);

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var vid_2 = tube_data[i][&quot;thumb_url&quot;].search(&#39;&amp;amp;feature&#39;);

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var vid_len = vid_2 - (vid_1 + 2);

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tube_data[i][&quot;vid&quot;] = tube_data[i][&quot;thumb_url&quot;].substr(vid_1 + 2, vid_len);

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;});
 &amp;nbsp; 
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;});

&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
This function is a bit more involved because it combines all the tags depending on the user choice. User can ask all the tags to be compulsory(and), any of the tags(or). The user might like a sub-set of new tags to be used from the original tag each time the program is executed.
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:javascript&quot; style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;var randomnumber = Math.floor(Math.random() * (tag_arr.length - 1)) + 1;
     &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;qstring = tag_arr[randomnumber];

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;for (k = 0; k &amp;lt;= randomnumber; k++) {
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;randomnumber = Math.floor(Math.random() * tag_arr.length);
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;qstring += &quot;%7c&quot; + tag_arr[randomnumber];

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
The Lines above just choose a random number which signifies the number of tags to be considered and then inside a loop each time a new random number is generated to signify the tag chosen.


&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;getPlayListVideos &lt;/b&gt;This function gets a playlist depending on the user-name and the playlist name. Unfortunately only those play list are available which have been marked public by the creator, if any play-list is marked as private it will not be available through this function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:javascript&quot;&gt;this.getPlayListVideos = function(username, playlist, format) {

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var q = &quot;http://gdata.youtube.com/feeds/api/users/&quot; + username + &quot;/playlists?alt=json-in-script&quot;;

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;q += &quot;&amp;amp;callback=?&quot;;

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$.getJSON(q, function(data) {





&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$.each(data.feed.entry, function(i, item) {

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var title = item[&#39;title&#39;][&#39;$t&#39;];

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (title.toLowerCase() == playlist.toLowerCase())

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;q = item[&#39;gd$feedLink&#39;][0][&#39;href&#39;];





&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;});

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (format == &#39;5&#39;)

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;q += &quot;?alt=json-in-script&amp;amp;callback=?&amp;amp;format=5&quot;;

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;else

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;q += &quot;?alt=json-in-script&amp;amp;callback=?&amp;amp;format=5&quot;;

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$.getJSON(q, function(json) {

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var htmlstr = &#39;&#39;;



&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tube_data = new Array(json.feed.entry.length);

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$.each(json.feed.entry, function(i, pl_item) {

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var title2 = pl_item[&#39;media$group&#39;][&#39;media$title&#39;][&#39;$t&#39;];



&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tube_data[i] = new Array(6)

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (pl_item[&#39;app$control&#39;] != undefined &amp;amp;&amp;amp; pl_item[&#39;app$control&#39;][&#39;yt$state&#39;] != undefined) {

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var thumb = pl_item[&#39;app$control&#39;][&#39;yt$state&#39;][&#39;$t&#39;];

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var url = &#39;#&#39;;

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tube_data[i][&quot;thumb_url&quot;] = &#39;#&#39;;

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tube_data[i][&quot;vid&quot;] = pl_item[&#39;app$control&#39;][&#39;yt$state&#39;][&#39;$t&#39;];

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}



&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;else {

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tube_data[i][&quot;thumb_title&quot;] = pl_item[&#39;title&#39;][&#39;$t&#39;];

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tube_data[i][&quot;thumb_img&quot;] = pl_item[&#39;media$group&#39;][&#39;media$thumbnail&#39;][0][&#39;url&#39;];

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tube_data[i][&quot;thumb_width&quot;] = pl_item[&#39;media$group&#39;][&#39;media$thumbnail&#39;][0][&#39;width&#39;];

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tube_data[i][&quot;thumb_height&quot;] = pl_item[&#39;media$group&#39;][&#39;media$thumbnail&#39;][0][&#39;height&#39;];

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tube_data[i][&quot;thumb_url&quot;] = pl_item[&#39;media$group&#39;][&#39;media$player&#39;][0][&#39;url&#39;]

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var vid_1 = tube_data[i][&quot;thumb_url&quot;].search(&#39;v=&#39;);

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var vid_2 = tube_data[i][&quot;thumb_url&quot;].search(&#39;&amp;amp;feature&#39;);

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var vid_len = vid_2 - (vid_1 + 2);

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tube_data[i][&quot;vid&quot;] = tube_data[i][&quot;thumb_url&quot;].substr(vid_1 + 2, vid_len);

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}





&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;});

&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;});

 &amp;nbsp; &amp;nbsp;});



&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
This function has two getJSON calls why because, the first call brings all the playlist of the user specified. Then the url for the playlist specified is parsed from the first feed result. After this we get the actual request URL for the playlist. this url is used to fire the second request.&lt;br /&gt;
The second request brings the videos and their data.&lt;br /&gt;
As mentioned earlier, I have not shown you how to use the parsed data because that is another post may be later in the week. I will put up a test page and a you tube video for the full code very soon. Please subscribe to my feed for further updates.

If you want to watch a real-life example please click &lt;a href=&#39;http://coolnerdblogger.com/mydownloads/YoutubeSlide/jQueryAndYouTube.html&#39; target=&#39;_blank&#39;&gt;here&lt;/a&gt; or visit http://coolnerdblogger.com/mydownloads/YoutubeSlide/jQueryAndYouTube.html
&lt;br/&gt;
&lt;object width=&quot;640&quot; height=&quot;385&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/cKqBO6dwffM&amp;hl=en_GB&amp;fs=1&amp;rel=0&amp;color1=0x3a3a3a&amp;color2=0x999999&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;/param&gt;&lt;embed src=&quot;http://www.youtube.com/v/cKqBO6dwffM&amp;hl=en_GB&amp;fs=1&amp;rel=0&amp;color1=0x3a3a3a&amp;color2=0x999999&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;640&quot; height=&quot;385&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br/&gt;&lt;br/&gt;
&lt;object width=&quot;640&quot; height=&quot;385&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/8j585ctHOP0&amp;hl=en_GB&amp;fs=1&amp;rel=0&amp;color1=0x3a3a3a&amp;color2=0x999999&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;/param&gt;&lt;embed src=&quot;http://www.youtube.com/v/8j585ctHOP0&amp;hl=en_GB&amp;fs=1&amp;rel=0&amp;color1=0x3a3a3a&amp;color2=0x999999&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;640&quot; height=&quot;385&quot;&gt;&lt;/embed&gt;&lt;/object&gt;</description><link>http://widgetsgadgetsworld.blogspot.com/2010/03/youtube-video-feed-slide-show-gadget.html</link><author>noreply@blogger.com (Sudeep Mukherjee)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7142487369609798249.post-5567575246488624868</guid><pubDate>Fri, 12 Mar 2010 19:34:00 +0000</pubDate><atom:updated>2010-03-13T01:04:58.950+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">authentication</category><category domain="http://www.blogger.com/atom/ns#">gadget</category><category domain="http://www.blogger.com/atom/ns#">Google</category><category domain="http://www.blogger.com/atom/ns#">problem</category><title>Google Authentication Problems</title><description>&lt;pre class=&quot;brush:javascript&quot;&gt;
&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;
    google.load(&quot;gdata&quot;, &quot;2.x&quot;);
    google.setOnLoadCallback(getMyBlogFeed);
    var feedUrl = &quot;http://feeds.feedburner.com/WorldOfWidgetsAndGadgets&quot;
    var myService;
    function setUpService() {
     var myService = new google.gdata.blogger.BloggerService(&#39;exampleC&#39;);
     logMeIn();
     return myService; 
    }
    function getMyBlogFeed() {

     myService = setUpService();
     myService.getBlogPostFeed(feedUrl, handleMyFeed, handleError);


 }
 function logMeIn() {
  scope = &quot;http://www.blogger.com/feeds&quot;;
  var token = google.accounts.user.login(scope);
 }

 function handleMyFeed(myResultsFeedRoot) {
  alert(&quot;This feed&#39;s title is: &quot; + myResultsFeedRoot.feed.getTitle().getText());
 }

 function handleError(e) {
  alert(&quot;There was an error!&quot;);
  alert(e.cause ? e.cause.statusText : e.message);
 }
&amp;lt;/script&amp;gt;
&lt;/pre&gt;
This little code which in general is a copy from the Google Sample Code is giving me nightmares. Somehow it refuses to authenticate my application even though I have a google account and a related blogger account. I could not find any reason for this malfunction as it keeps showing the same authentication page again and again. I have tried to run this code from my localhost as well as a web-server. To no avail. 
I will revisit this problem in a couple of days , until then I have a little mash up code to write dealing with you tube and jquery.</description><link>http://widgetsgadgetsworld.blogspot.com/2010/03/google-authentication-problems.html</link><author>noreply@blogger.com (Sudeep Mukherjee)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7142487369609798249.post-8277500498889857694</guid><pubDate>Sat, 06 Mar 2010 19:00:00 +0000</pubDate><atom:updated>2010-03-11T12:55:34.487+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">blogger</category><category domain="http://www.blogger.com/atom/ns#">gadget</category><category domain="http://www.blogger.com/atom/ns#">Google</category><category domain="http://www.blogger.com/atom/ns#">jquery</category><category domain="http://www.blogger.com/atom/ns#">widget</category><title>Using Flickr Feed To Create Blogger Gadget</title><description>Hi there folks I am back with something different this time around. As this blog deals with widgets and gadgets, one side of the story which I missed out was Blogger gadgets, as you all know who have worked on blogger sometime or the other, these gadgets as they call make your blog either more intresting or adds value to your site. Thus this topic got me intrested. In one of my previous blog, I dealt with getting javascript working on wordpress, the same can be done to some extent with blogger.Unfortunately I dont beleive it to be the best way out.&lt;br /&gt;
Gadgets are the proper way of organising your site interface and avoiding unecessary clutter.     &lt;br /&gt;
Blogger gadgets are nearly same as the google gadgets which you use on your igoogle page.     &lt;br /&gt;
First thing to understand is these gadgets are nothing more than XML files with HTML/javascript thrown into the mixture. Therefore if you are an experienced HTML developer or Javascript developer, you will fit right into it.     &lt;br /&gt;
As usual lets talk about some basic theory, google as well as blogger gadgets have this structure you must follow &lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Basic Theory&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;pre class=&quot;brush:xml&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&amp;gt;    
&amp;lt;Module&amp;gt;     
&amp;nbsp; &amp;lt;ModulePrefs title=&quot;hello world example&quot; /&amp;gt; 

&amp;lt;UserPref……/&amp;gt;    
&amp;nbsp; &amp;lt;Content type=&quot;html&quot;&amp;gt;     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;![CDATA[     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Hello, world!     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ]]&amp;gt;     
&amp;nbsp; &amp;lt;/Content&amp;gt;     
&amp;lt;/Module&amp;gt;&lt;/pre&gt;
&lt;br /&gt;
Lets try to figure out each element one by one&lt;br /&gt;
Module tag as we know is the root element of the XML file. Everything else is contained inside this element&lt;br /&gt;
ModulePrefs tag creates the meta-data for your gadget to be used by any site which is hosting this gadget either it is blogger or orkut or igoogle. These are the few customizations which google API provides for you&lt;br /&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;Following few lines are exact copy from &lt;/span&gt;&lt;a href=&quot;http://code.google.com/apis/gadgets/docs/reference.html&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;http://code.google.com/apis/gadgets/docs/reference.html&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;em&gt;Attribute Description&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;code&gt;title&lt;/code&gt;       &lt;br /&gt;Optional string that provides the title of the gadget. This title is displayed in the gadget title bar on iGoogle. If this string contains &lt;/em&gt;&lt;a href=&quot;http://code.google.com/basic.html#UP_MP&quot;&gt;&lt;em&gt;user preference substitution variables&lt;/em&gt;&lt;/a&gt;&lt;em&gt; and you are planning to submit your gadget to the iGoogle content directory, you should also provide a &lt;code&gt;directory_title&lt;/code&gt; for directory display.&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;code&gt;title_url&lt;/code&gt;       &lt;br /&gt;Optional string that provides a URL that the gadget title links to. For example, you could link the title to a webpage related to the gadget.&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;code&gt;description&lt;/code&gt;       &lt;br /&gt;Optional string that describes the gadget.&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;code&gt;author&lt;/code&gt;       &lt;br /&gt;Optional string that lists the author of the gadget.&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;code&gt;author_email&lt;/code&gt;       &lt;br /&gt;Optional string that provides the gadget author&#39;s email address. You can use any email system, but you should not use a personal email address because of spam. One approach is to use an email address of the form &lt;strong&gt;helensmith.feedback+coolgadget@gmail.com&lt;/strong&gt; in your gadget spec.       &lt;br /&gt;Gmail drops everything after the plus sign (+), so this email address is interpreted as &lt;strong&gt;helensmith.feedback@gmail.com&lt;/strong&gt;.       &lt;br /&gt;You can create a Gmail account &lt;/em&gt;&lt;a href=&quot;http://mail.google.com/mail/signup&quot;&gt;&lt;em&gt;here&lt;/em&gt;&lt;/a&gt;&lt;em&gt;.&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;code&gt;screenshot&lt;/code&gt;       &lt;br /&gt;Optional string that gives the URL of a gadget screenshot. This must be an image on a public web site that is not blocked by &lt;strong&gt;robots.txt&lt;/strong&gt;. PNG is the preferred format, though GIF and JPG are also acceptable. Gadget screenshots should be 280 pixels wide. The height of the screenshot should be the &quot;natural&quot; height of the gadget when it&#39;s in use.&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;code&gt;thumbnail&lt;/code&gt;       &lt;br /&gt;Optional string that gives the URL of a gadget thumbnail. This must be an image on a public web site that is not blocked by &lt;strong&gt;robots.txt&lt;/strong&gt;. PNG is the preferred format, though GIF and JPG are also acceptable. Gadget thumbnails should be 120x60 pixels.&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
Then comes UserPref tag, this tag is the customization element for your gadget, for example you may require some data for the gadget to work like username or password, this is the element which provides the user with the opportunity to enter data for the gadget. Have a look at the picture below, this is like form which is presented to you when you either install the gadget for the first time or when you edit it later on&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0PmXbToRvAlCbB15OnRojJ4zdSyQj2s_IuACe7YuJgUc2CA1KKNK95hnPds89PHTX17x_jsg4M_5swU1VQgSfEDqCGpN4SUnil-vwi6DueHd6bLKZ5yroWoBfXmDG4dBfrBBqhzWMQm_r/s1600-h/blog1%5B5%5D.jpg&quot;&gt;&lt;img alt=&quot;blog1&quot; border=&quot;0&quot; height=&quot;376&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqz6sUQA70glBDeBFb1LAApBqYKE2BAjPWz04htsK9ArL7KThTJ-3PW_djXbarGPQ99E5gSRFOXX-rhJSaiba8Q-kBwAhPqHhZCGFljnaPaOXHQWkxAMAa96HkaD6mXZGFHl2-Jme-Tk8W/?imgmax=800&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;blog1&quot; width=&quot;353&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
As mentioned all the userpref’s are provided by the author of the gadget, in my case it was pretty simple I provided the Tag to search and Refresh Rate, rest of the customization is provided by the gadget itself you don’t have to worry about it.&lt;br /&gt;
UserPref can have the following attributes&lt;br /&gt;
&lt;code&gt;name&lt;/code&gt;     &lt;br /&gt;
Required &quot;symbolic&quot; name of the user preference; displayed to the user during editing if no &lt;code&gt;display_name&lt;/code&gt; is defined. Must contain only letters, number and underscores, i.e. the regular expression ^[a-zA-Z0-9_]+$. Must be unique.&lt;br /&gt;
&lt;code&gt;display_name&lt;/code&gt;     &lt;br /&gt;
Optional string to display alongside the user preferences in the edit window. Must be unique.&lt;br /&gt;
&lt;code&gt;urlparam&lt;/code&gt;     &lt;br /&gt;
Optional string to pass as the parameter name for content &lt;code&gt;type=&quot;url&quot;&lt;/code&gt;.&lt;br /&gt;
&lt;code&gt;datatype&lt;/code&gt;     &lt;br /&gt;
Optional string that indicates the data type of this attribute. Can be &lt;code&gt;string&lt;/code&gt;, &lt;code&gt;bool&lt;/code&gt;, &lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;enum&lt;/span&gt;, &lt;code&gt;hidden&lt;/code&gt; (a string that is not visible or user editable), or &lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;list&lt;/span&gt;(dynamic array generated from user input). The default is &lt;code&gt;string&lt;/code&gt;.&lt;br /&gt;
&lt;code&gt;required&lt;/code&gt;     &lt;br /&gt;
Optional boolean argument (&lt;code&gt;true&lt;/code&gt; or &lt;code&gt;false&lt;/code&gt;) indicating whether this user preference is required. The default is &lt;code&gt;false&lt;/code&gt;.&lt;br /&gt;
&lt;code&gt;default_value&lt;/code&gt;     &lt;br /&gt;
Optional string that indicates a user preference&#39;s default value.&lt;br /&gt;
Moving forward the next element of interest is Content. It is the heart and soul of your gadget or in simple terms the basic body of this gadget is the content section.Content section may have URL type or HTML type. In this post we will discuss HTML type. Inside this tag you place your HTML or javascript. these must be contained in a CDATA section. You can link to external JS files too. &lt;br /&gt;
This is the basic hierarchy of a google/blogger gadget. Now we are ready to define the gadget we need to build.&lt;br /&gt;
&lt;h4&gt;


&lt;/h4&gt;
&lt;h4&gt;


Gadget Creation&lt;/h4&gt;
In this post I shall create a slide show gadget of random pictures from Flickr based on any tag that you provide. This gadget may be used from anywhere and can be downloaded from &lt;a href=&quot;http://coolnerdblogger.com/flickr_view.xml&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;
Firstly we must understand that Flickr provides us with an API to interact with itself, therefore we must make a request just like an XMLHTTPRequest shown in my previous post. Unfortunately this is not possible. Why because cross-domain XMLHTTPRequest is not allowed.The reason for this is a topic in itself and we shall not go into it here. Suffice to say that it creates more headaches rather than solutions. But don not despair help is on hand in the form of jquery. JQuery provides us with a handy function to make cross domain request thus we do not need to get stuck with some ugly server code.&lt;br /&gt;
$.getJSON is the function which we will call to get the feed in JSON format from Flickr. If you want to know more about jquery please send me a mail and I&amp;nbsp; will do a tutorial for that. At present my jquery function gets the photos and adds two divs for each photo, one has the pic and the other has the tile. All the divs except the first one are hidden and we will use jquery to show and hide them.&lt;br /&gt;
The user can give us the tag to search and the refresh rate that is the time between changing of two images.&lt;br /&gt;
&lt;pre class=&quot;brush:javascript&quot;&gt;function getimages(tags)    
{ 

&amp;nbsp;&amp;nbsp;&amp;nbsp; var query=&quot;&lt;a href=&quot;http://api.flickr.com/services/feeds/photos_public.gne?tags=%22&quot;&gt;http://api.flickr.com/services/feeds/photos_public.gne?tags=&quot;&lt;/a&gt; + tags + &quot;&amp;amp;tagmode=any&amp;amp;format=json&amp;amp;jsoncallback=?&quot;;     
var x=$.getJSON(query,function(data){     
&amp;nbsp;&amp;nbsp;&amp;nbsp; var htmlstr=&quot;&quot;;     
&amp;nbsp;&amp;nbsp;&amp;nbsp; var htmltxt=&quot;&quot;;     
&amp;nbsp;&amp;nbsp;&amp;nbsp; var div_img=$(&#39;#PlaceImages&#39;);     
&amp;nbsp;&amp;nbsp;&amp;nbsp; var div_txt=$(&#39;#PlaceText&#39;);     
&amp;nbsp;&amp;nbsp;&amp;nbsp; $.each(data.items,function(i,item)     
&amp;nbsp;&amp;nbsp;&amp;nbsp; {     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var sourceSquare = (item.media.m).replace(&quot;_m.jpg&quot;, &quot;_s.jpg&quot;);     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; htmlstr=&quot;&amp;lt;a target=&#39;_blank&#39; href=&#39;&quot; + item.link + &quot;&#39;&amp;gt;&amp;lt;img src=&#39;&quot; + item.media.m + &quot;&#39; width=&#39;100%&#39; height=&#39;90%&#39;/&amp;gt;&amp;lt;/a&amp;gt;&quot;;     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; htmltxt=&quot;&amp;lt;a target=&#39;_blank&#39; href=&#39;&quot; + item.link + &quot;&#39; &amp;gt;&quot; + item.title + &quot; &amp;lt;/a&amp;gt;&quot;;     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(i&amp;gt;0)     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; div_img.append(&quot;&amp;lt;div id=&#39;div&quot; + i.toString() + &quot;&#39; style=&#39;left:0px;top:0px;display:none;width:100%;height:99%;z-index:&quot;+i+&quot;&#39;&amp;gt;&quot; + htmlstr +&quot;&amp;lt;/div&amp;gt;&quot;);     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; div_txt.append(&quot;&amp;lt;div id=&#39;div_txt&quot; + i.toString() + &quot;&#39; style=&#39;left:0px;top:0px;display:none;width:100%;height:99%;z-index:&quot;+i+&quot;&#39;&amp;gt;&quot; + htmltxt +&quot;&amp;lt;/div&amp;gt;&quot;);     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; div_img.append(&quot;&amp;lt;div id=&#39;div&quot; + i.toString() + &quot;&#39; style=&#39;left:0px;top:0px;height:100%;width:99%&quot;+i+&quot;&#39;&amp;gt;&quot; + htmlstr +&quot;&amp;lt;/div&amp;gt;&quot;);     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; div_txt.append(&quot;&amp;lt;div id=&#39;div_txt&quot; + i.toString() + &quot;&#39; style=&#39;left:0px;top:0px;width:100%;height:99%;z-index:&quot;+i+&quot;&#39;&amp;gt;&quot; + htmltxt +&quot;&amp;lt;/div&amp;gt;&quot;);     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } 

&amp;nbsp;&amp;nbsp;&amp;nbsp; }    
&amp;nbsp;&amp;nbsp;&amp;nbsp; );

&amp;nbsp;&amp;nbsp;&amp;nbsp; });    
}&lt;/pre&gt;
&lt;br /&gt;
Looks complicated but it is not, everything is being done by jquery. In our original document we have two divs one is called PlaceImages and the other is called PlaceText. What I am doing is appending a new div for each image object. Therefore htmlstr creates a link with the image object and the script puts this link in the new div, each new div has a unique name which is created by “div” + the sequence number. This will be used later. Same is true for the PlaceText div where a new div with the photo title is added. &lt;br /&gt;
Most important part of all this is the divs so created are all hidden except the first one div0 and div_txt0. How do we unhide them that will be shown later. I hope I have made my point clear. After the this function finishes the control is returned to the original function shown below.&lt;br /&gt;
&lt;pre class=&quot;brush:javascript&quot;&gt;function getPics() {    
&amp;nbsp;&amp;nbsp;&amp;nbsp; var prefs = new _IG_Prefs();     
&amp;nbsp;&amp;nbsp;&amp;nbsp; var tags = prefs.getString(&quot;tags&quot;);     
&amp;nbsp;&amp;nbsp;&amp;nbsp; rate=parseInt(prefs.getString(&quot;rate&quot;));     
&amp;nbsp;&amp;nbsp;&amp;nbsp; var linkColor=document.getElementById(&quot;PlaceText&quot;);     
&amp;nbsp;&amp;nbsp;&amp;nbsp; linkColor.style.color=gadgets.skins.getProperty(&#39;CONTENT_LINK_COLOR&#39;);     
&amp;nbsp;&amp;nbsp;&amp;nbsp; document.body.style.borderColor = gadgets.skins.getProperty(&#39;CONTENT_BG_COLOR&#39;);     
&amp;nbsp;&amp;nbsp;&amp;nbsp; getimages(tags);     
&amp;nbsp;&amp;nbsp;&amp;nbsp; id=setInterval(&quot;changeImage()&quot;,32000);     
}&lt;/pre&gt;
&lt;br /&gt;
This is the function which is executed when the gadget is loaded. Thus the first line creates a new preference object which will get us all the user preference values.Next two lines get the tag and refresh rate from the user preference. Again I have tried to show you how the blogger widget can use the gadgets.skin class to get the different values for the theme being used and modify your gadget CSS accordingly. Finally we call our function getimages with the user given tag. After the function has been called a timer is set up which will fire every 32000 milli second.Each time the timer is fired the function changeImage will be called. &lt;br /&gt;
As mentioned above all the showing and hiding is done in this function, basically this function handles the slide show and disables or enables the timer.&lt;br /&gt;
&lt;pre class=&quot;brush:javascript&quot;&gt;function changeImage()    
&amp;nbsp;&amp;nbsp;&amp;nbsp; {     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var y=$(&#39;#PlaceImages&amp;gt;div:visible&#39;).attr(&#39;id&#39;);     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var txt=$(&#39;#PlaceText&amp;gt;div:visible&#39;).attr(&#39;id&#39;);     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //alert(y);     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(y!=undefined)     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; clearInterval(id);     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var temp1=y.charAt(y.length-1);     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var temp2=y.charAt(y.length-2);     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var num=0;     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(isNaN(temp2)!=true)     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; num=parseInt(temp2)*10 + parseInt(temp1);     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; num=parseInt(temp1);     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; num+=1;     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(num&amp;gt;=20)     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; num=0;     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; hidediv=&quot;#&quot; + y;     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; showdiv=&quot;#div&quot; + num.toString();     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; showdiv_txt=&quot;#div_txt&quot; + num.toString();     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; hidediv_txt=&quot;#&quot;+txt;     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $(showdiv).fadeIn(&#39;slow&#39;);     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $(showdiv_txt).fadeIn(&#39;fast&#39;);     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $(hidediv).fadeOut(&#39;slow&#39;);     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $(hidediv_txt).fadeOut(&#39;slow&#39;);     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(isNaN(rate)==true)     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rate=9500;     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; id=setInterval(&quot;changeImage()&quot;,rate);     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }     
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/pre&gt;
&lt;br /&gt;
I shall not go into the details of the code because it is quite clear what is going on.&amp;nbsp; Each time it selects the visible div and using the number at the end of the id shows the next div while the original is hidden. If div0 was visible to start with next time this function gets called div1 is visible and div0 is hidden. Thus creating a slide show. The whole code is shown below .If you want to see this widget working please visit &lt;a href=&quot;http://widgetsgadgetsworld.blogspot.com/&quot;&gt;http://widgetsgadgetsworld.blogspot.com/&lt;/a&gt;  &lt;br /&gt;
&lt;pre class=&quot;brush:xml&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;   
&amp;lt;Module&amp;gt;    
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;ModulePrefs    
&amp;nbsp;&amp;nbsp;&amp;nbsp; title=&quot;Flickr Photo&quot;    
&amp;nbsp;&amp;nbsp;&amp;nbsp; author=&quot;Someone&quot;    
&amp;nbsp;&amp;nbsp;&amp;nbsp; title_url=&quot;&lt;a href=&quot;http://best-news-site.com/%22&quot;&gt;http://best-news-site.com/&quot;&lt;/a&gt;    
&amp;nbsp;&amp;nbsp;&amp;nbsp; author_email=&quot;somewhere@lycos.com&quot;    
&amp;nbsp;&amp;nbsp;&amp;nbsp; description=&quot;Flickr image slide show&quot;&amp;gt;    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Require feature=&quot;opensocial-0.7&quot;/&amp;gt;    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Require feature=&quot;google.blog&quot;/&amp;gt;    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Require feature=&quot;skins&quot;/&amp;gt;    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Require feature=&quot;views&quot;/&amp;gt;    
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/ModulePrefs&amp;gt;    
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;UserPref display_name=&quot;Tag To Search&quot; name=&quot;tags&quot; datatype=&quot;string&quot; default_value=&quot;india&quot;    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&amp;lt;/UserPref&amp;gt;    
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;UserPref display_name=&quot;Refresh Rate(ms)&quot; name=&quot;rate&quot; datatype=&quot;string&quot; default_value=&quot;9500&quot;    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&amp;lt;/UserPref&amp;gt;    
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Content type=&quot;html&quot;&amp;gt;    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;![CDATA[    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;script type=&quot;text/javascript&quot; src=&quot;&lt;a href=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js%22&quot;&gt;http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js&quot;&lt;/a&gt;&amp;gt;&amp;lt;/script&amp;gt;    
&amp;lt;div id=&quot;PlaceImages&quot;&amp;nbsp; style=&quot;width:100%;height:90%; overflow:hidden;float:left;&quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;br /&amp;gt;    
&amp;lt;div id=&quot;PlaceText&quot; style=&quot;width:100%;height:8%; text-align:center;overflow:hidden; clear:both;&quot;&amp;gt;&amp;lt;/div&amp;gt;    
&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;    
var rate=9500;    
var id;    
function getimages(tags)    
{ 

&amp;nbsp;&amp;nbsp;&amp;nbsp; var query=&quot;&lt;a href=&quot;http://api.flickr.com/services/feeds/photos_public.gne?tags=%22&quot;&gt;http://api.flickr.com/services/feeds/photos_public.gne?tags=&quot;&lt;/a&gt; + tags + &quot;&amp;amp;tagmode=any&amp;amp;format=json&amp;amp;jsoncallback=?&quot;;    
var x=$.getJSON(query,function(data){    
&amp;nbsp;&amp;nbsp;&amp;nbsp; var htmlstr=&quot;&quot;;    
&amp;nbsp;&amp;nbsp;&amp;nbsp; var htmltxt=&quot;&quot;;    
&amp;nbsp;&amp;nbsp;&amp;nbsp; var div_img=$(&#39;#PlaceImages&#39;);    
&amp;nbsp;&amp;nbsp;&amp;nbsp; var div_txt=$(&#39;#PlaceText&#39;);    
&amp;nbsp;&amp;nbsp;&amp;nbsp; $.each(data.items,function(i,item)    
&amp;nbsp;&amp;nbsp;&amp;nbsp; {    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var sourceSquare = (item.media.m).replace(&quot;_m.jpg&quot;, &quot;_s.jpg&quot;);    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; htmlstr=&quot;&amp;lt;a target=&#39;_blank&#39; href=&#39;&quot; + item.link + &quot;&#39;&amp;gt;&amp;lt;img src=&#39;&quot; + item.media.m + &quot;&#39; width=&#39;100%&#39; height=&#39;90%&#39;/&amp;gt;&amp;lt;/a&amp;gt;&quot;;    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; htmltxt=&quot;&amp;lt;a target=&#39;_blank&#39; href=&#39;&quot; + item.link + &quot;&#39; &amp;gt;&quot; + item.title + &quot; &amp;lt;/a&amp;gt;&quot;;    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(i&amp;gt;0)    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; div_img.append(&quot;&amp;lt;div id=&#39;div&quot; + i.toString() + &quot;&#39; style=&#39;left:0px;top:0px;display:none;width:100%;height:99%;z-index:&quot;+i+&quot;&#39;&amp;gt;&quot; + htmlstr +&quot;&amp;lt;/div&amp;gt;&quot;);    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; div_txt.append(&quot;&amp;lt;div id=&#39;div_txt&quot; + i.toString() + &quot;&#39; style=&#39;left:0px;top:0px;display:none;width:100%;height:99%;z-index:&quot;+i+&quot;&#39;&amp;gt;&quot; + htmltxt +&quot;&amp;lt;/div&amp;gt;&quot;);    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; div_img.append(&quot;&amp;lt;div id=&#39;div&quot; + i.toString() + &quot;&#39; style=&#39;left:0px;top:0px;height:100%;width:99%&quot;+i+&quot;&#39;&amp;gt;&quot; + htmlstr +&quot;&amp;lt;/div&amp;gt;&quot;);    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; div_txt.append(&quot;&amp;lt;div id=&#39;div_txt&quot; + i.toString() + &quot;&#39; style=&#39;left:0px;top:0px;width:100%;height:99%;z-index:&quot;+i+&quot;&#39;&amp;gt;&quot; + htmltxt +&quot;&amp;lt;/div&amp;gt;&quot;);    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } 

&amp;nbsp;&amp;nbsp;&amp;nbsp; }   
&amp;nbsp;&amp;nbsp;&amp;nbsp; );

&amp;nbsp;&amp;nbsp;&amp;nbsp; });   
}    
 function getPics() {    
&amp;nbsp;&amp;nbsp;&amp;nbsp; var prefs = new _IG_Prefs();    
&amp;nbsp;&amp;nbsp;&amp;nbsp; var tags = prefs.getString(&quot;tags&quot;);    
&amp;nbsp;&amp;nbsp;&amp;nbsp; rate=parseInt(prefs.getString(&quot;rate&quot;));    
&amp;nbsp;&amp;nbsp;&amp;nbsp; var linkColor=document.getElementById(&quot;PlaceText&quot;);    
&amp;nbsp;&amp;nbsp;&amp;nbsp; linkColor.style.color=gadgets.skins.getProperty(&#39;CONTENT_LINK_COLOR&#39;);    
&amp;nbsp;&amp;nbsp;&amp;nbsp; document.body.style.borderColor = gadgets.skins.getProperty(&#39;CONTENT_BG_COLOR&#39;);    
&amp;nbsp;&amp;nbsp;&amp;nbsp; getimages(tags);    
&amp;nbsp;&amp;nbsp;&amp;nbsp; id=setInterval(&quot;changeImage()&quot;,32000);    
} 

function changeImage()   
&amp;nbsp;&amp;nbsp;&amp;nbsp; {    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var y=$(&#39;#PlaceImages&amp;gt;div:visible&#39;).attr(&#39;id&#39;);    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var txt=$(&#39;#PlaceText&amp;gt;div:visible&#39;).attr(&#39;id&#39;);    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //alert(y);    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(y!=undefined)    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; clearInterval(id);    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var temp1=y.charAt(y.length-1);    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var temp2=y.charAt(y.length-2);    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var num=0;    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(isNaN(temp2)!=true)    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; num=parseInt(temp2)*10 + parseInt(temp1);    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; num=parseInt(temp1);    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; num+=1;    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(num&amp;gt;=20)    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; num=0;    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; hidediv=&quot;#&quot; + y;    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; showdiv=&quot;#div&quot; + num.toString();    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; showdiv_txt=&quot;#div_txt&quot; + num.toString();    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; hidediv_txt=&quot;#&quot;+txt;    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $(showdiv).fadeIn(&#39;slow&#39;);     
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $(showdiv_txt).fadeIn(&#39;fast&#39;);    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $(hidediv).fadeOut(&#39;slow&#39;);    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $(hidediv_txt).fadeOut(&#39;slow&#39;);    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(isNaN(rate)==true)    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rate=9500;    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; id=setInterval(&quot;changeImage()&quot;,rate);    
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }    
&amp;nbsp;&amp;nbsp;&amp;nbsp; }    
 gadgets.util.registerOnLoadHandler(getPics); 

&amp;lt;/script&amp;gt; 

]]&amp;gt; 

&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Content&amp;gt;   
&amp;lt;/Module&amp;gt;&lt;/pre&gt;</description><link>http://widgetsgadgetsworld.blogspot.com/2010/03/using-flickr-feed-to-create-blogger.html</link><author>noreply@blogger.com (Sudeep Mukherjee)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqz6sUQA70glBDeBFb1LAApBqYKE2BAjPWz04htsK9ArL7KThTJ-3PW_djXbarGPQ99E5gSRFOXX-rhJSaiba8Q-kBwAhPqHhZCGFljnaPaOXHQWkxAMAa96HkaD6mXZGFHl2-Jme-Tk8W/s72-c?imgmax=800" height="72" width="72"/><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7142487369609798249.post-2180588445362089441</guid><pubDate>Tue, 02 Mar 2010 19:15:00 +0000</pubDate><atom:updated>2010-03-04T16:01:38.755+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Yahoo widgets Javascript RSS</category><title>How to create widgets Part4 Custom RSS Feed</title><description>Hi there everybody, it has been a few days since my last post, sorry for the delay. We had this big festival thus it was&amp;nbsp;impossible to concentrate, okay in my last post, I had shown you how to develop a little News Reader for your self.&lt;br /&gt;
Please refer to my earlier post &lt;a href=&quot;http://widgetsgadgetsworld.blogspot.com/2010/02/how-to-create-widgets-part3-rss-feed.html&quot;&gt;here&lt;/a&gt;.Let us take this concept a bit further as promised. The RSS feed was one of my favourite it may not be yours too thus&amp;nbsp;there must be a way to change it.&lt;br /&gt;
As you must have noticed Yahoo provides the widget preference option for you, just right click anywhere on the widget&amp;nbsp;body or click on the setting icon shown above your widget icon in the dock bar. Most widgets provide you with some&amp;nbsp;level of customization.&lt;br /&gt;
As mentioned above why dont we start with one simple preference of changing the the news feed according to the user&amp;nbsp;choice.&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-large;&quot;&gt;&lt;b&gt;Some Theory&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;A Widget can provide a number of preference objects to allow itself to save out settings. These settings &lt;/i&gt;&lt;br /&gt;
&lt;i&gt;are saved out in per-user preference storage. &lt;/i&gt;&lt;br /&gt;
&lt;i&gt;•   On the Mac, this is in  ~/Library/Preferences/Konfabulator . &lt;/i&gt;&lt;br /&gt;
&lt;i&gt;•   On the PC, this is in  HKEY_CURRENT_USER\Software\Yahoo\WidgetEngine .&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;You can define preferences in the XML:&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;lt;preference hidden=&quot;true&quot; name=&quot;windowLevel&quot; value=&quot;1&quot;&amp;gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;lt;preference hidden=&quot;true&quot; name=&quot;windowOpacity&quot; value=&quot;0.7&quot;&amp;gt; &lt;/i&gt;&lt;br /&gt;
&lt;i&gt;And get and set preference objects in JavaScript:&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;preferences.windowOpacity = &quot;0.9&quot;;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;print(preferences.windowOpacity);&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;If your Widget will be saving large amounts of data, consider using the SQLite embedded database &lt;/i&gt;&lt;br /&gt;
&lt;i&gt;available within the engine.&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;(reference Yahoo SDK Manual)&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-large;&quot;&gt;&lt;b&gt;Practical&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
Please open your kon file in an editor of your choice and lets insert few basic entries to customize the feed&lt;br /&gt;
&lt;pre class=&quot;brush:xml&quot;&gt;&amp;lt;preference name=&quot;NewsFeed&quot;&amp;gt;

  &amp;lt;type&amp;gt;popup&amp;lt;/type&amp;gt;
  &amp;lt;title&amp;gt;Add Feed &amp;lt;/title&amp;gt;
  &amp;lt;type&amp;gt;text&amp;lt;/type&amp;gt;
  &amp;lt;value&amp;gt;http://www.deccanherald.com/rss/69/news.html&amp;lt;/value&amp;gt;
 &amp;lt;/preference&amp;gt;
 &amp;lt;preference name=&quot;Title&quot;&amp;gt;
   &amp;lt;type&amp;gt;popup&amp;lt;/type&amp;gt;
   &amp;lt;title&amp;gt;Feed Title &amp;lt;/title&amp;gt;
   &amp;lt;type&amp;gt;text&amp;lt;/type&amp;gt;
 &amp;lt;/preference&amp;gt;

 &amp;lt;preference name=&quot;refresh&quot;&amp;gt;
  &amp;lt;type&amp;gt;popup&amp;lt;/type&amp;gt;
  &amp;lt;title&amp;gt;Refresh Interval &amp;lt;/title&amp;gt;
  &amp;lt;type&amp;gt;text&amp;lt;/type&amp;gt;
 &amp;lt;/preference&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
These are choices which user may change. Even though the preferences are quite easy yet..........&lt;br /&gt;
NewsFeed preference gives you a chance to get your own favourite feed displayed and not have a static page.&lt;br /&gt;
Title preference generated the window title based on the feed, it reads the title of the feed and displays it in your bar&amp;nbsp;refresh preferences gives you anoption to specify the seconds after which the window will fetch the feed again to refresh&amp;nbsp;the contents.&lt;br /&gt;
This entry should be kept outside your window element. As this is not the part of the main window.&lt;br /&gt;
When these preferences are changed there is an event which is generated called onPreferencesChanged. We will write an&amp;nbsp;event handler for this because user has made some changes which will effect the program&lt;br /&gt;
Where we had declared the onLoad trigger, just below it we will write&lt;br /&gt;
&lt;pre class=&quot;brush:xml&quot;&gt;&amp;lt;action trigger=&quot;onPreferencesChanged&quot;&amp;gt;
  readRSS();
 &amp;lt;/action&amp;gt;
&lt;/pre&gt;Presently our changes are simple enough to be handled in the same function later on when we have more complicated&amp;nbsp;preferences we might use a separate event handler&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-large;&quot;&gt;&lt;b&gt;Javascript Part&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Lets see how we can modify our javascript to read the user preference to load a new feed&lt;br /&gt;
The problem is that we have no way of knowing if the user has given any preferences or left the preference field blank. To&amp;nbsp;mitigate that problem please add the next few lines at the top of your readRSS() function&lt;br /&gt;
var news=preferences.NewsFeed.value;&lt;br /&gt;
&lt;pre class=&quot;brush:js&quot;&gt;if(news.length&amp;lt;8)
  news=&quot;http://timesofindia.indiatimes.com/rssfeeds/-2128936835.cms&quot;;
&lt;/pre&gt;Simply if the preference entry is not present we provide a hardcoded one(not the most elegant but lets keep it simple)&lt;br /&gt;
Use the same variable in your HTTP send operation&lt;br /&gt;
&lt;pre class=&quot;brush:js&quot;&gt;var timer=widget.getElementById(&quot;rss1timer&quot;);
 if(timer!=null)
 {
  timer.ticking=false;
  var timer_time=preferences.refresh.value;
  if(timer_time==&quot;&quot;)
   timer.interval=500;
  else
   timer.interval=timer_time;
  
 }
 preferences.refresh.value=timer.interval;
&lt;/pre&gt;as mentioned earlier in my previous article when timer event fires it calls the main readRSS() function where we check if&amp;nbsp;there is a preferred value for interval ,if not we provide the timer with one&lt;br /&gt;
&lt;pre class=&quot;brush:js&quot;&gt;var win_title=widget.getElementById(&quot;winTitle&quot;);
&lt;/pre&gt;This statement will get the title bar text object and initialize with a user given title if available in preferences or get the title&amp;nbsp;from the RSS feed and stores it as the preference called Title(as defined in the Kon file)&lt;br /&gt;
&lt;pre class=&quot;brush:js&quot;&gt;win_title.data=preferences.Title.value;
  if(win_title.data==&quot;&quot;)
  {
   var temp_titles=xmldoc.evaluate(&quot;rss/channel/title&quot;);
   win_title.data=temp_titles.item(0).firstChild.data;  
  }
    
  preferences.Title.value=win_title.data;
&lt;/pre&gt;I have tried to explain the code in piece meal form lets see the whole XML in the kon file&lt;br /&gt;
&lt;pre class=&quot;brush:xml&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;
&amp;lt;widget minimumversion=&quot;4.5&quot;&amp;gt;
&amp;lt;script charset=&quot;utf-8&quot; src=&quot;RssRead.js&quot;&amp;gt;
&amp;lt;/script&amp;gt;
&amp;lt;window id=&quot;mainWin&quot;&amp;gt;
 &amp;lt;name&amp;gt; RSS1&amp;lt;/name&amp;gt;
 &amp;lt;title&amp;gt; My Rss Widget&amp;lt;/title&amp;gt;
 &amp;lt;width&amp;gt;400&amp;lt;/width&amp;gt;
 &amp;lt;height&amp;gt;310&amp;lt;/height&amp;gt;
 &amp;lt;visible&amp;gt;true&amp;lt;/visible&amp;gt;

  &amp;lt;img &amp;gt;

    &amp;lt;src&amp;gt;Resources/widget.png&amp;lt;/src&amp;gt;
  &amp;lt;/img &amp;gt;
  &amp;lt;img &amp;gt;
    &amp;lt;src&amp;gt;Resources/wintitle.png&amp;lt;/src&amp;gt;
    &amp;lt;voffset&amp;gt;-1&amp;lt;/voffset&amp;gt;
 &amp;lt;/img &amp;gt;

  &amp;lt;text id=&quot;winTitle&quot; style=&quot;font-size: 24px;&quot;&amp;gt;
    &amp;lt;hoffset&amp;gt;15&amp;lt;/hoffset&amp;gt;
    &amp;lt;voffset&amp;gt;15&amp;lt;/voffset&amp;gt;
    &amp;lt;size&amp;gt;16&amp;lt;/size&amp;gt;
    &amp;lt;color&amp;gt;#f0fff9&amp;lt;/color&amp;gt;
  &amp;lt;/text&amp;gt;

  &amp;lt;web id=&quot;rss1&quot;&amp;gt;

    &amp;lt;font&amp;gt;Times New Roman&amp;lt;/font&amp;gt;
    &amp;lt;size&amp;gt;14&amp;lt;/size&amp;gt;
    &amp;lt;voffset&amp;gt;28&amp;lt;/voffset&amp;gt;
    &amp;lt;hoffset&amp;gt;18&amp;lt;/hoffset&amp;gt;
    &amp;lt;width&amp;gt;380&amp;lt;/width&amp;gt;
    &amp;lt;height&amp;gt;270&amp;lt;/height&amp;gt;
    &amp;lt;bgcolor&amp;gt;#ffaa55&amp;lt;/bgcolor&amp;gt;
&amp;lt;/web&amp;gt;
&amp;lt;/window&amp;gt;

  &amp;lt;timer id=&quot;rss1timer&quot; name=&quot;rss1timer1&quot;&amp;gt;
    &amp;lt;ticking&amp;gt;false&amp;lt;/ticking&amp;gt;
    &amp;lt;ontimerfired&amp;gt;readRSS();&amp;lt;/ontimerfired&amp;gt;
    &amp;lt;interval&amp;gt;20&amp;lt;/interval&amp;gt;
  &amp;lt;/timer&amp;gt;

  &amp;lt;preferencegroup name=&quot;RSS&quot; title=&quot;RSS&quot;&amp;gt;

     &amp;lt;type&amp;gt;popup&amp;lt;/type&amp;gt;
  &amp;lt;title&amp;gt;Add Feed &amp;lt;/title&amp;gt;
  &amp;lt;type&amp;gt;text&amp;lt;/type&amp;gt;
  &amp;lt;value&amp;gt;http://www.deccanherald.com/rss/69/news.html&amp;lt;/value&amp;gt;
 &amp;lt;/preference&amp;gt;
 &amp;lt;preference name=&quot;Title&quot;&amp;gt;
   &amp;lt;type&amp;gt;popup&amp;lt;/type&amp;gt;
   &amp;lt;title&amp;gt;Feed Title &amp;lt;/title&amp;gt;
   &amp;lt;type&amp;gt;text&amp;lt;/type&amp;gt;
 &amp;lt;/preference&amp;gt;

 &amp;lt;preference name=&quot;refresh&quot;&amp;gt;
  &amp;lt;type&amp;gt;popup&amp;lt;/type&amp;gt;
  &amp;lt;title&amp;gt;Refresh Interval &amp;lt;/title&amp;gt;
  &amp;lt;type&amp;gt;text&amp;lt;/type&amp;gt;
 &amp;lt;/preference&amp;gt;
&amp;lt;/preferencegroup&amp;gt;

  &amp;lt;action trigger=&quot;onLoad&quot;&amp;gt;

     readRSS();

  &amp;lt;/action&amp;gt;

  &amp;lt;action trigger=&quot;onPreferencesChanged&quot;&amp;gt;

       readRSS();

  &amp;lt;/action&amp;gt;

&amp;lt;/widget&amp;gt;
&lt;/pre&gt;Now lets have a quick peak in our js file &lt;br /&gt;
&lt;pre class=&quot;brush:js&quot;&gt;function GetXmlHttpObject()
{

  return new XMLHttpRequest();
}

function readRSS()
{
 var news=preferences.NewsFeed.value;
 if(news.length&amp;lt;8)
    news=&quot;http://timesofindia.indiatimes.com/rssfeeds/-2128936835.cms&quot;;
 var timer=widget.getElementById(&quot;rss1timer&quot;);
 var win_title=widget.getElementById(&quot;winTitle&quot;);
 if(timer!=null)
{
  timer.ticking=false;
  var timer_time=preferences.refresh.value;
  if(timer_time==&quot;&quot;)
    timer.interval=500;
  else
    timer.interval=timer_time;
}
 xmlhttp=GetXmlHttpObject();
 if (xmlhttp==null)
 {
   alert (&quot;Something has gone wrong&quot;);
   return;
 }

 xmlhttp.onreadystatechange=function()
 {
   if (xmlhttp.readyState==4)
   {
     xmldoc=xmlhttp.responseXML;
     if (xmlhttp.status==200 &amp;amp;&amp;amp; xmldoc!=null)
     {
        win_title.data=preferences.Title.value;
        if(win_title.data==&quot;&quot;)
        {
           var temp_titles=xmldoc.evaluate(&quot;rss/channel/title&quot;);
           win_title.data=temp_titles.item(0).firstChild.data;
        }
        preferences.Title.value=win_title.data;
        var titles=xmldoc.evaluate(&quot;rss/channel/item/title&quot;);
        var links=xmldoc.evaluate(&quot;rss/channel/item/link&quot;);
        var strAnswer=&quot;&quot;
        for(var i = 0; i &amp;lt; titles.length; i++)
        {
          strAnswer=strAnswer + &quot;&amp;lt;a href=&#39;&quot; + links.item(i).firstChild.data + 
          &quot;&#39; target=&#39;_self&#39; style=&#39;color:white; textDecoration:none&#39;&amp;gt;&quot;+(i+1)+ &quot; : &quot;   +titles.item(i).firstChild.data + &quot;&amp;lt;/a&amp;gt;&amp;lt;br/&amp;gt;&quot;;
        }
       var result=widget.getElementById(&quot;rss1&quot;);
       result.html=strAnswer;
       timer.ticking=true;
     }
     else
     {
       result.html=&quot;An error has occurred&quot;;
       timer.ticking=true;
     }
   }
 }

 xmlhttp.open(&quot;GET&quot;, preferences.NewsFeed.value, true)
 xmlhttp.send(null)
}

&lt;/pre&gt;&lt;br /&gt;
Please do not forget to subscribe to my feed for the latest and visit me on youtube for further video tutorials&lt;br /&gt;
&lt;object width=&quot;640&quot; height=&quot;385&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube-nocookie.com/v/1x0icmhKJpY&amp;hl=en_GB&amp;fs=1&amp;rel=0&amp;color1=0x3a3a3a&amp;color2=0x999999&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;/param&gt;&lt;embed src=&quot;http://www.youtube-nocookie.com/v/1x0icmhKJpY&amp;hl=en_GB&amp;fs=1&amp;rel=0&amp;color1=0x3a3a3a&amp;color2=0x999999&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;640&quot; height=&quot;385&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;
In the next post we will look into using some kind of animation to let the user know while he/she waits and we will look into sqllite with widgets, before that I may delve into sidebars, I have been thinking of doing so for quite some time .</description><link>http://widgetsgadgetsworld.blogspot.com/2010/03/how-to-create-widgets-part4-custom-rss.html</link><author>noreply@blogger.com (Sudeep Mukherjee)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7142487369609798249.post-4729274282035539869</guid><pubDate>Sat, 27 Feb 2010 06:40:00 +0000</pubDate><atom:updated>2010-02-27T12:12:18.370+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">HTML</category><category domain="http://www.blogger.com/atom/ns#">Radio</category><category domain="http://www.blogger.com/atom/ns#">WordPress</category><category domain="http://www.blogger.com/atom/ns#">Yahoo widgets Javascript</category><title>WordPress And Javascript</title><description>This is going to be a short post and a bit off-topic yet I found it a quite interesting.&lt;br /&gt;
I have another blog using WordPress and I wanted to incorporate a page from my earlier web-site which gave user&#39;s the opportunity to listen to music online. The page is quite simple, it has a bunch of radio buttons with different radio station links and all you got to do is click on one of them and the javascript will take care of the rest. &lt;br /&gt;
Nifty isn&#39;t it, therefore I created a wordpress page and copied my HTML.Javascript onto that page. Easy..... unfortunately when I previewed the page it did not work, the page and the options showed all right yet the javascript refused to work. When I went back to check the code of my page, lo behold there were&lt;p&gt;tags all round my javascript lines and no way out.&lt;br /&gt;
A little research later realized that I have to put the javascript in a separate file and then link it with the page&lt;br /&gt;
Here is the example (assume my script is called radioScript.js)&lt;br /&gt;
&amp;lt;script type=&quot;text/javascript&quot; src=&quot;/radioScript.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
That&#39;s it and now you can call any function written in the file. I have created the page and is online if you care to have a look at it please &lt;a href=&quot;http://best-news-site.com/radio-2&quot;&gt;click here&lt;/a&gt; or go to http://best-news-site.com/radio-2&lt;br /&gt;
Very soon I will post again showing you how to create a simple widget for WordPress&lt;br /&gt;
See you, don&#39;t forget to subscribe to my feed for the latest updates</description><enclosure type='' url='http://best-news-site.com/radio-2' length='0'/><link>http://widgetsgadgetsworld.blogspot.com/2010/02/wordpress-and-javascript.html</link><author>noreply@blogger.com (Sudeep Mukherjee)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7142487369609798249.post-8082009933435300724</guid><pubDate>Fri, 26 Feb 2010 08:48:00 +0000</pubDate><atom:updated>2010-03-02T14:07:18.188+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Yahoo widgets Javascript RSS</category><title>How To Create Widgets Part3 RSS Feed</title><description>&lt;iframe height=&quot;200&quot; noborder=&quot;&quot; src=&quot;http://www.youtube.com/user/MrBestProfessor&quot; width=&quot;610&quot;&gt;&lt;/iframe&gt;&lt;br /&gt;
&lt;br /&gt;
Hi there everybody, today&#39;s topic has been written about quite extensively and yet I have taken it up because of the way Yahoo Konfabulator handles it. Say for instance you have a favourite site maybe news or blog and while working on your desktop you would like to get the updates from this site quickly without having to install any third party software or toolbars etc.&lt;br /&gt;
With widgets this job becomes quite easy. First I will go into a bit of theory and then dive into the real coding part.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: yellow;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-large;&quot;&gt;&lt;b&gt;XMLHTTPRequest&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
To begin with we all know what can be done with this object called XMLHTTPRequest, unfortunately though, due to severe restrictions on cross domain request originating from the client side, it is impossible to have a standalone javascript. This object has to be used in conjunction to PHP or ASP.net sort of scripts.&lt;br /&gt;
Say I dont know PHP yet I want to have my news on my desktop.....?&lt;br /&gt;
Yahoo provides an object similar to the original XMLHTTPRequest but it is a standalone you do not require to understand or know the working of any server side script, Yahoo will take care of all that and more.&lt;br /&gt;
Lets see what Yahoo reference says about this object&lt;br /&gt;
&lt;br /&gt;
&quot;&lt;i&gt;&lt;b&gt;The &amp;nbsp;XMLHttpRequest &amp;nbsp;object is very much like the &amp;nbsp;URL &amp;nbsp;object that has existed in the Widget Engine since&amp;nbsp;very early on. &amp;nbsp;XMLHttpRequest &amp;nbsp;is, however, a de facto standard for doing XML over HTTP in web&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;i&gt;&lt;b&gt;browsers, so its addition here is to provide people with an easier migration path when moving AJAX code&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;i&gt;&lt;b&gt;over to the Widget Engine, as well as simply trying to adhere to standards so developers find it more&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;i&gt;&lt;b&gt;approachable.&lt;/b&gt;&lt;/i&gt;&quot;&lt;/span&gt;&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
A list of functions and attributes are provided here for reference&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Attributes&lt;/b&gt;&lt;br /&gt;
&lt;i&gt;XMLHttpRequest.autoRedirect&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;XMLHttpRequest.onreadystatechange&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;XMLHttpRequest.readyState&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;XMLHttpRequest.responseText&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;XMLHttpRequest.responseXML&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;XMLHttpRequest.status&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;XMLHttpRequest.statusText&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;XMLHttpRequest.timeout&lt;/i&gt;&lt;br /&gt;
&lt;b&gt;Functions&lt;/b&gt;&lt;br /&gt;
&lt;i&gt;XMLHttpRequest.abort()&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;XMLHttpRequest.getAllResponseHeaders()&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;XMLHttpRequest.getResponseHeader()&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;XMLHttpRequest.open()&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;XMLHttpRequest.send()&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;XMLHttpRequest.setRequestHeader()&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;
&lt;/i&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: yellow;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-large;&quot;&gt;Web &lt;web&gt;&lt;/web&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;
&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal;&quot;&gt;The web block in the XML file defines the initial placement and event handlers for an HTML rendering&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal;&quot;&gt;surface,&lt;i&gt;&lt;i&gt;&lt;/i&gt;&lt;/i&gt;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal;&quot;&gt;&lt;i&gt;&lt;i&gt;&lt;/i&gt;&lt;/i&gt;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal;&quot;&gt;&lt;i&gt;&lt;i&gt;&lt;/i&gt;&lt;/i&gt;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal;&quot;&gt;&lt;i&gt;&lt;i&gt;&lt;/i&gt;&lt;/i&gt;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;div style=&quot;display: inline ! important;&quot;&gt;&lt;div style=&quot;display: inline ! important;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal;&quot;&gt;&lt;i&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal;&quot;&gt;web objects can also be created and destroyed dynamically with the JavaScript engine.&lt;/span&gt;&lt;/i&gt;&lt;/i&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;/div&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal;&quot;&gt;&lt;i&gt;&lt;i&gt;&lt;/i&gt;&lt;/i&gt;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt; &lt;i&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;/i&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;i&gt;&lt;/i&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;i&gt;&lt;/i&gt;&lt;/i&gt;&lt;br /&gt;
&lt;div style=&quot;display: inline ! important;&quot;&gt;&lt;i&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal;&quot;&gt;In laymans term this this is the container where you can put all those pretty HTML codes, to make your widget look fab. If you are from a programming background it is quite similar to web browser object provided to you by VB.&lt;/span&gt;&lt;/i&gt;&lt;/i&gt;&lt;/div&gt;&lt;i&gt;&lt;i&gt;&lt;/i&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;
&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;
&lt;/i&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: yellow;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-large;&quot;&gt;Implementation&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Lets build ourself a news feed,&lt;br /&gt;
&lt;br /&gt;
News Feed To be used is http://feeds2.feedburner.com/NdtvNews-TopStories&lt;br /&gt;
We will bring the top news from my favourite news channel NDTV.&lt;br /&gt;
&lt;br /&gt;
I want to refresh the feed every 12 hours&lt;br /&gt;
(To keep things simple in this post you are not allowed to change the widget preference, we will develop this concept further in later posts)&lt;br /&gt;
&lt;br /&gt;
Firstly I will design my background which in this case is a simple semi-transparent black png of the size 400*300 pixel as shown below, if you are an accomplished designer please go nuts and do all the fancy things you ever wished for with your image editing software. I will stick to the basic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgztQMQqPFEP7_jjBWNTNvWyR1Qp7OyhwYa8aYJzc_BdFzME_8hN5HO8SNuT6hMBQuXDORHaUHH15YnROOTtJvfmAGmeiOmtTFqSRj2rTM7OOeTgGXD8SDXy4O4GmOjlVVccedSK13Yo2GM/s1600-h/widget.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgztQMQqPFEP7_jjBWNTNvWyR1Qp7OyhwYa8aYJzc_BdFzME_8hN5HO8SNuT6hMBQuXDORHaUHH15YnROOTtJvfmAGmeiOmtTFqSRj2rTM7OOeTgGXD8SDXy4O4GmOjlVVccedSK13Yo2GM/s320/widget.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Because most of this face will be covered by your web object we need someplace from where we can drag. Like the title bar of a window.(Objects inside the widget do not let you drag the window automatically). therefore I decided to make another image called winTitle to make it look like a window title bar&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoHXqaF611P1gBCac-iERFO2htp-nu4sLqVyUcnBYKSNhsvat8eTOuaPvx77OWUJ3UZy3hrVIz5J2LSmMIAt_Um6vOGT-vTKfIvjOSIRelPHyhnQR4I25RdvXT4WXFl7eLd2rHGoNSzl0X/s1600-h/wintitle.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoHXqaF611P1gBCac-iERFO2htp-nu4sLqVyUcnBYKSNhsvat8eTOuaPvx77OWUJ3UZy3hrVIz5J2LSmMIAt_Um6vOGT-vTKfIvjOSIRelPHyhnQR4I25RdvXT4WXFl7eLd2rHGoNSzl0X/s320/wintitle.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Lets just create window first nothing else&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;widget minimumVersion=&quot;4.5&quot;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;window id=&quot;mainWin&quot;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;name&amp;gt; RSS1&amp;lt;/name&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;title&amp;gt;My First Widget&amp;lt;/title&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;width&amp;gt;400&amp;lt;/width&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;height&amp;gt;300&amp;lt;/height&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;visible&amp;gt;true&amp;lt;/visible&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;image&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;src&amp;gt;Resources/widget.png&amp;lt;/src&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;/image&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;image&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;src&amp;gt;Resources/wintitle.png&amp;lt;/src&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;voffset&amp;gt;-1&amp;lt;/voffset&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;/image&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;/window&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;/widget&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
As mentioned earlier it will just create window and do nothing.&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: yellow;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-large;&quot;&gt;Javascript Request&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
I will create a separate JS file called RssRead.js. One of the functions will be readRSS, which is the heart of this code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;function readRSS()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;xmlhttp=new XMLHttpRequest();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;if (xmlhttp==null)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;alert (&quot;Something has gone wrong!&quot;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;return;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;To begin we instantiate an object of the XMLHTTPRequest type and check if the object is not null if it is so then the function exits with a warning window&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;As we know that XMLHTTPRequest &amp;nbsp;gives us the chance of making an asynchronous call therefore we will define an anonymous function to handle the situation when our request returns.If complete the readyState is 4&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;xmlhttp.onreadystatechange=function()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;if (xmlhttp.readyState==4)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;{}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;The response which is returned is an xml document and we can treat it so&lt;br /&gt;
&lt;br /&gt;
xmldoc=xmlhttp.responseXML;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;As we all know that RSS file structure is fixed and in XML thus making our life much easier, we will just read the elements that we want and ignore all the other. For more information on &lt;a href=&quot;http://www.xul.fr/en-xml-rss.html#rss-tag&quot;&gt;RSS File Structure click on the link&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;if (xmlhttp.status==200 &amp;amp;&amp;amp; xmldoc!=null) //just to check for error or empty XML&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;var titles=xmldoc.evaluate(&quot;rss/channel/item/title&quot;);//first line&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;var links=xmldoc.evaluate(&quot;rss/channel/item/link&quot;);//second line&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;var strAnswer=&quot;&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;for(var i = 0; i &amp;lt; titles.length; i++)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;strAnswer=strAnswer + &quot;&amp;lt;a href=&#39;&quot; + links.item(i).firstChild.data + &quot;&#39; target=&#39;_self&#39; style=&#39;color:white; textDecoration:none&#39;&amp;gt;;&quot;+(i+1)+ &quot; : &quot; +titles.item(i).firstChild.data + &quot;&amp;lt;/a&amp;gt;&amp;lt;br/&amp;gt;&quot;;&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;The first line gets all the title elements, we are concerned with the headlines only not the description, we want to give the user a choice to read up on the headline he wants thus the link for that headline or title is required.&lt;/div&gt;&lt;div&gt;The second line gets all the links for the stories&lt;/div&gt;&lt;div&gt;As we all know only way to put a link is an HREF tag therefore I decided to create a string which will have the title inside an href tag with the corresponding link as the src. Simply run a loop for the number of titles in the array and use the variable as an index into the array of links.&lt;/div&gt;&lt;div&gt;This is for returning the value but we didnot make the real call yet so lets see that&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;xmlhttp.open(&quot;GET&quot;, &quot;http://feeds2.feedburner.com/NdtvNews-TopStories&quot;, true)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;xmlhttp.send(null)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
most of it is easy except the last argument in the open function, if we make it false then the call will be synchronous but I want it to be async therefore I passed it a true value.&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Thats about it..... wait what happened to the string we created with the links, We will find in the widget the object which will show the link, in my case it will be the web element with the id rss1&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;var result=widget.getElementById(&quot;rss1&quot;);&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;result.html=strAnswer;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;the complete code is follows&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;function readRSS()&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;var timer=widget.getElementById(&quot;rss1timer&quot;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;if(timer!=null)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;timer.ticking=false;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;xmlhttp=new XMLHttpRequest();&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;if (xmlhttp==null)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;alert (&quot;Something has gone wrong!&quot;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;return;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;xmlhttp.onreadystatechange=function()&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;if (xmlhttp.readyState==4)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;xmldoc=xmlhttp.responseXML;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;if (xmlhttp.status==200 &amp;amp;&amp;amp; xmldoc!=null)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;var titles=xmldoc.evaluate(&quot;rss/channel/item/title&quot;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;var links=xmldoc.evaluate(&quot;rss/channel/item/link&quot;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;var strAnswer=&quot;&quot;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;for(var i = 0; i &amp;lt; titles.length; i++)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;strAnswer=strAnswer + &quot;&amp;lt;a href=&#39;&quot; + links.item(i).firstChild.data + &quot;&#39; target=&#39;_self&#39; style=&#39;color:white; textDecoration:none&#39;&amp;gt;;&quot;+(i+1)+ &quot; : &quot; +titles.item(i).firstChild.data + &quot;&amp;lt;/a&amp;gt;&amp;lt;br/&amp;gt;&quot;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;var result=widget.getElementById(&quot;rss1&quot;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;result.html=strAnswer;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;    timer.ticking=true;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;else&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;result.html=&quot;An error has occurred&quot;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;xmlhttp.open(&quot;GET&quot;, &quot;http://feeds2.feedburner.com/NdtvNews-TopStories&quot;, true)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;xmlhttp.send(null)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
Lets create the web object in our kon or widget file&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;web id=&quot;rss1&quot; &amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;font&amp;gt;Times New Roman&amp;lt;/font&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;size&amp;gt;14&amp;lt;/size&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;voffset&amp;gt;29&amp;lt;/voffset&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;hoffset&amp;gt;20&amp;lt;/hoffset&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;width&amp;gt;380&amp;lt;/width&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;height&amp;gt;280&amp;lt;/height&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;bgcolor&amp;gt;#ffaa55&amp;lt;/bgcolor&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;/web&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Now to give our widget a nice title&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;text style=&quot;font-size: 24px&quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;data&amp;gt;NDTV Top News&amp;lt;/data&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;hoffset&amp;gt;15&amp;lt;/hoffset&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;voffset&amp;gt;15&amp;lt;/voffset&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;size&amp;gt;16&amp;lt;/size&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;color&amp;gt;#ff4499&amp;lt;/color&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;/text&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
That is all we are done except one tiny winy timer issue. We wanted this widget to upgrade itself every 12 hour. To achieve that we put in a timer object with 12*60*60 as interval. When the timer reaches that interval the onTimerFired event is raised. we just call our main readRSS function.&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;timer name=&quot;rss1timer1&quot; id=&quot;rss1timer&quot; ticking=&quot;true&quot; interval=&quot;43200&quot; onTimerFired=&quot;readRSS();&quot;&amp;gt;&amp;lt;/timer&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
lastly the onLoad event must be handled so as we call call our main function without any need for user intervention like a click etc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;action&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;trigger&amp;gt;onLoad&amp;lt;/trigger&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;readRSS();&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;/action&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Thus our full program will be something like this&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;widget minimumVersion=&quot;4.5&quot;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;script src=&quot;RssRead.js&quot; charset=&quot;utf-8&quot;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;
&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;window id=&quot;mainWin&quot;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;name&amp;gt; RSS1&amp;lt;/name&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;title&amp;gt;My First Widget&amp;lt;/title&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;width&amp;gt;400&amp;lt;/width&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;height&amp;gt;300&amp;lt;/height&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;visible&amp;gt;true&amp;lt;/visible&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;image&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;src&amp;gt;Resources/widget.png&amp;lt;/src&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;/image&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;image&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;src&amp;gt;Resources/wintitle.png&amp;lt;/src&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;voffset&amp;gt;-1&amp;lt;/voffset&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;/image&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;text style=&quot;font-size: 24px&quot;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;data&amp;gt;NDTV Top News&amp;lt;/data&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;hoffset&amp;gt;15&amp;lt;/hoffset&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;voffset&amp;gt;15&amp;lt;/voffset&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;size&amp;gt;16&amp;lt;/size&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;color&amp;gt;#ff4499&amp;lt;/color&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;/text&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;web id=&quot;rss1&quot; &amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;font&amp;gt;Times New Roman&amp;lt;/font&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;size&amp;gt;14&amp;lt;/size&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;voffset&amp;gt;29&amp;lt;/voffset&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;hoffset&amp;gt;20&amp;lt;/hoffset&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;width&amp;gt;380&amp;lt;/width&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;height&amp;gt;280&amp;lt;/height&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;bgcolor&amp;gt;#ffaa55&amp;lt;/bgcolor&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;/web&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;/window&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;timer name=&quot;rss1timer1&quot; id=&quot;rss1timer&quot; ticking=&quot;true&quot; onTimerFired=&quot;readRSS();&quot; interval=&quot;43200&quot;&amp;gt;&amp;lt;/timer&amp;gt; &lt;/span&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;action&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;trigger&amp;gt;onLoad&amp;lt;/trigger&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;readRSS();&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;/action&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;lt;/widget&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Please don&#39;t forget to check my youtube videos. We will develop this concept further to bring in user preferences database, registry keys etc in my future posts.&lt;/div&gt;</description><link>http://widgetsgadgetsworld.blogspot.com/2010/02/how-to-create-widgets-part3-rss-feed.html</link><author>noreply@blogger.com (Sudeep Mukherjee)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgztQMQqPFEP7_jjBWNTNvWyR1Qp7OyhwYa8aYJzc_BdFzME_8hN5HO8SNuT6hMBQuXDORHaUHH15YnROOTtJvfmAGmeiOmtTFqSRj2rTM7OOeTgGXD8SDXy4O4GmOjlVVccedSK13Yo2GM/s72-c/widget.png" height="72" width="72"/><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7142487369609798249.post-8206862321044433968</guid><pubDate>Wed, 24 Feb 2010 05:32:00 +0000</pubDate><atom:updated>2010-02-25T00:08:08.806+05:30</atom:updated><title>Widget Configurations</title><description>&lt;iframe height=&quot;200&quot; noborder=&quot;&quot; src=&quot;http://www.youtube.com/user/MrBestProfessor&quot; width=&quot;640&quot;&gt;&lt;/iframe&gt;&lt;br /&gt;
Hello there everybody, today I am going to talking about the configuration file for you widget under Yahoo Konfabulator.&lt;br /&gt;
Every widget may have few properties which are more to do with configuration rather than actual code or design. The best similarity which I can think of is the web.config file of .net appllications. To give you an idea the best example will be the icon which is showed on the yahoo dock for your widget and the icon showed on the security window when you run the widget for the first time.&lt;br /&gt;
The picture below shows an example of the window and the dock with a custom icon which I have created for a simple widget.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiS493Lls_HDB6ipqLdfjdA2YGNsygB0fWTPWO2W6avsppiEHr3YmZWn_Qv0AlIuLbZtFM_22fgBHLHlaQgzUtN1vcbbYaw0hJUS9XhIi2es7INKN5cNuCdZcVesrp-UyeLqi9HsPyST2lr/s1600-h/blog1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiS493Lls_HDB6ipqLdfjdA2YGNsygB0fWTPWO2W6avsppiEHr3YmZWn_Qv0AlIuLbZtFM_22fgBHLHlaQgzUtN1vcbbYaw0hJUS9XhIi2es7INKN5cNuCdZcVesrp-UyeLqi9HsPyST2lr/s320/blog1.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
the second place where you will see this icon will be on the yahoo dock on your screen. The style and placement may differ according to your machine.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKnV1QUWeU0jL-CJ37m49fhD1ZuVQQOFGT-WP9fCtmexmm1F2YGaLvvZhTSFCQZmrAkaW8r445WBIewk5YNwZ6_X1iw_1hR-u8ifLOLZmO3csa0kZeanv66aTFcoyhZfRBOZmb_U56OGhC/s1600-h/blog2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKnV1QUWeU0jL-CJ37m49fhD1ZuVQQOFGT-WP9fCtmexmm1F2YGaLvvZhTSFCQZmrAkaW8r445WBIewk5YNwZ6_X1iw_1hR-u8ifLOLZmO3csa0kZeanv66aTFcoyhZfRBOZmb_U56OGhC/s320/blog2.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
From version 4.0 onward the metadata or the data about your widget is stored in a&amp;nbsp;separate file called &lt;b&gt;&lt;i&gt;widget.xml &lt;/i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;which should be placed with your kon file on the same path. This file deals with all the metadata elements of your widget. Lets start by looking at the simple structure of this file. Please remember this is an XML file thus all the rules of XML apply.&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjntpL-uQSZv3ekwIN3bsJLSFuvaIfYjS0is-wA2BAaYNJeNtNYeGgpIJl3Gr714U8SuOXDplkNrbtBUokimmt9Fh3WyQ_WtTd-ykz0DboF7IihRJNYJLqt4HBqLlGeZUFeDGcnNpgT46mM/s1600-h/blog3.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjntpL-uQSZv3ekwIN3bsJLSFuvaIfYjS0is-wA2BAaYNJeNtNYeGgpIJl3Gr714U8SuOXDplkNrbtBUokimmt9Fh3WyQ_WtTd-ykz0DboF7IihRJNYJLqt4HBqLlGeZUFeDGcnNpgT46mM/s320/blog3.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;So metadata is the root element of this document, now I will show you how to put an icon in the Dock.&lt;br /&gt;
Yahoo specified that the icon to be shown in the dock must be 75*70 pixel. Thus i created the icon(png image) in photoshop shown below&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVfo3k43zi3AuxzWq6Zn5pMSCGYmur3wKR06M3rO68eVcivTkr7hzo7uiF-9P6kNvOFoWA1SZKjXepj1TqFW6RYr3aoJd2xKCiXiWUGW0WEmQoXrytJ_cRzqN-rceToW6TEUd1UZj1tFN8/s1600-h/dockIcon.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVfo3k43zi3AuxzWq6Zn5pMSCGYmur3wKR06M3rO68eVcivTkr7hzo7uiF-9P6kNvOFoWA1SZKjXepj1TqFW6RYr3aoJd2xKCiXiWUGW0WEmQoXrytJ_cRzqN-rceToW6TEUd1UZj1tFN8/s320/dockIcon.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
As you can see my designing skills are nothing to be talked about you are free to use any style of designing you wish just remember the size. Now we place the icon reference in one of the elements called image with the usage attribute as dock eg&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-large;&quot;&gt;&amp;lt;img src=&quot;Resources/dockIcon.png&quot; usage=&quot;dock&quot; /&amp;gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
The widget automatically looks for this file and uses it if it is present.&lt;br /&gt;
If you want to give your widget a proper name with copyright notice and author name etc, again this file is the best place to put these informations&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&amp;gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;lt;metadata&amp;gt;&lt;/b&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;b&gt; &lt;/b&gt;&lt;/span&gt;&lt;b&gt;&amp;lt;version&amp;gt;1&amp;lt;/version&amp;gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;b&gt; &lt;/b&gt;&lt;/span&gt;&lt;b&gt;&amp;lt;name&amp;gt;ModernRSS&amp;lt;/name&amp;gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;b&gt; &lt;/b&gt;&lt;/span&gt;&lt;b&gt;&amp;lt;mage usage=&quot;dock&quot; src=&quot;Resources/dockIcon.png&quot;/&amp;gt;&lt;/b&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;b&gt; &lt;/b&gt;&lt;/span&gt;&lt;b&gt;&amp;lt;image usage=&quot;security&quot; src=&quot;Resources/dockIcon.png&quot;/&amp;gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;b&gt; &lt;/b&gt;&lt;/span&gt;&lt;b&gt;&amp;lt;author name=&quot;Sudeep Mukherjee&quot; organization=&quot;DigitalDreams&quot; href=&quot;http://widgetsgadgetsworld.blogspot.com/&quot;/&amp;gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;b&gt; &lt;/b&gt;&lt;/span&gt;&lt;b&gt;&amp;lt;copyright&amp;gt;(c) 2010-2012 sudeep.&amp;lt;/copyright&amp;gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;b&gt; &lt;/b&gt;&lt;/span&gt;&lt;b&gt;&amp;lt;description&amp;gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;b&gt;  &lt;/b&gt;&lt;/span&gt;&lt;b&gt;A simple RSS news Widget&lt;/b&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;b&gt; &lt;/b&gt;&lt;/span&gt;&lt;b&gt;&amp;lt;/description&amp;gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;b&gt; &lt;/b&gt;&lt;/span&gt;&lt;b&gt;&amp;lt;platform minVersion=&quot;4.5&quot; os=&quot;windows&quot;/&amp;gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;lt;/metadata&amp;gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
You can customize all these options according to your need.&lt;br /&gt;
Another interesting tit-bit you might be interested in is the debug option, say you are trying out your widget and would like an option to run the widget without actually closing it and loading it again and going through the security screen each time you do it. Or you want to have a look at some variables during the execution or see some special messages while the widget executes. We all developers from time to time use these kind of facilities provided by modern compilers and IDE&#39;s. Therefore Yahoo provides a debug mode for you. To switch on the debug mode make the following changes to your kon file or main widget file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&lt;br /&gt;
&amp;lt;widget minimumVersion=&quot;4.5&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;settings&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;b&gt;&amp;lt;setting name=&quot;debug&quot; value=&quot;on&quot;/&amp;gt;&lt;/b&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/settings&amp;gt;&lt;br /&gt;
&amp;lt;/widget&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have any queries please send me comments or mails, and do not forget to check my you tube video for the same.&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;&lt;object height=&quot;360&quot; width=&quot;580&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/fbUmdZ7uZtQ&amp;hl=en_GB&amp;fs=1&amp;color1=0x2b405b&amp;color2=0x6b8ab6&amp;border=1&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;/param&gt;&lt;embed src=&quot;http://www.youtube.com/v/fbUmdZ7uZtQ&amp;hl=en_GB&amp;fs=1&amp;color1=0x2b405b&amp;color2=0x6b8ab6&amp;border=1&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;580&quot; height=&quot;360&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</description><link>http://widgetsgadgetsworld.blogspot.com/2010/02/widget-configurations.html</link><author>noreply@blogger.com (Sudeep Mukherjee)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiS493Lls_HDB6ipqLdfjdA2YGNsygB0fWTPWO2W6avsppiEHr3YmZWn_Qv0AlIuLbZtFM_22fgBHLHlaQgzUtN1vcbbYaw0hJUS9XhIi2es7INKN5cNuCdZcVesrp-UyeLqi9HsPyST2lr/s72-c/blog1.jpg" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7142487369609798249.post-6182423768573768510</guid><pubDate>Mon, 22 Feb 2010 10:50:00 +0000</pubDate><atom:updated>2010-02-24T12:44:49.609+05:30</atom:updated><title></title><description>&lt;iframe height=&quot;200&quot; noborder=&quot;&quot; src=&quot;http://www.youtube.com/user/MrBestProfessor&quot; width=&quot;610&quot;&gt;&lt;/iframe&gt;&lt;br /&gt;
Hello there everybody, This is the part 2 of the ongoing series of tutorials which deals with the creation of widgets using Yahoo Konfabulator SDK. In my last post I had a simple widget up and running unfortunately it does not do anything. In this video I will try to teach you the most simple way of reacting to events such as button click.&lt;br /&gt;
If you are from a programming background then you might expect a button click event but I am going to use the mouse down event instead. The problem with this approach is, if I use the mousedown event of the windows element in my kon file then anywhere you click this event will be fired. What I want is for this event to fire only when I click inside a button. Thus we will simplify our work by creating a separate graphics for the button and using the mousedown event of that object. Confused, don’t be let us see the original file used for the background&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDKdhFb13cv4J4UQhwa0gPcwEbD0RnloqufZDpKLhyfwvQJB6QVYskuMI47g2qcP16K1n2gTb7QFjxaUlpbgH-moWF-W5Te6kfXbDKAwCpRgJDnS3CaJtay2FX2mu_j0ppSK2b5yziYfWN/s1600-h/back1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDKdhFb13cv4J4UQhwa0gPcwEbD0RnloqufZDpKLhyfwvQJB6QVYskuMI47g2qcP16K1n2gTb7QFjxaUlpbgH-moWF-W5Te6kfXbDKAwCpRgJDnS3CaJtay2FX2mu_j0ppSK2b5yziYfWN/s320/back1.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;Let us say we want the star fish thing as our button. Instead of sweating by finding the co-ordinates etc, I will create a button1.png with the same image and overlay it on my window.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEis7U6HZVrrwqX5wIzkraZRvfUm-Aw-MLt2j7NkIPxfimb_CORAf99AQrURk64SADW-P7wX8vq-VnZNXLTdMqdd3Cjyb0cvD24x7c_GbYUMuTzLTJSNpLg9farIZxw7QTNJ-DV1YCJ30P1Y/s1600-h/button1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEis7U6HZVrrwqX5wIzkraZRvfUm-Aw-MLt2j7NkIPxfimb_CORAf99AQrURk64SADW-P7wX8vq-VnZNXLTdMqdd3Cjyb0cvD24x7c_GbYUMuTzLTJSNpLg9farIZxw7QTNJ-DV1YCJ30P1Y/s320/button1.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;Let us review our original widget file&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjV7HQE9rVfkhyDd_btamyInpvWk0WHwXnVMdQ2Z4pztclvgJvlScLlBtAMPMKxc310ji1rI9T0wpI7mYHCg9OCa3M3TLB88fSY3CBZ_cE-LqLAVIUepPmGXd-p4mmZjFF7_lG9xFjnGmHI/s1600-h/prg2_1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjV7HQE9rVfkhyDd_btamyInpvWk0WHwXnVMdQ2Z4pztclvgJvlScLlBtAMPMKxc310ji1rI9T0wpI7mYHCg9OCa3M3TLB88fSY3CBZ_cE-LqLAVIUepPmGXd-p4mmZjFF7_lG9xFjnGmHI/s320/prg2_1.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;As I mentioned earlier I will just overlay this image on top of my background.&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLqAXZQ-m-4P6JefxJHm6DcJyRnbXu8BDqLdBgAyz1Mv3OrAVJqIMQyADGCd-GBIcFMX1wKIHaeR60ooXXBIR_aP8n27-DF-wzxLmUCHLo1Sdid253FM-HMbDqLeX-4VI0Ky0cSRXnn5pd/s1600-h/prg2_2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;291&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLqAXZQ-m-4P6JefxJHm6DcJyRnbXu8BDqLdBgAyz1Mv3OrAVJqIMQyADGCd-GBIcFMX1wKIHaeR60ooXXBIR_aP8n27-DF-wzxLmUCHLo1Sdid253FM-HMbDqLeX-4VI0Ky0cSRXnn5pd/s640/prg2_2.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;There you have it your first event driven widget. The important line is the image tag with the button1.png as the source and the onMouseDown event as a sub-element. If you are familiar with Javascript then you must immediately recognize the web scripting aspect of the program. Simple when the object is clicked we call the alert function of javascript with the message.&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;I would like to emphasize that this program is not meant to do anything except show you how to use events. Some people had requested me to show them how to add JavaScript code blocks. It is quite simple. As shown in the example below&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfReLFGIaqJMhH1TJDoeJukGo7pmIWLUewSlTA4_7v2jarZialVsio341Akbu7QLz0hwY8n3hrrrBtczppV_BUNOaQMtftZDdiTGxYheijRBIMm4E9Q3usr3xHLJtDhSQDmCZwWVI0Hq82/s1600-h/prg2_3.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;380&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfReLFGIaqJMhH1TJDoeJukGo7pmIWLUewSlTA4_7v2jarZialVsio341Akbu7QLz0hwY8n3hrrrBtczppV_BUNOaQMtftZDdiTGxYheijRBIMm4E9Q3usr3xHLJtDhSQDmCZwWVI0Hq82/s640/prg2_3.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;On the top of the code we define script block, declare a function, this function is called when the button is clicked or onMouseDown event of that object. &lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;Again this post was a simple way of adding events to your widget, in the next blog I will try to put in few more functionalities. If any of you is interested in gadgets drop me a line and I will put in a post and video about gadgets. &lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;Do not forget to subscribe to my channel in you tube to get the most updated tutorials.&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;</description><link>http://widgetsgadgetsworld.blogspot.com/2010/02/hello-there-everybody-this-is-part-2-of.html</link><author>noreply@blogger.com (Sudeep Mukherjee)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDKdhFb13cv4J4UQhwa0gPcwEbD0RnloqufZDpKLhyfwvQJB6QVYskuMI47g2qcP16K1n2gTb7QFjxaUlpbgH-moWF-W5Te6kfXbDKAwCpRgJDnS3CaJtay2FX2mu_j0ppSK2b5yziYfWN/s72-c/back1.png" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7142487369609798249.post-4577535732043896496</guid><pubDate>Sun, 21 Feb 2010 19:28:00 +0000</pubDate><atom:updated>2010-02-24T12:43:17.974+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Yahoo widgets Javascript</category><title>My First Widget</title><description>This will be my first foray into the world of widgets. I am more of a traditional programmer and I use javascript under extreme duress.&amp;nbsp;Therefore&amp;nbsp;I was never attracted toward the field of widgets or gadgets for that matter.&lt;br /&gt;
If you want to have a look as to what are widgets please visit this site&amp;nbsp;&lt;a href=&quot;http://widgets.yahoo.com/&quot; target=&quot;_blank&quot;&gt;http://widgets.yahoo.com/&lt;/a&gt;&amp;nbsp;.&lt;br /&gt;
Moving on to requirements for this kind of development&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;&lt;i&gt;Widget engine, Yahoo calls it Konfabulator. (don&#39;t ask me why, I have no idea). Get Yahoo SDK&amp;nbsp;&lt;/i&gt;&lt;a href=&quot;http://download.yimg.com/ycs/widgets/us/4.5.2x10a50/ywidgets_sdk_setup.exe&quot;&gt;&lt;i&gt;Download SDK&lt;/i&gt;&lt;/a&gt;&lt;i&gt;&amp;nbsp;. After the download just install it and you are ready to go&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;The secondry requirement is a good text editor, Yahoo uses XML and javascript to design widgets thus, I would suggest finding a good XML and Javascript editor. If you are confused please download the visual studio free edition, i think it will be sufficient for your requirements. On this point I am open to suggestions.&amp;nbsp;&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;Download the reference manual from the Yahoo site.&amp;nbsp;&lt;a href=&quot;http://widgets.yahoo.com/static/downloads/WidgetsReference_4.5.zip&quot;&gt;Click here to download a zip which has the manual in pdf format&lt;/a&gt;&amp;nbsp;.&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;Image editor, you will need a good image editor to design your widget backgrounds and the UI in general thus please buy or get an image editor which is as good as Gimp or Photoshop. The following list has been provided by my readers thus I have no idea how good these softwares are but I know that these are free.&lt;/i&gt;&lt;i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Photoscape&amp;nbsp;&lt;a href=&quot;http://www.photoscape.org/ps/main/download.php&quot; target=&quot;_blank&quot;&gt;Download&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;Gimp for windows&amp;nbsp;&lt;a href=&quot;http://downloads.sourceforge.net/gimp-win/gimp-2.6.8-i686-setup.exe?use_mirror=&quot; target=&quot;_blank&quot;&gt;Download&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Serif PhotoPlus&amp;nbsp;&lt;a href=&quot;http://www.freeserifsoftware.com/software/photoplus/&quot; target=&quot;_blank&quot;&gt;Download&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/i&gt;Beside these software&#39;s you need to have basic understanding of XML and Javascript. These tutorials will not try to teach you either of these two subjects.&amp;nbsp; &lt;br /&gt;
The main file which is executed has an extension of kon. This you say is like the exe file under the windows environment. The kon file is not a standalone exe but a file which is used by the konfublator. Once the Konfabulator engine is installed on your system as soon as you double click on any kon file the engine will start and the file will be executed. All these steps will be outline in my video tommorow on the you tube. If you have any questions feel free to drop me a line&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-large;&quot;&gt;Creating the background&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
For your widget lets build a small background graphic file. I am not trying to create anything complicated to begin with thus the background file will be an image of 200*200 pixels. The base color is transparent thus it will not obstruct anything and there are three- four shapes. The name of the file is back1.png&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4fHjeFdmrLK8zuIwgVttRgkZlOO9P0F-M9d-cazQrHPV-CKEsNHqU3z2zYLykjglb8iwzqj1BmUxmqdYZ3E-wSFISO6IUYUxMWjtoDmS02XgfqfcJ7bxYPfxFN3Yjy35-34dpj2VJFbTL/s1600-h/back1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4fHjeFdmrLK8zuIwgVttRgkZlOO9P0F-M9d-cazQrHPV-CKEsNHqU3z2zYLykjglb8iwzqj1BmUxmqdYZ3E-wSFISO6IUYUxMWjtoDmS02XgfqfcJ7bxYPfxFN3Yjy35-34dpj2VJFbTL/s320/back1.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-large;&quot;&gt;Creating the program&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Lets fire up our favourite text editor and create a file called helloworld.kon. The basic syntax is like a xml file. therefore it must start with the following line just like an XML file&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;
&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjB1biXPmSi1Kitj02tDIbxgcFfH02tdKRIKpnWmi2-M3f6lcUe9gmI3e-UlnaYPlg0WwBpjlfIOMtWt2JgF7A8JMI_qw7E5VrMtYdKYFo0g_M1N1Li3BOzbCh7AuChKvTPDgZBcPkcLP78/s1600-h/prg1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjB1biXPmSi1Kitj02tDIbxgcFfH02tdKRIKpnWmi2-M3f6lcUe9gmI3e-UlnaYPlg0WwBpjlfIOMtWt2JgF7A8JMI_qw7E5VrMtYdKYFo0g_M1N1Li3BOzbCh7AuChKvTPDgZBcPkcLP78/s320/prg1.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/i&gt;&lt;i&gt;&lt;br /&gt;
&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
These files have the basic element as &lt;widget&gt; Therefore let us create the basic skeleton of the file&lt;/widget&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-FtYP6VB0wRZg_bsfhTe87ZQD-zDyv0ToO4y175174K15OXWabJ8wE_4Qmw1SCFblMrtXE3fJdlqgNiPY6vGpjzyROr7VsRKQuzeIMLJOVT6qOGGnDziO9HjKZb1Tj8VtPLaios2KbIDH/s1600-h/prg2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-FtYP6VB0wRZg_bsfhTe87ZQD-zDyv0ToO4y175174K15OXWabJ8wE_4Qmw1SCFblMrtXE3fJdlqgNiPY6vGpjzyROr7VsRKQuzeIMLJOVT6qOGGnDziO9HjKZb1Tj8VtPLaios2KbIDH/s320/prg2.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Every widget element must have a window element inside it therefore we must define a window which would be the visible portion of your widget. As we all know every window must have a name, title, height and width in the same way we must define these attributes. Again it is upto to you if you want these as attributes of the window element or child of window element. Personally I prefer the latter.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNHswWABhOSpcE9zQWxEQvuOyrGZCv6VZPlDv5wq4CXIlJwoIBNjjQ8GRjy6QrRY5R09Vnnya1S90oeIh5C1KCR0kIrlop4NrIsZSGQWi1W-To1dmjzTjPL-de0JFcC1ZOel1yg-5W8ncd/s1600-h/prg3.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNHswWABhOSpcE9zQWxEQvuOyrGZCv6VZPlDv5wq4CXIlJwoIBNjjQ8GRjy6QrRY5R09Vnnya1S90oeIh5C1KCR0kIrlop4NrIsZSGQWi1W-To1dmjzTjPL-de0JFcC1ZOel1yg-5W8ncd/s320/prg3.jpg&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNHswWABhOSpcE9zQWxEQvuOyrGZCv6VZPlDv5wq4CXIlJwoIBNjjQ8GRjy6QrRY5R09Vnnya1S90oeIh5C1KCR0kIrlop4NrIsZSGQWi1W-To1dmjzTjPL-de0JFcC1ZOel1yg-5W8ncd/s1600-h/prg3.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;br /&gt;
&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As you can see we have defined all the properties the last property that we must add is the image property which will show the background of the window. Lets put in the image element.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjInH8SXCKL8YX5RMN7wdu6HXZjlLuuQmUZHvLSBOzwAEeFCJR5rC2spBN_L0bqE0H7VoQ9Rb7wa3Gj9Lh7WgD_em8VXAhJ9KY7UAU4RU1FH9F98YUGWLST9KCd-dAJvjPe5scSKshxJ8XP/s1600-h/prg4.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjInH8SXCKL8YX5RMN7wdu6HXZjlLuuQmUZHvLSBOzwAEeFCJR5rC2spBN_L0bqE0H7VoQ9Rb7wa3Gj9Lh7WgD_em8VXAhJ9KY7UAU4RU1FH9F98YUGWLST9KCd-dAJvjPe5scSKshxJ8XP/s320/prg4.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;One important point is the files should be in the same path, because we cannot be sure as to the file system of the user thus if you save your widget in a folder called mywidgets then save the image either there or make a sub-directory such as images or resources to save the image files.&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;As is customary there must be a hello world message somewhere, thus lets put in the text, in yahoo widget this is also an element called text and attributes like data, color,font etc.&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;i&gt;&lt;text&gt;&lt;/text&gt;&lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9Jxktd8NY9-cXmTk18F5o7Y726D3P-umU5UhinnVFi65411xEpy5MwIDrnTNxzGX9HfQ06yG5pDfet4xGAzgLYOPAKClm3XL1VibJPKfkPx0K76TNX6Kc0u1ZlLexbfuMW-VwdXvmx0OO/s1600-h/prg5.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9Jxktd8NY9-cXmTk18F5o7Y726D3P-umU5UhinnVFi65411xEpy5MwIDrnTNxzGX9HfQ06yG5pDfet4xGAzgLYOPAKClm3XL1VibJPKfkPx0K76TNX6Kc0u1ZlLexbfuMW-VwdXvmx0OO/s320/prg5.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By default the text will be printed on the extreme left i.e 0,0 position. If we want to move the text we must give the voffset and hoffset values. Basically these values will move the text vertically and horizontally from the 0,0 position by the amount of pixels you specify. I have placed the text 100 pixels down and 50 pixels to the right. Lets save this and try to execute it. If everything has been installed properly and the file has been written properly,&amp;nbsp;&lt;i&gt;&lt;name&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal;&quot;&gt;your Desktop should show this message&lt;/span&gt;&lt;/name&gt;&lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicRP4nGtbktZMrRX_VVxnsf3f9sgnyb4Joda_rsNCW9YZF4R4cxVYBc4h6RyXqmOi69Yp-_kgOyYChVajUrbTxginykQei7K3qiFSNTeQl5iMhWCa3a7o0alCPufAElXlfZvMy31j2t4jJ/s1600-h/step1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicRP4nGtbktZMrRX_VVxnsf3f9sgnyb4Joda_rsNCW9YZF4R4cxVYBc4h6RyXqmOi69Yp-_kgOyYChVajUrbTxginykQei7K3qiFSNTeQl5iMhWCa3a7o0alCPufAElXlfZvMy31j2t4jJ/s320/step1.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;Click on the use widget button and the desktop should show something like this. Please be advised I have drawn the black rectangle to emphasize the window.&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCR9UBwhoawPgFjW9o-I2jK05GV0Llqm_R0jTev2TUzOcowYvr9IZjG-PWvonfhilVlHmpJ66hYCHhZ729UBgivKhd4jQE2veyhUdqlt7Qu4NKXRoVit01mks98L4JXtn9YzhHljN7yUSd/s1600-h/step2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCR9UBwhoawPgFjW9o-I2jK05GV0Llqm_R0jTev2TUzOcowYvr9IZjG-PWvonfhilVlHmpJ66hYCHhZ729UBgivKhd4jQE2veyhUdqlt7Qu4NKXRoVit01mks98L4JXtn9YzhHljN7yUSd/s320/step2.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;There you have it, your first widget, if you want to close it just left click on it and choose close widget.&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;Tomorrow I will show you how to &amp;nbsp;put some functionality in this widget, hopefully I will have a video ready too.&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;object height=&quot;364&quot; width=&quot;445&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/57kG6Tw-oOQ&amp;hl=en_GB&amp;fs=1&amp;border=1&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;/param&gt;&lt;embed src=&quot;http://www.youtube.com/v/57kG6Tw-oOQ&amp;hl=en_GB&amp;fs=1&amp;border=1&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;445&quot; height=&quot;364&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;a href=&quot;http://www.youtube.com/watch?v=57kG6Tw-oOQ&quot;&gt;Watch the video&lt;/a&gt;</description><enclosure type='Video' url='http://www.youtube.com/watch?v=57kG6Tw-oOQ' length='0'/><link>http://widgetsgadgetsworld.blogspot.com/2010/02/my-first-widget.html</link><author>noreply@blogger.com (Sudeep Mukherjee)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4fHjeFdmrLK8zuIwgVttRgkZlOO9P0F-M9d-cazQrHPV-CKEsNHqU3z2zYLykjglb8iwzqj1BmUxmqdYZ3E-wSFISO6IUYUxMWjtoDmS02XgfqfcJ7bxYPfxFN3Yjy35-34dpj2VJFbTL/s72-c/back1.png" height="72" width="72"/><thr:total>0</thr:total></item></channel></rss>