Merge pull request #3809 from ngosang/webui_optim

[Web UI] Code cleanup and little change in contextual menu
This commit is contained in:
sledgehammer999 2015-11-01 17:38:55 -06:00
commit f7f23d2ae9
5 changed files with 50 additions and 83 deletions

View file

@ -116,9 +116,9 @@
</li> </li>
<li class="separator"><a href="#DownloadLimit"><img src="images/skin/download.png" alt="QBT_TR(Limit download rate...)QBT_TR"/> QBT_TR(Limit download rate...)QBT_TR</a></li> <li class="separator"><a href="#DownloadLimit"><img src="images/skin/download.png" alt="QBT_TR(Limit download rate...)QBT_TR"/> QBT_TR(Limit download rate...)QBT_TR</a></li>
<li><a href="#UploadLimit"><img src="images/skin/seeding.png" alt="QBT_TR(Limit upload rate...)QBT_TR"/> QBT_TR(Limit upload rate...)QBT_TR</a></li> <li><a href="#UploadLimit"><img src="images/skin/seeding.png" alt="QBT_TR(Limit upload rate...)QBT_TR"/> QBT_TR(Limit upload rate...)QBT_TR</a></li>
<li><a href="#SuperSeeding"><img src="theme/checked" alt="QBT_TR(Super seeding mode)QBT_TR"/> QBT_TR(Super seeding mode)QBT_TR</a></li>
<li class="separator"><a href="#SequentialDownload"><img src="theme/checked" alt="QBT_TR(Download in sequential order)QBT_TR"/> QBT_TR(Download in sequential order)QBT_TR</a></li> <li class="separator"><a href="#SequentialDownload"><img src="theme/checked" alt="QBT_TR(Download in sequential order)QBT_TR"/> QBT_TR(Download in sequential order)QBT_TR</a></li>
<li><a href="#FirstLastPiecePrio"><img src="theme/checked" alt="QBT_TR(Download first and last piece first)QBT_TR"/> QBT_TR(Download first and last piece first)QBT_TR</a></li> <li><a href="#FirstLastPiecePrio"><img src="theme/checked" alt="QBT_TR(Download first and last piece first)QBT_TR"/> QBT_TR(Download first and last piece first)QBT_TR</a></li>
<li class="separator"><a href="#SuperSeeding"><img src="theme/checked" alt="QBT_TR(Super seeding mode)QBT_TR"/> QBT_TR(Super seeding mode)QBT_TR</a></li>
<li class="separator"><a href="#ForceRecheck"><img src="theme/document-edit-verify" alt="QBT_TR(Force recheck)QBT_TR"/> QBT_TR(Force recheck)QBT_TR</a></li> <li class="separator"><a href="#ForceRecheck"><img src="theme/document-edit-verify" alt="QBT_TR(Force recheck)QBT_TR"/> QBT_TR(Force recheck)QBT_TR</a></li>
</ul> </ul>
<div id="desktopFooterWrapper"> <div id="desktopFooterWrapper">

View file

@ -12,9 +12,12 @@
$('addTrackersButton').addEvent('click', function(e){ $('addTrackersButton').addEvent('click', function(e){
new Event(e).stop(); new Event(e).stop();
var hash = new URI().getData('hash'); 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() { onComplete: function() {
window.parent.document.getElementById('trackersPage').parentNode.removeChild(window.parent.document.getElementById('trackersPage')); window.parent.closeWindows();
} }
}).send(); }).send();
}); });

View file

