Page 2 of 2
Problem with Jquery?
Posted: 17 Nov 2011, 23:27
by doktornotor
smallbreeds wrote:Perfect! I removed the line jQuery.noConflict();
and is working well!
Good. You really should report this to the blinky PM mod author and point him to the API docs, he is doing something weird there.
Problem with Jquery?
Posted: 17 Nov 2011, 23:31
by smallbreeds
Will do so, thanks again!
Problem with Jquery?
Posted: 19 Nov 2011, 06:31
by all4phone
First of all thank you to
Stoker, per Top Stats MOD
In view of the problem which had
smallbreeds (thanks for letting me know), I decided to check interoperability modifications Top Stats and Red Blinking PM and additionally mChat, which uses the jQuery library also.
I installed all on a clean phpbb in the order:
- Top Stats
- mChat
- Red Blinking PM
Then I checked operation:
- TopStats - no scrolling Recent Active Topics
- mChat - no sound, no slide BBCodes, smilies
- rbpm - correct operation (maybe because of install as a last)
I opened
styles/prosilver/template/overall_header.html and
I removed the phrase
noConflict - nothing happened, it does not improve
I brought back
noConflict and remove from Red Blinking PM script:
Code: Select all
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
Then I checked operation:
- TopStats - works correctly
- mChat - works correctly
- rbpm - works correctly
Conclusion: all three modifications using the jQuery library, from My experience shows that you must remove references to jQuery scripts of modifications that were installed later, as the next after the first mod wich uses jQuery.
After your conversation in this topic, I wonder about the use of noConflict and it probably would resign in the next version. I thank everyone for their voice heard in this discussion, it was very helpful for me.
Problem with Jquery?
Posted: 19 Nov 2011, 09:53
by doktornotor
all4phone wrote:After your conversation in this topic, I wonder about the use of noConflict and it probably would resign in the next version. I thank everyone for their voice heard in this discussion, it was very helpful for me.
Well, looking at your code, you seem to use it the other way round. In my
jQuery Replace Broken Images mod, I am doing this in overall_footer.html:
Code: Select all
<script type="text/javascript">
$(window).load(function() {
$("img").each(function(){
var image = $(this);
if(image.context.naturalWidth == 0 || image.readyState == 'uninitialized'){
$(image).unbind("error").attr("src", "images/404.png");
}
});
});
</script>
and it seems to work just fine without any jQuery.noConflict(); stuff. In my experience, the noConlict() API is
only useful when you need to use some other JS lib in the
same script like jQuery and you need to rescue $ as a function or variable name back from jQuery
temporarily (since $ is just an alias for jQuery otherwise.)
If you do anything else with it, it seems you just flush jQuery down the drain and it never comes back. Hmmmm.
Problem with Jquery?
Posted: 22 Nov 2011, 22:15
by all4phone
Thanks for your reply and for your help
doktornotor, probably you're right. I'll try to go the other way
.