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 @@ @@ -1,5 +1,6 @@
<!DOCTYPE html>
<html lang="${LANG}">
<head>
<meta charset="UTF-8" />
<title>QBT_TR(Trackers addition dialog)QBT_TR[CONTEXT=TrackersAdditionDlg]</title>
@ -7,9 +8,9 @@ @@ -7,9 +8,9 @@
<script src="scripts/lib/mootools-1.2-core-yc.js"></script>
<script src="scripts/lib/mootools-1.2-more.js"></script>
<script>
window.addEvent('domready', function(){
window.addEvent('domready', function() {
$('trackersUrls').focus();
$('addTrackersButton').addEvent('click', function(e){
$('addTrackersButton').addEvent('click', function(e) {
new Event(e).stop();
var hash = new URI().getData('hash');
new Request({
@ -27,13 +28,15 @@ @@ -27,13 +28,15 @@
});
</script>
</head>
<body>
<div style="text-align: center;">
<div style="text-align: center;">
<br/>
<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>
<br/>
<input type="button" value="QBT_TR(Add)QBT_TR[CONTEXT=HttpServer]" id="addTrackersButton"/>
</div>
<input type="button" value="QBT_TR(Add)QBT_TR[CONTEXT=HttpServer]" id="addTrackersButton" />
</div>
</body>
</html>

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

@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
<!DOCTYPE html>
<html lang="${LANG}">
<head>
<meta charset="UTF-8" />
<title>QBT_TR(Deletion confirmation - qBittorrent)QBT_TR[CONTEXT=confirmDeletionDlg]</title>
@ -8,13 +9,13 @@ @@ -8,13 +9,13 @@
<script src="scripts/lib/mootools-1.2-more.js"></script>
<script>
var hashes = new URI().getData('hashes').split('|');
window.addEvent('domready', function(){
window.addEvent('domready', function() {
$('cancelBtn').focus();
$('cancelBtn').addEvent('click', function(e){
$('cancelBtn').addEvent('click', function(e) {
new Event(e).stop();
window.parent.closeWindows();
});
$('confirmBtn').addEvent('click', function(e){
$('confirmBtn').addEvent('click', function(e) {
parent.torrentsTable.deselectAll();
new Event(e).stop();
var cmd = 'api/v2/torrents/delete';
@ -34,13 +35,15 @@ @@ -34,13 +35,15 @@
});
</script>
</head>
<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>
&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;">
<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>
&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;">
<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>
</body>
</html>

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

@ -186,7 +186,8 @@ body { @@ -186,7 +186,8 @@ body {
color: #3f3f3f;
font-weight: normal;
/* 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 {

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

@ -24,8 +24,7 @@ Required by: @@ -24,8 +24,7 @@ Required by:
background-color: #e5e5e5;
}
.mocha.isFocused {
}
.mocha.isFocused {}
.mochaOverlay {
position: absolute; /* This is also set in theme.js in order to make theme transitions smoother */
@ -181,7 +180,7 @@ div.mochaToolbarWrapper.bottom { @@ -181,7 +180,7 @@ div.mochaToolbarWrapper.bottom {
.mochaCloseButton {
}
.mochaSpinner{
.mochaSpinner {
display: none;
position: absolute;
bottom: 7px;
@ -255,7 +254,8 @@ div.mochaToolbarWrapper.bottom { @@ -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. */
.mocha.replaced, .mochaTitlebar.replaced, .mochaMinimizeButton.replaced, .mochaMaximizeButton.replaced, .mochaCloseButton.replaced {
.mocha.replaced, .mochaTitlebar.replaced, .mochaMinimizeButton.replaced,
.mochaMaximizeButton.replaced, .mochaCloseButton.replaced {
background-color: transparent !important;
}
@ -269,7 +269,8 @@ div.mochaToolbarWrapper.bottom { @@ -269,7 +269,8 @@ div.mochaToolbarWrapper.bottom {
overflow: hidden;
}
.windowClosed .mochaContentBorder, .windowClosed .mochaToolbarWrapper, .windowClosed .mochaTitlebar, .windowClosed .mochaControls,
.windowClosed .mochaContentBorder, .windowClosed .mochaToolbarWrapper,
.windowClosed .mochaTitlebar, .windowClosed .mochaControls,
.windowClosed .mochaCanvasControls {
position: absolute;
top: 0;
@ -371,6 +372,7 @@ div.mochaToolbarWrapper.bottom { @@ -371,6 +372,7 @@ div.mochaToolbarWrapper.bottom {
}
/* Workaround to make invisible buttons clickable */
.mochaMinimizeButton.replaced,
.mochaMaximizeButton.replaced,
.mochaCloseButton.replaced {

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

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

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

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

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

@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
<!DOCTYPE html>
<html lang="${LANG}">
<head>
<meta charset="UTF-8" />
<title>QBT_TR(Add Torrent Links)QBT_TR[CONTEXT=downloadFromURL]</title>
@ -8,84 +9,85 @@ @@ -8,84 +9,85 @@
<script src="scripts/lib/mootools-1.2-core-yc.js"></script>
<script src="scripts/download.js"></script>
</head>
<body>
<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">
<div style="text-align: center;">
<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">
<div style="text-align: center;">
<br/>
<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>
<p>QBT_TR(Only one link per line)QBT_TR[CONTEXT=HttpServer]</p>
<fieldset class="settings" style="border: 0; text-align: left;">
<div class="formRow" style="margin-top: 6px;">
<p>QBT_TR(Only one link per line)QBT_TR[CONTEXT=HttpServer]</p>
<fieldset class="settings" style="border: 0; text-align: left;">
<div class="formRow" style="margin-top: 6px;">
<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;"/>
</div>
<div class="formRow">
<input type="text" id="savepath" name="savepath" style="width: 16em;" />
</div>
<div class="formRow">
<label for="cookie" class="leftLabelLarge">QBT_TR(Cookie:)QBT_TR[CONTEXT=HttpServer]</label>
<input type="text" id="cookie" name="cookie" style="width: 16em;"/>
</div>
<div class="formRow">
<input type="text" id="cookie" name="cookie" style="width: 16em;" />
</div>
<div class="formRow">
<label for="rename" class="leftLabelLarge">QBT_TR(Rename torrent)QBT_TR[CONTEXT=HttpServer]</label>
<input type="text" id="rename" name="rename" style="width: 16em;"/>
</div>
<div class="formRow">
<input type="text" id="rename" name="rename" style="width: 16em;" />
</div>
<div class="formRow">
<label for="category" class="leftLabelLarge">QBT_TR(Category:)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
<input type="text" id="category" name="category" style="width: 16em;"/>
</div>
<div class="formRow">
<input type="text" id="category" name="category" style="width: 16em;" />
</div>
<div class="formRow">
<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="hidden" id="add_paused" name="paused" value="true" disabled="disabled"/>
</div>
<div class="formRow">
<input type="checkbox" id="start_torrent" checked="checked" />
<input type="hidden" id="add_paused" name="paused" value="true" disabled="disabled" />
</div>
<div class="formRow">
<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"/>
</div>
<div class="formRow">
<input type="checkbox" id="skip_checking" name="skip_checking" value="true" />
</div>
<div class="formRow">
<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"/>
</div>
<div class="formRow">
<input type="checkbox" id="root_folder" name="root_folder" value="true" checked="checked" />
</div>
<div class="formRow">
<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"/>
</div>
<div class="formRow">
<input type="checkbox" id="sequentialDownload" name="sequentialDownload" value="true" />
</div>
<div class="formRow">
<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"/>
</div>
<div class="formRow">
<input type="checkbox" id="firstLastPiecePrio" name="firstLastPiecePrio" value="true" />
</div>
<div class="formRow">
<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"/>
</div>
<div class="formRow">
<input type="text" id="dlLimit" name="dlLimit" style="width: 16em;" placeholder="Bytes/s" />
</div>
<div class="formRow">
<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"/>
</div>
<div id="submitbutton" style="margin-top: 12px; text-align: center;">
<input type="text" id="upLimit" name="upLimit" style="width: 16em;" placeholder="Bytes/s" />
</div>
<div id="submitbutton" style="margin-top: 12px; text-align: center;">
<button type="submit" id="submitButton">QBT_TR(Download)QBT_TR[CONTEXT=downloadFromURL]</button>
</div>
</fieldset>
</div>
</form>
<script>
</div>
</fieldset>
</div>
</form>
<script>
var submitted = false;
var submitted = false;
$('downloadForm').addEventListener("submit", function() {
$('downloadForm').addEventListener("submit", function() {
$('download_spinner').style.display = "block";
submitted = true;
});
});
$('download_frame').addEventListener("load", function() {
$('download_frame').addEventListener("load", function() {
if (submitted)
window.parent.closeWindows();
});
});
$('start_torrent').addEventListener('change', function() {
$('start_torrent').addEventListener('change', function() {
$('add_paused').disabled = $('start_torrent').checked;
});
</script>
<div id="download_spinner" class="mochaSpinner"></div>
});
</script>
<div id="download_spinner" class="mochaSpinner"></div>
</body>
</html>

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

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

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

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

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

@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
<!DOCTYPE html>
<html lang="${LANG}">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=10" />
@ -26,6 +27,7 @@ @@ -26,6 +27,7 @@
<script src="scripts/client.js"></script>
<script src="scripts/contextmenu.js"></script>
</head>
<body>
<div id="desktop">
<div id="desktopHeader">
@ -64,7 +66,7 @@ @@ -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="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 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>
</li>
<li>
@ -152,7 +154,7 @@ @@ -152,7 +154,7 @@
<tr>
<td id="DHTNodes"></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 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>
@ -164,4 +166,5 @@ @@ -164,4 +166,5 @@
</div>
</div>
</body>
</html>

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

@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
<!DOCTYPE html>
<html lang="${LANG}">
<head>
<meta charset="UTF-8" />
<title>QBT_TR(New Category)QBT_TR[CONTEXT=TransferListWidget]</title>
@ -10,7 +11,7 @@ @@ -10,7 +11,7 @@
var newCategoryKeyboardEvents = new Keyboard({
defaultEventType: 'keydown',
events: {
'enter': function (event) {
'enter': function(event) {
$('newCategoryButton').click();
event.preventDefault();
}
@ -38,13 +39,12 @@ @@ -38,13 +39,12 @@
data: {
category: categoryName
},
onComplete: function () {
onComplete: function() {
window.parent.closeWindows();
}
}).send();
}
else
{
else {
new Request({
url: 'api/v2/torrents/setCategory',
method: 'post',
@ -52,7 +52,7 @@ @@ -52,7 +52,7 @@
hashes: hashesList,
category: categoryName
},
onComplete: function () {
onComplete: function() {
window.parent.closeWindows();
}
}).send();
@ -61,13 +61,15 @@ @@ -61,13 +61,15 @@
});
</script>
</head>
<body>
<div style="padding: 10px 10px 0px 10px;">
<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;">
<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>
</body>
</html>

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

@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
<!DOCTYPE html>
<html lang="${LANG}">
<head>
<meta charset="UTF-8" />
<title>QBT_TR(Download from URLs)QBT_TR[CONTEXT=downloadFromURL]</title>
@ -9,9 +10,10 @@ @@ -9,9 +10,10 @@
<script src="scripts/lib/mootools-1.2-more.js"></script>
<script src="scripts/lib/mocha-yc.js"></script>
</head>
<body style="padding: 5px;">
<!-- preferences -->
<div class="toolbarTabs">
<!-- preferences -->
<div class="toolbarTabs">
<ul id="preferencesTabs" class="tab-menu">
<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>
@ -20,32 +22,33 @@ @@ -20,32 +22,33 @@
<li id="PrefWebUILink"><a>QBT_TR(Web UI)QBT_TR[CONTEXT=OptionsDialog]</a></li>
</ul>
<div class="clear"></div>
</div>
</div>
<script>
// Tabs
MochaUI.initializeTabs('preferencesTabs');
<script>
// Tabs
MochaUI.initializeTabs('preferencesTabs');
$('PrefDownloadsLink').addEvent('click', function(e) {
$('PrefDownloadsLink').addEvent('click', function(e) {
$$('.PrefTab').addClass('invisible');
$('DownloadsTab').removeClass('invisible');
});
$('PrefConnectionLink').addEvent('click', function(e){
});
$('PrefConnectionLink').addEvent('click', function(e) {
$$('.PrefTab').addClass('invisible');
$('ConnectionTab').removeClass('invisible');
});
$('PrefSpeedLink').addEvent('click', function(e) {
});
$('PrefSpeedLink').addEvent('click', function(e) {
$$('.PrefTab').addClass('invisible');
$('SpeedTab').removeClass('invisible');
});
$('PrefBittorrentLink').addEvent('click', function(e) {
});
$('PrefBittorrentLink').addEvent('click', function(e) {
$$('.PrefTab').addClass('invisible');
$('BittorrentTab').removeClass('invisible');
});
$('PrefWebUILink').addEvent('click', function(e) {
});
$('PrefWebUILink').addEvent('click', function(e) {
$$('.PrefTab').addClass('invisible');
$('WebUITab').removeClass('invisible');
});
</script>
});
</script>
</body>
</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 @@ @@ -3,25 +3,44 @@
<legend><b>QBT_TR(Transfer)QBT_TR[CONTEXT=PropertiesWidget]</b></legend>
<table style="width: 100%">
<tr>
<td class="generalLabel">QBT_TR(Time Active:)QBT_TR[CONTEXT=PropertiesWidget]</td><td id="time_elapsed"></td>
<td class="generalLabel">QBT_TR(ETA:)QBT_TR[CONTEXT=PropertiesWidget]</td><td id="eta"></td>
<td class="generalLabel">QBT_TR(Connections:)QBT_TR[CONTEXT=PropertiesWidget]</td><td id="nb_connections"></td>
</tr><tr>
<td class="generalLabel">QBT_TR(Downloaded:)QBT_TR[CONTEXT=PropertiesWidget]</td><td id="total_downloaded"></td>
<td class="generalLabel">QBT_TR(Uploaded:)QBT_TR[CONTEXT=PropertiesWidget]</td><td id="total_uploaded"></td>
<td class="generalLabel">QBT_TR(Seeds:)QBT_TR[CONTEXT=PropertiesWidget]</td><td id="seeds"></td>
</tr><tr>
<td class="generalLabel">QBT_TR(Download Speed:)QBT_TR[CONTEXT=PropertiesWidget]</td><td id="dl_speed"></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>
<td class="generalLabel">QBT_TR(Time Active:)QBT_TR[CONTEXT=PropertiesWidget]</td>
<td id="time_elapsed"></td>
<td class="generalLabel">QBT_TR(ETA:)QBT_TR[CONTEXT=PropertiesWidget]</td>
<td id="eta"></td>
<td class="generalLabel">QBT_TR(Connections:)QBT_TR[CONTEXT=PropertiesWidget]</td>
<td id="nb_connections"></td>
</tr>
<tr>
<td class="generalLabel">QBT_TR(Downloaded:)QBT_TR[CONTEXT=PropertiesWidget]</td>
<td id="total_downloaded"></td>
<td class="generalLabel">QBT_TR(Uploaded:)QBT_TR[CONTEXT=PropertiesWidget]</td>
<td id="total_uploaded"></td>
<td class="generalLabel">QBT_TR(Seeds:)QBT_TR[CONTEXT=PropertiesWidget]</td>
<td id="seeds"></td>
</tr>
<tr>
<td class="generalLabel">QBT_TR(Download Speed:)QBT_TR[CONTEXT=PropertiesWidget]</td>
<td id="dl_speed"></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>
</table>
</fieldset>
@ -29,19 +48,32 @@ @@ -29,19 +48,32 @@
<legend><b>QBT_TR(Information)QBT_TR[CONTEXT=PropertiesWidget]</b></legend>
<table style="width: 100%">
<tr>
<td class="generalLabel">QBT_TR(Total Size:)QBT_TR[CONTEXT=PropertiesWidget]</td><td id="total_size"></td>
<td class="generalLabel">QBT_TR(Pieces:)QBT_TR[CONTEXT=PropertiesWidget]</td><td id="pieces"></td>
<td class="generalLabel">QBT_TR(Created By:)QBT_TR[CONTEXT=PropertiesWidget]</td><td id="created_by"></td>
</tr><tr>
<td class="generalLabel">QBT_TR(Added On:)QBT_TR[CONTEXT=PropertiesWidget]</td><td id="addition_date"></td>
<td class="generalLabel">QBT_TR(Completed On:)QBT_TR[CONTEXT=PropertiesWidget]</td><td id="completion_date"></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>
<td class="generalLabel">QBT_TR(Total Size:)QBT_TR[CONTEXT=PropertiesWidget]</td>
<td id="total_size"></td>
<td class="generalLabel">QBT_TR(Pieces:)QBT_TR[CONTEXT=PropertiesWidget]</td>
<td id="pieces"></td>
<td class="generalLabel">QBT_TR(Created By:)QBT_TR[CONTEXT=PropertiesWidget]</td>
<td id="created_by"></td>
</tr>
<tr>
<td class="generalLabel">QBT_TR(Added On:)QBT_TR[CONTEXT=PropertiesWidget]</td>
<td id="addition_date"></td>
<td class="generalLabel">QBT_TR(Completed On:)QBT_TR[CONTEXT=PropertiesWidget]</td>
<td id="completion_date"></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>
</table>
</fieldset>

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

@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
<!DOCTYPE html>
<html lang="${LANG}">
<head>
<meta charset="UTF-8" />
<title>QBT_TR(Rename)QBT_TR[CONTEXT=TransferListWidget]</title>
@ -11,7 +12,7 @@ @@ -11,7 +12,7 @@
var renameKeyboardEvents = new Keyboard({
defaultEventType: 'keydown',
events: {
'enter': function (event) {
'enter': function(event) {
$('renameButton').click();
event.preventDefault();
}
@ -42,7 +43,7 @@ @@ -42,7 +43,7 @@
hash: hash,
name: name
},
onComplete: function () {
onComplete: function() {
window.parent.closeWindows();
}
}).send();
@ -51,13 +52,15 @@ @@ -51,13 +52,15 @@
});
</script>
</head>
<body>
<div style="padding: 10px 10px 0px 10px;">
<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;">
<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>
</body>
</html>

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

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

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

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

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

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

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

@ -90,14 +90,14 @@ if (!Date.prototype.toISOString) { @@ -90,14 +90,14 @@ if (!Date.prototype.toISOString) {
}
Date.prototype.toISOString = function() {
return this.getUTCFullYear() +
'-' + pad(this.getUTCMonth() + 1) +
'-' + pad(this.getUTCDate()) +
'T' + pad(this.getUTCHours()) +
':' + pad(this.getUTCMinutes()) +
':' + pad(this.getUTCSeconds()) +
'.' + (this.getUTCMilliseconds() / 1000).toFixed(3).slice(2, 5) +
'Z';
return this.getUTCFullYear()
+ '-' + pad(this.getUTCMonth() + 1)
+ '-' + pad(this.getUTCDate())
+ 'T' + pad(this.getUTCHours())
+ ':' + pad(this.getUTCMinutes())
+ ':' + pad(this.getUTCSeconds())
+ '.' + (this.getUTCMilliseconds() / 1000).toFixed(3).slice(2, 5)
+ 'Z';
};
}());
@ -108,7 +108,7 @@ if (!Date.prototype.toISOString) { @@ -108,7 +108,7 @@ if (!Date.prototype.toISOString) {
*/
function parseHtmlLinks(text) {
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) {

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

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

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

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

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

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

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

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

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

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

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

@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
<!DOCTYPE html>
<html lang="${LANG}">
<head>
<meta charset="UTF-8" />
<title>QBT_TR(Set location)QBT_TR[CONTEXT=HttpServer]</title>
@ -10,7 +11,7 @@ @@ -10,7 +11,7 @@
var setLocationKeyboardEvents = new Keyboard({
defaultEventType: 'keydown',
events: {
'enter': function (event) {
'enter': function(event) {
$('setLocationButton').click();
event.preventDefault();
}
@ -35,7 +36,7 @@ @@ -35,7 +36,7 @@
hashes: hashesList,
location: location
},
onComplete: function () {
onComplete: function() {
window.parent.closeWindows();
}
}).send();
@ -43,13 +44,15 @@ @@ -43,13 +44,15 @@
});
</script>
</head>
<body>
<div style="padding: 10px 10px 0px 10px;">
<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;">
<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>
</body>
</html>

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

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

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

@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
<!DOCTYPE html>
<html lang="${LANG}">
<head>
<meta charset="UTF-8" />
<title>QBT_TR(Upload local torrent)QBT_TR[CONTEXT=HttpServer]</title>
@ -8,77 +9,78 @@ @@ -8,77 +9,78 @@
<script src="scripts/lib/mootools-1.2-core-yc.js"></script>
<script src="scripts/download.js"></script>
</head>
<body>
<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">
<div style="margin-top: 25px; display: inline-block; border: 1px solid lightgrey; border-radius: 4px;">
<input type="file" id="fileselect" name="fileselect[]" multiple="multiple"/>
</div>
<fieldset class="settings" style="border: 0; text-align: left;">
<div class="formRow" style="margin-top: 12px;">
<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">
<div style="margin-top: 25px; display: inline-block; border: 1px solid lightgrey; border-radius: 4px;">
<input type="file" id="fileselect" name="fileselect[]" multiple="multiple" />
</div>
<fieldset class="settings" style="border: 0; text-align: left;">
<div class="formRow" style="margin-top: 12px;">
<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;"/>
</div>
<div class="formRow">
<input type="text" id="savepath" name="savepath" style="width: 16em;" />
</div>
<div class="formRow">
<label for="rename" class="leftLabelLarge">QBT_TR(Rename torrent)QBT_TR[CONTEXT=HttpServer]</label>
<input type="text" id="rename" name="rename" style="width: 16em;"/>
</div>
<div class="formRow">
<input type="text" id="rename" name="rename" style="width: 16em;" />
</div>
<div class="formRow">
<label for="category" class="leftLabelLarge">QBT_TR(Category:)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
<input type="text" id="category" name="category" style="width: 16em;"/>
</div>
<div class="formRow">
<input type="text" id="category" name="category" style="width: 16em;" />
</div>
<div class="formRow">
<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="hidden" id="add_paused" name="paused" value="true" disabled="disabled"/>
</div>
<div class="formRow">
<input type="checkbox" id="start_torrent" checked="checked" />
<input type="hidden" id="add_paused" name="paused" value="true" disabled="disabled" />
</div>
<div class="formRow">
<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"/>
</div>
<div class="formRow">
<input type="checkbox" id="skip_checking" name="skip_checking" value="true" />
</div>
<div class="formRow">
<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"/>
</div>
<div class="formRow">
<input type="checkbox" id="root_folder" name="root_folder" value="true" checked="checked" />
</div>
<div class="formRow">
<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"/>
</div>
<div class="formRow">
<input type="checkbox" id="sequentialDownload" name="sequentialDownload" value="true" />
</div>
<div class="formRow">
<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"/>
</div>
<div class="formRow">
<input type="checkbox" id="firstLastPiecePrio" name="firstLastPiecePrio" value="true" />
</div>
<div class="formRow">
<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"/>
</div>
<div class="formRow">
<input type="text" id="dlLimit" name="dlLimit" style="width: 16em;" placeholder="Bytes/s" />
</div>
<div class="formRow">
<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"/>
</div>
<div id="submitbutton" style="margin-top: 30px; text-align: center;">
<input type="text" id="upLimit" name="upLimit" style="width: 16em;" placeholder="Bytes/s" />
</div>
<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>
</div>
</fieldset>
</form>
<script>
</div>
</fieldset>
</form>
<script>
var submitted = false;
var submitted = false;
$('uploadForm').addEventListener("submit", function() {
$('uploadForm').addEventListener("submit", function() {
$('upload_spinner').style.display = "block";
submitted = true;
});
});
$('upload_frame').addEventListener("load", function() {
$('upload_frame').addEventListener("load", function() {
if (submitted)
window.parent.closeWindows();
});
});
$('start_torrent').addEventListener('change', function() {
$('start_torrent').addEventListener('change', function() {
$('add_paused').disabled = $('start_torrent').checked;
});
</script>
<div id="upload_spinner" class="mochaSpinner"></div>
});
</script>
<div id="upload_spinner" class="mochaSpinner"></div>
</body>
</html>

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

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

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

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

Loading…
Cancel
Save