Commit 22605e44021492f5442fce712846afa46fac200c
1 parent
93a2aad6
Exists in
master
and in
9 other branches
adding requirejs config file
Showing
2 changed files
with
58 additions
and
57 deletions
Show diff stats
index.html
| @@ -48,17 +48,16 @@ | @@ -48,17 +48,16 @@ | ||
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | function loadJavaScriptAsync(file_path){ | 50 | function loadJavaScriptAsync(file_path){ |
| 51 | - var head = document.getElementsByTagName('head')[0]; | ||
| 52 | - var script_element = document.createElement('script'); | ||
| 53 | - script_element.type = 'text/javascript'; | ||
| 54 | - script_element.src = file_path; | ||
| 55 | - head.appendChild(script_element); | ||
| 56 | } | 51 | } |
| 57 | 52 | ||
| 58 | function loadRequireJS(){ | 53 | function loadRequireJS(){ |
| 59 | - loadJavaScriptAsync(makeJSURL('js/require.js')); | 54 | + var head = document.getElementsByTagName('head')[0]; |
| 55 | + var script_element = document.createElement('script'); | ||
| 56 | + script_element.type = 'text/javascript'; | ||
| 57 | + script_element.src = makeJSURL('js/require.js'); | ||
| 58 | + script_element.setAttribute('data-main', makeJSURL('js/requirejs-config.js')); | ||
| 59 | + head.appendChild(script_element); | ||
| 60 | } | 60 | } |
| 61 | - loadRequireJS(); | ||
| 62 | loadCSSFiles(); | 61 | loadCSSFiles(); |
| 63 | </script> | 62 | </script> |
| 64 | 63 | ||
| @@ -301,58 +300,11 @@ | @@ -301,58 +300,11 @@ | ||
| 301 | </form> | 300 | </form> |
| 302 | </script> | 301 | </script> |
| 303 | 302 | ||
| 304 | - <script type='text/javascript'> | ||
| 305 | - var base = window.location.href; | ||
| 306 | - var host = window.location.host; | ||
| 307 | - var regex = new RegExp(".*" + host + '/', "g"); | ||
| 308 | - | ||
| 309 | - if(host){ | ||
| 310 | - base = base.replace(regex,''); | ||
| 311 | - }else{ | ||
| 312 | - base = base.replace('index.html',''); | ||
| 313 | - } | ||
| 314 | - base = removeUrlParameters(base); | ||
| 315 | - | ||
| 316 | - require.config({ | ||
| 317 | - baseUrl: ( base + '/js/'), | ||
| 318 | - paths: { | ||
| 319 | - jquery: 'jquery-2.1.3.min', | ||
| 320 | - jquery_ui: 'jquery-ui-1.11.4.custom/jquery-ui.min', | ||
| 321 | - jquery_cookie: 'jquery.cookie', | ||
| 322 | - handlebars: 'handlebars-v3.0.1', | ||
| 323 | - handlebars_helpers: 'handlebars-helpers', | ||
| 324 | - dotdotdot: 'jquery.dotdotdot.min', | ||
| 325 | - jquery_maxlength: 'jquery.maxlength.min', | ||
| 326 | - layout: 'layout', | ||
| 327 | - main: 'main' | ||
| 328 | - }, | ||
| 329 | - shim: { | ||
| 330 | - 'handlebars':{ | ||
| 331 | - deps: ['jquery'], | ||
| 332 | - exports: 'Handlebars' | ||
| 333 | - }, | ||
| 334 | - 'jquery_ui': { | ||
| 335 | - deps: ['jquery'] | ||
| 336 | - }, | ||
| 337 | - 'dotdotdot': { | ||
| 338 | - deps: ['jquery'] | ||
| 339 | - }, | ||
| 340 | - 'layout': { | ||
| 341 | - deps: ['jquery'] | ||
| 342 | - }, | ||
| 343 | - 'jquery_maxlength': { | ||
| 344 | - deps: ['jquery'] | ||
| 345 | - }, | ||
| 346 | - 'handlebars_helpers':{ | ||
| 347 | - deps: ['handlebars'] | ||
| 348 | - } | ||
| 349 | - } | ||
| 350 | - }); | ||
| 351 | - | ||
| 352 | - requirejs(['jquery', 'jquery_ui', 'jquery_cookie', 'handlebars', 'handlebars_helpers']); | ||
| 353 | - requirejs(['dotdotdot', 'jquery_maxlength', 'layout', 'main']); | 303 | + <script type='text/javascript' > |
| 304 | +loadRequireJS(); | ||
| 354 | </script> | 305 | </script> |
| 355 | 306 | ||
| 307 | + | ||
| 356 | </body> | 308 | </body> |
| 357 | 309 | ||
| 358 | </html> | 310 | </html> |
| @@ -0,0 +1,49 @@ | @@ -0,0 +1,49 @@ | ||
| 1 | +var base = window.location.href; | ||
| 2 | +var host = window.location.host; | ||
| 3 | +var regex = new RegExp(".*" + host + '/', "g"); | ||
| 4 | + | ||
| 5 | +if(host){ | ||
| 6 | + base = base.replace(regex,''); | ||
| 7 | +}else{ | ||
| 8 | + base = base.replace('index.html',''); | ||
| 9 | +} | ||
| 10 | +base = removeUrlParameters(base); | ||
| 11 | + | ||
| 12 | +requirejs.config({ | ||
| 13 | + baseUrl: ( base + '/js/'), | ||
| 14 | + paths: { | ||
| 15 | + jquery: 'jquery-2.1.3.min', | ||
| 16 | + jquery_ui: 'jquery-ui-1.11.4.custom/jquery-ui.min', | ||
| 17 | + jquery_cookie: 'jquery.cookie', | ||
| 18 | + handlebars: 'handlebars-v3.0.1', | ||
| 19 | + handlebars_helpers: 'handlebars-helpers', | ||
| 20 | + dotdotdot: 'jquery.dotdotdot.min', | ||
| 21 | + jquery_maxlength: 'jquery.maxlength.min', | ||
| 22 | + layout: 'layout', | ||
| 23 | + main: 'main' | ||
| 24 | + }, | ||
| 25 | + shim: { | ||
| 26 | + 'handlebars':{ | ||
| 27 | + deps: ['jquery'], | ||
| 28 | + exports: 'Handlebars' | ||
| 29 | + }, | ||
| 30 | + 'jquery_ui': { | ||
| 31 | + deps: ['jquery'] | ||
| 32 | + }, | ||
| 33 | + 'dotdotdot': { | ||
| 34 | + deps: ['jquery'] | ||
| 35 | + }, | ||
| 36 | + 'layout': { | ||
| 37 | + deps: ['jquery'] | ||
| 38 | + }, | ||
| 39 | + 'jquery_maxlength': { | ||
| 40 | + deps: ['jquery'] | ||
| 41 | + }, | ||
| 42 | + 'handlebars_helpers':{ | ||
| 43 | + deps: ['handlebars'] | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | +}); | ||
| 47 | + | ||
| 48 | +requirejs(['jquery', 'jquery_ui', 'jquery_cookie', 'handlebars', 'handlebars_helpers']); | ||
| 49 | +requirejs(['dotdotdot', 'jquery_maxlength', 'layout', 'main']); |