summaryrefslogtreecommitdiffstats
path: root/static/functions/browse.js
diff options
context:
space:
mode:
authorGit <git@what.cd>2015-11-15 08:00:28 +0000
committerGit <git@what.cd>2015-11-15 08:00:28 +0000
commit8bd65bfe066ec671553c38e88c48713a73b85192 (patch)
tree688e1d43704f7594f67f160b06c448aca7aa16b5 /static/functions/browse.js
parent411a01201586b60bbca954cb8f661a2ce9cd6ef9 (diff)
downloadGazelle-8bd65bfe066ec671553c38e88c48713a73b85192.zip
Gazelle-8bd65bfe066ec671553c38e88c48713a73b85192.tar.gz
Gazelle-8bd65bfe066ec671553c38e88c48713a73b85192.tar.bz2
Empty commit
Diffstat (limited to 'static/functions/browse.js')
-rw-r--r--static/functions/browse.js32
1 files changed, 23 insertions, 9 deletions
diff --git a/static/functions/browse.js b/static/functions/browse.js
index 32c2728..addf104 100644
--- a/static/functions/browse.js
+++ b/static/functions/browse.js
@@ -86,13 +86,14 @@ function add_tag(tag) {
}
function toggle_group(groupid, link, event) {
+ var showRow = true;
var clickedRow = link;
while (clickedRow.nodeName != 'TR') {
clickedRow = clickedRow.parentNode;
}
var group_rows = clickedRow.parentNode.children;
var showing = $(clickedRow).nextElementSibling().has_class('hidden');
- var allGroups = event.ctrlKey;
+ var allGroups = (event.ctrlKey || event.metaKey); // detect ctrl or cmd
// for dealing with Mac OS X
// http://stackoverflow.com/a/3922353
@@ -101,7 +102,8 @@ function toggle_group(groupid, link, event) {
|| event.keyCode == 93 // WebKit (right apple)
|| event.keyCode == 224 // Firefox
|| event.keyCode == 17 // Opera
- ) ? 91 : null;
+ ) ? true : null;
+
for (var i = 0; i < group_rows.length; i++) {
var row = $(group_rows[i]);
@@ -111,6 +113,9 @@ function toggle_group(groupid, link, event) {
if (row.has_class('colhead')) {
continue;
}
+ if (row.has_class('torrent')) {
+ continue; // Prevents non-grouped torrents from disappearing when collapsing all groups
+ }
var relevantRow = row.has_class('group') ? $(group_rows[i + 1]) : row;
if (allGroups || allGroupsMac || relevantRow.has_class('groupid_' + groupid)) {
row = $(group_rows[i]); // idk why we need this :S
@@ -122,8 +127,8 @@ function toggle_group(groupid, link, event) {
section = 'on this page.';
}
var tooltip = showing
- ? 'Collapse this group. Hold "Ctrl" while clicking to collapse all groups '+section
- : 'Expand this group. Hold "Ctrl" while clicking to expand all groups '+section;
+ ? 'Collapse this group. Hold [Command] <em>(Mac)</em> or [Ctrl] <em>(PC)</em> while clicking to collapse all groups '+section
+ : 'Expand this group. Hold [Command] <em>(Mac)</em> or [Ctrl] <em>(PC)</em> while clicking to expand all groups '+section;
$('a.show_torrents_link', row).updateTooltip(tooltip);
$('a.show_torrents_link', row).raw().parentNode.className = (showing) ? 'hide_torrents' : 'show_torrents';
} else {
@@ -160,19 +165,28 @@ function toggle_edition(groupid, editionid, lnk, event) {
}
//var showing = has_class(nextElementSibling(clickedRow), 'hidden');
var showing = $(clickedRow).nextElementSibling().has_class('hidden');
- var allEditions = event.ctrlKey;
+ var allEditions = (event.ctrlKey || event.metaKey); // detect ctrl and cmd
+ // for dealing with Mac OS X
+ // http://stackoverflow.com/a/3922353
+ var allEditionsMac = (
+ event.keyCode == 91 // WebKit (left apple)
+ || event.keyCode == 93 // WebKit (right apple)
+ || event.keyCode == 224 // Firefox
+ || event.keyCode == 17 // Opera
+ ) ? true : null;
+
var group_rows = $('tr.groupid_' + groupid);
for (var i = 0; i < group_rows.results(); i++) {
var row = $(group_rows.raw(i));
if (row.has_class('edition') && (allEditions || row.raw(0) == clickedRow)) {
var tooltip = showing
- ? 'Collapse this edition. Hold "Ctrl" while clicking to collapse all editions in this torrent group.'
- : 'Expand this edition. Hold "Ctrl" while clicking to expand all editions in this torrent group.';
+ ? 'Collapse this edition. Hold [Command] <em>(Mac)</em> or [Ctrl] <em>(PC)</em> while clicking to collapse all editions in this torrent group.'
+ : 'Expand this edition. Hold [Command] <em>(Mac)</em> or [Ctrl] <em>(PC)</em> while clicking to expand all editions in this torrent group.';
$('a', row).raw().innerHTML = (showing) ? '&minus;' : '+';
$('a', row).updateTooltip(tooltip);
continue;
}
- if (allEditions || row.has_class('edition_' + editionid)) {
+ if (allEditions || allEditionsMac || row.has_class('edition_' + editionid)) {
if (showing && !row.has_class('torrentdetails')) {
row.gshow();
} else {
@@ -282,4 +296,4 @@ function ToggleEditionRows() {
$('#edition_title').gtoggle();
$('#edition_label').gtoggle();
$('#edition_catalogue').gtoggle();
-}
+} \ No newline at end of file