Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

This hack will update the timestamp for Newest Nodes with the node creation time of the node from where it was submitted, leaving you with a node list presentation since the updated timestamp.

The Motivation

Although I am an everyday visitor, I cannot manage to keep up with the newest nodes during the week, because my job keeps me rather busy more often than not and so I have to catch up on evenings and on weekends until I can click on 'I've checked all of these' on Newest Nodes. Switching between my nodes list at work and the list at home without 'checking all of these' doesn't present me a clear overview of what I've already read.

The Hack

This is a two step process.

Step 1:
By clicking the button 'Get node creation time', the node creation (local)time (based on your settings in Timezone Settings) will be converted to unix time - in full minutes only, since there is no more information in the node itself. This button will disappear, the node creation time and a textbox with the converted unix time in it will be presented and below that a submit button.

Step 2:
By clicking the button 'Set Timestamp' then, the database entry for 'viewedNewNodes' on PM will be updated with the value which was in the textbox above, and you will be redirected to the updated Newest Nodes.

Without changing the unix time, the node where the submit action took place, will then be one of the oldest node id's to be displayed in Newest Nodes, depending on the node id, when there are more than one nodes from the same minute.

However, if you're applying this on a node where there is no such table with the id "titlebar-bottom" (i.e. Newest Nodes), or when the calculated unix time is not exactly 10 digits, the button 'Get node creation time' will (safely) not do anything. Bear in mind, that you are responsible which value you will submit if you are changing the textbox entry or if you are submitting the form on a really old node. Also watch out for nodes from other PM sections with lower node id's before updating, so that you will not miss these.

The Code

Add the javascript and the HTML part to your Free Nodelet Settings.
Insert the javascript without script tags in the javascript section if you already have such a section in your Free Nodelet!

The javascript part:
<script language="javascript"><!-- // Get Unix Time from node creation time and prepare form // to set last to display node time for 'Newest Nodes' function fn_getunixtime() { var table = document.getElementById("titlebar-bottom"); var span = table.getElementsByTagName("span"); var ctime = span[0]; var re = /^on\s+(\w+\s+\d{1,2},\s*\d{4}\s+)at\s+([\d:]+)/; re.exec(ctime); var timestr = RegExp.$1 + RegExp.$2; var unixtime = new Date(timestr) / 1000; var chkfmt = /^\d{10}$/; var ok = chkfmt.test(unixtime); if (ok == false) return false; var TStext = document.getElementById("fn_SetTimeText"); var TSform = document.all.fn_ViewedNodesTime; TStext.firstChild.nodeValue = timestr; TSform.pageloadtime.value = unixtime; TSform.viewedNewNodes.value = "Set Timestamp"; = "none"; = ""; } //--></script>

The HTML part:
<hr> <center> <div id="fn_SetTimeText"> Set Timestamp for 'Newest Nodes' </div> <form name="fn_PrepareUnixTime"> <div id="fn_dsp_put"> <input type="button" name="prepare" value="Get node creation time" onClick=fn_getunixtime()> </div> </form> <form name="fn_ViewedNodesTime" method="post" action="?" enctype="application/x-www-form-urlencoded"> <input name="node_id" value="3628" type="hidden"> <div id="fn_dsp_vnt" style="display:none"> <input name="pageloadtime" size="12" maxlength="10" type="text"><br> <input name="viewedNewNodes" type="submit"> </div> </form> </center> <hr>

For general information about the Free Nodelet you should read Free Nodelet freed.

Successfully tested on:
WindowsXP: Firefox 1.07, Opera 8.01, IE 6.0
Linux (FC4): Firefox 1.06, Mozilla 1.7.8, Epiphany 1.6.1

Didn't get it to work with Konqueror 3.4.

In reply to Free Nodelet Hack: Set Timestamp for Newest Nodes by Dietz

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others exploiting the Monastery: (4)
    As of 2020-11-26 07:49 GMT
    Find Nodes?
      Voting Booth?

      No recent polls found