Referencing Third-Party JavaScript Libraries and Files in Customized Widgets
If the custom widget uses third-party JavaScript libraries, images, and other Web artifacts, the best practice is to create a subfolder in the widget folder /ui/<widgetname>. Add these files in the subfolder. For example, if you create a subfolder jslibrary, the third-party files should be added in the following location:
/ui/<widgetname>/<jslibrary>/
These files can be referenced from the *.ide.js and *.runtime.js files using the following relative path:
../Common/extensions/<extensionname>/ui/<widgetname>/<jslibrary>/
The following example shows how to include a third-party JavaScript library and CSS into your widget code:
if (!jQuery().qtip) {
$("body").append('<script type="text/javascript"
src="../Common/extensions/MyExtension/ui/mywidget/
include/qtip/jquery.qtip.js"></script>');
$("head").append('<link type="text/css"
rel="stylesheet" href="
../Common/extensions/MyExtension/ui/mywidget/include/
qtip/jquery.qtip.css" />');
}
Was this helpful?