inherit
Peabrained Codebreaker
107114
0
Mar 11, 2020 7:47:27 GMT -8
Boy_Wonder
6,249
July 2007
natzy24
|
Post by Boy_Wonder on Jul 22, 2014 9:31:11 GMT -8
Okay so I have a question. Is there any way if I created a field that had a date and time included that this could then be translated through code into say 23 seconds ago, etc and updates on a refresh to how many minutes/seconds/hours ago until it reaches 24 hours since date when it then shows date and time
I'm asking to do it this way as I don't think there's any way to grab a "server time" as to when something was input to the plugin back end
|
|
inherit
(?)?
188910
0
Jan 26, 2013 13:30:48 GMT -8
♥ ℒʊ√ ♥
Clouds float into my life no longer to carry rain or usher storm but to add color to my sunset sky.
10,458
January 2013
luv
|
Post by ♥ ℒʊ√ ♥ on Jul 22, 2014 10:22:35 GMT -8
As on my board, Boy_Wonder? If so, Chris, did the code for it.
I'll just have to locate the thread, if it's what you're looking for.
|
|
inherit
Peabrained Codebreaker
107114
0
Mar 11, 2020 7:47:27 GMT -8
Boy_Wonder
6,249
July 2007
natzy24
|
Post by Boy_Wonder on Jul 22, 2014 10:29:48 GMT -8
I don't think so Luv, mines to give an effect of when information was added to the intel plugin on a site I'm developing, as well as likely getting reused on the bounty hunting board plugin I'm coding
|
|
inherit
(?)?
188910
0
Jan 26, 2013 13:30:48 GMT -8
♥ ℒʊ√ ♥
Clouds float into my life no longer to carry rain or usher storm but to add color to my sunset sky.
10,458
January 2013
luv
|
Post by ♥ ℒʊ√ ♥ on Jul 22, 2014 10:43:52 GMT -8
|
|
inherit
Peabrained Codebreaker
107114
0
Mar 11, 2020 7:47:27 GMT -8
Boy_Wonder
6,249
July 2007
natzy24
|
Post by Boy_Wonder on Jul 22, 2014 10:45:16 GMT -8
Thank you! I'm hoping that there is a way to do it if I input a time stamp and date in manually in the plugin and then some code changing it to the dynamic one like what happens automatically in posts
|
|
inherit
The Dream Crusher (Ret.)
164921
0
Apr 1, 2014 11:00:25 GMT -8
Tim Camara
Teach a man to fish, etc., etc.
1,721
March 2011
tcamara
|
Post by Tim Camara on Jul 22, 2014 11:32:16 GMT -8
Wherever you want the timestamp displayed, you just have to output the following: <abbr class="time" data-timestamp="64546541000"></abbr> Where the value of data-timestamp is the epoch or linux timestamp. You can learn more about how to work with this style of timestamp in JavaScript here.
|
|
inherit
Peabrained Codebreaker
107114
0
Mar 11, 2020 7:47:27 GMT -8
Boy_Wonder
6,249
July 2007
natzy24
|
Post by Boy_Wonder on Jul 22, 2014 11:36:55 GMT -8
Would this be useable in a plugin then Tim?
EG such as in a situation where in a plugin there's information added in the plugin interface back end and it then displays the "date" its added -reading that thread-
|
|
inherit
201984
0
Sept 11, 2023 1:23:07 GMT -8
P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓
Using My Talents Elsewhere
3,314
November 2013
pastuleo23
|
Post by P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓ on Jul 23, 2014 22:21:18 GMT -8
Would this be useable in a plugin then Tim? EG such as in a situation where in a plugin there's information added in the plugin interface back end and it then displays the "date" its added -reading that thread- It's totally possible. Proboards has designed their own 'a few seconds ago' object by specifying the class time. A script I made replaces the timestamp with the current (server) time. aka Real-Time What your asking for though is that you have a slightly different text replacement. I believe the time class is perfect for everything you want EXCEPT seconds.
|
|
inherit
Peabrained Codebreaker
107114
0
Mar 11, 2020 7:47:27 GMT -8
Boy_Wonder
6,249
July 2007
natzy24
|
Post by Boy_Wonder on Jul 23, 2014 22:36:42 GMT -8
Its not a plugin I'm after. This is for a plugin I'm coding.
I have two fields. One is a text field called "date" that I ALWAYS input through DD/MM/YYYY
The second is a Time field which I always input in 24hrs time (so right now I'd input the time is 07:35 )
I'm trying to work out how to get the plugin to translate this info a) into the users 'local time' and then into a dynamic time eg "5 seconds ago" "10 seconds ago" etc.
I can't currently link the site until forums.net upgrade without it is understood its still in development and will be moving to forums.net sometime today
|
|
inherit
201984
0
Sept 11, 2023 1:23:07 GMT -8
P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓
Using My Talents Elsewhere
3,314
November 2013
pastuleo23
|
Post by P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓ on Jul 23, 2014 23:13:00 GMT -8
Its not a plugin I'm after. This is for a plugin I'm coding. I have two fields. One is a text field called "date" that I ALWAYS input through DD/MM/YYYY The second is a Time field which I always input in 24hrs time (so right now I'd input the time is 07:35 ) I'm trying to work out how to get the plugin to translate this info a) into the users 'local time' and then into a dynamic time eg "5 seconds ago" "10 seconds ago" etc. I can't currently link the site until forums.net upgrade without it is understood its still in development and will be moving to forums.net sometime today That doesn't sound too hard. The date object should be represented as new Date(year, month, day, hours, minutes, seconds, milliseconds); HTML: <abbr class="time lokitime" data-timestamp="64546541000"></abbr> JAVASCRIPT: $('.lokitime').attr('data-timestamp', new Date(2011,0, 1, 2, 3, 29, 0).getTime()); Where you replace date with all of your fields. And the function will replace your html. Or since your making a plugin, Javascript: var lokidiv = document.createElement('div'); with(lokidiv) { innerHTML= '<abbr class="time" data-timestamp="'+new Date(2011,0, 1, 2, 3, 29, 0).getTime()+'"></abbr>' } $('JQUERY CLASS OR ID').append($(lokidiv)); That would add the html at the end of whatever you needed. Tag me if you have any other questions
|
|
inherit
Peabrained Codebreaker
107114
0
Mar 11, 2020 7:47:27 GMT -8
Boy_Wonder
6,249
July 2007
natzy24
|
Post by Boy_Wonder on Jul 23, 2014 23:20:40 GMT -8
Okay I really need that broken down as that just confused me
I understand simple enough that I know how to add fields to display, so can you work me through it step by step
|
|
inherit
201984
0
Sept 11, 2023 1:23:07 GMT -8
P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓
Using My Talents Elsewhere
3,314
November 2013
pastuleo23
|
Post by P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓ on Jul 23, 2014 23:28:45 GMT -8
You can count seconds with something like this:
|
|
inherit
Peabrained Codebreaker
107114
0
Mar 11, 2020 7:47:27 GMT -8
Boy_Wonder
6,249
July 2007
natzy24
|
Post by Boy_Wonder on Jul 23, 2014 23:35:20 GMT -8
How does that though work with using a field within the plugin UI
|
|
inherit
201984
0
Sept 11, 2023 1:23:07 GMT -8
P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓
Using My Talents Elsewhere
3,314
November 2013
pastuleo23
|
Post by P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓ on Jul 23, 2014 23:37:55 GMT -8
Its not a plugin I'm after. This is for a plugin I'm coding. I have two fields. One is a text field called "date" that I ALWAYS input through DD/MM/YYYY The second is a Time field which I always input in 24hrs time (so right now I'd input the time is 07:35 ) I'm trying to work out how to get the plugin to translate this info a) into the users 'local time' and then into a dynamic time eg "5 seconds ago" "10 seconds ago" etc. I can't currently link the site until forums.net upgrade without it is understood its still in development and will be moving to forums.net sometime today That doesn't sound too hard. The date object should be represented as new Date(year, month, day, hours, minutes, seconds, milliseconds); HTML: <abbr class="time lokitime" data-timestamp="64546541000"></abbr> JAVASCRIPT: $('.lokitime').attr('data-timestamp', new Date(2011,0, 1, 2, 3, 29, 0).getTime()); Where you replace date with all of your fields. And the function will replace your html. Or since your making a plugin, Javascript: var lokidiv = document.createElement('div'); with(lokidiv) { innerHTML= '<abbr class="time" data-timestamp="'+new Date(2011,0, 1, 2, 3, 29, 0).getTime()+'"></abbr>' } $('JQUERY CLASS OR ID').append($(lokidiv)); That would add the html at the end of whatever you needed. Tag me if you have any other questions As a plugin developer I assume you are using the JS console. So I will use the last example. var lokidiv = document.createElement('div'); with(lokidiv) { innerHTML= '<abbr class="time" data-timestamp="'+new Date(2011,0, 1, 2, 3, 29, 0).getTime()+'"></abbr>' } $('JQUERY CLASS OR ID').append($(lokidiv)); var lokidiv is a custom name that we can reference when we want it that stores data. document.createElement('div'); says that we want lokidiv to be a <div></div> container. with(lokidiv) { OPENS up the <div></div> tags so we are now inserting HTML in the middle innerHTML = Is where we insert the HTML as raw text. <abbr class="time" data-timestamp= is what PROBOARDS recognizes and works magic with. (we are recreating it) new Date(year, month, day, hours, minutes, seconds, milliseconds).getTime() Gets the format that PROBOARDS wants to use. It creates a date object using all of the specified data you have already collected (if you insert them correctly) And .getTime() converts the date object back to a string that PROBOARDS likes. '"></abbr>' Finishes the HTML } Closes the <div></div> you created $('JQUERY CLASS OR ID').append($(lokidiv)); Adds the lokidiv wherever you want it. By using a Jquery Selector
|
|
inherit
201984
0
Sept 11, 2023 1:23:07 GMT -8
P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓
Using My Talents Elsewhere
3,314
November 2013
pastuleo23
|
Post by P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓ on Jul 23, 2014 23:42:10 GMT -8
How does that though work with using a field within the plugin UI Should look like <abbr class="time" data-timestamp="'+new Date(pb.plugin.get('plugin_name').settings.year, pb.plugin.get('plugin_name').settings.month, pb.plugin.get('plugin_name').settings.day, pb.plugin.get('plugin_name').settings.hours, pb.plugin.get('plugin_name').settings.minutes, pb.plugin.get('plugin_name').settings.seconds, 0).getTime()+'"> FOR A SINGLE DATE Which is 6 fields per Date. Thus the invention of AUTOFORM was born.
|
|