@ -6,60 +6,32 @@
<link rel="stylesheet" href="css/style.css" type="text/css" /> <link rel="stylesheet" href="css/style.css" type="text/css" />
<script type="text/javascript" src="scripts/mootools-1.2-core-yc.js" charset="utf-8"></script> <script type="text/javascript" src="scripts/mootools-1.2-core-yc.js" charset="utf-8"></script>
<script type="text/javascript" src="scripts/mootools-1.2-more.js" charset="utf-8"></script> <script type="text/javascript" src="scripts/mootools-1.2-more.js" charset="utf-8"></script>
<script type="text/javascript"> <script type="text/javascript">
function $get(key,url){ var hashes = new URI().getData('hashes').split('|');
if(arguments.length < 2) url =location.href;
if(arguments.length > 0 && key != ""){
if(key == "#"){
var regex = new RegExp("[#]([^$]*)");
} else if(key == "?"){
var regex = new RegExp("[?]([^#$]*)");
} else {
var regex = new RegExp("[?&]"+key+"=([^&#]*)");
}
var results = regex.exec(url);
return (results == null )? "" : results[1].replace(/%22/g, "'");
} else {
url = url.split("?");
var results = {};
if(url.length > 1){
url = url[1].split("#");
if(url.length > 1) results["hash"] = url[1];
url[0].split("&").each(function(item,index){
item = item.split("=");
results[item[0]] = item[1].replace(/%22/g, "'");
});
}
return results;
}
}
var hashes = $get('hashes').split(',');
window.addEvent('domready', function(){ window.addEvent('domready', function(){
$('cancelBtn').focus(); $('cancelBtn').focus();
$('cancelBtn').addEvent('click', function(e){ $('cancelBtn').addEvent('click', function(e){
new Event(e).stop(); new Event(e).stop();
window.parent.document.getElementById('confirmDeletionPage').parentNode.removeChild(window.parent.document.getElementById('confirmDeletionPage')); window.parent.closeWindows();
}); });
$('confirmBtn').addEvent('click', function(e){ $('confirmBtn').addEvent('click', function(e){
new Event(e).stop(); new Event(e).stop();
var cmd = 'command/delete'; var cmd = 'command/delete';
if($('deleteFromDiskCB').get('checked')) if($('deleteFromDiskCB').get('checked'))
cmd = 'command/deletePerm'; cmd = 'command/deletePerm';
new Request({url: cmd, new Request({
url: cmd,
method: 'post', method: 'post',
data: {hashes: hashes.join('|')}, data: {
'hashes': hashes.join('|')
},
onComplete: function() { onComplete: function() {
window.parent.document.getElementById('confirmDeletionPage').parentNode.removeChild(window.parent.document.getElementById('confirmDeletionPage')); window.parent.closeWindows();
} }
}).send(); }).send();
}); });
}); });
</script> </script>
</head> </head>
<body> <body>
<br/> <br/>

View file

@ -234,17 +234,12 @@ initializeWindows = function() {
deleteFN = function() { deleteFN = function() {
var h = myTable.selectedIds(); var h = myTable.selectedIds();
/*if(h.length && confirm('QBT_TR(Are you sure you want to delete the selected torrents from the transfer list?)QBT_TR')) {
h.each(function(item, index){
new Request({url: 'command/delete', method: 'post', data: {hash: item}}).send();
});
}*/
if (h.length) { if (h.length) {
new MochaUI.Window({ new MochaUI.Window({
id: 'confirmDeletionPage', id: 'confirmDeletionPage',
title: "QBT_TR(Deletion confirmation - qBittorrent)QBT_TR", title: "QBT_TR(Deletion confirmation)QBT_TR",
loadMethod: 'iframe', loadMethod: 'iframe',
contentURL: 'confirmdeletion.html?hashes=' + h.join(','), contentURL: 'confirmdeletion.html?hashes=' + h.join("|"),
scrollbars: false, scrollbars: false,
resizable: false, resizable: false,
maximizable: false, maximizable: false,

View file

@ -16,9 +16,6 @@
Delete : function (element, ref) { Delete : function (element, ref) {
deleteFN(); deleteFN();
}, },
DeleteHD : function (element, ref) {
deleteHDFN();
},
Start : function (element, ref) { Start : function (element, ref) {
startFN(); startFN();
}, },