added dynamic document titles;
This commit is contained in:
@@ -19,6 +19,7 @@ javascripts:
|
||||
- public/javascripts/search.js
|
||||
- public/javascripts/store.js
|
||||
- public/javascripts/caching.js
|
||||
- public/javascripts/title.js
|
||||
- public/javascripts/ajax/*.js
|
||||
- public/javascripts/animations/*.js
|
||||
- public/javascripts/layout.js
|
||||
|
||||
@@ -43,14 +43,18 @@ function favourite_request(link, params){
|
||||
}
|
||||
|
||||
function load_site_request(link, params){
|
||||
changeDocumentTitle(link, params);
|
||||
|
||||
// proof given params
|
||||
params = (typeof params == "undefined" || typeof params == "boolean") ? "" : params;
|
||||
show_flash(false);
|
||||
|
||||
// request to object cache
|
||||
if(link != user_path)
|
||||
cacheResponse = cacheRequest(link+params);
|
||||
else cacheResponse = false;
|
||||
|
||||
hide_flash(true);
|
||||
hide_flash(true); // remove error messages if shown
|
||||
if(!cacheResponse)
|
||||
{
|
||||
console.info("=> Request to server");
|
||||
|
||||
@@ -14,6 +14,9 @@ var logout_path = "/logout";
|
||||
var favourite_path = "/favourize";
|
||||
var search_video_path = "/search_video";
|
||||
|
||||
// root title
|
||||
var documentTitle = "9minutes";
|
||||
|
||||
$(document).ready(function(){
|
||||
// home site
|
||||
Path.root("#!/home");
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
String.prototype.replaceAll = function(
|
||||
strTarget,
|
||||
strSubString
|
||||
){
|
||||
var strText = this;
|
||||
var intIndexOfMatch = strText.indexOf( strTarget );
|
||||
|
||||
while (intIndexOfMatch != -1)
|
||||
{
|
||||
strText = strText.replace( strTarget, strSubString )
|
||||
intIndexOfMatch = strText.indexOf( strTarget );
|
||||
}
|
||||
|
||||
return(strText);
|
||||
}
|
||||
|
||||
String.prototype.urifyAll = function(){
|
||||
var strText = this;
|
||||
var text = unescape(decodeURI(strText).replaceAll("+", " "));
|
||||
|
||||
return(text);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
function changeDocumentTitle(to, special)
|
||||
{
|
||||
special = (typeof special == "undefined" || typeof special == "boolean") ? null : special;
|
||||
|
||||
titleLink = (to.substring(to.length-1, to.length) == "/") ?
|
||||
to.substring(0, to.length-1) : to;
|
||||
|
||||
titleLink = titleLink.replaceAll("/","");
|
||||
|
||||
if(titleLink == "artists")
|
||||
{
|
||||
titleLink = special;
|
||||
special = null;
|
||||
}
|
||||
|
||||
document.title = documentTitle + " » " + titleLink.urifyAll();
|
||||
if (special) document.title += " » " + special.urifyAll();
|
||||
}
|
||||
Reference in New Issue
Block a user