修复修改后台路径之后,离线下载无法使用的bug

master
Abbey 5 years ago
parent 0fa021958e
commit be2e2cb6ae
  1. 32
      app/static/js/offdownload.js
  2. 33
      app/templates/admin/offdownload.html

@ -174,12 +174,12 @@ function ClearHist(){
);
}
function tellActive() {
function tellActive(admin_prefix) {
var defer = $.Deferred();
var getTimestamp=new Date().getTime();
$.ajax({
type: "POST",
url: "/admin/jsonrpc?t="+getTimestamp,
url: "/"+admin_prefix+"/jsonrpc?t="+getTimestamp,
data: { action:'tellActive' },
cache: false, //使用同步的方式,true为异步方式
// async: false, //使用同步的方式,true为异步方式
@ -261,17 +261,17 @@ function tellActive() {
},
complete:function(){
defer.promise();
tellFail();
tellFail(admin_prefix);
}
});
}
function tellFail() {
function tellFail(admin_prefix) {
var defer = $.Deferred();
var getTimestamp=new Date().getTime();
$.ajax({
type: "POST",
url: "/admin/jsonrpc?t="+getTimestamp,
url: "/"+admin_prefix+"/jsonrpc?t="+getTimestamp,
data: { action:'tellFail' },
cache: false, //使用同步的方式,true为异步方式
// async: false, //使用同步的方式,true为异步方式
@ -353,17 +353,17 @@ function tellFail() {
},
complete:function(){
defer.promise();
tellSuccess();
tellSuccess(admin_prefix);
}
});
}
function tellSuccess() {
function tellSuccess(admin_prefix) {
var defer = $.Deferred();
var getTimestamp=new Date().getTime();
$.ajax({
type: "POST",
url: "/admin/jsonrpc?t="+getTimestamp,
url: "/"+admin_prefix+"/jsonrpc?t="+getTimestamp,
data: { action:'tellSuccess' },
cache: false,
// async: false,
@ -437,18 +437,4 @@ function tellSuccess() {
}
});
}
function Refresh(){
tellActive();
}
var interval_id=null;
function AutoRefresh(){
if (interval_id){
window.clearInterval(interval_id);
}
interval_id = window.setInterval(function(){
if(need_refresh){
Refresh();
}
},2000);
}
AutoRefresh();

@ -55,7 +55,7 @@
</div>
</div>
<script type="text/javascript" src="/static/js/offdownload.js?t=201902264"></script>
<script type="text/javascript" src="/static/js/offdownload.js?t=20190524v1"></script>
<script>
{%if msg!=None%}
ShowNotice("{{msg}}");
@ -63,7 +63,7 @@ ShowNotice("{{msg}}");
function GetTreelist(user){
$.ajax({
type: "GET",
url: "/admin/treelists/"+user,
url: "/{{GetConfig('admin_prefix')}}/treelists/"+user,
async: false, //使用同步的方式,true为异步方式
dataType: "json",
success: function(data) {
@ -106,7 +106,7 @@ function AddLink() {
var defer = $.Deferred();
$.ajax({
type: "POST",
url: "/admin/off_download",
url: "/{{GetConfig('admin_prefix')}}/off_download",
data: { grand_path: $("#path").val(), urls: value, user: $("#user").val() },
// async: false, //使用同步的方式,true为异步方式
dataType: "json",
@ -131,15 +131,7 @@ function AddLink() {
});
});
}
function unescapeHtml(safe) {
return safe
.replace(/&amp;/g, "&")
.replace(/&lt;/g, "<")
.replace(/&gt;/g, ">")
.replace(/&quot;/g, "\"")
.replace(/%20;/g, " ")
.replace(/&#039;/g, "'");
}
$( document ).ready(function() {
var path = $(location).attr('hash').replace('#', '');
if (path){
@ -158,5 +150,22 @@ $( document ).ready(function() {
GetTreelist("{{cur_user}}");
}
});
function Refresh(){
tellActive("{{GetConfig('admin_prefix')}}");
}
var interval_id=null;
function AutoRefresh(){
if (interval_id){
window.clearInterval(interval_id);
}
interval_id = window.setInterval(function(){
if(need_refresh){
Refresh();
}
},2000);
}
AutoRefresh();
</script>
{%endblock content%}

Loading…
Cancel
Save