ViewTemplate:

<div class='toolbar' macro='toolbar
[[ToolbarCommands::ViewToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='subtitle'><span macro='view modifier link'></span>, <span
macro='view modified date'></span> (<span macro='message
views.wikified.createdPrompt'></span> <span macro='view created
date'></span>)</div>
<div class='tagging' macro='tagging'></div>
<div class='tagged' macro='tags'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='tagClear'></div>


PrettyDatesPlugin:

Date.prototype.prettyDate = function() {
        var diff = (((new Date()).getTime() - this.getTime()) / 1000);
        var day_diff = Math.floor(diff / 86400);

        if (isNaN(day_diff))      return "";
        else if (diff < 0)        return "in the future";
        else if (diff < 60)       return "just now";
        else if (diff < 120)      return "1 minute ago";
        else if (diff < 3600)     return Math.floor(diff/60) + " minutes
ago";
        else if (diff < 7200)     return "1 hour ago";
        else if (diff < 86400)    return Math.floor(diff/3600) + " hours
ago";
        else if (day_diff == 1)   return "Yesterday";
        else if (day_diff < 7)    return day_diff + " days ago";
        else if (day_diff < 14)   return  "a week ago";
        else if (day_diff < 31)   return Math.ceil(day_diff/7) + " weeks
ago";
        else if (day_diff < 62)   return "a month ago";
        else if (day_diff < 365)  return "about " + Math.ceil(day_diff/31) +
" months ago";
        else if (day_diff < 730)  return "a year ago";
        else                      return Math.ceil(day_diff/365) + " years
ago";
}

Date.prototype.formatString_orig_mptw = Date.prototype.formatString;

Date.prototype.formatString = function(template) {
        return this.formatString_orig_mptw(template).replace(/
pppp/,this.prettyDate());
}

// for MPTW. otherwise edit your ViewTemplate as required.
// config.mptwDateFormat = 'pppp (DD/MM/YY)';
config.mptwDateFormat = 'pppp';


On Jun 22, 1:03 pm, Michael Johanson <michael.j.johan...@gmail.com>
wrote:
> Well, atleast I thought everything was solved...
>
> I didn't notice it at first but this is what I get, e.g. : (updated
> just nowby MichaelJohanson)
> You see what is wrong? Yes, "nowby" which should be "now by".
>
> I can't find it anywhere in the ViewTemplate code orPrettyDatesPlugin. Where 
> else should I look?
> My codes doesn't differ at all compared to MPTW.
>
> /Mike
>
> On Jun 22, 12:21 pm, Michael Johanson <michael.j.johan...@gmail.com>
> wrote:
>
> > Got it all sorted out now.
> > Thanks for the help and patience.
>
> > /Mike
>
> > On Jun 22, 11:49 am, wolfgang <wolfgangl...@gmail.com> wrote:
>
> > > In Page or ViewTemplate you can comment parts of it out, so you don't
> > > have to delete and later don't find the bit of code again if you would
> > > want to revert, by using <!-- code -->
>
> > > In the example above, if you want the code commented out back, it
> > > would look like this:
>
> > > <div class='subtitle'>
> > >         (updated <span macro='view modified date {{config.mptwDateFormat?
> > > config.mptwDateFormat:"MM/0DD/YY"}}'></span>
> > >         by <span macro='view modifier link'></span>)
> > >         (<span macro='message views.wikified.createdPrompt'></span>
> > >         <span macro='view created date {{config.mptwDateFormat?
> > > config.mptwDateFormat:"MM/0DD/YY"}}'></span>)
> > > </div>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To post to this group, send email to TiddlyWiki@googlegroups.com
To unsubscribe from this group, send email to 
tiddlywiki+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/TiddlyWiki?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to