jquery noconflict manage in hks level

  • Posts: 846
  • Thank you received: 92
10 years 11 months ago #169273

hi
my jquery code using $ don't work now !!!
i see in the HTML client code this javascript code
"""""
if(hikaModule) hikaModule.innerHTML = result;
if(window.jQuery && typeof(jQuery.noConflict) == "function" && !window.hkjQuery) {
window.hkjQuery = jQuery.noConflict();
}

""""""
Q1 Can we interpret this code like " HKS create a new namespace for jquery of name hkjQuery "
Q2 If yes can we create another new namespace for another jquery library( not same version ) .
Q3 howto detect the namespace of jquery if $ is use by mootool ?
Q4 si there a good way to find which extension call / manage a specific javascript file ?
Q5 is there a way to not let HKS manage javascript conflict ?

regard's

Last edit: 10 years 11 months ago by lionel75.

Please Log in or Create an account to join the conversation.

  • Posts: 26264
  • Thank you received: 4043
  • MODERATOR
10 years 11 months ago #169288

Hi,

api.jquery.com/jquery.noconflict/
We store a pointer to the jQuery object so if something break the jQuery object or the "$" (like re-include mootools after), we still can access to the jQuery object thanks to our pointer.
The code is totally safe and does not break the "jQuery" or the "$", it is just a backup of the object (using a pointer).

If your code with $ does not work, use a lamba function with a " window.jQuery" parameter.
You should have an inclusion of mootools or maybe several inclusion of jQuery (which have the bad effect to destroy the previous jQuery point and lot the jQuery module loaded ; thanks to the hkjQuery, we can still have a backup of the previous loaded jQuery).

Q3. There is no way to detect that, you have to use lamba function with "window.jQuery" or "document.id".
Q4. Analyze the code :)

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: lionel75

Please Log in or Create an account to join the conversation.

  • Posts: 846
  • Thank you received: 92
10 years 11 months ago #169354

Thank's for your reply
since my last post i answer to most of my questions by look at the code .
I discover where the mootool setting is locate in the joomla GUI BackEnd .
configuration -> display -> general display -> Image popup mode : mootool |shadowbox ( external ) |shadowbox embedded)
don't know if it make sense for many HKS users to be able to disable image popup but for how i use HKS i ll say yes )

HKS is really great and prevent incompatibilities ( it looks like AMD feature for javascript ) .

Please Log in or Create an account to join the conversation.

  • Posts: 26264
  • Thank you received: 4043
  • MODERATOR
10 years 11 months ago #169355

Hi,

Yes we did our best to have HikaShop working even if the rest of the website had some javascript troubles.
That's why we have the hkjQuery, the "Oby" library, the integration with shadowbox.
We are looking for a good replacement for the classical popups (instead of the mootools lightbox or the bootstrap popup) ; but for the moment, I did not see something which fully convinced me.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

Time to create page: 0.058 seconds
Powered by Kunena Forum