From d85eaed45384be50b6a603cf896d30e82a427515 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Fri, 31 May 2013 21:17:57 +0000 Subject: [PATCH] load Ox.js with pandora version to avoid loading outdated version without clearing cache, fixes #1556 --- static/js/pandora.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/static/js/pandora.js b/static/js/pandora.js index ad8f2fc59..5d8502377 100644 --- a/static/js/pandora.js +++ b/static/js/pandora.js @@ -58,6 +58,15 @@ appPanel }); }); + function getPandoraVersion() { + var i, path, scripts = document.getElementsByTagName('script'); + for (i = 0;i < scripts.length; i++) { + if(/pandora.js/.test(scripts[i].src)) { + return scripts[1].src.replace(/.*\?/, ''); + } + } + } + function loadImages(callback) { // Opera doesn't fire onload for SVGs, // so we only wait for the PNG to load. @@ -167,7 +176,7 @@ appPanel } else { script.onload = callback; } - script.src = '/static/oxjs/' + (enableDebugMode ? 'dev' : 'build') + '/Ox.js'; + script.src = '/static/oxjs/' + (enableDebugMode ? 'dev' : 'build') + '/Ox.js?' + getPandoraVersion(); script.type = 'text/javascript'; head.appendChild(script); }