*/
function Dialog(){
- this.initialize();
+ this.initialize();
}
Dialog.prototype = {
- /*
- * Constructor
- */
- initialize: function() {
+ /*
+ * Constructor
+ */
+ initialize: function() {
/*
* Private Interface Variables
- /*--------------------------------------------
- *
- * E V E N T F U N C T I O N S
- *
- *--------------------------------------------*/
+ /*--------------------------------------------
+ *
+ * E V E N T F U N C T I O N S
+ *
+ *--------------------------------------------*/
hideDialog: function()
{
dialog.hideDialog();
},
- /*--------------------------------------------
- *
- * I N T E R F A C E F U N C T I O N S
- *
- *--------------------------------------------*/
+ /*--------------------------------------------
+ *
+ * I N T E R F A C E F U N C T I O N S
+ *
+ *--------------------------------------------*/
- /*
- * Display a confirm dialog
- */
- confirm: function(dialog_heading, dialog_message, confirm_button_label, callback_function, callback_data, cancel_button_label) {
+ /*
+ * Display a confirm dialog
+ */
+ confirm: function(dialog_heading, dialog_message, confirm_button_label,
+ callback_function, callback_data, cancel_button_label)
+ {
if (!iPhone && Safari3) {
$('div#upload_container div.dialog_window').css('top', '-205px');
$('div#prefs_container div.dialog_window').css('top', '-425px');
}
},
- /*
- * Display an alert dialog
- */
- alert: function(dialog_heading, dialog_message, cancel_button_label) {
+ /*
+ * Display an alert dialog
+ */
+ alert: function(dialog_heading, dialog_message, cancel_button_label) {
if (!iPhone && Safari3) {
$('div#upload_container div.dialog_window').css('top', '-205px');
$('div#prefs_container div.dialog_window').css('top', '-425px');
function FileRow(torrent, i)
{
- this.initialize(torrent, i);
+ this.initialize(torrent, i);
}
FileRow.prototype =
return this._index;
},
- readAttributes: function(file)
+ readAttributes: function(file)
{
- if (file.index !== undefined && file.index !== this._index) {
- this._index = file.index;
- this._dirty = true;
- }
- if (file.bytesCompleted !== undefined && file.bytesCompleted !== this._done) {
- this._done = file.bytesCompleted;
- this._dirty = true;
- }
- if (file.length !== undefined && file.length !== this._size) {
- this._size = file.length;
- this._dirty = true;
- }
- if (file.priority !== undefined && file.priority !== this._prio) {
- this._prio = file.priority;
- this._dirty = true;
- }
- if (file.wanted !== undefined && file.wanted !== this._wanted) {
- this._wanted = file.wanted;
- this._dirty = true;
- }
- },
-
- refreshWantedHTML: function() {
- var e = this.getElement();
- var c = [ e.classNameConst ];
- if (!this._wanted) { c.push('skip'); }
- if (this.isDone()) { c.push('complete'); }
- e.className = c.join(' ');
- },
- refreshPriorityHTML: function() {
- var e = this._priority_control;
- var c = [ e.classNameConst ];
- switch(this._prio) {
- case -1 : c.push('low'); break;
- case 1 : c.push('high'); break;
- default : c.push('normal'); break;
- }
- e.className = c.join(' ');
- },
- refreshProgressHTML: function() {
- var pct = 100 * (this._size ? (this._done / this._size) : 1.0);
- var c = [ Transmission.fmt.size(this._done),
- ' of ',
- Transmission.fmt.size(this._size),
- ' (',
- Transmission.fmt.percentString(pct),
- '%)' ].join('');
- setInnerHTML(this._progress[0], c);
- },
- refreshHTML: function() {
- if (this._dirty) {
- this._dirty = false;
- this.refreshProgressHTML();
- this.refreshWantedHTML();
- this.refreshPriorityHTML();
- }
- },
+ if (file.index !== undefined && file.index !== this._index) {
+ this._index = file.index;
+ this._dirty = true;
+ }
+ if (file.bytesCompleted !== undefined && file.bytesCompleted !== this._done) {
+ this._done = file.bytesCompleted;
+ this._dirty = true;
+ }
+ if (file.length !== undefined && file.length !== this._size) {
+ this._size = file.length;
+ this._dirty = true;
+ }
+ if (file.priority !== undefined && file.priority !== this._prio) {
+ this._prio = file.priority;
+ this._dirty = true;
+ }
+ if (file.wanted !== undefined && file.wanted !== this._wanted) {
+ this._wanted = file.wanted;
+ this._dirty = true;
+ }
+ },
+
+ refreshWantedHTML: function()
+ {
+ var e = this.getElement(),
+ c = [ e.classNameConst ];
+
+ if (!this._wanted) { c.push('skip'); }
+ if (this.isDone()) { c.push('complete'); }
+ e.className = c.join(' ');
+ },
+ refreshPriorityHTML: function()
+ {
+ var e = this._priority_control,
+ c = [ e.classNameConst ];
+
+ switch(this._prio) {
+ case -1 : c.push('low'); break;
+ case 1 : c.push('high'); break;
+ default : c.push('normal'); break;
+ }
+ e.className = c.join(' ');
+ },
+ refreshProgressHTML: function()
+ {
+ var pct = 100 * (this._size ? (this._done / this._size) : 1.0),
+ c = [ Transmission.fmt.size(this._done),
+ ' of ',
+ Transmission.fmt.size(this._size),
+ ' (',
+ Transmission.fmt.percentString(pct),
+ '%)' ].join('');
+ setInnerHTML(this._progress[0], c);
+ },
+ refreshHTML: function() {
+ if (this._dirty) {
+ this._dirty = false;
+ this.refreshProgressHTML();
+ this.refreshWantedHTML();
+ this.refreshPriorityHTML();
+ }
+ },
refresh: function()
{
- var i = this.getIndex();
- var t = this.getTorrent();
+ var i = this.getIndex(),
+ t = this.getTorrent();
this.readAttributes(t.getFile(i));
this.refreshHTML();
},
- isDone: function () {
- return this._done >= this._size;
- },
- isEditable: function () {
- return (this.getTorrent().getFileCount()>1) && !this.isDone();
- },
+ isDone: function () {
+ return this._done >= this._size;
+ },
+ isEditable: function () {
+ return (this.getTorrent().getFileCount()>1) && !this.isDone();
+ },
- createRow: function(torrent, i)
+ createRow: function(torrent, i)
{
- var me = this;
- var file = torrent.getFile(i);
- var name = file.name.substring (file.name.lastIndexOf('/')+1);
-
- var root = document.createElement('li');
- root.id = 't' + this._torrent.getId() + 'f' + this._index;
- root.classNameConst = 'inspector_torrent_file_list_entry ' + ((i%2)?'odd':'even');
- root.className = root.classNameConst;
-
- var wanted_div = document.createElement('div');
- wanted_div.className = "file_wanted_control";
- $(wanted_div).bind('click',function(){ me.fireWantedChanged(!me._wanted); });
-
- var pri_div = document.createElement('div');
- pri_div.classNameConst = "file_priority_control";
- pri_div.className = pri_div.classNameConst;
- $(pri_div).bind('click',function(ev){
- var x = ev.pageX;
- var e = ev.target;
+ var me = this,
+ file = torrent.getFile(i),
+ name = file.name.substring (file.name.lastIndexOf('/')+1),
+ root, wanted_div, pri_div, file_div, prog_div;
+
+ root = document.createElement('li');
+ root.id = 't' + this._torrent.getId() + 'f' + this._index;
+ root.classNameConst = 'inspector_torrent_file_list_entry ' + ((i%2)?'odd':'even');
+ root.className = root.classNameConst;
+
+ wanted_div = document.createElement('div');
+ wanted_div.className = "file_wanted_control";
+ $(wanted_div).bind('click',function(){ me.fireWantedChanged(!me._wanted); });
+
+ pri_div = document.createElement('div');
+ pri_div.classNameConst = "file_priority_control";
+ pri_div.className = pri_div.classNameConst;
+ $(pri_div).bind('click',function(ev){
+ var prio,
+ x = ev.pageX,
+ e = ev.target;
while (e) {
x -= e.offsetLeft;
e = e.offsetParent;
}
- var prio;
if (iPhone) {
if (x < 8) prio = -1;
else if (x < 27) prio = 0;
me.firePriorityChanged(prio);
});
- var file_div = document.createElement('div');
- file_div.className = "inspector_torrent_file_list_entry_name";
- file_div.innerHTML = name.replace(/([\/_\.])/g, "$1​");
+ file_div = document.createElement('div');
+ file_div.className = "inspector_torrent_file_list_entry_name";
+ file_div.innerHTML = name.replace(/([\/_\.])/g, "$1​");
- var prog_div = document.createElement('div');
- prog_div.className = "inspector_torrent_file_list_entry_progress";
+ prog_div = document.createElement('div');
+ prog_div.className = "inspector_torrent_file_list_entry_progress";
- root.appendChild(wanted_div);
- root.appendChild(pri_div);
- root.appendChild(file_div);
- root.appendChild(prog_div);
+ root.appendChild(wanted_div);
+ root.appendChild(pri_div);
+ root.appendChild(file_div);
+ root.appendChild(prog_div);
- this._element = root;
- this._priority_control = pri_div;
- this._progress = $(prog_div);
+ this._element = root;
+ this._priority_control = pri_div;
+ this._progress = $(prog_div);
this.refresh();
return root;
- },
+ },
getElement: function()
{
return this._element;
},
- fireWantedChanged: function(do_want)
- {
- $(this).trigger('wantedToggled',[ this, do_want ]);
- },
- firePriorityChanged: function(priority)
- {
- $(this).trigger('priorityToggled',[ this, priority ]);
- }
+ fireWantedChanged: function(do_want)
+ {
+ $(this).trigger('wantedToggled',[ this, do_want ]);
+ },
+ firePriorityChanged: function(priority)
+ {
+ $(this).trigger('priorityToggled',[ this, priority ]);
+ }
};
TorrentRendererHelper.getProgressInfo = function(controller, t)
{
- var seed_ratio_limit = t.seedRatioLimit(controller);
+ var pct, extra,
+ s = t.getStatus(),
+ seed_ratio_limit = t.seedRatioLimit(controller);
- var pct;
if (t.needsMetaData())
pct = t.getMetadataPercentComplete() * 100;
else if (!t.isDone())
else
pct = 100;
- var extra = '';
- var s = t.getStatus();
if (s == Torrent._StatusStopped)
extra = 'paused';
else if (s == Torrent._StatusDownloadWait)
extra = 'seeding queued';
else if (s == Torrent._StatusSeed)
extra = 'seeding';
+ else
+ extra = '';
return {
percent: pct,
TorrentRendererHelper.createProgressbar = function(classes)
{
- var complete = document.createElement('div');
+ var complete, incomplete, progressbar;
+
+ complete = document.createElement('div');
complete.className = 'torrent_progress_bar complete';
- var incomplete = document.createElement('div');
+
+ incomplete = document.createElement('div');
incomplete.className = 'torrent_progress_bar incomplete';
- var progressbar = document.createElement('div');
+
+ progressbar = document.createElement('div');
progressbar.className = 'torrent_progress_bar_container ' + classes;
progressbar.appendChild(complete);
progressbar.appendChild(incomplete);
+
return { 'element': progressbar, 'complete': complete, 'incomplete': incomplete };
};
{
createRow: function()
{
- var root = document.createElement('li');
+ var root, name, peers, progressbar, details, image, button;
+
+ root = document.createElement('li');
root.className = 'torrent';
- var name = document.createElement('div');
+ name = document.createElement('div');
name.className = 'torrent_name';
- var peers = document.createElement('div');
+ peers = document.createElement('div');
peers.className = 'torrent_peer_details';
- var progressbar = TorrentRendererHelper.createProgressbar('full');
+ progressbar = TorrentRendererHelper.createProgressbar('full');
- var details = document.createElement('div');
+ details = document.createElement('div');
details.className = 'torrent_progress_details';
- var image = document.createElement('div');
- var button = document.createElement('a');
+ image = document.createElement('div');
+ button = document.createElement('a');
button.appendChild(image);
root.appendChild(name);
"%)" ].join('');
}
- var c;
- var sizeWhenDone = t.getSizeWhenDone();
- var totalSize = t.getTotalSize();
- var is_done = t.isDone() || t.isSeeding();
+ var c,
+ sizeWhenDone = t.getSizeWhenDone(),
+ totalSize = t.getTotalSize(),
+ is_done = t.isDone() || t.isSeeding();
if (is_done) {
if (totalSize == sizeWhenDone) // seed: '698.05 MiB'
{
createRow: function()
{
- var progressbar = TorrentRendererHelper.createProgressbar('compact');
+ var progressbar, deatils, name, root;
+
+ progressbar = TorrentRendererHelper.createProgressbar('compact');
- var details = document.createElement('div');
+ details = document.createElement('div');
details.className = 'torrent_peer_details compact';
- var name = document.createElement('div');
+ name = document.createElement('div');
name.className = 'torrent_name compact';
- var root = document.createElement('li');
+ root = document.createElement('li');
root.appendChild(progressbar.element);
root.appendChild(details);
root.appendChild(name);
if ((c = t.getErrorMessage()))
return c;
if (t.isDownloading()) {
- var have_dn = t.getDownloadSpeed() > 0;
- var have_up = t.getUploadSpeed() > 0;
+ var have_dn = t.getDownloadSpeed() > 0,
+ have_up = t.getUploadSpeed() > 0;
if (!have_up && !have_dn)
return 'Idle';
var s = '';
function TorrentRow(view, controller, torrent, selected)
{
- this.initialize(view, controller, torrent, selected);
+ this.initialize(view, controller, torrent, selected);
}
TorrentRow.prototype =
{
setTorrent: function(controller, t) {
if (this._torrent !== t) {
- var row = this;
- var key = 'dataChanged.torrentRowListener';
+ var row = this,
+ key = 'dataChanged.torrentRowListener';
if (this._torrent)
$(this._torrent).unbind(key);
if ((this._torrent = t))
},
// fields.files is an array of unions of RPC's "files" and "fileStats" objects.
- updateFiles: function(files) {
- var changed = false;
- var myfiles = this.fields.files || [];
- var keys = [ 'length', 'name', 'bytesCompleted', 'wanted', 'priority' ];
- for (var i=0, f; f=files[i]; ++i) {
- var myfile = myfiles[i] || {};
- for (var j=0, key; key=keys[j]; ++j)
+ updateFiles: function(files)
+ {
+ var changed = false,
+ myfiles = this.fields.files || [],
+ keys = [ 'length', 'name', 'bytesCompleted', 'wanted', 'priority' ],
+ i, f, j, key, myfile;
+
+ for (i=0; f=files[i]; ++i) {
+ myfile = myfiles[i] || {};
+ for (j=0; key=keys[j]; ++j)
if(key in f)
changed |= this.setField(myfile,key,f[key]);
myfiles[i] = myfile;
return changed;
},
- collateTrackers: function(trackers) {
- announces = [];
- for (var i=0, t; t=trackers[i]; ++i)
+ collateTrackers: function(trackers)
+ {
+ var i, t, announces = [];
+
+ for (i=0; t=trackers[i]; ++i)
announces.push(t.announce.toLowerCase());
return announces.join('\t');
},
refreshFields: function(data)
{
- var changed = false;
+ var key,
+ changed = false;
- for (var key in data) {
+ for (key in data) {
switch (key) {
case 'files':
case 'fileStats': // merge files and fileStats together
default: return -1;
}
},
- getErrorMessage: function() {
+ getErrorMessage: function() {
var str = this.getErrorString();
switch(this.getError()) {
case Torrent._ErrTrackerWarning:
};
Torrent.compareByAge = function(ta, tb)
{
- var a = ta.getDateAdded();
- var b = tb.getDateAdded();
+ var a = ta.getDateAdded(),
+ b = tb.getDateAdded();
+
return (b - a) || Torrent.compareByQueue(ta, tb);
};
Torrent.compareByState = function(ta, tb)
{
- var a = ta.getStatus();
- var b = tb.getStatus();
+ var a = ta.getStatus(),
+ b = tb.getStatus();
+
return (b - a) || Torrent.compareByQueue(ta, tb);
};
Torrent.compareByActivity = function(ta, tb)
{
- var a = ta.getActivity();
- var b = tb.getActivity();
+ var a = ta.getActivity(),
+ b = tb.getActivity();
+
return (b - a) || Torrent.compareByState(ta, tb);
};
Torrent.compareByRatio = function(ta, tb)
{
- var a = ta.getUploadRatio();
- var b = tb.getUploadRatio();
+ var a = ta.getUploadRatio(),
+ b = tb.getUploadRatio();
+
if (a < b) return 1;
if (a > b) return -1;
return Torrent.compareByState(ta, tb);
};
Torrent.compareByProgress = function(ta, tb)
{
- var a = ta.getPercentDone();
- var b = tb.getPercentDone();
+ var a = ta.getPercentDone(),
+ b = tb.getPercentDone();
+
return (a - b) || Torrent.compareByRatio(ta, tb);
};
if (iPhone) // FIXME: why?
return;
- var list = $('#torrent_container');
- var scrollTop = list.scrollTop();
- var innerHeight = list.innerHeight();
-
- var e = $(row.getElement());
- var offsetTop = e[0].offsetTop;
- var offsetHeight = e.outerHeight();
+ var list = $('#torrent_container'),
+ scrollTop = list.scrollTop(),
+ innerHeight = list.innerHeight(),
+ offsetTop = row.getElement().offsetTop,
+ offsetHeight = $(row.getElement()).outerHeight();
if (offsetTop < scrollTop)
list.scrollTop(offsetTop);
keyDown: function(ev)
{
var up = ev.keyCode === 38; // up key pressed
- var dn = ev.keyCode === 40; // down key pressed
- var shift = ev.keyCode === 16; // shift key pressed
+ dn = ev.keyCode === 40, // down key pressed
+ shift = ev.keyCode === 16; // shift key pressed
if (up || dn)
{
- var rows = this._rows;
-
- var last = this.indexOfLastTorrent();
- var i = last;
+ var rows = this._rows,
+ last = this.indexOfLastTorrent(),
+ i = last,
+ anchor = this._shift_index;
if (i === -1) // no selection yet
i = 0;
i = (i || rows.length) - 1;
var r = rows[i];
- var anchor = this._shift_index;
if (anchor >= 0)
{
// user is extending the selection with the shift + arrow keys...
return p.className!='disabled' && p.parentNode.className!='disabled';
},
- stopAllClicked: function(event) {
- if (this.isButtonEnabled(event)) {
+ stopAllClicked: function(ev) {
+ if (this.isButtonEnabled(ev)) {
this.stopAllTorrents();
this.hideiPhoneAddressbar();
}
},
- stopSelectedClicked: function(event) {
- if (this.isButtonEnabled(event)) {
+ stopSelectedClicked: function(ev) {
+ if (this.isButtonEnabled(ev)) {
this.stopSelectedTorrents();
this.hideiPhoneAddressbar();
}
},
- startAllClicked: function(event) {
- if (this.isButtonEnabled(event)) {
+ startAllClicked: function(ev) {
+ if (this.isButtonEnabled(ev)) {
this.startAllTorrents();
this.hideiPhoneAddressbar();
}
},
- startSelectedClicked: function(event) {
- if (this.isButtonEnabled(event)) {
+ startSelectedClicked: function(ev) {
+ if (this.isButtonEnabled(ev)) {
this.startSelectedTorrents(false);
this.hideiPhoneAddressbar();
}
},
- openTorrentClicked: function(event) {
- if (this.isButtonEnabled(event)) {
+ openTorrentClicked: function(ev) {
+ if (this.isButtonEnabled(ev)) {
$('body').addClass('open_showing');
this.uploadTorrentFile();
this.updateButtonStates();
}
},
- dragenter: function(event) {
- if (event.dataTransfer && event.dataTransfer.types) {
+ dragenter: function(ev) {
+ if (ev.dataTransfer && ev.dataTransfer.types) {
var types = ["text/uri-list", "text/plain"];
for (var i = 0; i < types.length; ++i) {
- if (event.dataTransfer.types.contains(types[i])) {
- // it would be better to actually look at the links here;
- // sadly, (at least with Firefox,) trying would throw.
- event.stopPropagation();
- event.preventDefault();
- event.dropEffect = "copy";
+ // it would be better to look at the links here;
+ // sadly, with Firefox, trying would throw.
+ if (ev.dataTransfer.types.contains(types[i])) {
+ ev.stopPropagation();
+ ev.preventDefault();
+ ev.dropEffect = "copy";
return false;
}
}
}
- else if (event.dataTransfer) {
- event.dataTransfer.dropEffect = "none";
+ else if (ev.dataTransfer) {
+ ev.dataTransfer.dropEffect = "none";
}
return true;
},
if (rate != tr[Prefs._RefreshRate])
tr.setPref (Prefs._RefreshRate, rate);
- var up_bytes = parseInt($('#prefs_form #upload_rate').val(), 10);
- var dn_bytes = parseInt($('#prefs_form #download_rate').val(), 10);
- var turtle_up_bytes = parseInt($('#prefs_form #turtle_upload_rate').val(), 10);
- var turtle_dn_bytes = parseInt($('#prefs_form #turtle_download_rate').val(), 10);
+ var up_bytes = parseInt($('#prefs_form #upload_rate').val(), 10),
+ dn_bytes = parseInt($('#prefs_form #download_rate').val(), 10),
+ turtle_up_bytes = parseInt($('#prefs_form #turtle_upload_rate').val(), 10),
+ turtle_dn_bytes = parseInt($('#prefs_form #turtle_download_rate').val(), 10);
// pass the new prefs upstream to the RPC server
var o = { };
var turtle_up_limit_k = p[RPC._TurtleUpSpeedLimit];
var turtle_dn_limit_k = p[RPC._TurtleDownSpeedLimit];
- if (p.units)
- Transmission.fmt.updateUnits(p.units);
+ if (p.units)
+ Transmission.fmt.updateUnits(p.units);
$('div.download_location input').val( p[RPC._DownloadDir]);
$('div.port input').val( p[RPC._PeerPort]);
{
// Display the upload dialog
if (! confirmed) {
- $('input#torrent_upload_file').attr('value', '');
- $('input#torrent_upload_url').attr('value', '');
- $('input#torrent_auto_start').attr('checked', $('#prefs_form #auto_start')[0].checked);
- $('#upload_container').show();
- $('#torrent_upload_url').focus();
+ $('input#torrent_upload_file').attr('value', '');
+ $('input#torrent_upload_url').attr('value', '');
+ $('input#torrent_auto_start').attr('checked', $('#prefs_form #auto_start')[0].checked);
+ $('#upload_container').show();
+ $('#torrent_upload_url').focus();
if (!iPhone && Safari3) {
setTimeout("$('div#upload_container div.dialog_window').css('top', '0px');",10);
}
torrent_count = Object.keys(this._torrents).length,
visible_count = this._rows.length;
+ text = 'Show <span class="filter-selection">';
if (state_all && tracker_all)
- text = 'Show <span class="filter-selection">All</span>';
+ text += 'All';
else if (state_all)
- text = 'Show <span class="filter-selection">' + tracker_string + '</span>';
+ text += tracker_string;
else if (tracker_all)
- text = 'Show <span class="filter-selection">' + state_string + '</span>';
+ text += state_string;
else
- text = 'Show <span class="filter-selection">' + state_string + '</span> at <span class="filter-selection">' + tracker_string + '</span>';
+ text += state_string + '</span> at <span class="filter-selection">' + tracker_string;
+ text += '</span> — ';
if (torrent_count === visible_count)
- text += ' — ' + torrent_count + ' Transfers';
+ text += torrent_count + ' Transfers';
else
- text += ' — ' + visible_count + ' of ' + torrent_count;
- $('#filter-button')[0].innerHTML = text;
+ text += visible_count + ' of ' + torrent_count;
+ $('#filter-button').html(text);
},
refilterSoon: function()
for (id in this.dirtyTorrents) {
t = this._torrents[id];
if (t.test(filter_mode, filter_text, filter_tracker)) {
- var is_selected = t.getId() in sel;
- row = new TorrentRow(renderer, this, t, is_selected);
+ var s = t.getId() in sel;
+ row = new TorrentRow(renderer, this, t, s);
row.getElement().row = row;
dirty_rows.push(row);
}
else if (di==dmax)
push_clean = true;
else {
- var c = Torrent.compareTorrents(clean_rows[ci].getTorrent(),
- dirty_rows[di].getTorrent(),
- sort_mode, sort_direction);
+ var c = Torrent.compareTorrents(
+ clean_rows[ci].getTorrent(),
+ dirty_rows[di].getTorrent(),
+ sort_mode, sort_direction);
push_clean = (c < 0);
}
this._rows = rows;
this.dirtyTorrents = { };
- // jquery's even/odd starts with 1 rather than 0, so invert the logic here
+ // jquery's even/odd starts with 1 not 0, so invert its logic
e = $.map(rows.slice(0), function(r){return r.getElement();});
$(e).filter(":odd").addClass('even');
$(e).filter(":even").removeClass('even');
},
setCompactMode: function(is_compact)
{
- var key = Prefs._CompactDisplayState;
- var was_compact = this[key];
+ var key = Prefs._CompactDisplayState,
+ was_compact = this[key];
+
if (was_compact !== is_compact) {
this.setPref(key, is_compact);
this.onCompactModeChanged();
},
addTorrentByUrl: function(url, options) {
var remote = this;
- if (url.match(/^[0-9a-f]{40}$/i)) {
- url = 'magnet:?xt=urn:btih:'+url;
- }
+ if (url.match(/^[0-9a-f]{40}$/i)) {
+ url = 'magnet:?xt=urn:btih:'+url;
+ }
var o = {
method: 'torrent-add',
arguments: {