Browse Source

Web UI: Stop using absolute URLs in ajax requests (closes #1011226)

adaptive-webui-19844
Christophe Dumez 13 years ago
parent
commit
81e4e39878
  1. 2
      src/webui/html/addtrackers.html
  2. 4
      src/webui/html/confirmdeletion.html
  3. 4
      src/webui/html/downloadlimit.html
  4. 2
      src/webui/html/preferences_content.html
  5. 2
      src/webui/html/prop-files.html
  6. 2
      src/webui/html/upload.html
  7. 4
      src/webui/html/uploadlimit.html
  8. 2
      src/webui/scripts/download.js
  9. 14
      src/webui/scripts/mocha-init.js
  10. 8
      src/webui/scripts/parametrics.js

2
src/webui/html/addtrackers.html

@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
$('addTrackersButton').addEvent('click', function(e){
new Event(e).stop();
var hash = new URI().getData('hash');
new Request({url: '/command/addTrackers', method: 'post', data: {hash: hash, urls: $('trackersUrls').value},
new Request({url: 'command/addTrackers', method: 'post', data: {hash: hash, urls: $('trackersUrls').value},
onComplete: function() {
window.parent.document.getElementById('trackersPage').parentNode.removeChild(window.parent.document.getElementById('trackersPage'));
}

4
src/webui/html/confirmdeletion.html

@ -45,9 +45,9 @@ window.addEvent('domready', function(){ @@ -45,9 +45,9 @@ window.addEvent('domready', function(){
});
$('confirmBtn').addEvent('click', function(e){
new Event(e).stop();
var cmd = '/command/delete';
var cmd = 'command/delete';
if($('deleteFromDiskCB').get('checked'))
cmd = '/command/deletePerm';
cmd = 'command/deletePerm';
new Request({url: cmd,
method: 'post',
data: {hashes: hashes.join('|')},

4
src/webui/html/downloadlimit.html

@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
setDlLimit = function() {
var limit = $("dllimitUpdatevalue").get('html').toInt() * 1024;
if(hash == "global") {
new Request({url: '/command/setGlobalDlLimit',
new Request({url: 'command/setGlobalDlLimit',
method: 'post',
data: {'limit': limit},
onComplete: function() {
@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
}
}).send();
} else {
new Request({url: '/command/setTorrentDlLimit',
new Request({url: 'command/setTorrentDlLimit',
method: 'post',
data: {'hash': hash, 'limit': limit},
onComplete: function() {

2
src/webui/html/preferences_content.html

@ -1043,7 +1043,7 @@ applyPreferences = function() { @@ -1043,7 +1043,7 @@ applyPreferences = function() {
// Send it to qBT
var json_str = JSON.encode(settings);
new Request({url: '/command/setPreferences',
new Request({url: 'command/setPreferences',
method: 'post',
data: {'json': json_str,
},

2
src/webui/html/prop-files.html

@ -88,7 +88,7 @@ var allCBUnchecked = function() { @@ -88,7 +88,7 @@ var allCBUnchecked = function() {
var setFilePriority = function(id, priority) {
if(current_hash == "") return;
new Request({url: '/command/setFilePrio', method: 'post', data: {'hash': current_hash, 'id': id, 'priority': priority}}).send();
new Request({url: 'command/setFilePrio', method: 'post', data: {'hash': current_hash, 'id': id, 'priority': priority}}).send();
// Display or add combobox
if(priority > 0) {
$('comboPrio'+id).set("value", 1);

2
src/webui/html/upload.html

@ -15,7 +15,7 @@ function hideAll() { @@ -15,7 +15,7 @@ function hideAll() {
<iframe id="upload_frame" name="upload_frame" style="width:1px;height:1px;border:0px;" src="javascript:false;"></iframe>
<center>
<h1 class="vcenter"><img class="vcenter" title="Download local torrent" src="theme/list-add"/>_(Download local torrent)</h1>
<form action="/command/upload" enctype="multipart/form-data" method="post" id="uploadForm" target="upload_frame">
<form action="command/upload" enctype="multipart/form-data" method="post" id="uploadForm" target="upload_frame">
<input type="file" name="torrentfile" id="torrentfile" size="40"/><br/><br/>
<input type="submit" value="_(Download)" id="upButton"/>
</form>

4
src/webui/html/uploadlimit.html

@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
setUpLimit = function() {
var limit = $("uplimitUpdatevalue").get('html').toInt() * 1024;
if(hash == "global") {
new Request({url: '/command/setGlobalUpLimit',
new Request({url: 'command/setGlobalUpLimit',
method: 'post',
data: {'limit': limit},
onComplete: function() {
@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
}
}).send();
}else {
new Request({url: '/command/setTorrentUpLimit',
new Request({url: 'command/setTorrentUpLimit',
method: 'post',
data: {'hash': hash, 'limit': limit},
onComplete: function() {

2
src/webui/scripts/download.js

@ -25,7 +25,7 @@ window.addEvent('domready', function(){ @@ -25,7 +25,7 @@ window.addEvent('domready', function(){
$('urls').focus();
$('downButton').addEvent('click', function(e){
new Event(e).stop();
new Request({url: '/command/download', method: 'post', data: {urls: $('urls').value},
new Request({url: 'command/download', method: 'post', data: {urls: $('urls').value},
onComplete: function() {
window.parent.document.getElementById('downloadPage').parentNode.removeChild(window.parent.document.getElementById('downloadPage'));
}

14
src/webui/scripts/mocha-init.js

@ -152,7 +152,7 @@ initializeWindows = function(){ @@ -152,7 +152,7 @@ initializeWindows = function(){
var h = myTable.selectedIds();
/*if(h.length && confirm('_(Are you sure you want to delete the selected torrents from the transfer list?)')) {
h.each(function(item, index){
new Request({url: '/command/delete', method: 'post', data: {hash: item}}).send();
new Request({url: 'command/delete', method: 'post', data: {hash: item}}).send();
});
}*/
if(h.length) {
@ -180,7 +180,7 @@ initializeWindows = function(){ @@ -180,7 +180,7 @@ initializeWindows = function(){
var h = myTable.selectedIds();
if(h.length){
h.each(function(hash, index){
new Request({url: '/command/pause', method: 'post', data: {hash: hash}}).send();
new Request({url: 'command/pause', method: 'post', data: {hash: hash}}).send();
});
}
};
@ -189,7 +189,7 @@ initializeWindows = function(){ @@ -189,7 +189,7 @@ initializeWindows = function(){
var h = myTable.selectedIds();
if(h.length){
h.each(function(hash, index){
new Request({url: '/command/resume', method: 'post', data: {hash: hash}}).send();
new Request({url: 'command/resume', method: 'post', data: {hash: hash}}).send();
});
}
};
@ -198,7 +198,7 @@ initializeWindows = function(){ @@ -198,7 +198,7 @@ initializeWindows = function(){
var h = myTable.selectedIds();
if(h.length){
h.each(function(hash, index){
new Request({url: '/command/recheck', method: 'post', data: {hash: hash}}).send();
new Request({url: 'command/recheck', method: 'post', data: {hash: hash}}).send();
});
}
};
@ -209,14 +209,14 @@ initializeWindows = function(){ @@ -209,14 +209,14 @@ initializeWindows = function(){
var h = myTable.selectedIds();
if(h.length){
h.each(function(hash, index){
new Request({url: '/command/'+item, method: 'post', data: {hash: hash}}).send();
new Request({url: 'command/'+item, method: 'post', data: {hash: hash}}).send();
});
}
});
addClickEvent(item+'All', function(e){
new Event(e).stop();
new Request({url: '/command/'+item+'all'}).send();
new Request({url: 'command/'+item+'all'}).send();
});
});
@ -230,7 +230,7 @@ initializeWindows = function(){ @@ -230,7 +230,7 @@ initializeWindows = function(){
setPriorityFN = function(cmd) {
var h = myTable.selectedIds();
if(h.length) {
new Request({url: '/command/'+cmd, method: 'post', data: {hashes: h.join("|")}}).send();
new Request({url: 'command/'+cmd, method: 'post', data: {hashes: h.join("|")}}).send();
}
}

8
src/webui/scripts/parametrics.js

@ -22,7 +22,7 @@ MochaUI.extend({ @@ -22,7 +22,7 @@ MochaUI.extend({
// Get global upload limit
var maximum = 500;
var req = new Request({
url: '/command/getGlobalUpLimit',
url: 'command/getGlobalUpLimit',
method: 'post',
data: {},
onSuccess: function(data) {
@ -64,7 +64,7 @@ MochaUI.extend({ @@ -64,7 +64,7 @@ MochaUI.extend({
}
} else {
var req = new Request({
url: '/command/getTorrentUpLimit',
url: 'command/getTorrentUpLimit',
method: 'post',
data: {hash: hash},
onSuccess: function(data) {
@ -109,7 +109,7 @@ MochaUI.extend({ @@ -109,7 +109,7 @@ MochaUI.extend({
// Get global upload limit
var maximum = 500;
var req = new Request({
url: '/command/getGlobalDlLimit',
url: 'command/getGlobalDlLimit',
method: 'post',
data: {},
onSuccess: function(data) {
@ -151,7 +151,7 @@ MochaUI.extend({ @@ -151,7 +151,7 @@ MochaUI.extend({
}
} else {
var req = new Request({
url: '/command/getTorrentDlLimit',
url: 'command/getTorrentDlLimit',
method: 'post',
data: {hash: hash},
onSuccess: function(data) {

Loading…
Cancel
Save