1function _array_like_to_array(arr, len) { 2 if (len == null || len > arr.length) len = arr.length; 3 for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i]; 4 return arr2; 5} 6function _array_without_holes(arr) { 7 if (Array.isArray(arr)) return _array_like_to_array(arr); 8} 9function _class_call_check(instance, Constructor) { 10 if (!(instance instanceof Constructor)) { 11 throw new TypeError("Cannot call a class as a function"); 12 } 13} 14function _defineProperties(target, props) { 15 for(var i = 0; i < props.length; i++){ 16 var descriptor = props[i]; 17 descriptor.enumerable = descriptor.enumerable || false; 18 descriptor.configurable = true; 19 if ("value" in descriptor) descriptor.writable = true; 20 Object.defineProperty(target, descriptor.key, descriptor); 21 } 22} 23function _create_class(Constructor, protoProps, staticProps) { 24 if (protoProps) _defineProperties(Constructor.prototype, protoProps); 25 if (staticProps) _defineProperties(Constructor, staticProps); 26 return Constructor; 27} 28function _define_property(obj, key, value) { 29 if (key in obj) { 30 Object.defineProperty(obj, key, { 31 value: value, 32 enumerable: true, 33 configurable: true, 34 writable: true 35 }); 36 } else { 37 obj[key] = value; 38 } 39 return obj; 40} 41function _iterable_to_array(iter) { 42 if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); 43} 44function _non_iterable_spread() { 45 throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 46} 47function _object_spread(target) { 48 for(var i = 1; i < arguments.length; i++){ 49 var source = arguments[i] != null ? arguments[i] : {}; 50 var ownKeys = Object.keys(source); 51 if (typeof Object.getOwnPropertySymbols === "function") { 52 ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) { 53 return Object.getOwnPropertyDescriptor(source, sym).enumerable; 54 })); 55 } 56 ownKeys.forEach(function(key) { 57 _define_property(target, key, source[key]); 58 }); 59 } 60 return target; 61} 62function ownKeys(object, enumerableOnly) { 63 var keys = Object.keys(object); 64 if (Object.getOwnPropertySymbols) { 65 var symbols = Object.getOwnPropertySymbols(object); 66 if (enumerableOnly) { 67 symbols = symbols.filter(function(sym) { 68 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 69 }); 70 } 71 keys.push.apply(keys, symbols); 72 } 73 return keys; 74} 75function _object_spread_props(target, source) { 76 source = source != null ? source : {}; 77 if (Object.getOwnPropertyDescriptors) { 78 Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); 79 } else { 80 ownKeys(Object(source)).forEach(function(key) { 81 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 82 }); 83 } 84 return target; 85} 86function _to_consumable_array(arr) { 87 return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread(); 88} 89function _unsupported_iterable_to_array(o, minLen) { 90 if (!o) return; 91 if (typeof o === "string") return _array_like_to_array(o, minLen); 92 var n = Object.prototype.toString.call(o).slice(8, -1); 93 if (n === "Object" && o.constructor) n = o.constructor.name; 94 if (n === "Map" || n === "Set") return Array.from(n); 95 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen); 96} 97import $ from "jquery"; 98import Swal from "sweetalert2"; 99import TextosUtils from "./TextosUtils.js"; 100import Cortina from "./Cortina.js"; 101var Pizarra = /*#__PURE__*/ function() { 102 "use strict"; 103 function Pizarra(state, listado) { 104 _class_call_check(this, Pizarra); 105 _define_property(this, "state", void 0); 106 _define_property(this, "listado", void 0); 107 _define_property(this, "cortina", void 0); 108 _define_property(this, "nUltimaZonaPresentada", 1); 109 _define_property(this, "nUltimoTextoPresentado", -1); 110 _define_property(this, "tiempoInicialZona", []); 111 _define_property(this, "configuracion", { 112 modoTrabajo: "modoEditar", 113 desbordamientoHorizontal: false, 114 solo1Zona: false, 115 negrita: false,
116 cursiva: false, 117 subrayado: false, 118 BordesLetras: false, 119 BordesEspacios: false, 120 SilabaTonica: false, 121 BarajarBloques: false, 122 EncolumnarBloques: false, 123 nFilasTabla: 4, 124 nColsTabla: 5, 125 TipoColorear: "Fijo", 126 ColorFijo: "0000ff", 127 ColorTitulos: "000000", 128 ColorMarco: "000000", 129 ColorPizarra: "000000", 130 ColorAleatorio: [ 131 "e4f3d8", 132 "afcacc", 133 "ffa02e", 134 "e80560", 135 "331d4a", 136 "3d1c00", 137 "86b8b1", 138 "f2d694", 139 "fa2a00", 140 "f0d8a8" 141 ], 142 ColorAleatorioActivo: [ 143 true, 144 true, 145 true, 146 true, 147 true, 148 true, 149 true, 150 true, 151 true, 152 true 153 ], 154 PatronActivo: [ 155 true, 156 false, 157 false, 158 false 159 ], 160 PatronLista: [ 161 "", 162 "", 163 "", 164 "" 165 ], 166 PatronColor: [ 167 "0000ff", 168 "ff0000", 169 "ff0000", 170 "ff0000" 171 ], 172 PatronTamano: [ 173 "normal", 174 "normal", 175 "normal", 176 "normal" 177 ] 178 }); 179 _define_property(this, "estiloInicial", { 180 activar: true, 181 tipoTrocear: "Silabas", 182 tamanoLetra: "60px", 183 tipoLetra: "massallera_0", 184 tipoAlinear: "Centro", 185 margenIzq: "0px", 186 margenDer: "0px", 187 margenSup: "10px", 188 espaciadoEntreLineas: "150%", 189 espaciadoEntreLetras: "0px", 190 espaciadoEntrePalabras: "0px", 191 capitalizar: "0", 192 texto: "", 193 alto: "" 194 }); 195 _define_property(this, "estilosZonas", [ 196 this.crearEstiloInicial(), 197 this.crearEstiloInicial(), 198 this.crearEstiloInicial(), 199 this.crearEstiloInicial(), 200 this.crearEstiloInicial() // Zona4 201 ]); 202 _define_property(this, "ignorarSolo1Visible", false) //variable para detectar que cuando se copien a las 4 zonas se muestren auqneu esté activado sol1visible 203 ; 204 _define_property(this, "ultimoTipoAlinearPresentado", "Centro"); 205 _define_property(this, "tiposAlinear", [ 206 "", 207 "Izquierda", 208 "Centro", 209 "Derecha", 210 "Justificada", 211 "Secuencial", 212 "Aleatoria" 213 ]); 214 _define_property(this, "tiposDeLetras", [ 215 { 216 title: "Script / escolar o ligada", 217 fonts: [ 218 { 219 name: "massallera_0", 220 title: "Massallera" 221 }, 222 { 223 name: "KatamotzIkasi", 224 title: "KatamotzIkasi" 225 } 226 ] 227 }, 228 { 229 title: "Letras sin serifa", 230 fonts: [ 231 { 232 name: "Roboto-Regular", 233 title: "Roboto" 234 }, 235 { 236 name: "Anuphan-VariableFont_wght", 237 title: "Anuphan" 238 }, 239 { 240 name: "Outfit-VariableFont_wght", 241 title: "Outfit" 242 }, 243 { 244 name: "PlaypenSans-VariableFont_wght", 245 title: "PlaypenSans" 246 }, 247 { 248 name: "MontserratAlternates-Regular", 249 title: "Montserrat Alternates" 250 } 251 ] 252 }, 253 { 254 title: "Letras con serifa", 255 fonts: [ 256 { 257 name: "RobotoSerif-Italic-VariableFont_GRAD,opsz,w
257dth,wght", 258 title: "RobotoSerif" 259 }, 260 { 261 name: "OpenSans-VariableFont_wdth,wght", 262 title: "OpenSans" 263 }, 264 { 265 name: "Arapey-Regular", 266 title: "Arapey" 267 }, 268 { 269 name: "Maitree-Regular", 270 title: "Maitree" 271 }, 272 { 273 name: "Diphylleia-Regular", 274 title: "Diphylleia-Regular" 275 }, 276 { 277 name: "FontdinerSwanky", 278 title: "FontdinerSwanky-Regular" 279 } 280 ] 281 }, 282 { 283 title: "Imitando la escritura manual", 284 fonts: [ 285 { 286 name: "Caveat-VariableFont_wght", 287 title: "Caveat" 288 }, 289 { 290 name: "GloriaHallelujah-Regular", 291 title: "GloriaHallelujah" 292 }, 293 { 294 name: "LaBelleAurore-Regular", 295 title: "LaBelleAurore" 296 }, 297 { 298 name: "Sacramento-Regular", 299 title: "Sacramento" 300 }, 301 { 302 name: "DawningofaNewDay-Regular", 303 title: "DawningofaNewDay" 304 }, 305 { 306 name: "RougeScript-Regular", 307 title: "RougeScript" 308 } 309 ] 310 } 311 ]); 312 _define_property(this, "Zonas", void 0); 313 _define_property(this, "Zona1", void 0); 314 _define_property(this, "Zona2", void 0); 315 _define_property(this, "Zona3", void 0); 316 _define_property(this, "Zona4", void 0); 317 _define_property(this, "Bloques", []); 318 _define_property(this, "timerLecturaAutomatica", void 0); 319 _define_property(this, "lecturaAutomaticaActiva", false); 320 _define_property(this, "presentacionAutomaticaTimer", void 0); 321 _define_property(this, "presentacionAutomaticaDesactivarTimer", void 0); 322 _define_property(this, "presentacionAutomaticaActiva", false); 323 _define_property(this, "presentacionAutomaticaZonas", []); 324 _define_property(this, "presentacionAutomaticaIndex", 0); 325 _define_property(this, "idInter1", ""); 326 _define_property(this, "idInter2", ""); 327 _define_property(this, "nColorDelTrozo", 0); 328 this.state = state; 329 this.listado = listado; 330 this.Zonas = document.getElementById("Zonas"); 331 this.Zona1 = document.getElementById("Zona1"); 332 this.Zona2 = document.getElementById("Zona2"); 333 this.Zona3 = document.getElementById("Zona3"); 334 this.Zona4 = document.getElementById("Zona4"); 335 this.cortina = new Cortina(this); 336 this.configurarProps(state); 337 this.configurarCallbacks(); 338 this.configurarTabla(); 339 } 340 _create_class(Pizarra, [ 341 { 342 /** 343 * @see on('mousemove', '[data-filas]') 344 */ key: "configurarTabla", 345 value: function configurarTabla() { 346 var max = 0; 347 for(var index = 1; index <= 4; index++){ 348 var n = this.getNumeroBloquesEnZona(index); 349 if (n > max) { 350 max = n; 351 } 352 } 353 var html = ""; 354 for(var filas = 1; filas <= 15; filas++){ 355 html += "<tr>"; 356 for(var columnas = 1; columnas <= 15; columnas++){ 357 var i = filas * columnas; 358 if (i <= max) { 359 html += '<td class="tabla-disabled" data-filas="'.concat(filas, '" data-columnas="').concat(columnas, '"> </td>'); 360 } else { 361 html += '<td data-filas="'.concat(filas, '" data-columnas="').concat(columnas, '"> </td>'); 362 } 363 } 364 html += "</tr>"; 365 } 366 html = "Numero de bloques en pizarras: ".concat(max, ' <table class="table-small tabla-encolumnar">').concat(html, '</table> <div id="tabla-encolumnar-dimension">0 filas, 0 columnas, 0 bloques</div> '); 367 document.getElementById("tablaSeleccion").innerHTML = html; 368 } 369 }, 370 { 371 key: "configurarProps", 372 value: function configurarProps(state) { 373 var _this = this; 374 state.addProp("nUltimaZonaPresentada", function() { 375 return _this.nUltimaZonaPresentada.toString(); 376 }, function(a) { 377 return _this.nUltimaZonaPresentada = parseInt(a); 378 }); 379 state.addProp("nUltimoTextoPresentado", function() { 380 return _this.nUltimoTextoPresentado.toString(); 381 }, function(a) { 382 return _this.nUltimoTextoPresentado = parseInt(a); 383 }); 384 state.addProp("TextoZona1", function() { 385 return _this.estilosZonas[1].texto; 386 }, function(a) { 387 return _this.estilosZonas[1].texto = a; 388 }); 389 state.addProp("TextoZona2", function() { 390 return _this.estilosZonas[2].texto; 391 }, function(a) { 392 return _this.estilosZonas[2].texto = a; 393 }); 394 state.addProp("TextoZona3", function() { 395 return _this.estilosZonas[3].texto; 396 }, function(a) { 397 return _this.estilosZonas[3].texto = a; 398 }); 399 state.addProp("TextoZona4", function() { 400 return _this.estilosZonas[4].texto; 401 }, function(a) { 402 return _this.estilosZonas[4].texto = a; 403 }); 404 state.addProp("TipoLetra0", function() { 405 return _this.estilosZonas[0].tipoLetra; 406 }, function(a) { 407 return _this.estilosZonas[0].tipoLetra = a; 408 }); 409 state.addProp("TipoLetra1", function() { 410 return _this.estilosZonas[1].tipoLetra; 411 }, function(a) { 412 return _this.estilosZonas[1].tipoLetra = a; 413 }); 414 state.addProp("TipoLetra2", function() { 415 return _this.estilosZonas[2].tipoLetra; 416 }, function(a) { 417 return _this.estilosZonas[2].tipoLetra = a; 418 }); 419 state.addProp("TipoLetra3", function() { 420 return _this.estilosZonas[3].tipoLetra; 421 }, function(a) { 422 return _this.estilosZonas[3].tipoLetra = a; 423 }); 424 state.addProp("TipoLetra4", function() { 425 return _this.estilosZonas[4].tipoLetra; 426 }, function(a) { 427 return _this.estilosZonas[4].tipoLetra = a; 428 }); 429 state.addProp("TipoAlinear0", function() { 430 return _this.estilosZonas[0].tipoAlinear; 431 }, function(a) { 432 return _this.estilosZonas[0].tipoAlinear = a; 433 }); 434 state.addProp("TipoAlinear1", function() { 435 return _this.estilosZonas[1].tipoAlinear; 436 }, function(a) { 437 return _this.estilosZonas[1].tipoAlinear = a; 438 }); 439 state.addProp("TipoAlinear2", function() { 440 return _this.estilosZonas[2].tipoAlinear; 441 }, function(a) { 442 return _this.estilosZonas[2].tipoAlinear = a; 443 }); 444 state.addProp("TipoAlinear3", function() { 445 return _this.estilosZonas[3].tipoAlinear; 446 }, function(a) { 447 return _this.estilosZonas[3].tipoAlinear = a; 448 }); 449 state.addProp("TipoAlinear4", function() { 450 return _this.estilosZonas[4].tipoAlinear; 451 }, function(a) { 452 return _this.estilosZonas[4].tipoAlinear = a; 453 }); 454 state.addProp("TamanoLetra0", function() { 455 return _this.estilosZonas[0].tamanoLetra; 456 }, function(a) { 457 return _this.estilosZonas[0].tamanoLetra = a; 458 }); 459 state.addProp("TamanoLetra1", function() { 460 return _this.estilosZonas[1].tamanoLetra; 461 }, function(a) { 462 return _this.estilosZonas[1].tamanoLetra = a; 463 }); 464 state.addProp("TamanoLetra2", function() { 465 return _this.estilosZonas[2].tamanoLetra; 466 }, function(a) { 467 return _this.estilosZonas[2].tamanoLetra = a; 468 }); 469 state.addProp("TamanoLetra3", function() { 470 return _this.estilosZonas[3].tamanoLetra; 471 }, function(a) { 472 return _this.estilosZonas[3].tamanoLetra = a; 473 }); 474 state.addProp("TamanoLetra4", function() { 475 return _this.estilosZonas[4].tamanoLetra; 476 }, function(a) { 477 return _this.estilosZonas[4].tamanoLetra = a; 478 }); 479 state.addProp("TipoTrocear0", function() { 480 return _this.estilosZonas[0].tipoTrocear; 481 }, function(a) { 482 return _this.estilosZonas[0].tipoTrocear = a; 483 }); 484 state.addProp("TipoTrocear1", function() { 485 return _this.estilosZonas[1].tipoTrocear; 486 }, function(a) { 487 return _this.estilosZonas[1].tipoTrocear = a; 488 }); 489 state.addProp("TipoTrocear2", function() { 490 return _this.estilosZonas[2].tipoTrocear; 491 }, function(a) { 492 return _this.estilosZonas[2].tipoTrocear = a; 493 }); 494 state.addProp("TipoTrocear3", function() { 495 return _this.estilosZonas[3].tipoTrocear; 496 }, function(a) { 497 return _this.estilosZonas[3].tipoTrocear = a; 498 }); 499 state.addProp("TipoTrocear4", function() { 500 return _this.estilosZonas[4].tipoTrocear; 501 }, function(a) { 502 return _this.estilosZonas[4].tipoTrocear = a; 503 }); 504 state.addProp("MargenSuperior0", function() { 505 return _this.estilosZonas[0].margenSup; 506 }, function(a) { 507 return _this.estilosZonas[0].margenSup = a; 508 }); 509 state.addProp("MargenSuperior1", function() { 510 return _this.estilosZonas[1].margenSup; 511 }, function(a) { 512 return _this.estilosZonas[1].margenSup = a; 513 }); 514 state.addProp("MargenSuperior2", function() { 515 return _this.estilosZonas[2].margenSup; 516 }, function(a) { 517 return _this.estilosZonas[2].margenSup = a; 518 }); 519 state.addProp("MargenSuperior3", function() { 520 return _this.estilosZonas[3].margenSup; 521 }, function(a) { 522 return _this.estilosZonas[3].margenSup = a; 523 }); 524 state.addProp("MargenSuperior4", function() { 525 return _this.estilosZonas[4].margenSup; 526 }, function(a) { 527 return _this.estilosZonas[4].margenSup = a; 528 }); 529 state.addProp("MargenIzquierdo0", function() { 530 return _this.estilosZonas[0].margenIzq; 531 }, function(a) { 532 return _this.estilosZonas[0].margenIzq = a; 533 }); 534 state.addProp("MargenIzquierdo1", function() { 535 return _this.estilosZonas[1].margenIzq; 536 }, function(a) { 537 return _this.estilosZonas[1].margenIzq = a; 538 }); 539 state.addProp("MargenIzquierdo2", function() { 540 return _this.estilosZonas[2].margenIzq; 541 }, function(a) { 542 return _this.estilosZonas[2].margenIzq = a; 543 }); 544 state.addProp("MargenIzquierdo3", function() { 545 return _this.estilosZonas[3].margenIzq; 546 }, function(a) { 547 return _this.estilosZonas[3].margenIzq = a; 548 }); 549 state.addProp("MargenIzquierdo4", function() { 550 return _this.estilosZonas[4].margenIzq; 551 }, function(a) { 552 return _this.estilosZonas[4].margenIzq = a; 553 }); 554 state.addProp("MargenDerecho0", function() { 555 return _this.estilosZonas[0].margenDer; 556 }, function(a) { 557 return _this.estilosZonas[0].margenDer = a; 558 }); 559 state.addProp("MargenDerecho1", function() { 560 return _this.estilosZonas[1].margenDer; 561 }, function(a) { 562 return _this.estilosZonas[1].margenDer = a; 563 }); 564 state.addProp("MargenDerecho2", function() { 565 return _this.estilosZonas[2].margenDer; 566 }, function(a) { 567 return _this.estilosZonas[2].margenDer = a; 568 }); 569 state.addProp("MargenDerecho3", function() { 570 return _this.estilosZonas[3].margenDer; 571 }, function(a) { 572 return _this.estilosZonas[3].margenDer = a; 573 }); 574 state.addProp("MargenDerecho4", function() { 575 return _this.estilosZonas[4].margenDer; 576 }, function(a) { 577 return _this.estilosZonas[4].margenDer = a; 578 }); 579 state.addProp("EspaciadoEntreLineas0", function() { 580 return _this.estilosZonas[0].espaciadoEntreLineas; 581 }, function(a) { 582 return _this.estilosZonas[0].espaciadoEntreLineas = a; 583 }); 584 state.addProp("EspaciadoEntreLineas1", function() { 585 return _this.estilosZonas[1].espaciadoEntreLineas; 586 }, function(a) { 587 return _this.estilosZonas[1].espaciadoEntreLineas = a; 588 }); 589 state.addProp("EspaciadoEntreLineas2", function() { 590 return _this.estilosZonas[2].espaciadoEntreLineas; 591 }, function(a) { 592 return _this.estilosZonas[2].espaciadoEntreLineas = a; 593 }); 594 state.addProp("EspaciadoEntreLineas3", function() { 595 return _this.estilosZonas[3].espaciadoEntreLineas; 596 }, function(a) { 597 return _this.estilosZonas[3].espaciadoEntreLineas = a; 598 }); 599 state.addProp("EspaciadoEntreLineas4", function() { 600 return _this.estilosZonas[4].espaciadoEntreLineas; 601 }, function(a) { 602 return _this.estilosZonas[4].espaciadoEntreLineas = a; 603 }); 604 state.addProp("EspaciadoEntreLetras0", function() { 605 return _this.estilosZonas[0].espaciadoEntreLetras; 606 }, function(a) { 607 return _this.estilosZonas[0].espaciadoEntreLetras
607= a; 608 }); 609 state.addProp("EspaciadoEntreLetras1", function() { 610 return _this.estilosZonas[1].espaciadoEntreLetras; 611 }, function(a) { 612 return _this.estilosZonas[1].espaciadoEntreLetras = a; 613 }); 614 state.addProp("EspaciadoEntreLetras2", function() { 615 return _this.estilosZonas[2].espaciadoEntreLetras; 616 }, function(a) { 617 return _this.estilosZonas[2].espaciadoEntreLetras = a; 618 }); 619 state.addProp("EspaciadoEntreLetras3", function() { 620 return _this.estilosZonas[3].espaciadoEntreLetras; 621 }, function(a) { 622 return _this.estilosZonas[3].espaciadoEntreLetras = a; 623 }); 624 state.addProp("EspaciadoEntreLetras4", function() { 625 return _this.estilosZonas[4].espaciadoEntreLetras; 626 }, function(a) { 627 return _this.estilosZonas[4].espaciadoEntreLetras = a; 628 }); 629 state.addProp("EspaciadoEntrePalabras0", function() { 630 return _this.estilosZonas[0].espaciadoEntrePalabras; 631 }, function(a) { 632 return _this.estilosZonas[0].espaciadoEntrePalabras = a; 633 }); 634 state.addProp("EspaciadoEntrePalabras1", function() { 635 return _this.estilosZonas[1].espaciadoEntrePalabras; 636 }, function(a) { 637 return _this.estilosZonas[1].espaciadoEntrePalabras = a; 638 }); 639 state.addProp("EspaciadoEntrePalabras2", function() { 640 return _this.estilosZonas[2].espaciadoEntrePalabras; 641 }, function(a) { 642 return _this.estilosZonas[2].espaciadoEntrePalabras = a; 643 }); 644 state.addProp("EspaciadoEntrePalabras3", function() { 645 return _this.estilosZonas[3].espaciadoEntrePalabras; 646 }, function(a) { 647 return _this.estilosZonas[3].espaciadoEntrePalabras = a; 648 }); 649 state.addProp("EspaciadoEntrePalabras4", function() { 650 return _this.estilosZonas[4].espaciadoEntrePalabras; 651 }, function(a) { 652 return _this.estilosZonas[4].espaciadoEntrePalabras = a; 653 }); 654 state.addProp("CapitalizarZ0", function() { 655 return _this.estilosZonas[0].capitalizar; 656 }, function(a) { 657 return _this.estilosZonas[0].capitalizar = a; 658 }); 659 state.addProp("CapitalizarZ1", function() { 660 return _this.estilosZonas[1].capitalizar; 661 }, function(a) { 662 return _this.estilosZonas[1].capitalizar = a; 663 }); 664 state.addProp("CapitalizarZ2", function() { 665 return _this.estilosZonas[2].capitalizar; 666 }, function(a) { 667 return _this.estilosZonas[2].capitalizar = a; 668 }); 669 state.addProp("CapitalizarZ3", function() { 670 return _this.estilosZonas[3].capitalizar; 671 }, function(a) { 672 return _this.estilosZonas[3].capitalizar = a; 673 }); 674 state.addProp("CapitalizarZ4", function() { 675 return _this.estilosZonas[4].capitalizar; 676 }, function(a) { 677 return _this.estilosZonas[4].capitalizar = a; 678 }); 679 state.addProp("Zona1Alto", function() { 680 return _this.estilosZonas[1].alto; 681 }, function(a) { 682 return _this.estilosZonas[1].alto = a; 683 }); 684 state.addProp("Zona2Alto", function() { 685 return _this.estilosZonas[2].alto; 686 }, function(a) { 687 return _this.estilosZonas[2].alto = a; 688 }); 689 state.addProp("Zona3Alto", function() { 690 return _this.estilosZonas[3].alto; 691 }, function(a) { 692 return _this.estilosZonas[3].alto = a; 693 }); 694 state.addProp("Zona4Alto", function() { 695 return _this.estilosZonas[4].alto; 696 }, function(a) { 697 return _this.estilosZonas[4].alto = a; 698 }); 699 state.addProp("TipoColorear", function() { 700 return _this.configuracion.TipoColorear; 701 }, function(a) { 702 return _this.configuracion.TipoColorear = a; 703 }); 704 state.addProp("ColorFijo", function() { 705 return _this.configuracion.ColorFijo; 706 }, function(a) { 707 return _this.configuracion.ColorFijo = a; 708 }); 709 state.addProp("ColorTitulos", function() { 710 return _this.configuracion.ColorTitulos; 711 }, function(a) { 712 return _this.configuracion.ColorTitulos = a; 713 }); 714 state.addProp("ColorMarco", function() { 715 return _this.configuracion.ColorMarco; 716 }, function(a) { 717 return _this.configuracion.ColorMarco = a; 718 }); 719 state.addProp("ColorPizarra", function() { 720 return _this.configuracion.ColorPizarra; 721 }, function(a) { 722 return _this.configuracion.ColorPizarra = a; 723 }); 724 state.addProp("ColorAleatorio1", function() { 725 return _this.configuracion.ColorAleatorio[0]; 726 }, function(a) { 727 return _this.configuracion.ColorAleatorio[0] = a; 728 }); 729 state.addProp("ColorAleatorio2", function() { 730 return _this.configuracion.ColorAleatorio[1]; 731 }, function(a) { 732 return _this.configuracion.ColorAleatorio[1] = a; 733 }); 734 state.addProp("ColorAleatorio3", function() { 735 return _this.configuracion.ColorAleatorio[2]; 736 }, function(a) { 737 return _this.configuracion.ColorAleatorio[2] = a; 738 }); 739 state.addProp("ColorAleatorio4", function() { 740 return _this.configuracion.ColorAleatorio[3]; 741 }, function(a) { 742 return _this.configuracion.ColorAleatorio[3] = a; 743 }); 744 state.addProp("ColorAleatorio5", function() { 745 return _this.configuracion.ColorAleatorio[4]; 746 }, function(a) { 747 return _this.configuracion.ColorAleatorio[4] = a; 748 }); 749 state.addProp("ColorAleatorio6", function() { 750 return _this.configuracion.ColorAleatorio[5]; 751 }, function(a) { 752 return _this.configuracion.ColorAleatorio[5] = a; 753 }); 754 state.addProp("ColorAleatorio7", function() { 755 return _this.configuracion.ColorAleatorio[6]; 756 }, function(a) { 757 return _this.configuracion.ColorAleatorio[6] = a; 758 }); 759 state.addProp("ColorAleatorio8", function() { 760 return _this.configuracion.ColorAleatorio[7]; 761 }, function(a) { 762 return _this.configuracion.ColorAleatorio[7] = a; 763 }); 764 state.addProp("ColorAleatorio9", function() { 765 return _this.configuracion.ColorAleatorio[8]; 766 }, function(a) { 767 return _this.configuracion.ColorAleatorio[8]
767= a; 768 }); 769 state.addProp("ColorAleatorio10", function() { 770 return _this.configuracion.ColorAleatorio[9]; 771 }, function(a) { 772 return _this.configuracion.ColorAleatorio[9] = a; 773 }); 774 state.addProp("ColorAleatorioActivo1", state.buildAsBool(function() { 775 return _this.configuracion.ColorAleatorioActivo[0]; 776 }), state.parseAsBool(function(a) { 777 return _this.configuracion.ColorAleatorioActivo[0] = a; 778 })); 779 state.addProp("ColorAleatorioActivo2", state.buildAsBool(function() { 780 return _this.configuracion.ColorAleatorioActivo[1]; 781 }), state.parseAsBool(function(a) { 782 return _this.configuracion.ColorAleatorioActivo[1] = a; 783 })); 784 state.addProp("ColorAleatorioActivo3", state.buildAsBool(function() { 785 return _this.configuracion.ColorAleatorioActivo[2]; 786 }), state.parseAsBool(function(a) { 787 return _this.configuracion.ColorAleatorioActivo[2] = a; 788 })); 789 state.addProp("ColorAleatorioActivo4", state.buildAsBool(function() { 790 return _this.configuracion.ColorAleatorioActivo[3]; 791 }), state.parseAsBool(function(a) { 792 return _this.configuracion.ColorAleatorioActivo[3] = a; 793 })); 794 state.addProp("ColorAleatorioActivo5", state.buildAsBool(function() { 795 return _this.configuracion.ColorAleatorioActivo[4]; 796 }), state.parseAsBool(function(a) { 797 return _this.configuracion.ColorAleatorioActivo[4] = a; 798 })); 799 state.addProp("ColorAleatorioActivo6", state.buildAsBool(function() { 800 return _this.configuracion.ColorAleatorioActivo[5]; 801 }), state.parseAsBool(function(a) { 802 return _this.configuracion.ColorAleatorioActivo[5] = a; 803 })); 804 state.addProp("ColorAleatorioActivo7", state.buildAsBool(function() { 805 return _this.configuracion.ColorAleatorioActivo[6]; 806 }), state.parseAsBool(function(a) { 807 return _this.configuracion.ColorAleatorioActivo[6] = a; 808 })); 809 state.addProp("ColorAleatorioActivo8", state.buildAsBool(function() { 810 return _this.configuracion.ColorAleatorioActivo[7]; 811 }), state.parseAsBool(function(a) { 812 return _this.configuracion.ColorAleatorioActivo[7] = a; 813 })); 814 state.addProp("ColorAleatorioActivo9", state.buildAsBool(function() { 815 return _this.configuracion.ColorAleatorioActivo[8]; 816 }), state.parseAsBool(function(a) { 817 return _this.configuracion.ColorAleatorioActivo[8] = a; 818 })); 819 state.addProp("ColorAleatorioActivo10", state.buildAsBool(function() { 820 return _this.configuracion.ColorAleatorioActivo[9]; 821 }), state.parseAsBool(function(a) { 822 return _this.configuracion.ColorAleatorioActivo[9] = a; 823 })); 824 state.addProp("Patron1Activo", state.buildAsBool(function() { 825 return _this.configuracion.PatronActivo[0]; 826 }), state.parseAsBool(function(a) { 827 return _this.configuracion.PatronActivo[0] = a; 828 })); 829 state.addProp("Patron2Activo", state.buildAsBool(function() { 830 return _this.configuracion.PatronActivo[1]; 831 }), state.parseAsBool(function(a) { 832 return _this.configuracion.PatronActivo[1] = a; 833 })); 834 state.addProp("Patron3Activo", state.buildAsBool(function() { 835 return _this.configuracion.PatronActivo[2]; 836 }), state.parseAsBool(function(a) { 837 return _this.configuracion.PatronActivo[2] = a; 838 })); 839 state.addProp("Patron4Activo", state.buildAsBool(function() { 840 return _this.configuracion.PatronActivo[3]; 841 }), state.parseAsBool(function(a) { 842 return _this.configuracion.PatronActivo[3] = a; 843 })); 844 state.addProp("Patron1Lista", function() { 845 return _this.configuracion.PatronLista[0]; 846 }, function(a) { 847 return _this.configuracion.PatronLista[0] = a; 848 }); 849 state.addProp("Patron2Lista", function() { 850 return _this.configuracion.PatronLista[1]; 851 }, function(a) { 852 return _this.configuracion.PatronLista[1] = a; 853 }); 854 state.addProp("Patron3Lista", function() { 855 return _this.configuracion.PatronLista[2]; 856 }, function(a) { 857 return _this.configuracion.PatronLista[2] = a; 858 }); 859 state.addProp("Patron4Lista", function() { 860 return _this.configuracion.PatronLista[3]; 861 }, function(a) { 862 return _this.configuracion.PatronLista[3] = a; 863 }); 864 state.addProp("Patron1Color", function() { 865 return _this.configuracion.PatronColor[0]; 866 }, function(a) { 867 return _this.configuracion.PatronColor[0] = a; 868 }); 869 state.addProp("Patron2Color", function() { 870 return _this.configuracion.PatronColor[1]; 871 }, function(a) { 872 return _this.configuracion.PatronColor[1] = a; 873 }); 874 state.addProp("Patron3Color", function() { 875 return _this.configuracion.PatronColor[2]; 876 }, function(a) { 877 return _this.configuracion.PatronColor[2] = a; 878 }); 879 state.addProp("Patron4Color", function() { 880 return _this.configuracion.PatronColor[3]; 881 }, function(a) { 882 return _this.configuracion.PatronColor[3] = a; 883 }); 884 state.addProp("Patron1Tamano", function() { 885 return _this.configuracion.PatronTamano[0]; 886 }, function(a) { 887 return _this.configuracion.PatronTamano[0] = a; 888 }); 889 state.addProp("Patron2Tamano", function() { 890 return _this.configuracion.PatronTamano[1]; 891 }, function(a) { 892 return _this.configuracion.PatronTamano[1] = a; 893 }); 894 state.addProp("Patron3Tamano", function() { 895 return _this.configuracion.PatronTamano[2]; 896 }, function(a) { 897 return _this.configuracion.PatronTamano[2] = a; 898 }); 899 state.addProp("Patron4Tamano", function() { 900 return _this.configuracion.PatronTamano[3]; 901 }, function(a) { 902 return _this.configuracion.PatronTamano[3] = a; 903 }); 904 state.addProp("Cursiva", state.buildAsBool(function() { 905 return _this.configuracion.cursiva; 906 }), state.parseAsBool(function(a) { 907 return _this.configuracion.cursiva = a; 908 })); 909 state.addProp("Negrita", state.buildAsBool(function() { 910 return _this.configuracion.negrita; 911 }), state.parseAsBool(function(a) { 912 return _this.configuracion.negrita = a; 913 })); 914 state.addProp("Subrayado", state.buildAsBool(function() { 915 return _this.configuracion.subrayado; 916 }), state.parseAsBool(function(a) { 917 return _this.configuracion.subrayado = a; 918 })); 919 state.addProp("BordesLetras", state.buildAsBool(function() { 920 return _this.configuracion.BordesLetras; 921 }), state.parseAsBool(function(a) { 922 return _this.configuracion.BordesLetras = a; 923 })); 924 state.addProp("BordesEspacios", state.buildAsBool(function() { 925 return _this.configuracion.BordesEspacios; 926 }), state.parseAsBool(function(a) { 927 return _this.configuracion.BordesEspacios = a; 928 })); 929 state.addProp("SilabaTonica", state.buildAsBool(function() { 930 return _this.configuracion.SilabaTonica; 931 }), state.parseAsBool(function(a) { 932 return _this.configuracion.SilabaTonica = a; 933 })); 934 state.addProp("modoTrabajo", function() { 935 return _this.configuracion.modoTrabajo; 936 }, function(a) { 937 return _this.configuracion.modoTrabajo = a; 938 }); 939 state.addProp("barajarTextoActivado", state.buildAsBool(function() { 940 return _this.configuracion.BarajarBloques; 941 }), state.parseAsBool(function(a) { 942 return _this.configuracion.BarajarBloques = a; 943 })); 944 state.addProp("encolumnarTextoActivado", state.buildAsBool(function() { 945 return _this.configuracion.EncolumnarBloques; 946 }), state.parseAsBool(function(a) { 947 return _this.configuracion.EncolumnarBloques = a; 948 })); 949 state.addProp("nFilasTabla", function() { 950 return _this.configuracion.nFilasTabla.toString(); 951 }, function(a) { 952 return _this.configuracion.nFilasTabla = parseInt(a); 953 }); 954 state.addProp("nColsTabla", function() { 955 return _this.configuracion.nColsTabla.toString(); 956 }, function(a) { 957 return _this.configuracion.nColsTabla = parseInt(a); 958 }); 959 state.addPropTextField("tResaltarBloque"); 960 state.addPropTextField("tEsperarBloque"); 961 // state.addPropInputColor('colorFuenteResaltarBloque'); 962 state.addPropInputColor("colorFondoResaltarBloque"); 963 state.addPropInputRadio("nEstiloResaltado"); 964 state.addPropTextField("tsExpoZ1"); 965 state.addPropTextField("tmExpoZ1"); 966 state.addPropTextField("tsEsperaZ1"); 967 state.addPropTextField("tmEsperaZ1"); 968 state.addPropTextField("tiDTotalZ1"); 969 state.addPropTextField("tsDTotalZ1"); 970 state.addPropTextField("tmDTotalZ1"); 971 state.addProp("Zona1Activa", state.buildAsBool(function() { 972 return _this.estilosZonas[1].activar; 973 }), state.parseAsBool(function(a) { 974 return _this.estilosZonas[1].activar = a; 975 })); 976 state.addProp("Zona2Activa", state.buildAsBool(function() { 977 return _this.estilosZonas[2].activar; 978 }), state.parseAsBool(function(a) { 979 return _this.estilosZonas[2].activar = a; 980 })); 981 state.addProp("Zona3Activa", state.buildAsBool(function() { 982 return _this.estilosZonas[3].activar; 983 }), state.parseAsBool(function(a) { 984 return _this.estilosZonas[3].activar = a; 985 })); 986 state.addProp("Zona4Activa", state.buildAsBool(function() { 987 return _this.estilosZonas[4].activar; 988 }), state.parseAsBool(function(a) { 989 return _this.estilosZonas[4].activar = a; 990 })); 991 } 992 }, 993 { 994 key: "configurarCallbacks", 995 value: function configurarCallbacks() { 996 var _loop = function(index) { 997 var color = document.getElementById("ColorAleatorio" + (index + 1)); 998 var check = document.getElementById("ColorAleatorioActivo" + (index + 1)); 999 color.addEventListener("change", function(ev) { 1000 _this.configuracion.ColorAleatorio[index] = color.value.substring(1); // Eliminar "#" 1001 }); 1002 check.addEventListener("change", function(ev) { 1003 _this.configuracion.ColorAleatorioActivo[index] = color.checked; 1004 }); 1005 }, _loop1 = function(index1) { 1006 var check = document.getElementById("Patron" + (index1 + 1) + "Activo"); 1007 var lista = document.getElementById("Patron" + (index1 + 1) + "Lista"); 1008 var color = document.getElementById("Patron" + (index1 + 1) + "Color"); 1009 var tamano = document.getElementById("Patron" + (index1 + 1) + "Tamano"); 1010 check.addEventListener("change", function(ev) { 1011 _this.configuracion.PatronActivo[index1] = check.checked; 1012 _this.renderColores(); 1013 }); 1014 lista.addEventListener("change", function(ev) { 1015 _this.configuracion.PatronLista[index1] = lista.value; 1016 _this.renderColores(); 1017 }); 1018 color.addEventListener("change", function(ev) { 1019 _this.configuracion.PatronColor[index1] = color.value.substring(1); // Eliminar "#"; 1020 _this.renderColores(); 1021 }); 1022 tamano.addEventListener("change", function(ev) { 1023 _this.configuracion.PatronTamano[index1] = tamano.value; 1024 _this.renderColores(); 1025 }); 1026 }; 1027 var _this = this; 1028 this.state.on("load", function() { 1029 _this.empezar(); 1030 }); 1031 this.state.on("build", function() { 1032 _this.estilosZonas[1].alto = _this.Zona1.style.height; 1033 _this.estilosZonas[2].alto = _this.Zona2.style.height; 1034 _this.estilosZonas[3].alto = _this.Zona3.style.height; 1035 _this.estilosZonas[4].alto = _this.Zona4.style.height; 1036 }); 1037 this.listado.addUpdateTextosListener(function(textos) { 1038 _this.renderPosicionadorTextos(); 1039 }); 1040 this.listado.setUpdateSeleccionListener(function(texto) { 1041 // this.renderPosicionadorTextos(); 1042 _this.nUltimoTextoPresentado = _this.listado.getElementoSeleccionadoListaTextos() - 1; 1043 _this.updatePosicionadorTextos(); 1044 }); 1045 $(document.body).on("mouseover", ".btn-pizarra-sacar img", function(ev) { 1046 var _$_parent_data; 1047 var zona = parseInt((_$_parent_data = $(ev.currentTarget).parent().data("pizarra")) !== null && _$_parent_data !== void 0 ? _$_parent_data : "0"); 1048 _this.activarZona(zona); 1049 }); 1050 $(document.body).on("mouseover", ".image-toggle img", function(ev) { 1051 $(ev.currentTarget).parent().addClass("active"); 1052 }); 1053 $(document.body).on("mouseleave", ".image-toggle img", function(ev) { 1054 $(ev.currentTarget).parent().removeClass("active"); 1055 }); 1056 $(document.body).on("click", "[data-sacar-texto]", function(ev) { 1057 _this.handleSacarTexto($(ev.currentTarget).data("sacar-texto")); 1058 }); 1059 $(document.body).on("mousemove", "[data-filas]", function(ev) {
1060 var filas = $(ev.currentTarget).data("filas"); 1061 var columnas = $(ev.currentTarget).data("columnas"); 1062 var table = document.getElementsByClassName("tabla-encolumnar")[0].childNodes[0]; // tbody 1063 var numeroFilas = table.childNodes.length; 1064 var numeroColumnas = table.childNodes[0].childNodes.length; 1065 $("#tabla-encolumnar-dimension").text(filas + " filas, " + columnas + " columnas, " + filas * columnas + " bloques"); 1066 for(var i = 0; i < numeroFilas; i++){ 1067 for(var j = 0; j < numeroColumnas; j++){ 1068 var element = table.childNodes[i].childNodes[j]; 1069 if (i < filas && j < columnas) { 1070 element.classList.add("active"); 1071 } else { 1072 element.classList.remove("active"); 1073 } 1074 } 1075 } 1076 }); 1077 $(document.body).on("click", "[data-filas]", function(ev) { 1078 var filas = $(ev.currentTarget).data("filas"); 1079 var columnas = $(ev.currentTarget).data("columnas"); 1080 _this.configuracion.nColsTabla = columnas; 1081 _this.configuracion.nFilasTabla = filas; 1082 _this.encolumnarZonas(columnas, filas); 1083 }); 1084 $(document.body).on("change", "[data-select-pizarra]", function(ev) { 1085 var valido = true; 1086 var tipo = $(ev.currentTarget).data("select-pizarra"); 1087 var _$_data; 1088 var zona = parseInt((_$_data = $(ev.currentTarget).data("pizarra")) !== null && _$_data !== void 0 ? _$_data : "0"); 1089 if (tipo == "texto-size") { 1090 var val = $(ev.currentTarget).val(); 1091 _this.setEstiloAZona(zona, "tamanoLetra", val); 1092 } else if (tipo == "espacio-linea") { 1093 var val1 = $(ev.currentTarget).val(); 1094 _this.setEstiloAZona(zona, "espaciadoEntreLineas", val1); 1095 } else if (tipo == "espacio-letras") { 1096 var val2 = $(ev.currentTarget).val(); 1097 _this.setEstiloAZona(zona, "espaciadoEntreLetras", val2); 1098 } else if (tipo == "espacio-palabras") { 1099 var val3 = $(ev.currentTarget).val(); 1100 _this.setEstiloAZona(zona, "espaciadoEntrePalabras", val3); 1101 } else if (tipo == "margen-izq") { 1102 var val4 = $(ev.currentTarget).val(); 1103 _this.setEstiloAZona(zona, "margenIzq", val4); 1104 } else if (tipo == "margen-der") { 1105 var val5 = $(ev.currentTarget).val(); 1106 _this.setEstiloAZona(zona, "margenDer", val5); 1107 } else if (tipo == "margen-sup") { 1108 var val6 = $(ev.currentTarget).val(); 1109 _this.setEstiloAZona(zona, "margenSup", val6); 1110 } else { 1111 valido = false; 1112 } 1113 if (valido) { 1114 _this.state.saveLocalStorage(); 1115 } 1116 }); 1117 $(document.body).on("click", "[data-dropdown-pizarra] [value]", function(ev) { 1118 var valido = true; 1119 var tipo = $(ev.currentTarget).parent("[data-dropdown-pizarra]").data("dropdown-pizarra"); 1120 var _$_data; 1121 var zona = parseInt((_$_data = $(ev.currentTarget).data("pizarra")) !== null && _$_data !== void 0 ? _$_data : "0"); 1122 if (tipo == "tipoTrocear") { 1123 var val = _this.getValue(ev.target); 1124 _this.setEstiloAZona(zona, "tipoTrocear", val); 1125 } else if (tipo == "modoTrabajo") { 1126 var val1 = _this.getValue(ev.target); 1127 _this.setModoTrabajo(val1); 1128 } else { 1129 valido = false;
1130 alert("(2) Tipo de opraci\xf3n no v\xe1lida: " + tipo); 1131 } 1132 if (valido) { 1133 _this.state.saveLocalStorage(); 1134 } 1135 }); 1136 $(document.body).on("click", "[data-radio-pizarra]", function(ev) { 1137 var valido = true; 1138 var tipo = $(ev.currentTarget).data("radio-pizarra"); 1139 var zona = 0; 1140 var val = $(ev.currentTarget).val(); 1141 if (tipo == "TipoColorear") { 1142 _this.configuracion.TipoColorear = val; 1143 _this.setConfiguracion(); 1144 } else if (tipo == "...") {} else { 1145 valido = false; 1146 alert("(3) Tipo de opraci\xf3n no v\xe1lida: " + tipo); 1147 } 1148 if (valido) { 1149 _this.state.saveLocalStorage(); 1150 } 1151 }); 1152 $(document.body).on("click", "[data-accion-pizarra]", function(ev) { 1153 var valido = true; 1154 var tipo = $(ev.currentTarget).data("accion-pizarra"); 1155 var _$_data; 1156 var zona = parseInt((_$_data = $(ev.currentTarget).data("pizarra")) !== null && _$_data !== void 0 ? _$_data : "0"); 1157 if (tipo == "texto-fuente") { 1158 var fuente = $(ev.currentTarget).data("tipo-letra"); 1159 _this.setEstiloAZona(zona, "tipoLetra", fuente); 1160 } else if (tipo == "texto-incr") { 1161 var px = TextosUtils.incrementarValor(_this.estilosZonas[zona].tamanoLetra); 1162 _this.setEstiloAZona(zona, "tamanoLetra", px); 1163 } else if (tipo == "texto-dec") { 1164 var px1 = TextosUtils.decrementarValor(_this.estilosZonas[zona].tamanoLetra); 1165 _this.setEstiloAZona(zona, "tamanoLetra", px1); 1166 } else if (tipo == "sacarNuevoTextoPor") { 1167 _this.setResultadoEnPosicionador("next"); 1168 _this.sacarNuevoTextoPor(zona); 1169 } else if (tipo == "bordes-espacios") { 1170 _this.configuracion.BordesEspacios = !_this.configuracion.BordesEspacios; 1171 _this.setConfiguracion(); 1172 _this.caracterizarZonas(); 1173 } else if (tipo == "bordes-textos") { 1174 _this.configuracion.BordesLetras = !_this.configuracion.BordesLetras; 1175 _this.caracterizarZonas(); 1176 _this.setConfiguracion(); 1177 } else if (tipo == "capitalizar") { 1178 var val = _this.getValue(ev.target); 1179 _this.setEstiloAZona(zona, "capitalizar", val); 1180 } else if (tipo == "negrita") { 1181 // let val = $(ev.target).val(); 1182 _this.configuracion.negrita = !_this.configuracion.negrita; 1183 _this.caracterizarZonas(); 1184 _this.setConfiguracion(); 1185 } else if (tipo == "cursiva") { 1186 // let val = $(ev.target).val(); 1187 _this.configuracion.cursiva = !_this.configuracion.cursiva; 1188 _this.caracterizarZonas(); 1189 _this.setConfiguracion(); 1190 } else if (tipo == "subrayado") { 1191 // let val = $(ev.target).val(); 1192 _this.configuracion.subrayado = !_this.configuracion.subrayado; 1193 _this.caracterizarZonas(); 1194 _this.setConfiguracion(); 1195 } else if (tipo == "acentos") { 1196 // let val = $(ev.target).val(); 1197 _this.configuracion.SilabaTonica = !_this.configuracion.SilabaTonica; 1198 _this.caracterizarZonas(); 1199 _this.setConfiguracion(); 1200 } else if (tipo == "tipoTrocear") { 1201 var val1 = _this.getValue(ev.target); 1202 _this.setEstiloAZona(zona, "tipoTrocear", val1); 1203 } else if (tipo == "modoTrabajo") { 1204 var val2 = _this.getValue(ev.target); 1205 _this.setModoTrabajo(val2); 1206 } else if (tipo == "tipo-alinear") { 1207 var val3 = _this.getValue(ev.target); 1208 _this.setEstiloAZona(zona, "tipoAlinear", val3); 1209 } else if (tipo == "barajar-letras") { 1210 _this.barajarTextoZona("Letras", 0); 1211 ev.stopPropagation(); 1212 } else if (tipo == "barajar-silabas") { 1213 _this.barajarTextoZona("Silabas", 0); 1214 ev.stopPropagation(); 1215 } else if (tipo == "barajar-palabras") { 1216 _this.barajarTextoZona("Palabras", 0); 1217 ev.stopPropagation(); 1218 } else if (tipo == "barajar-parrafos") { 1219 _this.barajarTextoZona("Parrafos", 0); 1220 ev.stopPropagation(); 1221 } else if (tipo == "barajar-check") { 1222 _this.configuracion.BarajarBloques = ev.currentTarget.checked; 1223 _this.setConfiguracion(); 1224 } else if (tipo == "tabla-check") { 1225 _this.configuracion.EncolumnarBloques = ev.currentTarget.checked; 1226 _this.setConfiguracion(); 1227 _this.actualizarTextoZona(0, !_this.configuracion.EncolumnarBloques); 1228 } else if (tipo == "tabla-letras") { 1229 _this.encolumnarZona(0, "Letras"); 1230 } else if (tipo == "tabla-silabas") { 1231 _this.encolumnarZona(0, "Silabas"); 1232 } else if (tipo == "tabla-palabras") { 1233 _this.encolumnarZona(0, "Palabras"); 1234 } else if (tipo == "lectura-automatica") { 1235 if (!_this.lecturaAutomaticaActiva) { 1236 _this.iniciarLecturaAutomatica(); 1237 } else { 1238 _this.detenerLecturaAutomatica(); 1239 } 1240 } else if (tipo == "presentacion-automatica") { 1241 if (zona == 0) { 1242 if (!_this.presentacionAutomaticaActiva) { 1243 _this.inicarPresentacionSincronizada(0); 1244 } else { 1245 _this.detenerPresentacionSincronizada(); 1246 } 1247 } else { 1248 _this.inicarPresentacionSincronizada(zona); 1249 } 1250 } else if (tipo == "borrar") { 1251 if (zona == 0) { 1252 _this.limpiarPizarras(); 1253 } else { 1254 _this.setTextoZona("", zona); 1255 } 1256 } else if (tipo == "toggle-ocultar-texto") { 1257 _this.toggleZonaVisible(zona); 1258 } else if (tipo == "activar-pizarra") { 1259 _this.estilosZonas[zona].activar = !_this.estilosZonas[zona].activar; 1260 _this.setConfiguracion(); 1261 } else if (tipo == "toggle-cortina") { 1262 _this.cortina.cortinear(); 1263 } else if (tipo == "siguienteTexto") { 1264 if (_this.nUltimaZonaPresentada) { 1265 _this.sacarNuevoTextoPor(_this.nUltimaZonaPresentada); 1266 } 1267 } else if (tipo == "siguientesTextos") { 1268 if (_this.nUltimaZonaPresentada) { 1269 for(var index = 0; index < 4; index++){ 1270 var element = index + 1; 1271 if (_this.estilosZonas[element].activar) { 1272 _this.sacarNuevoTextoPor(element); 1273 } 1274 } 1275 } 1276 } else if (tipo == "siguienteTextoX4") { 1277 var n = _this.nUltimoTextoPresentado + 1; 1278 for(var index1 = 0; index1 < 4; index1++){ 1279 var element1 = index1 + 1; 1280 if (_this.estilosZonas[element1].activar) { 1281 _this.sacarNuevoTextoPor(element1, n); 1282 } 1283 } 1284 // this.nUltimoTextoPresentado = n; 1285 } else if (tipo == "...") {} else { 1286 valido = false;
1287 alert("(1) Tipo de opraci\xf3n no v\xe1lida: " + tipo); 1288 } 1289 if (valido) { 1290 _this.state.saveLocalStorage(); 1291 } 1292 }); 1293 $("#Zona1").on("focusout", function() { 1294 _this.actualizarTextoZona(1); 1295 }); 1296 $("#Zona2").on("focusout", function() { 1297 _this.actualizarTextoZona(2); 1298 }); 1299 $("#Zona3").on("focusout", function() { 1300 _this.actualizarTextoZona(3); 1301 }); 1302 $("#Zona4").on("focusout", function() { 1303 _this.actualizarTextoZona(4); 1304 }); 1305 var ColorFijo = document.getElementById("ColorFijo"); 1306 ColorFijo.addEventListener("change", function(ev) { 1307 _this.configuracion.ColorFijo = ColorFijo.value.substring(1); // Eliminar "#" 1308 }); 1309 for(var index = 0; index < 10; index++)_loop(index); 1310 for(var index1 = 0; index1 < 4; index1++)_loop1(index1); 1311 // $("#coloresTextosModal").on('hide.bs.modal', () => { 1312 // debugger; 1313 // for (let index = 1; index <=4; index++) { 1314 // this.asignarColores(index, this.configuracion.TipoColorear); 1315 // } 1316 // this.state.saveLocalStorage(); 1317 // }); 1318 $("#coloresTextosModal .btn-primary").on("click", function() { 1319 for(var index = 1; index <= 4; index++){ 1320 _this.asignarColores(index, _this.configuracion.TipoColorear); 1321 } 1322 _this.state.saveLocalStorage(); 1323 }); 1324 $("#Zonas").on("dragover", ".tabla-inventapalabras", function(ev) { 1325 if (_this.configuracion.modoTrabajo == "modoMover") { 1326 ev.preventDefault(); 1327 } 1328 }); 1329 $("#Zonas").on("drop", ".tabla-inventapalabras", function(ev) { 1330 var $tz = $(ev.target).find("tz"); 1331 _this.moverTrozo(_this.idInter1, $tz[0].id); 1332 }); 1333 $(".btn-configuracion-encolumnar").on("click", function() { 1334 _this.configurarTabla(); 1335 }); 1336 $("#modoPizarra").on("focusin focusout", function(ev) { 1337 console.log(ev); 1338 }); 1339 $("#openTablaResumen").on("click", function() { 1340 $("#openTablaResumen").toggleClass("active"); 1341 $("#tablaResumenModal").toggleClass("active"); 1342 $("#openTablaResumenBackdrop").toggleClass("active"); 1343 }); 1344 $("#openTablaResumenBackdrop").on("click", function() { 1345 $("#openTablaResumen").removeClass("active"); 1346 $("#tablaResumenModal").removeClass("active"); 1347 $("#openTablaResumenBackdrop").removeClass("active"); 1348 }); 1349 // $("#tablaResumenModal").on('mouseout', (ev) => { 1350 // if (ev.relatedTarget == null || !$(ev.relatedTarget).hasClass("active") || !$(ev.relatedTarget!).hasClass("tablaResumenModal")) { 1351 // $("#openTablaResumen").removeClass('active'); 1352 // $("#tablaResumenModal").removeClass('active'); 1353 // } 1354 // }); 1355 // $("#openTablaResumen").on('mouseover', (ev) => { 1356 // $("#openTablaResumen").addClass('active'); 1357 // $("#tablaResumenModal").addClass('active'); 1358 // }); 1359 } 1360 }, 1361 { 1362 key: "getValue", 1363 value: function getValue(el) { 1364 var attr = $(el).attr("value"); 1365 if (typeof attr !== "undefined") { 1366 return attr; 1367 } 1368 return this.getValue($(el).parent()); 1369 } 1370 }, 1371 { 1372 key: "empezar", 1373 value: function empezar() { 1374 // Render... 1375 // this.limpiarPizarras(); 1376 this.renderFuentes(); 1377 this.renderColores(); 1378 this.asignarAlto(0); 1379 // this.caracterizarZonas(); 1380 for(var index = 1; index <= 4; index++){ 1381 var element = this.estilosZonas[index].texto; 1382 this.setTextoZona(element, index); 1383 } 1384 this.setConfiguracion(); 1385 this.renderPosicionadorTextos(); 1386 this.updatePosicionadorTextos(); 1387 // if (this.nUltimoTextoPresentado > -1) { 1388 // this.sacarNuevoTextoPor(this.nUltimaZonaPresentada, this.nUltimoTextoPresentado); 1389 // } 1390 } 1391 }, 1392 { 1393 key: "activarZona", 1394 value: function activarZona(nZona) { 1395 this.nUltimaZonaPresentada = nZona; 1396 $(".btn-pizarra-sacar").removeClass("active"); 1397 $('.btn-pizarra-sacar[data-pizarra="' + nZona + '"]').addClass("active"); 1398 } 1399 }, 1400 { 1401 key: "setModoTrabajo", 1402 value: function setModoTrabajo(modo) { 1403 this.configuracion.modoTrabajo = modo; 1404 this.setButtonOption("modoTrabajo", 0, this.configuracion.modoTrabajo); 1405 for(var index = 0; index < 4; index++){ 1406 this.asignarModoTrabajo(index + 1, modo); 1407 } 1408 } 1409 }, 1410 { 1411 key: "getColoresAleatorios", 1412 value: function getColoresAleatorios() { 1413 var res = []; 1414 for(var index = 0; index < this.configuracion.ColorAleatorioActivo.length; index++){ 1415 var element = this.configuracion.ColorAleatorioActivo[index]; 1416 if (element) { 1417 res.push("#" + this.configuracion.ColorAleatorio[index]); 1418 } 1419 } 1420 return res; 1421 } 1422 }, 1423 { 1424 key: "setEstiloAZona", 1425 value: function setEstiloAZona(nZona, key, value) { 1426 if (nZona == 0) { 1427 this.estilosZonas[0][key] = value; 1428 this.estilosZonas[1][key] = value; 1429 this.estilosZonas[2][key] = value; 1430 this.estilosZonas[3][key] = value; 1431 this.estilosZonas[4][key] = value; 1432 } else { 1433 this.estilosZonas[nZona][key] = value; 1434 } 1435 this.caracterizarZona(nZona); 1436 this.setConfiguracion(); 1437 this.actualizarTextoZona(nZona, key == "tipoTrocear"); 1438 } 1439 }, 1440 { 1441 key: "setConfiguracion", 1442 value: function setConfiguracion() { 1443 $('[data-accion-pizarra="texto-fuente"]').removeClass("active"); 1444 this.asignarPizarrasActivas();
1445 this.setConfiguracionZona(0); 1446 this.setConfiguracionZona(1); 1447 this.setConfiguracionZona(2); 1448 this.setConfiguracionZona(3); 1449 this.setConfiguracionZona(4); 1450 // $('[select-pizarra="texto-size"]').val(this.estilosZonas[0].tamanoLetra); 1451 this.setButtonToggle("bordes-espacios", this.configuracion.BordesEspacios); 1452 this.setButtonToggle("bordes-textos", this.configuracion.BordesLetras); 1453 this.setButtonToggle("negrita", this.configuracion.negrita); 1454 this.setButtonToggle("cursiva", this.configuracion.cursiva); 1455 this.setButtonToggle("subrayado", this.configuracion.subrayado); 1456 this.setButtonToggle("acentos", this.configuracion.SilabaTonica); 1457 this.setButtonOption("modoTrabajo", 0, this.configuracion.modoTrabajo); 1458 this.setRadioValue("TipoColorear", this.configuracion.TipoColorear); 1459 $("[data-tipo-colorear]").addClass("opacity-25"); 1460 $('[data-tipo-colorear="' + this.configuracion.TipoColorear + '"]').removeClass("opacity-25"); 1461 $('[data-accion-pizarra="barajar-check"]').prop("checked", this.configuracion.BarajarBloques); 1462 if (this.configuracion.BarajarBloques) { 1463 $(".btn-configuracion-barajar").addClass("btn-success"); 1464 $(".btn-configuracion-barajar").removeClass("btn-secondary"); 1465 } else { 1466 $(".btn-configuracion-barajar").removeClass("btn-success"); 1467 $(".btn-configuracion-barajar").addClass("btn-secondary"); 1468 } 1469 $('[data-accion-pizarra="tabla-check"]').prop("checked", this.configuracion.EncolumnarBloques); 1470 if (this.configuracion.EncolumnarBloques) { 1471 $(".btn-configuracion-encolumnar").addClass("btn-success"); 1472 $(".btn-configuracion-encolumnar").removeClass("btn-secondary"); 1473 } else { 1474 $(".btn-configuracion-encolumnar").removeClass("btn-success"); 1475 $(".btn-configuracion-encolumnar").addClass("btn-secondary"); 1476 } 1477 this.setModoTrabajo(this.configuracion.modoTrabajo); 1478 // Colores aleatorios 1479 this.renderColores(); 1480 } 1481 }, 1482 { 1483 key: "setConfiguracionZona", 1484 value: function setConfiguracionZona(zona) { 1485 $('[data-accion-pizarra="texto-fuente"][data-tipo-letra="' + this.estilosZonas[zona].tipoLetra + '"][data-pizarra="' + zona + '"]').addClass("active"); 1486 this.setSelectValue("texto-size", zona, this.estilosZonas[zona].tamanoLetra); 1487 this.setSelectValue("espacio-linea", zona, this.estilosZonas[zona].espaciadoEntreLineas); 1488 this.setSelectValue("espacio-letras", zona, this.estilosZonas[zona].espaciadoEntreLetras); 1489 this.setSelectValue("espacio-palabras", zona, this.estilosZonas[zona].espaciadoEntrePalabras); 1490 this.setSelectValue("margen-izq", zona, this.estilosZonas[zona].margenIzq); 1491 this.setSelectValue("margen-der", zona, this.estilosZonas[zona].margenDer); 1492 this.setSelectValue("margen-sup", zona, this.estilosZonas[zona].margenSup); 1493 this.setButtonOption("capitalizar", zona, this.estilosZonas[zona].capitalizar); 1494 this.setButtonOption("tipo-alinear", zona, this.estilosZonas[zona].tipoAlinear); 1495 this.setButtonOption("tipoTrocear", zona, this.estilosZonas[zona].tipoTrocear); 1496 } 1497 }, 1498 { 1499 key: "renderColores", 1500 value: function renderColores() { 1501 document.getElementById("ColorFijo").value = "#" + this.configuracion.ColorFijo; 1502 for(var index = 0; index < 10; index++){ 1503 var color = document.getElementById("ColorAleatorio" + (index + 1)); 1504 var check = document.getElementById("ColorAleatorioActivo" + (index + 1)); 1505 color.value = "#" + this.configuracion.ColorAleatorio[index]; 1506 check.checked = this.configuracion.ColorAleatorioActivo[index]; 1507 } 1508 for(var index1 = 0; index1 < 4; index1++){ 1509 var check1 = document.getElementById("Patron" + (index1 + 1) + "Activo"); 1510 var lista = document.getElementById("Patron" + (index1 + 1) + "Lista"); 1511 var color1 = document.getElementById("Patron" + (index1 + 1) + "Color"); 1512 var tamano = document.getElementById("Patron" + (index1 + 1) + "Tamano"); 1513 check1.checked = this.configuracion.PatronActivo[index1]; 1514 lista.value = this.configuracion.PatronLista[index1]; 1515 color1.value = "#" + this.configuracion.PatronColor[index1]; 1516 tamano.value = this.configuracion.PatronTamano[index1]; 1517 lista.disabled = !check1.checked; 1518 color1.disabled = !check1.checked; 1519 tamano.disabled = !check1.checked; 1520 } 1521 } 1522 }, 1523 { 1524 key: "setButtonToggle", 1525 value: function setButtonToggle(name, state) { 1526 if (state) { 1527 $('[data-accion-pizarra="' + name + '"]').addClass("active"); 1528 } else { 1529 $('[data-accion-pizarra="' + name + '"]').removeClass("active"); 1530 } 1531 } 1532 }, 1533 { 1534 key: "setButtonOption", 1535 value: function setButtonOption(name, zona, state) { 1536 $('[data-pizarra="' + zona + '"][data-accion-pizarra="' + name + '"]').find("[value]").removeClass("active"); 1537 $('[data-pizarra="' + zona + '"][data-accion-pizarra="' + name + '"]').find('[value="' + state
1537+ '"]').addClass("active"); 1538 } 1539 }, 1540 { 1541 key: "setSelectValue", 1542 value: function setSelectValue(name, zona, state) { 1543 $('[data-pizarra="' + zona + '"][data-select-pizarra="' + name + '"]').val(state); 1544 } 1545 }, 1546 { 1547 key: "setRadioValue", 1548 value: function setRadioValue(name, state) { 1549 $('[data-radio-pizarra="' + name + '"]').removeProp("checked"); 1550 $('[data-radio-pizarra="' + name + '"][value="' + state + '"]').prop("checked", true); 1551 } 1552 }, 1553 { 1554 key: "crearEstiloInicial", 1555 value: function crearEstiloInicial() { 1556 var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; 1557 return _object_spread({}, this.estiloInicial, options); 1558 } 1559 }, 1560 { 1561 key: "handleSacarTexto", 1562 value: function handleSacarTexto(numero) { 1563 var index = parseInt(numero); 1564 this.setResultadoEnPosicionador("next"); 1565 this.sacarNuevoTextoPor(this.getSiguienteZonaPresentacion(), index); 1566 } 1567 }, 1568 { 1569 key: "getSiguienteZonaPresentacion", 1570 value: function getSiguienteZonaPresentacion() { 1571 var zonasConsecutivas = false; 1572 var array = []; 1573 for(var index = 1; index <= 4; index++){ 1574 if (this.estilosZonas[index].activar) { 1575 array.push(index); 1576 } 1577 } 1578 var index2 = array.indexOf(this.nUltimaZonaPresentada); 1579 if (zonasConsecutivas) { 1580 if (index2 >= 0) { 1581 return array[(index2 + 1) % array.length]; 1582 } else if (array.length > 0) { 1583 return array[0]; 1584 } 1585 return 0; 1586 } else { 1587 if (index2 >= 0) { 1588 return this.nUltimaZonaPresentada; 1589 } else if (array.length > 0) { 1590 return array[0]; 1591 } 1592 return 0; 1593 } 1594 } 1595 }, 1596 { 1597 key: "sacarSiguienteTexto", 1598 value: function sacarSiguienteTexto() { 1599 this.sacarNuevoTextoPor(this.getSiguienteZonaPresentacion()); 1600 } 1601 }, 1602 { 1603 key: "getTextoZonaActual", 1604 value: function getTextoZonaActual() { 1605 return this.getTextoZona(this.nUltimaZonaPresentada); 1606 } 1607 }, 1608 { 1609 key: "getZonaActual", 1610 value: function getZonaActual() { 1611 return this.nUltimaZonaPresentada; 1612 } 1613 }, 1614 { 1615 key: "sacarNuevoTextoPor", 1616 value: function sacarNuevoTextoPor(nZona, nTexto, resultado, nPos) { 1617 if (nZona == 0) { 1618 nZona = this.getSiguienteZonaPresentacion(); 1619 } 1620 if (!nZona) { 1621 Swal.fire({ 1622 icon: "error", 1623 title: "No hay pizarras para presentar textos" 1624 }); 1625 return; 1626 } 1627 if (nTexto === undefined) { 1628 this.nUltimoTextoPresentado++; 1629 } else { 1630 this.nUltimoTextoPresentado = nTexto; 1631 } 1632 if (this.nUltimoTextoPresentado < 0) { 1633 this.nUltimoTextoPresentado = 0; 1634 } 1635 if (this.nUltimoTextoPresentado >= this.listado.getListaTextos().length) { 1636 this.nUltimoTextoPresentado = 0; 1637 } 1638 if (this.listado.getListaTextos().length == 0) { 1639 Swal.fire({ 1640 icon: "error", 1641 title: "No hay textos para presentar" 1642 }); 1643 return; 1644 } 1645 var texto = this.listado.getListaTextos()[this.nUltimoTextoPresentado]; 1646 this.nUltimaZonaPresentada = nZona; 1647 // Almacenar la fecha y hora de la presentación. 1648 this.tiempoInicialZona[nZona] = new Date(); 1649 this.setTextoZona(texto, nZona); 1650 this.updatePosicionadorTextos(); 1651 } 1652 }, 1653 { 1654 key: "renderPosicionadorTextos", 1655 value: function renderPosicionadorTextos() { 1656 var textos = this.listado.getListaTextos(); 1657 var html = ""; 1658 for(var index = 0; index < textos.length; index++){ 1659 var element = textos[index]; 1660 html += '<div class="fa fa-square-o" data-posicionador="'.concat(index, '" data-sacar-texto="').concat(index, '"></div>'); 1661 } 1662 $("#PosicionadorDeTextos").html(html); 1663 } 1664 }, 1665 { 1666 key: "updatePosicionadorTextos", 1667 value: function updatePosicionadorTextos() { 1668 $("[data-posicionador]").removeClass("bg-info"); 1669 $('[data-posicionador="' + this.nUltimoTextoPresentado + '"]').addClass("bg-info"); 1670 } 1671 }, 1672 {
1673 key: "setResultadoEnPosicionador", 1674 value: function setResultadoEnPosicionador(resultado) { 1675 var actual = this.nUltimoTextoPresentado; 1676 var iconos = { 1677 "": "fa-square-o", 1678 "next": "fa-forward-step", 1679 "a": "fa-flag-checkered", 1680 "f": "fa-2", 1681 "n": "fa-circle-question" 1682 }; 1683 for(var key in iconos){ 1684 var v = iconos[key]; 1685 $('[data-posicionador="' + actual + '"]').removeClass(v); 1686 } 1687 $('[data-posicionador="' + actual + '"]').addClass(iconos[resultado]); 1688 } 1689 }, 1690 { 1691 key: "renderFuentes", 1692 value: function renderFuentes() { 1693 $("#Zona0Fuente").find(".dropdown-menu").html(this.renderListaFuentes(0)); 1694 $("#Zona1Fuente").find(".dropdown-menu").html(this.renderListaFuentes(1)); 1695 $("#Zona2Fuente").find(".dropdown-menu").html(this.renderListaFuentes(2)); 1696 $("#Zona3Fuente").find(".dropdown-menu").html(this.renderListaFuentes(3)); 1697 $("#Zona4Fuente").find(".dropdown-menu").html(this.renderListaFuentes(4)); 1698 } 1699 }, 1700 { 1701 key: "renderListaFuentes", 1702 value: function renderListaFuentes(zona) { 1703 var html = ""; 1704 var counter = 1; 1705 for(var index = 0; index < this.tiposDeLetras.length; index++){ 1706 var element = this.tiposDeLetras[index]; 1707 html += '<li><h6 class="dropdown-header">'.concat(element.title, "</h6></li>"); 1708 for(var j = 0; j < element.fonts.length; j++){ 1709 var element2 = element.fonts[j]; 1710 html += ' <li>\n <a title="'.concat(element2.title, '" class="dropdown-item" data-tipo-letra="').concat(element2.name, '" data-accion-pizarra="texto-fuente" style=\'font-family:').concat(element2.name, "' data-pizarra=\"").concat(zona, '">\n ').concat(counter, ". ").concat(element2.title, " abcdefghijklmnñopqrstuvwxyz</a></li>"); 1711 counter++; 1712 } 1713 } 1714 return html; 1715 } 1716 }, 1717 { 1718 key: "encolumnarZonas", 1719 value: function encolumnarZonas(columnas, filas) { 1720 this.configuracion.nColsTabla = columnas; 1721 this.configuracion.nFilasTabla = filas; 1722 for(var index = 1; index <= 4; index++){ 1723 var tipo = this.saberTipoTrocearTexto(index); 1724 this.encolumnarZona(index, tipo); 1725 } 1726 } 1727 }, 1728 { 1729 key: "encolumnarZona", 1730 value: function encolumnarZona(nZona, tipo) { 1731 if (nZona == 0) { 1732 for(var index = 1; index <= 4; index++){ 1733 this.encolumnarZona(index, tipo); 1734 } 1735 } else { 1736 var texto = this.getTextoZona(nZona); 1737 this.asignarTipoTrocear(nZona, tipo); 1738 this.setTextoZona(texto, nZona, false, { 1739 columnas: this.configuracion.nColsTabla 1740 }); 1741 } 1742 } 1743 }, 1744 { 1745 key: "barajarTextoZona", 1746 value: function barajarTextoZona(tipo, nZona) { 1747 if (nZona == 0) { 1748 for(var index = 1; index <= 4; index++){ 1749 this.barajarTextoZona(tipo, index); 1750 } 1751 } else { 1752 this.barajarBloques(nZona, tipo); 1753 this.caracterizarZona(nZona); 1754 } 1755 } 1756 }, 1757 { 1758 key: "getTextoZona", 1759 value: function getTextoZona(nZona) { 1760 // Cuando editas el texto el navegador añade <div></div> 1761 // Este segmento comprueba si has editado el texto y lo corrige. 1762 var e = document.getElementById("Zona" + nZona); 1763 var cars = e.getElementsByTagName("car"); 1764 var texto = ""; 1765 for(var index = 0; index < cars.length; index++){ 1766 var element = cars[index]; 1767 if (element.parentNode && element.parentElement.parentNode) { 1768 var parent = element.parentNode.parentNode; 1769 if (parent.nodeName == "DIV" && !parent.i
1769d.startsWith("Zona") && element.innerText.trim() != "") { 1770 texto += "\n"; 1771 } 1772 } 1773 texto += element.innerText; 1774 } 1775 if (cars.length == 0) { 1776 texto = e.textContent; 1777 } 1778 // 1779 // texto = document.getElementById("Zona" + nZona)!.innerText 1780 texto = texto.trim().replaceAll(/\u2002/g, " "); // Lipiar el caracter espacio (2002h) 1781 texto = texto.replaceAll(/([\t])/g, ""); 1782 console.log("texto = ", texto); 1783 return texto; 1784 } 1785 }, 1786 { 1787 key: "getListaTextoZona", 1788 value: function getListaTextoZona(nZona) { 1789 return this.getTextoZona(nZona).split("\n").map(function(a) { 1790 return a.split(" "); 1791 }); 1792 } 1793 }, 1794 { 1795 key: "actualizarTextoZona", 1796 value: function actualizarTextoZona(nZona) { 1797 var quitarTabla = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; 1798 if (nZona == 0) { 1799 for(var index = 1; index <= 4; index++){ 1800 this.actualizarTextoZona(index, quitarTabla); 1801 } 1802 } else if (nZona >= 1 && nZona <= 4) { 1803 var texto = this.getTextoZona(nZona); 1804 var tabla = this.saberTipoTabla(nZona); 1805 this.setTextoZona(texto, nZona, false, !quitarTabla && tabla ? tabla : undefined); 1806 } 1807 } 1808 }, 1809 { 1810 key: "saberTipoTabla", 1811 value: function saberTipoTabla(nZona) { 1812 if (nZona < 1 || nZona > 4) { 1813 return null; 1814 } 1815 var e = document.getElementById("Zona" + nZona); 1816 if (e.getElementsByTagName("table").length > 0) { 1817 return { 1818 columnas: 5 1819 }; 1820 } 1821 return null; 1822 } 1823 }, 1824 { 1825 key: "barajarBloques", 1826 value: function barajarBloques(nZona, tipo) { 1827 var parrafos = this.getListaTextoZona(nZona); 1828 if (tipo == "Parrafos") { 1829 Pizarra.barajar(parrafos); 1830 this.setTextoZona(parrafos.map(function(a) { 1831 return a.join(" "); 1832 }).join("\n"), nZona, true); 1833 return; 1834 } 1835 if (tipo == "Palabras") { 1836 parrafos.map(function(a) { 1837 return Pizarra.barajar(a); 1838 }); 1839 // Pizarra.barajar(parrafos); 1840 this.setTextoZona(parrafos.map(function(a) { 1841 return a.join(" "); 1842 }).join("\n"), nZona, true); 1843 return; 1844 } 1845 var resultado = ""; 1846 for(var j = 0; j < parrafos.length; j++){ 1847 var linea = ""; 1848 var element = parrafos[j]; 1849 for(var item = 0; item < element.length; item++){ 1850 var element2 = element[item]; 1851 var texts = this.trocearTexto(element2, tipo); 1852 texts = Pizarra.barajar(texts); 1853 linea += (linea == "" ? "" : " ") + texts.join(""); 1854 } 1855 resultado += (resultado == "" ? "" : "\n") + linea; 1856 } 1857 this.setTextoZona(resultado, nZona, true); 1858 // let bloques = this.trocearTexto(this.getTextoZona(nZona), tipo); 1859 // Pizarra.barajar(bloques); 1860 // console.log(bloques); 1861 } 1862 }, 1863 { 1864 key: "limpiarPizarras", 1865 value: function limpiarPizarras() { 1866 for(var index = 1; index <= 4; index++){ 1867 this.setTextoZona("", index); 1868 } 1869 } 1870 }, 1871 { 1872 key: "setTextoZona", 1873 value: function setTextoZona(texto, nZona) { 1874 var noCaraterizar = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false, tabla = arguments.length > 3 ? arguments[3] : void 0; 1875 if (nZona >= 1 && nZona <= 4) { 1876 this.estilosZonas[nZona].texto = texto; 1877 var newTexto = ""; 1878 var ele; 1879 for(var j = 0; j < texto.length; j++){ 1880 ele = texto[j]; 1881 if (texto[j] == " " || ele.charCodeAt(0) == 160 || texto[j].charCo
1881deAt(0) == 8194) { 1882 // Lo pongo para que trocee bien varios espacios en blanco seguidos 1883 newTexto += "\xb7"; 1884 } else { 1885 newTexto += texto[j]; 1886 } 1887 } 1888 texto = newTexto; 1889 var tipoTrocear = this.saberTipoTrocearTexto(nZona); 1890 var aBloques = this.trocearTexto(texto, tipoTrocear); 1891 this.Bloques = _to_consumable_array(aBloques); 1892 var miHTML = ""; 1893 if (this.configuracion.EncolumnarBloques) { 1894 miHTML = this.HTMLearTrozosTabla(aBloques, nZona, this.configuracion.nColsTabla); 1895 } else if (tabla) { 1896 miHTML = this.HTMLearTrozosTabla(aBloques, nZona, tabla.columnas); 1897 } else { 1898 miHTML = this.HTMLearTrozosTexto(aBloques, nZona); 1899 } 1900 miHTML = TextosUtils.replaceAll(">\xb7</car>", "> </car>", miHTML); 1901 $("#Zona" + nZona).html(miHTML); 1902 if (noCaraterizar == false) { 1903 this.caracterizarZona(nZona); 1904 } 1905 } 1906 } 1907 }, 1908 { 1909 // ******************** 1910 key: "trocearTexto", 1911 value: function trocearTexto(miTexto, tipo) { 1912 // ******************** 1913 var res = []; 1914 miTexto = TextosUtils.replaceAll("\n", "\xb6", miTexto); 1915 if (tipo == "Letras") { 1916 res = TextosUtils.deletrearTexto(miTexto); 1917 } else if (tipo == "Grupos") { 1918 res = TextosUtils.gruparCTexto(miTexto); 1919 } else if (tipo == "Silabas") { 1920 res = TextosUtils.silabearTexto(miTexto); 1921 } else if (tipo == "Palabras") { 1922 res = TextosUtils.palabrearTexto(miTexto); 1923 } else if (tipo == "Parrafos") { 1924 res = TextosUtils.parrafearTexto(miTexto); 1925 } else if (tipo == "TodoUno") { 1926 res = TextosUtils.todearTexto(miTexto); 1927 } else { 1928 alert("Tipo de troceo no definidio: " + tipo); 1929 } 1930 if (res[res.length - 1] == "") { 1931 // Quitar el último si está vacÃo. 1932 res.pop(); 1933 //res.splice(res.length-1,1); 1934 } 1935 // console.log("Trocear:\n "+miTexto); 1936 // console.log("Troceado:\n "+res); 1937 return res; 1938 } 1939 }, 1940 { 1941 /** 1942 * Obtener la estructua presentable en Texto o en Tabla 1943 * @param aTrozos 1944 * @param nZona 1945 * @returns 1946 */ key: "getEstructuraBloques", 1947 value: function getEstructuraBloques(aTrozos, nZona) { 1948 var listaEspacios = [ 1949 String.fromCharCode(32), 1950 String.fromCharCode(160), 1951 String.fromCharCode(8194), 1952 String.fromCharCode(8195), 1953 String.fromCharCode(8201), 1954 String.fromCharCode(45), 1955 String.fromCharCode(183) 1956 ]; 1957 var nCar = 0; 1958 var resultado = []; 1959 for(var i = 0; i < aTrozos.length; i++){ 1960 var idTrozo = "tz" + nZona + "_" + (i + 1); 1961 var espacio = listaEspacios.indexOf(aTrozos[i]) !== -1; 1962 var caracteres = []; 1963 var clases = "bloque"; 1964 if (espacio) { 1965 clases += " espacio"; 1966 } else { 1967 clases += " letra"; 1968 } 1969 if (aTrozos[i] != undefined) { 1970 for(var j = 0; j < aTrozos[i].length; j++){ 1971 nCar++; 1972 var idCaracter = "c" + nZona + "-" + nCar; 1973 var miLetra = aTrozos[i][j]; 1974 caracteres.push({ 1975 c: miLetra, 1976 id: idCaracter 1977 }); 1978 } 1979 } 1980 resultado.push({ 1981 id: idTrozo, 1982 espacio: espacio, 1983 clases: clases, 1984 caracteres: caracteres 1985 }); 1986 } 1987 return resultado; 1988 } 1989 }, 1990 { 1991 // ******************** 1992 key: "HTMLearTrozosTexto", 1993 value: function HTMLearTrozosTexto(aTrozos, nZona) { 1994 // ******************** 1995 var estructura = this.getEstructuraBloques(aTrozos, nZona); 1996 var miHTML = ""; 1997 for(var index = 0; index < estructura.length; index++){ 1998 var element = estructura[index]; 1999 miHTML += "<tz class='" + element.clases + "' id='" + element.i
1999d + "' style='cursor:text' draggable='false' onmouseover='this.style.background=\"yellow\";' onmouseout='this.style.background=\"transparent\";' >"; 2000 for(var j = 0; j < element.caracteres.length; j++){ 2001 var element2 = element.caracteres[j]; 2002 var miLetra = element2.c; 2003 var idCaracter = element2.id; 2004 miHTML += "<car id='" + idCaracter + "' title='" + idCaracter + "'>" + miLetra + "</car>"; 2005 } 2006 miHTML += "</tz>"; 2007 } 2008 miHTML = TextosUtils.replaceAll("\xb6", "<br>", miHTML); 2009 return miHTML; 2010 } 2011 }, 2012 { 2013 key: "HTMLearTrozosTabla", 2014 value: function HTMLearTrozosTabla(aBloques, nZona) { 2015 var columnas = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 5; 2016 if (columnas == 0) { 2017 return "Columnas no v\xe1lido"; 2018 } 2019 var estructura = this.getEstructuraBloques(aBloques, nZona); 2020 var bloquesTexto = estructura.filter(function(a) { 2021 return !a.espacio; 2022 }); 2023 // Buscamos el numero de filas. 2024 // Si el usuario ha indicado un valor menos de las posible, entonces hay que incrementar el número de filas 2025 var filas = Math.max(Math.floor(bloquesTexto.length / columnas), this.configuracion.nFilasTabla); 2026 // Hay que combinar los elementos para que los espacios y saltos de lÃnea no aparezcan 2027 // en la tabla pero si estén cuando queramos recuperar el texto. 2028 // La estrategia que se sigue es crear una lista con los caracteres visibles y no visibles. 2029 var temporal = []; 2030 var resultadoEstructura = []; 2031 for(var index = 0; index < estructura.length; index++){ 2032 var element = estructura[index]; 2033 if (element.espacio || element.caracteres.length > 0 && element.caracteres[0].c == "\xb6") { 2034 if (index == estructura.length - 1) { 2035 // Si es el ultimo de la lista insertar directamente 2036 resultadoEstructura.push(_object_spread_props(_object_spread({}, element), { 2037 prefix: temporal 2038 })); 2039 temporal = []; 2040 } else { 2041 temporal = _to_consumable_array(temporal).concat(_to_consumable_array(element.caracteres)); 2042 } 2043 } else { 2044 resultadoEstructura.push(_object_spread_props(_object_spread({}, element), { 2045 prefix: temporal 2046 })); 2047 temporal = []; 2048 } 2049 } 2050 var html = ""; 2051 for(var index1 = 0; index1 < filas; index1++){ 2052 html += "<tr>"; 2053 for(var j = 0; j < columnas; j++){ 2054 var miHTML = ""; 2055 if (resultadoEstructura.length > 0) { 2056 var element1 = resultadoEstructura.shift(); 2057 miHTML = "<tz class='" + element1.clases + "' id='" + element1.id + "' style='cursor:text' draggable='false' onmouseover='this.style.background=\"yellow\";' onmouseout='this.style.background=\"transparent\";' >"; 2058 for(var j1 = 0; j1 < element1.prefix.length; j1++){ 2059 var element2 = element1.prefix[j1]; 2060 var miLetra = element2.c; 2061 var idCaracter = element2.id; 2062 miHTML += '<car style="display: none" id=\'' + idCaracter + "' title='" + idCaracter + "'>" + miLetra + "</car>"; 2063 } 2064 for(var j2 = 0; j2 < element1.caracteres.length; j2++){ 2065 var element21 = element1.caracteres[j2]; 2066 var miLetra = element21.c; 2067 var idCaracter1 = element21.id; 2068 miHTML += "<car id='" + idCaracter1 + "' title='" + idCaracter1 + "'>" + miLetra + "</car>"; 2069 } 2070 miHTML += "</tz>"; 2071 } else { 2072 var rand = Math.random() * 1000000; 2073 miHTML = '<tz id="rand-'.concat(rand, '" class="bloque espacio"><car> </car></tz>'); 2074 } 2075 html += '<td style="padding:5px;border:1px solid #ccc">'.concat(miHTML, "</td>"); 2076 } 2077 html += "</tr>"; 2078 }
2079 return "<table class='tabla-inventapalabras' style=\"width:100%;overflow-x:hidden\">".concat(html, "</table>"); 2080 } 2081 }, 2082 { 2083 key: "getNumeroBloquesEnZona", 2084 value: function getNumeroBloquesEnZona(nZona) { 2085 if (nZona == 0) { 2086 return 0; 2087 } 2088 var total = 0; 2089 var el = document.getElementById("Zona" + nZona); 2090 var list = el === null || el === void 0 ? void 0 : el.getElementsByTagName("tz"); 2091 for(var index = 0; index < list.length; index++){ 2092 var _element_textContent; 2093 var element = list[index]; 2094 if (((_element_textContent = element.textContent) === null || _element_textContent === void 0 ? void 0 : _element_textContent.trim()) != "") { 2095 total++; 2096 } 2097 } 2098 return total; 2099 } 2100 }, 2101 { 2102 key: "saberTipoTrocearTexto", 2103 value: function saberTipoTrocearTexto(nZona) { 2104 if (this.estilosZonas[nZona]) { 2105 return this.estilosZonas[nZona].tipoTrocear; 2106 } 2107 return this.estilosZonas[0].tipoTrocear; 2108 } 2109 }, 2110 { 2111 key: "saberTamanoLetra", 2112 value: function saberTamanoLetra(nZona) { 2113 if (this.estilosZonas[nZona]) { 2114 return this.estilosZonas[nZona].tamanoLetra; 2115 } 2116 return this.estilosZonas[0].tamanoLetra; 2117 } 2118 }, 2119 { 2120 key: "saberTipoAlinear", 2121 value: function saberTipoAlinear(nZona) { 2122 if (this.estilosZonas[nZona]) { 2123 return this.estilosZonas[nZona].tipoAlinear; 2124 } 2125 return this.estilosZonas[0].tipoAlinear; 2126 } 2127 }, 2128 { 2129 key: "saberTipoLetra", 2130 value: function saberTipoLetra(nZona) { 2131 if (this.estilosZonas[nZona]) { 2132 return this.estilosZonas[nZona].tipoLetra; 2133 } 2134 return this.estilosZonas[0].tipoLetra; 2135 } 2136 }, 2137 { 2138 key: "saberMargenIzq", 2139 value: function saberMargenIzq(nZona) { 2140 return this.estilosZonas[nZona].margenIzq; 2141 } 2142 }, 2143 { 2144 key: "saberMargenDer", 2145 value: function saberMargenDer(nZona) { 2146 return this.estilosZonas[nZona].margenDer; 2147 } 2148 }, 2149 { 2150 key: "saberMargenSup", 2151 value: function saberMargenSup(nZona) { 2152 return this.estilosZonas[nZona].margenSup; 2153 } 2154 }, 2155 { 2156 key: "saberEspaciadoEntreLineas", 2157 value: function saberEspaciadoEntreLineas(nZona) { 2158 return this.estilosZonas[nZona].espaciadoEntreLineas; 2159 } 2160 }, 2161 { 2162 key: "saberEspaciadoEntreLetras", 2163 value: function saberEspaciadoEntreLetras(nZona) { 2164 return this.estilosZonas[nZona].espaciadoEntreLetras; 2165 } 2166 }, 2167 { 2168 key: "saberEspaciadoEntrePalabras", 2169 value: function saberEspaciadoEntrePalabras(nZona) { 2170 return this.estilosZonas[nZona].espaciadoEntrePalabras; 2171 } 2172 }, 2173 { 2174 key: "saberTipoCapitalizar", 2175 value: function saberTipoCapitalizar(nZona) { 2176 var tipo = this.estilosZonas[nZona].capitalizar; 2177 if (tipo == "0") { 2178 return ""; 2179 } 2180 if (tipo == "1") { 2181 return "lowercase"; 2182 } 2183 if (tipo == "2") { 2184 return "uppercase"; 2185 } 2186 if (tipo == "3") { 2187 return "capitalize"; 2188 } 2189 return ""; 2190 } 2191 }, 2192 { 2193 key: "caracterizarZonas", 2194 value: function caracterizarZonas() { 2195 for(var index = 1; index <= 4; index++){ 2196 this.caracterizarZona(index); 2197 } 2198 } 2199 }, 2200 { 2201 key: "caracterizarZona", 2202 value: function caracterizarZona() { 2203 var nZona = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0; 2204 this.asignarTamanoLetra(nZona); 2205 this.asignarTipoLetra(nZona); 2206 this.asignarDesbordamientoHorizontal(); 2207 this.asignar1Visible(nZona); 2208 this.asignarTipoAlinear(nZona); 2209 this.asignarMargenSup(nZona); 2210 this.asignarMargenIzq(nZona); 2211 this.asignarMargenDer(nZona); 2212 this.asignarEspaciadoEntreLineas(nZona); 2213 this.asignarEspaciadoEntreLetras(nZona); 2214 this.asignarEspaciadoEntrePalabras(nZona); 2215 this.asignarNegrita(); 2216 this.asignarCursiva(); 2217 this.asignarSubrayado(); 2218 this.asignarBordesLetras(); // Ineficiente: Crear clase css y activar o desactivar 2219 this.asignarBordesEspacios(); 2220 this.asignarSilabaTonica(); 2221 this.asignarCapitalizar(nZona); 2222 if (nZona == 0) { 2223 for(var index = 1; index <= 4; index++){ 2224 if (this.configuracion.BarajarBloques) { 2225 this.barajarBloques(index, this.saberTipoTrocearTexto(index)); 2226 } 2227 this.asignarColores(index, this.configuracion.TipoColorear); 2228 this.asignarModoTrabajo(index, this.configuracion.modoTrabajo); 2229 } 2230 } else { 2231 if (this.configuracion.BarajarBloques) { 2232 this.barajarBloques(nZona, this.saberTipoTrocearTexto(nZona)); 2233 } 2234 this.asignarColores(nZona, this.configuracion.TipoColorear); 2235 this.asignarModoTrabajo(nZona, this.configuracion.modoTrabajo); 2236 } 2237 } 2238 }, 2239 { 2240 key: "asignarTipoTrocear", 2241 value: function asignarTipoTrocear(nZona, tipo) { 2242 if (nZona == 0) { 2243 for(var index = 0; index < 4; index++){ 2244 this.estilosZonas[index].tipoTrocear = tipo; 2245 } 2246 } else { 2247 this.estilosZonas[nZona - 1].tipoTrocear = tipo; 2248 } 2249 this.setConfiguracion(); 2250 } 2251 }, 2252 { 2253 key: "asignarPizarrasActivas", 2254 value: function asignarPizarrasActivas() { 2255 for(var i = 1; i <= 4; i++){ 2256 if (this.estilosZonas[i].activar) { 2257 document.getElementById("Pizarra_" + i + "_Main").hidden = false;
2258 $('[data-accion-pizarra="activar-pizarra"][data-pizarra="' + i + '"]').addClass("active"); 2259 } else { 2260 document.getElementById("Pizarra_" + i + "_Main").hidden = true; 2261 $('[data-accion-pizarra="activar-pizarra"][data-pizarra="' + i + '"]').removeClass("active"); 2262 } 2263 } 2264 } 2265 }, 2266 { 2267 key: "asignarTamanoLetra", 2268 value: function asignarTamanoLetra(nZona) { 2269 var tamanoLetraPx = this.saberTamanoLetra(nZona); 2270 var e; 2271 if (nZona == 0) { 2272 for(var i = 1; i <= 4; i++){ 2273 var _this_estilosZonas_nZona; 2274 if ((_this_estilosZonas_nZona = this.estilosZonas[nZona]) === null || _this_estilosZonas_nZona === void 0 ? void 0 : _this_estilosZonas_nZona.activar) { 2275 document.getElementById("Zona" + i).style.fontSize = tamanoLetraPx.toString(); // El de la zona 0 2276 // Y además pongo todas las zonas con el mismo tipo de letra 2277 // this.marcarOpcTamanoLetra(i, tamanoLetraPx); 2278 } 2279 } 2280 } else if (nZona >= 1 && nZona <= 4) { 2281 e = document.getElementById("Zona" + nZona); 2282 e.style.fontSize = tamanoLetraPx; 2283 } 2284 } 2285 }, 2286 { 2287 key: "asignarTipoLetra", 2288 value: function asignarTipoLetra(nZona) { 2289 // ********************** 2290 var tipoLetra = this.saberTipoLetra(nZona); 2291 if (nZona == 0) { 2292 for(var i = 1; i <= 4; i++){ 2293 var _this_estilosZonas_nZona; 2294 if ((_this_estilosZonas_nZona = this.estilosZonas[nZona]) === null || _this_estilosZonas_nZona === void 0 ? void 0 : _this_estilosZonas_nZona.activar) { 2295 document.getElementById("Zona" + i).style.fontFamily = tipoLetra; // El de la zona 0 2296 // Y además pongo todas las zonas con el mismo tipo de letra 2297 // marcarOpcTipoLetra(i, tipoLetra); 2298 } 2299 } 2300 } else if (nZona >= 1 && nZona <= 4) { 2301 document.getElementById("Zona" + nZona).style.fontFamily = tipoLetra; 2302 } 2303 } 2304 }, 2305 { 2306 key: "asignarDesbordamientoHorizontal", 2307 value: function asignarDesbordamientoHorizontal() { 2308 for(var i = 1; i <= 4; i++){ 2309 document.getElementById("Zona" + i).style.whiteSpace = this.configuracion.desbordamientoHorizontal ? "nowrap" : "normal"; 2310 } 2311 } 2312 }, 2313 { 2314 key: "asignar1Visible", 2315 value: function asignar1Visible(nZona) { 2316 // ****************** 2317 if (nZona == null) { 2318 nZona = this.nUltimaZonaPresentada; 2319 } 2320 var e = document.getElementById("solo1Visible"); 2321 if (this.configuracion.solo1Zona && !this.ignorarSolo1Visible) { 2322 for(var i = 1; i <= 4; i++){ 2323 if (i == nZona) { 2324 // Se queda 2325 } else { 2326 // Se ocultan 2327 document.getElementById("Zona" + i).innerText = ""; 2328 document.getElementById("Horai_Z" + i).value = ""; 2329 document.getElementById("ti_Z" + i).value = "0"; 2330 document.getElementById("tf_Z" + i).value = "0"; 2331 document.getElementById("nPos_Z" + i).value = "-1"; 2332 } 2333 } 2334 } 2335 } 2336 }, 2337 { 2338 key: "asignarTipoAlinear", 2339 value: function asignarTipoAlinear(nZona) { 2340 // ********************** 2341 //tiposAlinear 2342 var nTpAlign; 2343 var anteriorTipoAlinearPresentado = this.ultimoTipoAlinearPresentado; 2344 var tipoAlinear = this.saberTipoAlinear(nZona); 2345 //console.log("El tipo alinear en zona "+nZona+" es "+tipoAlinear); 2346 if (tipoAlinear == "Secuencial") { 2347 //secuenciar el ultimoTipoAlinearPresentado 2348 nTpAlign = this.tiposAlinear.indexOf(this.ultimoTipoAlinearPresentado); 2349 // posibles = 1,2,3 izq,centro,derecha 2350 //nTpAlign++; // No se porqué pero lo tuve que cambiar porque me lo hace 2 veces ¿..? 2351 //if (nTpAlign>3) { nTpAlign=1;} 2352 nTpAlign++; 2353 if (nTpAlign > 3) { 2354 nTpAlign = 1; 2355 } 2356 //if (nTpAlign<1) { nTpAlign=3;} 2357 this.ultimoTipoAlinearPresentado = this.tiposAlinear[nTpAlign]; 2358 } else if (tipoAlinear == "Aleatoria") { 2359 //aleatorizar el ultimoTipoAlinearPresentado 2360 nTpAlign = Math.random() * 4 + 1; // + (this.tiposAlinear.indexOf(this.ultimoTipoAlinearPresentado)); 2361 this.ultimoTipoAlinearPresentado = this.tiposAlinear[nTpAlign % this.tiposAlinear.length]; 2362 } else { 2363 this.ultimoTipoAlinearPresentado = tipoAlinear; 2364 } 2365 var e; 2366 if (nZona == 0) { 2367 for(var i = 1; i <= 4; i++){ 2368 var _this_estilosZonas_i; 2369 if ((_this_estilosZonas_i = this.estilosZonas[i]) === null || _this_estilosZonas_i === void 0 ? void 0 : _this_estilosZonas_i.activar) { 2370 e = document.getElementById("Zona" + i); 2371 switch(this.ultimoTipoAlinearPresentado){ 2372 case "Izquierda": 2373 e.style.textAlign = "left"; 2374 break; 2375 case "Centro": 2376 e.style.textAlign = "center"; 2377 break; 2378 case "Derecha": 2379 e.style.textAlign = "right"; 2380 break; 2381 case "Justificada": 2382 e.style.textAlign = "justify"; 2383 break; 2384 } 2385 } 2386 } 2387 // // Lo desmarcamos de la zona 0 2388 // document.getElementById("tipoAlinear" + anteriorTipoAlinearPresentado + "_Z0")?.style.backgroundColor = "transparent";
2389 // //Y además Lo asignamos a las zonas activas 2390 // for (var i = 1; i <= 4; i++) { 2391 // if (this.estilosZonas[i].activar) { 2392 // // this.marcarOpcTipoAlinear(i, this.ultimoTipoAlinearPresentado); 2393 // } 2394 // } 2395 } else if (nZona >= 1 && nZona <= 4) { 2396 e = document.getElementById("Zona" + nZona); 2397 switch(this.ultimoTipoAlinearPresentado){ 2398 case "Izquierda": 2399 e.style.textAlign = "left"; 2400 break; 2401 case "Centro": 2402 e.style.textAlign = "center"; 2403 break; 2404 case "Derecha": 2405 e.style.textAlign = "right"; 2406 break; 2407 case "Justificada": 2408 e.style.textAlign = "justify"; 2409 break; 2410 } 2411 } 2412 } 2413 }, 2414 { 2415 key: "asignarMargenIzq", 2416 value: function asignarMargenIzq(nZona) { 2417 if (nZona == 0) { 2418 var margenPx = this.saberMargenIzq(0); 2419 for(var i = 1; i <= 4; i++){ 2420 if (this.estilosZonas[i].activar) { 2421 // document.getElementById("margenIzq" + i).value = margenPx; 2422 document.getElementById("Zona" + i).style.paddingLeft = margenPx; 2423 } 2424 } 2425 } else if (nZona >= 1 && nZona <= 4) { 2426 var margenPx = this.saberMargenIzq(nZona); 2427 document.getElementById("Zona" + nZona).style.paddingLeft = margenPx; 2428 } 2429 } 2430 }, 2431 { 2432 key: "asignarMargenDer", 2433 value: function asignarMargenDer(nZona) { 2434 if (nZona == 0) { 2435 var margenPx = this.saberMargenDer(0); 2436 for(var i = 1; i <= 4; i++){ 2437 if (this.estilosZonas[i].activar) { 2438 // document.getElementById("margenDer" + i).value = margenPx; 2439 document.getElementById("Zona" + i).style.paddingRight = margenPx; 2440 } 2441 } 2442 } else if (nZona >= 1 && nZona <= 4) { 2443 var margenPx = this.saberMargenDer(nZona); 2444 document.getElementById("Zona" + nZona).style.paddingRight = margenPx; 2445 } 2446 } 2447 }, 2448 { 2449 key: "asignarMargenSup", 2450 value: function asignarMargenSup(nZona) { 2451 if (nZona == 0) { 2452 var margenPx = this.saberMargenSup(0); 2453 for(var i = 1; i <= 4; i++){ 2454 if (this.estilosZonas[nZona].activar) { 2455 // (document.getElementById("margenSup" + i) as HTMLInputElement).value = margenPx; 2456 document.getElementById("Zona" + i).style.paddingTop = margenPx; 2457 } 2458 } 2459 } else if (nZona >= 1 && nZona <= 4) { 2460 var margenPx = this.saberMargenSup(nZona); 2461 document.getElementById("Zona" + nZona).style.paddingTop = margenPx; 2462 } 2463 } 2464 }, 2465 { 2466 key: "asignarEspaciadoEntreLineas", 2467 value: function asignarEspaciadoEntreLineas(nZona) { 2468 // ********************** 2469 var margenPx = this.saberEspaciadoEntreLineas(nZona); 2470 if (nZona == 0) { 2471 for(var i = 1; i <= 4; i++){ 2472 if (this.estilosZonas[nZona].activar) { 2473 // document.getElementById("espaciadoEntreLineas"+i).value = margenPx; 2474 document.getElementById("Zona" + i).style.lineHeight = margenPx; 2475 } 2476 } 2477 } else if (nZona >= 1 && nZona <= 4) { 2478 document.getElementById("Zona" + nZona).style.lineHeight = margenPx; 2479 } 2480 } 2481 }, 2482 { 2483 // ********************** 2484 key: "asignarEspaciadoEntreLetras", 2485 value: function asignarEspaciadoEntreLetras(nZona) { 2486 // ********************** 2487 var margenPx = this.saberEspaciadoEntreLetras(nZona); 2488 if (nZona == 0) { 2489 for(var i = 1; i <= 4; i++){ 2490 if (this.estilosZonas[i].activar) { 2491 // document.getElementById("espaciadoEntreLetras"+i).value = margenPx; 2492 document.getElementById("Zona" + i).style.letterSpacing = margenPx; 2493 } 2494 } 2495 } else if (nZona >= 1 && nZona <= 4) { 2496 document.getElementById("Zona" + nZona).style.letterSpacing = margenPx; 2497 } 2498 } 2499 }, 2500 { 2501 // ********************** 2502 key: "asignarEspaciadoEntrePalabras", 2503 value: function asignarEspaciadoEntrePalabras(nZona) { 2504 // ********************** 2505 var margenPx = this.saberEspaciadoEntrePalabras(nZona); 2506 if (nZona == 0) { 2507 for(var i = 1; i <= 4; i++){ 2508 if (this.estilosZonas[i].activar) { 2509 // document.getElementById("espaciadoEntrePalabras"+i).value = margenPx; 2510 document.getElementById("Zona" + i).style.wordSpacing = margenPx; 2511 } 2512 } 2513 } else if (nZona >= 1 && nZona <= 4) { 2514 document.getElementById("Zona" + nZona).style.wordSpacing = margenPx; 2515 } 2516 } 2517 }, 2518 { 2519 // **************** 2520 key: "asignarNegrita", 2521 value: function asignarNegrita() { 2522 // ***************** 2523 var tipo = this.configuracion.negrita ? "bold" : "normal"; 2524 for(var i = 1; i <= 4; i++){ 2525 if (this.estilosZonas[i].activar) { 2526 document.getElementById("Zona" + i).style.fontWeight = tipo; 2527 } 2528 } 2529 } 2530 }, 2531 { 2532 // **************** 2533 key: "asignarCursiva", 2534 value: function asignarCursiva() { 2535 // ***************** 2536 var tipo = this.configuracion.cursiva ? "italic" : "normal"; 2537 for(var i = 1; i <= 4; i++){ 2538 if (this.estilosZonas[i].activar) { 2539 document.getElementById("Zona" + i).style.fontStyle = tipo; 2540 } 2541 } 2542 } 2543 }, 2544 { 2545 // **************** 2546 key: "asignarSubrayado", 2547 value: function asignarSubrayado() { 2548 // ***************** 2549 var tipo = this.configuracion.subrayado ? "underline" : "none"; 2550 for(var i = 1; i <= 4; i++){ 2551 if (this.estilosZonas[i].activar) { 2552 document.getElementById("Zona" + i).style.textDecoration = tipo; 2553 } 2554 } 2555 } 2556 }, 2557 { 2558 // **************** 2559 key: "asignarBordesLetras", 2560 value: function asignarBordesLetras() { 2561 // ***************** 2562 for(var i = 1; i <= 4; i++){ 2563 if (this.estilosZonas[i].activar) { 2564 var zona = document.getElementById("Zona" + i); 2565 if (this.configuracion.BordesLetras) { 2566 $("#Zona" + i).addClass("BordesLetras"); 2567 } else { 2568 $("#Zona" + i).removeClass("BordesLetras"); 2569 } 2570 } 2571 } 2572 } 2573 }, 2574 { 2575 // **************** 2576 key: "asignarBordesEspacios", 2577 value: function asignarBordesEspacios() { 2578 // ***************** 2579 // espacios y guiones separadores de palabras 2580 for(var i = 1; i <= 4; i++){ 2581 if (this.estilosZonas[i].activar) { 2582 var zona = document.getElementById("Zona" + i); 2583 if (this.configuracion.BordesEspacios) { 2584 $("#Zona" + i).addClass("BordesEspacios"); 2585 } else { 2586 $("#Zona" + i).removeClass("BordesEspacios"); 2587 } 2588 } 2589 } 2590 } 2591 }, 2592 { 2593 // **************** 2594 key: "asignarSilabaTonica", 2595 value: function asignarSilabaTonica() { 2596 // ***************** 2597 if (this.configuracion.SilabaTonica) { 2598 this.marcarSTonicas(true); 2599 } else { 2600 this.marcarSTonicas(false); 2601 } 2602 } 2603 }, 2604 { 2605 key: "marcarSTonicas", 2606 value: function marcarSTonicas(sTonica) { 2607 // Primero desmarcar todas las marcas overline, si las hubiera 2608 for(var nZona = 1; nZona <= 4; nZona++){ 2609 var e = document.getElementById("Zona" + nZona); 2610 var cars = e.getElementsByTagName("car"); 2611 for(var i = 0; i < cars.length; i++){ 2612 cars[i].style.textDecoration = "none"; 2613 } 2614 } 2615 if (sTonica) { 2616 for(var nZona = 1; nZona <= 4; nZona++){ 2617 var e = document.getElementById("Zona" + nZona); 2618 var cars = e.getElementsByTagName("car"); 2619 var caracteres = []; 2620 var ids = []; 2621 var index = -1; 2622 var n; 2623 var palabra = ""; 2624 var finPalabra = false;
2625 for(var i = 0; i < cars.length; i++){ 2626 caracteres[i] = cars[i].innerText.toLowerCase(); // en minusculas 2627 n = caracteres[i].charCodeAt(0); 2628 // Ascii extendido á é à ó ú ü ñ 2629 if (n >= 97 && n <= 122 || n == 225 || n == 233 || n == 237 || n == 243 || n == 250 || n == 252 || n == 241) { 2630 // Es una letra 2631 palabra += caracteres[i]; 2632 index++; 2633 ids[index] = cars[i].id; 2634 if (i == cars.length - 1) { 2635 // última letra. Alcanzado final de palabra. 2636 finPalabra = true; 2637 } 2638 } else { 2639 // alcanzado final de palabra 2640 finPalabra = true; 2641 } 2642 if (finPalabra) { 2643 //console.log(palabra); 2644 // Hemos llegado al final de la palabra. Examinarla 2645 if (palabra.trim() != "") { 2646 // silabear la palabra 2647 var silabas = TextosUtils.silabearTexto(palabra); 2648 var ns = silabas.length; 2649 var sAMarcar = TextosUtils.saberTipoAcento(silabas); 2650 // devuelve nº...654321-0 2651 // Encontrar los ids inicio y final de sÃlaba tónica 2652 // Contar ids 2653 var conta = 0; 2654 for(var j = 0; j < ns; j++){ 2655 if (j - ns == sAMarcar) { 2656 // Se marca esta sÃlaba 2657 //console.log(silabas[j]+" es tónica. Conta= "+conta+" "+(conta+silabas[j].length-1)); 2658 for(var k = conta; k < conta + silabas[j].length; k++){ 2659 document.getElementById(ids[k]).style.textDecoration = "overline"; 2660 } 2661 } else { 2662 conta += silabas[j].length; 2663 } 2664 } 2665 } 2666 palabra = ""; 2667 ids = []; 2668 index = -1; 2669 finPalabra = false; 2670 } 2671 } 2672 } 2673 } 2674 } 2675 }, 2676 { 2677 key: "asignarCapitalizar", 2678 value: function asignarCapitalizar(nZona) { 2679 var tipo = this.saberTipoCapitalizar(nZona); 2680 for(var i = 1; i <= 4; i++){ 2681 if (this.estilosZonas[i].activar) { 2682 document.getElementById("Zona" + i).style.textTransform = tipo; 2683 } 2684 } 2685 } 2686 }, 2687 { 2688 key: "asignarAlto", 2689 value: function asignarAlto(nZona) { 2690 if (nZona == 0) { 2691 for(var i = 1; i <= 4; i++){ 2692 this.asignarAlto(i); 2693 } 2694 } else if (nZona >= 1 && nZona <= 4) { 2695 var alto = this.estilosZonas[nZona].alto; 2696 var zona = document.getElementById("Zona" + nZona); 2697 if (alto) { 2698 zona.style.height = alto; 2699 } else { 2700 zona.style.height = "auto"; // Si es 0, auto 2701 } 2702 zona.style.width = "850px"; 2703 } 2704 } 2705 }, 2706 { 2707 key: "asignarModoTrabajo", 2708 value: function asignarModoTrabajo(nZona, modo) { 2709 var _this = this; 2710 var CONTENTEDITABLE_ENABLE = "true"; 2711 var CONTENTEDITABLE_DISABLE = "false"; 2712 if (modo == "modoProtegido") { 2713 var e = document.getElementById("Zona" + nZona); 2714 e.contentEditable = CONTENTEDITABLE_DISABLE; 2715 e.draggable = true; 2716 e.style.cursor = "move"; 2717 e.onmouseover = function(ev) { 2718 this.style.cursor = "move"; 2719 }; 2720 var trozos = e.getElementsByTagName("tz"); 2721 for(var ntrozo = 0; ntrozo < trozos.length; ntrozo++){ 2722 var e1 = trozos[ntrozo]; 2723 if (e1) { 2724 e1.contentEditable = CONTENTEDITABLE_DISABLE; 2725 e1.style.cursor = "default"; 2726 e1.draggable = false;
2727 e1.ondrop = function() {}; 2728 e1.ondragover = function() {}; 2729 e1.ondragstart = function() {}; 2730 e1.ondragend = function() {}; 2731 e1.onclick = function() {}; 2732 e1.removeAttribute("onClick"); 2733 e1.setAttribute("onClick", ""); 2734 e1.onblur = function() {}; 2735 } 2736 } 2737 } else if (modo == "modoMover") { 2738 var e2 = document.getElementById("Zona" + nZona); 2739 e2.contentEditable = CONTENTEDITABLE_DISABLE; 2740 e2.draggable = false; 2741 e2.style.cursor = "default"; 2742 e2.onmouseover = function(ev) { 2743 this.style.cursor = "default"; 2744 }; 2745 var trozos1 = e2.getElementsByTagName("tz"); 2746 for(var ntrozo = 0; ntrozo < trozos1.length; ntrozo++){ 2747 var e3 = trozos1[ntrozo]; 2748 if (e3) { 2749 e3.contentEditable = CONTENTEDITABLE_DISABLE; 2750 e3.style.cursor = "move"; 2751 e3.draggable = true; 2752 e3.ondrop = function() {}; 2753 e3.ondragover = function() {}; 2754 e3.ondragstart = function() {}; 2755 e3.ondragend = function() {}; 2756 e3.ondrop = function(ev) { 2757 return _this.handleDropTrozo(ev); 2758 }; 2759 e3.ondragover = function(ev) { 2760 return _this.handleAllowDropTrozo(ev); 2761 }; 2762 e3.ondragstart = function(ev) { 2763 return _this.handleDragStartTrozo(ev); 2764 }; 2765 e3.ondragend = function(ev) { 2766 return _this.handleDragEndTrozo(ev); 2767 }; 2768 e3.onclick = function() {}; 2769 e3.removeAttribute("onClick"); 2770 e3.setAttribute("onClick", ""); 2771 e3.onblur = function() {}; 2772 } 2773 } 2774 } else if (modo == "modoEditar") { 2775 var e4 = document.getElementById("Zona" + nZona); 2776 e4.contentEditable = CONTENTEDITABLE_ENABLE; 2777 e4.draggable = false; 2778 e4.style.cursor = "text"; 2779 e4.onmouseover = function(ev) { 2780 this.style.cursor = "text"; 2781 }; 2782 var trozos2 = e4.getElementsByTagName("tz"); 2783 for(var ntrozo = 0; ntrozo < trozos2.length; ntrozo++){ 2784 var e5 = trozos2[ntrozo]; 2785 if (e5) { 2786 e5.contentEditable = CONTENTEDITABLE_ENABLE; 2787 e5.style.cursor = "text"; 2788 e5.draggable = false; 2789 e5.ondrop = function() {}; 2790 e5.ondragover = function() {}; 2791 e5.ondragstart = function() {}; 2792 e5.ondragend = function() {}; 2793 e5.onclick = function() {}; 2794 e5.removeAttribute("onClick"); 2795 e5.setAttribute("onClick", ""); 2796 e5.onblur = function() {}; 2797 } 2798 } 2799 } else if (modo == "modoOcultar") { 2800 var _loop = function() { 2801 var e = trozos3[ntrozo]; 2802 if (e) { 2803 e.contentEditable = CONTENTEDITABLE_DISABLE; 2804 e.style.cursor = "crosshair"; 2805 e.draggable = false;
2806 e.ondrop = function() {}; 2807 e.ondragover = function() {}; 2808 e.ondragstart = function() {}; 2809 e.ondragend = function() {}; 2810 e.onclick = function() { 2811 return _this.handleAlternarVisibilidadDelTrozo(nZona, e.id); 2812 }; 2813 e.onblur = function() {}; 2814 } 2815 }; 2816 var e6 = document.getElementById("Zona" + nZona); 2817 e6.contentEditable = CONTENTEDITABLE_DISABLE; 2818 e6.draggable = false; 2819 e6.style.cursor = "default"; 2820 e6.onmouseover = function(ev) { 2821 this.style.cursor = "default"; 2822 }; 2823 var trozos3 = e6.getElementsByTagName("tz"); 2824 for(var ntrozo = 0; ntrozo < trozos3.length; ntrozo++)_loop(); 2825 } else if (modo == "modoColorear") { 2826 var _loop1 = function() { 2827 var e = trozos4[ntrozo]; 2828 if (e) { 2829 e.contentEditable = CONTENTEDITABLE_DISABLE; 2830 e.style.cursor = "alias"; 2831 e.draggable = false; 2832 e.ondrop = function() {}; 2833 e.ondragover = function() {}; 2834 e.ondragstart = function() {}; 2835 e.ondragend = function() {}; 2836 e.onclick = function() { 2837 return _this.handleCambiarColorDelTrozo(nZona, e.id); 2838 }; 2839 e.onblur = function() {}; 2840 } 2841 }; 2842 var e7 = document.getElementById("Zona" + nZona); 2843 e7.contentEditable = CONTENTEDITABLE_DISABLE; 2844 e7.draggable = false; 2845 e7.style.cursor = "default"; 2846 e7.onmouseover = function(ev) { 2847 this.style.cursor = "default"; 2848 }; 2849 var trozos4 = e7.getElementsByTagName("tz"); 2850 for(var ntrozo = 0; ntrozo < trozos4.length; ntrozo++)_loop1(); 2851 } 2852 } 2853 }, 2854 { 2855 key: "handleDropTrozo", 2856 value: function handleDropTrozo(ev) { 2857 if (!this.idInter1) { 2858 return; 2859 } 2860 this.idInter2 = ev.currentTarget.id; 2861 this.moverTrozo(this.idInter1, this.idInter2); 2862 } 2863 }, 2864 { 2865 key: "moverTrozo", 2866 value: function moverTrozo(id1, id2) { 2867 var e1 = document.getElementById(id1); 2868 var e2 = document.getElementById(id2); 2869 var html1 = e1.innerHTML; 2870 var html2 = e2.innerHTML; 2871 var kolor1 = e1.style.color; 2872 var kolor2 = e2.style.color; 2873 e1.innerHTML = html2; 2874 e2.innerHTML = html1; 2875 e1.style.color = kolor2; 2876 e2.style.color = kolor1; 2877 } 2878 }, 2879 { 2880 key: "handleAllowDropTrozo", 2881 value: function handleAllowDropTrozo(ev) { 2882 ev.preventDefault(); 2883 } 2884 }, 2885 { 2886 key: "handleDragStartTrozo", 2887 value: function handleDragStartTrozo(ev) { 2888 this.idInter1 = ev.target.id; 2889 $(this.Zonas).addClass("inventa-drag-start"); 2890 } 2891 }, 2892 { 2893 key: "handleDragEndTrozo", 2894 value: function handleDragEndTrozo(ev) { 2895 $(this.Zonas).removeClass("inventa-drag-start"); 2896 // this.idInter1 = (ev.target as HTMLElement).id; 2897 } 2898 }, 2899 { 2900 key: "handleAlternarVisibilidadDelTrozo", 2901 value: function handleAlternarVisibilidadDelTrozo(nZona, id) { 2902 var e = document.getElementById(id); 2903 var opacidad = "0"; 2904 var aChars = e.getElementsByTagName("car"); 2905 for(var i = 0; i < aChars.length; i++){ 2906 var e2 = document.getElementById(aChars[i].id); 2907 opacidad = "1"; 2908 if (e2.style.opacity == "" || e2.style.opacity == "1") { 2909 opacidad = "0"; 2910 } 2911 e2.style.opacity = opacidad; 2912 } 2913 } 2914 }, 2915 { 2916 key: "handleCambiarColorDelTrozo", 2917 value: function handleCambiarColorDelTrozo(nZona, id) { 2918 var e = document.getElementById(id); 2919 var aColoresAleatorios = this.getColoresAleatorios(); 2920 // Usamos el mismo color, en principio 2921 if (this.nColorDelTrozo > aColoresAleatorios.length - 1) { 2922 // Por si hubiesen variado el número de colores aleatorios 2923 this.nColorDelTrozo = 0; 2924 } 2925 var aKolor = aColoresAleatorios[this.nColorDelTrozo]; 2926 if (this.rgbToHex(e.style.color) == aKolor) { 2927 this.nColorDelTrozo++; 2928 if (this.nColorDelTrozo > aColoresAleatorios.length - 1) { 2929 // Por si hubiéramos llegado al último color aleatorio 2930 this.nColorDelTrozo = 0; 2931 } 2932 aKolor = aColoresAleatorios[this.nColorDelTrozo]; 2933 } 2934 e.style.color = aKolor; 2935 //window["aColoresZ"+nZona][i]=aKolor; 2936 // Y ahora todos sus caracteres 2937 this.colorearCharsDelTrozo(nZona, id, aKolor); 2938 } 2939 }, 2940 { 2941 // ******** 2942 key: "colorearCharsDelTrozo", 2943 value: function colorearCharsDelTrozo(nZona, id, kolor) { 2944 // ******** 2945 var e = document.getElementById(id); 2946 var aChars = e.getElementsByTagName("car"); 2947 for(var i = 0; i < aChars.length; i++){ 2948 var e2 = document.getElementById(aChars[i].id); 2949 e2.style.color = kolor; 2950 } 2951 } 2952 }, 2953 { 2954 // ********************************** 2955 key: "asignarColores", 2956 value: function asignarColores(nZona, tpColoreo) { 2957 // ********************************** 2958 // tpColoreo = fijo, aleatorio, predefinido 2959 this.limpiarEstilo(nZona); 2960 switch(tpColoreo){ 2961 case "Fijo": 2962 this.colorearFijoZona(nZona, this.configuracion.ColorFijo); 2963 break; 2964 case "Aleatorio": 2965 this.colorearAleatorioZona(nZona); 2966 break; 2967 case "Predefinido": 2968 for(var nPatron = 1; nPatron <= 4; nPatron++){ 2969 if (this.configuracion.PatronActivo[nPatron - 1]) { 2970 this.colorearPredefinidoZona(nZona, nPatron - 1); 2971 } 2972 } 2973 break; 2974 default: 2975 console.log("tipo de coloreo -" + tpColoreo + "- no definido."); 2976 } 2977 return; 2978 } 2979 }, 2980 { 2981 // ********************************** 2982 key: "colorearFijoZona", 2983 value: function colorearFijoZona(nZona, colorFijo) { 2984 // ********************************** 2985 var e = document.getElementById("Zona" + nZona); 2986 var i = 1; 2987 while(e = document.getElementById("c" + nZona + "-" + i)){ 2988 e.style.color = "#" + colorFijo; 2989 //e.style.fontSize = tamanoLetra; 2990 //e.style.fontFamily = tipoLetra; 2991 i++; 2992 } 2993 } 2994 }, 2995 { 2996 // ********************************** 2997 key: "colorearAleatorioZona", 2998 value: function colorearAleatorioZona(nZona) { 2999 // ********************************** 3000 // Pongo el texto troceado en Zona 3001 // var e = document.getElementById("Zona"+nZona); 3002 // var tipoLetra = saberTipoLetra(nZona); 3003 // e.style.fontFamily = tipoLetra; 3004 // cargarColoresAleatorios(); 3005 var aColoresAleatorios = this.getColoresAleatorios(); 3006 var nKolorAleatorio = Math.floor(Math.random() * aColoresAleatorios.length); 3007 var nKolorUltimo = 0; 3008 var rgbKolorUltimo = "#000000"; 3009 var nZonaAnterior = nZona - 1; 3010 if (nZonaAnterior == 0) { 3011 nZonaAnterior = 4; 3012 } 3013 var id = "tz" + nZonaAnterior + "_1"; 3014 if (document.getElementById(id)) { 3015 rgbKolorUltimo = this.rgbToHex(document.getElementById("tz" + nZonaAnterior + "_1").style.color); 3016 nKolorUltimo = aColoresAleatorios.indexOf(rgbKolorUltimo); 3017 if (nKolorUltimo == -1) { 3018 nKolorUltimo = 0; 3019 } 3020 } 3021 var txtPlano = ""; 3022 // var tamanoLetra = saberTamanoLetra(nZona); 3023 var i = 1; 3024 var e; 3025 while(e = document.getElementById("tz" + nZona + "_" + i)){ 3026 txtPlano = this.quitarHtml(e.innerHTML); 3027 if (txtPlano == " " || txtPlano == "\xb7" || txtPlano == "<br>" || txtPlano == "<BR>") { 3028 // espacio en blanco o salto de linea 3029 e.style.color = "transparent";
3030 } else { 3031 // trozo con caracter visible 3032 nKolorAleatorio = Math.floor(Math.random() * aColoresAleatorios.length); 3033 while(nKolorUltimo == nKolorAleatorio){ 3034 // Para que no salgan colores repetidos consecutivos 3035 nKolorAleatorio = Math.floor(Math.random() * aColoresAleatorios.length); 3036 } 3037 // Debe de haber salido un color diferente del anterior 3038 //console.log(aColoresAleatorios[nKolorAleatorio]); 3039 e.style.color = aColoresAleatorios[nKolorAleatorio]; 3040 nKolorUltimo = nKolorAleatorio; 3041 } 3042 i++; 3043 } 3044 } 3045 }, 3046 { 3047 // **************** 3048 key: "quitarHtml", 3049 value: function quitarHtml(html) { 3050 // **************** 3051 // Crea un nuevo elemento div 3052 var temporalDivElement = document.createElement("div"); 3053 // Establecer el contenido HTML con el dado 3054 temporalDivElement.innerHTML = html; 3055 // Recuperar la propiedad de texto del elemento (compatibilidad con varios navegadores) 3056 return temporalDivElement.textContent || temporalDivElement.innerText || ""; 3057 } 3058 }, 3059 { 3060 key: "colorearPredefinidoZona", 3061 value: function colorearPredefinidoZona(nZona, nPatron) { 3062 var patron = this.configuracion.PatronLista[nPatron]; 3063 var aListaDePatrones = patron.split(" "); 3064 var texto = this.getTextoZona(nZona); // document.getElementById("Zona" + nZona)!.innerText.toLocaleLowerCase(); 3065 var multiplicadores = [ 3066 0.5, 3067 1, 3068 2, 3069 3, 3070 4, 3071 5 3072 ]; 3073 var kColor = "#" + this.configuracion.PatronColor[nPatron]; 3074 var tamanosPosibles = [ 3075 "mitad", 3076 "normal", 3077 "doble", 3078 "triple", 3079 "cuadruple", 3080 "quintuple" 3081 ]; 3082 var tamano = tamanosPosibles.indexOf(this.configuracion.PatronTamano[nPatron]); 3083 if (tamano == -1) { 3084 tamano = 1; 3085 } 3086 var kSize = (parseInt(this.saberTamanoLetra(nZona)) * multiplicadores[tamano]).toString(); 3087 kSize = kSize + "px"; 3088 for(var index = 0; index < aListaDePatrones.length; index++){ 3089 var element = aListaDePatrones[index]; 3090 if (element.trim() == "") { 3091 continue; 3092 } 3093 var pattern = Pizarra.buildPattern(element); 3094 var m = void 0; 3095 if (element.match(/[·+_]/)) { 3096 // Silabas matcher 3097 var silabas = TextosUtils.silabearTexto(texto); 3098 var j = 0; 3099 for(var index1 = 0; index1 < silabas.length; index1++){ 3100 var element2 = silabas[index1]; 3101 if ((m = pattern.exec(element2)) !== null) { 3102 if (m.length <= 1 || m[1] === undefined || m[1].length == 0) { 3103 continue; 3104 } 3105 var start = j + m.index + m[0].indexOf(m[1]); 3106 var length = m[1].length; 3107 this.aplicarEstilo(nZona, start, start + length, kColor, kSize); 3108 } 3109 j += element2.length; 3110 } 3111 } else { 3112 // Global matcher 3113 while((m = pattern.exec(texto)) !== null){ 3114 // This is necessary to avoid infinite loops with zero-width matches 3115 if (m.index === pattern.lastIndex) { 3116 pattern.lastIndex++; 3117 } 3118 if (m.length <= 0) { 3119 continue; 3120 } 3121 var start1 = m.index; 3122 var end = pattern.lastIndex; 3123 // console.log("LIMITS: ", m.index, m[0].length); 3124 this.aplicarEstilo(nZona, start1, end, kColor, kSize); 3125 // GestorInterfaz.aplicarEstilo(elementos, start, start + length - 1, { color: element.color, fontSize: settings.size * (element.size) }); 3126 // // The result can be accessed through the `m`-variable. 3127 // m.forEach((match, groupIndex) => { 3128 // console.log(`Found match, group ${groupIndex}: ${match}`); 3129 // }); 3130 } 3131 } 3132 } 3133 } 3134 }, 3135 { 3136 key: "aplicarEstilo", 3137 value: function aplicarEstilo(nZona, start, end, color, size) { 3138 for(var index = start; index < end; index++){ 3139 var element = document.getElementById("c" + nZona + "-" + (index + 1)); 3140 if (element) { 3141 element.style.color = color; 3142 element.style.fontSize = size; 3143 } 3144 } 3145 } 3146 }, 3147 { 3148 key: "limpiarEstilo", 3149 value: function limpiarEstilo(nZona) { 3150 var index = 1; 3151 var el; 3152 while(el = document.getElementById("c" + nZona + "-" + index)){ 3153 el.style.color = ""; 3154 el.style.fontSize = ""; 3155 index++; 3156 } 3157 } 3158 }, 3159 { 3160 // ************* 3161 key: "rgbToHex", 3162 value: function rgbToHex(miColorRGB) { 3163 // ************* 3164 miColorRGB = TextosUtils.replaceAll("rgb(", "", miColorRGB); 3165 miColorRGB = TextosUtils.replaceAll(")", "", miColorRGB); 3166 var colores = miColorRGB.split(","); 3167 // los paso a hexadecimal 3168 colores[0] = this.decToHex(colores[0]); 3169 colores[1] = this.decToHex(colores[1]); 3170 colores[2] = this.decToHex(colores[2]); 3171 miColorRGB = colores[0].concat(colores[1]); 3172 miColorRGB = miColorRGB.concat(colores[2]); 3173 return "#" + miColorRGB; 3174 } 3175 }, 3176 { 3177 // ---------------- 3178 key: "decToHex", 3179 value: function decToHex(val255) { 3180 // ---------------- 3181 var hex = Number(val255).toString(16); 3182 if (hex.length < 2) { 3183 hex = "0" + hex; 3184 } 3185 return hex; 3186 } 3187 }, 3188 { 3189 key: "iniciarLecturaAutomatica", 3190 value: function iniciarLecturaAutomatica() { 3191 if (this.nUltimaZonaPresentada >= 1 && this.nUltimaZonaPresentada <= 4) { 3192 if (this.estilosZonas[this.nUltimaZonaPresentada].activar) { 3193 if (this.getTextoZona(this.nUltimaZonaPresentada).trim() != "") { 3194 this.lecturaAutomaticaActiva = true; 3195 this.programarAparicionDeBloques(this.nUltimaZonaPresentada); 3196 } else { 3197 Swal.fire({ 3198 icon: "error", 3199 title: "No hay texto en la pizarra activa", 3200 text: "Tiene que introducir un texto en la pizarra para poder iniciar la lectura asistida" 3201 }); 3202 } 3203 } else { 3204 Swal.fire({ 3205 icon: "error", 3206 title: "La pizarra activa no est\xe1 visible", 3207 text: "Establezca la pizarra visible" 3208 }); 3209 } 3210 } else { 3211 Swal.fire({ 3212 icon: "error", 3213 title: "No hay pizarra activa", 3214 text: "Seleccione una pizarra" 3215 }); 3216 } 3217 } 3218 }, 3219 { 3220 key: "detenerLecturaAutomatica", 3221 value: function detenerLecturaAutomatica() { 3222 this.lecturaAutomaticaActiva = false;
3223 if (this.lecturaAutomaticaActiva) { 3224 clearTimeout(this.timerLecturaAutomatica); 3225 } 3226 var nZona = this.nUltimaZonaPresentada; 3227 $('[data-accion-pizarra="lectura-automatica"][data-pizarra="' + nZona + '"]').removeClass("active"); 3228 $('[data-accion-pizarra="lectura-automatica"][data-pizarra="0"]').removeClass("active"); 3229 var e = document.getElementById("Zona" + this.nUltimaZonaPresentada); 3230 $(e).find("tz").each(function(index, el1) { 3231 el1.style.backgroundColor = "transparent"; 3232 el1.style.opacity = "1"; 3233 }); 3234 } 3235 }, 3236 { 3237 key: "programarAparicionDeBloques", 3238 value: function programarAparicionDeBloques(nZona) { 3239 var index = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1; 3240 var _this = this; 3241 var estilo = this.state.getState("nEstiloResaltado"); 3242 var modoEntrar = "aparecer"; 3243 var modoSalir = "desaparecer"; 3244 if (estilo == "0" || estilo == "1") { 3245 modoEntrar = "resaltar"; 3246 } else { 3247 modoEntrar = "aparecer"; 3248 } 3249 if (estilo == "0" || estilo == "2") { 3250 modoSalir = "permanecer"; 3251 } else { 3252 modoSalir = "desaparecer"; 3253 } 3254 if (this.timerLecturaAutomatica) { 3255 clearTimeout(this.timerLecturaAutomatica); 3256 } 3257 if (!this.lecturaAutomaticaActiva) { 3258 return; 3259 } 3260 var e = document.getElementById("Zona" + nZona); 3261 $(e).find("tz").each(function(index1, el1) { 3262 // debugger; 3263 el1.style.backgroundColor = "transparent"; 3264 if (modoEntrar == "aparecer" && index1 + 1 >= index) { 3265 el1.style.opacity = "0"; 3266 } 3267 }); 3268 var current = document.getElementById("tz" + nZona + "_" + index); 3269 if (current) { 3270 $('[data-accion-pizarra="lectura-automatica"][data-pizarra="' + nZona + '"]').addClass("active"); 3271 $('[data-accion-pizarra="lectura-automatica"][data-pizarra="0"]').addClass("active"); 3272 if (current.innerText.trim() != "") { 3273 var tiempoAparicion = parseInt($("#tResaltarBloque").val()); 3274 var tiempoEspera = parseInt($("#tEsperarBloque").val()); 3275 var color = this.state.getState("colorFondoResaltarBloque"); 3276 current.style.backgroundColor = "#" + color; 3277 current.style.opacity = "1"; 3278 this.timerLecturaAutomatica = setTimeout(function() { 3279 current.style.backgroundColor = "transparent"; 3280 if (modoSalir == "desaparecer") { 3281 current.style.opacity = "0"; 3282 } 3283 _this.timerLecturaAutomatica = setTimeout(function() { 3284 _this.programarAparicionDeBloques(nZona, index + 1); 3285 }, tiempoEspera); 3286 }, tiempoAparicion); 3287 } else { 3288 this.programarAparicionDeBloques(nZona, index + 1); 3289 } 3290 } else { 3291 // this.detenerLecturaAutomática(); 3292 } 3293 } 3294 }, 3295 { 3296 key: "saberTiempoPresentacionMostar", 3297 value: function saberTiempoPresentacionMostar() { 3298 var ts = parseInt(this.state.getState("tsExpoZ1")); 3299 var tm = parseInt(this.state.getState("tmExpoZ1")); 3300 return ts * 1000 + tm; 3301 } 3302 }, 3303 { 3304 key: "saberTiempoPresentacionOcultar", 3305 value: function saberTiempoPresentacionOcultar() { 3306 var ts = parseInt(this.state.getState("tsEsperaZ1")); 3307 var tm = parseInt(this.state.getState("tmEsperaZ1")); 3308 return ts * 1000 + tm; 3309 } 3310 }, 3311 { 3312 key: "saberTiempoPresentacionTotal", 3313 value: function saberTiempoPresentacionTotal() { 3314 var tmin = parseInt(this.state.getState("tiDTotalZ1")); 3315 var ts = parseInt(this.state.getState("tsDTotalZ1")); 3316 var tm = parseInt(this.state.getState("tmDTotalZ1")); 3317 return (tmin * 60 + ts) * 1000 + tm; 3318 } 3319 }, 3320 { 3321 key: "inicarPresentacionSincronizada", 3322 value: function inicarPresentacionSincronizada(nZona) { 3323 var _this = this; 3324 var tiempoPresentacionTotal = this.saberTiempoPresentacionTotal(); 3325 if (nZona == 0) { 3326 this.presentacionAutomaticaZonas = []; 3327 for(var index = 1; index <= 4; index++){ 3328 if (this.estilosZonas[index].activar) { 3329 this.presentacionAutomaticaZonas.push(index); 3330 } 3331 } 3332 } else { 3333 var index1 = this.presentacionAutomaticaZonas.indexOf(nZona); 3334 if (index1 >= 0) { 3335 // Remove 3336 this.presentacionAutomaticaZonas.splice(index1, 1); 3337 } else { 3338 this.presentacionAutomaticaZonas.push(nZona); 3339 } 3340 } 3341 if (this.presentacionAutomaticaZonas.length > 0) { 3342 this.presentacionAutomaticaActiva = true; 3343 this.programarPresentacion(); 3344 if (!this.presentacionAutomaticaDesactivarTimer && tiempoPresentacionTotal > 0) { 3345 this.presentacionAutomaticaDesactivarTimer = setTimeout(function() { 3346 // Tiempo de presentacion 3347 _this.detenerPresentacionSincronizada(); 3348 }, tiempoPresentacionTotal); 3349 } 3350 } else { 3351 this.detenerPresentacionSincronizada(); 3352 } 3353 for(var index2 = 1; index2 <= 4; index2++){ 3354 if (this.presentacionAutomaticaZonas.indexOf(index2) >= 0) { 3355 $('[data-accion-pizarra="presentacion-automatica"][data-pizarra="' + index2 + '"]').addClass("active"); 3356 } else { 3357 $('[data-accion-pizarra="presentacion-automatica"][data-pizarra="' + index2 + '"]').removeClass("active"); 3358 } 3359 } 3360 } 3361 }, 3362 { 3363 key: "detenerPresentacionSincronizada", 3364 value: function detenerPresentacionSincronizada() { 3365 this.presentacionAutomaticaActiva = false;
3366 clearTimeout(this.presentacionAutomaticaTimer); 3367 clearTimeout(this.presentacionAutomaticaDesactivarTimer); 3368 this.presentacionAutomaticaDesactivarTimer = undefined; 3369 $('[data-accion-pizarra="presentacion-automatica"][data-pizarra="0"]').removeClass("active"); 3370 for(var index = 1; index <= 4; index++){ 3371 $('[data-accion-pizarra="presentacion-automatica"][data-pizarra="' + index + '"]').removeClass("active"); 3372 } 3373 } 3374 }, 3375 { 3376 key: "programarPresentacion", 3377 value: function programarPresentacion() { 3378 var _this = this; 3379 $('[data-accion-pizarra="presentacion-automatica"][data-pizarra="0"]').addClass("active"); 3380 /* 3381 while (not tiempoTranscurrido) or presentacionActivada: 3382 actual := ultimaZonaPresentada; 3383 sacarTextoPor(actual, nUltimoTextoPresentado); 3384 esperar(tiempoMostrar); 3385 ocultarTexto(actual); 3386 esperar(tiempoOcultar); 3387 ultimaZonaPresentada += 1; 3388 nUltimoTextoPresentado += 1; 3389 */ if (this.presentacionAutomaticaTimer) { 3390 clearTimeout(this.presentacionAutomaticaTimer); 3391 } 3392 var tiempoAparicion = this.saberTiempoPresentacionMostar(); 3393 var tiempoOcultar = this.saberTiempoPresentacionOcultar(); 3394 if (this.presentacionAutomaticaActiva && this.presentacionAutomaticaZonas.length > 0) { 3395 var actual = this.presentacionAutomaticaZonas[this.presentacionAutomaticaIndex % this.presentacionAutomaticaZonas.length]; 3396 this.sacarNuevoTextoPor(actual, this.nUltimoTextoPresentado); 3397 this.presentacionAutomaticaTimer = setTimeout(function() { 3398 _this.setTextoZona("", actual); // ocultarTexto(actual); 3399 _this.presentacionAutomaticaTimer = setTimeout(function() { 3400 _this.presentacionAutomaticaIndex = (_this.presentacionAutomaticaIndex + 1) % _this.presentacionAutomaticaZonas.length; 3401 _this.nUltimoTextoPresentado += 1; 3402 _this.programarPresentacion(); 3403 }, tiempoOcultar); 3404 }, tiempoAparicion); // esperar(tiempoMostrar); 3405 } 3406 } 3407 }, 3408 { 3409 key: "toggleZonaVisible", 3410 value: function toggleZonaVisible(zona) { 3411 if (zona == 0) { 3412 for(var index = 1; index <= 4; index++){ 3413 this.toggleZonaVisible(index); 3414 } 3415 } else { 3416 var e = document.getElementById("Zona" + zona); 3417 var aChars = e.getElementsByTagName("car"); 3418 if (aChars.length > 0) { 3419 var opacidad = aChars[0].style.opacity; 3420 var setOpacidad = "1"; 3421 if (opacidad == "1" || opacidad == "") { 3422 setOpacidad = "0"; 3423 } 3424 for(var i = 0; i < aChars.length; i++){ 3425 var e2 = document.getElementById(aChars[i].id); 3426 e2.style.opacity = setOpacidad; 3427 } 3428 } 3429 } 3430 } 3431 } 3432 ], [ 3433 { 3434 key: "buildPattern", 3435 value: function buildPattern(basicPattern) { 3436 basicPattern = basicPattern.replaceAll(/([a-zA-Z+*_]+)/gmi, function(a, g) { 3437 return "(" + g + ")"; 3438 }); // Grupo de búsqueda 3439 basicPattern = basicPattern.replaceAll("\xb7", "[aeiou\xe1\xe9\xed\xf3\xfa]"); // Silabas directas / inversas 3440 basicPattern = basicPattern.replaceAll("+", "[aeiou\xe1\xe9\xed\xf3\xfa]"); // Silabas directas / inversas 3441 basicPattern = basicPattern.replaceAll(/\*\)/g, ".+)$"); 3442 basicPattern = basicPattern.replaceAll(/\(\*/g, "(.+"); 3443 basicPattern = basicPattern.replaceAll("_", "%[aeiou\xe1\xe9\xed\xf3\xfa]%"); // Silabas directas / inversas 3444 basicPattern = basicPattern.replaceAll("(%", "(.*"); 3445 basicPattern = basicPattern.replaceAll("%)", ".*)"); 3446 basicPattern = basicPattern.replaceAll("%", ""); 3447 basicPattern = basicPattern.replaceAll("?", "\\?"); 3448 basicPattern = basicPattern.replaceAll(".", "\\."); 3449 basicPattern = basicPattern.replaceAll("+", "\\+"); 3450 basicPattern = basicPattern.replaceAll("!", "\\!"); 3451 return new RegExp(basicPattern, "gmi"); 3452 } 3453 } 3454 ]); 3455 return Pizarra; 3456}(); 3457_define_property(Pizarra, "barajar", function(arr) { 3458 return arr.sort(function(a, b) { 3459 return Math.floor(.5 - Math.random()); 3460 }); 3461}); 3462export { Pizarra as default };
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.