Browse Source

Apply formatting to Web UI files

adaptive-webui-19844
Chocobo1 7 years ago
parent
commit
cf2c0bd47e
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 13
      src/webui/www/private/addtrackers.html
  2. 19
      src/webui/www/private/confirmdeletion.html
  3. 3
      src/webui/www/private/css/Layout.css
  4. 12
      src/webui/www/private/css/Window.css
  5. 7
      src/webui/www/private/css/dynamicTable.css
  6. 77
      src/webui/www/private/css/style.css
  7. 112
      src/webui/www/private/download.html
  8. 21
      src/webui/www/private/downloadlimit.html
  9. 26
      src/webui/www/private/filters.html
  10. 7
      src/webui/www/private/index.html
  11. 16
      src/webui/www/private/newcategory.html
  12. 37
      src/webui/www/private/preferences.html
  13. 580
      src/webui/www/private/preferences_content.html
  14. 96
      src/webui/www/private/properties_content.html
  15. 11
      src/webui/www/private/rename.html
  16. 197
      src/webui/www/private/scripts/client.js
  17. 47
      src/webui/www/private/scripts/contextmenu.js
  18. 258
      src/webui/www/private/scripts/dynamicTable.js
  19. 18
      src/webui/www/private/scripts/misc.js
  20. 16
      src/webui/www/private/scripts/mocha-init.js
  21. 4
      src/webui/www/private/scripts/prop-files.js
  22. 4
      src/webui/www/private/scripts/prop-general.js
  23. 4
      src/webui/www/private/scripts/prop-trackers.js
  24. 4
      src/webui/www/private/scripts/prop-webseeds.js
  25. 11
      src/webui/www/private/setlocation.html
  26. 47
      src/webui/www/private/transferlist.html
  27. 106
      src/webui/www/private/upload.html
  28. 21
      src/webui/www/private/uploadlimit.html
  29. 11
      src/webui/www/public/login.html

13
src/webui/www/private/addtrackers.html

@ -1,5 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="${LANG}"> <html lang="${LANG}">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<title>QBT_TR(Trackers addition dialog)QBT_TR[CONTEXT=TrackersAdditionDlg]</title> <title>QBT_TR(Trackers addition dialog)QBT_TR[CONTEXT=TrackersAdditionDlg]</title>
@ -7,9 +8,9 @@
<script src="scripts/lib/mootools-1.2-core-yc.js"></script> <script src="scripts/lib/mootools-1.2-core-yc.js"></script>
<script src="scripts/lib/mootools-1.2-more.js"></script> <script src="scripts/lib/mootools-1.2-more.js"></script>
<script> <script>
window.addEvent('domready', function(){ window.addEvent('domready', function() {
$('trackersUrls').focus(); $('trackersUrls').focus();
$('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({ new Request({
@ -27,13 +28,15 @@
}); });
</script> </script>
</head> </head>
<body> <body>
<div style="text-align: center;"> <div style="text-align: center;">
<br/> <br/>
<h2 class="vcenter">QBT_TR(List of trackers to add (one per line):)QBT_TR[CONTEXT=TrackersAdditionDlg]</h2> <h2 class="vcenter">QBT_TR(List of trackers to add (one per line):)QBT_TR[CONTEXT=TrackersAdditionDlg]</h2>
<textarea name="list" id="trackersUrls" rows="10" cols="1"></textarea> <textarea name="list" id="trackersUrls" rows="10" cols="1"></textarea>
<br/> <br/>
<input type="button" value="QBT_TR(Add)QBT_TR[CONTEXT=HttpServer]" id="addTrackersButton"/> <input type="button" value="QBT_TR(Add)QBT_TR[CONTEXT=HttpServer]" id="addTrackersButton" />
</div> </div>
</body> </body>
</html> </html>

19
src/webui/www/private/confirmdeletion.html

@ -1,5 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="${LANG}"> <html lang="${LANG}">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<title>QBT_TR(Deletion confirmation - qBittorrent)QBT_TR[CONTEXT=confirmDeletionDlg]</title> <title>QBT_TR(Deletion confirmation - qBittorrent)QBT_TR[CONTEXT=confirmDeletionDlg]</title>
@ -8,13 +9,13 @@
<script src="scripts/lib/mootools-1.2-more.js"></script> <script src="scripts/lib/mootools-1.2-more.js"></script>
<script> <script>
var hashes = new URI().getData('hashes').split('|'); var hashes = new URI().getData('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.closeWindows(); window.parent.closeWindows();
}); });
$('confirmBtn').addEvent('click', function(e){ $('confirmBtn').addEvent('click', function(e) {
parent.torrentsTable.deselectAll(); parent.torrentsTable.deselectAll();
new Event(e).stop(); new Event(e).stop();
var cmd = 'api/v2/torrents/delete'; var cmd = 'api/v2/torrents/delete';
@ -34,13 +35,15 @@
}); });
</script> </script>
</head> </head>
<body> <body>
<br/> <br/>
<p>&nbsp;&nbsp;QBT_TR(Are you sure you want to delete the selected torrents from the transfer list?)QBT_TR[CONTEXT=HttpServer]</p> <p>&nbsp;&nbsp;QBT_TR(Are you sure you want to delete the selected torrents from the transfer list?)QBT_TR[CONTEXT=HttpServer]</p>
&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="deleteFromDiskCB"/> <label for="deleteFromDiskCB"><i>QBT_TR(Also delete the files on the hard disk)QBT_TR[CONTEXT=confirmDeletionDlg]</i></label><br/><br/> &nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="deleteFromDiskCB" /> <label for="deleteFromDiskCB"><i>QBT_TR(Also delete the files on the hard disk)QBT_TR[CONTEXT=confirmDeletionDlg]</i></label><br/><br/>
<div style="text-align: right;"> <div style="text-align: right;">
<input type="button" id="cancelBtn" value="QBT_TR(No)QBT_TR[CONTEXT=MainWindow]" />&nbsp;&nbsp;<input type="button" id="confirmBtn" value="QBT_TR(Yes)QBT_TR[CONTEXT=MainWindow]"/>&nbsp;&nbsp; <input type="button" id="cancelBtn" value="QBT_TR(No)QBT_TR[CONTEXT=MainWindow]" />&nbsp;&nbsp;<input type="button" id="confirmBtn" value="QBT_TR(Yes)QBT_TR[CONTEXT=MainWindow]" />&nbsp;&nbsp;
</div> </div>
</body> </body>
</html> </html>

3
src/webui/www/private/css/Layout.css

@ -186,7 +186,8 @@ body {
color: #3f3f3f; color: #3f3f3f;
font-weight: normal; font-weight: normal;
/* Fix By Chris */ /* Fix By Chris */
padding: 1px 10px 1px 20px; /* Reduce left padding */ padding: 1px 10px 1px 20px;
/* Reduce left padding */
} }
#desktopNavbar li ul li a:hover { #desktopNavbar li ul li a:hover {

12
src/webui/www/private/css/Window.css

@ -24,8 +24,7 @@ Required by:
background-color: #e5e5e5; background-color: #e5e5e5;
} }
.mocha.isFocused { .mocha.isFocused {}
}
.mochaOverlay { .mochaOverlay {
position: absolute; /* This is also set in theme.js in order to make theme transitions smoother */ position: absolute; /* This is also set in theme.js in order to make theme transitions smoother */
@ -181,7 +180,7 @@ div.mochaToolbarWrapper.bottom {
.mochaCloseButton { .mochaCloseButton {
} }
.mochaSpinner{ .mochaSpinner {
display: none; display: none;
position: absolute; position: absolute;
bottom: 7px; bottom: 7px;
@ -255,7 +254,8 @@ div.mochaToolbarWrapper.bottom {
/* The replaced class is used internally when converting CSS values to Canvas. These classes should not be removed. */ /* The replaced class is used internally when converting CSS values to Canvas. These classes should not be removed. */
.mocha.replaced, .mochaTitlebar.replaced, .mochaMinimizeButton.replaced, .mochaMaximizeButton.replaced, .mochaCloseButton.replaced { .mocha.replaced, .mochaTitlebar.replaced, .mochaMinimizeButton.replaced,
.mochaMaximizeButton.replaced, .mochaCloseButton.replaced {
background-color: transparent !important; background-color: transparent !important;
} }
@ -269,7 +269,8 @@ div.mochaToolbarWrapper.bottom {
overflow: hidden; overflow: hidden;
} }
.windowClosed .mochaContentBorder, .windowClosed .mochaToolbarWrapper, .windowClosed .mochaTitlebar, .windowClosed .mochaControls, .windowClosed .mochaContentBorder, .windowClosed .mochaToolbarWrapper,
.windowClosed .mochaTitlebar, .windowClosed .mochaControls,
.windowClosed .mochaCanvasControls { .windowClosed .mochaCanvasControls {
position: absolute; position: absolute;
top: 0; top: 0;
@ -371,6 +372,7 @@ div.mochaToolbarWrapper.bottom {
} }
/* Workaround to make invisible buttons clickable */ /* Workaround to make invisible buttons clickable */
.mochaMinimizeButton.replaced, .mochaMinimizeButton.replaced,
.mochaMaximizeButton.replaced, .mochaMaximizeButton.replaced,
.mochaCloseButton.replaced { .mochaCloseButton.replaced {

7
src/webui/www/private/css/dynamicTable.css

@ -1,11 +1,10 @@
/************************************************************** /**************************************************************
Dynamic Table Dynamic Table
v 0.4 v 0.4
**************************************************************/ **************************************************************/
.dynamicTable tbody tr { .dynamicTable tbody tr {
background-color: #fff; background-color: #fff;
} }
@ -45,7 +44,7 @@ tr.dynamicTableHeader {
.dynamicTable { .dynamicTable {
table-layout: fixed; table-layout: fixed;
width :1%; width: 1%;
padding: 0; padding: 0;
border-spacing: 0; border-spacing: 0;
} }
@ -63,7 +62,7 @@ tr.dynamicTableHeader {
} }
.dynamicTable td { .dynamicTable td {
padding:0px 4px; padding: 0px 4px;
white-space: nowrap; white-space: nowrap;
} }

77
src/webui/www/private/css/style.css

@ -1,9 +1,16 @@
/* Reset */ /* Reset */
/*ul,ol,dl,li,dt,dd,h1,h2,h3,h4,h5,h6,pre,form,body,html,p,blockquote,fieldset,input,object,iframe { margin: 0; padding: 0; }*/ /*ul,ol,dl,li,dt,dd,h1,h2,h3,h4,h5,h6,pre,form,body,html,p,blockquote,fieldset,input,object,iframe { margin: 0; padding: 0; }*/
a img,:link img,:visited img { border: none; }
a img, :link img, :visited img {
border: none;
}
/*table { border-collapse: collapse; border-spacing: 0; }*/ /*table { border-collapse: collapse; border-spacing: 0; }*/
:focus { outline: none; }
:focus {
outline: none;
}
/* Structure */ /* Structure */
@ -100,7 +107,7 @@ pre {
margin: 0 0 10px 0; margin: 0 0 10px 0;
padding: 10px; padding: 10px;
border: 1px solid #d1d7dc; border: 1px solid #d1d7dc;
} }
/* Dividers */ /* Dividers */
@ -116,13 +123,13 @@ hr {
} }
#urls { #urls {
width:90%; width: 90%;
height:100%; height: 100%;
} }
#trackersUrls { #trackersUrls {
width:90%; width: 90%;
height:100%; height: 100%;
} }
#Filters ul { #Filters ul {
@ -172,39 +179,69 @@ a.propButton img {
/* context menu specific */ /* context menu specific */
.contextMenu { border:1px solid #999; padding:0; background:#eee; list-style-type:none; display:none;} .contextMenu {
.contextMenu .separator { border-top:1px solid #999; } border: 1px solid #999;
.contextMenu li { margin:0; padding:0;} padding: 0;
background: #eee;
list-style-type: none;
display: none;
}
.contextMenu .separator {
border-top: 1px solid #999;
}
.contextMenu li {
margin: 0;
padding: 0;
}
.contextMenu li a { .contextMenu li a {
display: block; display: block;
padding: 5px 20px 5px 5px; padding: 5px 20px 5px 5px;
font-size: 12px; font-size: 12px;
text-decoration: none; text-decoration: none;
font-family: tahoma,arial,sans-serif; font-family: tahoma, arial, sans-serif;
color: #000; color: #000;
white-space: nowrap; white-space: nowrap;
} }
.contextMenu li a:hover { background-color:#ddd; }
.contextMenu li a.disabled { color:#ccc; font-style:italic; } .contextMenu li a:hover {
.contextMenu li a.disabled:hover { background-color:#eee; } background-color: #ddd;
}
.contextMenu li a.disabled {
color: #ccc;
font-style: italic;
}
.contextMenu li a.disabled:hover {
background-color: #eee;
}
.contextMenu li ul { .contextMenu li ul {
padding: 0; padding: 0;
border:1px solid #999; padding:0; background:#eee; border: 1px solid #999;
list-style-type:none; padding: 0;
background: #eee;
list-style-type: none;
position: absolute; position: absolute;
left: -999em; left: -999em;
z-index: 8000; z-index: 8000;
margin: -29px 0 0 100%; margin: -29px 0 0 100%;
width: 164px; width: 164px;
} }
.contextMenu li ul li a { .contextMenu li ul li a {
position: relative; position: relative;
} }
.contextMenu li a.arrow-right, .contextMenu li a:hover.arrow-right { .contextMenu li a.arrow-right, .contextMenu li a:hover.arrow-right {
background-image: url(../images/skin/arrow-right.gif); background-image: url(../images/skin/arrow-right.gif);
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: right center; background-position: right center;
} }
.contextMenu li:hover ul, .contextMenu li:hover ul,
.contextMenu li.ieHover ul, .contextMenu li.ieHover ul,
.contextMenu li li.ieHover ul, .contextMenu li li.ieHover ul,
@ -218,7 +255,7 @@ a.propButton img {
width: 16px; width: 16px;
height: 16px; height: 16px;
margin-bottom: -4px; margin-bottom: -4px;
-ms-interpolation-mode : bicubic; -ms-interpolation-mode: bicubic;
} }
/* Sliders */ /* Sliders */
@ -280,6 +317,7 @@ a.propButton img {
} }
/* Mocha Customization */ /* Mocha Customization */
#mochaToolbar { #mochaToolbar {
margin-top: 5px; margin-top: 5px;
} }
@ -392,7 +430,8 @@ td.generalLabel {
line-height: 20px; line-height: 20px;
} }
#trackersTable, #webseedsTable { #trackersTable,
#webseedsTable {
line-height: 25px; line-height: 25px;
} }
@ -425,7 +464,7 @@ td.generalLabel {
} }
.select-watched-folder-editable { .select-watched-folder-editable {
position:relative; position: relative;
background-color: white; background-color: white;
border: solid grey 1px; border: solid grey 1px;
width: 160px; width: 160px;

112
src/webui/www/private/download.html

@ -1,5 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="${LANG}"> <html lang="${LANG}">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<title>QBT_TR(Add Torrent Links)QBT_TR[CONTEXT=downloadFromURL]</title> <title>QBT_TR(Add Torrent Links)QBT_TR[CONTEXT=downloadFromURL]</title>
@ -8,84 +9,85 @@
<script src="scripts/lib/mootools-1.2-core-yc.js"></script> <script src="scripts/lib/mootools-1.2-core-yc.js"></script>
<script src="scripts/download.js"></script> <script src="scripts/download.js"></script>
</head> </head>
<body> <body>
<iframe id="download_frame" name="download_frame" class="invisible" src="javascript:false;"></iframe> <iframe id="download_frame" name="download_frame" class="invisible" src="javascript:false;"></iframe>
<form action="api/v2/torrents/add" enctype="multipart/form-data" method="post" id="downloadForm" style="text-align: center;" target="download_frame"> <form action="api/v2/torrents/add" enctype="multipart/form-data" method="post" id="downloadForm" style="text-align: center;" target="download_frame">
<div style="text-align: center;"> <div style="text-align: center;">
<br/> <br/>
<h2 class="vcenter">QBT_TR(Download Torrents from their URLs or Magnet links)QBT_TR[CONTEXT=HttpServer]</h2> <h2 class="vcenter">QBT_TR(Download Torrents from their URLs or Magnet links)QBT_TR[CONTEXT=HttpServer]</h2>
<textarea id="urls" rows="10" name="urls"></textarea> <textarea id="urls" rows="10" name="urls"></textarea>
<p>QBT_TR(Only one link per line)QBT_TR[CONTEXT=HttpServer]</p> <p>QBT_TR(Only one link per line)QBT_TR[CONTEXT=HttpServer]</p>
<fieldset class="settings" style="border: 0; text-align: left;"> <fieldset class="settings" style="border: 0; text-align: left;">
<div class="formRow" style="margin-top: 6px;"> <div class="formRow" style="margin-top: 6px;">
<label for="savepath" class="leftLabelLarge">QBT_TR(Save files to location:)QBT_TR[CONTEXT=HttpServer]</label> <label for="savepath" class="leftLabelLarge">QBT_TR(Save files to location:)QBT_TR[CONTEXT=HttpServer]</label>
<input type="text" id="savepath" name="savepath" style="width: 16em;"/> <input type="text" id="savepath" name="savepath" style="width: 16em;" />
</div> </div>
<div class="formRow"> <div class="formRow">
<label for="cookie" class="leftLabelLarge">QBT_TR(Cookie:)QBT_TR[CONTEXT=HttpServer]</label> <label for="cookie" class="leftLabelLarge">QBT_TR(Cookie:)QBT_TR[CONTEXT=HttpServer]</label>
<input type="text" id="cookie" name="cookie" style="width: 16em;"/> <input type="text" id="cookie" name="cookie" style="width: 16em;" />
</div> </div>
<div class="formRow"> <div class="formRow">
<label for="rename" class="leftLabelLarge">QBT_TR(Rename torrent)QBT_TR[CONTEXT=HttpServer]</label> <label for="rename" class="leftLabelLarge">QBT_TR(Rename torrent)QBT_TR[CONTEXT=HttpServer]</label>
<input type="text" id="rename" name="rename" style="width: 16em;"/> <input type="text" id="rename" name="rename" style="width: 16em;" />
</div> </div>
<div class="formRow"> <div class="formRow">
<label for="category" class="leftLabelLarge">QBT_TR(Category:)QBT_TR[CONTEXT=AddNewTorrentDialog]</label> <label for="category" class="leftLabelLarge">QBT_TR(Category:)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
<input type="text" id="category" name="category" style="width: 16em;"/> <input type="text" id="category" name="category" style="width: 16em;" />
</div> </div>
<div class="formRow"> <div class="formRow">
<label for="start_torrent" class="leftLabelLarge">QBT_TR(Start torrent)QBT_TR[CONTEXT=AddNewTorrentDialog]</label> <label for="start_torrent" class="leftLabelLarge">QBT_TR(Start torrent)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
<input type="checkbox" id="start_torrent" checked="checked"/> <input type="checkbox" id="start_torrent" checked="checked" />
<input type="hidden" id="add_paused" name="paused" value="true" disabled="disabled"/> <input type="hidden" id="add_paused" name="paused" value="true" disabled="disabled" />
</div> </div>
<div class="formRow"> <div class="formRow">
<label for="skip_checking" class="leftLabelLarge">QBT_TR(Skip hash check)QBT_TR[CONTEXT=AddNewTorrentDialog]</label> <label for="skip_checking" class="leftLabelLarge">QBT_TR(Skip hash check)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
<input type="checkbox" id="skip_checking" name="skip_checking" value="true"/> <input type="checkbox" id="skip_checking" name="skip_checking" value="true" />
</div> </div>
<div class="formRow"> <div class="formRow">
<label for="root_folder" class="leftLabelLarge">QBT_TR(Create subfolder)QBT_TR[CONTEXT=AddNewTorrentDialog]</label> <label for="root_folder" class="leftLabelLarge">QBT_TR(Create subfolder)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
<input type="checkbox" id="root_folder" name="root_folder" value="true" checked="checked"/> <input type="checkbox" id="root_folder" name="root_folder" value="true" checked="checked" />
</div> </div>
<div class="formRow"> <div class="formRow">
<label for="sequentialDownload" class="leftLabelLarge">QBT_TR(Download in sequential order)QBT_TR[CONTEXT=TransferListWidget]</label> <label for="sequentialDownload" class="leftLabelLarge">QBT_TR(Download in sequential order)QBT_TR[CONTEXT=TransferListWidget]</label>
<input type="checkbox" id="sequentialDownload" name="sequentialDownload" value="true"/> <input type="checkbox" id="sequentialDownload" name="sequentialDownload" value="true" />
</div> </div>
<div class="formRow"> <div class="formRow">
<label for="firstLastPiecePrio" class="leftLabelLarge">QBT_TR(Download first and last pieces first)QBT_TR[CONTEXT=TransferListWidget]</label> <label for="firstLastPiecePrio" class="leftLabelLarge">QBT_TR(Download first and last pieces first)QBT_TR[CONTEXT=TransferListWidget]</label>
<input type="checkbox" id="firstLastPiecePrio" name="firstLastPiecePrio" value="true"/> <input type="checkbox" id="firstLastPiecePrio" name="firstLastPiecePrio" value="true" />
</div> </div>
<div class="formRow"> <div class="formRow">
<label for="dlLimit" class="leftLabelLarge">QBT_TR(Limit download rate)QBT_TR[CONTEXT=HttpServer]</label> <label for="dlLimit" class="leftLabelLarge">QBT_TR(Limit download rate)QBT_TR[CONTEXT=HttpServer]</label>
<input type="text" id="dlLimit" name="dlLimit" style="width: 16em;" placeholder="Bytes/s"/> <input type="text" id="dlLimit" name="dlLimit" style="width: 16em;" placeholder="Bytes/s" />
</div> </div>
<div class="formRow"> <div class="formRow">
<label for="upLimit" class="leftLabelLarge">QBT_TR(Limit upload rate)QBT_TR[CONTEXT=HttpServer]</label> <label for="upLimit" class="leftLabelLarge">QBT_TR(Limit upload rate)QBT_TR[CONTEXT=HttpServer]</label>
<input type="text" id="upLimit" name="upLimit" style="width: 16em;" placeholder="Bytes/s"/> <input type="text" id="upLimit" name="upLimit" style="width: 16em;" placeholder="Bytes/s" />
</div> </div>
<div id="submitbutton" style="margin-top: 12px; text-align: center;"> <div id="submitbutton" style="margin-top: 12px; text-align: center;">
<button type="submit" id="submitButton">QBT_TR(Download)QBT_TR[CONTEXT=downloadFromURL]</button> <button type="submit" id="submitButton">QBT_TR(Download)QBT_TR[CONTEXT=downloadFromURL]</button>
</div> </div>
</fieldset> </fieldset>
</div> </div>
</form> </form>
<script> <script>
var submitted = false;
var submitted = false; $('downloadForm').addEventListener("submit", function() {
$('downloadForm').addEventListener("submit", function() {
$('download_spinner').style.display = "block"; $('download_spinner').style.display = "block";
submitted = true; submitted = true;
}); });
$('download_frame').addEventListener("load", function() { $('download_frame').addEventListener("load", function() {
if (submitted) if (submitted)
window.parent.closeWindows(); window.parent.closeWindows();
}); });
$('start_torrent').addEventListener('change', function() { $('start_torrent').addEventListener('change', function() {
$('add_paused').disabled = $('start_torrent').checked; $('add_paused').disabled = $('start_torrent').checked;
}); });
</script> </script>
<div id="download_spinner" class="mochaSpinner"></div> <div id="download_spinner" class="mochaSpinner"></div>
</body> </body>
</html> </html>

21
src/webui/www/private/downloadlimit.html

@ -1,5 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="${LANG}"> <html lang="${LANG}">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<title>QBT_TR(Torrent Download Speed Limiting)QBT_TR[CONTEXT=TransferListWidget]</title> <title>QBT_TR(Torrent Download Speed Limiting)QBT_TR[CONTEXT=TransferListWidget]</title>
@ -9,17 +10,18 @@
<script src="scripts/lib/mocha-yc.js"></script> <script src="scripts/lib/mocha-yc.js"></script>
<script src="scripts/lib/parametrics.js"></script> <script src="scripts/lib/parametrics.js"></script>
</head> </head>
<body> <body>
<div style="width: 100%; text-align: center; margin: 0 auto; overflow: hidden"> <div style="width: 100%; text-align: center; margin: 0 auto; overflow: hidden">
<div id="dllimitSlider" class="slider"> <div id="dllimitSlider" class="slider">
<div id="dllimitUpdate" class="update">QBT_TR(Download limit:)QBT_TR[CONTEXT=PropertiesWidget] <input id="dllimitUpdatevalue" size="6" placeholder="∞" style="text-align: center;"> <span id="dlLimitUnit">QBT_TR(KiB/s)QBT_TR[CONTEXT=SpeedLimitDialog]</span></div> <div id="dllimitUpdate" class="update">QBT_TR(Download limit:)QBT_TR[CONTEXT=PropertiesWidget] <input id="dllimitUpdatevalue" size="6" placeholder="∞" style="text-align: center;"> <span id="dlLimitUnit">QBT_TR(KiB/s)QBT_TR[CONTEXT=SpeedLimitDialog]</span></div>
<div class="sliderWrapper"> <div class="sliderWrapper">
<div id="dllimitSliderknob" class="sliderknob"></div> <div id="dllimitSliderknob" class="sliderknob"></div>
<div id="dllimitSliderarea" class="sliderarea"></div> <div id="dllimitSliderarea" class="sliderarea"></div>
</div> </div>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<script> <script>
var hashes = new URI().getData('hashes').split('|'); var hashes = new URI().getData('hashes').split('|');
setDlLimit = function() { setDlLimit = function() {
var limit = $("dllimitUpdatevalue").value.toInt() * 1024; var limit = $("dllimitUpdatevalue").value.toInt() * 1024;
@ -50,13 +52,14 @@
}).send(); }).send();
} }
} }
</script> </script>
<input type="button" value="QBT_TR(Apply)QBT_TR[CONTEXT=HttpServer]" onclick="setDlLimit()"/> <input type="button" value="QBT_TR(Apply)QBT_TR[CONTEXT=HttpServer]" onclick="setDlLimit()" />
</div> </div>
<script> <script>
MochaUI.addDlLimitSlider(hashes); MochaUI.addDlLimitSlider(hashes);
</script> </script>
</body> </body>
</html> </html>

