IMPORTANT

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

Latest topics
» 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

» Forumactif Edge - Releases
by Ange Tuteur Thu 14 Dec 2017, 11:25

» [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

» Numbering of messages in the topic
by SLGray Mon 04 Dec 2017, 22:40

Recent Tutorials
Top posting users this month

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

None

[ View the whole list ]


Most users ever online was 172 on Fri 19 Feb 2016, 05:17

is there auto topic update - refresh to see new posts with out refresh the page

View previous topic View next topic Go down

avatar
Michael_vx

Title :
Gender : Male
Age : 26
Posts : 302
Points : 1841
Reputation : 76
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx on Mon 18 Jul 2016, 21:05

is there auto topic update - refresh to see new posts with out refresh the page


Last edited by Michael_vx on Sat 27 Aug 2016, 01:08; edited 1 time in total
avatar
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 22
Posts : 4725
Points : 9714
Reputation : 2359
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Mon 18 Jul 2016, 21:47

Yeah, it's possible. You'd just have to create an array of all the posts on the page, once you do this you can setup an interval which will poll for changes by sending a AJAX request to the page you're currently on.

Something like this for example :
Code:
$(function() {
  window.AJAX_TOPIC = {
    poll_time : 3000,
    post_then : $('.post'),

    get : function() {
      $.get(window.location.href, function(d) {
        AJAX_TOPIC.post_now = $('.post', d);

        if (AJAX_TOPIC.post_now.length > AJAX_TOPIC.post_then.length) {
          AJAX_TOPIC.post_then.last().after(AJAX_TOPIC.post_now.slice(AJAX_TOPIC.post_now.length, AJAX_TOPIC.post_then.length));
          AJAX_TOPIC.post_then = AJAX_TOPIC.post_now;
        }
      });
    }
  };

  AJAX_TOPIC.poll = window.setInterval(AJAX_TOPIC.get, AJAX_TOPIC.poll_time);
  'par ange tuteur';
});
It's a rough draft, so I don't know how well it'll work.

--------

Ange Tuteur
Tips and TricksContact Me

avatar
Michael_vx

Title :
Gender : Male
Age : 26
Posts : 302
Points : 1841
Reputation : 76
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx on Tue 19 Jul 2016, 04:42

im not sure about array of all the posts on the page
but ill do my best
thanks for now
cheers
avatar
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 22
Posts : 4725
Points : 9714
Reputation : 2359
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Tue 19 Jul 2016, 11:21

What I mean by array, is creating an element array of the posts on the page. Calling
Code:
$('SELECTOR')
in jQuery automatically returns an element array of all the elements that match your selector query. Same with
Code:
document.querySelectorAll('SELECTOR')
which is a native function of javascript. For example, this will return all posts in a topic and caches them to a variable :
Code:
var current_posts = $('.post');

Running the above in the console will return this element array :

Which is three posts at the time I was typing this message. Razz

Now since you cached the posts to a variable you'll be able to determine how many posts are on the page by writing
Code:
current_posts.length
, which would return 3 in my case. After that you just need to use AJAX to get the new posts and make a comparison like this for example :
Code:
if (current_posts.length < new_posts.length) {
  // update the topic and current_posts variable
}
Obviously new_posts is undefined since this is an example, but my script I posted earlier should show you what to do. xD

--------

Ange Tuteur
Tips and TricksContact Me

avatar
Guest
Guest
View all awards

PostGuest on Tue 23 Aug 2016, 18:05

*** This topic will be closed soon if we don't get any feedback. @Michael_vx Is this solved / still needed? ***
avatar
Michael_vx

Title :
Gender : Male
Age : 26
Posts : 302
Points : 1841
Reputation : 76
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx on Tue 23 Aug 2016, 21:10

im still working with the answer
cant tell yet if its solved or not
avatar
Michael_vx

Title :
Gender : Male
Age : 26
Posts : 302
Points : 1841
Reputation : 76
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx on Wed 24 Aug 2016, 09:39

is there a general way
Object { length: 0, prevObject: Object, context: HTMLDocument → t7-topic, selector: "SELECTOR" }
this what i get
also if this worked in my testing forum it might not work with the ther users Sad
if not possible
then just forget about it Sad
avatar
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 22
Posts : 4725
Points : 9714
Reputation : 2359
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Wed 24 Aug 2016, 10:24

@Michael_vx I took a look over my example script and I noticed it was a bit incorrect. Try adding this script with placement in the topics :
Code:
$(function() {
  window.AJAX_TOPIC = {
    poll_time : 3000,
    post_then : $('.post'),
 
    get : function() {
      $.get(window.location.href, function(d) {
        AJAX_TOPIC.post_now = $('.post', d);
 
        if (AJAX_TOPIC.post_now.length > AJAX_TOPIC.post_then.length) {
          AJAX_TOPIC.post_then.last().after(AJAX_TOPIC.post_now.slice(AJAX_TOPIC.post_then.length, AJAX_TOPIC.post_now.length));
          AJAX_TOPIC.post_then = $('.post');
        }
      });
    }
  };
 
  AJAX_TOPIC.poll = window.setInterval(AJAX_TOPIC.get, AJAX_TOPIC.poll_time);
  'par ange tuteur';
});

--------

Ange Tuteur
Tips and TricksContact Me

avatar
Michael_vx

Title :
Gender : Male
Age : 26
Posts : 302
Points : 1841
Reputation : 76
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx on Wed 24 Aug 2016, 21:51

wow
tested on phpbb3
working like a charm
phpbb2
not working
punbb
working like a charm
invision
working like a charm
most users use phpbb2
but some how phpbb2 looks a bit stupid in Scripts like that
i used 1000 instead of 3000 the reply appear in real time just like facebook LOL
avatar
Guest
Guest
View all awards

PostGuest on Thu 25 Aug 2016, 01:53

@Michael_vx, was that latest answer given by Ange helpful to you? Can we close this case now?
avatar
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 22
Posts : 4725
Points : 9714
Reputation : 2359
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Thu 25 Aug 2016, 13:15

@Michael_vx hmm what if you change the selector
Code:
.post
to
Code:
tr.post
for phpbb2 ?

--------

Ange Tuteur
Tips and TricksContact Me

avatar
Michael_vx

Title :
Gender : Male
Age : 26
Posts : 302
Points : 1841
Reputation : 76
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx on Sat 27 Aug 2016, 01:13

yes its working fine
ill just look in my old files to find the tags of
punbb and invision Smile
i remarked the topic so you can close it
i also apologize for not marking solved topic
my head a little huzzy these days
since a few things one of them is i saw pic of someone broke my heart before on fb that made me remember all old times when i was in love with her Sad
then my forum was almost lost but i fixed that
and some fights with my older brother
avatar
Michael_vx

Title :
Gender : Male
Age : 26
Posts : 302
Points : 1841
Reputation : 76
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx on Sat 27 Aug 2016, 01:17

i forget to say
its not working with multi pages
avatar
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 22
Posts : 4725
Points : 9714
Reputation : 2359
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Sat 27 Aug 2016, 10:44

@Michael_vx ah yes, I forgot to mention that it only updates the comments on the current page. Try this and see if it works regardless of your current page :
Code:
$(function() {
  window.AJAX_TOPIC = {
    poll_time : 3000,
    post_then : $('.post'),
 
    get : function() {
      $.get(window.location.href + '?view=newest', function(d) {
        AJAX_TOPIC.post_now = $('.post', d);
 
        if (AJAX_TOPIC.post_now.length > AJAX_TOPIC.post_then.length) {
          AJAX_TOPIC.post_then.last().after(AJAX_TOPIC.post_now.slice(AJAX_TOPIC.post_then.length, AJAX_TOPIC.post_now.length));
          AJAX_TOPIC.post_then = $('.post');
        }
      });
    }
  };
 
  AJAX_TOPIC.poll = window.setInterval(AJAX_TOPIC.get, AJAX_TOPIC.poll_time);
  'par ange tuteur';
});

--------

Ange Tuteur
Tips and TricksContact Me

avatar
Michael_vx

Title :
Gender : Male
Age : 26
Posts : 302
Points : 1841
Reputation : 76
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx on Sat 27 Aug 2016, 18:32

im not sure right now
i have just used my internet speed is dropped to 256KB/s till 4th of the next month
any way
the multi pages still same
drop it for later
i think its would be good if we look into more better Scripts then this one
Thumb right
avatar
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 22
Posts : 4725
Points : 9714
Reputation : 2359
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Sun 28 Aug 2016, 07:23

@Michael_vx oops, give it one more try :
Code:
$(function() {
  window.AJAX_TOPIC = {
    poll_time : 3000,
    post_then : $('.post'),
 
    get : function() {
      $.get(window.location.pathname + '?view=newest', function(d) {
        AJAX_TOPIC.post_now = $('.post', d);
 
        if (AJAX_TOPIC.post_now.length > AJAX_TOPIC.post_then.length) {
          AJAX_TOPIC.post_then.last().after(AJAX_TOPIC.post_now.slice(AJAX_TOPIC.post_then.length, AJAX_TOPIC.post_now.length));
          AJAX_TOPIC.post_then = $('.post');
        }
      });
    }
  };
 
  AJAX_TOPIC.poll = window.setInterval(AJAX_TOPIC.get, AJAX_TOPIC.poll_time);
  'par ange tuteur';
});

I used window.location.href instead of window.location.pathname. href includes everything ; hash and queries included, so it may have voided the query that I added : ?view=newest. It checks for the newest post. For example this link, links to the first page in the topic, but will display the most recent post :
http://fmdesign.forumotion.com/t120-chit-chat-thread?view=newest

--------

Ange Tuteur
Tips and TricksContact Me

avatar
Michael_vx

Title :
Gender : Male
Age : 26
Posts : 302
Points : 1841
Reputation : 76
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx on Sun 28 Aug 2016, 14:32

Zen
i guess its still the same im testin right now on phpbb3
avatar
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 22
Posts : 4725
Points : 9714
Reputation : 2359
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Sun 28 Aug 2016, 15:43

Oh right, you're correct. I didn't consider that the posts on the page you're currently on, would be lesser than the posts on the most recent page.. Face palm The stock script only works on the currently page, unfortunately.

--------

Ange Tuteur
Tips and TricksContact Me

avatar
Michael_vx

Title :
Gender : Male
Age : 26
Posts : 302
Points : 1841
Reputation : 76
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx on Sun 28 Aug 2016, 15:54

its okay consder it solved and archive it
who need the mutil pages any way we have more better Scripts to deal with
avatar
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 22
Posts : 4725
Points : 9714
Reputation : 2359
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Sun 28 Aug 2016, 15:56

Haha, yes. At least it works to some degree. Wink

Anyway you're welcome. Smile

Topic archived

--------

Ange Tuteur
Tips and TricksContact Me

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