Ver Mensaje Individual
  #3 (permalink)  
Antiguo 09/09/2010, 15:02
javiercitox
 
Fecha de Ingreso: diciembre-2009
Ubicación: Valparaíso
Mensajes: 118
Antigüedad: 14 años, 4 meses
Puntos: 3
Respuesta: Mootols conflicto con interpretador de JS

Cita:
Iniciado por javiercitox Ver Mensaje
Lo solucione, para los que tengan el mismo problema:

La librería de mootols contiene dos funciones que tienen el mismo nombre de funciones de la otra librería. Lo que hice fue cambiar el nombre de ambas funciones en la librería InterpretaJS.js

Las funciones eran stripScript y map, la corrección quedó así

Código Javascript:
Ver original
  1. var tagScript = '(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)';
  2. /**
  3. * Eval script fragment
  4. * @return String
  5. */
  6. String.prototype.evalScript = function () {
  7.     return (this.match(new RegExp(tagScript, 'img')) || []).evalScript();
  8. };
  9. /**
  10. * strip script fragment
  11. * @return String
  12. * striptScript reemplazado por stripScriptPrototype para evitar conflicto
  13. */
  14. String.prototype.stripScriptPrototype = function () {
  15.     return this.replace(new RegExp(tagScript, 'img'), '');
  16. };
  17. /**
  18. * extract script fragment
  19. * @return String
  20. */
  21. String.prototype.extractScript = function () {
  22.     var matchAll = new RegExp(tagScript, 'img');
  23.     return (this.match(matchAll) || []);
  24. };
  25. /**
  26. * Eval scripts
  27. * @return String
  28. */
  29. Array.prototype.evalScript = function (extracted) {
  30.     var s = this.map(function (sr) {
  31.         var sc = (sr.match(new RegExp(tagScript, 'im')) || ['', ''])[1];
  32.         if (window.execScript) {
  33.             window.execScript(sc);
  34.         }
  35.         else {
  36.             window.setTimeout(sc, 0);
  37.         }
  38.     });
  39.     return true;
  40. };
  41. /**
  42. * Map array elements
  43. * @param {Function} fun
  44. * @return Function
  45. * * map reemplazado por mapPrototype para evitar conflicto
  46. */
  47. Array.prototype.mapPrototype = function (fun) {
  48.     if (typeof fun !== "function") { return false; }
  49.     var i = 0, l = this.length;
  50.     for (i = 0; i < l; i++) {
  51.         fun(this[i]);
  52.     }
  53.     return true;
  54. };