Feature Select all from this group [DENIED]
Moderator: AniDB
Feature Select all from this group [DENIED]
Hi
Under show anime when have exspanded all entrys, I would like a feature(button?) that could selecting all entrys from a specific group.
Cgfluffy
Jacob
Under show anime when have exspanded all entrys, I would like a feature(button?) that could selecting all entrys from a specific group.
Cgfluffy
Jacob
-
- Posts: 10
- Joined: Fri Dec 31, 2004 1:39 am
May I ask why has it been denied so many times? It would be _really_ useful!
It's just a few simple lines of JS together with small changes in the listing-output.
I'm currently trying to implement it for the Firefox-Greasemonkey-Extension. It already seems to work, but it's also a dirty hack that is only working in Firefox. I have to parse the HTML-source to get the group-IDs and find corresponding the checkboxes. But the actual JS-code doing the work is just 5 lines! Selecting 30 files with a single click is convenient!
It's just a few simple lines of JS together with small changes in the listing-output.
I'm currently trying to implement it for the Firefox-Greasemonkey-Extension. It already seems to work, but it's also a dirty hack that is only working in Firefox. I have to parse the HTML-source to get the group-IDs and find corresponding the checkboxes. But the actual JS-code doing the work is just 5 lines! Selecting 30 files with a single click is convenient!
-
- Posts: 10
- Joined: Fri Dec 31, 2004 1:39 am
That is no reason to not implement such a feature. I have to check them anyway. And people, who don't, won't do it, just because they have to click every file separatly.
There could be some help in finding these files. Selecting one file of a group out of 20 for an episode and this 20, 30 or even more times depending on the length of a series is tedious (also due to that fact that the files are not sorted by group and the column, which the group is in, is also far from the checkbox/link you have to click). If all the corresponding checkboxes would be selected by the click of only one checkbox, it would help alot.
Btw, there are other ways, too: instead of selecting all the checkboxes you could for example mark the lines with another color via css and js.
It's all just to further improve the useability of the pages for everyone (for my part, I have already done it with the extension mentioned earlier, that's quite buggy, but working, and does exactly the thing described above)
There could be some help in finding these files. Selecting one file of a group out of 20 for an episode and this 20, 30 or even more times depending on the length of a series is tedious (also due to that fact that the files are not sorted by group and the column, which the group is in, is also far from the checkbox/link you have to click). If all the corresponding checkboxes would be selected by the click of only one checkbox, it would help alot.
Btw, there are other ways, too: instead of selecting all the checkboxes you could for example mark the lines with another color via css and js.
It's all just to further improve the useability of the pages for everyone (for my part, I have already done it with the extension mentioned earlier, that's quite buggy, but working, and does exactly the thing described above)
-
- Posts: 10
- Joined: Fri Dec 31, 2004 1:39 am
-
- Posts: 10
- Joined: Fri Dec 31, 2004 1:39 am
But it is a frequent request, so it seems to be wanted.
So for everyone using Firefox, try this:
first install the greasemonkey extension http://greasemonkey.mozdev.org/
Then copy this code into a file called something.user.js (the .user.js is important!)
Open the file in Firefox and select "Install userscript" from the tools menu.
Now when you view the listing of an anime there should be an extra column with checkboxes in the group listing. Choose "expand all entries" and then click on one of the checkboxes. Voila, all checkboxes of this group should be selected.
Please still check that the files selected are the ones you have/want to add!!
btw.: no garantee of any kind (functioning, damaging, ... you know these)
(tested on Mozilla 1.7.10 with an homebrew cvs-build of greasemonkey)
So for everyone using Firefox, try this:
first install the greasemonkey extension http://greasemonkey.mozdev.org/
Then copy this code into a file called something.user.js (the .user.js is important!)
Code: Select all
// ==UserScript==
// @name select_all_of_a_group
// @namespace lupin_sanseis_scripts
// @description selects all files of a release group
// @include http://anidb.info/*
// ==/UserScript==
(function() {
// 2D-array containing all the checkbox names corresponding to a group
checkbox_names = new Array();
function initialize() {
var gids = new Array();
// walk through all tbodies (they are created by the browser DOM internally, they don't have to be in source)
for (var i=0; i < document.getElementsByTagName("tbody").length; i++) {
var tbody = document.getElementsByTagName("tbody")[i];
// the group-listing-table contains no inner table, so it's the wrong tbody if a table is found inside
match = tbody.innerHTML.match(/table/i);
if (match) { continue; }
// search for "Group Info"
match = tbody.innerHTML.match(/Group Info:/i);
if (match) {
// found the right table
var regexp = /gid=(\d+)"/;
var tr = tbody.firstChild;
// walk through all rows of the table
while (tr.nextSibling) {
if (tr.nodeType == 1
&& tr.nodeName == 'TR')
{
// create an adittional column to add to the end of the row
var td = document.createElement("td");
if (match = regexp.exec(tr.innerHTML)) {
// found a group-id, so create the subarray for the checkboxnames and the checkbox
var gid = match[1];
gids.push(gid);
checkbox_names[gid] = new Array();
var input = document.createElement('input');
input.setAttribute('type', 'checkbox');
input.setAttribute('id', 'toggle_gid_'+gid);
input.setAttribute('onclick', 'toggle('+gid+')');
td.appendChild(input);
} else
if (tr.innerHTML.match(/Group Info:/i)) {
td.setAttribute('bgcolor', '#b0b0b0');
td.appendChild(document.createTextNode('toggle all'));
}
tr.appendChild(td);
}
tr = tr.nextSibling;
}
}
}
// if checkbox_names still contains no elements, it's no animelisting --> exit function
if (checkbox_names.length == 0) { return; }
// walk through all checkboxes in the page
for (var i=0; i < document.getElementsByTagName("input").length; i++) {
var input = document.getElementsByTagName("input")[i];
if (input.type == 'checkbox'
&& input.name.search(/^madd\.f\.\d+$/) != -1) {
var regexp = /gid=(\d+)/;
// if the checkboxname is like madd.f.xyz, try to find the gid in the same table-row
// and add the checkboxname to the corresponding array
var tr = input.parentNode.parentNode;
if (match = regexp.exec(tr.innerHTML)) {
var gid = match[1];
if (checkbox_names[gid]) {
checkbox_names[gid].push(input.name);
}
}
}
}
// add a title attribute to the created checkboxes
for (var i=0; i < gids.length; i++) {
document.getElementById('toggle_gid_'+gids[i]).setAttribute('title', 'Toggle all files of this anime-group ('+checkbox_names[gids[i]].length+' files)');
document.getElementById('toggle_gid_'+gids[i]).parentNode.appendChild(document.createTextNode('('+checkbox_names[gids[i]].length+')'));
}
// expand the grouplist too when expanding all file-entries (change href of plus icon)
for (var i=0; i < document.getElementsByTagName("a").length; i++) {
var a = document.getElementsByTagName("a")[i];
if (a.href.match(/expandall/)
&& a.innerHTML.match(/all entries/)) {
a.href += '&showallag=1';
break;
}
}
// finally add the function for the checkbox onclick-handler to the document
// has to be done this way, because of scoping of function names
var script = document.createElement('script');
script.type = 'text/javascript';
script.appendChild(document.createTextNode("\
function toggle(_gid) {\
for (var i=0; i < checkbox_names[_gid].length; i++) {\
document.getElementsByName(checkbox_names[_gid][i])[0].checked = document.getElementById('toggle_gid_'+_gid).checked;\
}\
if (document.getElementById('toggle_gid_'+_gid).checked) {\
alert('Selected ' + checkbox_names[_gid].length + ' files. Please check for correctness!');\
} else {\
alert('Removed all checkmarks for this group!');\
}\
}"));
document.getElementsByTagName("head")[0].appendChild(script);
}
window.addEventListener("load", initialize(), false);
})();
Now when you view the listing of an anime there should be an extra column with checkboxes in the group listing. Choose "expand all entries" and then click on one of the checkboxes. Voila, all checkboxes of this group should be selected.
Please still check that the files selected are the ones you have/want to add!!
btw.: no garantee of any kind (functioning, damaging, ... you know these)
(tested on Mozilla 1.7.10 with an homebrew cvs-build of greasemonkey)
Last edited by Lupin III. on Fri Aug 05, 2005 6:23 pm, edited 1 time in total.
Works perfectly, thank you! Though it would be much easier if you uploaded the script somewhere. I'll put it on my ISP freespace temporarily.
So Quicklink/quickguide for the lazy:
Just install Greasemonkey, click that link and do Tools->Install User Script
http://www3.sympatico.ca/techniko/anidb.user.js
(updated with expand all/show all addition)
-TechNiko
So Quicklink/quickguide for the lazy:
Just install Greasemonkey, click that link and do Tools->Install User Script
http://www3.sympatico.ca/techniko/anidb.user.js
(updated with expand all/show all addition)
-TechNiko
Last edited by TechNiko on Fri Aug 05, 2005 6:42 pm, edited 2 times in total.
-
- Posts: 10
- Joined: Fri Dec 31, 2004 1:39 am
I wouldn't call it a bug, it's something I can't change (or maybe I could with some additional JS). There isn't a link for it, but that doesn't mean it's possible
Just expand all files with the +-icon and then add "&showallag=1" to the url in the adressbar. Or click "show all" in the groups table and add "&expandall=1".
You now should have both lists fully expanded!
Thanks for hosting the file (even if it's temporarily). I don't have a space to upload to.
[edit]
btw. which browser/greasemonkey-version are you using?
Just expand all files with the +-icon and then add "&showallag=1" to the url in the adressbar. Or click "show all" in the groups table and add "&expandall=1".
You now should have both lists fully expanded!
Thanks for hosting the file (even if it's temporarily). I don't have a space to upload to.
[edit]
btw. which browser/greasemonkey-version are you using?
-
- Posts: 10
- Joined: Fri Dec 31, 2004 1:39 am