26
src/webui/www/private/filters.html

@ -17,33 +17,33 @@
<script> <script>
var categoriesFilterContextMenu = new CategoriesFilterContextMenu({ var categoriesFilterContextMenu = new CategoriesFilterContextMenu({
targets : '.categoriesFilterContextMenuTarget', targets: '.categoriesFilterContextMenuTarget',
menu : 'categoriesFilterMenu', menu: 'categoriesFilterMenu',
actions : { actions: {
CreateCategory : function (element, ref) { CreateCategory: function(element, ref) {
createCategoryFN(); createCategoryFN();
}, },
DeleteCategory : function (element, ref) { DeleteCategory: function(element, ref) {
removeCategoryFN(element.id); removeCategoryFN(element.id);
}, },
DeleteUnusedCategories : function (element, ref) { DeleteUnusedCategories: function(element, ref) {
deleteUnusedCategoriesFN(); deleteUnusedCategoriesFN();
}, },
StartTorrentsByCategory : function (element, ref) { StartTorrentsByCategory: function(element, ref) {
startTorrentsByCategoryFN(element.id); startTorrentsByCategoryFN(element.id);
}, },
PauseTorrentsByCategory : function (element, ref) { PauseTorrentsByCategory: function(element, ref) {
pauseTorrentsByCategoryFN(element.id); pauseTorrentsByCategoryFN(element.id);
}, },
DeleteTorrentsByCategory : function (element, ref) { DeleteTorrentsByCategory: function(element, ref) {
deleteTorrentsByCategoryFN(element.id); deleteTorrentsByCategoryFN(element.id);
} }
}, },
offsets : { offsets: {
x : -15, x: -15,
y : 2 y: 2
}, },
onShow: function () { onShow: function() {
this.options.element.firstChild.click(); this.options.element.firstChild.click();
} }
}); });

7
src/webui/www/private/index.html

@ -1,5 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="${LANG}"> <html lang="${LANG}">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=10" /> <meta http-equiv="X-UA-Compatible" content="IE=10" />
@ -26,6 +27,7 @@
<script src="scripts/client.js"></script> <script src="scripts/client.js"></script>
<script src="scripts/contextmenu.js"></script> <script src="scripts/contextmenu.js"></script>
</head> </head>
<body> <body>
<div id="desktop"> <div id="desktop">
<div id="desktopHeader"> <div id="desktopHeader">
@ -64,7 +66,7 @@
<li><a id="showTopToolbarLink"><img class="MyMenuIcon" src="theme/checked" alt="QBT_TR(&Top Toolbar)QBT_TR[CONTEXT=MainWindow]" width="16" height="16" onload="fixPNG(this)"/>QBT_TR(&Top Toolbar)QBT_TR[CONTEXT=MainWindow]</a></li> <li><a id="showTopToolbarLink"><img class="MyMenuIcon" src="theme/checked" alt="QBT_TR(&Top Toolbar)QBT_TR[CONTEXT=MainWindow]" width="16" height="16" onload="fixPNG(this)"/>QBT_TR(&Top Toolbar)QBT_TR[CONTEXT=MainWindow]</a></li>
<li><a id="showStatusBarLink"><img class="MyMenuIcon" src="theme/checked" alt="QBT_TR(&Status Bar)QBT_TR[CONTEXT=MainWindow]" width="16" height="16" onload="fixPNG(this)"/>QBT_TR(&Status Bar)QBT_TR[CONTEXT=MainWindow]</a></li> <li><a id="showStatusBarLink"><img class="MyMenuIcon" src="theme/checked" alt="QBT_TR(&Status Bar)QBT_TR[CONTEXT=MainWindow]" width="16" height="16" onload="fixPNG(this)"/>QBT_TR(&Status Bar)QBT_TR[CONTEXT=MainWindow]</a></li>
<li><a id="speedInBrowserTitleBarLink"><img class="MyMenuIcon" src="theme/checked" alt="QBT_TR(S&peed in Title Bar)QBT_TR[CONTEXT=MainWindow]" width="16" height="16" onload="fixPNG(this)"/>QBT_TR(S&peed in Title Bar)QBT_TR[CONTEXT=MainWindow]</a></li> <li><a id="speedInBrowserTitleBarLink"><img class="MyMenuIcon" src="theme/checked" alt="QBT_TR(S&peed in Title Bar)QBT_TR[CONTEXT=MainWindow]" width="16" height="16" onload="fixPNG(this)"/>QBT_TR(S&peed in Title Bar)QBT_TR[CONTEXT=MainWindow]</a></li>
<li class="divider"><a id=StatisticsLink ><img class="MyMenuIcon" src="theme/view-statistics" alt="QBT_TR(&Statistics)QBT_TR[CONTEXT=MainWindow]" width="16" height="16" onload="fixPNG(this)"/>QBT_TR(&Statistics)QBT_TR[CONTEXT=MainWindow]</a></li> <li class="divider"><a id=StatisticsLink><img class="MyMenuIcon" src="theme/view-statistics" alt="QBT_TR(&Statistics)QBT_TR[CONTEXT=MainWindow]" width="16" height="16" onload="fixPNG(this)"/>QBT_TR(&Statistics)QBT_TR[CONTEXT=MainWindow]</a></li>
</ul> </ul>
</li> </li>
<li> <li>
@ -152,7 +154,7 @@
<tr> <tr>
<td id="DHTNodes"></td> <td id="DHTNodes"></td>
<td class="statusBarSeparator"></td> <td class="statusBarSeparator"></td>
<td><img id="connectionStatus" alt="Connection Status" src="images/skin/firewalled.png" style="height: 1.5em;"/></td> <td><img id="connectionStatus" alt="Connection Status" src="images/skin/firewalled.png" style="height: 1.5em;" /></td>
<td class="statusBarSeparator"></td> <td class="statusBarSeparator"></td>
<td style="cursor:pointer;"><img id="alternativeSpeedLimits" alt="QBT_TR(Alternative speed limits)QBT_TR[CONTEXT=MainWindow]" src="images/slow_off.png" /></td> <td style="cursor:pointer;"><img id="alternativeSpeedLimits" alt="QBT_TR(Alternative speed limits)QBT_TR[CONTEXT=MainWindow]" src="images/slow_off.png" /></td>
<td class="statusBarSeparator"></td> <td class="statusBarSeparator"></td>
@ -164,4 +166,5 @@
</div> </div>
</div> </div>
</body> </body>
</html> </html>

16
src/webui/www/private/newcategory.html

@ -1,5 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="${LANG}"> <html lang="${LANG}">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<title>QBT_TR(New Category)QBT_TR[CONTEXT=TransferListWidget]</title> <title>QBT_TR(New Category)QBT_TR[CONTEXT=TransferListWidget]</title>
@ -10,7 +11,7 @@
var newCategoryKeyboardEvents = new Keyboard({ var newCategoryKeyboardEvents = new Keyboard({
defaultEventType: 'keydown', defaultEventType: 'keydown',
events: { events: {
'enter': function (event) { 'enter': function(event) {
$('newCategoryButton').click(); $('newCategoryButton').click();
event.preventDefault(); event.preventDefault();
} }
@ -38,13 +39,12 @@
data: { data: {
category: categoryName category: categoryName
}, },
onComplete: function () { onComplete: function() {
window.parent.closeWindows(); window.parent.closeWindows();
} }
}).send(); }).send();
} }
else else {
{
new Request({ new Request({
url: 'api/v2/torrents/setCategory', url: 'api/v2/torrents/setCategory',
method: 'post', method: 'post',
@ -52,7 +52,7 @@
hashes: hashesList, hashes: hashesList,
category: categoryName category: categoryName
}, },
onComplete: function () { onComplete: function() {
window.parent.closeWindows(); window.parent.closeWindows();
} }
}).send(); }).send();
@ -61,13 +61,15 @@
}); });
</script> </script>
</head> </head>
<body> <body>
<div style="padding: 10px 10px 0px 10px;"> <div style="padding: 10px 10px 0px 10px;">
<p style="font-weight: bold;">QBT_TR(Category)QBT_TR[CONTEXT=TransferListWidget]:</p> <p style="font-weight: bold;">QBT_TR(Category)QBT_TR[CONTEXT=TransferListWidget]:</p>
<input type="text" id="newCategory" value="" maxlength="100" style="width: 220px;"/> <input type="text" id="newCategory" value="" maxlength="100" style="width: 220px;" />
<div style="text-align: center; padding-top: 10px;"> <div style="text-align: center; padding-top: 10px;">
<input type="button" value="QBT_TR(Add)QBT_TR[CONTEXT=HttpServer]" id="newCategoryButton"/> <input type="button" value="QBT_TR(Add)QBT_TR[CONTEXT=HttpServer]" id="newCategoryButton" />
</div> </div>
</div> </div>
</body> </body>
</html> </html>

