Skip to content

Instantly share code, notes, and snippets.

@Yomiji
Created July 12, 2016 15:03
Show Gist options
  • Save Yomiji/1782927b56b4aa486873d3418ff18ae3 to your computer and use it in GitHub Desktop.
Save Yomiji/1782927b56b4aa486873d3418ff18ae3 to your computer and use it in GitHub Desktop.
Optimized version of F. Kranenburg's IBM Domino XPages AMD fix
<!-- Optimized Kranenburg AMD Fix Snippet -->
<!-- Original at: https://openntf.org/xsnippets.nsf/snippet.xsp?id=hack-to-use-jquery-amd-widgets-and-dojo-together -->
<xp:text escape="false">
<xp:this.value><![CDATA[
<script>
${javascript:"if (typeof define === 'function' && define.amd) {if(define.amd.vendor =='dojotoolkit.org'){define._amd = define.amd;delete define.amd;}}";}
</script>
]]>
</xp:this.value>
</xp:text>
<!-- Adding custom jquery version to load a custom plugin from another bootstrap version :P -->
<!-- gentelella jquery -->
<script src="gentelella/vendors/jquery/dist/jquery.min.js"></script>
<!-- Bootstrap Tab -->
<script src="gentelella/vendors/bootstrap/js/tab.js"></script>
<!-- Strip out the newly loaded jQuery to safely continue page generation -->
<!-- Use this dom element object later to utilize the plugin with the correct jQuery version -->
<script>
var dom = {};
dom.gQuery = jQuery.noConflict(true);
</script>
<!-- Restore dojo AMD per the original pattern -->
<xp:text escape="false">
<xp:this.value><![CDATA[
<script>
${javascript:"if (typeof define === 'function' && define._amd) {define.amd = define._amd; delete define._amd;}"}
</script>
]]>
</xp:this.value>
</xp:text>
<!-- /Optimized Kranenburg AMD Fix Snippet -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment