mirror of
https://github.com/onionshare/onionshare.git
synced 2024-12-27 08:19:41 -05:00
Use a more efficient way of parsing the path to /img on the static URL in order to load ajax.gif via receive.js
This commit is contained in:
parent
ce73138890
commit
21480a5117
@ -4,10 +4,8 @@ $(function(){
|
|||||||
$('#flashes').append($('<li>').addClass(category).text(message));
|
$('#flashes').append($('<li>').addClass(category).text(message));
|
||||||
};
|
};
|
||||||
|
|
||||||
var scriptEls = document.getElementsByTagName( 'script' );
|
var scriptSrc = document.getElementById('receive-script').src;
|
||||||
var thisScriptEl = scriptEls[scriptEls.length - 1];
|
var staticImgPath = scriptSrc.substr(0, scriptSrc.lastIndexOf( '/' )+1).replace('js', 'img');
|
||||||
var scriptPath = thisScriptEl.src;
|
|
||||||
var scriptFolder = scriptPath.substr(0, scriptPath.lastIndexOf( '/' )+1 );
|
|
||||||
|
|
||||||
// Intercept submitting the form
|
// Intercept submitting the form
|
||||||
$('#send').submit(function(event){
|
$('#send').submit(function(event){
|
||||||
@ -43,7 +41,7 @@ $(function(){
|
|||||||
// and update the status
|
// and update the status
|
||||||
if(event.loaded == event.total) {
|
if(event.loaded == event.total) {
|
||||||
$('.cancel', ajax.$upload_div).remove();
|
$('.cancel', ajax.$upload_div).remove();
|
||||||
$('.upload-status', ajax.$upload_div).html('<img src="' + scriptFolder + '../img/ajax.gif" alt="" /> Waiting for data to finish traversing Tor network ...');
|
$('.upload-status', ajax.$upload_div).html('<img src="' + staticImgPath + '/ajax.gif" alt="" /> Waiting for data to finish traversing Tor network ...');
|
||||||
}
|
}
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
|
@ -39,6 +39,6 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<script src="{{ static_url_path }}/js/jquery-3.5.1.min.js"></script>
|
<script src="{{ static_url_path }}/js/jquery-3.5.1.min.js"></script>
|
||||||
<script async src="{{ static_url_path }}/js/receive.js"></script>
|
<script async src="{{ static_url_path }}/js/receive.js" id="receive-script"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user