1
0
Fork 0

Fixed album url. Closes #44

This commit is contained in:
magnolia-fan 2011-06-17 19:13:47 +04:00
parent 48ab2826aa
commit 7e0db9074e
2 changed files with 11 additions and 14 deletions

View File

@ -2,7 +2,7 @@ var Ajax = {
loadArtistData: function(name) {
$('#search-container input').attr('disabled', 'disabled').blur();
$('#search-container img').show();
name = name.replace(' ', '+');
name = name.split(' ').join('+');
Ajax.setArchor('/artist/'+ name +'/');
$.get('/artist/'+ name +'/', function(data){
if (typeof data.error != 'undefined') {
@ -51,24 +51,20 @@ var Ajax = {
},
setArchor: function(anchor) {
window.location = '#'+ anchor;
window.location.hash = '#'+ anchor;
},
getAnchor: function() {
var tmp = window.location.href.split('#');
if (typeof tmp[1] !== 'undefined') {
return tmp[1];
}
return '';
return window.location.hash.substring(1);
},
detectStartPage: function() {
if (m = this.getAnchor().match(/\/artist\/(.+)\//)) {
this.loadArtistData(m[1]);
} else if (this.getAnchor() === '' || this.getAnchor().match(/\/search\//)) {
this.loadSearchPage();
detectPage: function() {
if (m = Ajax.getAnchor().match(/\/artist\/(.+)\//)) {
Ajax.loadArtistData(m[1]);
} else if (Ajax.getAnchor() === '' || Ajax.getAnchor().match(/\/search\//)) {
Ajax.loadSearchPage();
} else {
this.load404Page();
Ajax.load404Page();
}
}
}
@ -88,4 +84,5 @@ $(function(){
Ajax.loadArtistData($('#search_field').val());
return false;
});
$(window).bind('hashchange', Ajax.detectPage);
})

View File

@ -10,7 +10,7 @@ var beathaven = {
init: function () {
this.drawInterface();
this.adjustSizes();
Ajax.detectStartPage();
Ajax.detectPage();
},
drawInterface: function() {