By Gregor de Lijzer on Tuesday, 15 November 2016
Posted in Technical Issues
Likes 0
Views 240
Votes 0
Going further with my project i want to implement context menu functionality!
Therefore i downloaded a library from https://swisnl.github.io/jQuery-contextMenu/

i included it in my default.js file in .../apps/assets/scripts like

EasySocial.require()
.library('ui/resizable', 'ui/draggable', 'ui/selectable', 'moment')
.script(''<?php echo rtrim( JURI::root() , '/' );?>/media/com_easysocial/apps/group/planner/assets/scripts/context-menu/src/jquery.contextMenu.js',
'<?php echo rtrim( JURI::root() , '/' );?>/media/com_easysocial/apps/group/planner/assets/scripts/context-menu/screen.js',
'<?php echo rtrim( JURI::root() , '/' );?>/media/com_easysocial/apps/group/planner/assets/scripts/context-menu/prettify/prettify.js').done(function($) {
$.contextMenu({
selector: 'span.context-menu'
});
}


But mixing external libraries with ES seems not quite easy!
By running the script above it gives me
TypeError: $.contextMenu is not a function


Do i have to adapt external libraries for using in ES?

Thanks and good morning from Vienna
EasySocial uses it's own "requirejs" implementation to prevent conflicts with 99% of the external scripts that you have on your site and this is why, each jquery plugin that you use, needs to be wrapped around our namespace / module style.

If you are a little adventurous, see the files under /media/com_easysocial/scripts/site/vendors/ to get a glimpse of how you can wrap the module around your plugin.

Otherwise, you don't really need to extend EasySocial's script, you could just run with jQuery however you want and select the elements using jQuery. We do expose jQuery on the document by accessing it with EasySocial.$

By the way, please take note that we do not provide support for requests like this. If you need developers assistance, you can always reach us at https://crm.stackideas.com for a quote.
·
Tuesday, 15 November 2016 19:09
·
0 Likes
·
0 Votes
·
0 Comments
·
Thank you Mark for your advice and hint to post such requests under an other forum!
I'll try your suggestions and will give you Feedback asap.

Greg
·
Tuesday, 15 November 2016 19:17
·
0 Likes
·
0 Votes
·
0 Comments
·
You are most welcome
·
Tuesday, 15 November 2016 21:09
·
0 Likes
·
0 Votes
·
0 Comments
·
got it! I used the "adventerous way!!
·
Wednesday, 16 November 2016 22:03
·
0 Likes
·
0 Votes
·
0 Comments
·
Great, glad that your issues are resolved now
·
Wednesday, 16 November 2016 22:06
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post