in reply to 'Nodes you wrote' root revisited

The scripts posted there by ikegami and tye seem redundant by now. I suspect the root node link on every sub-node came after that(!?), maybe inspired by that node.

Read ikegami's reply again. It is titled Free Nodelet Hack: Add parent & root links to nodes in 'Nodes You Wrote'. There. Nodes You Wrote. Which means it is for Super Search.

update: tye's code completed with XPath expressions to rewrite links in Perl Monks User Search:

<script type="text/javaScript"> // <!-- function xq (query) { return document.evaluate(query,document,null,XPathResult.ORDERED_N +ODE_SNAPSHOT_TYPE,null); } function xl (query) { var r = xq(query); var a = new Array; for ( var i=0 ; i < r.snapshotLength; i++ ) a.push(r.snapshotItem( +i)); return a; } if (xl("//body[@id='id-6364']")[0]) { // only for super search var list = xl("/html/body[@id='id-6364']/center/table/tbody/tr/td[ +1]/table[@id='writeups']/tbody/tr/td[2]/a"); for (var i in list) { var link = list[i]; var container = document.createElement('span'); container.innerHTML = ( '' + '<a href="' + link.href + ';_redir=root">r</a>' + ' ' + '<a href="' + link.href + ';_redir=parent">p</a>' + '&nbsp;&nbsp;' ); link.parentNode.insertBefore(container, link); } } var params= window.location.search; if( 0 <= params.indexOf( ";_redir=root" ) ) { window.location.search= "?node_id=`root_id`"; } else if( 0 <= params.indexOf( ";_redir=parent" ) ) { window.location.search= "?node_id=`parent_id`"; } else if( 0 <= params.indexOf( ";_redir=author" ) ) { window.location.search= "?node_id=`author_id`"; } --></script>

That still loads your node first, but redirects it to its parent or root node, after loading, which saves you a click.

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Replies are listed 'Best First'.
Re^2: 'Nodes you wrote' root revisited
by jethro (Monsignor) on Aug 04, 2008 at 21:44 UTC
    Sadly no. Posted your code into my nodelet, can see the free nodelet (so it's activated), but neither in super search nor 'nodes you wrote' do I get redirected after klicking on the node link.

    Is it me or the script?

    I tried tye's code by the way and didn't put enough attention to the sentence '... is left as an exercise'. It is only now that I grasp what that sentence was about.

    UPDATE: The script is working now. It probably was me, not noticing the links.