Follow project coding style. Issue #2192.

This commit is contained in:
Gabriele 2014-11-30 14:14:09 +01:00
parent 3672363207
commit aab2c34257
6 changed files with 798 additions and 734 deletions

View file

@ -10,7 +10,10 @@ var ContextMenu = new Class({
stopEvent: true,
targets: 'body',
trigger: 'contextmenu',
offsets: { x:0, y:0 },
offsets: {
x: 0,
y: 0
},
onShow: $empty,
onHide: $empty,
onClick: $empty,
@ -33,7 +36,8 @@ var ContextMenu = new Class({
onComplete: function() {
if (this.getStyle('opacity')) {
this.setStyle('visibility', 'visible');
}else{
}
else {
this.setStyle('visibility', 'hidden');
}
}.bind(this.menu)
@ -43,7 +47,11 @@ var ContextMenu = new Class({
this.hide().startListener();
//hide the menu
this.menu.setStyles({ 'position':'absolute','top':'-900000px', 'display':'block' });
this.menu.setStyles({
'position': 'absolute',
'top': '-900000px',
'display': 'block'
});
},
addTarget: function(t) {
@ -52,7 +60,9 @@ var ContextMenu = new Class({
//enabled?
if (!this.options.disabled) {
//prevent default, if told to
if(this.options.stopEvent) { e.stop(); }
if (this.options.stopEvent) {
e.stop();
}
//record this as the trigger
this.options.element = $(t);
//position the menu
@ -80,7 +90,9 @@ var ContextMenu = new Class({
//enabled?
if (!this.options.disabled) {
//prevent default, if told to
if(this.options.stopEvent) { e.stop(); }
if (this.options.stopEvent) {
e.stop();
}
//record this as the trigger
this.options.element = $(el);
//position the menu
@ -126,8 +138,7 @@ var ContextMenu = new Class({
//hide the menu
hide: function(trigger) {
if(this.shown)
{
if (this.shown) {
this.fx.start(0);
//this.menu.fade('out');
this.fireEvent('hide');

View file

@ -20,12 +20,16 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
window.addEvent('domready', function() {
$('urls').focus();
$('downButton').addEvent('click', function(e) {
new Event(e).stop();
new Request({url: 'command/download', method: 'post', data: {urls: $('urls').value},
new Request({
url: 'command/download',
method: 'post',
data: {
urls: $('urls').value
},
onComplete: function() {
window.parent.document.getElementById('downloadPage').parentNode.removeChild(window.parent.document.getElementById('downloadPage'));
}

View file

@ -8,7 +8,6 @@
it in the onContentLoaded function of the new window.
----------------------------------------------------------------- */
/* Define localStorage object for older browsers */
if (typeof localStorage == 'undefined') {
window['localStorage'] = {
@ -16,7 +15,9 @@ if (typeof localStorage == 'undefined') {
return Cookie.read(name);
},
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();
if (h.length) {
h.each(function(hash, index) {
new Request({url: 'command/pause', method: 'post', data: {hash: hash}}).send();
new Request({
url: 'command/pause',
method: 'post',
data: {
hash: hash
}
}).send();
});
}
};
@ -201,7 +208,13 @@ initializeWindows = function(){
var h = myTable.selectedIds();
if (h.length) {
h.each(function(hash, index) {
new Request({url: 'command/resume', method: 'post', data: {hash: hash}}).send();
new Request({
url: 'command/resume',
method: 'post',
data: {
hash: hash
}
}).send();
});
}
};
@ -210,7 +223,13 @@ initializeWindows = function(){
var h = myTable.selectedIds();
if (h.length) {
h.each(function(hash, index) {
new Request({url: 'command/recheck', method: 'post', data: {hash: hash}}).send();
new Request({
url: 'command/recheck',
method: 'post',
data: {
hash: hash
}
}).send();
});
}
};
@ -221,14 +240,22 @@ initializeWindows = function(){
var h = myTable.selectedIds();
if (h.length) {
h.each(function(hash, index) {
new Request({url: 'command/'+item, method: 'post', data: {hash: hash}}).send();
new Request({
url: 'command/' + item,
method: 'post',
data: {
hash: hash
}
}).send();
});
}
});
addClickEvent(item + 'All', function(e) {
new Event(e).stop();
new Request({url: 'command/'+item+'all'}).send();
new Request({
url: 'command/' + item + 'all'
}).send();
});
});
@ -242,7 +269,13 @@ initializeWindows = function(){
setPriorityFN = function(cmd) {
var h = myTable.selectedIds();
if (h.length) {
new Request({url: 'command/'+cmd, method: 'post', data: {hashes: h.join("|")}}).send();
new Request({
url: 'command/' + cmd,
method: 'post',
data: {
hashes: h.join("|")
}
}).send();
}
}
@ -281,8 +314,7 @@ initializeWindows = function(){
}).send();
});
updateSpeedInBrowserTitleBarLinkCheckState = function()
{
updateSpeedInBrowserTitleBarLinkCheckState = function() {
if (localStorage.getItem('speed_in_browser_title_bar') == 'true')
$(speedInBrowserTitleBarLink).firstChild.style.opacity = '1';
else

View file

@ -13,7 +13,6 @@ Requires:
Core.js, Window.js
*/
MochaUI.extend({
addUpLimitSlider: function(hash) {
if ($('uplimitSliderarea')) {
@ -30,7 +29,8 @@ MochaUI.extend({
var tmp = data.toInt();
if (tmp > 0) {
maximum = tmp / 1024.
} else {
}
else {
maximum = 1000
}
}
@ -48,7 +48,8 @@ MochaUI.extend({
if (pos > 0) {
$('uplimitUpdatevalue').set('html', pos);
$('upLimitUnit').set('html', "_(KiB/s)");
} else {
}
else {
$('uplimitUpdatevalue').set('html', '∞');
$('upLimitUnit').set('html', "");
}
@ -58,15 +59,19 @@ MochaUI.extend({
if (up_limit == 0) {
$('uplimitUpdatevalue').set('html', '∞');
$('upLimitUnit').set('html', "");
} else {
}
else {
$('uplimitUpdatevalue').set('html', up_limit.round());
$('upLimitUnit').set('html', "_(KiB/s)");
}
} else {
}
else {
var req = new Request({
url: 'command/getTorrentUpLimit',
method: 'post',
data: {hash: hash},
data: {
hash: hash
},
onSuccess: function(data) {
if (data) {
var up_limit = data.toInt();
@ -79,7 +84,8 @@ MochaUI.extend({
if (pos > 0) {
$('uplimitUpdatevalue').set('html', pos);
$('upLimitUnit').set('html', "_(KiB/s)");
} else {
}
else {
$('uplimitUpdatevalue').set('html', '∞');
$('upLimitUnit').set('html', "");
}
@ -89,7 +95,8 @@ MochaUI.extend({
if (up_limit == 0) {
$('uplimitUpdatevalue').set('html', '∞');
$('upLimitUnit').set('html', "");
} else {
}
else {
$('uplimitUpdatevalue').set('html', (up_limit / 1024.).round());
$('upLimitUnit').set('html', "_(KiB/s)");
}
@ -117,7 +124,8 @@ MochaUI.extend({
var tmp = data.toInt();
if (tmp > 0) {
maximum = tmp / 1024.
} else {
}
else {
maximum = 1000
}
}
@ -135,7 +143,8 @@ MochaUI.extend({
if (pos > 0) {
$('dllimitUpdatevalue').set('html', pos);
$('dlLimitUnit').set('html', "_(KiB/s)");
} else {
}
else {
$('dllimitUpdatevalue').set('html', '∞');
$('dlLimitUnit').set('html', "");
}
@ -145,15 +154,19 @@ MochaUI.extend({
if (dl_limit == 0) {
$('dllimitUpdatevalue').set('html', '∞');
$('dlLimitUnit').set('html', "");
} else {
}
else {
$('dllimitUpdatevalue').set('html', dl_limit.round());
$('dlLimitUnit').set('html', "_(KiB/s)");
}
} else {
}
else {
var req = new Request({
url: 'command/getTorrentDlLimit',
method: 'post',
data: {hash: hash},
data: {
hash: hash
},
onSuccess: function(data) {
if (data) {
var dl_limit = data.toInt();
@ -166,7 +179,8 @@ MochaUI.extend({
if (pos > 0) {
$('dllimitUpdatevalue').set('html', pos);
$('dlLimitUnit').set('html', "_(KiB/s)");
} else {
}
else {
$('dllimitUpdatevalue').set('html', '∞');
$('dlLimitUnit').set('html', "");
}
@ -176,7 +190,8 @@ MochaUI.extend({
if (dl_limit == 0) {
$('dllimitUpdatevalue').set('html', '∞');
$('dlLimitUnit').set('html', "");
} else {
}
else {
$('dllimitUpdatevalue').set('html', (dl_limit / 1024.).round());
$('dlLimitUnit').set('html', "_(KiB/s)");
}

View file

@ -82,6 +82,7 @@ function ProgressBar_setValue(value){
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)');
}
function ProgressBar_checkForParent(id) {
var obj = $(id);
if (!obj) return;
@ -93,4 +94,5 @@ function ProgressBar_checkForParent(id){
obj.vals.width = w;
obj.setValue(obj.vals.value);
}
var ProgressBars = 0;