37
src/webui/www/private/preferences.html

@ -1,5 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="${LANG}"> <html lang="${LANG}">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<title>QBT_TR(Download from URLs)QBT_TR[CONTEXT=downloadFromURL]</title> <title>QBT_TR(Download from URLs)QBT_TR[CONTEXT=downloadFromURL]</title>
@ -9,9 +10,10 @@
<script src="scripts/lib/mootools-1.2-more.js"></script> <script src="scripts/lib/mootools-1.2-more.js"></script>
<script src="scripts/lib/mocha-yc.js"></script> <script src="scripts/lib/mocha-yc.js"></script>
</head> </head>
<body style="padding: 5px;"> <body style="padding: 5px;">
<!-- preferences --> <!-- preferences -->
<div class="toolbarTabs"> <div class="toolbarTabs">
<ul id="preferencesTabs" class="tab-menu"> <ul id="preferencesTabs" class="tab-menu">
<li id="PrefDownloadsLink" class="selected"><a>QBT_TR(Downloads)QBT_TR[CONTEXT=OptionsDialog]</a></li> <li id="PrefDownloadsLink" class="selected"><a>QBT_TR(Downloads)QBT_TR[CONTEXT=OptionsDialog]</a></li>
<li id="PrefConnectionLink"><a>QBT_TR(Connection)QBT_TR[CONTEXT=OptionsDialog]</a></li> <li id="PrefConnectionLink"><a>QBT_TR(Connection)QBT_TR[CONTEXT=OptionsDialog]</a></li>
@ -20,32 +22,33 @@
<li id="PrefWebUILink"><a>QBT_TR(Web UI)QBT_TR[CONTEXT=OptionsDialog]</a></li> <li id="PrefWebUILink"><a>QBT_TR(Web UI)QBT_TR[CONTEXT=OptionsDialog]</a></li>
</ul> </ul>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<script> <script>
// Tabs // Tabs
MochaUI.initializeTabs('preferencesTabs'); MochaUI.initializeTabs('preferencesTabs');
$('PrefDownloadsLink').addEvent('click', function(e) { $('PrefDownloadsLink').addEvent('click', function(e) {
$$('.PrefTab').addClass('invisible'); $$('.PrefTab').addClass('invisible');
$('DownloadsTab').removeClass('invisible'); $('DownloadsTab').removeClass('invisible');
}); });
$('PrefConnectionLink').addEvent('click', function(e){ $('PrefConnectionLink').addEvent('click', function(e) {
$$('.PrefTab').addClass('invisible'); $$('.PrefTab').addClass('invisible');
$('ConnectionTab').removeClass('invisible'); $('ConnectionTab').removeClass('invisible');
}); });
$('PrefSpeedLink').addEvent('click', function(e) { $('PrefSpeedLink').addEvent('click', function(e) {
$$('.PrefTab').addClass('invisible'); $$('.PrefTab').addClass('invisible');
$('SpeedTab').removeClass('invisible'); $('SpeedTab').removeClass('invisible');
}); });
$('PrefBittorrentLink').addEvent('click', function(e) { $('PrefBittorrentLink').addEvent('click', function(e) {
$$('.PrefTab').addClass('invisible'); $$('.PrefTab').addClass('invisible');
$('BittorrentTab').removeClass('invisible'); $('BittorrentTab').removeClass('invisible');
}); });
$('PrefWebUILink').addEvent('click', function(e) { $('PrefWebUILink').addEvent('click', function(e) {
$$('.PrefTab').addClass('invisible'); $$('.PrefTab').addClass('invisible');
$('WebUITab').removeClass('invisible'); $('WebUITab').removeClass('invisible');
}); });
</script> </script>
</body> </body>
</html> </html>

580
src/webui/www/private/preferences_content.html

File diff suppressed because it is too large Load Diff

96
src/webui/www/private/properties_content.html

@ -3,25 +3,44 @@
<legend><b>QBT_TR(Transfer)QBT_TR[CONTEXT=PropertiesWidget]</b></legend> <legend><b>QBT_TR(Transfer)QBT_TR[CONTEXT=PropertiesWidget]</b></legend>
<table style="width: 100%"> <table style="width: 100%">
<tr> <tr>
<td class="generalLabel">QBT_TR(Time Active:)QBT_TR[CONTEXT=PropertiesWidget]</td><td id="time_elapsed"></td> <td class="generalLabel">QBT_TR(Time Active:)QBT_TR[CONTEXT=PropertiesWidget]</td>
<td class="generalLabel">QBT_TR(ETA:)QBT_TR[CONTEXT=PropertiesWidget]</td><td id="eta"></td> <td id="time_elapsed"></td>
<td class="generalLabel">QBT_TR(Connections:)QBT_TR[CONTEXT=PropertiesWidget]</td><td id="nb_connections"></td> <td class="generalLabel">QBT_TR(ETA:)QBT_TR[CONTEXT=PropertiesWidget]</td>
</tr><tr> <td id="eta"></td>
<td class="generalLabel">QBT_TR(Downloaded:)QBT_TR[CONTEXT=PropertiesWidget]</td><td id="total_downloaded"></td> <td class="generalLabel">QBT_TR(Connections:)QBT_TR[CONTEXT=PropertiesWidget]</td>
<td class="generalLabel">QBT_TR(Uploaded:)QBT_TR[CONTEXT=PropertiesWidget]</td><td id="total_uploaded"></td> <td id="nb_connections"></td>
<td class="generalLabel">QBT_TR(Seeds:)QBT_TR[CONTEXT=PropertiesWidget]</td><td id="seeds"></td> </tr>
</tr><tr> <tr>
<td class="generalLabel">QBT_TR(Download Speed:)QBT_TR[CONTEXT=PropertiesWidget]</td><td id="dl_speed"></td> <td class="generalLabel">QBT_TR(Downloaded:)QBT_TR[CONTEXT=PropertiesWidget]</td>
<td class="generalLabel">QBT_TR(Upload Speed:)QBT_TR[CONTEXT=PropertiesWidget]</td><td id="up_speed"></td> <td id="total_downloaded"></td>
<td class="generalLabel">QBT_TR(Peers:)QBT_TR[CONTEXT=PropertiesWidget]</td><td id="peers"></td> <td class="generalLabel">QBT_TR(Uploaded:)QBT_TR[CONTEXT=PropertiesWidget]</td>
</tr><tr> <td id="total_uploaded"></td>
<td class="generalLabel">QBT_TR(Download Limit:)QBT_TR[CONTEXT=PropertiesWidget]</td><td id="dl_limit"></td> <td class="generalLabel">QBT_TR(Seeds:)QBT_TR[CONTEXT=PropertiesWidget]</td>
<td class="generalLabel">QBT_TR(Upload Limit:)QBT_TR[CONTEXT=PropertiesWidget]</td><td id="up_limit"></td> <td id="seeds"></td>
<td class="generalLabel">QBT_TR(Wasted:)QBT_TR[CONTEXT=PropertiesWidget]</td><td id="total_wasted"></td> </tr>
</tr><tr> <tr>
<td class="generalLabel">QBT_TR(Share Ratio:)QBT_TR[CONTEXT=PropertiesWidget]</td><td id="share_ratio"></td> <td class="generalLabel">QBT_TR(Download Speed:)QBT_TR[CONTEXT=PropertiesWidget]</td>
<td class="generalLabel">QBT_TR(Reannounce In:)QBT_TR[CONTEXT=PropertiesWidget]</td><td id="reannounce"></td> <td id="dl_speed"></td>
<td class="generalLabel">QBT_TR(Last Seen Complete:)QBT_TR[CONTEXT=PropertiesWidget]</td><td id="last_seen"></td> <td class="generalLabel">QBT_TR(Upload Speed:)QBT_TR[CONTEXT=PropertiesWidget]</td>
<td id="up_speed"></td>
<td class="generalLabel">QBT_TR(Peers:)QBT_TR[CONTEXT=PropertiesWidget]</td>
<td id="peers"></td>
</tr>
<tr>
<td class="generalLabel">QBT_TR(Download Limit:)QBT_TR[CONTEXT=PropertiesWidget]</td>
<td id="dl_limit"></td>
<td class="generalLabel">QBT_TR(Upload Limit:)QBT_TR[CONTEXT=PropertiesWidget]</td>
<td id="up_limit"></td>
<td class="generalLabel">QBT_TR(Wasted:)QBT_TR[CONTEXT=PropertiesWidget]</td>
<td id="total_wasted"></td>
</tr>
<tr>
<td class="generalLabel">QBT_TR(Share Ratio:)QBT_TR[CONTEXT=PropertiesWidget]</td>
<td id="share_ratio"></td>
<td class="generalLabel">QBT_TR(Reannounce In:)QBT_TR[CONTEXT=PropertiesWidget]</td>
<td id="reannounce"></td>
<td class="generalLabel">QBT_TR(Last Seen Complete:)QBT_TR[CONTEXT=PropertiesWidget]</td>
<td id="last_seen"></td>
</tr> </tr>
</table> </table>
</fieldset> </fieldset>
@ -29,19 +48,32 @@
<legend><b>QBT_TR(Information)QBT_TR[CONTEXT=PropertiesWidget]</b></legend> <legend><b>QBT_TR(Information)QBT_TR[CONTEXT=PropertiesWidget]</b></legend>
<table style="width: 100%"> <table style="width: 100%">
<tr> <tr>
<td class="generalLabel">QBT_TR(Total Size:)QBT_TR[CONTEXT=PropertiesWidget]</td><td id="total_size"></td> <td class="generalLabel">QBT_TR(Total Size:)QBT_TR[CONTEXT=PropertiesWidget]</td>
<td class="generalLabel">QBT_TR(Pieces:)QBT_TR[CONTEXT=PropertiesWidget]</td><td id="pieces"></td> <td id="total_size"></td>
<td class="generalLabel">QBT_TR(Created By:)QBT_TR[CONTEXT=PropertiesWidget]</td><td id="created_by"></td> <td class="generalLabel">QBT_TR(Pieces:)QBT_TR[CONTEXT=PropertiesWidget]</td>
</tr><tr> <td id="pieces"></td>
<td class="generalLabel">QBT_TR(Added On:)QBT_TR[CONTEXT=PropertiesWidget]</td><td id="addition_date"></td> <td class="generalLabel">QBT_TR(Created By:)QBT_TR[CONTEXT=PropertiesWidget]</td>
<td class="generalLabel">QBT_TR(Completed On:)QBT_TR[CONTEXT=PropertiesWidget]</td><td id="completion_date"></td> <td id="created_by"></td>
<td class="generalLabel">QBT_TR(Created On:)QBT_TR[CONTEXT=PropertiesWidget]</td><td id="creation_date"></td> </tr>
</tr><tr> <tr>
<td class="generalLabel">QBT_TR(Torrent Hash:)QBT_TR[CONTEXT=PropertiesWidget]</td><td colspan="5" id="torrent_hash"></td> <td class="generalLabel">QBT_TR(Added On:)QBT_TR[CONTEXT=PropertiesWidget]</td>
</tr><tr> <td id="addition_date"></td>
<td class="generalLabel">QBT_TR(Save Path:)QBT_TR[CONTEXT=PropertiesWidget]</td><td colspan="5" id="save_path"></td> <td class="generalLabel">QBT_TR(Completed On:)QBT_TR[CONTEXT=PropertiesWidget]</td>
</tr><tr> <td id="completion_date"></td>
<td class="generalLabel">QBT_TR(Comment:)QBT_TR[CONTEXT=PropertiesWidget]</td><td colspan="5" style="white-space: pre-wrap;" id="comment"></td> <td class="generalLabel">QBT_TR(Created On:)QBT_TR[CONTEXT=PropertiesWidget]</td>
<td id="creation_date"></td>
</tr>
<tr>
<td class="generalLabel">QBT_TR(Torrent Hash:)QBT_TR[CONTEXT=PropertiesWidget]</td>
<td colspan="5" id="torrent_hash"></td>
</tr>
<tr>
<td class="generalLabel">QBT_TR(Save Path:)QBT_TR[CONTEXT=PropertiesWidget]</td>
<td colspan="5" id="save_path"></td>
</tr>
<tr>
<td class="generalLabel">QBT_TR(Comment:)QBT_TR[CONTEXT=PropertiesWidget]</td>
<td colspan="5" style="white-space: pre-wrap;" id="comment"></td>
</tr> </tr>
</table> </table>
</fieldset> </fieldset>

11
src/webui/www/private/rename.html

@ -1,5 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="${LANG}"> <html lang="${LANG}">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<title>QBT_TR(Rename)QBT_TR[CONTEXT=TransferListWidget]</title> <title>QBT_TR(Rename)QBT_TR[CONTEXT=TransferListWidget]</title>
@ -11,7 +12,7 @@
var renameKeyboardEvents = new Keyboard({ var renameKeyboardEvents = new Keyboard({
defaultEventType: 'keydown', defaultEventType: 'keydown',
events: { events: {
'enter': function (event) { 'enter': function(event) {
$('renameButton').click(); $('renameButton').click();
event.preventDefault(); event.preventDefault();
} }
@ -42,7 +43,7 @@
hash: hash, hash: hash,
name: name name: name
}, },
onComplete: function () { onComplete: function() {
window.parent.closeWindows(); window.parent.closeWindows();
} }
}).send(); }).send();
@ -51,13 +52,15 @@
}); });
</script> </script>
</head> </head>
<body> <body>
<div style="padding: 10px 10px 0px 10px;"> <div style="padding: 10px 10px 0px 10px;">
<p style="font-weight: bold;">QBT_TR(New name)QBT_TR[CONTEXT=TransferListWidget]:</p> <p style="font-weight: bold;">QBT_TR(New name)QBT_TR[CONTEXT=TransferListWidget]:</p>
<input type="text" id="rename" value="" maxlength="100" style="width: 220px;"/> <input type="text" id="rename" value="" maxlength="100" style="width: 220px;" />
<div style="text-align: center; padding-top: 10px;"> <div style="text-align: center; padding-top: 10px;">
<input type="button" value="QBT_TR(Save)QBT_TR[CONTEXT=HttpServer]" id="renameButton"/> <input type="button" value="QBT_TR(Save)QBT_TR[CONTEXT=HttpServer]" id="renameButton" />
</div> </div>
</div> </div>
</body> </body>
</html> </html>

197
src/webui/www/private/scripts/client.js

