• So yesterday we discussed how to prefix insertions to posts with the time the insertions were made, using CSS. We discovered this could be done by editing the wp-layout.css file to use the :before pseudo-element with the ins tag:

    ins:before {
    content: attr(datetime);
    }

    The output of an update to a post such as “Hi Mom!” when between ins tags would then look like this:
    2004-7-26T10:47:47-4:00Hi Mom!
    This is not the most easily readable format. So today I figured out how to change it. You need to edit the quicktags.js file, a JavaScript file. I made these edits:
    Line 19:

    • Original

      var datetime = now.getFullYear() + '-' + now.getMonth() + '-' + now.getDate() + 'T' +
      now.getHours() + ':' + now.getMinutes() + ':' +
      now.getSeconds() + '-' + (now.getTimezoneOffset()/60)
      + ':' + '00';
    • Modified-

      var datetime = now.getFullYear() + '-' + now.getMonth() + '-' + now.getDate() + ' at ' +
      now.getHours() + ':' + now.getMinutes() + ':' +
      now.getSeconds() + '-' + (now.getTimezoneOffset()/60)
      + ':' + '00';

    Line 68:

    • Original-

      ,'<ins datetime="' + datetime + '">'
    • Modified-

      ,'<ins datetime="Edit, ' + datetime + '--">'

    If I type This is an insertion between ins tags, the output I now get (in Mozilla/Firefox only, not IE) is this:
    Edit, 2004-7-26 at 10:47:47-4:00--This is an insertion
    Neat, huh?

Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘I’m proud of this quicktag trick!’ is closed to new replies.