In fact... let me propose a slight change to the pseudo-JS I wrote to 
make the implementation cleaner.

Recall, this is what the <div> tag for one task looks like:

 <div id='component=writer__difficulty=medium__skill=C'>


 1. For each category write a function:

   INPUT:  A string with the above formatting.
   OUTPUT: A string with the right side of the = sign
           or "" if there is no match.

   function task_component (string str) { 
       //  ...
   }
   function task_difficulty (string task) { 
       //  ...
   }
   ...

 2. Write a function that turns the current selection into a string
    formatted as above:

    function selected_task {
        //  ...
    }

    Purpose being, you can use the functions from (1) for the user's
    selection as well.

 3. Write a loop that reads through the HTML and returns an array of
    tasks (strings formatted as above).

    function available_tasks {
        // ...
    }

 4. Write comparison functions. One for each category (component, 
    difficulty, etc). The "any" keyword means that it can match 
    "anything".
 
    function tasks_match_difficulty (string task1, string task2) {
     
        if (task_difficulty(task1) == "any") return true;
        if (task_difficulty(task2) == "any") return true;
        if (task_difficulty(task1) == (task_difficulty(task2) )
            return true;
     
        // If none of the above match, return false.
        return false;
    }

 4. Whenever the selection changes, run through a loop:

    //
    // Daniel doesn't remember how to step through an array in
    // JS, so he'll just use Bash-ish syntax.
    // 
    for this_task in ( available_tasks() ) {

       if (  tasks_match_component(  this_task, selected_task() )
          && tasks_match_difficulty( this_task, selected_task() )
          && tasks_match_skill (     this_task, selected_task() )
          ... )
       {
          make_visible(this_task);
       }
       else
       {
          make_invisible(this_task);
       }
    }


Just a thought.


Cheers,
-- 
Daniel Carrera          | Rigorous reasoning from inapplicable
Join OOoAuthors today!  | assumptions yields the world's most
http://oooauthors.org   | durable nonsense.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to