mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-12 16:23:07 -07:00
Follow project coding style. Issue #2192.
This commit is contained in:
parent
3672363207
commit
aab2c34257
6 changed files with 798 additions and 734 deletions
|
@ -10,7 +10,10 @@ var ContextMenu = new Class({
|
||||||
stopEvent: true,
|
stopEvent: true,
|
||||||
targets: 'body',
|
targets: 'body',
|
||||||
trigger: 'contextmenu',
|
trigger: 'contextmenu',
|
||||||
offsets: { x:0, y:0 },
|
offsets: {
|
||||||
|
x: 0,
|
||||||
|
y: 0
|
||||||
|
},
|
||||||
onShow: $empty,
|
onShow: $empty,
|
||||||
onHide: $empty,
|
onHide: $empty,
|
||||||
onClick: $empty,
|
onClick: $empty,
|
||||||
|
@ -33,7 +36,8 @@ var ContextMenu = new Class({
|
||||||
onComplete: function() {
|
onComplete: function() {
|
||||||
if (this.getStyle('opacity')) {
|
if (this.getStyle('opacity')) {
|
||||||
this.setStyle('visibility', 'visible');
|
this.setStyle('visibility', 'visible');
|
||||||
}else{
|
}
|
||||||
|
else {
|
||||||
this.setStyle('visibility', 'hidden');
|
this.setStyle('visibility', 'hidden');
|
||||||
}
|
}
|
||||||
}.bind(this.menu)
|
}.bind(this.menu)
|
||||||
|
@ -43,7 +47,11 @@ var ContextMenu = new Class({
|
||||||
this.hide().startListener();
|
this.hide().startListener();
|
||||||
|
|
||||||
//hide the menu
|
//hide the menu
|
||||||
this.menu.setStyles({ 'position':'absolute','top':'-900000px', 'display':'block' });
|
this.menu.setStyles({
|
||||||
|
'position': 'absolute',
|
||||||
|
'top': '-900000px',
|
||||||
|
'display': 'block'
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
addTarget: function(t) {
|
addTarget: function(t) {
|
||||||
|
@ -52,7 +60,9 @@ var ContextMenu = new Class({
|
||||||
//enabled?
|
//enabled?
|
||||||
if (!this.options.disabled) {
|
if (!this.options.disabled) {
|
||||||
//prevent default, if told to
|
//prevent default, if told to
|
||||||
if(this.options.stopEvent) { e.stop(); }
|
if (this.options.stopEvent) {
|
||||||
|
e.stop();
|
||||||
|
}
|
||||||
//record this as the trigger
|
//record this as the trigger
|
||||||
this.options.element = $(t);
|
this.options.element = $(t);
|
||||||
//position the menu
|
//position the menu
|
||||||
|
@ -80,7 +90,9 @@ var ContextMenu = new Class({
|
||||||
//enabled?
|
//enabled?
|
||||||
if (!this.options.disabled) {
|
if (!this.options.disabled) {
|
||||||
//prevent default, if told to
|
//prevent default, if told to
|
||||||
if(this.options.stopEvent) { e.stop(); }
|
if (this.options.stopEvent) {
|
||||||
|
e.stop();
|
||||||
|
}
|
||||||
//record this as the trigger
|
//record this as the trigger
|
||||||
this.options.element = $(el);
|
this.options.element = $(el);
|
||||||
//position the menu
|
//position the menu
|
||||||
|
@ -126,8 +138,7 @@ var ContextMenu = new Class({
|
||||||
|
|
||||||
//hide the menu
|
//hide the menu
|
||||||
hide: function(trigger) {
|
hide: function(trigger) {
|
||||||
if(this.shown)
|
if (this.shown) {
|
||||||
{
|
|
||||||
this.fx.start(0);
|
this.fx.start(0);
|
||||||
//this.menu.fade('out');
|
//this.menu.fade('out');
|
||||||
this.fireEvent('hide');
|
this.fireEvent('hide');
|
||||||
|
|
|
@ -20,12 +20,16 @@
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
window.addEvent('domready', function() {
|
window.addEvent('domready', function() {
|
||||||
$('urls').focus();
|
$('urls').focus();
|
||||||
$('downButton').addEvent('click', function(e) {
|
$('downButton').addEvent('click', function(e) {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
new Request({url: 'command/download', method: 'post', data: {urls: $('urls').value},
|
new Request({
|
||||||
|
url: 'command/download',
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
urls: $('urls').value
|
||||||
|
},
|
||||||
onComplete: function() {
|
onComplete: function() {
|
||||||
window.parent.document.getElementById('downloadPage').parentNode.removeChild(window.parent.document.getElementById('downloadPage'));
|
window.parent.document.getElementById('downloadPage').parentNode.removeChild(window.parent.document.getElementById('downloadPage'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
it in the onContentLoaded function of the new window.
|
it in the onContentLoaded function of the new window.
|
||||||
|
|
||||||
----------------------------------------------------------------- */
|
----------------------------------------------------------------- */
|
||||||
|
|
||||||
/* Define localStorage object for older browsers */
|
/* Define localStorage object for older browsers */
|
||||||
if (typeof localStorage == 'undefined') {
|
if (typeof localStorage == 'undefined') {
|
||||||
window['localStorage'] = {
|
window['localStorage'] = {
|
||||||
|
@ -16,7 +15,9 @@ if (typeof localStorage == 'undefined') {
|
||||||
return Cookie.read(name);
|
return Cookie.read(name);
|
||||||
},
|
},
|
||||||
setItem: function(name, value) {
|
setItem: function(name, value) {
|
||||||
Cookie.write(name, value, {duration: 365 * 10});
|
Cookie.write(name, value, {
|
||||||
|
duration: 365 * 10
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -192,7 +193,13 @@ initializeWindows = function(){
|
||||||
var h = myTable.selectedIds();
|
var h = myTable.selectedIds();
|
||||||
if (h.length) {
|
if (h.length) {
|
||||||
h.each(function(hash, index) {
|
h.each(function(hash, index) {
|
||||||
new Request({url: 'command/pause', method: 'post', data: {hash: hash}}).send();
|
new Request({
|
||||||
|
url: 'command/pause',
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
hash: hash
|
||||||
|
}
|
||||||
|
}).send();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -201,7 +208,13 @@ initializeWindows = function(){
|
||||||
var h = myTable.selectedIds();
|
var h = myTable.selectedIds();
|
||||||
if (h.length) {
|
if (h.length) {
|
||||||
h.each(function(hash, index) {
|
h.each(function(hash, index) {
|
||||||
new Request({url: 'command/resume', method: 'post', data: {hash: hash}}).send();
|
new Request({
|
||||||
|
url: 'command/resume',
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
hash: hash
|
||||||
|
}
|
||||||
|
}).send();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -210,7 +223,13 @@ initializeWindows = function(){
|
||||||
var h = myTable.selectedIds();
|
var h = myTable.selectedIds();
|
||||||
if (h.length) {
|
if (h.length) {
|
||||||
h.each(function(hash, index) {
|
h.each(function(hash, index) {
|
||||||
new Request({url: 'command/recheck', method: 'post', data: {hash: hash}}).send();
|
new Request({
|
||||||
|
url: 'command/recheck',
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
hash: hash
|
||||||
|
}
|
||||||
|
}).send();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -221,14 +240,22 @@ initializeWindows = function(){
|
||||||
var h = myTable.selectedIds();
|
var h = myTable.selectedIds();
|
||||||
if (h.length) {
|
if (h.length) {
|
||||||
h.each(function(hash, index) {
|
h.each(function(hash, index) {
|
||||||
new Request({url: 'command/'+item, method: 'post', data: {hash: hash}}).send();
|
new Request({
|
||||||
|
url: 'command/' + item,
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
hash: hash
|
||||||
|
}
|
||||||
|
}).send();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
addClickEvent(item + 'All', function(e) {
|
addClickEvent(item + 'All', function(e) {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
new Request({url: 'command/'+item+'all'}).send();
|
new Request({
|
||||||
|
url: 'command/' + item + 'all'
|
||||||
|
}).send();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -242,7 +269,13 @@ initializeWindows = function(){
|
||||||
setPriorityFN = function(cmd) {
|
setPriorityFN = function(cmd) {
|
||||||
var h = myTable.selectedIds();
|
var h = myTable.selectedIds();
|
||||||
if (h.length) {
|
if (h.length) {
|
||||||
new Request({url: 'command/'+cmd, method: 'post', data: {hashes: h.join("|")}}).send();
|
new Request({
|
||||||
|
url: 'command/' + cmd,
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
hashes: h.join("|")
|
||||||
|
}
|
||||||
|
}).send();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,8 +314,7 @@ initializeWindows = function(){
|
||||||
}).send();
|
}).send();
|
||||||
});
|
});
|
||||||
|
|
||||||
updateSpeedInBrowserTitleBarLinkCheckState = function()
|
updateSpeedInBrowserTitleBarLinkCheckState = function() {
|
||||||
{
|
|
||||||
if (localStorage.getItem('speed_in_browser_title_bar') == 'true')
|
if (localStorage.getItem('speed_in_browser_title_bar') == 'true')
|
||||||
$(speedInBrowserTitleBarLink).firstChild.style.opacity = '1';
|
$(speedInBrowserTitleBarLink).firstChild.style.opacity = '1';
|
||||||
else
|
else
|
||||||
|
|
|
@ -13,7 +13,6 @@ Requires:
|
||||||
Core.js, Window.js
|
Core.js, Window.js
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
MochaUI.extend({
|
MochaUI.extend({
|
||||||
addUpLimitSlider: function(hash) {
|
addUpLimitSlider: function(hash) {
|
||||||
if ($('uplimitSliderarea')) {
|
if ($('uplimitSliderarea')) {
|
||||||
|
@ -30,7 +29,8 @@ MochaUI.extend({
|
||||||
var tmp = data.toInt();
|
var tmp = data.toInt();
|
||||||
if (tmp > 0) {
|
if (tmp > 0) {
|
||||||
maximum = tmp / 1024.
|
maximum = tmp / 1024.
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
maximum = 1000
|
maximum = 1000
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,8 @@ MochaUI.extend({
|
||||||
if (pos > 0) {
|
if (pos > 0) {
|
||||||
$('uplimitUpdatevalue').set('html', pos);
|
$('uplimitUpdatevalue').set('html', pos);
|
||||||
$('upLimitUnit').set('html', "_(KiB/s)");
|
$('upLimitUnit').set('html', "_(KiB/s)");
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$('uplimitUpdatevalue').set('html', '∞');
|
$('uplimitUpdatevalue').set('html', '∞');
|
||||||
$('upLimitUnit').set('html', "");
|
$('upLimitUnit').set('html', "");
|
||||||
}
|
}
|
||||||
|
@ -58,15 +59,19 @@ MochaUI.extend({
|
||||||
if (up_limit == 0) {
|
if (up_limit == 0) {
|
||||||
$('uplimitUpdatevalue').set('html', '∞');
|
$('uplimitUpdatevalue').set('html', '∞');
|
||||||
$('upLimitUnit').set('html', "");
|
$('upLimitUnit').set('html', "");
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$('uplimitUpdatevalue').set('html', up_limit.round());
|
$('uplimitUpdatevalue').set('html', up_limit.round());
|
||||||
$('upLimitUnit').set('html', "_(KiB/s)");
|
$('upLimitUnit').set('html', "_(KiB/s)");
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
var req = new Request({
|
var req = new Request({
|
||||||
url: 'command/getTorrentUpLimit',
|
url: 'command/getTorrentUpLimit',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: {hash: hash},
|
data: {
|
||||||
|
hash: hash
|
||||||
|
},
|
||||||
onSuccess: function(data) {
|
onSuccess: function(data) {
|
||||||
if (data) {
|
if (data) {
|
||||||
var up_limit = data.toInt();
|
var up_limit = data.toInt();
|
||||||
|
@ -79,7 +84,8 @@ MochaUI.extend({
|
||||||
if (pos > 0) {
|
if (pos > 0) {
|
||||||
$('uplimitUpdatevalue').set('html', pos);
|
$('uplimitUpdatevalue').set('html', pos);
|
||||||
$('upLimitUnit').set('html', "_(KiB/s)");
|
$('upLimitUnit').set('html', "_(KiB/s)");
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$('uplimitUpdatevalue').set('html', '∞');
|
$('uplimitUpdatevalue').set('html', '∞');
|
||||||
$('upLimitUnit').set('html', "");
|
$('upLimitUnit').set('html', "");
|
||||||
}
|
}
|
||||||
|
@ -89,7 +95,8 @@ MochaUI.extend({
|
||||||
if (up_limit == 0) {
|
if (up_limit == 0) {
|
||||||
$('uplimitUpdatevalue').set('html', '∞');
|
$('uplimitUpdatevalue').set('html', '∞');
|
||||||
$('upLimitUnit').set('html', "");
|
$('upLimitUnit').set('html', "");
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$('uplimitUpdatevalue').set('html', (up_limit / 1024.).round());
|
$('uplimitUpdatevalue').set('html', (up_limit / 1024.).round());
|
||||||
$('upLimitUnit').set('html', "_(KiB/s)");
|
$('upLimitUnit').set('html', "_(KiB/s)");
|
||||||
}
|
}
|
||||||
|
@ -117,7 +124,8 @@ MochaUI.extend({
|
||||||
var tmp = data.toInt();
|
var tmp = data.toInt();
|
||||||
if (tmp > 0) {
|
if (tmp > 0) {
|
||||||
maximum = tmp / 1024.
|
maximum = tmp / 1024.
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
maximum = 1000
|
maximum = 1000
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,7 +143,8 @@ MochaUI.extend({
|
||||||
if (pos > 0) {
|
if (pos > 0) {
|
||||||
$('dllimitUpdatevalue').set('html', pos);
|
$('dllimitUpdatevalue').set('html', pos);
|
||||||
$('dlLimitUnit').set('html', "_(KiB/s)");
|
$('dlLimitUnit').set('html', "_(KiB/s)");
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$('dllimitUpdatevalue').set('html', '∞');
|
$('dllimitUpdatevalue').set('html', '∞');
|
||||||
$('dlLimitUnit').set('html', "");
|
$('dlLimitUnit').set('html', "");
|
||||||
}
|
}
|
||||||
|
@ -145,15 +154,19 @@ MochaUI.extend({
|
||||||
if (dl_limit == 0) {
|
if (dl_limit == 0) {
|
||||||
$('dllimitUpdatevalue').set('html', '∞');
|
$('dllimitUpdatevalue').set('html', '∞');
|
||||||
$('dlLimitUnit').set('html', "");
|
$('dlLimitUnit').set('html', "");
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$('dllimitUpdatevalue').set('html', dl_limit.round());
|
$('dllimitUpdatevalue').set('html', dl_limit.round());
|
||||||
$('dlLimitUnit').set('html', "_(KiB/s)");
|
$('dlLimitUnit').set('html', "_(KiB/s)");
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
var req = new Request({
|
var req = new Request({
|
||||||
url: 'command/getTorrentDlLimit',
|
url: 'command/getTorrentDlLimit',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: {hash: hash},
|
data: {
|
||||||
|
hash: hash
|
||||||
|
},
|
||||||
onSuccess: function(data) {
|
onSuccess: function(data) {
|
||||||
if (data) {
|
if (data) {
|
||||||
var dl_limit = data.toInt();
|
var dl_limit = data.toInt();
|
||||||
|
@ -166,7 +179,8 @@ MochaUI.extend({
|
||||||
if (pos > 0) {
|
if (pos > 0) {
|
||||||
$('dllimitUpdatevalue').set('html', pos);
|
$('dllimitUpdatevalue').set('html', pos);
|
||||||
$('dlLimitUnit').set('html', "_(KiB/s)");
|
$('dlLimitUnit').set('html', "_(KiB/s)");
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$('dllimitUpdatevalue').set('html', '∞');
|
$('dllimitUpdatevalue').set('html', '∞');
|
||||||
$('dlLimitUnit').set('html', "");
|
$('dlLimitUnit').set('html', "");
|
||||||
}
|
}
|
||||||
|
@ -176,7 +190,8 @@ MochaUI.extend({
|
||||||
if (dl_limit == 0) {
|
if (dl_limit == 0) {
|
||||||
$('dllimitUpdatevalue').set('html', '∞');
|
$('dllimitUpdatevalue').set('html', '∞');
|
||||||
$('dlLimitUnit').set('html', "");
|
$('dlLimitUnit').set('html', "");
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$('dllimitUpdatevalue').set('html', (dl_limit / 1024.).round());
|
$('dllimitUpdatevalue').set('html', (dl_limit / 1024.).round());
|
||||||
$('dlLimitUnit').set('html', "_(KiB/s)");
|
$('dlLimitUnit').set('html', "_(KiB/s)");
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,6 +82,7 @@ function ProgressBar_setValue(value){
|
||||||
this.vals.dark.setStyle('clip', 'rect(0,' + r + 'px,' + this.vals.height + 'px,0)');
|
this.vals.dark.setStyle('clip', 'rect(0,' + r + 'px,' + this.vals.height + 'px,0)');
|
||||||
this.vals.light.setStyle('clip', 'rect(0,' + this.vals.width + 'px,' + this.vals.height + 'px,' + r + 'px)');
|
this.vals.light.setStyle('clip', 'rect(0,' + this.vals.width + 'px,' + this.vals.height + 'px,' + r + 'px)');
|
||||||
}
|
}
|
||||||
|
|
||||||
function ProgressBar_checkForParent(id) {
|
function ProgressBar_checkForParent(id) {
|
||||||
var obj = $(id);
|
var obj = $(id);
|
||||||
if (!obj) return;
|
if (!obj) return;
|
||||||
|
@ -93,4 +94,5 @@ function ProgressBar_checkForParent(id){
|
||||||
obj.vals.width = w;
|
obj.vals.width = w;
|
||||||
obj.setValue(obj.vals.value);
|
obj.setValue(obj.vals.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
var ProgressBars = 0;
|
var ProgressBars = 0;
|
Loading…
Add table
Add a link
Reference in a new issue