Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.06 KB | None | 0 0
  1. /* globals window, document */
  2. ( function() {
  3.  
  4. // Find the script element
  5. var scripts = document.getElementsByTagName( "script" );
  6. var script = scripts[ scripts.length - 1 ];
  7.  
  8. // Read the modules
  9. var modules = script.getAttribute( "data-modules" );
  10. var composite = script.getAttribute( "data-composite" ) || false;
  11. var pathParts = window.location.pathname.split( "/" );
  12. var effectsAll = [
  13. "effects/effect-blind",
  14. "effects/effect-bounce",
  15. "effects/effect-clip",
  16. "effects/effect-drop",
  17. "effects/effect-explode",
  18. "effects/effect-fade",
  19. "effects/effect-fold",
  20. "effects/effect-highlight",
  21. "effects/effect-puff",
  22. "effects/effect-pulsate",
  23. "effects/effect-scale",
  24. "effects/effect-shake",
  25. "effects/effect-size",
  26. "effects/effect-slide",
  27. "effects/effect-transfer"
  28. ];
  29. var widgets = [
  30. "accordion",
  31. "autocomplete",
  32. "button",
  33. "checkboxradio",
  34. "controlgroup",
  35. "datepicker",
  36. "dialog",
  37. "draggable",
  38. "droppable",
  39. "menu",
  40. "mouse",
  41. "progressbar",
  42. "resizable",
  43. "selectable",
  44. "selectmenu",
  45. "slider",
  46. "sortable",
  47. "spinner",
  48. "tabs",
  49. "tooltip"
  50. ];
  51.  
  52. function getPath( module ) {
  53. for ( var i = 0; i < widgets.length; i++ ) {
  54. if ( widgets[ i ] === module ) {
  55. return "widgets/" + module;
  56. }
  57. }
  58. for ( var j = 0; j < effectsAll.length; j++ ) {
  59. if ( module !== "effect" ) {
  60. if ( effectsAll[ j ] === module ) {
  61. return module;
  62. }
  63. if ( effectsAll[ j ].indexOf( module ) !== -1 ) {
  64. return "effects/" + module;
  65. }
  66. }
  67. }
  68. return module;
  69. }
  70. function fixPaths( modules ) {
  71. for ( var i = 0; i < modules.length; i++ ) {
  72. modules[ i ] = getPath( modules[ i ] );
  73. }
  74. return modules;
  75. }
  76.  
  77. // Hide the page while things are loading to prevent a FOUC
  78. document.documentElement.className = "demo-loading";
  79.  
  80. require.config( {
  81. baseUrl: window.location.pathname.indexOf( "node-arc-d3/" ) !== -1 ? "node_modules/jquery-ui/ui/" : "../node_modules/jquery-ui/ui/",
  82. paths: {
  83. lodash: "../../lodash/lodash",
  84. jquery: "../external/jquery/jquery",
  85. external: "../external/",
  86. // d3sketch: "../demos/d3sketch",
  87. d3: "../../d3/build/d3",
  88. // d3: "../demos/d3.v4.min",
  89. // isthebest: "../demos/isthebest",
  90. fn_parsefile: "../demos-test/js/libraries/fn_parsefile",
  91. n3lib: "../demos-test/js/libraries/bun2-exportN3",
  92. jsonld: "../../jsonld/js/jsonld",
  93. fn_ldpsparql: "../demos-test/js/libraries/fn_ldpsparql",
  94. fn_triplemodifications: "../demos-test/js/libraries/fn_triplemodifications",
  95. parsetriples: "../demos-test/js/parsetriples",
  96. urijs: "../../urijs/src/",
  97. triplemodifications: "../demos-test/js/triplemodifications",
  98. createprimitives: "../demos-test/js/createprimitives",
  99. d3sketch: "../demos-test/js/d3sketch"
  100. // d3: "../../d3/build/d3"
  101. },
  102. shim: {
  103. "external/globalize/globalize.culture.de-DE": [ "external/globalize/globalize" ],
  104. "external/globalize/globalize.culture.ja-JP": [ "external/globalize/globalize" ]
  105. }
  106. } );
  107.  
  108. // Replace effects all shortcut modules with all the effects modules
  109. if ( modules && modules.indexOf( "effects-all" ) !== -1 ) {
  110. modules = modules.replace( /effects-all/, effectsAll.join( " " ) );
  111. }
  112.  
  113. modules = modules ? modules.replace( /^\s+|\s+$/g, "" ).split( /\s+/ ) : [];
  114. if ( !composite ) {
  115. modules.push('dialog');
  116. // modules.push( pathParts[ pathParts.length - 2 ] );
  117. }
  118. modules = fixPaths( modules );
  119.  
  120. // pull in d3sketch into the modules array so that it is available to the scripts
  121. modules.push('d3');
  122. //modules.push('d3sketch');
  123. modules.push('fn_parsefile');
  124. modules.push('lodash');
  125. modules.push('fn_ldpsparql');
  126. modules.push('fn_triplemodifications');
  127. modules.push('parsetriples');
  128. modules.push('triplemodifications');
  129. modules.push('createprimitives');
  130. modules.push('d3sketch');
  131.  
  132. require( modules, function() {
  133. var newScript = document.createElement( "script" );
  134.  
  135. document.documentElement.className = "";
  136.  
  137. newScript.text = "( function() { " + script.innerHTML + " } )();";
  138. document.body.appendChild( newScript ).parentNode.removeChild( newScript );
  139. } );
  140.  
  141. } )();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement