diff --git a/public/javascripts/application.js b/public/javascripts/application.js index b90011a4f..ce5a960cf 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -863,6 +863,10 @@ function redo() { window.location.reload() } +function encodeHomeworkUrl(url){ + var file = encodeURI(url).replace(/\+/g, '%2B'); + return '/zipdown/download?file='+file; +} //// 作业附件删除 $(function(){ @@ -880,8 +884,7 @@ $(function(){ } if(res.length==1){ - var file = encodeURI(res[0].file).replace(/\+/g, '%2B'); - location.href = '/zipdown/download?file='+file;return; + location.href = encodeHomeworkUrl(res[0].file);return; } document.getElementById('light').style.display='block'; @@ -894,7 +897,7 @@ $(function(){ } else { des = '第'+res[i].index+'个学生的作品下载'; } - $('
  • '+(i+1)+'. '+des+'  (共'+res[i].size+'M)
  • ').appendTo($container); + $('
  • '+(i+1)+'. '+des+'  (共'+res[i].size+'M)
  • ').appendTo($container); } } @@ -911,7 +914,7 @@ $(function(){ else { if(res.length==1){ - location.href = '/zipdown/download?file='+res[0].file;return; + location.href = encodeHomeworkUrl(res[0].file);return; } document.getElementById('light').style.display='block'; $container = $('#light .upload_box_ul'); @@ -923,7 +926,7 @@ $(function(){ } else { des = '第'+res[i].index+'个学生的作品下载'; } - $('
  • '+(i+1)+'. '+des+'  (共'+res[i].size+'M)
  • ').appendTo($container); + $('
  • '+(i+1)+'. '+des+'  (共'+res[i].size+'M)
  • ').appendTo($container); } }