diff options
author | Madhura Jayaratne <madhura.cj@gmail.com> | 2011-09-14 06:26:50 +0400 |
---|---|---|
committer | Madhura Jayaratne <madhura.cj@gmail.com> | 2011-09-14 06:26:50 +0400 |
commit | 29a8f3f32c50d359496f56da458b68d721ddb6ab (patch) | |
tree | ace10a6a2dc1ad5f2f2db3c1a8ee2421986e4783 /js/gis_data_editor.js | |
parent | c1c81ed80aff6a870aea4fa84e05de79fb2c5836 (diff) |
Load scripts from cache when they are available
Diffstat (limited to 'js/gis_data_editor.js')
-rw-r--r-- | js/gis_data_editor.js | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/js/gis_data_editor.js b/js/gis_data_editor.js index 00cf17e017..401e19f2ee 100644 --- a/js/gis_data_editor.js +++ b/js/gis_data_editor.js @@ -89,17 +89,25 @@ function initGISEditorVisualization() { * @param token token */ function loadJSAndGISEditor(value, field, type, input_name, token) { + var head = document.getElementsByTagName('head')[0]; + var script; // Loads a set of small JS file needed for the GIS editor - loadJavascript([ 'js/jquery/jquery.svg.js', + var smallScripts = [ 'js/jquery/jquery.svg.js', 'js/jquery/jquery.mousewheel.js', 'js/jquery/jquery.event.drag-2.0.min.js', - 'js/tbl_gis_visualization.js' ]); + 'js/tbl_gis_visualization.js' ]; + + for (i = 0; i < smallScripts.length; i++) { + script = document.createElement('script'); + script.type = 'text/javascript'; + script.src = smallScripts[i]; + head.appendChild(script); + } // OpenLayers.js is BIG and takes time. So asynchronous loading would not work. // Load the JS and do a callback to load the content for the GIS Editor. - var head = document.getElementsByTagName('head')[0]; - var script = document.createElement('script'); + script = document.createElement('script'); script.type = 'text/javascript'; script.onreadystatechange = function() { |