SimplePortal

Support => English Support => Topic started by: 420connect on February 26, 2016, 12:53:10 PM

Title: My shoutbox is requiring a page refresh - jq conflict?
Post by: 420connect on February 26, 2016, 12:53:10 PM
Hey everyone,

like it says on the tin, my shoutbox is playing up on my new site I am developing at the moment and wondered if it could be a jQuery conflict or something similar..


when I 'shout' something.. it refreshes the page to post it, instead of being 'ajax'?
(I don't really know what I'm talking about lol)

Has anyone experienced it before and/or know of a quick fix?!  :thumbsup:

Title: Re: My shoutbox is requiring a page refresh - jq conflict?
Post by: ♦ Ninja ZX-10RR ♦ on February 26, 2016, 02:19:35 PM
Welcome back mate :)

There is a topic (http://simpleportal.net/index.php?topic=13865.0) about this issue, have you tried the solution provided in it?

Regards
Title: Re: My shoutbox is requiring a page refresh - jq conflict?
Post by: 420connect on February 26, 2016, 02:31:43 PM
Welcome back mate :)

There is a topic (http://simpleportal.net/index.php?topic=13865.0) about this issue, have you tried the solution provided in it?

Regards

Thanks!  :nervous-happy:

I guess it's a good thing it's been a while.. - shows how stable and awesome SP is!  :applause:

& I thought you had just saved my socks but unfortunately that particular fix doesn't seem to have solved my problem!  :( (Many thanks for pointing me in the right direction though!)


I can pm you a login to have a spy around but I've not got the site 'live' at the moment..
Title: Re: My shoutbox is requiring a page refresh - jq conflict?
Post by: ♦ Ninja ZX-10RR ♦ on February 26, 2016, 02:48:56 PM
Yep, last version is quite stable and awesome :) Only a few non-critical problems here and there.

If not that, the problem is likely caused by something (another mod or some js in the theme) interfering with the shoutbox, and affecting the xml output. If you don't have a live site... Erh... Well... It might be a problem to fix what I cannot see, I'm just a ninja, not God :P
Title: Re: My shoutbox is requiring a page refresh - jq conflict?
Post by: 420connect on February 26, 2016, 03:55:55 PM
Sorry.. I'll explain better!

I have my old site is currently on maintenance mode.
& I have my new site also on maintenance, but don't want to publicly shout the url yet! :P

& Yep, I did think it was probably a mod conflicting with parts of it - it's just a pain having to pull out mods 1 by 1 to find the problem and was hoping someone with a better idea might know of a better approach..

I know no conflict things exist but don't know if they'd be useful for this.. or really what the problem is! :P
Title: Re: My shoutbox is requiring a page refresh - jq conflict?
Post by: ♦ Ninja ZX-10RR ♦ on February 26, 2016, 04:30:06 PM
Then... Perhaps telling me the mods list can be helpful :P Btw yes you can send me a pm with the data, I'll have a look later.
Title: Re: My shoutbox is requiring a page refresh - jq conflict?
Post by: 420connect on March 01, 2016, 01:39:10 PM
Hey sorry for the delay,

Other bigger issues came up but would still like to solve this one..

http://www.420connect.co.uk
you can use account: smftest/smftest for testing...
Title: Re: My shoutbox is requiring a page refresh - jq conflict?
Post by: ♦ Ninja ZX-10RR ♦ on March 01, 2016, 05:49:57 PM
Weird, no errors anywhere... Can you temporarily rename /Themes/MaterialisticTheme/scripts/colpick.js to something else and see if it works?
Title: Re: My shoutbox is requiring a page refresh - jq conflict?
Post by: 420connect on March 02, 2016, 12:43:58 PM
Weird, no errors anywhere... Can you temporarily rename /Themes/MaterialisticTheme/scripts/colpick.js to something else and see if it works?

Ninja and your Ninja Skillz!  ;P

Okay.. So we've found the 'cause'...

Now to get them to play nice together!  :thumbsup:



e2a:

Solved* with the help of Google..

I've added this before/ after the troublesome .js file:

jQuery(document).ready(function($){

// original code here

  var body = $( 'body' );
});


*might not be the best solution, but it seems to be working?


Yey! :)


.. Onto the next bug! :P
Title: Re: My shoutbox is requiring a page refresh - jq conflict?
Post by: ♦ Ninja ZX-10RR ♦ on March 02, 2016, 12:55:47 PM
Ha, I guess me learning some javascript wasn't a bad idea :) So basically it's just a js variable conflict, I will have a look later if I can edit that colpick, you can rename it back to the original name, I'll download it and see if I can adapt it. It's better to adapt that one rather than SimplePortal javascript, because updates may break it again and so on.
EDIT: oh, interesting, yeah that can work, although the problem I think is that "$" that is the variable itself.
Title: Re: My shoutbox is requiring a page refresh - jq conflict?
Post by: ♦ Ninja ZX-10RR ♦ on March 02, 2016, 01:12:05 PM
In your colorpick.js remove your edit and replace all "$" (without quotes) with "£" (without quotes), but do keep a backup (much easier if you use Notepad++). It is still throwing errors into the browser console :/
Title: Re: My shoutbox is requiring a page refresh - jq conflict?
Post by: 420connect on March 03, 2016, 12:43:47 PM
Hey Ninja,

Carrying on from yesterday, If you wouldn't mind having a quick check to see if you're still receiving any errors?

