Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

The title of the page now changes depending on which video is opened

  • Loading branch information...
commit af0d465de6f7b0d4840836118a94b54a23e76acf 1 parent 66f8fbb
@dreasgrech authored
Showing with 24 additions and 6 deletions.
  1. +1 −0  index.htm
  2. +2 −2 js/main.js
  3. +1 −4 js/service.js
  4. +20 −0 js/titlebuilder.js
View
1  index.htm
@@ -25,6 +25,7 @@
<script src="js/external/swfobject.js"></script>
<script src="js/pojo.js"></script>
<script src="js/helpers.js"></script>
+ <script src="js/querystring.js"></script>
<script src="js/titlebuilder.js"></script>
<script src="js/requestHandler.js"></script>
<script src="js/youtubeplayer.js"></script>
View
4 js/main.js
@@ -314,6 +314,7 @@ window.fbAsyncInit = function () {
}
var videoID = youtubeEmbedBuilder.getVideoID(element.url);
+ titleBuilder.setVideoTitle(element.name);
dialog.html('').append(constructVideoModalContents(element));
dialog.dialog({title: element.name});
@@ -339,6 +340,7 @@ window.fbAsyncInit = function () {
close: function () {
lastElementClicked.actionDone = false; // reset it so that an action request can be sent next time this video is opened in the dialog again.
lastDialogOpened.remove();
+ titleBuilder.setVideoTitle(); // Remove the video name from the title of the page
}
});
@@ -374,7 +376,6 @@ window.fbAsyncInit = function () {
}
});
-
box.click(function (e) {
var element = matrices.getElementUnderMouse(e.pageX, e.pageY);
@@ -382,7 +383,6 @@ window.fbAsyncInit = function () {
return;
}
-
showVideoModalDialog(element, false);
});
View
5 js/service.js
@@ -88,9 +88,6 @@ var service = function (matrices, postsPerRow, box, bodyWidth, postWidth, postHe
logger.log('Fetching from ' + url);
}
},
- buildTitle = function (name) {
- return "YouTube Collage - " + name;
- },
obj = {
getValidLinks: function (links) {
throw "No override";
@@ -108,7 +105,7 @@ var service = function (matrices, postsPerRow, box, bodyWidth, postWidth, postHe
fetch: fetch,
renderInfo: function (info) {
info.icon && $("#favicon").attr('href', info.icon);
- $("title").html(buildTitle(info.name));
+ titleBuilder.setObjectTitle(info.name);
$("#grouptitle").html(info.name);
$("#groupdescription").html(info.description);
$("#grouplink").attr('href', info.link);
View
20 js/titlebuilder.js
@@ -0,0 +1,20 @@
+var titleBuilder = (function () {
+ var DELIMITER = ' - ',
+ title = $("title"),
+ defaultTitle = "YouTube Collage",
+ objectTitle,
+ getObjectTitle = function () {
+ return defaultTitle + DELIMITER + objectTitle;
+ };
+
+ return {
+ setObjectTitle: function (ot) {
+ objectTitle = ot;
+ title.html(getObjectTitle());
+ },
+ setVideoTitle: function (videoTitle) {
+ var fullTitle = getObjectTitle() + (videoTitle ? (DELIMITER + videoTitle) : '');
+ title.html(fullTitle);
+ }
+ };
+}());
Please sign in to comment.
Something went wrong with that request. Please try again.