http://www.perlmonks.org?node_id=268740

Our site allows to message the users via chatterbox, msgbox nodelet and some users' homenode. Integration of /msg with the nodes would be helpful, especially with the root nodes. So, you can message the author of the root node and it will auto-fill the node id/title as well as author name by clicking a link. Placement of this link should be next to the author name in the rootnode when displayed the node on with the subsequent threads if any. (Let us make it mandatory to 'view' the node).

artist

Replies are listed 'Best First'.
Re: /msg to [author] of the [node]
by chromatic (Archbishop) on Jun 25, 2003 at 03:39 UTC

    This could be done with a bookmarklet. You just need to fetch the node_id of the parent node (easy) and the name of the author (easy, just fetch the text of the a node within the span node with a class of attribution). There's no server code necessary.

      I mean, when you clink on the link, it will open a new '/msg node' with pre-filled details. In any case I would love to see the bookmarklet that you described.

      Debating my own idea, I am not sure that dual interface to the user about the node (answer and the message) would serve the purpose. Intention was to make user specific comments about the node or ask to clarify the user's idea.

      artist

        This will get you a good portion of the way there.
        javascript:function htmlEscape(s) { s=s.replace(/&/g,'&amp; s=s.replace(/>/g,'&gt;'); s=s.replace(/</g,'&lt;'); return s; } function linkEscape(s) { s=s.replace(/&/g,'&amp;'); s=s.replace(/"/,'&quot;'); return s } h = '<a href="' + linkEscape(location.href) + '">' + htmlEscape(document.title) + '</a>'; with(window.open().document) { write(h+'<form name=f> <textarea name=a rows=5 cols=80 wrap=hard>' +htmlEscape(h)+'</textarea></form>'); close(); f.a.select(); } void 0;

        I leave it to you to grok the rest of the data out of the page in question, but here's a clue there as well:

        javascript:(function() { var a = { }, b =[], i, e, c, k, d, s = "<table border=1> <thead> <tr><th>#</th> <th>Tag</th> <th>className</th> </tr> </thead>"; for (i = 0; e = document.getElementsByTagName("*")[i]; ++i) if (c = e.className) { k = e.tagName + "." + c; a[k] = a[k] ? a[k] + 1 : 1; } for (k in a) b.push([k, a[k]]); b.sort(); for (i in b) s += "<tr><td>" + b[i][1] + "</td><td>" + b[i][0].split(".").join("</td><td>") + "</td></tr>"; s += "</table>"; d = open().document; d.write(s); d.close();} )

        Be aware of the maximum length of bookmarklets in your browser of course, and make sure to unwrap the code above onto single lines in your bookmarklet entry field. I have purposely wrapped these here to eliminate the possibility of rogue '+' signs appearing in there from PerlMonks wrapping code itself.

        Good luck..

(/msg [node_id]) Re: /msg to [author] of the [node]
by particle (Vicar) on Jun 25, 2003 at 12:58 UTC

    i can see using something like /msg [node_id] to tell someone they've mispelled something, or have a code bug. i'd find it helpful because sometimes the chatterbox nodelet input form and the node author cannot be viewed without scrolling.

    i thought i could work around this my changing my "custom node title", (mine is currently defined in User Settings as %N | %T | %S, which gives me node id, title, and section.) unfortunately, node author isn't available, so i can't tell who authored the root node from my titlebar. it does, however, give me the node id, which i could use as stated above.

    perhaps this is a subtle departure from your idea, but that's the direction in which you got me thinking.

    ~Particle *accelerates*

Re: /msg to [author] of the [node]
by jdporter (Paladin) on Mar 15, 2007 at 18:37 UTC