[CGI] Checkbox modifying javascript functions [DONE/DENIED]

old granted and denied feature requests

Moderator: AniDB

Locked
PetriW
AniDB Staff
Posts: 1522
Joined: Sat May 24, 2003 2:34 pm

[CGI] Checkbox modifying javascript functions [DONE/DENIED]

Post by PetriW »

As discussed on IRC I would like to request a feature like on sharereactor where you can mark the checkboxes for the files in the expanded view of an anime you want to download then with with a simple click post the checkboxes chosen to a new page where you're presented with an "add to download" option.

Since it was requested here's a javascript for the select all function, unselect and toggle are basically just copy paste anyway. It should work fine in all 4+ versions of netscape and ie plus other browsers.

Code: Select all

<script>
  var files = new Array(1234, 2346, 623, 634, 13466, 78, 7890, 10978, 3465, 4545, 456745);
  function myGetElement(name) {
    if (document.getElementById){
      // Standards
      return document.getElementById(name);
    } else if (document.layers) {
      // NS 4
      return document.layers[name];
    } else if (document.all) {
      // IE 4
      return document.all[name];
    } else {
      alert('baka baka');
    }
  }
  function selectAll() {
    for (var i = 0; i < files.length; i++) {
      myGetElement('file.a.' + files[i]).checked = true;
    }
  }
</script>
<input type="checkbox" id="file.a.1234" />
...
<input type="button" onclick="javascript:selectAll();" value="Select All" />
Note, IE will accept filling out only the name field while netscape requires that the id field is filled for the checkboxes... Select functions might be pretty neat for the mylist too. :)
wahaha
AniDB Staff
Posts: 1497
Joined: Sun Nov 17, 2002 3:33 pm

Post by wahaha »

Well, at least "select all" will most likely not make it in - look for some thread that includes "checkbox" listed in the denied-section of the web-interface request-overview ;)

I must admit that I came to like the current way - one file is easy as always, for some more files, I use "expand all", for many files (or an entire series), I use the export ed2k-links-function. :)
PetriW
AniDB Staff
Posts: 1522
Joined: Sat May 24, 2003 2:34 pm

Post by PetriW »

When I talked with exp about it on IRC it seemed more like the javascript and extra page size part was what he wanted to avoid than the feature itself, which is understandable. ;)
This would require about 2k on a 100 episode list with 5 digit file ids btw.
wahaha
AniDB Staff
Posts: 1497
Joined: Sun Nov 17, 2002 3:33 pm

Post by wahaha »

Ha! Random excuses... :P

All the checkboxes already have, well, no "id", but they have "name"s. getElementsByName() should be as compatible as getElementById(), so the whole issue would be reduced to 30 bytes for the <script src=...>-line* :roll:

* with a little java-script-tricking to dynamically get all the checkbox-names - otherwise a checkbox-name-array could be predefined by the perl-script, that would mean ~ 520 bytes for 100 eps.
The "Select all"-link should also be dynamically added to only show up with browsers that are capable of a high enough javascript-level, so you can add another 30 bytes for this second script... ^^
PetriW
AniDB Staff
Posts: 1522
Joined: Sat May 24, 2003 2:34 pm

Post by PetriW »

Using the name to access objects is iffy territory in IE4 and NS4 for me, thus why I access by ID. getElementByName is a 5+ feature. And while dynamically detecting browsers and changing content based on that is possible it's better to just pop up an alert if the browser you're using is incompatible. EXP specifically stated it should work in IE and NS 4+ though.
exp
Site Admin
Posts: 2438
Joined: Tue Oct 01, 2002 9:42 pm
Location: Nowhere

Post by exp »

the adding of multiple ed2k links to an ed2k client via java script has now been implemented.
I do not plan to include a select all java script checkbox on the anime page though. We require ppl to click once per file for a reason.

BYe!
EXP
Locked