Permalink
Browse files

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

  • Loading branch information...
1 parent 66f8fbb commit af0d465de6f7b0d4840836118a94b54a23e76acf @dreasgrech committed Feb 6, 2012
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
@@ -25,6 +25,7 @@
<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>
<script src="js/link.js"></script>
View
@@ -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,15 +376,13 @@ window.fbAsyncInit = function () {
}
});
-
box.click(function (e) {
var element = matrices.getElementUnderMouse(e.pageX, e.pageY);
if (!element) {
return;
}
-
showVideoModalDialog(element, false);
});
View
@@ -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
@@ -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);
+ }
+ };
+}());

0 comments on commit af0d465

Please sign in to comment.