Commit 8b3f04afb51c08c6757b0f43d784575efb798974
1 parent
19095eed
Exists in
master
and in
7 other branches
--no commit message
Showing
2 changed files
with
227 additions
and
241 deletions
Show diff stats
ferramentas/graficointerativo1/dicionario.js
ferramentas/graficointerativo1/index.js
| ... | ... | @@ -192,22 +192,8 @@ i3GEOF.graficointerativo1 = { |
| 192 | 192 | function outputStatus(e) { |
| 193 | 193 | //alert("oi"); |
| 194 | 194 | } |
| 195 | - swfobject.embedSWF( | |
| 196 | - i3GEO.configura.locaplic+"/pacotes/openflashchart/open-flash-chart.swf", | |
| 197 | - "i3GEOgraficointerativo1Grafico", | |
| 198 | - "95%", | |
| 199 | - "88%", | |
| 200 | - "9.0.0", | |
| 201 | - "expressInstall.swf", | |
| 202 | - { | |
| 203 | - "get-data":"i3GEOF.graficointerativo1.tabela2dados", | |
| 204 | - "loading":"Criando grafico..." | |
| 205 | - }, | |
| 206 | - false, | |
| 207 | - false, | |
| 208 | - outputStatus | |
| 209 | - ); | |
| 210 | - var t = $i("i3GEOgraficointerativo1Grafico"); | |
| 195 | + var t = $i("i3GEOgraficointerativo1Grafico"), | |
| 196 | + dados = i3GEOF.graficointerativo1.tabela2dados; | |
| 211 | 197 | t.style.display = "block"; |
| 212 | 198 | t.style.position = "relative"; |
| 213 | 199 | t.style.top = "-5px"; |
| ... | ... | @@ -259,33 +245,33 @@ i3GEOF.graficointerativo1 = { |
| 259 | 245 | '<div class=guiaobj id="i3GEOgraficointerativo1guia1obj" style="left:1px;display:none;">' + |
| 260 | 246 | ' <p class=paragrafo >Escolha o tipo de gráfico: </p>' + |
| 261 | 247 | ' <table class=lista6 >' + |
| 262 | - ' <tr><td><img style=cursor:text; src="'+locaplic+'/imagens/oxygen/22x22/Actions-office-chart-pie-icon.png" /></td><td><input type=radio onclick="i3GEOF.graficointerativo1.ativaTipo(this)" value="pizza2d" name="tipoGrafico" style="border:0px solid white;cursor:pointer" > </td><td>pizza 2d</td></tr>' + | |
| 263 | - ' <tr><td> </td></tr>' + | |
| 264 | - ' <tr><td><img style=cursor:text; src="'+locaplic+'/imagens/oxygen/22x22/Actions-office-chart-area-stacked-icon.png" /></td><td><input type=radio onclick="i3GEOF.graficointerativo1.ativaTipo(this)" value="area" name="tipoGrafico" style="border:0px solid white;cursor:pointer" > </td><td>área 2d</td></tr>' + | |
| 265 | - ' <tr><td> </td></tr>' + | |
| 266 | - ' <tr><td><img style=cursor:text; src="'+locaplic+'/imagens/oxygen/22x22/Actions-office-chart-scatter-icon.png" /></td><td><input type=radio onclick="i3GEOF.graficointerativo1.ativaTipo(this)" value="scatter" name="tipoGrafico" style="border:0px solid white;cursor:pointer" > </td><td>distribuição de pontos</td></tr>' + | |
| 267 | - ' <tr><td> </td></tr>' + | |
| 268 | - ' <tr><td><img style=cursor:text; src="'+locaplic+'/imagens/oxygen/22x22/Actions-office-chart-line-stacked-icon.png" /></td><td><input type=radio onclick="i3GEOF.graficointerativo1.ativaTipo(this)" value="line" name="tipoGrafico" style="border:0px solid white;cursor:pointer" > </td><td>linha</td></tr>' + | |
| 269 | - ' <tr><td> </td></tr>' + | |
| 270 | - ' <tr><td><img style=cursor:text; src="'+locaplic+'/imagens/oxygen/22x22/Actions-office-chart-polar-icon.png" /></td><td><input type=radio onclick="i3GEOF.graficointerativo1.ativaTipo(this)" value="radar" name="tipoGrafico" style="border:0px solid white;cursor:pointer" > </td><td>radar</td></tr>' + | |
| 271 | - ' <tr><td> </td></tr>' + | |
| 248 | + //' <tr><td><img style=cursor:text; src="'+locaplic+'/imagens/oxygen/22x22/Actions-office-chart-pie-icon.png" /></td><td><input type=radio onclick="i3GEOF.graficointerativo1.ativaTipo(this)" value="pizza2d" name="tipoGrafico" style="border:0px solid white;cursor:pointer" > </td><td>pizza 2d</td></tr>' + | |
| 249 | + //' <tr><td> </td></tr>' + | |
| 250 | + //' <tr><td><img style=cursor:text; src="'+locaplic+'/imagens/oxygen/22x22/Actions-office-chart-area-stacked-icon.png" /></td><td><input type=radio onclick="i3GEOF.graficointerativo1.ativaTipo(this)" value="area" name="tipoGrafico" style="border:0px solid white;cursor:pointer" > </td><td>área 2d</td></tr>' + | |
| 251 | + //' <tr><td> </td></tr>' + | |
| 252 | + //' <tr><td><img style=cursor:text; src="'+locaplic+'/imagens/oxygen/22x22/Actions-office-chart-scatter-icon.png" /></td><td><input type=radio onclick="i3GEOF.graficointerativo1.ativaTipo(this)" value="scatter" name="tipoGrafico" style="border:0px solid white;cursor:pointer" > </td><td>distribuição de pontos</td></tr>' + | |
| 253 | + //' <tr><td> </td></tr>' + | |
| 254 | + //' <tr><td><img style=cursor:text; src="'+locaplic+'/imagens/oxygen/22x22/Actions-office-chart-line-stacked-icon.png" /></td><td><input type=radio onclick="i3GEOF.graficointerativo1.ativaTipo(this)" value="line" name="tipoGrafico" style="border:0px solid white;cursor:pointer" > </td><td>linha</td></tr>' + | |
| 255 | + //' <tr><td> </td></tr>' + | |
| 256 | + //' <tr><td><img style=cursor:text; src="'+locaplic+'/imagens/oxygen/22x22/Actions-office-chart-polar-icon.png" /></td><td><input type=radio onclick="i3GEOF.graficointerativo1.ativaTipo(this)" value="radar" name="tipoGrafico" style="border:0px solid white;cursor:pointer" > </td><td>radar</td></tr>' + | |
| 257 | + //' <tr><td> </td></tr>' + | |
| 272 | 258 | ' <tr><td><img style=cursor:text; src="'+locaplic+'/imagens/oxygen/22x22/Actions-office-chart-bar-icon.png" /></td><td><input type=radio onclick="i3GEOF.graficointerativo1.ativaTipo(this)" value="bar_filled" name="tipoGrafico" style="border:0px solid white;cursor:pointer" > </td><td>barras simples</td></tr>' + |
| 273 | - ' <tr><td> </td></tr>' + | |
| 274 | - ' <tr><td><img style=cursor:text; src="'+locaplic+'/imagens/oxygen/22x22/Actions-office-chart-bar-icon.png" /></td><td><input type=radio onclick="i3GEOF.graficointerativo1.ativaTipo(this)" value="bar_glass" name="tipoGrafico" style="border:0px solid white;cursor:pointer" > </td><td>barras 2 cores</td></tr>' + | |
| 275 | - ' <tr><td> </td></tr>' + | |
| 276 | - ' <tr><td><img style=cursor:text; src="'+locaplic+'/imagens/oxygen/22x22/Actions-office-chart-bar-icon.png" /></td><td><input type=radio onclick="i3GEOF.graficointerativo1.ativaTipo(this)" value="bar_3d" name="tipoGrafico" style="border:0px solid white;cursor:pointer" > </td><td>barras 3d</td></tr>' + | |
| 277 | - ' <tr><td> </td></tr>' + | |
| 278 | - ' <tr><td><img style=cursor:text; src="'+locaplic+'/imagens/oxygen/22x22/Actions-office-chart-bar-icon.png" /></td><td><input type=radio onclick="i3GEOF.graficointerativo1.ativaTipo(this)" value="bar_sketch" name="tipoGrafico" style="border:0px solid white;cursor:pointer" > </td><td>barras rascunho</td></tr>' + | |
| 279 | - ' <tr><td> </td></tr>' + | |
| 280 | - ' <tr><td><img style=cursor:text; src="'+locaplic+'/imagens/oxygen/22x22/Actions-office-chart-bar-icon.png" /></td><td><input type=radio onclick="i3GEOF.graficointerativo1.ativaTipo(this)" value="bar_cylinder" name="tipoGrafico" style="border:0px solid white;cursor:pointer" > </td><td>barras cilindro</td></tr>' + | |
| 281 | - ' <tr><td> </td></tr>' + | |
| 282 | - ' <tr><td><img style=cursor:text; src="'+locaplic+'/imagens/oxygen/22x22/Actions-office-chart-bar-icon.png" /></td><td><input type=radio onclick="i3GEOF.graficointerativo1.ativaTipo(this)" value="bar_cylinder_outline" name="tipoGrafico" style="border:0px solid white;cursor:pointer" > </td><td>barras cilindro com contorno</td></tr>' + | |
| 283 | - ' <tr><td> </td></tr>' + | |
| 284 | - ' <tr><td><img style=cursor:text; src="'+locaplic+'/imagens/oxygen/22x22/Actions-office-chart-bar-icon.png" /></td><td><input type=radio onclick="i3GEOF.graficointerativo1.ativaTipo(this)" value="bar_round_glass" name="tipoGrafico" style="border:0px solid white;cursor:pointer" > </td><td>barras cúpula</td></tr>' + | |
| 285 | - ' <tr><td> </td></tr>' + | |
| 286 | - ' <tr><td><img style=cursor:text; src="'+locaplic+'/imagens/oxygen/22x22/Actions-office-chart-bar-icon.png" /></td><td><input type=radio onclick="i3GEOF.graficointerativo1.ativaTipo(this)" value="bar_round" name="tipoGrafico" style="border:0px solid white;cursor:pointer" > </td><td>barras pílula</td></tr>' + | |
| 287 | - ' <tr><td> </td></tr>' + | |
| 288 | - ' <tr><td><img style=cursor:text; src="'+locaplic+'/imagens/oxygen/22x22/Actions-office-chart-bar-icon.png" /></td><td><input type=radio onclick="i3GEOF.graficointerativo1.ativaTipo(this)" value="hbar" name="tipoGrafico" style="border:0px solid white;cursor:pointer" > </td><td>barras horizontais</td></tr>' + | |
| 259 | + //' <tr><td> </td></tr>' + | |
| 260 | + //' <tr><td><img style=cursor:text; src="'+locaplic+'/imagens/oxygen/22x22/Actions-office-chart-bar-icon.png" /></td><td><input type=radio onclick="i3GEOF.graficointerativo1.ativaTipo(this)" value="bar_glass" name="tipoGrafico" style="border:0px solid white;cursor:pointer" > </td><td>barras 2 cores</td></tr>' + | |
| 261 | + //' <tr><td> </td></tr>' + | |
| 262 | + //' <tr><td><img style=cursor:text; src="'+locaplic+'/imagens/oxygen/22x22/Actions-office-chart-bar-icon.png" /></td><td><input type=radio onclick="i3GEOF.graficointerativo1.ativaTipo(this)" value="bar_3d" name="tipoGrafico" style="border:0px solid white;cursor:pointer" > </td><td>barras 3d</td></tr>' + | |
| 263 | + //' <tr><td> </td></tr>' + | |
| 264 | + //' <tr><td><img style=cursor:text; src="'+locaplic+'/imagens/oxygen/22x22/Actions-office-chart-bar-icon.png" /></td><td><input type=radio onclick="i3GEOF.graficointerativo1.ativaTipo(this)" value="bar_sketch" name="tipoGrafico" style="border:0px solid white;cursor:pointer" > </td><td>barras rascunho</td></tr>' + | |
| 265 | + //' <tr><td> </td></tr>' + | |
| 266 | + //' <tr><td><img style=cursor:text; src="'+locaplic+'/imagens/oxygen/22x22/Actions-office-chart-bar-icon.png" /></td><td><input type=radio onclick="i3GEOF.graficointerativo1.ativaTipo(this)" value="bar_cylinder" name="tipoGrafico" style="border:0px solid white;cursor:pointer" > </td><td>barras cilindro</td></tr>' + | |
| 267 | + //' <tr><td> </td></tr>' + | |
| 268 | + //' <tr><td><img style=cursor:text; src="'+locaplic+'/imagens/oxygen/22x22/Actions-office-chart-bar-icon.png" /></td><td><input type=radio onclick="i3GEOF.graficointerativo1.ativaTipo(this)" value="bar_cylinder_outline" name="tipoGrafico" style="border:0px solid white;cursor:pointer" > </td><td>barras cilindro com contorno</td></tr>' + | |
| 269 | + //' <tr><td> </td></tr>' + | |
| 270 | + //' <tr><td><img style=cursor:text; src="'+locaplic+'/imagens/oxygen/22x22/Actions-office-chart-bar-icon.png" /></td><td><input type=radio onclick="i3GEOF.graficointerativo1.ativaTipo(this)" value="bar_round_glass" name="tipoGrafico" style="border:0px solid white;cursor:pointer" > </td><td>barras cúpula</td></tr>' + | |
| 271 | + //' <tr><td> </td></tr>' + | |
| 272 | + //' <tr><td><img style=cursor:text; src="'+locaplic+'/imagens/oxygen/22x22/Actions-office-chart-bar-icon.png" /></td><td><input type=radio onclick="i3GEOF.graficointerativo1.ativaTipo(this)" value="bar_round" name="tipoGrafico" style="border:0px solid white;cursor:pointer" > </td><td>barras pílula</td></tr>' + | |
| 273 | + //' <tr><td> </td></tr>' + | |
| 274 | + //' <tr><td><img style=cursor:text; src="'+locaplic+'/imagens/oxygen/22x22/Actions-office-chart-bar-icon.png" /></td><td><input type=radio onclick="i3GEOF.graficointerativo1.ativaTipo(this)" value="hbar" name="tipoGrafico" style="border:0px solid white;cursor:pointer" > </td><td>barras horizontais</td></tr>' + | |
| 289 | 275 | ' </table>' + |
| 290 | 276 | '</div> ' + |
| 291 | 277 | '<div class=guiaobj id="i3GEOgraficointerativo1guia2obj" style="left:1px;display:none;top:-5px">' + |
| ... | ... | @@ -374,7 +360,7 @@ i3GEOF.graficointerativo1 = { |
| 374 | 360 | google.maps.event.removeListener(graficointerativo1Zoomend); |
| 375 | 361 | } |
| 376 | 362 | if(i3GEO.Interface.ATUAL === "googleearth"){ |
| 377 | - google.earth.removeEventListener(graficointerativo1Dragend); | |
| 363 | + google.earth.removeEventListener(graficointerativo1Dragend); | |
| 378 | 364 | } |
| 379 | 365 | if(i3GEO.eventos.ATUALIZAARVORECAMADAS.toString().search("i3GEOF.graficointerativo1.comboTemas()") > 0) |
| 380 | 366 | {i3GEO.eventos.ATUALIZAARVORECAMADAS.remove("i3GEOF.graficointerativo1.comboTemas()");} |
| ... | ... | @@ -508,24 +494,24 @@ i3GEOF.graficointerativo1 = { |
| 508 | 494 | tema, |
| 509 | 495 | function(retorno){ |
| 510 | 496 | if(retorno.tipo === "erro"){ |
| 511 | - $i("i3GEOgraficointerativo1ComboX").innerHTML = "<br><br><span style='color:red'>erro ao ler os itens do tema de origem</span><br><br>"; | |
| 512 | - $i("i3GEOgraficointerativo1ComboY").innerHTML = "<br><br><span style='color:red'>erro ao ler os itens do tema de origem</span><br><br>"; | |
| 513 | - } | |
| 514 | - else{ | |
| 515 | - $i("i3GEOgraficointerativo1ComboY").innerHTML = retorno.dados + " <input title='Digite o título' class=digitar type=text size=20 id=i3GEOgraficointerativo1ComboYidTitulo value='' />"; | |
| 516 | - $i("i3GEOgraficointerativo1ComboXid").id = "i3GEOgraficointerativo1ComboYid"; | |
| 517 | - $i("i3GEOgraficointerativo1ComboX").innerHTML = retorno.dados + " <input title='Digite o título' class=digitar type=text size=20 id=i3GEOgraficointerativo1ComboXidTitulo value='' />"; | |
| 518 | - $i("i3GEOgraficointerativo1ComboXid").style.width = "160px"; | |
| 519 | - $i("i3GEOgraficointerativo1ComboYid").style.width = "160px"; | |
| 520 | - $i("i3GEOgraficointerativo1ComboXid").onchange = function(){ | |
| 521 | - var combo = $i("i3GEOgraficointerativo1ComboXid"); | |
| 522 | - $i("i3GEOgraficointerativo1ComboXidTitulo").value = combo.options[combo.selectedIndex].label; | |
| 523 | - }; | |
| 524 | - $i("i3GEOgraficointerativo1ComboYid").onchange = function(){ | |
| 525 | - var combo = $i("i3GEOgraficointerativo1ComboYid"); | |
| 526 | - $i("i3GEOgraficointerativo1ComboYidTitulo").value = combo.options[combo.selectedIndex].label; | |
| 527 | - }; | |
| 528 | - } | |
| 497 | + $i("i3GEOgraficointerativo1ComboX").innerHTML = "<br><br><span style='color:red'>erro ao ler os itens do tema de origem</span><br><br>"; | |
| 498 | + $i("i3GEOgraficointerativo1ComboY").innerHTML = "<br><br><span style='color:red'>erro ao ler os itens do tema de origem</span><br><br>"; | |
| 499 | + } | |
| 500 | + else{ | |
| 501 | + $i("i3GEOgraficointerativo1ComboY").innerHTML = retorno.dados + " <input title='Digite o título' class=digitar type=text size=20 id=i3GEOgraficointerativo1ComboYidTitulo value='' />"; | |
| 502 | + $i("i3GEOgraficointerativo1ComboXid").id = "i3GEOgraficointerativo1ComboYid"; | |
| 503 | + $i("i3GEOgraficointerativo1ComboX").innerHTML = retorno.dados + " <input title='Digite o título' class=digitar type=text size=20 id=i3GEOgraficointerativo1ComboXidTitulo value='' />"; | |
| 504 | + $i("i3GEOgraficointerativo1ComboXid").style.width = "160px"; | |
| 505 | + $i("i3GEOgraficointerativo1ComboYid").style.width = "160px"; | |
| 506 | + $i("i3GEOgraficointerativo1ComboXid").onchange = function(){ | |
| 507 | + var combo = $i("i3GEOgraficointerativo1ComboXid"); | |
| 508 | + $i("i3GEOgraficointerativo1ComboXidTitulo").value = combo.options[combo.selectedIndex].label; | |
| 509 | + }; | |
| 510 | + $i("i3GEOgraficointerativo1ComboYid").onchange = function(){ | |
| 511 | + var combo = $i("i3GEOgraficointerativo1ComboYid"); | |
| 512 | + $i("i3GEOgraficointerativo1ComboYidTitulo").value = combo.options[combo.selectedIndex].label; | |
| 513 | + }; | |
| 514 | + } | |
| 529 | 515 | }, |
| 530 | 516 | "i3GEOgraficointerativo1ComboX", |
| 531 | 517 | "" |
| ... | ... | @@ -776,7 +762,7 @@ i3GEOF.graficointerativo1 = { |
| 776 | 762 | "title":{ |
| 777 | 763 | "text": titulo, |
| 778 | 764 | "style": "{font-size: "+tituloSize+"; color:"+tituloCor+"; text-align: "+tituloAlinhamento+";}" |
| 779 | - }, | |
| 765 | + }, | |
| 780 | 766 | "num_decimals": 2, |
| 781 | 767 | "is_fixed_num_decimals_forced": true, |
| 782 | 768 | "is_decimal_separator_comma": true, |
| ... | ... | @@ -834,7 +820,7 @@ i3GEOF.graficointerativo1 = { |
| 834 | 820 | "title":{ |
| 835 | 821 | "text": titulo, |
| 836 | 822 | "style": "{font-size: "+tituloSize+"; color:"+tituloCor+"; text-align: "+tituloAlinhamento+";}" |
| 837 | - } | |
| 823 | + } | |
| 838 | 824 | }; |
| 839 | 825 | if($i("i3GEOgraficointerativo1AdLinhas").checked){ |
| 840 | 826 | parametros.elements.push({ |
| ... | ... | @@ -863,8 +849,8 @@ i3GEOF.graficointerativo1 = { |
| 863 | 849 | "steps": parseInt((maior / divisoesY),10) |
| 864 | 850 | }; |
| 865 | 851 | parametros.y_axis = { |
| 866 | - "offset": 1, | |
| 867 | - "labels": nomes | |
| 852 | + "offset": 1, | |
| 853 | + "labels": nomes | |
| 868 | 854 | }; |
| 869 | 855 | parametros.x_legend.text = legendaY; |
| 870 | 856 | parametros.y_legend.text = legendaX; |
| ... | ... | @@ -914,8 +900,8 @@ i3GEOF.graficointerativo1 = { |
| 914 | 900 | "title":{ |
| 915 | 901 | "text": titulo, |
| 916 | 902 | "style": "{font-size: "+tituloSize+"; color:"+tituloCor+"; text-align: "+tituloAlinhamento+";}" |
| 917 | - }, | |
| 918 | - "bg_colour": "#DFFFEC" | |
| 903 | + }, | |
| 904 | + "bg_colour": "#DFFFEC" | |
| 919 | 905 | }; |
| 920 | 906 | } |
| 921 | 907 | return( JSON1.stringify(parametros)); |
| ... | ... | @@ -1004,11 +990,11 @@ i3GEOF.graficointerativo1 = { |
| 1004 | 990 | i3GEO.eventos.NAVEGAMAPA.push("i3GEOF.graficointerativo1.obterDados()"); |
| 1005 | 991 | } |
| 1006 | 992 | if(i3GEO.Interface.ATUAL === "googlemaps"){ |
| 1007 | - graficointerativo1Dragend = GEvent.addListener(i3GeoMap, "dragend", function() {i3GEOF.graficointerativo1.obterDados();}); | |
| 1008 | - graficointerativo1Zoomend = GEvent.addListener(i3GeoMap, "zoomend", function() {i3GEOF.graficointerativo1.obterDados();}); | |
| 993 | + graficointerativo1Dragend = GEvent.addListener(i3GeoMap, "dragend", function() {i3GEOF.graficointerativo1.obterDados();}); | |
| 994 | + graficointerativo1Zoomend = GEvent.addListener(i3GeoMap, "zoomend", function() {i3GEOF.graficointerativo1.obterDados();}); | |
| 1009 | 995 | } |
| 1010 | 996 | if(i3GEO.Interface.ATUAL === "googleearth"){ |
| 1011 | - graficointerativo1Dragend = google.earth.addEventListener(i3GeoMap.getView(), "viewchangeend", function() {i3GEOF.graficointerativo1.obterDados();}); | |
| 997 | + graficointerativo1Dragend = google.earth.addEventListener(i3GeoMap.getView(), "viewchangeend", function() {i3GEOF.graficointerativo1.obterDados();}); | |
| 1012 | 998 | } |
| 1013 | 999 | } |
| 1014 | 1000 | else{ |
| ... | ... | @@ -1027,177 +1013,177 @@ i3GEOF.graficointerativo1 = { |
| 1027 | 1013 | }; |
| 1028 | 1014 | //pacotes/openflashchart/json2.js |
| 1029 | 1015 | if (!this.JSON1) { |
| 1030 | - JSON1 = function () { | |
| 1031 | - | |
| 1032 | - function f(n) { // Format integers to have at least two digits. | |
| 1033 | - return n < 10 ? '0' + n : n; | |
| 1034 | - } | |
| 1035 | - Date.prototype.toJSON = function () { | |
| 1036 | - return this.getUTCFullYear() + '-' + | |
| 1037 | - f(this.getUTCMonth() + 1) + '-' + | |
| 1038 | - f(this.getUTCDate()) + 'T' + | |
| 1039 | - f(this.getUTCHours()) + ':' + | |
| 1040 | - f(this.getUTCMinutes()) + ':' + | |
| 1041 | - f(this.getUTCSeconds()) + 'Z'; | |
| 1042 | - }; | |
| 1043 | - var escapeable = /["\\\x00-\x1f\x7f-\x9f]/g, | |
| 1044 | - gap, | |
| 1045 | - indent, | |
| 1046 | - meta = { // table of character substitutions | |
| 1047 | - '\b': '\\b', | |
| 1048 | - '\t': '\\t', | |
| 1049 | - '\n': '\\n', | |
| 1050 | - '\f': '\\f', | |
| 1051 | - '\r': '\\r', | |
| 1052 | - '"' : '\\"', | |
| 1053 | - '\\': '\\\\' | |
| 1054 | - }, | |
| 1055 | - rep; | |
| 1056 | - function quote(string) { | |
| 1057 | - return escapeable.test(string) ? | |
| 1058 | - '"' + string.replace(escapeable, function (a) { | |
| 1059 | - var c = meta[a]; | |
| 1060 | - if (typeof c === 'string') { | |
| 1061 | - return c; | |
| 1062 | - } | |
| 1063 | - c = a.charCodeAt(); | |
| 1064 | - return '\\u00' + Math.floor(c / 16).toString(16) + | |
| 1065 | - (c % 16).toString(16); | |
| 1066 | - }) + '"' : | |
| 1067 | - '"' + string + '"'; | |
| 1068 | - } | |
| 1069 | - function str(key, holder) { | |
| 1070 | - var i, // The loop counter. | |
| 1071 | - k, // The member key. | |
| 1072 | - v, // The member value. | |
| 1073 | - length, | |
| 1074 | - mind = gap, | |
| 1075 | - partial, | |
| 1076 | - value = holder[key]; | |
| 1077 | - if (value && typeof value === 'object' && | |
| 1078 | - typeof value.toJSON === 'function') { | |
| 1079 | - value = value.toJSON(key); | |
| 1080 | - } | |
| 1081 | - if (typeof rep === 'function') { | |
| 1082 | - value = rep.call(holder, key, value); | |
| 1083 | - } | |
| 1084 | - switch (typeof value) { | |
| 1085 | - case 'string': | |
| 1086 | - return quote(value); | |
| 1087 | - | |
| 1088 | - case 'number': | |
| 1089 | - return isFinite(value) ? String(value) : 'null'; | |
| 1090 | - | |
| 1091 | - case 'boolean': | |
| 1092 | - case 'null': | |
| 1093 | - return String(value); | |
| 1094 | - case 'object': | |
| 1095 | - if (!value) { | |
| 1096 | - return 'null'; | |
| 1097 | - } | |
| 1098 | - gap += indent; | |
| 1099 | - partial = []; | |
| 1100 | - if (typeof value.length === 'number' && | |
| 1101 | - !(value.propertyIsEnumerable('length'))) { | |
| 1102 | - length = value.length; | |
| 1103 | - for (i = 0; i < length; i += 1) { | |
| 1104 | - partial[i] = str(i, value) || 'null'; | |
| 1105 | - } | |
| 1106 | - v = partial.length === 0 ? '[]' : | |
| 1107 | - gap ? '[\n' + gap + partial.join(',\n' + gap) + | |
| 1108 | - '\n' + mind + ']' : | |
| 1109 | - '[' + partial.join(',') + ']'; | |
| 1110 | - gap = mind; | |
| 1111 | - return v; | |
| 1112 | - } | |
| 1113 | - if (typeof rep === 'object') { | |
| 1114 | - length = rep.length; | |
| 1115 | - for (i = 0; i < length; i += 1) { | |
| 1116 | - k = rep[i]; | |
| 1117 | - if (typeof k === 'string') { | |
| 1118 | - v = str(k, value, rep); | |
| 1119 | - if (v) { | |
| 1120 | - partial.push(quote(k) + (gap ? ': ' : ':') + v); | |
| 1121 | - } | |
| 1122 | - } | |
| 1123 | - } | |
| 1124 | - } else { | |
| 1125 | - for (k in value) { | |
| 1126 | - v = str(k, value, rep); | |
| 1127 | - if (v) { | |
| 1128 | - partial.push(quote(k) + (gap ? ': ' : ':') + v); | |
| 1129 | - } | |
| 1130 | - } | |
| 1131 | - } | |
| 1132 | - v = partial.length === 0 ? '{}' : | |
| 1133 | - gap ? '{\n' + gap + partial.join(',\n' + gap) + | |
| 1134 | - '\n' + mind + '}' : | |
| 1135 | - '{' + partial.join(',') + '}'; | |
| 1136 | - gap = mind; | |
| 1137 | - return v; | |
| 1138 | - } | |
| 1139 | - } | |
| 1140 | - return { | |
| 1141 | - stringify: function (value, replacer, space) { | |
| 1142 | - var i; | |
| 1143 | - gap = ''; | |
| 1144 | - indent = ''; | |
| 1145 | - if (space) { | |
| 1146 | - if (typeof space === 'number') { | |
| 1147 | - for (i = 0; i < space; i += 1) { | |
| 1148 | - indent += ' '; | |
| 1149 | - } | |
| 1150 | - } else if (typeof space === 'string') { | |
| 1151 | - indent = space; | |
| 1152 | - } | |
| 1153 | - } | |
| 1154 | - if (!replacer) { | |
| 1155 | - rep = function (key, value) { | |
| 1156 | - if (!Object.hasOwnProperty.call(this, key)) { | |
| 1157 | - return undefined; | |
| 1158 | - } | |
| 1159 | - return value; | |
| 1160 | - }; | |
| 1161 | - } else if (typeof replacer === 'function' || | |
| 1162 | - (typeof replacer === 'object' && | |
| 1163 | - typeof replacer.length === 'number')) { | |
| 1164 | - rep = replacer; | |
| 1165 | - } else { | |
| 1166 | - throw new Error('JSON.stringify'); | |
| 1167 | - } | |
| 1168 | - return str('', {'': value}); | |
| 1169 | - }, | |
| 1170 | - parse: function (text, reviver) { | |
| 1171 | - var j; | |
| 1172 | - | |
| 1173 | - function walk(holder, key) { | |
| 1174 | - var k, v, value = holder[key]; | |
| 1175 | - if (value && typeof value === 'object') { | |
| 1176 | - for (k in value) { | |
| 1177 | - if (Object.hasOwnProperty.call(value, k)) { | |
| 1178 | - v = walk(value, k); | |
| 1179 | - if (v !== undefined) { | |
| 1180 | - value[k] = v; | |
| 1181 | - } else { | |
| 1182 | - delete value[k]; | |
| 1183 | - } | |
| 1184 | - } | |
| 1185 | - } | |
| 1186 | - } | |
| 1187 | - return reviver.call(holder, key, value); | |
| 1188 | - } | |
| 1189 | - if (/^[\],:{}\s]*$/.test(text.replace(/\\["\\\/bfnrtu]/g, '@'). | |
| 1016 | + JSON1 = function () { | |
| 1017 | + | |
| 1018 | + function f(n) { // Format integers to have at least two digits. | |
| 1019 | + return n < 10 ? '0' + n : n; | |
| 1020 | + } | |
| 1021 | + Date.prototype.toJSON = function () { | |
| 1022 | + return this.getUTCFullYear() + '-' + | |
| 1023 | + f(this.getUTCMonth() + 1) + '-' + | |
| 1024 | + f(this.getUTCDate()) + 'T' + | |
| 1025 | + f(this.getUTCHours()) + ':' + | |
| 1026 | + f(this.getUTCMinutes()) + ':' + | |
| 1027 | + f(this.getUTCSeconds()) + 'Z'; | |
| 1028 | + }; | |
| 1029 | + var escapeable = /["\\\x00-\x1f\x7f-\x9f]/g, | |
| 1030 | + gap, | |
| 1031 | + indent, | |
| 1032 | + meta = { // table of character substitutions | |
| 1033 | + '\b': '\\b', | |
| 1034 | + '\t': '\\t', | |
| 1035 | + '\n': '\\n', | |
| 1036 | + '\f': '\\f', | |
| 1037 | + '\r': '\\r', | |
| 1038 | + '"' : '\\"', | |
| 1039 | + '\\': '\\\\' | |
| 1040 | + }, | |
| 1041 | + rep; | |
| 1042 | + function quote(string) { | |
| 1043 | + return escapeable.test(string) ? | |
| 1044 | + '"' + string.replace(escapeable, function (a) { | |
| 1045 | + var c = meta[a]; | |
| 1046 | + if (typeof c === 'string') { | |
| 1047 | + return c; | |
| 1048 | + } | |
| 1049 | + c = a.charCodeAt(); | |
| 1050 | + return '\\u00' + Math.floor(c / 16).toString(16) + | |
| 1051 | + (c % 16).toString(16); | |
| 1052 | + }) + '"' : | |
| 1053 | + '"' + string + '"'; | |
| 1054 | + } | |
| 1055 | + function str(key, holder) { | |
| 1056 | + var i, // The loop counter. | |
| 1057 | + k, // The member key. | |
| 1058 | + v, // The member value. | |
| 1059 | + length, | |
| 1060 | + mind = gap, | |
| 1061 | + partial, | |
| 1062 | + value = holder[key]; | |
| 1063 | + if (value && typeof value === 'object' && | |
| 1064 | + typeof value.toJSON === 'function') { | |
| 1065 | + value = value.toJSON(key); | |
| 1066 | + } | |
| 1067 | + if (typeof rep === 'function') { | |
| 1068 | + value = rep.call(holder, key, value); | |
| 1069 | + } | |
| 1070 | + switch (typeof value) { | |
| 1071 | + case 'string': | |
| 1072 | + return quote(value); | |
| 1073 | + | |
| 1074 | + case 'number': | |
| 1075 | + return isFinite(value) ? String(value) : 'null'; | |
| 1076 | + | |
| 1077 | + case 'boolean': | |
| 1078 | + case 'null': | |
| 1079 | + return String(value); | |
| 1080 | + case 'object': | |
| 1081 | + if (!value) { | |
| 1082 | + return 'null'; | |
| 1083 | + } | |
| 1084 | + gap += indent; | |
| 1085 | + partial = []; | |
| 1086 | + if (typeof value.length === 'number' && | |
| 1087 | + !(value.propertyIsEnumerable('length'))) { | |
| 1088 | + length = value.length; | |
| 1089 | + for (i = 0; i < length; i += 1) { | |
| 1090 | + partial[i] = str(i, value) || 'null'; | |
| 1091 | + } | |
| 1092 | + v = partial.length === 0 ? '[]' : | |
| 1093 | + gap ? '[\n' + gap + partial.join(',\n' + gap) + | |
| 1094 | + '\n' + mind + ']' : | |
| 1095 | + '[' + partial.join(',') + ']'; | |
| 1096 | + gap = mind; | |
| 1097 | + return v; | |
| 1098 | + } | |
| 1099 | + if (typeof rep === 'object') { | |
| 1100 | + length = rep.length; | |
| 1101 | + for (i = 0; i < length; i += 1) { | |
| 1102 | + k = rep[i]; | |
| 1103 | + if (typeof k === 'string') { | |
| 1104 | + v = str(k, value, rep); | |
| 1105 | + if (v) { | |
| 1106 | + partial.push(quote(k) + (gap ? ': ' : ':') + v); | |
| 1107 | + } | |
| 1108 | + } | |
| 1109 | + } | |
| 1110 | + } else { | |
| 1111 | + for (k in value) { | |
| 1112 | + v = str(k, value, rep); | |
| 1113 | + if (v) { | |
| 1114 | + partial.push(quote(k) + (gap ? ': ' : ':') + v); | |
| 1115 | + } | |
| 1116 | + } | |
| 1117 | + } | |
| 1118 | + v = partial.length === 0 ? '{}' : | |
| 1119 | + gap ? '{\n' + gap + partial.join(',\n' + gap) + | |
| 1120 | + '\n' + mind + '}' : | |
| 1121 | + '{' + partial.join(',') + '}'; | |
| 1122 | + gap = mind; | |
| 1123 | + return v; | |
| 1124 | + } | |
| 1125 | + } | |
| 1126 | + return { | |
| 1127 | + stringify: function (value, replacer, space) { | |
| 1128 | + var i; | |
| 1129 | + gap = ''; | |
| 1130 | + indent = ''; | |
| 1131 | + if (space) { | |
| 1132 | + if (typeof space === 'number') { | |
| 1133 | + for (i = 0; i < space; i += 1) { | |
| 1134 | + indent += ' '; | |
| 1135 | + } | |
| 1136 | + } else if (typeof space === 'string') { | |
| 1137 | + indent = space; | |
| 1138 | + } | |
| 1139 | + } | |
| 1140 | + if (!replacer) { | |
| 1141 | + rep = function (key, value) { | |
| 1142 | + if (!Object.hasOwnProperty.call(this, key)) { | |
| 1143 | + return undefined; | |
| 1144 | + } | |
| 1145 | + return value; | |
| 1146 | + }; | |
| 1147 | + } else if (typeof replacer === 'function' || | |
| 1148 | + (typeof replacer === 'object' && | |
| 1149 | + typeof replacer.length === 'number')) { | |
| 1150 | + rep = replacer; | |
| 1151 | + } else { | |
| 1152 | + throw new Error('JSON.stringify'); | |
| 1153 | + } | |
| 1154 | + return str('', {'': value}); | |
| 1155 | + }, | |
| 1156 | + parse: function (text, reviver) { | |
| 1157 | + var j; | |
| 1158 | + | |
| 1159 | + function walk(holder, key) { | |
| 1160 | + var k, v, value = holder[key]; | |
| 1161 | + if (value && typeof value === 'object') { | |
| 1162 | + for (k in value) { | |
| 1163 | + if (Object.hasOwnProperty.call(value, k)) { | |
| 1164 | + v = walk(value, k); | |
| 1165 | + if (v !== undefined) { | |
| 1166 | + value[k] = v; | |
| 1167 | + } else { | |
| 1168 | + delete value[k]; | |
| 1169 | + } | |
| 1170 | + } | |
| 1171 | + } | |
| 1172 | + } | |
| 1173 | + return reviver.call(holder, key, value); | |
| 1174 | + } | |
| 1175 | + if (/^[\],:{}\s]*$/.test(text.replace(/\\["\\\/bfnrtu]/g, '@'). | |
| 1190 | 1176 | replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']'). |
| 1191 | 1177 | replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { |
| 1192 | - j = eval('(' + text + ')'); | |
| 1193 | - return typeof reviver === 'function' ? | |
| 1194 | - walk({'': j}, '') : j; | |
| 1195 | - } | |
| 1196 | - throw new SyntaxError('JSON.parse'); | |
| 1197 | - }, | |
| 1198 | - quote: quote | |
| 1199 | - }; | |
| 1200 | - }(); | |
| 1178 | + j = eval('(' + text + ')'); | |
| 1179 | + return typeof reviver === 'function' ? | |
| 1180 | + walk({'': j}, '') : j; | |
| 1181 | + } | |
| 1182 | + throw new SyntaxError('JSON.parse'); | |
| 1183 | + }, | |
| 1184 | + quote: quote | |
| 1185 | + }; | |
| 1186 | + }(); | |
| 1201 | 1187 | } |
| 1202 | 1188 | |
| 1203 | 1189 | ... | ... |