Fix hash parsing 3

This commit is contained in:
2019-12-08 10:30:45 +01:00
parent fed63345ca
commit c4d77d38b3

9
jquery/databap.js vendored
View File

@@ -99,11 +99,12 @@ function Databap()
if(!hash) return decodeURIComponent(window.location.hash.slice(1));
else
{
console.log('encoding: '+hash);
window.location.hash = '#'+encodeURIComponent(hash.slice(hash.substr(0, 1)=='#'?1:0));
//favicon, bug firefox
var link = $('link[rel="shortcut icon"]').remove().attr("href");
$('<link href="'+ link +'" rel="shortcut icon" type="image/x-icon" />').appendTo('head');
//var link = $('link[rel="shortcut icon"]').remove().attr("href");
//$('<link href="'+ link +'" rel="shortcut icon" type="image/x-icon" />').appendTo('head');
}
};
@@ -518,13 +519,15 @@ function Databap()
{
bAbsolute = bAbsolute || false;
if(sPage.length==1) sPage = self.vars.hash_to_page[sPage]; //if hash is provided instead of page
return (bAbsolute?self.vars.serv_name:'')+'#'+sPage+((iItemId>0 || iItemId!='')?'-'+escape($.trim(iItemId)):'');
return (bAbsolute?self.vars.serv_name:'')+'#'+sPage+((iItemId>0 || iItemId!='')?'-'+$.trim(iItemId):'');
};
this.goToInternalLink = function(sPage, iItemId, bFade)
{
self.vars2('fade', bFade || false);
console.log('goToInternalLink: '+iItemId);
iItemId = iItemId || 0;
var sHash = self.getInternalLink(sPage, iItemId).substr(1);
if(sHash==self.hash()) self.onHashChange({force:true});