The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

How to prevent the request limit in this javascript via the localstorage?

4 posters

Go down

Solved How to prevent the request limit in this javascript via the localstorage?

Post by Van-Helsing Mon 2 Jun - 6:22

Hi all,
I have a javascript in my overall_header to display the avatar in the navigation bar

Code:

                      <li><div id="avatar"><script>
                jQuery(document).ready(function(){
                  jQuery.get('/profile?mode=editprofile&page_profil=avatars', function(data) {
                      link = jQuery('.frm dl dd img', data).attr('src');
                      if(link){
                                            jQuery('#avatar').html('<center><img src="'+link+'" width="25px" height="25px" /></center>');
                      }else{
                        jQuery('#avatar').html('');
                      }
                  });
                });
      </script></div></li>      

How can I adapt it to prevent the Request Limit Exceeded?

Best Regards,
Dark-Avenger


Last edited by Dark-Avenger on Mon 9 Jun - 6:56; edited 2 times in total
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How to prevent the request limit in this javascript via the localstorage?

Post by Paulostge Tue 3 Jun - 2:29

yes this can be done
Paulostge
Paulostge
Forumember

Male Posts : 129
Reputation : 17
Language : Greek
Location : Greece

http://www.thegreeksenergy.com

Back to top Go down

Solved Re: How to prevent the request limit in this javascript via the localstorage?

Post by Van-Helsing Tue 3 Jun - 2:35

Hi Paulos,
Do you know how can I fix it?
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How to prevent the request limit in this javascript via the localstorage?

Post by Van-Helsing Thu 5 Jun - 1:32

Bump
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How to prevent the request limit in this javascript via the localstorage?

Post by Van-Helsing Fri 6 Jun - 6:34

Bump
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How to prevent the request limit in this javascript via the localstorage?

Post by Wagner' Fri 6 Jun - 10:08

Hello,

In this case, you don't need to use Ajax, Forumotion has a var to do this for you!!

Your code can be resumed on this
Code:
<li>
    <div id="avatar"></div>
</li>
<script>
    jQuery(function(){
        var avatar = _userdata["avatar"];
        jQuery('#avatar').append(avatar);
    });
</script>


Best regards, Wagner
Wagner'
Wagner'
Forumember

Male Posts : 48
Reputation : 6
Language : Portuguese
Location : Brazil

http://www.bestskins.net/forum

Back to top Go down

Solved Re: How to prevent the request limit in this javascript via the localstorage?

Post by Van-Helsing Fri 6 Jun - 14:01

How can I change avatar's size with this script?
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How to prevent the request limit in this javascript via the localstorage?

Post by Wagner' Fri 6 Jun - 15:06

You just need to put a CSS rule.. Something like this
Code:
#avatar img{width:WIDTHVALUE;height:HEIGHTVALUE}

Just put the rules you want...
Wagner'
Wagner'
Forumember

Male Posts : 48
Reputation : 6
Language : Portuguese
Location : Brazil

http://www.bestskins.net/forum

Back to top Go down

Solved Re: How to prevent the request limit in this javascript via the localstorage?

Post by Van-Helsing Fri 6 Jun - 16:12

It still reaches the requests limit. I dont know but I have removed the javascript from template and request limit hits on each move which I can make in my ACP and I have removed 2-3 javascripts to make my forum more light.
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How to prevent the request limit in this javascript via the localstorage?

Post by Wagner' Fri 6 Jun - 17:05

Can you send your forum link? I will check if i know what is doing this...
Wagner'
Wagner'
Forumember

Male Posts : 48
Reputation : 6
Language : Portuguese
Location : Brazil

http://www.bestskins.net/forum

Back to top Go down

Solved Re: How to prevent the request limit in this javascript via the localstorage?

Post by Van-Helsing Fri 6 Jun - 17:08

Wagner' wrote:Can you send your forum link? I will check if i know what is doing this...
Yes sure here it is:
Spoiler:
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How to prevent the request limit in this javascript via the localstorage?

