Web UI for ARGUS server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
4.1 KiB

6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. <title>The source code</title>
  5. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  6. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  7. </head>
  8. <body onload="prettyPrint();">
  9. <pre class="prettyprint lang-js">/*!
  10. * Ext JS Library 3.3.1
  11. * Copyright(c) 2006-2010 Sencha Inc.
  12. * licensing@sencha.com
  13. * http://www.sencha.com/license
  14. */
  15. <div id="cls-Ext.Loader"></div>/**
  16. * @class Ext.Loader
  17. * @singleton
  18. * Simple class to help load JavaScript files on demand
  19. */
  20. Ext.Loader = Ext.apply({}, {
  21. <div id="method-Ext.Loader-load"></div>/**
  22. * Loads a given set of .js files. Calls the callback function when all files have been loaded
  23. * Set preserveOrder to true to ensure non-parallel loading of files if load order is important
  24. * @param {Array} fileList Array of all files to load
  25. * @param {Function} callback Callback to call after all files have been loaded
  26. * @param {Object} scope The scope to call the callback in
  27. * @param {Boolean} preserveOrder True to make files load in serial, one after the other (defaults to false)
  28. */
  29. load: function(fileList, callback, scope, preserveOrder) {
  30. var scope = scope || this,
  31. head = document.getElementsByTagName("head")[0],
  32. fragment = document.createDocumentFragment(),
  33. numFiles = fileList.length,
  34. loadedFiles = 0,
  35. me = this;
  36. <div id="prop-Ext.Loader-var"></div>/**
  37. * Loads a particular file from the fileList by index. This is used when preserving order
  38. */
  39. var loadFileIndex = function(index) {
  40. head.appendChild(
  41. me.buildScriptTag(fileList[index], onFileLoaded)
  42. );
  43. };
  44. <div id="prop-Ext.Loader-var"></div>/**
  45. * Callback function which is called after each file has been loaded. This calls the callback
  46. * passed to load once the final file in the fileList has been loaded
  47. */
  48. var onFileLoaded = function() {
  49. loadedFiles ++;
  50. //if this was the last file, call the callback, otherwise load the next file
  51. if (numFiles == loadedFiles && typeof callback == 'function') {
  52. callback.call(scope);
  53. } else {
  54. if (preserveOrder === true) {
  55. loadFileIndex(loadedFiles);
  56. }
  57. }
  58. };
  59. if (preserveOrder === true) {
  60. loadFileIndex.call(this, 0);
  61. } else {
  62. //load each file (most browsers will do this in parallel)
  63. Ext.each(fileList, function(file, index) {
  64. fragment.appendChild(
  65. this.buildScriptTag(file, onFileLoaded)
  66. );
  67. }, this);
  68. head.appendChild(fragment);
  69. }
  70. },
  71. /**
  72. * @private
  73. * Creates and returns a script tag, but does not place it into the document. If a callback function
  74. * is passed, this is called when the script has been loaded
  75. * @param {String} filename The name of the file to create a script tag for
  76. * @param {Function} callback Optional callback, which is called when the script has been loaded
  77. * @return {Element} The new script ta
  78. */
  79. buildScriptTag: function(filename, callback) {
  80. var script = document.createElement('script');
  81. script.type = "text/javascript";
  82. script.src = filename;
  83. //IE has a different way of handling &lt;script&gt; loads, so we need to check for it here
  84. if (script.readyState) {
  85. script.onreadystatechange = function() {
  86. if (script.readyState == "loaded" || script.readyState == "complete") {
  87. script.onreadystatechange = null;
  88. callback();
  89. }
  90. };
  91. } else {
  92. script.onload = callback;
  93. }
  94. return script;
  95. }
  96. });
  97. </pre>
  98. </body>
  99. </html>