Skip to content

Adds runtime options #24

Open
wants to merge 1 commit into from

8 participants

@petersendidit

Allows the plugin to handle things like: $("time").timeago({suffixAgo: ""});

@ChaseFlorell

This is working wonderfully, however today I noticed that the plugin is saying "yesterday ago" when I apply the suffixAgo.

@RomainSauvaire

It's too bad that this merge is not yet done !

2years ago...

@kellysutton

+1

@scarytom

+1

@akrawchyk

+1

@rmm5t rmm5t referenced this pull request Mar 7, 2013
Closed

Runtime options #3

@rmm5t
Owner
rmm5t commented Mar 7, 2013

Sorry for neglecting this project somewhat, but I'm on a kick to refocus efforts again while planning a 2.0 (rewrite) release. Meanwhile, If someone has the time to rebase this, I promise to get it into a 1.x release.

@dark-panda

Here's a rebase/small rewrite of the patch, along with a test for using runtime settings.

https://github.com/dark-panda/jquery-timeago/tree/runtime-settings

@rmm5t
Owner
rmm5t commented Aug 19, 2013

@dark-panda Your patch doesn't look like it touches $.fn.timeago which defeats the main point. Also, a full-fledged pull-request with the rebase would make it easier to collaborate.

@dark-panda

Ah, whoops. I spent so much time getting inWords to work (which was what I needed for my use-case) that I skipped over that part. Give me a bit and I'll re-roll a better patch.

@dark-panda

I've created a work-in-progress version of the patch at https://github.com/dark-panda/jquery-timeago/tree/runtime-settings . I'm currently working on some issues with the refresh tests, although in general things appear to be working pretty well.

The patch allows you to do the following sorts of things:

// with action and settings
$('abbr#foo').timeago("init", { "strings": {"suffixFromNow": "foo" } });

// with just settings
$('abbr#foo').timeago({ "strings": {"suffixFromNow": "foo" } });

// additional settings for methods like `update`
$('abbr#foo').timeago("update", new Date(), { "strings": {"suffixAgo": "foo" } });

// via $.timeago
$.timeago(new Date(), { "strings": { "suffixAgo": "foo" } });

Once the tests are fixed up and extended and I'm sure everything is working correctly I can post a new pull request, but I figured I'd post the work-in-progress here to solicit some comments and maybe a bit of help with the refresh tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.