Permalink
Browse files

Cleaning up some trailing whitespace.

  • Loading branch information...
1 parent f5f8821 commit 2ddd5e665be40637e6fc0fcd2b21333b39a9bd68 @RichGuk committed Feb 13, 2012
Showing with 37 additions and 39 deletions.
  1. +11 −11 js/background.js
  2. +26 −28 js/status.js
View
@@ -97,7 +97,7 @@ var Background = (function($) {
if (Global.getDebugMode()) {
console.log('Deluge: Checking status');
}
-
+
var that = this;
function checkStatus() {
@@ -207,7 +207,7 @@ var Background = (function($) {
// Send deactivation to anything listening.
chrome.extension.sendRequest({ msg: 'extension_deactivated' });
};
-
+
/**
* Add a torrent to Deluge using a URL. This method is meant to be called
* as part of Chrome extensions messaging system.
@@ -249,7 +249,7 @@ var Background = (function($) {
sendResponse({msg: 'error', result: null, error: 'unable to add torrent to deluge'});
});
}
-
+
// Need to get config values to add with the torrent first.
Deluge.api('core.get_config_values', [['add_paused', 'compact_allocation', 'download_location',
'max_connections_per_torrent', 'max_download_speed_per_torrent',
@@ -298,7 +298,7 @@ var Background = (function($) {
sendResponse({msg: 'error', result: null, error: 'failed to download torrent from URL.'});
});
}
-
+
function handleContextMenuClick(OnClickData) {
var torrentUrl = OnClickData.linkUrl;
if(torrentUrl.search(/\/(download|get)\//) > 0 || torrentUrl.search(/\.torrent$/) > 0) {
@@ -318,12 +318,12 @@ var Background = (function($) {
console.log('Deluge: Link not a torrent!');
}
}
-
+
return false;
}
-
+
var contextMenu = null;
-
+
pub.addContextMenu = function() {
if (contextMenu === null) {
contextMenu = chrome.contextMenus.create({
@@ -333,14 +333,14 @@ var Background = (function($) {
});
}
}
-
+
pub.removeContextMenu = function() {
if (contextMenu !== null) {
chrome.contextMenus.remove(contextMenu);
contextMenu = null;
}
}
-
+
//for some reason the context menu is always added regardless of the if
if (localStorage.contextMenu) {
pub.addContextMenu();
@@ -371,7 +371,7 @@ chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
} else if(request.msg == 'enable_download_icon') {
sendResponse(localStorage.delugeDownloadIcon);
}
-
+
// We need to send a reponse, even if it's empty.
sendResponse({msg: 'error', result: null, error: 'nothing called!'});
-});
+});
View
@@ -90,7 +90,7 @@ jQuery(document).ready(function($) {
// Set the initial height for the overlay.
var $overlay = $('#overlay').css({ height: $(document).height() });
-
+
// I can't get the popup to play nicely when there is a scroll bar and then
// when there isn't - so going to adjust the width if a scroll bar is
// visible (this needs to be done on timeout to give popup time to show).
@@ -156,7 +156,7 @@ jQuery(document).ready(function($) {
checkStatus();
});
}
-
+
/**
* Pause the table refresh.
*/
@@ -165,7 +165,7 @@ jQuery(document).ready(function($) {
clearInterval(refreshTimer);
}
}
-
+
/**
* Resume the table refresh.
*/
@@ -235,22 +235,21 @@ jQuery(document).ready(function($) {
}
$(document).trigger('table_updated');
}
-
+
(function() {
-
+
function getRowData(element) {
var $parent = $(element).parents('tr');
var torrentId = $parent.data('id');
var torrent = Torrents.getById(torrentId);
-
+
return {'torrentId': torrentId, 'torrent': torrent};
}
-
+
$('.main_actions .toggle_managed').live('click', function() {
var rowData = getRowData(this);
-
var autoManaged = !rowData.torrent.autoManaged;
-
+
Deluge.api('core.set_torrent_auto_managed', [rowData.torrentId, autoManaged])
.success(function() {
if (Global.getDebugMode()) {
@@ -264,12 +263,11 @@ jQuery(document).ready(function($) {
}
});
});
-
+
$('.main_actions .state').live('click', function() {
var rowData = getRowData(this);
-
var method = rowData.torrent.state == 'Paused' ? 'core.resume_torrent' : 'core.pause_torrent';
-
+
Deluge.api(method, [[rowData.torrentId]])
.success(function() {
if (Global.getDebugMode()) {
@@ -283,10 +281,10 @@ jQuery(document).ready(function($) {
}
});
});
-
+
$('.main_actions .move_up').live('click', function() {
var rowData = getRowData(this);
-
+
Deluge.api('core.queue_up', [[rowData.torrentId]])
.success(function() {
if (Global.getDebugMode()) {
@@ -300,10 +298,10 @@ jQuery(document).ready(function($) {
}
});
});
-
+
$('.main_actions .move_down').live('click', function() {
var rowData = getRowData(this);
-
+
Deluge.api('core.queue_down', [[rowData.torrentId]])
.success(function() {
if (Global.getDebugMode()) {
@@ -317,10 +315,10 @@ jQuery(document).ready(function($) {
}
});
});
-
+
$('.main_actions .delete').live('click', function() {
pauseTableRefresh();
-
+
var parentTd = $(this).parents('td');
var newElm = $('<div>');
newElm.addClass('delete-options');
@@ -332,10 +330,10 @@ jQuery(document).ready(function($) {
tmp.append('<a href="#delete-torrent" title="Just delete torrent file" rel="torrent"><img src="images/file.png" alt="T" /></a>');
});
});
-
+
$('.delete-options a').live('click', function() {
var rowData = getRowData(this);
-
+
var action = $(this).attr('rel') || 'cancel';
// If canceling remove overlay and resume refresh now and return.
if(action == 'cancel') {
@@ -346,15 +344,15 @@ jQuery(document).ready(function($) {
});
return false;
}
-
+
function removeButtons() {
// Remove buttons, resume refresh.
$('.delete-options').fadeOut('fast', function() {
resumeTableRefresh();
updateTable();
});
}
-
+
var delData = (action == 'data') ? true : false;
Deluge.api('core.remove_torrent', [rowData.torrentId, delData])
.success(function() {
@@ -372,21 +370,21 @@ jQuery(document).ready(function($) {
return false;
});
})();
-
+
(function() {
var $inputBox = $('#manual_add_input');
var $addButton = $('#manual_add_button');
-
+
$inputBox.keydown(function(event){
if (event.keyCode == '13') {
event.preventDefault();
$addButton.click();
}
});
-
+
$addButton.live('click', function() {
var url = $inputBox.val();
-
+
// Now check that the link contains either .torrent or download, get, etc...
if(url.search(/\/(download|get)\//) > 0 || url.search(/\.torrent$/) > 0) {
chrome.extension.sendRequest({ msg: 'add_torrent_from_url', url: url},
@@ -437,8 +435,8 @@ jQuery(document).ready(function($) {
// This function is called when the background page sends an activated
// message, this happens roughly every minute so we only want to call
- // updateTable, or hide any current overlays once, we can let the local
- // timers in within this script handle table updating.
+ // updateTable, or hide any current overlays once. We can let the local
+ // timers within this script handle table updating.
function activated() {
if (!extensionActivated) {
if (Global.getDebugMode()) {

0 comments on commit 2ddd5e6

Please sign in to comment.