wrux Posted May 14, 2014 Share Posted May 14, 2014 (edited) This is a subtle modification. It basically just updates the details in the sidebar (energy, hp, money, mail notifications etc) using JSON. I've seen other implementations of this, just getting the entire sidebar which isn't necessary so I just created a nicer way to do it. I have written a more in-depth explanation of it on my dev blog here which explains how to install it in more detail; probably a good idea if you are relatively new. To install this modification it basically requires a few edits to the template and uploading the javascript file and php file. I do not have the latest version of mccodes, so this may be outdated for some, however feel free to update it for me :P Heres the PHP code: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. And heres the JavaScript code: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Edited May 14, 2014 by wrux 1 Quote Link to comment Share on other sites More sharing options...
Dave Posted May 14, 2014 Share Posted May 14, 2014 Very nice clean implementation. Good to see decent use of commenting. Maybe you should detect if the browser window is in focus? Or you'll potentially be making requests whilst the player isn't even looking at the site. Quote Link to comment Share on other sites More sharing options...
peterisgb Posted May 14, 2014 Share Posted May 14, 2014 i must be a complete idiot of something, but what does it exactly do.... Quote Link to comment Share on other sites More sharing options...
wrux Posted May 14, 2014 Author Share Posted May 14, 2014 i must be a complete idiot of something, but what does it exactly do.... Well normally you would have to reload the page to see your updated energy and stuff if it's been a few minutes, this will load it automatically without having to reload. Quote Link to comment Share on other sites More sharing options...
peterisgb Posted May 14, 2014 Share Posted May 14, 2014 oh right, on my old site i iframed it. Quote Link to comment Share on other sites More sharing options...
wrux Posted May 14, 2014 Author Share Posted May 14, 2014 Very nice clean implementation. Good to see decent use of commenting. Maybe you should detect if the browser window is in focus? Or you'll potentially be making requests whilst the player isn't even looking at the site. Yea I make might make a revision for that another day. It was really just an attempt to show people that things can be done differently Quote Link to comment Share on other sites More sharing options...
Script47 Posted May 14, 2014 Share Posted May 14, 2014 Yea I make might make a revision for that another day. It was really just an attempt to show people that things can be done differently And also in this case, better! Good job. :) Quote Link to comment Share on other sites More sharing options...
Samurai Legend Posted May 14, 2014 Share Posted May 14, 2014 I am really confused. Where do I add what? Quote Link to comment Share on other sites More sharing options...
wrux Posted May 14, 2014 Author Share Posted May 14, 2014 I am really confused. Where do I add what? You need them two on your server. Make sure jQuery and the javascript file I posted are loaded. After that you then need open up header.php and wrap all the numbers to update in a corresponding span tag. An example: <span class="label" data-value="energypercent">{$enperc}</span> the data-value tag needs to be set to the variable to update it to. Another example (sets the mail notifications if the player has any): <span class="label" data-value="new_mail">{$ir['new_mail']}</span> Quote Link to comment Share on other sites More sharing options...
peterisgb Posted May 14, 2014 Share Posted May 14, 2014 could you post a screeny Quote Link to comment Share on other sites More sharing options...
Script47 Posted May 14, 2014 Share Posted May 14, 2014 could you post a screeny I don't think a screeny would do it justice whereas a live demo would, because you can't see it updating it in an image. Quote Link to comment Share on other sites More sharing options...
Samurai Legend Posted May 15, 2014 Share Posted May 15, 2014 I was just going to say that xD However this is great! Found out how to work it out! And it works great. However I need the CSS image of the bar to be changed to? Any ways I can do that? Quote Link to comment Share on other sites More sharing options...
boionfire81 Posted April 8, 2016 Share Posted April 8, 2016 Anyone have this working on v2.0.5? cause nothing looks the same >.< Quote Link to comment Share on other sites More sharing options...
Samurai Legend Posted April 17, 2016 Share Posted April 17, 2016 You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. [uSER=72582]boionfire81[/uSER] - Try this out Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.