Defvayne23

 

Posts Tagged ‘Javascript’

jQuery Weather Plugin – simpleWeather

monkeeCreate has release another jQuery plugin developed by James Fleeting that uses the Yahoo Weather API to pull in weather data by just passing it a zipcode. Using simpleWeather is alot like jTube in the sense that you pass the zipcode and a function to handle the results. Example of some of the results passed back are high, low, sunrise, sunset, wind direction, current conditions and forecast.

Checkout simpleWeather on jQuery Plugins and GitHub.

Share

 

Using jTube – Video and Thumbnail

This is the final post of the series that has so far covered the very basics of showing a list of video titles, to paging of the list using jTube. In this post I will discuss how to embed a video using jTubeEmbed which comes with the jTube jQuery plugin, also how to show the video thumbnail provided by YouTube. To show these features off I will modify where we left off in the paging tutorial and show the video for the first entry of the page then show the thumbnail for the other videos on the page.

To show the video only on the first video we need to modify the each loop to tell us where we are in the loop. Simply add `index` as the first parameter received.

12
        $(videos).each(function(index) {

(more…)

Share

 

Using jTube – Paging

In my previous post I covered the basics of showing a users uploaded videos. In this tutorial we will go over how to implement paging. To really show off paging, I have changed the request to top rated videos.

First we need to break our video options into a variable so we can re-use them when calling the other pages. This allows us to easily change the page number and leave all the other options intact.

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
var options = {
    feed: 'top_rated',
    success: function(videos, numberPages) {
        $(videos).each(function() {
            videoHTML = '<li>';
            videoHTML += '<a href="'+this.link+'" target="_blank">';
            videoHTML += this.title;
            videoHTML += '</a> - '+this.length;
            videoHTML += '</li>';
 
            $('#myVideos').append(videoHTML);
        });
    },
    error: function(error) {
        $('#myVideos').append('<li class="error">'+error+'</li>');
    }
};
 
$.jTube(options);

(more…)

Share

 

Using jTube – Basics

This is the first post in a line of uses for jTube. In this post I will show the basics of getting a users upload list and using the info. Before we start make sure that you have included the latest jQuery and latest jTube.

For jTube to work you must tell it what feed to grab by passing the info to the correct option. The only one we need to worry about today is `user`. Using the users feed has an option that accompanies it. The option userType tells what info about the user to retrieve. By default jTube loads the users uploads. Lets take a look at that.

1
2
3
4
5
<script>
$.jTube({
    user: 'defvayne23'
});
</script>

(more…)

Share