added dynamic document titles;
This commit is contained in:
@@ -19,6 +19,7 @@ javascripts:
|
|||||||
- public/javascripts/search.js
|
- public/javascripts/search.js
|
||||||
- public/javascripts/store.js
|
- public/javascripts/store.js
|
||||||
- public/javascripts/caching.js
|
- public/javascripts/caching.js
|
||||||
|
- public/javascripts/title.js
|
||||||
- public/javascripts/ajax/*.js
|
- public/javascripts/ajax/*.js
|
||||||
- public/javascripts/animations/*.js
|
- public/javascripts/animations/*.js
|
||||||
- public/javascripts/layout.js
|
- public/javascripts/layout.js
|
||||||
|
|||||||
@@ -43,14 +43,18 @@ function favourite_request(link, params){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function load_site_request(link, params){
|
function load_site_request(link, params){
|
||||||
|
changeDocumentTitle(link, params);
|
||||||
|
|
||||||
|
// proof given params
|
||||||
params = (typeof params == "undefined" || typeof params == "boolean") ? "" : params;
|
params = (typeof params == "undefined" || typeof params == "boolean") ? "" : params;
|
||||||
show_flash(false);
|
show_flash(false);
|
||||||
|
|
||||||
|
// request to object cache
|
||||||
if(link != user_path)
|
if(link != user_path)
|
||||||
cacheResponse = cacheRequest(link+params);
|
cacheResponse = cacheRequest(link+params);
|
||||||
else cacheResponse = false;
|
else cacheResponse = false;
|
||||||
|
|
||||||
hide_flash(true);
|
hide_flash(true); // remove error messages if shown
|
||||||
if(!cacheResponse)
|
if(!cacheResponse)
|
||||||
{
|
{
|
||||||
console.info("=> Request to server");
|
console.info("=> Request to server");
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ var logout_path = "/logout";
|
|||||||
var favourite_path = "/favourize";
|
var favourite_path = "/favourize";
|
||||||
var search_video_path = "/search_video";
|
var search_video_path = "/search_video";
|
||||||
|
|
||||||
|
// root title
|
||||||
|
var documentTitle = "9minutes";
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
// home site
|
// home site
|
||||||
Path.root("#!/home");
|
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