MyBB Community Forums

Full Version: Replacing Javascript libraries with JQuery, need help.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
OK, so I'm planning on replacing these .JS files used in headerinclude:

<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/prototype.js?ver=1603"></script>
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/general.js?ver=1603"></script>
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/popup_menu.js?ver=1600"></script>

with the one's hosted by Google, to save me some bandwidth. However, when I replace them, inline post moderation doesn't work(when I select posts they aren't highlighted and it acts like I selected nothing), can anybody tell me what else I need to replace in order for it to work right?
In the same way you can't one day decide to fill your petrol powered car with diesel, you can't just replace Prototype with jQuery because all the javascript in MyBB is written with Prototype, as that's what MyBB comes with. If you want to use Google's CDN you have to include the same libraries, not jQuery. Plus you can't replace general.js and popup_menu.js anyway as they're MyBB files, and it probably won't save you much bandwidth as the files will be cached on visitor's machines once they visit anyway if you serve them.
OK, thanks Matt, a simple 'You can't do that' would've sufficed.
You can do it if you like (http://code.google.com/apis/libraries/de...#prototype ), I was just trying to explain why it didn't/wouldn't work when you included jQuery and the drawbacks of doing it at all, as just saying you cant do it doesn't help you much.

I've found that it's often slower when trying to load the javascript from an external source as it has to make a request to the external source a lot and never seems to cache it properly so will mean it's slower for the users. We were initially going to include scripts from Google in 1.6 but decided against if for this reason among others (if we need you to use a certain version it won't always be what Google provides). Loading from the CDN has it's advantages (bandwidth (mainly for large sites though)) but you could always give it a try and see if you want to use Google or keep it local.
Check here:
http://community.mybb.com/thread-93652.html
I guess you mean Step #9. The file you possibly need is attached to that post.