Post by Wagner' Fri 6 Jun - 17:20

Hmm, I'm brazilian, Greek it's too hard to me xD
But, i don't see any script who is doing this.. And few minutes navigating in your forum i dont have reached any RL... Dont you think its your internet?
Wagner'
Wagner'
Forumember

Male Posts : 48
Reputation : 6
Language : Portuguese
Location : Brazil

http://www.bestskins.net/forum

Back to top Go down

Solved Re: How to prevent the request limit in this javascript via the localstorage?

Post by Van-Helsing Fri 6 Jun - 17:24

Do you know if these codes for IPB Profile makes to many requests to server?

Profile JS:
Code:

if(/\/?u(\d+)wall$/.test(location.pathname)) {
            jQuery(document).ready(function(){if(jQuery('#profile-advanced-layout #tabs li a').length){
            var nevoskin=jQuery('#profile-advanced-layout #tabs li:eq(1) a').attr('href');
            window.location.href=nevoskin;
            }})};
            if(/\/?u(\d+)stats$/.test(location.pathname)) {
            jQuery(document).ready(function(){if(jQuery('#profile-advanced-layout #tabs li a').length){
            var nevoskin=jQuery('#profile-advanced-layout #tabs li:eq(1) a').attr('href');
            window.location.href=nevoskin;
            }})};
            if(/\/?u(\d+)friends$/.test(location.pathname)) {
            jQuery(document).ready(function(){if(jQuery('#profile-advanced-layout #tabs li a').length){
            var nevoskin=jQuery('#profile-advanced-layout #tabs li:eq(1) a').attr('href');
            window.location.href=nevoskin;
            }})};
            if(/\/?u(\d+)contact$/.test(location.pathname)) {
            jQuery(document).ready(function(){if(jQuery('#profile-advanced-layout #tabs li a').length){
            var nevoskin=jQuery('#profile-advanced-layout #tabs li:eq(1) a').attr('href');
            window.location.href=nevoskin;
            }})};
            $("meta[http-equiv='refresh'][content]:first").each(function(){window.location.href=$(this).attr("content").replace(/^.*;url=/,"")});

IPB JS:

Code:

