Re: checklink: ideas for next version

On Fri, Dec 19, 2008 at 9:33 AM, Brett Bieber <brett.bieber@gmail.com>wrote:

>
> Responding to previous email, some api thoughts:
>
> How to do that:
>>
>> * code a js function to create an HTML id based on two URIs (the URI of
>> the document checked and the URI of the link checked). That will be useful
>> to identify table rows in the DOM
>>
>
> Sounds like a simple hash function. There are several md5 solutions out
> there in js.. the only problem is that the ID needs to be prefixed with some
> letters to ensure a valid id attribute. Something like... ?
> getLinkID(docuri, linkuri)
> {
>     return 'l'+md5(docuri+linkuri);
> }
>
>
>> * add a js function to add a row to the DOM with a given ID
>>
>
> appendRow(table, rowid)
>
> * add a js function to display the link in a given table cell. This
>> function will be called via a <script> output while a document is being
>> parsed and links-to-be-checked are discovered
>>
>>
> * add a js function to display the result in a table cell. This function
>> will be called via a <script> output in real time as links get checked. The
>> function will also apply styles on the fly to the table row or cell
>>
>
> displayResult(message, cell)
> displayLink(link, cell)
>
> The last two are basically the same function?
> displayMessage(message, cellid);
>
> I haven't had time to code anything working, but I did manage to get a
> checkout of the perl lib and I'll get it running from cvs here shortly so I
> can actually get something done.
>

About 2 seconds after I sent that message I realized maybe I should be
thinking about this at a lot higher level... and that I should have examined
Ville's js before responding.  :-)

Now I'm thinking something like:

w3_linkcheck.addLink(link)
w3_linkcheck.updateLinkStatus(link, status, message)

Inside the methods we can handle the details of translating the link to an
id using the same method Ville uses (md5 and prepend with L or S for link or
status), inside we could set the appropriate status class to the cell in the
corresponding row: class="status_200" class="status_301".. have the perl
script output the messages directly in the js, or figure out a more complex
way of handling the messages so the size isn't inflated too big.

On the right path now?

-- 
Brett Bieber

Received on Friday, 19 December 2008 15:54:12 UTC