From 21480a51177d22dd3c75670c363d4b1ba3bb43c9 Mon Sep 17 00:00:00 2001 From: Miguel Jacq Date: Mon, 8 Jun 2020 09:54:52 +1000 Subject: [PATCH] Use a more efficient way of parsing the path to /img on the static URL in order to load ajax.gif via receive.js --- share/static/js/receive.js | 8 +++----- share/templates/receive.html | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/share/static/js/receive.js b/share/static/js/receive.js index 30b6a46d..eac67412 100644 --- a/share/static/js/receive.js +++ b/share/static/js/receive.js @@ -4,10 +4,8 @@ $(function(){ $('#flashes').append($('
  • ').addClass(category).text(message)); }; - var scriptEls = document.getElementsByTagName( 'script' ); - var thisScriptEl = scriptEls[scriptEls.length - 1]; - var scriptPath = thisScriptEl.src; - var scriptFolder = scriptPath.substr(0, scriptPath.lastIndexOf( '/' )+1 ); + var scriptSrc = document.getElementById('receive-script').src; + var staticImgPath = scriptSrc.substr(0, scriptSrc.lastIndexOf( '/' )+1).replace('js', 'img'); // Intercept submitting the form $('#send').submit(function(event){ @@ -43,7 +41,7 @@ $(function(){ // and update the status if(event.loaded == event.total) { $('.cancel', ajax.$upload_div).remove(); - $('.upload-status', ajax.$upload_div).html(' Waiting for data to finish traversing Tor network ...'); + $('.upload-status', ajax.$upload_div).html(' Waiting for data to finish traversing Tor network ...'); } }, false); diff --git a/share/templates/receive.html b/share/templates/receive.html index 26d87ac1..b7e7f8e5 100644 --- a/share/templates/receive.html +++ b/share/templates/receive.html @@ -39,6 +39,6 @@ - +