@ -25,15 +25,15 @@
torrentsTable = new TorrentsTable(); torrentsTable = new TorrentsTable();
torrentPeersTable = new TorrentPeersTable(); torrentPeersTable = new TorrentPeersTable();
var updatePropertiesPanel = function () {}; var updatePropertiesPanel = function() {};
var updateTorrentData = function () {}; var updateTorrentData = function() {};
var updateTrackersData = function () {}; var updateTrackersData = function() {};
var updateTorrentPeersData = function () {}; var updateTorrentPeersData = function() {};
var updateWebSeedsData = function () {}; var updateWebSeedsData = function() {};
var updateTorrentFilesData = function () {}; var updateTorrentFilesData = function() {};
var updateMainData = function () {}; var updateMainData = function() {};
var alternativeSpeedLimits = false; var alternativeSpeedLimits = false;
var queueing_enabled = true; var queueing_enabled = true;
var syncMainDataTimerPeriod = 1500; var syncMainDataTimerPeriod = 1500;
@ -46,12 +46,12 @@ var CATEGORIES_UNCATEGORIZED = 2;
var category_list = {}; var category_list = {};
var selected_category = CATEGORIES_ALL; var selected_category = CATEGORIES_ALL;
var setCategoryFilter = function(){}; var setCategoryFilter = function() {};
var selected_filter = getLocalStorageItem('selected_filter', 'all'); var selected_filter = getLocalStorageItem('selected_filter', 'all');
var setFilter = function(){}; var setFilter = function() {};
var loadSelectedCategory = function () { var loadSelectedCategory = function() {
selected_category = getLocalStorageItem('selected_category', CATEGORIES_ALL); selected_category = getLocalStorageItem('selected_category', CATEGORIES_ALL);
}; };
loadSelectedCategory(); loadSelectedCategory();
@ -65,9 +65,9 @@ function genHash(string) {
return hash; return hash;
} }
window.addEvent('load', function () { window.addEvent('load', function() {
var saveColumnSizes = function () { var saveColumnSizes = function() {
var filters_width = $('Filters').getSize().x; var filters_width = $('Filters').getSize().x;
var properties_height_rel = $('propertiesPanel').getSize().y / Window.getSize().y; var properties_height_rel = $('propertiesPanel').getSize().y / Window.getSize().y;
localStorage.setItem('filters_width', filters_width); localStorage.setItem('filters_width', filters_width);
@ -92,17 +92,17 @@ window.addEvent('load', function () {
else else
filt_w = 120; filt_w = 120;
new MochaUI.Column({ new MochaUI.Column({
id : 'filtersColumn', id: 'filtersColumn',
placement : 'left', placement: 'left',
onResize : saveColumnSizes, onResize: saveColumnSizes,
width : filt_w, width: filt_w,
resizeLimit : [100, 300] resizeLimit: [100, 300]
}); });
new MochaUI.Column({ new MochaUI.Column({
id : 'mainColumn', id: 'mainColumn',
placement : 'main', placement: 'main',
width : null, width: null,
resizeLimit : [100, 300] resizeLimit: [100, 300]
}); });
setCategoryFilter = function(hash) { setCategoryFilter = function(hash) {
@ -113,7 +113,7 @@ window.addEvent('load', function () {
updateMainData(); updateMainData();
}; };
setFilter = function (f) { setFilter = function(f) {
// Visually Select the right filter // Visually Select the right filter
$("all_filter").removeClass("selectedFilter"); $("all_filter").removeClass("selectedFilter");
$("downloading_filter").removeClass("selectedFilter"); $("downloading_filter").removeClass("selectedFilter");
@ -133,22 +133,22 @@ window.addEvent('load', function () {
}; };
new MochaUI.Panel({ new MochaUI.Panel({
id : 'Filters', id: 'Filters',
title : 'Panel', title: 'Panel',
header : false, header: false,
padding : { padding: {
top : 0, top: 0,
right : 0, right: 0,
bottom : 0, bottom: 0,
left : 0 left: 0
}, },
loadMethod : 'xhr', loadMethod: 'xhr',
contentURL : 'filters.html', contentURL: 'filters.html',
onContentLoaded : function () { onContentLoaded: function() {
setFilter(selected_filter); setFilter(selected_filter);
}, },
column : 'filtersColumn', column: 'filtersColumn',
height : 300 height: 300
}); });
initializeWindows(); initializeWindows();
@ -203,7 +203,10 @@ window.addEvent('load', function () {
} }
var categoryHash = genHash(category); var categoryHash = genHash(category);
if (category_list[categoryHash] === null) // This should not happen if (category_list[categoryHash] === null) // This should not happen
category_list[categoryHash] = {name: category, torrents: []}; category_list[categoryHash] = {
name: category,
torrents: []
};
if (!Object.contains(category_list[categoryHash].torrents, torrent['hash'])) { if (!Object.contains(category_list[categoryHash].torrents, torrent['hash'])) {
removeTorrentFromCategoryList(torrent['hash']); removeTorrentFromCategoryList(torrent['hash']);
category_list[categoryHash].torrents = category_list[categoryHash].torrents.combine([torrent['hash']]); category_list[categoryHash].torrents = category_list[categoryHash].torrents.combine([torrent['hash']]);
@ -235,10 +238,13 @@ window.addEvent('load', function () {
categoryList.empty(); categoryList.empty();
var create_link = function(hash, text, count) { var create_link = function(hash, text, count) {
var html = '<a href="#" onclick="setCategoryFilter(' + hash + ');return false;">' + var html = '<a href="#" onclick="setCategoryFilter(' + hash + ');return false;">'
'<img src="theme/inode-directory"/>' + + '<img src="theme/inode-directory"/>'
escapeHtml(text) + ' (' + count + ')' + '</a>'; + escapeHtml(text) + ' (' + count + ')' + '</a>';
var el = new Element('li', {id: hash, html: html}); var el = new Element('li', {
id: hash,
html: html
});
categoriesFilterContextMenu.addTarget(el); categoriesFilterContextMenu.addTarget(el);
return el; return el;
}; };
@ -281,21 +287,21 @@ window.addEvent('load', function () {
}; };
var syncMainDataTimer; var syncMainDataTimer;
var syncMainData = function () { var syncMainData = function() {
var url = new URI('api/v2/sync/maindata'); var url = new URI('api/v2/sync/maindata');
url.setData('rid', syncMainDataLastResponseId); url.setData('rid', syncMainDataLastResponseId);
var request = new Request.JSON({ var request = new Request.JSON({
url : url, url: url,
noCache : true, noCache: true,
method : 'get', method: 'get',
onFailure : function () { onFailure: function() {
var errorDiv = $('error_div'); var errorDiv = $('error_div');
if (errorDiv) if (errorDiv)
errorDiv.set('html', 'QBT_TR(qBittorrent client is not reachable)QBT_TR[CONTEXT=HttpServer]'); errorDiv.set('html', 'QBT_TR(qBittorrent client is not reachable)QBT_TR[CONTEXT=HttpServer]');
clearTimeout(syncMainDataTimer); clearTimeout(syncMainDataTimer);
syncMainDataTimer = syncMainData.delay(2000); syncMainDataTimer = syncMainData.delay(2000);
}, },
onSuccess : function (response) { onSuccess: function(response) {
$('error_div').set('html', ''); $('error_div').set('html', '');
if (response) { if (response) {
var torrentsTableSelectedRows; var torrentsTableSelectedRows;
@ -312,7 +318,10 @@ window.addEvent('load', function () {
if (response['categories']) { if (response['categories']) {
response['categories'].each(function(category) { response['categories'].each(function(category) {
var categoryHash = genHash(category); var categoryHash = genHash(category);
category_list[categoryHash] = {name: category, torrents: []}; category_list[categoryHash] = {
name: category,
torrents: []
};
}); });
update_categories = true; update_categories = true;
} }
@ -341,7 +350,7 @@ window.addEvent('load', function () {
setupCopyEventHandler(); setupCopyEventHandler();
} }
if (response['torrents_removed']) if (response['torrents_removed'])
response['torrents_removed'].each(function (hash) { response['torrents_removed'].each(function(hash) {
torrentsTable.removeRow(hash); torrentsTable.removeRow(hash);
removeTorrentFromCategoryList(hash); removeTorrentFromCategoryList(hash);
update_categories = true; // Always to update All category update_categories = true; // Always to update All category
@ -350,7 +359,7 @@ window.addEvent('load', function () {
torrentsTable.altRow(); torrentsTable.altRow();
if (response['server_state']) { if (response['server_state']) {
var tmp = response['server_state']; var tmp = response['server_state'];
for(var k in tmp) for (var k in tmp)
serverState[k] = tmp[k]; serverState[k] = tmp[k];
processServerState(); processServerState();
} }
@ -376,7 +385,7 @@ window.addEvent('load', function () {
syncMainDataTimer = syncMainData.delay(100); syncMainDataTimer = syncMainData.delay(100);
}; };
var processServerState = function () { var processServerState = function() {
var transfer_info = friendlyUnit(serverState.dl_info_speed, true); var transfer_info = friendlyUnit(serverState.dl_info_speed, true);
if (serverState.dl_rate_limit > 0) if (serverState.dl_rate_limit > 0)
transfer_info += " [" + friendlyUnit(serverState.dl_rate_limit, true) + "]"; transfer_info += " [" + friendlyUnit(serverState.dl_rate_limit, true) + "]";
@ -390,7 +399,8 @@ window.addEvent('load', function () {
if (speedInTitle) { if (speedInTitle) {
document.title = "QBT_TR([D: %1, U: %2] qBittorrent %3)QBT_TR[CONTEXT=MainWindow]".replace("%1", friendlyUnit(serverState.dl_info_speed, true)).replace("%2", friendlyUnit(serverState.up_info_speed, true)).replace("%3", "${VERSION}"); document.title = "QBT_TR([D: %1, U: %2] qBittorrent %3)QBT_TR[CONTEXT=MainWindow]".replace("%1", friendlyUnit(serverState.dl_info_speed, true)).replace("%2", friendlyUnit(serverState.up_info_speed, true)).replace("%3", "${VERSION}");
document.title += " QBT_TR(Web UI)QBT_TR[CONTEXT=OptionsDialog]"; document.title += " QBT_TR(Web UI)QBT_TR[CONTEXT=OptionsDialog]";
}else }
else
document.title = "qBittorrent ${VERSION} QBT_TR(Web UI)QBT_TR[CONTEXT=OptionsDialog]"; document.title = "qBittorrent ${VERSION} QBT_TR(Web UI)QBT_TR[CONTEXT=OptionsDialog]";
$('DHTNodes').set('html', 'QBT_TR(DHT: %1 nodes)QBT_TR[CONTEXT=StatusBar]'.replace("%1", serverState.dht_nodes)); $('DHTNodes').set('html', 'QBT_TR(DHT: %1 nodes)QBT_TR[CONTEXT=StatusBar]'.replace("%1", serverState.dht_nodes));
@ -460,7 +470,8 @@ window.addEvent('load', function () {
// Change icon immediately to give some feedback // Change icon immediately to give some feedback
updateAltSpeedIcon(!alternativeSpeedLimits); updateAltSpeedIcon(!alternativeSpeedLimits);
new Request({url: 'api/v2/transfer/toggleSpeedLimitsMode', new Request({
url: 'api/v2/transfer/toggleSpeedLimitsMode',
method: 'post', method: 'post',
onComplete: function() { onComplete: function() {
alternativeSpeedLimits = !alternativeSpeedLimits; alternativeSpeedLimits = !alternativeSpeedLimits;
@ -517,23 +528,23 @@ window.addEvent('load', function () {
$('StatisticsLink').addEvent('click', StatisticsLinkFN); $('StatisticsLink').addEvent('click', StatisticsLinkFN);
new MochaUI.Panel({ new MochaUI.Panel({
id : 'transferList', id: 'transferList',
title : 'Panel', title: 'Panel',
header : false, header: false,
padding : { padding: {
top : 0, top: 0,
right : 0, right: 0,
bottom : 0, bottom: 0,
left : 0 left: 0
}, },
loadMethod : 'xhr', loadMethod: 'xhr',
contentURL : 'transferlist.html', contentURL: 'transferlist.html',
onContentLoaded : function () { onContentLoaded: function() {
updateMainData(); updateMainData();
}, },
column : 'mainColumn', column: 'mainColumn',
onResize : saveColumnSizes, onResize: saveColumnSizes,
height : null height: null
}); });
var prop_h = localStorage.getItem('properties_height_rel'); var prop_h = localStorage.getItem('properties_height_rel');
if ($defined(prop_h)) if ($defined(prop_h))
@ -541,22 +552,22 @@ window.addEvent('load', function () {
else else
prop_h = Window.getSize().y / 2.0; prop_h = Window.getSize().y / 2.0;
new MochaUI.Panel({ new MochaUI.Panel({
id : 'propertiesPanel', id: 'propertiesPanel',
title : 'Panel', title: 'Panel',
header : true, header: true,
padding : { padding: {
top : 0, top: 0,
right : 0, right: 0,
bottom : 0, bottom: 0,
left : 0 left: 0
}, },
contentURL : 'properties_content.html', contentURL: 'properties_content.html',
require : { require: {
css : ['css/Tabs.css', 'css/dynamicTable.css'], css: ['css/Tabs.css', 'css/dynamicTable.css'],
js : ['scripts/prop-general.js', 'scripts/prop-trackers.js', 'scripts/prop-webseeds.js', 'scripts/prop-files.js'], js: ['scripts/prop-general.js', 'scripts/prop-trackers.js', 'scripts/prop-webseeds.js', 'scripts/prop-files.js'],
}, },
tabsURL : 'properties.html', tabsURL: 'properties.html',
tabsOnload : function() { tabsOnload: function() {
MochaUI.initializeTabs('propertiesTabs'); MochaUI.initializeTabs('propertiesTabs');
updatePropertiesPanel = function() { updatePropertiesPanel = function() {
@ -572,7 +583,7 @@ window.addEvent('load', function () {
updateTorrentFilesData(); updateTorrentFilesData();
}; };
$('PropGeneralLink').addEvent('click', function(e){ $('PropGeneralLink').addEvent('click', function(e) {
$('prop_general').removeClass("invisible"); $('prop_general').removeClass("invisible");
$('prop_trackers').addClass("invisible"); $('prop_trackers').addClass("invisible");
$('prop_webseeds').addClass("invisible"); $('prop_webseeds').addClass("invisible");
@ -582,7 +593,7 @@ window.addEvent('load', function () {
localStorage.setItem('selected_tab', this.id); localStorage.setItem('selected_tab', this.id);
}); });
$('PropTrackersLink').addEvent('click', function(e){ $('PropTrackersLink').addEvent('click', function(e) {
$('prop_trackers').removeClass("invisible"); $('prop_trackers').removeClass("invisible");
$('prop_general').addClass("invisible"); $('prop_general').addClass("invisible");
$('prop_webseeds').addClass("invisible"); $('prop_webseeds').addClass("invisible");
@ -592,7 +603,7 @@ window.addEvent('load', function () {
localStorage.setItem('selected_tab', this.id); localStorage.setItem('selected_tab', this.id);
}); });
$('PropPeersLink').addEvent('click', function(e){ $('PropPeersLink').addEvent('click', function(e) {
$('prop_peers').removeClass("invisible"); $('prop_peers').removeClass("invisible");
$('prop_trackers').addClass("invisible"); $('prop_trackers').addClass("invisible");
$('prop_general').addClass("invisible"); $('prop_general').addClass("invisible");
@ -602,7 +613,7 @@ window.addEvent('load', function () {
localStorage.setItem('selected_tab', this.id); localStorage.setItem('selected_tab', this.id);
}); });
$('PropWebSeedsLink').addEvent('click', function(e){ $('PropWebSeedsLink').addEvent('click', function(e) {
$('prop_webseeds').removeClass("invisible"); $('prop_webseeds').removeClass("invisible");
$('prop_general').addClass("invisible"); $('prop_general').addClass("invisible");
$('prop_trackers').addClass("invisible"); $('prop_trackers').addClass("invisible");
@ -612,7 +623,7 @@ window.addEvent('load', function () {
localStorage.setItem('selected_tab', this.id); localStorage.setItem('selected_tab', this.id);
}); });
$('PropFilesLink').addEvent('click', function(e){ $('PropFilesLink').addEvent('click', function(e) {
$('prop_files').removeClass("invisible"); $('prop_files').removeClass("invisible");
$('prop_general').addClass("invisible"); $('prop_general').addClass("invisible");
$('prop_trackers').addClass("invisible"); $('prop_trackers').addClass("invisible");
@ -622,12 +633,12 @@ window.addEvent('load', function () {
localStorage.setItem('selected_tab', this.id); localStorage.setItem('selected_tab', this.id);
}); });
$('propertiesPanel_collapseToggle').addEvent('click', function(e){ $('propertiesPanel_collapseToggle').addEvent('click', function(e) {
updatePropertiesPanel(); updatePropertiesPanel();
}); });
}, },
column : 'mainColumn', column: 'mainColumn',
height : prop_h height: prop_h
}); });
}); });
@ -679,9 +690,9 @@ keyboardEvents.activate();
var loadTorrentPeersTimer; var loadTorrentPeersTimer;
var syncTorrentPeersLastResponseId = 0; var syncTorrentPeersLastResponseId = 0;
var show_flags = true; var show_flags = true;
var loadTorrentPeersData = function(){ var loadTorrentPeersData = function() {
if ($('prop_peers').hasClass('invisible') || if ($('prop_peers').hasClass('invisible')
$('propertiesPanel_collapseToggle').hasClass('panel-expand')) { || $('propertiesPanel_collapseToggle').hasClass('panel-expand')) {
syncTorrentPeersLastResponseId = 0; syncTorrentPeersLastResponseId = 0;
torrentPeersTable.clear(); torrentPeersTable.clear();
return; return;
@ -727,7 +738,7 @@ var loadTorrentPeersData = function(){
} }
} }
if (response['peers_removed']) if (response['peers_removed'])
response['peers_removed'].each(function (hash) { response['peers_removed'].each(function(hash) {
torrentPeersTable.removeRow(hash); torrentPeersTable.removeRow(hash);
}); });
torrentPeersTable.updateTable(full_update); torrentPeersTable.updateTable(full_update);
@ -750,7 +761,7 @@ var loadTorrentPeersData = function(){
}).send(); }).send();
}; };
updateTorrentPeersData = function(){ updateTorrentPeersData = function() {
clearTimeout(loadTorrentPeersTimer); clearTimeout(loadTorrentPeersTimer);
loadTorrentPeersData(); loadTorrentPeersData();
}; };

47
src/webui/www/private/scripts/contextmenu.js

@ -174,10 +174,10 @@ var ContextMenu = new Class({
}.bind(this)); }.bind(this));
}, },
updateMenuItems: function () {}, updateMenuItems: function() {},
//show menu //show menu
show: function (trigger) { show: function(trigger) {
if (lastShownContexMenu && lastShownContexMenu != this) if (lastShownContexMenu && lastShownContexMenu != this)
lastShownContexMenu.hide(); lastShownContexMenu.hide();
this.fx.start(1); this.fx.start(1);
@ -188,7 +188,7 @@ var ContextMenu = new Class({
}, },
//hide the menu //hide the menu
hide: function (trigger) { hide: function(trigger) {
if (this.shown) { if (this.shown) {
this.fx.start(0); this.fx.start(0);
//this.menu.fade('out'); //this.menu.fade('out');
@ -198,42 +198,42 @@ var ContextMenu = new Class({
return this; return this;
}, },
setItemChecked: function (item, checked) { setItemChecked: function(item, checked) {
this.menu.getElement('a[href$=' + item + ']').firstChild.style.opacity = this.menu.getElement('a[href$=' + item + ']').firstChild.style.opacity =
checked ? '1' : '0'; checked ? '1' : '0';
return this; return this;
}, },
getItemChecked: function (item) { getItemChecked: function(item) {
return '0' != this.menu.getElement('a[href$=' + item + ']').firstChild.style.opacity; return '0' != this.menu.getElement('a[href$=' + item + ']').firstChild.style.opacity;
}, },
//hide an item //hide an item
hideItem: function (item) { hideItem: function(item) {
this.menu.getElement('a[href$=' + item + ']').parentNode.addClass('invisible'); this.menu.getElement('a[href$=' + item + ']').parentNode.addClass('invisible');
return this; return this;
}, },
//show an item //show an item
showItem: function (item) { showItem: function(item) {
this.menu.getElement('a[href$=' + item + ']').parentNode.removeClass('invisible'); this.menu.getElement('a[href$=' + item + ']').parentNode.removeClass('invisible');
return this; return this;
}, },
//disable the entire menu //disable the entire menu
disable: function () { disable: function() {
this.options.disabled = true; this.options.disabled = true;
return this; return this;
}, },
//enable the entire menu //enable the entire menu
enable: function () { enable: function() {
this.options.disabled = false; this.options.disabled = false;
return this; return this;
}, },
//execute an action //execute an action
execute: function (action, element) { execute: function(action, element) {
if (this.options.actions[action]) { if (this.options.actions[action]) {
this.options.actions[action](element, this, action); this.options.actions[action](element, this, action);
} }
@ -244,7 +244,7 @@ var ContextMenu = new Class({
var TorrentsTableContextMenu = new Class({ var TorrentsTableContextMenu = new Class({
Extends: ContextMenu, Extends: ContextMenu,
updateMenuItems: function () { updateMenuItems: function() {
all_are_seq_dl = true; all_are_seq_dl = true;
there_are_seq_dl = false; there_are_seq_dl = false;
all_are_f_l_piece_prio = true; all_are_f_l_piece_prio = true;
@ -259,7 +259,7 @@ var TorrentsTableContextMenu = new Class({
there_are_auto_tmm = false; there_are_auto_tmm = false;
var h = torrentsTable.selectedRowsIds(); var h = torrentsTable.selectedRowsIds();
h.each(function(item, index){ h.each(function(item, index) {
var data = torrentsTable.rows.get(item).full_data; var data = torrentsTable.rows.get(item).full_data;
if (data['seq_dl'] !== true) if (data['seq_dl'] !== true)
@ -310,7 +310,8 @@ var TorrentsTableContextMenu = new Class({
this.hideItem('FirstLastPiecePrio'); this.hideItem('FirstLastPiecePrio');
this.showItem('SuperSeeding'); this.showItem('SuperSeeding');
this.setItemChecked('SuperSeeding', all_are_super_seeding); this.setItemChecked('SuperSeeding', all_are_super_seeding);
} else { }
else {
if (!show_seq_dl && show_f_l_piece_prio) if (!show_seq_dl && show_f_l_piece_prio)
this.menu.getElement('a[href$=FirstLastPiecePrio]').parentNode.addClass('separator'); this.menu.getElement('a[href$=FirstLastPiecePrio]').parentNode.addClass('separator');
else else
@ -351,22 +352,28 @@ var TorrentsTableContextMenu = new Class({
}, },
updateCategoriesSubMenu : function (category_list) { updateCategoriesSubMenu: function(category_list) {
var categoryList = $('contextCategoryList'); var categoryList = $('contextCategoryList');
categoryList.empty(); categoryList.empty();
categoryList.appendChild(new Element('li', {html: '<a href="javascript:torrentNewCategoryFN();"><img src="theme/list-add" alt="QBT_TR(New...)QBT_TR[CONTEXT=TransferListWidget]"/> QBT_TR(New...)QBT_TR[CONTEXT=TransferListWidget]</a>'})); categoryList.appendChild(new Element('li', {
categoryList.appendChild(new Element('li', {html: '<a href="javascript:torrentSetCategoryFN(0);"><img src="theme/edit-clear" alt="QBT_TR(Reset)QBT_TR[CONTEXT=TransferListWidget]"/> QBT_TR(Reset)QBT_TR[CONTEXT=TransferListWidget]</a>'})); html: '<a href="javascript:torrentNewCategoryFN();"><img src="theme/list-add" alt="QBT_TR(New...)QBT_TR[CONTEXT=TransferListWidget]"/> QBT_TR(New...)QBT_TR[CONTEXT=TransferListWidget]</a>'
}));
categoryList.appendChild(new Element('li', {
html: '<a href="javascript:torrentSetCategoryFN(0);"><img src="theme/edit-clear" alt="QBT_TR(Reset)QBT_TR[CONTEXT=TransferListWidget]"/> QBT_TR(Reset)QBT_TR[CONTEXT=TransferListWidget]</a>'
}));
var sortedCategories = []; var sortedCategories = [];
Object.each(category_list, function (category) { Object.each(category_list, function(category) {
sortedCategories.push(category.name); sortedCategories.push(category.name);
}); });
sortedCategories.sort(); sortedCategories.sort();
var first = true; var first = true;
Object.each(sortedCategories, function (categoryName) { Object.each(sortedCategories, function(categoryName) {
var categoryHash = genHash(categoryName); var categoryHash = genHash(categoryName);
var el = new Element('li', {html: '<a href="javascript:torrentSetCategoryFN(\'' + categoryHash + '\');"><img src="theme/inode-directory"/> ' + escapeHtml(categoryName) + '</a>'}); var el = new Element('li', {
html: '<a href="javascript:torrentSetCategoryFN(\'' + categoryHash + '\');"><img src="theme/inode-directory"/> ' + escapeHtml(categoryName) + '</a>'
});
if (first) { if (first) {
el.addClass('separator'); el.addClass('separator');
first = false; first = false;
@ -378,7 +385,7 @@ var TorrentsTableContextMenu = new Class({
var CategoriesFilterContextMenu = new Class({ var CategoriesFilterContextMenu = new Class({
Extends: ContextMenu, Extends: ContextMenu,
updateMenuItems: function () { updateMenuItems: function() {
var id = this.options.element.id; var id = this.options.element.id;
if (id != CATEGORIES_ALL && id != CATEGORIES_UNCATEGORIZED) if (id != CATEGORIES_ALL && id != CATEGORIES_UNCATEGORIZED)
this.showItem('DeleteCategory'); this.showItem('DeleteCategory');

258
src/webui/www/private/scripts/dynamicTable.js

@ -36,9 +36,9 @@ var ProgressColumnWidth = -1;
var DynamicTable = new Class({ var DynamicTable = new Class({
initialize : function () {}, initialize: function() {},
setup : function (dynamicTableDivId, dynamicTableFixedHeaderDivId, contextMenu) { setup: function(dynamicTableDivId, dynamicTableFixedHeaderDivId, contextMenu) {
this.dynamicTableDivId = dynamicTableDivId; this.dynamicTableDivId = dynamicTableDivId;
this.dynamicTableFixedHeaderDivId = dynamicTableFixedHeaderDivId; this.dynamicTableFixedHeaderDivId = dynamicTableFixedHeaderDivId;
this.fixedTableHeader = $(dynamicTableFixedHeaderDivId).getElements('tr')[0]; this.fixedTableHeader = $(dynamicTableFixedHeaderDivId).getElements('tr')[0];
@ -58,10 +58,9 @@ var DynamicTable = new Class({
this.setupHeaderMenu(); this.setupHeaderMenu();
}, },
setupCommonEvents : function () { setupCommonEvents: function() {
var scrollFn = function() { var scrollFn = function() {
$(this.dynamicTableFixedHeaderDivId).getElements('table')[0].style.left = $(this.dynamicTableFixedHeaderDivId).getElements('table')[0].style.left = -$(this.dynamicTableDivId).scrollLeft + 'px';
-$(this.dynamicTableDivId).scrollLeft + 'px';
}.bind(this); }.bind(this);
$(this.dynamicTableDivId).addEvent('scroll', scrollFn); $(this.dynamicTableDivId).addEvent('scroll', scrollFn);
@ -101,11 +100,11 @@ var DynamicTable = new Class({
setInterval(checkResizeFn, 500); setInterval(checkResizeFn, 500);
}, },
setupHeaderEvents : function () { setupHeaderEvents: function() {
this.currentHeaderAction = ''; this.currentHeaderAction = '';
this.canResize = false; this.canResize = false;
var resetElementBorderStyle = function (el, side) { var resetElementBorderStyle = function(el, side) {
if (side === 'left' || side !== 'right') { if (side === 'left' || side !== 'right') {
el.setStyle('border-left-style', ''); el.setStyle('border-left-style', '');
el.setStyle('border-left-color', ''); el.setStyle('border-left-color', '');
@ -118,7 +117,7 @@ var DynamicTable = new Class({
} }
}; };
var mouseMoveFn = function (e) { var mouseMoveFn = function(e) {
var brect = e.target.getBoundingClientRect(); var brect = e.target.getBoundingClientRect();
var mouseXRelative = e.event.clientX - brect.left; var mouseXRelative = e.event.clientX - brect.left;
if (this.currentHeaderAction === '') { if (this.currentHeaderAction === '') {
@ -131,7 +130,8 @@ var DynamicTable = new Class({
this.resizeTh = e.target.getPrevious('[class=""]'); this.resizeTh = e.target.getPrevious('[class=""]');
this.canResize = true; this.canResize = true;
e.target.getParent("tr").style.cursor = 'col-resize'; e.target.getParent("tr").style.cursor = 'col-resize';
} else { }
else {
this.canResize = false; this.canResize = false;
e.target.getParent("tr").style.cursor = ''; e.target.getParent("tr").style.cursor = '';
} }
@ -164,7 +164,7 @@ var DynamicTable = new Class({
resetElementBorderStyle(borderChangeElement, changeBorderSide === 'right' ? 'left' : 'right'); resetElementBorderStyle(borderChangeElement, changeBorderSide === 'right' ? 'left' : 'right');
borderChangeElement.getSiblings('[class=""]').each(function(el){ borderChangeElement.getSiblings('[class=""]').each(function(el) {
resetElementBorderStyle(el); resetElementBorderStyle(el);
}); });
} }
@ -172,18 +172,18 @@ var DynamicTable = new Class({
this.lastClientX = e.event.clientX; this.lastClientX = e.event.clientX;
}.bind(this); }.bind(this);
var mouseOutFn = function (e) { var mouseOutFn = function(e) {
resetElementBorderStyle(e.target); resetElementBorderStyle(e.target);
}.bind(this); }.bind(this);
var onBeforeStart = function (el) { var onBeforeStart = function(el) {
this.clickedTh = el; this.clickedTh = el;
this.currentHeaderAction = 'start'; this.currentHeaderAction = 'start';
this.dragMovement = false; this.dragMovement = false;
this.dragStartX = this.lastClientX; this.dragStartX = this.lastClientX;
}.bind(this); }.bind(this);
var onStart = function (el, event) { var onStart = function(el, event) {
if (this.canResize) { if (this.canResize) {
this.currentHeaderAction = 'resize'; this.currentHeaderAction = 'resize';
this.startWidth = this.resizeTh.getStyle('width').toFloat(); this.startWidth = this.resizeTh.getStyle('width').toFloat();
@ -194,7 +194,7 @@ var DynamicTable = new Class({
} }
}.bind(this); }.bind(this);
var onDrag = function (el, event) { var onDrag = function(el, event) {
if (this.currentHeaderAction === 'resize') { if (this.currentHeaderAction === 'resize') {
var width = this.startWidth + (event.page.x - this.dragStartX); var width = this.startWidth + (event.page.x - this.dragStartX);
if (width < 16) if (width < 16)
@ -204,7 +204,7 @@ var DynamicTable = new Class({
} }
}.bind(this); }.bind(this);
var onComplete = function (el, event) { var onComplete = function(el, event) {
resetElementBorderStyle(this.lastHoverTh); resetElementBorderStyle(this.lastHoverTh);
el.setStyle('background-color', ''); el.setStyle('background-color', '');
if (this.currentHeaderAction === 'resize') if (this.currentHeaderAction === 'resize')
@ -225,14 +225,14 @@ var DynamicTable = new Class({
} }
if (this.currentHeaderAction === 'drag') { if (this.currentHeaderAction === 'drag') {
resetElementBorderStyle(el); resetElementBorderStyle(el);
el.getSiblings('[class=""]').each(function(el){ el.getSiblings('[class=""]').each(function(el) {
resetElementBorderStyle(el); resetElementBorderStyle(el);
}); });
} }
this.currentHeaderAction = ''; this.currentHeaderAction = '';
}.bind(this); }.bind(this);
var onCancel = function (el) { var onCancel = function(el) {
this.currentHeaderAction = ''; this.currentHeaderAction = '';
this.setSortedColumn(el.columnName); this.setSortedColumn(el.columnName);
}.bind(this); }.bind(this);
@ -244,21 +244,24 @@ var DynamicTable = new Class({
th.addEvent('mousemove', mouseMoveFn); th.addEvent('mousemove', mouseMoveFn);
th.addEvent('mouseout', mouseOutFn); th.addEvent('mouseout', mouseOutFn);
th.makeResizable({ th.makeResizable({
modifiers : {x: '', y: ''}, modifiers: {
onBeforeStart : onBeforeStart, x: '',
onStart : onStart, y: ''
onDrag : onDrag, },
onComplete : onComplete, onBeforeStart: onBeforeStart,
onCancel : onCancel onStart: onStart,
onDrag: onDrag,
onComplete: onComplete,
onCancel: onCancel
}); });
} }
}, },
setupDynamicTableHeaderContextMenuClass : function () { setupDynamicTableHeaderContextMenuClass: function() {
if (!DynamicTableHeaderContextMenuClass) { if (!DynamicTableHeaderContextMenuClass) {
DynamicTableHeaderContextMenuClass = new Class({ DynamicTableHeaderContextMenuClass = new Class({
Extends: ContextMenu, Extends: ContextMenu,
updateMenuItems: function () { updateMenuItems: function() {
for (var i = 0; i < this.dynamicTable.columns.length; i++) { for (var i = 0; i < this.dynamicTable.columns.length; i++) {
if (this.dynamicTable.columns[i].caption === '') if (this.dynamicTable.columns[i].caption === '')
continue; continue;
@ -272,27 +275,32 @@ var DynamicTable = new Class({
} }
}, },
showColumn : function (columnName, show) { showColumn: function(columnName, show) {
this.columns[columnName].visible = show ? '1' : '0'; this.columns[columnName].visible = show ? '1' : '0';
localStorage.setItem('column_' + columnName + '_visible_' + this.dynamicTableDivId, show ? '1' : '0'); localStorage.setItem('column_' + columnName + '_visible_' + this.dynamicTableDivId, show ? '1' : '0');
this.updateColumn(columnName); this.updateColumn(columnName);
}, },
setupHeaderMenu : function () { setupHeaderMenu: function() {
this.setupDynamicTableHeaderContextMenuClass(); this.setupDynamicTableHeaderContextMenuClass();
var menuId = this.dynamicTableDivId + '_headerMenu'; var menuId = this.dynamicTableDivId + '_headerMenu';
var ul = new Element('ul', {id: menuId, class: 'contextMenu scrollableMenu'}); var ul = new Element('ul', {
id: menuId,
class: 'contextMenu scrollableMenu'
});
var createLi = function(columnName, text) { var createLi = function(columnName, text) {
var html = '<a href="#' + columnName + '" ><img src="theme/checked"/>' + escapeHtml(text) + '</a>'; var html = '<a href="#' + columnName + '" ><img src="theme/checked"/>' + escapeHtml(text) + '</a>';
return new Element('li', {html: html}); return new Element('li', {
html: html
});
}; };
var actions = {}; var actions = {};
var onMenuItemClicked = function (element, ref, action) { var onMenuItemClicked = function(element, ref, action) {
this.showColumn(action, this.columns[action].visible === '0'); this.showColumn(action, this.columns[action].visible === '0');
}.bind(this); }.bind(this);
@ -309,19 +317,19 @@ var DynamicTable = new Class({
this.headerContextMenu = new DynamicTableHeaderContextMenuClass({ this.headerContextMenu = new DynamicTableHeaderContextMenuClass({
targets: '#' + this.dynamicTableFixedHeaderDivId + ' tr', targets: '#' + this.dynamicTableFixedHeaderDivId + ' tr',
actions: actions, actions: actions,
menu : menuId, menu: menuId,
offsets : { offsets: {
x : -15, x: -15,
y : 2 y: 2
} }
}); });
this.headerContextMenu.dynamicTable = this; this.headerContextMenu.dynamicTable = this;
}, },
initColumns : function () {}, initColumns: function() {},
newColumn : function (name, style, caption, defaultWidth, defaultVisible) { newColumn: function(name, style, caption, defaultWidth, defaultVisible) {
var column = {}; var column = {};
column['name'] = name; column['name'] = name;
column['visible'] = getLocalStorageItem('column_' + name + '_visible_' + this.dynamicTableDivId, defaultVisible ? '1' : '0'); column['visible'] = getLocalStorageItem('column_' + name + '_visible_' + this.dynamicTableDivId, defaultVisible ? '1' : '0');
@ -330,19 +338,19 @@ var DynamicTable = new Class({
column['style'] = style; column['style'] = style;
column['width'] = getLocalStorageItem('column_' + name + '_width_' + this.dynamicTableDivId, defaultWidth); column['width'] = getLocalStorageItem('column_' + name + '_width_' + this.dynamicTableDivId, defaultWidth);
column['dataProperties'] = [name]; column['dataProperties'] = [name];
column['getRowValue'] = function (row, pos) { column['getRowValue'] = function(row, pos) {
if (pos === undefined) if (pos === undefined)
pos = 0; pos = 0;
return row['full_data'][this.dataProperties[pos]]; return row['full_data'][this.dataProperties[pos]];
}; };
column['compareRows'] = function (row1, row2) { column['compareRows'] = function(row1, row2) {
if (this.getRowValue(row1) < this.getRowValue(row2)) if (this.getRowValue(row1) < this.getRowValue(row2))
return -1; return -1;
else if (this.getRowValue(row1) > this.getRowValue(row2)) else if (this.getRowValue(row1) > this.getRowValue(row2))
return 1; return 1;
else return 0; else return 0;
}; };
column['updateTd'] = function (td, row) { column['updateTd'] = function(td, row) {
td.innerHTML = this.getRowValue(row); td.innerHTML = this.getRowValue(row);
}; };
column['onResize'] = null; column['onResize'] = null;
@ -353,7 +361,7 @@ var DynamicTable = new Class({
this.fixedTableHeader.appendChild(new Element('th')); this.fixedTableHeader.appendChild(new Element('th'));
}, },
loadColumnsOrder : function () { loadColumnsOrder: function() {
var columnsOrder = []; var columnsOrder = [];
var val = localStorage.getItem('columns_order_' + this.dynamicTableDivId); var val = localStorage.getItem('columns_order_' + this.dynamicTableDivId);
if (val === null || val === undefined) return; if (val === null || val === undefined) return;
@ -370,7 +378,7 @@ var DynamicTable = new Class({
this.columns[i] = this.columns[columnsOrder[i]]; this.columns[i] = this.columns[columnsOrder[i]];
}, },
saveColumnsOrder : function () { saveColumnsOrder: function() {
val = ''; val = '';
for (i = 0; i < this.columns.length; i++) { for (i = 0; i < this.columns.length; i++) {
if (i > 0) if (i > 0)
@ -380,12 +388,12 @@ var DynamicTable = new Class({
localStorage.setItem('columns_order_' + this.dynamicTableDivId, val); localStorage.setItem('columns_order_' + this.dynamicTableDivId, val);
}, },
updateTableHeaders : function () { updateTableHeaders: function() {
this.updateHeader(this.hiddenTableHeader); this.updateHeader(this.hiddenTableHeader);
this.updateHeader(this.fixedTableHeader); this.updateHeader(this.fixedTableHeader);
}, },
updateHeader : function (header) { updateHeader: function(header) {
var ths = header.getElements('th'); var ths = header.getElements('th');
for (var i = 0; i < ths.length; i++) { for (var i = 0; i < ths.length; i++) {
@ -402,14 +410,14 @@ var DynamicTable = new Class({
} }
}, },
getColumnPos : function (columnName) { getColumnPos: function(columnName) {
for (var i = 0; i < this.columns.length; i++) for (var i = 0; i < this.columns.length; i++)
if (this.columns[i].name == columnName) if (this.columns[i].name == columnName)
return i; return i;
return -1; return -1;
}, },
updateColumn : function (columnName) { updateColumn: function(columnName) {
var pos = this.getColumnPos(columnName); var pos = this.getColumnPos(columnName);
var visible = ((this.columns[pos].visible != '0') && !this.columns[pos].force_hide); var visible = ((this.columns[pos].visible != '0') && !this.columns[pos].force_hide);
var ths = this.hiddenTableHeader.getElements('th'); var ths = this.hiddenTableHeader.getElements('th');
@ -432,13 +440,12 @@ var DynamicTable = new Class({
for (var j = 0; j < trs.length; j++) for (var j = 0; j < trs.length; j++)
trs[j].getElements('td')[pos].addClass('invisible'); trs[j].getElements('td')[pos].addClass('invisible');
} }
if (this.columns[pos].onResize !== null) if (this.columns[pos].onResize !== null) {
{
this.columns[pos].onResize(columnName); this.columns[pos].onResize(columnName);
} }
}, },
setSortedColumn : function (column) { setSortedColumn: function(column) {
if (column != this.sortedColumn) { if (column != this.sortedColumn) {
this.sortedColumn = column; this.sortedColumn = column;
this.reverseSort = '0'; this.reverseSort = '0';
@ -452,27 +459,28 @@ var DynamicTable = new Class({
this.updateTable(false); this.updateTable(false);
}, },
getSelectedRowId : function () { getSelectedRowId: function() {
if (this.selectedRows.length > 0) if (this.selectedRows.length > 0)
return this.selectedRows[0]; return this.selectedRows[0];
return ''; return '';
}, },
altRow : function () { altRow: function() {
if (!MUI.ieLegacySupport) if (!MUI.ieLegacySupport)
return; return;
var trs = this.tableBody.getElements('tr'); var trs = this.tableBody.getElements('tr');
trs.each(function (el, i) { trs.each(function(el, i) {
if (i % 2) { if (i % 2) {
el.addClass('alt'); el.addClass('alt');
} else { }
else {
el.removeClass('alt'); el.removeClass('alt');
} }
}.bind(this)); }.bind(this));
}, },
selectAll : function () { selectAll: function() {
this.selectedRows.empty(); this.selectedRows.empty();
var trs = this.tableBody.getElements('tr'); var trs = this.tableBody.getElements('tr');
@ -484,11 +492,11 @@ var DynamicTable = new Class({
} }
}, },
deselectAll : function () { deselectAll: function() {
this.selectedRows.empty(); this.selectedRows.empty();
}, },
selectRow : function (rowId) { selectRow: function(rowId) {
this.deselectAll(); this.deselectAll();
this.selectedRows.push(rowId); this.selectedRows.push(rowId);
this.tableBody.getElements('tr').each(function(tr) { this.tableBody.getElements('tr').each(function(tr) {
@ -500,7 +508,7 @@ var DynamicTable = new Class({
this.onSelectedRowChanged(); this.onSelectedRowChanged();
}, },
reselectRows : function(rowIds) { reselectRows: function(rowIds) {
this.deselectAll(); this.deselectAll();
this.selectedRows = rowIds.slice(); this.selectedRows = rowIds.slice();
this.tableBody.getElements('tr').each(function(tr) { this.tableBody.getElements('tr').each(function(tr) {
@ -509,9 +517,9 @@ var DynamicTable = new Class({
}); });
}, },
onSelectedRowChanged : function () {}, onSelectedRowChanged: function() {},
updateRowData : function (data) { updateRowData: function(data) {
var rowId = data['rowId']; var rowId = data['rowId'];
var row; var row;
@ -526,22 +534,21 @@ var DynamicTable = new Class({
row['data'] = data; row['data'] = data;
for(var x in data) for (var x in data)
row['full_data'][x] = data[x]; row['full_data'][x] = data[x];
}, },
getFilteredAndSortedRows : function () { getFilteredAndSortedRows: function() {
var filteredRows = []; var filteredRows = [];
var rows = this.rows.getValues(); var rows = this.rows.getValues();
for (i = 0; i < rows.length; i++) for (i = 0; i < rows.length; i++) {
{
filteredRows.push(rows[i]); filteredRows.push(rows[i]);
filteredRows[rows[i].rowId] = rows[i]; filteredRows[rows[i].rowId] = rows[i];
} }
filteredRows.sort(function (row1, row2) { filteredRows.sort(function(row1, row2) {
var column = this.columns[this.sortedColumn]; var column = this.columns[this.sortedColumn];
res = column.compareRows(row1, row2); res = column.compareRows(row1, row2);
if (this.reverseSort == '0') if (this.reverseSort == '0')
@ -552,7 +559,7 @@ var DynamicTable = new Class({
return filteredRows; return filteredRows;
}, },
getTrByRowId : function (rowId) { getTrByRowId: function(rowId) {
trs = this.tableBody.getElements('tr'); trs = this.tableBody.getElements('tr');
for (var i = 0; i < trs.length; i++) for (var i = 0; i < trs.length; i++)
if (trs[i].rowId == rowId) if (trs[i].rowId == rowId)
@ -560,7 +567,7 @@ var DynamicTable = new Class({
return null; return null;
}, },
updateTable : function (fullUpdate) { updateTable: function(fullUpdate) {
if (fullUpdate === undefined) if (fullUpdate === undefined)
fullUpdate = false; fullUpdate = false;
@ -596,12 +603,12 @@ var DynamicTable = new Class({
tr['rowId'] = rows[rowPos]['rowId']; tr['rowId'] = rows[rowPos]['rowId'];
tr._this = this; tr._this = this;
tr.addEvent('contextmenu', function (e) { tr.addEvent('contextmenu', function(e) {
if (!this._this.selectedRows.contains(this.rowId)) if (!this._this.selectedRows.contains(this.rowId))
this._this.selectRow(this.rowId); this._this.selectRow(this.rowId);
return true; return true;
}); });
tr.addEvent('click', function (e) { tr.addEvent('click', function(e) {
e.stop(); e.stop();
if (e.control) { if (e.control) {
// CTRL key was pressed // CTRL key was pressed
@ -642,7 +649,8 @@ var DynamicTable = new Class({
tr.removeClass('selected'); tr.removeClass('selected');
} }
} }
} else { }
else {
// Simple selection // Simple selection
this._this.selectRow(this.rowId); this._this.selectRow(this.rowId);
} }
@ -652,7 +660,7 @@ var DynamicTable = new Class({
this.setupTr(tr); this.setupTr(tr);
for (var k = 0 ; k < this.columns.length; k++) { for (var k = 0; k < this.columns.length; k++) {
var td = new Element('td'); var td = new Element('td');
if ((this.columns[k].visible == '0') || this.columns[k].force_hide) if ((this.columns[k].visible == '0') || this.columns[k].force_hide)
td.addClass('invisible'); td.addClass('invisible');
@ -685,9 +693,9 @@ var DynamicTable = new Class({
} }
}, },
setupTr : function (tr) {}, setupTr: function(tr) {},
updateRow : function (tr, fullUpdate) { updateRow: function(tr, fullUpdate) {
var row = this.rows.get(tr.rowId); var row = this.rows.get(tr.rowId);
data = row[fullUpdate ? 'full_data' : 'data']; data = row[fullUpdate ? 'full_data' : 'data'];
@ -699,7 +707,7 @@ var DynamicTable = new Class({
row['data'] = {}; row['data'] = {};
}, },
removeRow : function (rowId) { removeRow: function(rowId) {
this.selectedRows.erase(rowId); this.selectedRows.erase(rowId);
var tr = this.getTrByRowId(rowId); var tr = this.getTrByRowId(rowId);
if (tr !== null) { if (tr !== null) {
@ -710,7 +718,7 @@ var DynamicTable = new Class({
return false; return false;
}, },
clear : function () { clear: function() {
this.selectedRows.empty(); this.selectedRows.empty();
this.rows.empty(); this.rows.empty();
var trs = this.tableBody.getElements('tr'); var trs = this.tableBody.getElements('tr');
@ -720,19 +728,19 @@ var DynamicTable = new Class({
} }
}, },
selectedRowsIds : function () { selectedRowsIds: function() {
return this.selectedRows.slice(); return this.selectedRows.slice();
}, },
getRowIds : function () { getRowIds: function() {
return this.rows.getKeys(); return this.rows.getKeys();
}, },
}); });
var TorrentsTable = new Class({ var TorrentsTable = new Class({
Extends: DynamicTable, Extends: DynamicTable,
initColumns : function () { initColumns: function() {
this.newColumn('priority', '', '#', 30, true); this.newColumn('priority', '', '#', 30, true);
this.newColumn('state_icon', 'cursor: default', '', 22, true); this.newColumn('state_icon', 'cursor: default', '', 22, true);
this.newColumn('name', '', 'QBT_TR(Name)QBT_TR[CONTEXT=TorrentModel]', 200, true); this.newColumn('name', '', 'QBT_TR(Name)QBT_TR[CONTEXT=TorrentModel]', 200, true);
@ -775,10 +783,10 @@ var TorrentsTable = new Class({
this.initColumnsFunctions(); this.initColumnsFunctions();
}, },
initColumnsFunctions : function () { initColumnsFunctions: function() {
// state_icon // state_icon
this.columns['state_icon'].updateTd = function (td, row) { this.columns['state_icon'].updateTd = function(td, row) {
var state = this.getRowValue(row); var state = this.getRowValue(row);
// normalize states // normalize states
switch (state) { switch (state) {
@ -825,13 +833,13 @@ var TorrentsTable = new Class({
} }
else else
td.adopt(new Element('img', { td.adopt(new Element('img', {
'src' : img_path, 'src': img_path,
'class' : 'stateIcon' 'class': 'stateIcon'
})); }));
}; };
// status // status
this.columns['status'].updateTd = function (td, row) { this.columns['status'].updateTd = function(td, row) {
var state = this.getRowValue(row); var state = this.getRowValue(row);
if (!state) return; if (!state) return;
@ -893,12 +901,12 @@ var TorrentsTable = new Class({
}; };
// priority // priority
this.columns['priority'].updateTd = function (td, row) { this.columns['priority'].updateTd = function(td, row) {
var priority = this.getRowValue(row); var priority = this.getRowValue(row);
td.set('html', priority < 1 ? '*' : priority); td.set('html', priority < 1 ? '*' : priority);
}; };
this.columns['priority'].compareRows = function (row1, row2) { this.columns['priority'].compareRows = function(row1, row2) {
var row1_val = this.getRowValue(row1); var row1_val = this.getRowValue(row1);
var row2_val = this.getRowValue(row2); var row2_val = this.getRowValue(row2);
if (row1_val < 1) if (row1_val < 1)
@ -913,19 +921,19 @@ var TorrentsTable = new Class({
}; };
// name, category // name, category
this.columns['name'].updateTd = function (td, row) { this.columns['name'].updateTd = function(td, row) {
td.set('html', escapeHtml(this.getRowValue(row))); td.set('html', escapeHtml(this.getRowValue(row)));
}; };
this.columns['category'].updateTd = this.columns['name'].updateTd; this.columns['category'].updateTd = this.columns['name'].updateTd;
// size // size
this.columns['size'].updateTd = function (td, row) { this.columns['size'].updateTd = function(td, row) {
var size = this.getRowValue(row); var size = this.getRowValue(row);
td.set('html', friendlyUnit(size, false)); td.set('html', friendlyUnit(size, false));
}; };
// progress // progress
this.columns['progress'].updateTd = function (td, row) { this.columns['progress'].updateTd = function(td, row) {
var progress = this.getRowValue(row); var progress = this.getRowValue(row);
var progressFormated = (progress * 100).round(1); var progressFormated = (progress * 100).round(1);
if (progressFormated == 100.0 && progress != 1.0) if (progressFormated == 100.0 && progress != 1.0)
@ -944,13 +952,13 @@ var TorrentsTable = new Class({
if (ProgressColumnWidth < 0) if (ProgressColumnWidth < 0)
ProgressColumnWidth = td.offsetWidth; ProgressColumnWidth = td.offsetWidth;
td.adopt(new ProgressBar(progressFormated.toFloat(), { td.adopt(new ProgressBar(progressFormated.toFloat(), {
'width' : ProgressColumnWidth - 5 'width': ProgressColumnWidth - 5
})); }));
td.resized = false; td.resized = false;
} }
}; };
this.columns['progress'].onResize = function (columnName) { this.columns['progress'].onResize = function(columnName) {
var pos = this.getColumnPos(columnName); var pos = this.getColumnPos(columnName);
var trs = this.tableBody.getElements('tr'); var trs = this.tableBody.getElements('tr');
ProgressColumnWidth = -1; ProgressColumnWidth = -1;
@ -964,7 +972,7 @@ var TorrentsTable = new Class({
}.bind(this); }.bind(this);
// num_seeds // num_seeds
this.columns['num_seeds'].updateTd = function (td, row) { this.columns['num_seeds'].updateTd = function(td, row) {
var num_seeds = this.getRowValue(row, 0); var num_seeds = this.getRowValue(row, 0);
var num_complete = this.getRowValue(row, 1); var num_complete = this.getRowValue(row, 1);
var html = num_seeds; var html = num_seeds;
@ -972,7 +980,7 @@ var TorrentsTable = new Class({
html += ' (' + num_complete + ')'; html += ' (' + num_complete + ')';
td.set('html', html); td.set('html', html);
}; };
this.columns['num_seeds'].compareRows = function (row1, row2) { this.columns['num_seeds'].compareRows = function(row1, row2) {
var num_seeds1 = this.getRowValue(row1, 0); var num_seeds1 = this.getRowValue(row1, 0);
var num_complete1 = this.getRowValue(row1, 1); var num_complete1 = this.getRowValue(row1, 1);
@ -995,7 +1003,7 @@ var TorrentsTable = new Class({
this.columns['num_leechs'].compareRows = this.columns['num_seeds'].compareRows; this.columns['num_leechs'].compareRows = this.columns['num_seeds'].compareRows;
// dlspeed // dlspeed
this.columns['dlspeed'].updateTd = function (td, row) { this.columns['dlspeed'].updateTd = function(td, row) {
var speed = this.getRowValue(row); var speed = this.getRowValue(row);
td.set('html', friendlyUnit(speed, true)); td.set('html', friendlyUnit(speed, true));
}; };
@ -1004,13 +1012,13 @@ var TorrentsTable = new Class({
this.columns['upspeed'].updateTd = this.columns['dlspeed'].updateTd; this.columns['upspeed'].updateTd = this.columns['dlspeed'].updateTd;
// eta // eta
this.columns['eta'].updateTd = function (td, row) { this.columns['eta'].updateTd = function(td, row) {
var eta = this.getRowValue(row); var eta = this.getRowValue(row);
td.set('html', friendlyDuration(eta, true)); td.set('html', friendlyDuration(eta, true));
}; };
// ratio // ratio
this.columns['ratio'].updateTd = function (td, row) { this.columns['ratio'].updateTd = function(td, row) {
var ratio = this.getRowValue(row); var ratio = this.getRowValue(row);
var html = null; var html = null;
if (ratio == -1) if (ratio == -1)
@ -1024,13 +1032,13 @@ var TorrentsTable = new Class({
this.columns['tags'].updateTd = this.columns['name'].updateTd; this.columns['tags'].updateTd = this.columns['name'].updateTd;
// added on // added on
this.columns['added_on'].updateTd = function (td, row) { this.columns['added_on'].updateTd = function(td, row) {
var date = new Date(this.getRowValue(row) * 1000).toLocaleString(); var date = new Date(this.getRowValue(row) * 1000).toLocaleString();
td.set('html', date); td.set('html', date);
}; };
// completion_on // completion_on
this.columns['completion_on'].updateTd = function (td, row) { this.columns['completion_on'].updateTd = function(td, row) {
var val = this.getRowValue(row); var val = this.getRowValue(row);
if (val === 0xffffffff || val < 0) if (val === 0xffffffff || val < 0)
td.set('html', ''); td.set('html', '');
@ -1044,7 +1052,7 @@ var TorrentsTable = new Class({
this.columns['seen_complete'].updateTd = this.columns['completion_on'].updateTd; this.columns['seen_complete'].updateTd = this.columns['completion_on'].updateTd;
// dl_limit, up_limit // dl_limit, up_limit
this.columns['dl_limit'].updateTd = function (td, row) { this.columns['dl_limit'].updateTd = function(td, row) {
var speed = this.getRowValue(row); var speed = this.getRowValue(row);
if (speed === 0) if (speed === 0)
td.set('html', '∞'); td.set('html', '∞');
@ -1072,7 +1080,7 @@ var TorrentsTable = new Class({
this.columns['ratio_limit'].updateTd = this.columns['ratio'].updateTd; this.columns['ratio_limit'].updateTd = this.columns['ratio'].updateTd;
// last_activity // last_activity
this.columns['last_activity'].updateTd = function (td, row) { this.columns['last_activity'].updateTd = function(td, row) {
var val = this.getRowValue(row); var val = this.getRowValue(row);
if (val < 1) if (val < 1)
td.set('html', '∞'); td.set('html', '∞');
@ -1081,18 +1089,18 @@ var TorrentsTable = new Class({
}; };
// time active // time active
this.columns['time_active'].updateTd = function (td, row) { this.columns['time_active'].updateTd = function(td, row) {
var time = this.getRowValue(row); var time = this.getRowValue(row);
td.set('html', friendlyDuration(time)); td.set('html', friendlyDuration(time));
}; };
}, },
applyFilter : function (row, filterName, categoryHash) { applyFilter: function(row, filterName, categoryHash) {
var state = row['full_data'].state; var state = row['full_data'].state;
var inactive = false; var inactive = false;
var r; var r;
switch(filterName) { switch (filterName) {
case 'downloading': case 'downloading':
if (state != 'downloading' && !~state.indexOf('DL')) if (state != 'downloading' && !~state.indexOf('DL'))
return false; return false;
@ -1142,7 +1150,7 @@ var TorrentsTable = new Class({
return true; return true;
}, },
getFilteredTorrentsNumber : function (filterName, categoryHash) { getFilteredTorrentsNumber: function(filterName, categoryHash) {
var cnt = 0; var cnt = 0;
var rows = this.rows.getValues(); var rows = this.rows.getValues();
@ -1151,7 +1159,7 @@ var TorrentsTable = new Class({
return cnt; return cnt;
}, },
getFilteredTorrentsHashes : function (filterName, categoryHash) { getFilteredTorrentsHashes: function(filterName, categoryHash) {
var rowsHashes = []; var rowsHashes = [];
var rows = this.rows.getValues(); var rows = this.rows.getValues();
@ -1162,7 +1170,7 @@ var TorrentsTable = new Class({
return rowsHashes; return rowsHashes;
}, },
getFilteredAndSortedRows : function () { getFilteredAndSortedRows: function() {
var filteredRows = []; var filteredRows = [];
var rows = this.rows.getValues(); var rows = this.rows.getValues();
@ -1173,7 +1181,7 @@ var TorrentsTable = new Class({
filteredRows[rows[i].rowId] = rows[i]; filteredRows[rows[i].rowId] = rows[i];
} }
filteredRows.sort(function (row1, row2) { filteredRows.sort(function(row1, row2) {
var column = this.columns[this.sortedColumn]; var column = this.columns[this.sortedColumn];
res = column.compareRows(row1, row2); res = column.compareRows(row1, row2);
if (this.reverseSort == '0') if (this.reverseSort == '0')
@ -1184,8 +1192,8 @@ var TorrentsTable = new Class({
return filteredRows; return filteredRows;
}, },
setupTr : function (tr) { setupTr: function(tr) {
tr.addEvent('dblclick', function (e) { tr.addEvent('dblclick', function(e) {
e.stop(); e.stop();
this._this.selectRow(this.rowId); this._this.selectRow(this.rowId);
var row = this._this.rows.get(this.rowId); var row = this._this.rows.get(this.rowId);
@ -1199,19 +1207,19 @@ var TorrentsTable = new Class({
tr.addClass("torrentsTableContextMenuTarget"); tr.addClass("torrentsTableContextMenuTarget");
}, },
getCurrentTorrentHash : function () { getCurrentTorrentHash: function() {
return this.getSelectedRowId(); return this.getSelectedRowId();
}, },
onSelectedRowChanged : function () { onSelectedRowChanged: function() {
updatePropertiesPanel(); updatePropertiesPanel();
} }
}); });
var TorrentPeersTable = new Class({ var TorrentPeersTable = new Class({
Extends: DynamicTable, Extends: DynamicTable,
initColumns : function () { initColumns: function() {
this.newColumn('country', '', 'QBT_TR(Country)QBT_TR[CONTEXT=PeerListWidget]', 22, true); this.newColumn('country', '', 'QBT_TR(Country)QBT_TR[CONTEXT=PeerListWidget]', 22, true);
this.newColumn('ip', '', 'QBT_TR(IP)QBT_TR[CONTEXT=PeerListWidget]', 80, true); this.newColumn('ip', '', 'QBT_TR(IP)QBT_TR[CONTEXT=PeerListWidget]', 80, true);
this.newColumn('port', '', 'QBT_TR(Port)QBT_TR[CONTEXT=PeerListWidget]', 35, true); this.newColumn('port', '', 'QBT_TR(Port)QBT_TR[CONTEXT=PeerListWidget]', 35, true);
@ -1231,11 +1239,11 @@ var TorrentPeersTable = new Class({
this.initColumnsFunctions(); this.initColumnsFunctions();
}, },
initColumnsFunctions : function () { initColumnsFunctions: function() {
// country // country
this.columns['country'].updateTd = function (td, row) { this.columns['country'].updateTd = function(td, row) {
var country = this.getRowValue(row, 0); var country = this.getRowValue(row, 0);
var country_code = this.getRowValue(row, 1); var country_code = this.getRowValue(row, 1);
@ -1256,23 +1264,23 @@ var TorrentPeersTable = new Class({
} }
else else
td.adopt(new Element('img', { td.adopt(new Element('img', {
'src' : img_path, 'src': img_path,
'class' : 'flags', 'class': 'flags',
'alt' : country, 'alt': country,
'title' : country 'title': country
})); }));
}; };
// ip // ip
this.columns['ip'].compareRows = function (row1, row2) { this.columns['ip'].compareRows = function(row1, row2) {
var ip1 = this.getRowValue(row1); var ip1 = this.getRowValue(row1);
var ip2 = this.getRowValue(row2); var ip2 = this.getRowValue(row2);
var a = ip1.split("."); var a = ip1.split(".");
var b = ip2.split("."); var b = ip2.split(".");
for (var i = 0; i < 4; i++){ for (var i = 0; i < 4; i++) {
if (a[i] != b[i]) if (a[i] != b[i])
return a[i] - b[i]; return a[i] - b[i];
} }
@ -1282,7 +1290,7 @@ var TorrentPeersTable = new Class({
// progress, relevance // progress, relevance
this.columns['progress'].updateTd = function (td, row) { this.columns['progress'].updateTd = function(td, row) {
var progress = this.getRowValue(row); var progress = this.getRowValue(row);
var progressFormated = (progress * 100).round(1); var progressFormated = (progress * 100).round(1);
if (progressFormated == 100.0 && progress != 1.0) if (progressFormated == 100.0 && progress != 1.0)
@ -1295,7 +1303,7 @@ var TorrentPeersTable = new Class({
// dl_speed, up_speed // dl_speed, up_speed
this.columns['dl_speed'].updateTd = function (td, row) { this.columns['dl_speed'].updateTd = function(td, row) {
var speed = this.getRowValue(row); var speed = this.getRowValue(row);
if (speed === 0) if (speed === 0)
td.set('html', ''); td.set('html', '');
@ -1307,7 +1315,7 @@ var TorrentPeersTable = new Class({
// downloaded, uploaded // downloaded, uploaded
this.columns['downloaded'].updateTd = function (td, row) { this.columns['downloaded'].updateTd = function(td, row) {
var downloaded = this.getRowValue(row); var downloaded = this.getRowValue(row);
td.set('html', friendlyUnit(downloaded, false)); td.set('html', friendlyUnit(downloaded, false));
}; };
@ -1316,19 +1324,19 @@ var TorrentPeersTable = new Class({
// flags // flags
this.columns['flags'].updateTd = function (td, row) { this.columns['flags'].updateTd = function(td, row) {
td.innerHTML = this.getRowValue(row, 0); td.innerHTML = this.getRowValue(row, 0);
td.title = this.getRowValue(row, 1); td.title = this.getRowValue(row, 1);
}; };
// files // files
this.columns['files'].updateTd = function (td, row) { this.columns['files'].updateTd = function(td, row) {
td.innerHTML = escapeHtml(this.getRowValue(row, 0).replace('\n', ';')); td.innerHTML = escapeHtml(this.getRowValue(row, 0).replace('\n', ';'));
td.title = escapeHtml(this.getRowValue(row, 0)); td.title = escapeHtml(this.getRowValue(row, 0));
}; };
} }
}); });
/*************************************************************/ /*************************************************************/

18
src/webui/www/private/scripts/misc.js

@ -90,14 +90,14 @@ if (!Date.prototype.toISOString) {
} }
Date.prototype.toISOString = function() { Date.prototype.toISOString = function() {
return this.getUTCFullYear() + return this.getUTCFullYear()
'-' + pad(this.getUTCMonth() + 1) + + '-' + pad(this.getUTCMonth() + 1)
'-' + pad(this.getUTCDate()) + + '-' + pad(this.getUTCDate())
'T' + pad(this.getUTCHours()) + + 'T' + pad(this.getUTCHours())
':' + pad(this.getUTCMinutes()) + + ':' + pad(this.getUTCMinutes())
':' + pad(this.getUTCSeconds()) + + ':' + pad(this.getUTCSeconds())
'.' + (this.getUTCMilliseconds() / 1000).toFixed(3).slice(2, 5) + + '.' + (this.getUTCMilliseconds() / 1000).toFixed(3).slice(2, 5)
'Z'; + 'Z';
}; };
}()); }());
@ -108,7 +108,7 @@ if (!Date.prototype.toISOString) {
*/ */
function parseHtmlLinks(text) { function parseHtmlLinks(text) {
var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig; var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
return text.replace(exp,"<a target='_blank' href='$1'>$1</a>"); return text.replace(exp, "<a target='_blank' href='$1'>$1</a>");
} }
function escapeHtml(str) { function escapeHtml(str) {

16
src/webui/www/private/scripts/mocha-init.js

@ -406,7 +406,7 @@ initializeWindows = function() {
} }
}; };
torrentNewCategoryFN = function () { torrentNewCategoryFN = function() {
var hashes = torrentsTable.selectedRowsIds(); var hashes = torrentsTable.selectedRowsIds();
if (hashes.length) { if (hashes.length) {
new MochaUI.Window({ new MochaUI.Window({
@ -425,7 +425,7 @@ initializeWindows = function() {
} }
}; };
torrentSetCategoryFN = function (categoryHash) { torrentSetCategoryFN = function(categoryHash) {
var categoryName = ''; var categoryName = '';
if (categoryHash != 0) if (categoryHash != 0)
categoryName = category_list[categoryHash].name; categoryName = category_list[categoryHash].name;
@ -442,7 +442,7 @@ initializeWindows = function() {
} }
}; };
createCategoryFN = function () { createCategoryFN = function() {
new MochaUI.Window({ new MochaUI.Window({
id: 'newCategoryPage', id: 'newCategoryPage',
title: "QBT_TR(New Category)QBT_TR[CONTEXT=CategoryFilterWidget]", title: "QBT_TR(New Category)QBT_TR[CONTEXT=CategoryFilterWidget]",
@ -459,7 +459,7 @@ initializeWindows = function() {
updateMainData(); updateMainData();
}; };
removeCategoryFN = function (categoryHash) { removeCategoryFN = function(categoryHash) {
var categoryName = category_list[categoryHash].name; var categoryName = category_list[categoryHash].name;
new Request({ new Request({
url: 'api/v2/torrents/removeCategories', url: 'api/v2/torrents/removeCategories',
@ -471,7 +471,7 @@ initializeWindows = function() {
setCategoryFilter(CATEGORIES_ALL); setCategoryFilter(CATEGORIES_ALL);
}; };
deleteUnusedCategoriesFN = function () { deleteUnusedCategoriesFN = function() {
var categories = []; var categories = [];
for (var hash in category_list) { for (var hash in category_list) {
if (torrentsTable.getFilteredTorrentsNumber('all', hash) === 0) if (torrentsTable.getFilteredTorrentsNumber('all', hash) === 0)
@ -487,7 +487,7 @@ initializeWindows = function() {
setCategoryFilter(CATEGORIES_ALL); setCategoryFilter(CATEGORIES_ALL);
}; };
startTorrentsByCategoryFN = function (categoryHash) { startTorrentsByCategoryFN = function(categoryHash) {
var hashes = torrentsTable.getFilteredTorrentsHashes('all', categoryHash); var hashes = torrentsTable.getFilteredTorrentsHashes('all', categoryHash);
if (hashes.length) { if (hashes.length) {
new Request({ new Request({
@ -501,7 +501,7 @@ initializeWindows = function() {
} }
}; };
pauseTorrentsByCategoryFN = function (categoryHash) { pauseTorrentsByCategoryFN = function(categoryHash) {
var hashes = torrentsTable.getFilteredTorrentsHashes('all', categoryHash); var hashes = torrentsTable.getFilteredTorrentsHashes('all', categoryHash);
if (hashes.length) { if (hashes.length) {
new Request({ new Request({
@ -515,7 +515,7 @@ initializeWindows = function() {
} }
}; };
deleteTorrentsByCategoryFN = function (categoryHash) { deleteTorrentsByCategoryFN = function(categoryHash) {
var hashes = torrentsTable.getFilteredTorrentsHashes('all', categoryHash); var hashes = torrentsTable.getFilteredTorrentsHashes('all', categoryHash);
if (hashes.length) { if (hashes.length) {
new MochaUI.Window({ new MochaUI.Window({

4
src/webui/www/private/scripts/prop-files.js

@ -273,8 +273,8 @@ var filesDynTable = new Class({
var loadTorrentFilesDataTimer; var loadTorrentFilesDataTimer;
var loadTorrentFilesData = function() { var loadTorrentFilesData = function() {
if ($('prop_files').hasClass('invisible') || if ($('prop_files').hasClass('invisible')
$('propertiesPanel_collapseToggle').hasClass('panel-expand')) { || $('propertiesPanel_collapseToggle').hasClass('panel-expand')) {
// Tab changed, don't do anything // Tab changed, don't do anything
return; return;
} }

4
src/webui/www/private/scripts/prop-general.js

@ -27,8 +27,8 @@ var clearData = function() {
var loadTorrentDataTimer; var loadTorrentDataTimer;
var loadTorrentData = function() { var loadTorrentData = function() {
if ($('prop_general').hasClass('invisible') || if ($('prop_general').hasClass('invisible')
$('propertiesPanel_collapseToggle').hasClass('panel-expand')) { || $('propertiesPanel_collapseToggle').hasClass('panel-expand')) {
// Tab changed, don't do anything // Tab changed, don't do anything
return; return;
} }

4
src/webui/www/private/scripts/prop-trackers.js

@ -54,8 +54,8 @@ var current_hash = "";
var loadTrackersDataTimer; var loadTrackersDataTimer;
var loadTrackersData = function() { var loadTrackersData = function() {
if ($('prop_trackers').hasClass('invisible') || if ($('prop_trackers').hasClass('invisible')
$('propertiesPanel_collapseToggle').hasClass('panel-expand')) { || $('propertiesPanel_collapseToggle').hasClass('panel-expand')) {
// Tab changed, don't do anything // Tab changed, don't do anything
return; return;
} }

4
src/webui/www/private/scripts/prop-webseeds.js

@ -54,8 +54,8 @@ var current_hash = "";
var loadWebSeedsDataTimer; var loadWebSeedsDataTimer;
var loadWebSeedsData = function() { var loadWebSeedsData = function() {
if ($('prop_webseeds').hasClass('invisible') || if ($('prop_webseeds').hasClass('invisible')
$('propertiesPanel_collapseToggle').hasClass('panel-expand')) { || $('propertiesPanel_collapseToggle').hasClass('panel-expand')) {
// Tab changed, don't do anything // Tab changed, don't do anything
return; return;
} }

11
src/webui/www/private/setlocation.html

@ -1,5 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="${LANG}"> <html lang="${LANG}">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<title>QBT_TR(Set location)QBT_TR[CONTEXT=HttpServer]</title> <title>QBT_TR(Set location)QBT_TR[CONTEXT=HttpServer]</title>
@ -10,7 +11,7 @@
var setLocationKeyboardEvents = new Keyboard({ var setLocationKeyboardEvents = new Keyboard({
defaultEventType: 'keydown', defaultEventType: 'keydown',
events: { events: {
'enter': function (event) { 'enter': function(event) {
$('setLocationButton').click(); $('setLocationButton').click();
event.preventDefault(); event.preventDefault();
} }
@ -35,7 +36,7 @@
hashes: hashesList, hashes: hashesList,
location: location location: location
}, },
onComplete: function () { onComplete: function() {
window.parent.closeWindows(); window.parent.closeWindows();
} }
}).send(); }).send();
@ -43,13 +44,15 @@
}); });
</script> </script>
</head> </head>
<body> <body>
<div style="padding: 10px 10px 0px 10px;"> <div style="padding: 10px 10px 0px 10px;">
<p style="font-weight: bold;">QBT_TR(Location)QBT_TR[CONTEXT=TransferListWidget]:</p> <p style="font-weight: bold;">QBT_TR(Location)QBT_TR[CONTEXT=TransferListWidget]:</p>
<input type="text" id="setLocation" value="" maxlength="100" style="width: 220px;"/> <input type="text" id="setLocation" value="" maxlength="100" style="width: 220px;" />
<div style="text-align: center; padding-top: 10px;"> <div style="text-align: center; padding-top: 10px;">
<input type="button" value="QBT_TR(Save)QBT_TR[CONTEXT=HttpServer]" id="setLocationButton"/> <input type="button" value="QBT_TR(Save)QBT_TR[CONTEXT=HttpServer]" id="setLocationButton" />
</div> </div>
</div> </div>
</body> </body>
</html> </html>

47
src/webui/www/private/transferlist.html

@ -16,74 +16,73 @@
</div> </div>
<script> <script>
//create a context menu //create a context menu
var torrentsTableContextMenu = new TorrentsTableContextMenu({ var torrentsTableContextMenu = new TorrentsTableContextMenu({
targets : '.torrentsTableContextMenuTarget', targets: '.torrentsTableContextMenuTarget',
menu : 'torrentsTableMenu', menu: 'torrentsTableMenu',
actions : { actions: {
Start : function (element, ref) { Start: function(element, ref) {
startFN(); startFN();
}, },
Pause : function (element, ref) { Pause: function(element, ref) {
pauseFN(); pauseFN();
}, },
ForceStart : function (element, ref) { ForceStart: function(element, ref) {
setForceStartFN(); setForceStartFN();
}, },
Delete : function (element, ref) { Delete: function(element, ref) {
deleteFN(); deleteFN();
}, },
SetLocation : function (element, ref) { SetLocation: function(element, ref) {
setLocationFN(); setLocationFN();
}, },
Rename : function(element, ref) { Rename: function(element, ref) {
renameFN(); renameFN();
}, },
prioTop : function (element, ref) { prioTop: function(element, ref) {
setPriorityFN('top_prio'); setPriorityFN('top_prio');
}, },
prioUp : function (element, ref) { prioUp: function(element, ref) {
setPriorityFN('increase_prio'); setPriorityFN('increase_prio');
}, },
prioDown : function (element, ref) { prioDown: function(element, ref) {
setPriorityFN('decrease_prio'); setPriorityFN('decrease_prio');
}, },
prioBottom : function (element, ref) { prioBottom: function(element, ref) {
setPriorityFN('bottom_prio'); setPriorityFN('bottom_prio');
}, },
DownloadLimit : function (element, ref) { DownloadLimit: function(element, ref) {
downloadLimitFN(); downloadLimitFN();
}, },
UploadLimit : function (element, ref) { UploadLimit: function(element, ref) {
uploadLimitFN(); uploadLimitFN();
}, },
SequentialDownload : function (element, ref) { SequentialDownload: function(element, ref) {
toggleSequentialDownloadFN(); toggleSequentialDownloadFN();
}, },
FirstLastPiecePrio : function (element, ref) { FirstLastPiecePrio: function(element, ref) {
toggleFirstLastPiecePrioFN(); toggleFirstLastPiecePrioFN();
}, },
AutoTorrentManagement : function (element, ref) { AutoTorrentManagement: function(element, ref) {
autoTorrentManagementFN(); autoTorrentManagementFN();
}, },
ForceRecheck : function (element, ref) { ForceRecheck: function(element, ref) {
recheckFN(); recheckFN();
}, },
SuperSeeding : function (element, ref) { SuperSeeding: function(element, ref) {
setSuperSeedingFN(!ref.getItemChecked('SuperSeeding')); setSuperSeedingFN(!ref.getItemChecked('SuperSeeding'));
} }
}, },
offsets : { offsets: {
x : -15, x: -15,
y : 2 y: 2
} }
}); });

106
src/webui/www/private/upload.html

@ -1,5 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="${LANG}"> <html lang="${LANG}">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<title>QBT_TR(Upload local torrent)QBT_TR[CONTEXT=HttpServer]</title> <title>QBT_TR(Upload local torrent)QBT_TR[CONTEXT=HttpServer]</title>
@ -8,77 +9,78 @@
<script src="scripts/lib/mootools-1.2-core-yc.js"></script> <script src="scripts/lib/mootools-1.2-core-yc.js"></script>
<script src="scripts/download.js"></script> <script src="scripts/download.js"></script>
</head> </head>
<body> <body>
<iframe id="upload_frame" name="upload_frame" class="invisible" src="javascript:false;"></iframe> <iframe id="upload_frame" name="upload_frame" class="invisible" src="javascript:false;"></iframe>
<form action="api/v2/torrents/add" enctype="multipart/form-data" method="post" id="uploadForm" style="text-align: center;" target="upload_frame"> <form action="api/v2/torrents/add" enctype="multipart/form-data" method="post" id="uploadForm" style="text-align: center;" target="upload_frame">
<div style="margin-top: 25px; display: inline-block; border: 1px solid lightgrey; border-radius: 4px;"> <div style="margin-top: 25px; display: inline-block; border: 1px solid lightgrey; border-radius: 4px;">
<input type="file" id="fileselect" name="fileselect[]" multiple="multiple"/> <input type="file" id="fileselect" name="fileselect[]" multiple="multiple" />
</div> </div>
<fieldset class="settings" style="border: 0; text-align: left;"> <fieldset class="settings" style="border: 0; text-align: left;">
<div class="formRow" style="margin-top: 12px;"> <div class="formRow" style="margin-top: 12px;">
<label for="savepath" class="leftLabelLarge">QBT_TR(Save files to location:)QBT_TR[CONTEXT=HttpServer]</label> <label for="savepath" class="leftLabelLarge">QBT_TR(Save files to location:)QBT_TR[CONTEXT=HttpServer]</label>
<input type="text" id="savepath" name="savepath" style="width: 16em;"/> <input type="text" id="savepath" name="savepath" style="width: 16em;" />
</div> </div>
<div class="formRow"> <div class="formRow">
<label for="rename" class="leftLabelLarge">QBT_TR(Rename torrent)QBT_TR[CONTEXT=HttpServer]</label> <label for="rename" class="leftLabelLarge">QBT_TR(Rename torrent)QBT_TR[CONTEXT=HttpServer]</label>
<input type="text" id="rename" name="rename" style="width: 16em;"/> <input type="text" id="rename" name="rename" style="width: 16em;" />
</div> </div>
<div class="formRow"> <div class="formRow">
<label for="category" class="leftLabelLarge">QBT_TR(Category:)QBT_TR[CONTEXT=AddNewTorrentDialog]</label> <label for="category" class="leftLabelLarge">QBT_TR(Category:)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
<input type="text" id="category" name="category" style="width: 16em;"/> <input type="text" id="category" name="category" style="width: 16em;" />
</div> </div>
<div class="formRow"> <div class="formRow">
<label for="start_torrent" class="leftLabelLarge">QBT_TR(Start torrent)QBT_TR[CONTEXT=AddNewTorrentDialog]</label> <label for="start_torrent" class="leftLabelLarge">QBT_TR(Start torrent)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
<input type="checkbox" id="start_torrent" checked="checked"/> <input type="checkbox" id="start_torrent" checked="checked" />
<input type="hidden" id="add_paused" name="paused" value="true" disabled="disabled"/> <input type="hidden" id="add_paused" name="paused" value="true" disabled="disabled" />
</div> </div>
<div class="formRow"> <div class="formRow">
<label for="skip_checking" class="leftLabelLarge">QBT_TR(Skip hash check)QBT_TR[CONTEXT=AddNewTorrentDialog]</label> <label for="skip_checking" class="leftLabelLarge">QBT_TR(Skip hash check)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
<input type="checkbox" id="skip_checking" name="skip_checking" value="true"/> <input type="checkbox" id="skip_checking" name="skip_checking" value="true" />
</div> </div>
<div class="formRow"> <div class="formRow">
<label for="root_folder" class="leftLabelLarge">QBT_TR(Create subfolder)QBT_TR[CONTEXT=AddNewTorrentDialog]</label> <label for="root_folder" class="leftLabelLarge">QBT_TR(Create subfolder)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
<input type="checkbox" id="root_folder" name="root_folder" value="true" checked="checked"/> <input type="checkbox" id="root_folder" name="root_folder" value="true" checked="checked" />
</div> </div>
<div class="formRow"> <div class="formRow">
<label for="sequentialDownload" class="leftLabelLarge">QBT_TR(Download in sequential order)QBT_TR[CONTEXT=TransferListWidget]</label> <label for="sequentialDownload" class="leftLabelLarge">QBT_TR(Download in sequential order)QBT_TR[CONTEXT=TransferListWidget]</label>
<input type="checkbox" id="sequentialDownload" name="sequentialDownload" value="true"/> <input type="checkbox" id="sequentialDownload" name="sequentialDownload" value="true" />
</div> </div>
<div class="formRow"> <div class="formRow">
<label for="firstLastPiecePrio" class="leftLabelLarge">QBT_TR(Download first and last pieces first)QBT_TR[CONTEXT=TransferListWidget]</label> <label for="firstLastPiecePrio" class="leftLabelLarge">QBT_TR(Download first and last pieces first)QBT_TR[CONTEXT=TransferListWidget]</label>
<input type="checkbox" id="firstLastPiecePrio" name="firstLastPiecePrio" value="true"/> <input type="checkbox" id="firstLastPiecePrio" name="firstLastPiecePrio" value="true" />
</div> </div>
<div class="formRow"> <div class="formRow">
<label for="dlLimit" class="leftLabelLarge">QBT_TR(Limit download rate)QBT_TR[CONTEXT=HttpServer]</label> <label for="dlLimit" class="leftLabelLarge">QBT_TR(Limit download rate)QBT_TR[CONTEXT=HttpServer]</label>
<input type="text" id="dlLimit" name="dlLimit" style="width: 16em;" placeholder="Bytes/s"/> <input type="text" id="dlLimit" name="dlLimit" style="width: 16em;" placeholder="Bytes/s" />
</div> </div>
<div class="formRow"> <div class="formRow">
<label for="upLimit" class="leftLabelLarge">QBT_TR(Limit upload rate)QBT_TR[CONTEXT=HttpServer]</label> <label for="upLimit" class="leftLabelLarge">QBT_TR(Limit upload rate)QBT_TR[CONTEXT=HttpServer]</label>
<input type="text" id="upLimit" name="upLimit" style="width: 16em;" placeholder="Bytes/s"/> <input type="text" id="upLimit" name="upLimit" style="width: 16em;" placeholder="Bytes/s" />
</div> </div>
<div id="submitbutton" style="margin-top: 30px; text-align: center;"> <div id="submitbutton" style="margin-top: 30px; text-align: center;">
<button type="submit" style="font-size: 1em;">QBT_TR(Upload Torrents)QBT_TR[CONTEXT=HttpServer]</button> <button type="submit" style="font-size: 1em;">QBT_TR(Upload Torrents)QBT_TR[CONTEXT=HttpServer]</button>
</div> </div>
</fieldset> </fieldset>
</form> </form>
<script> <script>
var submitted = false;
var submitted = false; $('uploadForm').addEventListener("submit", function() {
$('uploadForm').addEventListener("submit", function() {
$('upload_spinner').style.display = "block"; $('upload_spinner').style.display = "block";
submitted = true; submitted = true;
}); });
$('upload_frame').addEventListener("load", function() { $('upload_frame').addEventListener("load", function() {
if (submitted) if (submitted)
window.parent.closeWindows(); window.parent.closeWindows();
}); });
$('start_torrent').addEventListener('change', function() { $('start_torrent').addEventListener('change', function() {
$('add_paused').disabled = $('start_torrent').checked; $('add_paused').disabled = $('start_torrent').checked;
}); });
</script> </script>
<div id="upload_spinner" class="mochaSpinner"></div> <div id="upload_spinner" class="mochaSpinner"></div>
</body> </body>
</html> </html>

21
src/webui/www/private/uploadlimit.html

@ -1,5 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="${LANG}"> <html lang="${LANG}">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<title>QBT_TR(Torrent Upload Speed Limiting)QBT_TR[CONTEXT=TransferListWidget]</title> <title>QBT_TR(Torrent Upload Speed Limiting)QBT_TR[CONTEXT=TransferListWidget]</title>
@ -9,17 +10,18 @@
<script src="scripts/lib/mocha-yc.js"></script> <script src="scripts/lib/mocha-yc.js"></script>
<script src="scripts/lib/parametrics.js"></script> <script src="scripts/lib/parametrics.js"></script>
</head> </head>
<body> <body>
<div style="width: 100%; text-align: center; margin: 0 auto; overflow: hidden"> <div style="width: 100%; text-align: center; margin: 0 auto; overflow: hidden">
<div id="uplimitSlider" class="slider"> <div id="uplimitSlider" class="slider">
<div id="uplimitUpdate" class="update">QBT_TR(Upload limit:)QBT_TR[CONTEXT=PropertiesWidget] <input id="uplimitUpdatevalue" size="6" placeholder="∞" style="text-align: center;"> <span id="upLimitUnit">QBT_TR(KiB/s)QBT_TR[CONTEXT=SpeedLimitDialog]</span></div> <div id="uplimitUpdate" class="update">QBT_TR(Upload limit:)QBT_TR[CONTEXT=PropertiesWidget] <input id="uplimitUpdatevalue" size="6" placeholder="∞" style="text-align: center;"> <span id="upLimitUnit">QBT_TR(KiB/s)QBT_TR[CONTEXT=SpeedLimitDialog]</span></div>
<div class="sliderWrapper"> <div class="sliderWrapper">
<div id="uplimitSliderknob" class="sliderknob"></div> <div id="uplimitSliderknob" class="sliderknob"></div>
<div id="uplimitSliderarea" class="sliderarea"></div> <div id="uplimitSliderarea" class="sliderarea"></div>
</div> </div>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<script> <script>
var hashes = new URI().getData('hashes').split('|'); var hashes = new URI().getData('hashes').split('|');
setUpLimit = function() { setUpLimit = function() {
var limit = $("uplimitUpdatevalue").value.toInt() * 1024; var limit = $("uplimitUpdatevalue").value.toInt() * 1024;
@ -50,13 +52,14 @@
}).send(); }).send();
} }
} }
</script> </script>
<input type="button" value="QBT_TR(Apply)QBT_TR[CONTEXT=HttpServer]" onclick="setUpLimit()"/> <input type="button" value="QBT_TR(Apply)QBT_TR[CONTEXT=HttpServer]" onclick="setUpLimit()" />
</div> </div>
<script> <script>
MochaUI.addUpLimitSlider(hashes); MochaUI.addUpLimitSlider(hashes);
</script> </script>
</body> </body>
</html> </html>

11
src/webui/www/public/login.html

@ -1,5 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="${LANG}"> <html lang="${LANG}">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<title>qBittorrent QBT_TR(Web UI)QBT_TR[CONTEXT=OptionsDialog]</title> <title>qBittorrent QBT_TR(Web UI)QBT_TR[CONTEXT=OptionsDialog]</title>
@ -30,7 +31,8 @@
onFailure: function(xhr) { onFailure: function(xhr) {
if (xhr.responseText !== "") { if (xhr.responseText !== "") {
$('error_msg').set('html', xhr.responseText); $('error_msg').set('html', xhr.responseText);
} else { }
else {
$('error_msg').set('html', 'QBT_TR(Unable to log in, qBittorrent is probably unreachable.)QBT_TR[CONTEXT=HttpServer]'); $('error_msg').set('html', 'QBT_TR(Unable to log in, qBittorrent is probably unreachable.)QBT_TR[CONTEXT=HttpServer]');
} }
}, },
@ -38,7 +40,8 @@
if (text == "Ok.") { if (text == "Ok.") {
// Session started. Simply reload page. // Session started. Simply reload page.
window.location.reload(); window.location.reload();
} else { }
else {
$('error_msg').set('html', 'QBT_TR(Invalid Username or Password.)QBT_TR[CONTEXT=HttpServer]'); $('error_msg').set('html', 'QBT_TR(Invalid Username or Password.)QBT_TR[CONTEXT=HttpServer]');
} }
} }
@ -46,11 +49,12 @@
} }
</script> </script>
</head> </head>
<body> <body>
<div id="main"> <div id="main">
<h1>qBittorrent QBT_TR(Web UI)QBT_TR[CONTEXT=OptionsDialog]</h1> <h1>qBittorrent QBT_TR(Web UI)QBT_TR[CONTEXT=OptionsDialog]</h1>
<div id="logo" class="col"> <div id="logo" class="col">
<img src="images/skin/qbittorrent-tray.svg" alt="qBittorrent logo"/> <img src="images/skin/qbittorrent-tray.svg" alt="qBittorrent logo" />
</div> </div>
<div id="formplace" class="col"> <div id="formplace" class="col">
<form id="loginform"> <form id="loginform">
@ -68,4 +72,5 @@
<div id="error_msg"></div> <div id="error_msg"></div>
</div> </div>
</body> </body>
</html> </html>

Loading…
Cancel
Save