I had a lightbulb moment earlier and couldn't wait to get in to try it and it seems to be working on my end anyway :)
Title: Re: My shoutbox is requiring a page refresh - jq conflict?
Post by: ♦ Ninja ZX-10RR ♦ on March 03, 2016, 01:15:15 PM
What did you change, if I may ask? It seems to work, although I am in a hurry because I gotta go to dinner, so cannot check thoroughly.
Title: Re: My shoutbox is requiring a page refresh - jq conflict?
Post by: 420connect on March 03, 2016, 01:45:17 PM
I had another look through my source files and found another mod that was trying to add it's own call to a jquery library. - simply removing that line so it reverted back to using the newest one, used in the theme solved it :)

I've just re-done my shoutbox edits too and it still seems to be Ok!
So I think that has solved it nicely!

 :thumbsup:
Title: Re: My shoutbox is requiring a page refresh - jq conflict?
Post by: ♦ Ninja ZX-10RR ♦ on March 03, 2016, 04:13:10 PM
Hmm, 2 things:
profile.css (never seen a profile.css before, but oh well...)
Code: (find) [Select]
.profile_header {
    position: relative;
    max-width: 95%;
    margin: 0 auto;
Code: (replace with) [Select]
.profile_header {
    position: relative;
    max-width: 95%;
    margin: 0 auto;
    z-index: 1;
Fixes the overlapping issue in your profile.

Removing a jquery can be nice, but not the way you did, apparently: "http://www.420connect.co.uk/forum/Themes/MaterialisticTheme/css/jquery.noty.css Failed to load resource: the server responded with a status of 404 (Not Found)", I am not sure where that is loaded nor what it was/is for :/ It looks like some kind of alerts thingy, but anyways if you included the relative code somewhere else (I did that as well, with some files), you also have to remove the string where it calls the relative file - usually it's index.template.php, but if it's from a mod it might be somewhere else...
Title: Re: My shoutbox is requiring a page refresh - jq conflict?
Post by: 420connect on March 03, 2016, 04:26:44 PM
Many thanks Flav!
(The profile.css is from a custom profile mod as you can probably guess :P)

The 'noty' stuff is a part of the alerts mod I am using, yes.
I had forgotten about it and re-enabled it, but I've again disabled it.. if doesn't want to play nice, I can live without that part of the mod :P

The .js call I removed was from another file / mod completely! :)

Thanks again  :thumbsup:
Title: Re: My shoutbox is requiring a page refresh - jq conflict?
Post by: ♦ Ninja ZX-10RR ♦ on March 03, 2016, 04:56:41 PM
It's just a css, so I am not sure why it's not there, it's supposed to be, at least. Css doesn't interfere with jquery (despite the file name...), so you can actually put that file back, or even copy its content into for example index.css and then remove that jquery.noty.css call, wherever it is.
You're welcome, btw :)
Title: Re: My shoutbox is requiring a page refresh - jq conflict?
Post by: andy on March 03, 2016, 11:27:16 PM
This refresh problem is never ending... is there no way of writing it so that it will avoid problems with other theme and mod javascript?

Unfortunately I haven’t written any real code since the late 1980s so Im no expert.

I used Nibogo's mod from SMF and it worked without problem but its a bit large compared to SP shoutbox and I would like to use ours if it works without problem.
http://custom.simplemachines.org/mods/index.php?mod=1295



Title: Re: My shoutbox is requiring a page refresh - jq conflict?
Post by: ♦ Ninja ZX-10RR ♦ on March 03, 2016, 11:31:15 PM
No need to use that one, and it has numerous issues as well (many more than some compatibility problems), I was using it back in the days, uninstalled for being fed up with bugs and errors @_@
The conflict is simple btw, some javascript variable being the same in multiple files ($), and making a mess :P
Title: Re: My shoutbox is requiring a page refresh - jq conflict?
Post by: 420connect on March 04, 2016, 02:35:12 PM

apparently: "http://www.420connect.co.uk/forum/Themes/MaterialisticTheme/css/jquery.noty.css Failed to load resource: the server responded with a status of 404 (Not Found)", I am not sure where that is loaded nor what it was/is for :/ It looks like some kind of alerts thingy, but anyways if you included the relative code somewhere else (I did that as well, with some files), you also have to remove the string where it calls the relative file - usually it's index.template.php, but if it's from a mod it might be somewhere else...

I must have read that too quickly last night. That ones easy peasy to fix! :)
* Copies jquery.noty.css from default to theme *  :thumbsup:
Title: Re: My shoutbox is requiring a page refresh - jq conflict?
Post by: ♦ Ninja ZX-10RR ♦ on March 04, 2016, 03:51:59 PM
*sigh*
Font from origin 'http://www.420connect.co.uk' has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://420connect.co.uk' is therefore not allowed access.

I'm too tired today, fought for hours against Arduino that didn't want to co-operate at all @_@
Title: Re: My shoutbox is requiring a page refresh - jq conflict?
Post by: 420connect on March 04, 2016, 03:58:06 PM
You always seem to find a new bug hehe,

Hmmm, I think I've had that before with another issue and if I remember correctly, it was an htaccess tweak needed?

Im too tired to go looking tonight but I'll try and solve it tomorrow!
Title: Re: My shoutbox is requiring a page refresh - jq conflict?
Post by: emanuele on March 04, 2016, 06:36:02 PM
This refresh problem is never ending... is there no way of writing it so that it will avoid problems with other theme and mod javascript?
Depends on the conflict.
If the conflict is just variable names, than encapsulating the code into self-invoking functions may be the way to go:
Code: [Select]
(function(){
 // code goes here.
})();
The variables scope is limited to the function and nothing exists on the outside, so no conflicts.

If the conflict is between jQuery versions... well, that's another P.I.T.A. less easy to solve.
SimplePortal 2.3.8 © 2008-2024, SimplePortal