handle old and new embed urls

This commit is contained in:
rolux 2013-07-12 12:33:09 +02:00
parent 34c0e98798
commit 7841572a20

View file

@ -30,21 +30,21 @@ appPanel
}); });
} catch(e) {} } catch(e) {}
}; };
function getLocalStorage(key) {
//fails if localStorage does not exist or // handle old embed and print URLs
//if third party cookies are disabled document.location.hash = document.location.hash.replace(
try { /^#(embed|print)=true(&)?/,
return localStorage[key]; function() {
} catch(e) {} return '#' + arguments[1] + (arguments[2] ? '?' : '');
} }
);
var animationInterval, var animationInterval,
enableDebugMode = getLocalStorage('pandora.enableDebugMode'), enableDebugMode = getLocalStorage('pandora.enableDebugMode'),
enableEventLogging = getLocalStorage('pandora.enableEventLogging'), enableEventLogging = getLocalStorage('pandora.enableEventLogging'),
isEmbed = /^#\?/.test(document.location.hash) isEmbed = /^#embed(\?.*?)?$/.test(document.location.hash),
&& /embed=true/.test(document.location.hash),
isMSIE = /MSIE/.test(navigator.userAgent), isMSIE = /MSIE/.test(navigator.userAgent),
isPrint = /^#\?/.test(document.location.hash) isPrint = /^#print(\?.*?)?$/.test(document.location.hash),
&& /print=true/.test(document.location.hash),
legacyThemes = {classic: 'oxlight', modern: 'oxdark'}, legacyThemes = {classic: 'oxlight', modern: 'oxdark'},
theme = getLocalStorage('Ox.theme') theme = getLocalStorage('Ox.theme')
&& JSON.parse(localStorage['Ox.theme']) || 'oxmedium'; && JSON.parse(localStorage['Ox.theme']) || 'oxmedium';
@ -58,6 +58,14 @@ appPanel
}); });
}); });
function getLocalStorage(key) {
// fails if localStorage does not exist or if third party cookies are
// disabled
try {
return localStorage[key];
} catch(e) {}
}
function getPandoraVersion() { function getPandoraVersion() {
var i, path, scripts = document.getElementsByTagName('script'); var i, path, scripts = document.getElementsByTagName('script');
for (i = 0;i < scripts.length; i++) { for (i = 0;i < scripts.length; i++) {