Browse Source

Follow project coding style. Issue #2192.

adaptive-webui-19844
Gabriele 10 years ago
parent
commit
aab2c34257
  1. 25
      src/webui/www/public/scripts/contextmenu.js
  2. 8
      src/webui/www/public/scripts/download.js
  3. 52
      src/webui/www/public/scripts/mocha-init.js
  4. 45
      src/webui/www/public/scripts/parametrics.js
  5. 2
      src/webui/www/public/scripts/progressbar.js

25
src/webui/www/public/scripts/contextmenu.js

@ -10,7 +10,10 @@ var ContextMenu = new Class({ @@ -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({ @@ -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({ @@ -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({ @@ -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({ @@ -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({ @@ -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');

8
src/webui/www/public/scripts/download.js

@ -20,12 +20,16 @@ @@ -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'));
}

52
src/webui/www/public/scripts/mocha-init.js

@ -8,7 +8,6 @@ @@ -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') { @@ -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(){ @@ -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(){ @@ -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(){ @@ -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(){ @@ -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(){ @@ -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(){ @@ -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

45
src/webui/www/public/scripts/parametrics.js

@ -13,7 +13,6 @@ Requires: @@ -13,7 +13,6 @@ Requires:
Core.js, Window.js
*/
MochaUI.extend({
addUpLimitSlider: function(hash) {
if ($('uplimitSliderarea')) {
@ -30,7 +29,8 @@ MochaUI.extend({ @@ -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({ @@ -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({ @@ -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({ @@ -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({ @@ -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({ @@ -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({ @@ -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({ @@ -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({ @@ -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({ @@ -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)");
}

2
src/webui/www/public/scripts/progressbar.js

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