| 2156 | | // Might already be loaded |
| 2157 | | if(eval('typeof ' + nuPlugins[nuPlugins.length-1]) != 'undefined') |
| 2158 | | { |
| 2159 | | nuPlugins.pop(); |
| | 2167 | var p = nuPlugins.pop(); |
| | 2168 | if(typeof HTMLArea._pluginLoadStatus[p] == 'undefined') |
| | 2169 | { |
| | 2170 | // Load it |
| | 2171 | HTMLArea._pluginLoadStatus[p] = 'loading'; |
| | 2172 | HTMLArea.loadPlugin(p, |
| | 2173 | function(plugin) |
| | 2174 | { |
| | 2175 | if(eval('typeof ' + plugin) != 'undefined') |
| | 2176 | { |
| | 2177 | HTMLArea._pluginLoadStatus[plugin] = 'ready'; |
| | 2178 | } |
| | 2179 | else |
| | 2180 | { |
| | 2181 | // Actually, this won't happen, because if the script fails |
| | 2182 | // it will throw an exception preventing the callback from |
| | 2183 | // running. This will leave it always in the "loading" state |
| | 2184 | // unfortunatly that means we can't fail plugins gracefully |
| | 2185 | // by just skipping them. |
| | 2186 | HTMLArea._pluginLoadStatus[plugin] = 'failed'; |
| | 2187 | } |
| | 2188 | } |
| | 2189 | ); |
| | 2190 | retVal = false; |
| 2163 | | break; |
| 2164 | | } |
| 2165 | | } |
| 2166 | | |
| 2167 | | if(!nuPlugins.length) |
| 2168 | | { |
| 2169 | | return true; |
| 2170 | | } |
| 2171 | | |
| 2172 | | HTMLArea.loadPlugin |
| 2173 | | (nuPlugins.pop(), |
| 2174 | | function() |
| 2175 | | { |
| 2176 | | if(HTMLArea.loadPlugins(nuPlugins, callbackIfNotReady)) |
| 2177 | | { |
| 2178 | | if(typeof callbackIfNotReady == 'function') |
| 2179 | | { |
| 2180 | | callbackIfNotReady(); |
| 2181 | | } |
| 2182 | | } |
| 2183 | | } |
| 2184 | | ); |
| 2185 | | return false; |
| | 2194 | switch(HTMLArea._pluginLoadStatus[p]) |
| | 2195 | { |
| | 2196 | case 'failed': |
| | 2197 | case 'ready' : |
| | 2198 | break; |
| | 2199 | |
| | 2200 | case 'loading': |
| | 2201 | default : |
| | 2202 | document.getElementsByTagName('form').item(0).parentNode.appendChild(document.createTextNode(p)); |
| | 2203 | retVal = false; |
| | 2204 | break; |
| | 2205 | } |
| | 2206 | } |
| | 2207 | } |
| | 2208 | |
| | 2209 | if(retVal) return true; // All done, just return |
| | 2210 | |
| | 2211 | // Waiting on plugins to load, return false now and come back a bit later |
| | 2212 | // if we have to callback |
| | 2213 | if(callbackIfNotReady) |
| | 2214 | { |
| | 2215 | setTimeout(function() { if(HTMLArea.loadPlugins(plugins, callbackIfNotReady)) callbackIfNotReady(); }, 150); |
| | 2216 | } |
| | 2217 | return retVal; |