FM Design
Would you like to react to this message? Create an account in a few clicks or log in to continue.

IMPORTANT

FM Design is in read-only mode, please click here for more information.

Latest topics
» Forumactif Edge - Releases
by Ange Tuteur Tue 03 Sep 2019, 11:49

» GIFActif - Giphy Button for the Editor
by Ange Tuteur Wed 08 May 2019, 17:21

» Forum Closure
by Ange Tuteur Mon 01 Jan 2018, 01:28

» Chit Chat Thread
by Valoish Sun 31 Dec 2017, 19:15

» Font/Text background color.
by Valoish Sun 31 Dec 2017, 19:11

» Forumactif Messenger - Instant Message Application for Forumotion
by Wolfuryo Sun 31 Dec 2017, 18:24

» [GAME] Count to One Million!
by brandon_g Fri 29 Dec 2017, 18:58

» Post Cards
by manikbiradar Wed 20 Dec 2017, 07:50

» [GAME] Countdown from 200,000
by Valoish Wed 13 Dec 2017, 23:22

» GeekPolice Tech Support Forums - GeekPolice.net
by Dr Jay Mon 11 Dec 2017, 19:12

» Asking about some plugin for Forumotion
by Dr Jay Mon 11 Dec 2017, 19:10

» [GAME] What are you thinking right now?
by Van-Helsing Sat 09 Dec 2017, 14:51

» Widget : Similar topics
by ranbac Wed 06 Dec 2017, 18:11

» Change the Background of the Forum and put an image and how to make prefixs?
by Clement Wed 06 Dec 2017, 15:19

» Hello from Western Australia
by SarkZKalie Wed 06 Dec 2017, 05:34

Recent Tutorials
Top posting users this month

Who is online?
In total there are 41 users online :: 0 Registered, 0 Hidden and 41 Guests :: 1 Bot

None

[ View the whole list ]


Most users ever online was 515 on Tue 14 Sep 2021, 15:24

add time in notication list

View previous topic View next topic Go down

Ch@lo Valdez
Ch@lo Valdez

Gender : Male
Age : 48
Posts : 65
Points : 3688
Reputation : 5
Location : Mexico
Language : eng spa
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3

PostCh@lo Valdez Tue 16 Aug 2016, 12:25

hi, i try add in my notication list the time, i use this

Code:

$.get('/notification.forum').done(function (o) {
    h = o.store;
    for (var i = 0; i < h.length; i++) {
        console.log(h[i].time)
    }
})

how manage this array?
how add in "li" elements the right time?

reflect

my english is poor sorry


Last edited by Ch@lo Valdez on Tue 16 Aug 2016, 20:36; edited 1 time in total
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12043
Reputation : 2375
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Tue 16 Aug 2016, 12:32

Hi @Ch@lo Valdez,

You can try binding a click event to the document, and then when you click on the notification list you apply the necessary data. This is an example :
Code:
$(document).on('click', function(e) {
  var that = e.target, list;

  if (that.id == 'fa_notifications') {
    list = document.getElementById('notif_list');
    console.log(list.innerHTML);
  }
});

Where you see :
Code:
      list = document.getElementById('notif_list');
      console.log(list.innerHTML);
That's where you can make your modifications to the notif_list.
Ch@lo Valdez
Ch@lo Valdez

Gender : Male
Age : 48
Posts : 65
Points : 3688
Reputation : 5
Location : Mexico
Language : eng spa
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3

PostCh@lo Valdez Tue 16 Aug 2016, 13:40

ok let me explain better:

when you call /notification.forum, return this array:

add time in notication list Captur10

in html the notification list is this:

add time in notication list Captur11

each li element has a id
Code:
id="n218"

my question is how compare in array, the array id with li id in a for in or for var, and insert text element in html to display the time of each notifcation




Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12043
Reputation : 2375
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Tue 16 Aug 2016, 15:16

In the data returned there should be an id for the notification in
Code:
o.store
. It can be accessed via
Code:
o.store.text.id
and it'll return the notification id. Then all you need to do is call getElementById or a jQuery query select. Here's an example :
Code:
$.get('/notification.forum').done(function (o) {
    for (var h = o.store, i = 0, li; i < h.length; i++) {
        li = document.getElementById('n' + h[i].text.id);
        console.log(h[i].time);
        console.log(li);
    }
})

I added "li" which stores the li tag for that notification to a variable for you to manipulate. Wink
Ch@lo Valdez
Ch@lo Valdez

Gender : Male
Age : 48
Posts : 65
Points : 3688
Reputation : 5
Location : Mexico
Language : eng spa
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3

PostCh@lo Valdez Tue 16 Aug 2016, 15:48

ohh ok, Smile i think i got it
Ch@lo Valdez
Ch@lo Valdez

Gender : Male
Age : 48
Posts : 65
Points : 3688
Reputation : 5
Location : Mexico
Language : eng spa
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3

PostCh@lo Valdez Tue 16 Aug 2016, 16:20

ok, now, i think, i have to storage this data

Code:

$.get('/notification.forum').done(function (o) {
    for (var h = o.store, i = 0, li; i < h.length; i++) {
        li = document.getElementById('n' + h[i].text.id);
        console.log(h[i].time);
        li.insertAdjacentHTML('beforeend', h[i].time)
    }
})

add time in notication list Captur12
Ch@lo Valdez
Ch@lo Valdez

Gender : Male
Age : 48
Posts : 65
Points : 3688
Reputation : 5
Location : Mexico
Language : eng spa
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3

PostCh@lo Valdez Tue 16 Aug 2016, 17:22

ok convert it on my time zone

Code:

$.get('/notification.forum').done(function (o) {
    for (var h = o.store, i = 0, a, b, c, d, e; i < h.length; i++) {
        a = h[i].time;
        b = h[i].text.id;
        c = document.getElementById('n' + b);
        d = new Date(a);
        e = d.toLocaleString();
        c.insertAdjacentHTML('beforeend', '<b class="time_notif"><i class="fa fa-clock-o" aria-hidden="true"></i> '+ e +'</b>')
    }
})
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12043
Reputation : 2375
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Tue 16 Aug 2016, 19:56

@Ch@lo Valdez it looks good. Very good
Ch@lo Valdez
Ch@lo Valdez

Gender : Male
Age : 48
Posts : 65
Points : 3688
Reputation : 5
Location : Mexico
Language : eng spa
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3

PostCh@lo Valdez Tue 16 Aug 2016, 20:36

ok thanks

add time in notication list 1f601
add time in notication list Captur13

Ch@lo Valdez
Ch@lo Valdez

Gender : Male
Age : 48
Posts : 65
Points : 3688
Reputation : 5
Location : Mexico
Language : eng spa
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3

PostCh@lo Valdez Tue 16 Aug 2016, 20:52

uh oh, just now i read about of this service support is only for you responsive theme, i'm sorry Sad
Anonymous
Guest
Guest

PostGuest Tue 16 Aug 2016, 23:57

*** Topic solved, locked and archived ***
Sponsored content

PostSponsored content

View previous topic View next topic Back to top

Create an account or log in to leave a reply

You need to be a member in order to leave a reply.

Create an account

Join our community by creating a new account. It's easy!


Create a new account

Log in

Already have an account? No problem, log in here.


Log in

 
Permissions in this forum:
You cannot reply to topics in this forum