if(/\/?u(\d+)$/.test(location.pathname)) {
            jQuery(document).ready(function(){if(jQuery('#profile-advanced-right').length){
            var avataripb=jQuery('#profile-advanced-right .main-content.clearfix.center img:first-child').attr('src');
            var tabsipb=jQuery('#profile-advanced-layout #profile-advanced-left #tabs').html();var infoipbge=jQuery('#profile-advanced-left #profile-advanced-details .middleline').html();
            var listfriends=jQuery('.main-content.clearfix[style^="padding:0.3em;text-align:center;"]').html();
            var prfiletoadd=jQuery('#profile-advanced-right #profile-advanced-add').html();
            var usernameipb=jQuery('#profile-advanced-right .module.main:eq(0) .main-head .h3').text().split(' (conectado)').join('');var miregistro=jQuery('.middleline #field_id-4 dd div:eq(0)').html();
            var monedas=jQuery('.middleline #field_id-13 dd div:eq(0)').html();
            var reputipb=jQuery('.middleline #field_id-14 dd div:eq(0)').html();
            var mid=jQuery('#profile-advanced-layout #tabs li:eq(3) a').attr('href').match(/[0-9]+/);
            var onlineipb=jQuery('#profile-advanced-right .main-head:eq(0) .h3 em').text().replace(/[(]/gi,' ').replace(/[)]/gi,' ');
            jQuery('#profile-advanced-right').after('<div class="ipb-profile">
            <div class="nav-ipb-top"><span>Επισκόπηση Προφίλ Μέλους:  <span id="useridhahs"> '+usernameipb+'</span></span></div>
            <div class="mod-left">
            <div class="profile-ava"><img id="ipd-avatar" src="'+avataripb +'" /> </div>
            <div class="ipb-tab-us">'+tabsipb+'</div></div>
            <div class="mod-center">
            <div class="sub-panel-top"><div class="usernam-ipb">'+usernameipb+'</div>
            <div class="register-date">Εγγράφηκε στις:    '+miregistro+'</div>
        <div class="ofline-ipb">Copyright©& nbsp; PunBB.biz & nbsp;& & nbsp; 15-Tronos</div>
            <div class="lass-activiti"></div>
            <div class="rating-profile">
            <img src="http://i.imgur.com/jFLWgyz.png"/>
            <img src="http://i.imgur.com/jFLWgyz.png"/>
            <img src="http://i.imgur.com/jFLWgyz.png"/>
            <img src="http://i.imgur.com/jFLWgyz.png"/>
            <img src="http://i.imgur.com/jFLWgyz.png"/>
            </div><div class="profi-add-ipb">'+prfiletoadd+'
            <a id="men"href="/privmsg?mode=post&u='+mid+'">Αποστολή Προσωπικού Μηνύματος</a>
            <a id="search-i"href="/spa/'+usernameipb+'">Βρείτε το περιεχόμενο μου</a>
            </div>
            </div>
            <div class="main-info-ipb">
            <div class="co-ipb" id="profile">
            <div class="ipb-m-title">
            <h2 id="wallcomment">Σχόλια Προφίλ</h2>
            <h2 id="estadis">Λεπτομέρειες Προφίλ</h2>
            <h2 id="estadisgene"><span>Στατιστικά</span></h2>
            <h2 id="friends">Φίλοι</h2>
            <h2 id="contacto">Επικοινωνία</h2></div>
            <div class="mensajeprofile"></div>
            <div class="m-info-ipb"><div class="in-ipb">'+infoipbge+'
            <div class="contac-me-ipb"></div>
            </div>
            <div class="band-right">
            <div class="repu-ipb"><span id="cs">'+monedas+'</span><div id="sub">Βαθμοί</div></div>
            <div class="coin-ipb"><span>'+reputipb+'</span><div iid="re-p"> Φήμη</div></div>
            <div class="module-ipb-right">
            <h2>Φίλοι</h2>
            <div class="main-ipb-f">'+listfriends+'</div>
            </div>
            </div>
            </div>
            <div class="estadis-ipb"></div>
            <div class="friends-ips"></div>
            <div class="contact-ips"></div></div>
            </div></div>
            </div>');
            }});
            $(document).ready(function(){if(jQuery('#profile-advanced-right').length){
            $('.estoyenline-i:contains("conectado") .ofline-ipb').attr('style','display:none;');
            $('.estoyenline-i:contains("conectado")').attr('style','padding:0px 5px;');
            var linkwall=jQuery('#tabs ul li a:eq(0)').attr('href');
            jQuery(".mensajeprofile").load(linkwall+' #profile-advanced-details .main-content');
            var linkestaipb=jQuery('#tabs ul li a:eq(2)').attr('href');
            jQuery(".estadis-ipb").load(linkestaipb+' #profile-advanced-details .main-content');
            jQuery(".lass-activiti").load(linkestaipb+' #profile-advanced-details .main-content.clearfix .stats-field.genmed ul li:contains("Última visita :")');
            var linkfriendipb=jQuery('#tabs ul li a:eq(3)').attr('href');
            jQuery(".friends-ips").load(linkfriendipb+' #profile-advanced-details .main-content');
            var linkcontaipb=jQuery('#tabs ul li a:eq(4)').attr('href');
            jQuery(".contact-ips").load(linkcontaipb+' #profile-advanced-details .main-content');
            }});
            $(document).ready(function(){if(jQuery('#profile-advanced-right').length){ // Script del Slider
                $(".mensajeprofile, .estadis-ipb, .friends-ips, .contact-ips") . hide();
                $('.m-info-ipb').addClass('activetab');
             $(".ipb-tab-us ul li:eq(0)").click(function(e){
                    $('.ipb-tab-us li ,.co-ipb div').removeClass('activetab');
                    $(this).addClass('activetab');
                    $('.mensajeprofile').addClass('activetab').fadeToggle();
                    $('.estadis-ipb, .m-info-ipb, .friends-ips, .contact-ips') . hide('');
                    return false;
                    e.preventDefault();
                });
             $(".ipb-tab-us ul li:eq(1)").click(function(e){
                    $('.ipb-tab-us li ,.co-ipb div').removeClass('activetab');
                    $(this).addClass('activetab');
                    $('.m-info-ipb').addClass('activetab').fadeToggle();
                    $('.mensajeprofile, .estadis-ipb, .friends-ips, .contact-ips') . hide('');
                    return false;
                    e.preventDefault();
                });
            $(".ipb-tab-us ul li:eq(2)").click(function(e){
                    $('.ipb-tab-us li ,.co-ipb div').removeClass('activetab');
                    $(this).addClass('activetab');
                    $('.estadis-ipb').addClass('activetab').fadeToggle();
                    $('.mensajeprofile, .m-info-ipb, .friends-ips, .contact-ips') . hide('');
                    return false;
                    e.preventDefault();
                });
            $(".ipb-tab-us ul li:eq(3)").click(function(e){
                    $('.ipb-tab-us li ,.co-ipb div').removeClass('activetab');
                    $(this).addClass('activetab');
                    $('.friends-ips').addClass('activetab').fadeToggle();
                    $('.mensajeprofile, .m-info-ipb, .estadis-ipb, .contact-ips') . hide('');
                    return false;
                    e.preventDefault();
                });
            $(".ipb-tab-us ul li:eq(4)").click(function(e){
                    $('.ipb-tab-us li ,.co-ipb div').removeClass('activetab');
                    $(this).addClass('activetab');
                    $('.contact-ips').addClass('activetab').fadeToggle();
                    $('.mensajeprofile, .m-info-ipb, .estadis-ipb, .friends-ips') . hide('');
                    return false;
                    e.preventDefault();
                });
            }});
            $(document).ready(function(){if(jQuery('#profile-advanced-right').length){
            $(".ipb-tab-us ul li:first-child > a").click(function(e){$('.co-ipb').attr('id', 'profilewall');});
            $(".ipb-tab-us ul li:first-child + li > a").click(function(e){$('.co-ipb').attr('id', 'profile');});
            $(".ipb-tab-us ul li:first-child + li +li > a").click(function(e){$('.co-ipb').attr('id', 'estadisticas');});
            $(".ipb-tab-us ul li:first-child + li +li +li > a").click(function(e){$('.co-ipb').attr('id', 'friends');});
            $(".ipb-tab-us ul li:first-child + li +li + li +li > a").click(function(e){$('.co-ipb').attr('id', 'contacto');
            });
            }});
            $(document).ready(function(){if(jQuery('#profile-advanced-right').length){jQuery('#profile-advanced-right').remove()};});
            $(document).ready(function(){if(jQuery('#profile-advanced-layout').length){jQuery('#profile-advanced-layout').remove()};});
            }
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How to prevent the request limit in this javascript via the localstorage?

Post by Wagner' Fri 6 Jun - 17:29

Hmm, the second script (IPB JS) make too much requests..

See:

1.
Code:
jQuery(".contact-ips").load(linkcontaipb + ' #profile-advanced-details .main-content');

2.
Code:
jQuery(".friends-ips").load(linkfriendipb + ' #profile-advanced-details .main-content');

3.
Code:
jQuery(".lass-activiti").load(linkestaipb + ' #profile-advanced-details .main-content.clearfix .stats-field.genmed ul li:contains("Última visita :")');

4.
Code:
jQuery(".estadis-ipb").load(linkestaipb + ' #profile-advanced-details .main-content');

5.
Code:
jQuery(".mensajeprofile").load(linkwall + ' #profile-advanced-details .main-content');


Just 4, or 5 I don't remember now, it's sufficient to make a RL...
Wagner'
Wagner'
Forumember

Male Posts : 48
Reputation : 6
Language : Portuguese
Location : Brazil

http://www.bestskins.net/forum

Back to top Go down

Solved Re: How to prevent the request limit in this javascript via the localstorage?

Post by Van-Helsing Fri 6 Jun - 17:31

Is it better to remove them? Because the tutorial says to check In all the pages.
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How to prevent the request limit in this javascript via the localstorage?

Post by Wagner' Fri 6 Jun - 17:33

Hmm, where did you get that? There are some words in portuguese, so did you get in a portuguese forum, right?

Can you send the link to the tutorial? So i can check if is there any better way to do this...
Wagner'
Wagner'
Forumember

Male Posts : 48
Reputation : 6
Language : Portuguese
Location : Brazil

http://www.bestskins.net/forum

Back to top Go down

Solved Re: How to prevent the request limit in this javascript via the localstorage?

Post by Van-Helsing Fri 6 Jun - 17:40

I found them in punbb.biz before two-three months. I think this is an updated link http://www.punbb.biz/t316-javascript-ipb-profile-v220022014-jq191  I just found my reply to get the codes.
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How to prevent the request limit in this javascript via the localstorage?

Post by Wagner' Fri 6 Jun - 17:48

Hmm, so.. I think they have stolen this tutorial from some brazilian forum or something like that, i dont know... But, i think is this script is doing that to your forum... Its better to remove it.. (I think x.x)

@Edit: Reading the tutorial... Wait a sec..
Wagner'
Wagner'
Forumember

Male Posts : 48
Reputation : 6
Language : Portuguese
Location : Brazil

http://www.bestskins.net/forum

Back to top Go down

Solved Re: How to prevent the request limit in this javascript via the localstorage?

Post by Van-Helsing Fri 6 Jun - 17:54

Ok I am waiting if there is a solution or if not to delete them.
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How to prevent the request limit in this javascript via the localstorage?

Post by Wagner' Fri 6 Jun - 18:08

I think is better to do a another code, by yourself..

About your question of storage, its simple:

Setting items
Code:
localStorage.setItem('key','value');

Getting items
Code:
localStorage.getItem('key');

Example
Run in your console
Code:
var name = prompt('What\'s your name?');
    localStorage.setItem('name',name);

To get you name
Code:
alert( localStorage.getItem('name') );

You can close the browser, but when you comes back the name is in there (:

Best regards, Wagner
Wagner'
Wagner'
Forumember

Male Posts : 48
Reputation : 6
Language : Portuguese
Location : Brazil

http://www.bestskins.net/forum

Back to top Go down

Solved Re: How to prevent the request limit in this javascript via the localstorage?

Post by Van-Helsing Mon 9 Jun - 6:07

Ok I have removed some javascripts and now the problem with Requests Limits have been solved.

One more question: Do you know how many load functions must I have in my javascripts to skip the requests limits and how can I know how may .load functions firing the port?

With Best Regards,
Dark-Avenger
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How to prevent the request limit in this javascript via the localstorage?

Post by Wagner' Mon 9 Jun - 6:54

What is your browser?

In Google Chrome you can check the requests at Network tab in Developer Tools..

I think 5 requests in 10 seconds can make a request limit.. Just need to check if this is right..
Wagner'
Wagner'
Forumember

Male Posts : 48
Reputation : 6
Language : Portuguese
Location : Brazil

http://www.bestskins.net/forum

Back to top Go down

Solved Re: How to prevent the request limit in this javascript via the localstorage?

Post by Van-Helsing Mon 9 Jun - 6:55

Ok thanks Wagner.

Best Regards,
Dark-Avenger
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How to prevent the request limit in this javascript via the localstorage?

Post by Derri Tue 10 Jun - 17:18

Since this topic is marked solved I'll move it to the archive.
Derri
Derri
Helper
Helper

Male Posts : 8755
Reputation : 638
Language : English & Basic French
Location : Scotland, United Kingdom

Back to top Go down

Back to top


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