Commit 32ca85fb1861cee6ff01dd1a496d6e674f427674
1 parent
09ff5ae5
Exists in
master
and in
7 other branches
--no commit message
Showing
1 changed file
with
56 additions
and
6 deletions
Show diff stats
classesjs/classe_util.js
@@ -1293,8 +1293,8 @@ i3GEO.util = { | @@ -1293,8 +1293,8 @@ i3GEO.util = { | ||
1293 | if(!aguarde){aguarde = true;} | 1293 | if(!aguarde){aguarde = true;} |
1294 | var head,script, tipojanela = i3GEO.janela.ESTILOAGUARDE; | 1294 | var head,script, tipojanela = i3GEO.janela.ESTILOAGUARDE; |
1295 | if(!$i(id) || id === ""){ | 1295 | if(!$i(id) || id === ""){ |
1296 | - i3GEO.janela.ESTILOAGUARDE = "reduzida"; | ||
1297 | - i3GEO.janela.abreAguarde(id+"aguarde","Carregando JS"); | 1296 | + //i3GEO.janela.ESTILOAGUARDE = "reduzida"; |
1297 | + //i3GEO.janela.abreAguarde(id+"aguarde","Carregando JS"); | ||
1298 | head= document.getElementsByTagName('head')[0]; | 1298 | head= document.getElementsByTagName('head')[0]; |
1299 | script= document.createElement('script'); | 1299 | script= document.createElement('script'); |
1300 | script.type= 'text/javascript'; | 1300 | script.type= 'text/javascript'; |
@@ -2045,10 +2045,17 @@ i3GEO.util = { | @@ -2045,10 +2045,17 @@ i3GEO.util = { | ||
2045 | */ | 2045 | */ |
2046 | dialogoFerramenta: function(mensagem,dir,nome){ | 2046 | dialogoFerramenta: function(mensagem,dir,nome){ |
2047 | if(typeof(console) !== 'undefined'){console.info(mensagem);} | 2047 | if(typeof(console) !== 'undefined'){console.info(mensagem);} |
2048 | + var js = i3GEO.configura.locaplic+"/ferramentas/"+dir+"/index.js.php"; | ||
2048 | if(!$i("i3GEOF."+nome+"_script")){ | 2049 | if(!$i("i3GEOF."+nome+"_script")){ |
2049 | - var js = i3GEO.configura.locaplic+"/ferramentas/"+dir+"/index.js.php"; | ||
2050 | - i3GEO.util.scriptTag(js,"i3GEOF."+nome+".criaJanelaFlutuante()","i3GEOF."+nome+"_script"); | 2050 | + i3GEO.janela.ESTILOAGUARDE = "reduzida"; |
2051 | + i3GEO.util.multiStep( | ||
2052 | + [i3GEO.janela.abreAguarde,i3GEO.util.scriptTag], | ||
2053 | + [["i3GEOF."+nome+"_script"+"aguarde","Carregando JS"],[js,"i3GEOF."+nome+".criaJanelaFlutuante()","i3GEOF."+nome+"_script"]], | ||
2054 | + function(){} | ||
2055 | + ); | ||
2051 | } | 2056 | } |
2057 | + else | ||
2058 | + {i3GEO.util.scriptTag(js,"i3GEOF."+nome+".criaJanelaFlutuante()","i3GEOF."+nome+"_script");} | ||
2052 | }, | 2059 | }, |
2053 | /* | 2060 | /* |
2054 | Function: intersectaBox | 2061 | Function: intersectaBox |
@@ -2269,7 +2276,50 @@ i3GEO.util = { | @@ -2269,7 +2276,50 @@ i3GEO.util = { | ||
2269 | var txt = "¬" + matriz.join("¬") + "¬"; | 2276 | var txt = "¬" + matriz.join("¬") + "¬"; |
2270 | var er = new RegExp ("¬" + x + "¬", "gim"); | 2277 | var er = new RegExp ("¬" + x + "¬", "gim"); |
2271 | return ( (txt.match (er)) ? true : false ); | 2278 | return ( (txt.match (er)) ? true : false ); |
2272 | - } | 2279 | + }, |
2280 | + timedProcessArray: function(items,process,callback){ | ||
2281 | + var todo = items.concat(); | ||
2282 | + setTimeout(function() { | ||
2283 | + var start = +new Date(); | ||
2284 | + do{ | ||
2285 | + process(todo.shift()); | ||
2286 | + } while (todo.length > 0 && (+new date() - start < 50)); | ||
2287 | + if (todo.length > 0){ | ||
2288 | + setTimeout(arguments.callee,25); | ||
2289 | + } | ||
2290 | + else{ | ||
2291 | + callback(items); | ||
2292 | + } | ||
2293 | + },25); | ||
2294 | + }, | ||
2295 | + /* | ||
2296 | + Function: multiStep | ||
2297 | + | ||
2298 | + Implementa a técnica de particionamento para execussão de funções no modo assíncrono | ||
2299 | + | ||
2300 | + Conforme página 144 do livro "Javascript de alto desempenho, Nicholas Zakas | ||
2301 | + | ||
2302 | + Parâmetros: | ||
2303 | + | ||
2304 | + steps {array} - funções que serão executadas | ||
2305 | + | ||
2306 | + args {array} - array de arrays com os argumentos de cada função | ||
2307 | + | ||
2308 | + callback {function} - função que será executada ao terminar os processos | ||
2309 | + */ | ||
2310 | + multiStep: function(steps,args,callback){ | ||
2311 | + var tasks = steps.concat();//cria um clone | ||
2312 | + setTimeout(function(){ | ||
2313 | + var task = tasks.shift(), | ||
2314 | + a = args.shift(); | ||
2315 | + task.apply(null, a || []); | ||
2316 | + if(tasks.length > 0){ | ||
2317 | + setTimeout(arguments.callee,25); | ||
2318 | + } else { | ||
2319 | + callback(); | ||
2320 | + } | ||
2321 | + },25); | ||
2322 | + } | ||
2273 | }; | 2323 | }; |
2274 | //++++++++++++++++++++++++++++++++++++ | 2324 | //++++++++++++++++++++++++++++++++++++ |
2275 | // YUI ACCORDION | 2325 | // YUI ACCORDION |
@@ -2418,7 +2468,7 @@ try{ | @@ -2418,7 +2468,7 @@ try{ | ||
2418 | animation.animate(); | 2468 | animation.animate(); |
2419 | } | 2469 | } |
2420 | } | 2470 | } |
2421 | - }; | 2471 | + } |
2422 | } | 2472 | } |
2423 | catch(e){} | 2473 | catch(e){} |
2424 | // | 2474 | // |