update featured videos
also remove "new" tags from SDK and Resources nav items Change-Id: I75e16fc6dda5a7cbcd4ff8e4ebb2189860e884d5
This commit is contained in:
@ -167,14 +167,12 @@
|
||||
</a></li>
|
||||
<li><a href="<?cs var:toroot ?>resources/tutorials/testing/helloandroid_test.html">
|
||||
<span class="en">Hello Testing</span></a>
|
||||
<span class="new">new!</span>
|
||||
</li>
|
||||
<li><a href="<?cs var:toroot ?>resources/tutorials/notepad/index.html">
|
||||
<span class="en">Notepad Tutorial</span>
|
||||
</a></li>
|
||||
<li><a href="<?cs var:toroot ?>resources/tutorials/testing/activity_test.html">
|
||||
<span class="en">Activity Testing</span></a>
|
||||
<span class="new">new!</span>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?cs if:!sdk.redirect ?>
|
||||
<ul><?cs
|
||||
<ul><?cs
|
||||
if:android.whichdoc == "online" ?>
|
||||
<li>
|
||||
<h2>
|
||||
@ -35,7 +35,7 @@
|
||||
</a></li>
|
||||
|
||||
</ul>
|
||||
</li><?cs
|
||||
</li><?cs
|
||||
/if ?>
|
||||
<li>
|
||||
<h2>
|
||||
@ -61,13 +61,13 @@
|
||||
</li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><a href="<?cs var:toroot ?>sdk/android-2.2.html">Android 2.2 Platform</a> <span class="new">new!</span></li>
|
||||
<li><a href="<?cs var:toroot ?>sdk/android-2.2.html">Android 2.2 Platform</a></li>
|
||||
<li><a href="<?cs var:toroot ?>sdk/android-2.1.html">Android 2.1 Platform</a></li>
|
||||
<li><a href="<?cs var:toroot ?>sdk/android-1.6.html">Android 1.6 Platform</a></li>
|
||||
<li><a href="<?cs var:toroot ?>sdk/android-1.5.html">Android 1.5 Platform</a></li>
|
||||
<li class="toggle-list">
|
||||
<div><a href="#" onclick="toggle(this.parentNode.parentNode,true); return false;">Older Platforms</a></div>
|
||||
<ul>
|
||||
<ul>
|
||||
<li><a href="<?cs var:toroot ?>sdk/android-2.0.1.html">Android 2.0.1 Platform</a></li>
|
||||
<li><a href="<?cs var:toroot ?>sdk/android-2.0.html">Android 2.0 Platform</a></li>
|
||||
<li><a href="<?cs var:toroot ?>sdk/android-1.1.html">Android 1.1 Platform</a></li>
|
||||
@ -75,8 +75,7 @@
|
||||
</li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><a href="<?cs var:toroot ?>sdk/tools-notes.html">SDK Tools, r7</a>
|
||||
<span class="new">new!</span></li>
|
||||
<li><a href="<?cs var:toroot ?>sdk/tools-notes.html">SDK Tools, r7</a></li>
|
||||
<li><a href="<?cs var:toroot ?>sdk/win-usb.html">USB Driver for
|
||||
Windows, r3</a>
|
||||
</li>
|
||||
@ -116,8 +115,7 @@
|
||||
<span style="display:none" class="zh-TW"></span>
|
||||
</h2>
|
||||
<ul>
|
||||
<li><a href="<?cs var:toroot ?>sdk/ndk/index.html">Android NDK, r4b</a>
|
||||
<span class="new">new!</span></li>
|
||||
<li><a href="<?cs var:toroot ?>sdk/ndk/index.html">Android NDK, r4b</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -2,7 +2,7 @@ videos=true
|
||||
page.title=Videos
|
||||
@jd:body
|
||||
|
||||
<script src="http://swfobject.googlecode.com/svn/trunk/swfobject/swfobject.js" type="text/javascript"></script>
|
||||
<script src="http://swfobject.googlecode.com/svn/trunk/swfobject/swfobject.js" type="text/javascript"></script>
|
||||
<script src="{@docRoot}assets/jquery-history.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
// for debugging in FF, so other browsers ignore the console commands.
|
||||
@ -33,32 +33,32 @@ var playlists = {
|
||||
*/
|
||||
var playlistsWithTitleInDescription = "734A052F802C96B9";
|
||||
|
||||
/* This 'featured' object defines the Feature Videos list.
|
||||
/* This 'featured' object defines the Feature Videos list.
|
||||
* Each playlist ID is paired with a custom video description.
|
||||
*/
|
||||
var featured = {
|
||||
// Android 2.0 Release
|
||||
'opZ69P-0Jbc' : "The Android 2.0 platform adds exciting new user features and developer APIs. Here's an introduction to what's new.",
|
||||
// How to Make your Android UI Fast..
|
||||
'N6YdwzAvwOA' : "Make your user interface fast, with more efficient AdapterViews, better bitmap scaling, faster redrawing, ViewStub layouts, fewer Views, and more.",
|
||||
// How Do I Code Thee?
|
||||
'GARMe7Km_gk' : "If you'd like to augment your Android applications with pieces written in JavaScript or native code, watch this video."
|
||||
// Android UI design patterns
|
||||
'M1ZBjlCRfz0' : "The Android user experience team provides suggestions for how to make your applications more useable and engaging.",
|
||||
// The world of ListView
|
||||
'wDBM6wVEO70' : "ListView is a common widget that's customizable, but can be tricky to polish, so this talk shows how you can provide the best performance.",
|
||||
// Debugging Arts of the Ninja Masters
|
||||
'Dgnx0E7m1GQ' : "The Android SDK includes tools to debug your apps like a ninja. Enter the dojo and become a master at debugging your apps."
|
||||
};
|
||||
|
||||
|
||||
/* When an event on the browser history occurs (back, forward, load),
|
||||
* load the video found in the URL hash
|
||||
*/
|
||||
$(window).history(function(e, hash) {
|
||||
if (location.href.indexOf("#v=") != -1) {
|
||||
videoId = location.href.split("#v=");
|
||||
clickVideo(videoId[1]); // click the link with a matching class
|
||||
}
|
||||
* load the video found in the URL hash
|
||||
*/
|
||||
$(window).history(function(e, hash) {
|
||||
if (location.href.indexOf("#v=") != -1) {
|
||||
videoId = location.href.split("#v=");
|
||||
clickVideo(videoId[1]); // click the link with a matching class
|
||||
}
|
||||
});
|
||||
|
||||
/* Load a video into the player box.
|
||||
* @param id The YouTube video ID
|
||||
* @param title The video title to display in the player box (character escaped)
|
||||
* @param autoplay Whether to automatically play the video
|
||||
* @param autoplay Whether to automatically play the video
|
||||
*/
|
||||
function loadVideo(id, title, autoplay) {
|
||||
if($("." + id).hasClass("noplay")) {
|
||||
@ -66,51 +66,51 @@ function loadVideo(id, title, autoplay) {
|
||||
autoplay = false;
|
||||
$("." + id).removeClass("noplay");
|
||||
}
|
||||
swfobject.embedSWF('http://www.youtube.com/v/' + id + '&rel=1&border=0&fs=1&autoplay=' +
|
||||
swfobject.embedSWF('http://www.youtube.com/v/' + id + '&rel=1&border=0&fs=1&autoplay=' +
|
||||
(autoplay?1:0), 'player', '500', '334', '9.0.0', false, false, {allowfullscreen: 'true'});
|
||||
$("#videoPlayerTitle").html("<h2>" + unescape(title) + "</h2>");
|
||||
|
||||
|
||||
$.history.add('v=' + id); // add the current video to the browser history
|
||||
document.getElementById("doc-content").scrollTop = 0; // scroll the window to the top
|
||||
document.getElementById("doc-content").scrollTop = 0; // scroll the window to the top
|
||||
}
|
||||
|
||||
/* Draw all videos from a playlist into a 'videoPreviews' list
|
||||
* @param data The feed data returned from the youtube request
|
||||
*/
|
||||
function renderPlaylist(data) {
|
||||
function renderPlaylist(data) {
|
||||
var MAX_DESC_LENGTH = 390; // the length at which we will trim the description
|
||||
var feed = data.feed;
|
||||
var entries = feed.entry || [];
|
||||
var playlistId = feed.yt$playlistId.$t;
|
||||
|
||||
|
||||
var ul = $('<ul class="videoPreviews" />');
|
||||
|
||||
|
||||
// Loop through each entry (each video) and add it to the 'videoPreviews' list
|
||||
for (var i = 0; i < entries.length; i++) {
|
||||
var entry = entries[i];
|
||||
|
||||
|
||||
var title = entry.title.$t;
|
||||
var id = entry.media$group.yt$videoid.$t;
|
||||
var thumbUrl = entry.media$group.media$thumbnail[0].url;
|
||||
var fullDescription = entry.media$group.media$description.$t;
|
||||
var playerUrl = entry.media$group.media$content[0].url;
|
||||
|
||||
|
||||
// Check whether this playlist includes the video title inside the description meta-data, so we can remove it
|
||||
if (playlistsWithTitleInDescription.indexOf(playlistId) != -1) {
|
||||
var lines = fullDescription.split("\n");
|
||||
// If the first line includes the first 17 chars from the title, let's use the title from the description instead (because it's a more complete title)
|
||||
// This accounts for, literally, "Google I/O 2009 -", which is (so far) the min AND max for properly identifying a title in the only playlist with titles in the description
|
||||
if (lines[0].indexOf(title.slice(0,16)) != -1) {
|
||||
h3Title = "<h3>" + lines[0] + "</h3>";
|
||||
if (lines[0].indexOf(title.slice(0,16)) != -1) {
|
||||
h3Title = "<h3>" + lines[0] + "</h3>";
|
||||
if (lines[2].length < 30) lines = lines.slice(3); // also, if the second line is very short (the speaker name), slice it out too
|
||||
else lines = lines.slice(1); // otherwise, slice after the first line
|
||||
}
|
||||
fullDescription = lines.join("");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var shortDescription = fullDescription.substr(0, MAX_DESC_LENGTH);
|
||||
shortDescription += shortDescription.length == MAX_DESC_LENGTH ? "..." : ""; // add ellipsis if we've chopped the description
|
||||
|
||||
|
||||
var img = $('<img src="' + thumbUrl + '" width="120" height="90"/>');
|
||||
var a = $('<a class="' + id + '" href="#" onclick="loadVideo(\'' + id + '\',\'' + escape(title) + '\',true); return setSelected(this);" />');
|
||||
var pShortDescription = $('<p class="short">' + shortDescription + '</p>');
|
||||
@ -118,19 +118,19 @@ function renderPlaylist(data) {
|
||||
var h3Title = "<h3>" + title + "</h3>";
|
||||
var pToggle = "<p class='toggle'><a href='#' onclick='return toggleDescription(this)'><span class='more'>more</span><span class='less'>less</span></a></p>";
|
||||
var li = $('<li/>');
|
||||
|
||||
|
||||
li.append(a);
|
||||
a.append(img).append(h3Title).append(pShortDescription);
|
||||
|
||||
|
||||
// Add the full description and "more/less" toggle, if necessary
|
||||
if (fullDescription.length > MAX_DESC_LENGTH) {
|
||||
a.append(pFullDescription);
|
||||
li.append(pToggle);
|
||||
}
|
||||
|
||||
|
||||
ul.append(li);
|
||||
}
|
||||
|
||||
|
||||
// Now add the 'videoPreviews' list to the page, and be sure we put it in the right tab
|
||||
// This is the part that allows us to put multiple playlists in one tab
|
||||
for (var x in playlists) {
|
||||
@ -141,13 +141,13 @@ function renderPlaylist(data) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Draw a featured video into the existing 'videoPreviews' list
|
||||
/* Draw a featured video into the existing 'videoPreviews' list
|
||||
* @param data The video data returned from the youtube request
|
||||
*/
|
||||
function renderFeatured(data) {
|
||||
function renderFeatured(data) {
|
||||
var MAX_TITLE_LENGTH = 48;
|
||||
var entry = data.entry || [];
|
||||
var id = entry.media$group.yt$videoid.$t;
|
||||
@ -155,15 +155,15 @@ function renderFeatured(data) {
|
||||
var title = entry.title.$t;
|
||||
var thumbUrl = entry.media$group.media$thumbnail[0].url;
|
||||
var playerUrl = entry.media$group.media$content[0].url;
|
||||
|
||||
|
||||
var ellipsis = title.length > MAX_TITLE_LENGTH ? "..." : "";
|
||||
|
||||
|
||||
var h3Title = "<h3>"+ title.substr(0,MAX_TITLE_LENGTH) + ellipsis + "</h3>";
|
||||
var img = $('<img src="' + thumbUrl + '" width="120" height="90"/>');
|
||||
var p = $('<p>' + description + '</p>');
|
||||
var a = $('<a class="' + id + '" href="#" onclick="loadVideo(\'' + id + '\',\'' + title + '\',true); return setSelected(this);" />');
|
||||
var li = $("<li/>");
|
||||
|
||||
|
||||
a.append(h3Title).append(img).append(p);
|
||||
li.append(a);
|
||||
|
||||
@ -175,8 +175,8 @@ function showPlaylists() {
|
||||
for (var x in playlists) {
|
||||
var ids = playlists[x].ids;
|
||||
for (var i in ids) {
|
||||
var script = "<script type='text/javascript' src='http://gdata.youtube.com/feeds/api/playlists/"
|
||||
+ ids[i] +
|
||||
var script = "<script type='text/javascript' src='http://gdata.youtube.com/feeds/api/playlists/"
|
||||
+ ids[i] +
|
||||
"?v=2&alt=json-in-script&callback=renderPlaylist'><\/script>";
|
||||
$("body").append(script);
|
||||
}
|
||||
@ -186,14 +186,14 @@ function showPlaylists() {
|
||||
/* Request the featured videos from YouTube */
|
||||
function showFeatured() {
|
||||
for (var id in featured) {
|
||||
var script = "<script type='text/javascript' src='http://gdata.youtube.com/feeds/api/videos/"
|
||||
+ id +
|
||||
var script = "<script type='text/javascript' src='http://gdata.youtube.com/feeds/api/videos/"
|
||||
+ id +
|
||||
"?v=2&alt=json-in-script&callback=renderFeatured'><\/script>";
|
||||
$("body").append(script);
|
||||
}
|
||||
}
|
||||
|
||||
/* Reveal a tab (playlist) box
|
||||
/* Reveal a tab (playlist) box
|
||||
* @param name The name of the tab
|
||||
*/
|
||||
function showBox(name) {
|
||||
@ -202,7 +202,7 @@ function showBox(name) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Highlight a video thumbnail, including all duplicates that there may be
|
||||
/* Highlight a video thumbnail, including all duplicates that there may be
|
||||
* @param link The link <a> object that was clicked
|
||||
*/
|
||||
function setSelected(link) {
|
||||
@ -220,8 +220,8 @@ function setSelected(link) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Reveal and hide the long/short descriptions for a video in the playlist
|
||||
* @param link The link <a> object that was clicked
|
||||
/* Reveal and hide the long/short descriptions for a video in the playlist
|
||||
* @param link The link <a> object that was clicked
|
||||
*/
|
||||
function toggleDescription(link) {
|
||||
var aToggle = $(link);
|
||||
@ -238,9 +238,9 @@ function toggleDescription(link) {
|
||||
}
|
||||
|
||||
/* Add actions to the page onload event so that we load a video right away */
|
||||
addLoadEvent(function () {
|
||||
// if there's a video url in the hash, click that video
|
||||
if (location.href.indexOf("#v=") != -1) {
|
||||
addLoadEvent(function () {
|
||||
// if there's a video url in the hash, click that video
|
||||
if (location.href.indexOf("#v=") != -1) {
|
||||
var videoId = location.href.split("#v=");
|
||||
clickVideo(videoId[1]);
|
||||
} else { // otherwise, click the default video
|
||||
@ -251,20 +251,20 @@ addLoadEvent(function () {
|
||||
|
||||
var clickVideoAttempts = 0; // Used with clickVideo()
|
||||
|
||||
/* Click a video in order to load it and select it
|
||||
/* Click a video in order to load it and select it
|
||||
* @param videoId The ID of the video to click
|
||||
*/
|
||||
function clickVideo(videoId) {
|
||||
if ($("." + videoId).length != 0) { // if we find the video, click it and return
|
||||
$("." + videoId).addClass("noplay"); // add class to indicate we should NOT autoplay (class removed by loadVideo)
|
||||
$("." + videoId).addClass("noplay"); // add class to indicate we should NOT autoplay (class removed by loadVideo)
|
||||
$("." + videoId + ":first").click();
|
||||
return;
|
||||
} else { // if we don't find it, increment clickVideoAttempts
|
||||
console.log("video NOT found: " + videoId);
|
||||
clickVideoAttempts++;
|
||||
}
|
||||
|
||||
// if we don't find it after 20 attempts (2 seconds), click the first feature video
|
||||
|
||||
// if we don't find it after 20 attempts (2 seconds), click the first feature video
|
||||
if (clickVideoAttempts > 10) {
|
||||
console.log("video never found, clicking default...");
|
||||
clickVideoAttempts = 0;
|
||||
@ -278,15 +278,15 @@ function clickVideo(videoId) {
|
||||
function clickDefaultVideo() {
|
||||
if ($("#mainBodyRight .videoPreviews a:first").length != 0) {
|
||||
var videoId = $("#mainBodyRight .videoPreviews a:first").attr("class");
|
||||
$("." + videoId).addClass("noplay"); // add class to indicate we should NOT autoplay (class removed by loadVideo)
|
||||
$("." + videoId).addClass("noplay"); // add class to indicate we should NOT autoplay (class removed by loadVideo)
|
||||
$("." + videoId + ":first").click();
|
||||
return;
|
||||
} else { // if we don't find it, increment clickVideoAttempts
|
||||
console.log("default video NOT found");
|
||||
clickVideoAttempts++;
|
||||
}
|
||||
|
||||
// if we don't find it after 50 attempts (5 seconds), just fail
|
||||
|
||||
// if we don't find it after 50 attempts (5 seconds), just fail
|
||||
if (clickVideoAttempts > 50) {
|
||||
console.log("default video never found...");
|
||||
} else { // try again after 100 milliseconds
|
||||
@ -296,8 +296,8 @@ function clickDefaultVideo() {
|
||||
</script>
|
||||
|
||||
<div id="mainBodyFixed">
|
||||
|
||||
<div id="mainBodyLeft" class="videoPlayer" >
|
||||
|
||||
<div id="mainBodyLeft" class="videoPlayer" >
|
||||
<div id="videoPlayerBox">
|
||||
<div id="videoBorder">
|
||||
<div id="videoPlayerTitle"></div>
|
||||
@ -307,32 +307,32 @@ function clickDefaultVideo() {
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end mainBodyLeft -->
|
||||
|
||||
|
||||
<div id="mainBodyRight" class="videoPlayer">
|
||||
<h2>Featured Videos</h2>
|
||||
<ul class="videoPreviews"></ul>
|
||||
</div><!-- end mainBodyRight -->
|
||||
|
||||
|
||||
<ul id="videoTabs">
|
||||
<li id="aboutTab" class="selected"><a onclick="return showBox('about');" href="#">About the Platform</a></li>
|
||||
<li id="developertipsTab"><a onclick="return showBox('developertips');" href="#">Developer Tips</a></li>
|
||||
<li id="googleioTab"><a onclick="return showBox('googleio');" href="#">Google I/O Sessions</a></li>
|
||||
<li id="developersandboxTab"><a onclick="return showBox('developersandbox');" href="#">Developer Sandbox</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<div id="videos">
|
||||
<div id="aboutBox" class="selected"></div>
|
||||
<div id="developertipsBox"></div>
|
||||
<div id="googleioBox"></div>
|
||||
<div id="developersandboxBox"></div>
|
||||
</div>
|
||||
|
||||
|
||||
</div><!-- end mainBodyFixed -->
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
// Initialization actions
|
||||
showFeatured(); // load featured videos
|
||||
showPlaylists(); // load playlists
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user