FilmAffinity++

Mejoras en FilmAffinity

  1. /*
  2. FilmAffinity++
  3. Version 3.2.8 - benjani benjani86 at gmail.com
  4. Basado en una versión anterior de psychomaster zico10 at gmail.com,
  5. David Buxó Alvarez davidbuxo at gmail.com,
  6. Javier Arias http://javierarias.wordpress.com/scripts/filmaffinityplus/
  7. @todo:
  8. - Aplicar limites a todas las paginas de listados, comprobar limite real de FA
  9. - Nota media en busquedas por director
  10. - Cambios en la lista de TOP
  11. - Unificar los menus
  12. @no todo (cosas que solo podrian hacer en el servidor)
  13. - Afinidad de amigos
  14. - Grafico de usuarios
  15. Changelog
  16. * 3.2.8, 30 de Enero 2015
  17. + Diversas mejoras en las capturas de datos desde IMDB para añadir pelis
  18. + Muestra la fecha de votación de una película en su ficha
  19.  
  20. * 3.2.7.2, 31 de Diciembre 2014
  21. + Poner un guion en las pelis que no hemos votado en los distintos apartados
  22.  
  23. * 3.2.7.1, 31 de Diciembre 2014
  24. + Añadida nueva página de ThePirateBay
  25. + Añadido link del panel de configuracion fijo
  26. + Cambio del estilo de las críticas (fondo azul clarito)
  27. * 3.2.7, 30 de Diciembre 2014
  28. + Arreglado de nuevo votos (busquedas, topics, listas) tras cambio en FA
  29. + Arreglado datos extras en listas
  30. + Relleno de campos automaticamente desde IMDB al añadir película
  31. + Color de fondo a las críticas
  32. * 3.2.6, 20 de Septiembre 2014
  33. + Arreglado votos tras cambio de diseño en FA
  34. * 3.2.5, 17 de Junio 2014
  35. + Actualizadas clasificaciones a 2014
  36. + Arreglado votos en busquedas/listas/topics tras el cambio en FA
  37. + Arreglado mostrar listas favoritas
  38. + Arreglado icono para añadir listas favoritas en FA
  39. + Opción de cambiar el color de los votos en nuestras listas
  40. + Añadidos cinemageddon, karagarga, asiatorrents, eutorrents y kickass en enlaces externos
  41. * 3.2.4, 7 de Septiembre 2013
  42. + Añadidas notas del usuario en búsqueda avanzada, topics y votos de otros usuarios
  43. + Arreglado el problema en FA con las notas, y con los amigos
  44. + Acrtualizado el icono de argenteam, y revisada su página de búsqueda, así como la de clan-sudamerica
  45. * 3.2.3, 18 de Agosto 2013
  46. + Arreglado el script tras el cambio de estilo visual de FA
  47. + Mejorado notas de otras páginas (IMDB y Rottentomatoes) y añadida MyAnimeList
  48. + Mejorado el aspeto de votos en busquedas
  49. + Añadido votos por continentes en estadísticas de otros
  50. + Añadida afinidad entre 2 usuarios en estadísticas
  51. * 3.2.2, 30 de Diciembre 2012
  52. + Arreglado obtener Id de usuario
  53. + Añadida listas favoritas IMDB
  54. + Añadidas notas de IMDB, Rotten y Abandomoviez en fichas de películas (no funcionan al 100%)
  55. * 3.2.1, 27 de Junio
  56. + Opción de abrir votaciones/críticas/listas en una nueva pestaña
  57. + Opción de poner el retardo manual
  58. + Añadidos Comores, Lesotho, Liberia, Myanmar a los rankings
  59. + Arreglado enlace externo IMDB
  60. * 3.2.0, 23 de Junio 2012
  61. + Arreglado cambios en nº de votos/criticas/listas
  62. + Rediseñado el aspecto de la tabla de amigos
  63. + Actualizados Premios II
  64. * 3.1.0, 11 de Febrero 2012
  65. + Añadida clasificaciones por países
  66. * 3.0.1, 30 de Enero 2012
  67. + Arreglado añadir contactos adicionales sin críticas
  68. + Arreglado y añadido poder añadir contactos desde estadisticas, recomendaciones, listas
  69. * 3.0.0, 24 de Enero 2012
  70. + Arreglado mostrar banderas coproducciones
  71. + Arreglado búsquedas adicionales en búsquedas
  72. + Arreglado añadir rápido a listas
  73. + Nueva versión (con el nuevo diseño) de mis datos adicionales
  74. + Añadida listas en tabla de contactos adicionales
  75. + Posibilidad de ordenar contactos adicionales por nick/ubicacion/votos/criticas/listas
  76. + Búsqueda directa de guionistas, músicos, fotógrafos y años desde fichas
  77. + Agregados resumenes de votaciones en listas propias, y en listas de otros
  78. + Nueva versión de contactos adicionales (votos sacados desde página propia)
  79. + Añadido mostrar tus estadísticas al ver las de otro usuario
  80. * 2.0.50, 9 de Diciembre 2011
  81. - Deshabilitado de momento votos de contactos en fichas
  82. + Arreglado Añadir contactos desde url
  83. + Arreglado añadir contacto cuando no hay ninguno
  84. * 2.0.49, 8 de Diciembre 2011
  85. + Arreglado votos de contactos adicionales en fichas de películas con crítica hecha
  86. * 2.0.48, 8 de Diciembre 2011
  87. + Añadido votos de otros contactos en fichas de películas
  88. + Arreglado captura de nombre de otros contactos cuando contenian "de"
  89. + Añadido enlaces a votos y críticas en tabla de otros contactos
  90. * 2.0.47, 4 de Diciembre 2011
  91. + Arreglado mostrar listas favoritas en mis listas
  92. + Arreglado y mejorado añadir contactos adicionales desde página de votaciones
  93. + Arreglado captura nombre de listas
  94. + Arreglada tabla contactos adicionales
  95. + Arreglado menús en la barra izquierda
  96. + Añadido nuevo menú: Premios II
  97. * 2.0.46, 24 de Noviembre 2011
  98. + Corregido momentaneamente orden nuestras listas
  99. + Arreglado ordenar películas en listas con flechas (valido hasta 999 elementos)
  100. + Arreglado ver votos del usuario en listas de otros
  101. + Corregido ver votos en busquedas
  102. + Aumentado numero de votos mostrados en busquedas (no tops fa) (antes solo 20, ahora para los 45)
  103. * 2.0.45, 21 de Noviembre 2011
  104. + Corregidos enlaces externos en fichas de películas
  105. + Arreglada página de amigos que salía en blanco
  106. + Corregido actualización de contactos adicionales
  107. + Banderas en Mis Datos
  108. * 2.0.44, 12 de Julio 2011
  109. + Corregidos enlaces en Listas favoritas
  110. * 2.0.43, 11 de Julio 2011
  111. + Corregidos enlaces en Mis listas
  112. * 2.0.42, 21 de Mayo 2009
  113. + Ordenar lista de Mis Listas
  114. + Corregido Bug en Capturar listas con listas sin nombre.
  115. * 2.0.41, 20 de Mayo
  116. * Agrupadas las fechas en historico de cambios de Almas Gemelas.
  117. * Listas Favoritas
  118. * Distribución de paises 'Continental simplificado' de Multifolio
  119. * Ordenar listas multipagina
  120. * 2.0.40, 9 de Mayo
  121. * han vuelto a cambiar a TITULO ORIGINAL.
  122. * 2.0.38, 7 de Mayo
  123. * Cambio en FA. TITULO ORIGINAL -> TÍTULO ORIGINAL
  124. * 2.0.37b, 4 de Mayo
  125. * Cambios en Mis Datos opcionales.
  126. * 2.0.37, 4 de Mayo
  127. * Agrupaciones de paises según criterios
  128. * Bloqueado movimiento en listas para listas con mas de una página
  129. * 2.0.36, 1 de Mayo
  130. + Votos por año en Mis Datos
  131. * 2.0.35, 29 de Abril
  132. + Corregido problema con paises sin continente
  133. * 2.0.34 , 29 de Abril
  134. + Votaciones y Media por continentes en Mis Datos
  135. * 2.0.33 , 28 de Abril
  136. + Corregido tamaño de las barras en Mis Datos
  137. * 2.0.32, 27 de Abril
  138. + Añadidos dos indices mas (rareza, documentales)
  139. + Modificada la apariencia de la tabla de votos en Mis Datos
  140. + Corregida la ordenación de contactos adicionales por nombre
  141. * 2.0.31, 26 de Abril
  142. + Ajustada presentación de indices
  143. + Ordenados contactos adicionales por nombre
  144. * 2.0.30, 25 de Abril
  145. + Corregido Bug en contactos si tienes 20 amigos
  146. + Añadidos índices 'multifolio' - http://filmaffinity.mforos.com/1360515/7122665-indices-indicadores-e-indicios/
  147. * 2.0.29, 23 de Abril
  148. + Contactos adicionales
  149. + Corregido error si no se borra la lista temporal.
  150. + Corregido error al votar en listas, no se actualizaba la nueva puntuación en el menu
  151. + Enlaces externos en listas
  152. + Buscar listas (Usando metodo multifolio) (preliminar, por ahora te manda a la pagina de google)
  153. * 2.0.28, 26 de Marzo
  154. * Corregido cambio de estilo de puntuaciones
  155. * 2.0.27, 25 de Marzo
  156. # Corregido error con worklist
  157. * 2.0.26, 25 de Marzo
  158. + Mis votos en los resultados de las busquedas
  159. + Posibilidad de votar desde las busquedas y las listas de los amigos
  160. + Posibilidad de votar desde mis listas
  161. + En caso de que la busqueda no de resultado, nos redirige al buscador global
  162. * 2.0.25, 24 de Marzo
  163. + Mis votos en las listas de amigos
  164. + Soporte para varios usuarios de FilmAffinity en el mismo perfir de Firefox
  165. * 2.0.24, 21 de Marzo
  166. # Corregido Bug en coproducciones. (Ahora solo busca paises si aparece la palabra coproducción, quizas tengamos problemas)
  167. # Corregido Bug en Coproducciones -> Detectaba Alemania en 'Alemania del Oeste',etc..
  168. * 2.0.23, 21 de Marzo
  169. # Corregido error en nº de criticas modificadas en amigos
  170. # Corregido error: Se mostraba el botón de añadir a listas aun cuando no estabamos logeados.
  171. # Corregido error: No se mostraba el botón de añadir a listas al continuar con la busqueda.
  172. + Enlaces en la lista de amigos, pinchando en sus votaciones, vamos a su pagina de votaciones
  173. pinchando en sus criticas, vamos a su lista de criticas.
  174. * 2.0.22, 20 de Marzo
  175. * Soporte preliminar para opera en algunas opciones.
  176. necesita http://www.howtocreate.co.uk/operaStuff/userjs/aagmfunctions.js
  177. de la página http://www.howtocreate.co.uk/operaStuff/userJavaScript.html
  178. * Banderas en la lista de amigos
  179. * Añadidos codigos para Lituania, Eslovaquia , Sri Lanka,
  180. Albania,Azerbaijan,Bangladesh,Benín,Emiratos Árabes,Etiopía,Guinea,Guinea Bissau,
  181. Haití,Jamaica,Jordania,Kenia,Kirguizstán,Laos,Letonia,Malta,
  182. Mauritania,Moldavia,Namibia,Tanzania,Trinidad y Tobago y Ucrania
  183. Andorra,Antigua y Barbuda,Arabia Saudí,Bahamas,Bahrein,Barbados,Belize,
  184. Botswana,Brunei,Burundi,Cabo Verde,Camerún,Chipre,Comores,Congo,Dominica,
  185. El Salvador,Eritrea,Fidji,Gabón,Gambia,Ghana,Granada,Guinea Ecuatorial,
  186. Guyana,Honduras,Kuwait,Lesotho,Liberia,Libia,Liechtenstein,Madagascar,
  187. Malawi,Maldivas,Marshall (Islas),Mauricio (Isla),Micronesia,Mónaco,Montenegro,
  188. Mozambique,Myanmar - Birmania,Níger,Omán,Palau,Papuasia Nueva Guinea,Qatar,
  189. Rep. Centroafricana,Ruanda,Samoa,San Marino,Santo Tomé y Príncipe,
  190. Seychelles,Sierra Leona,Siria,Somalia,Sudán,Surinam,Swazilandia,
  191. Tajikistan,Togo,Turkmenistán,Uganda,Uzbekistan,Vanuatú,Zambia,Zimbabwe
  192. * 2.0.21, 18 de Marzo de 2009
  193. + Añadidos/modificados codigos para RDA, RFA, URSS, Líbano y Serbia y Montenegro
  194. - Eliminado opción para Ocultar series de TV (por ahora da problemas)
  195. # Cambiadas las imagenes de Almas gemelas(problemas al copiar/pegar en foros)
  196. * 2.0.20
  197. + Banderas de los paises coproductores en la ficha de la pelicula (Sacado de la lista de Productora)
  198. + Muestra los cambios en el nº de criticas de los amigos
  199. * 2.0.19, 17 de Marzo de 2009
  200. # Corregido bug con icono de zoom de los posters al centrar
  201. # Modifica la etiqueta de cantidad de listas a las que pertenece la pelicula al añadir o borrar
  202. # Corregido bug en opción de centrado (no se mostraba en panel de configuración)
  203. # Corregido bug en enlaces externos con tilde (no se podian ocultar)
  204. # Corregido bug en enlaces externos en el panel derecho (se mostraban las categorias sin enlaces activos)
  205. * 2.0.18, 16 de Marzo de 2009
  206. + Añadido ordenación dentro de las listas
  207. # Corregido Bug en estadisticas de usuarios
  208. # Corregido Bug en puntuaciones. (en pagina de película, con una sola alma gemela)
  209. + Añadido ocultar Series de TV (preliminar)
  210. # Centrar pagina en ventana del navegador (mejor hacerlo via stylish)
  211. + Añadido opción para plegar menus
  212. * 2.0.17, 13 de Marzo de 2009
  213. # Corregido bug en página de amigos
  214. * 2.0.16, 12 de Marzo de 2009
  215. # Corregido bug al mostrar enlaces en la página de busqueda
  216. * 2.0.15, 12 de Marzo de 2009
  217. + Añadido comprobación de listas en el menu rapido de listas
  218. * 2.0.14, 11 de Marzo de 2009
  219. # Sustituidas las funciones de comprobación de sección.
  220. + Añadido QuickList a las paginas de busqueda y Top
  221. # Modificado el estilo del menu de listas rapidas.
  222. * 2.0.12
  223. # Modificado DaleYa para que busque por el titulo original
  224. * 2.0.11
  225. + Añadido enlace a ForiegMMoviesDDL (petición de capacitivo)
  226. + Añadido enlace a DaleYa (petición de capacitivo)
  227. + Añadido soporte para opciones en los enlaces (DaleYa)
  228. * 2.0.9, 10 de Marzo de 2009
  229. - Eliminada la dependencia del indice de tabla en insertar enlaces en titulo
  230. * 2.0.8, 10 de Marzo de 2009
  231. +Añadido rapido a listas desde la ficha de la pélicula
  232. * 2.0.7b, 10 de Marzo de 2009
  233. # Modificado Icono vagos.es
  234. # Corregido el error en listas rapidas
  235. * 2.0.7, 10 de Marzo de 2009
  236. Historico en almas gemelas.
  237. * 2.0.6, 7 de Marzo de 2009
  238. Añadida lista rapida a pagina de votaciones de usuarios
  239. * 2.0.5, 5 de Marzo de 2009
  240. Corregida pantalla selección de listas para nº grande de listas
  241. * 2.0.4, 4 de marzo de 2009 (publica)
  242. Añadidos almas gemelas caidas y fecha de ultimos cambios.
  243. Ocultar enlaces por tipo
  244. Modificado el codigo para guardar las preferencias
  245. Posibilidad de modificar el nº de peliculas que aparecen en las listas de recomendaciones y TOP
  246. * 2.0.3, 3 de marzo de 2009 (interna)
  247. Añadido el control de cambios en almas gemelas
  248. Añadidas opciones para activar/desactivar los nuevos cambios
  249. * 2.0.2, 2 de marzo de 2009 (interna)
  250. Añadido el sistema rapido para añadir a listas
  251. * 2.0.1, 1 de marzo de 2009 (interna)
  252. Integrados los menus en la barra izquierda
  253. Integrados enlaces en la ficha de la pelicula
  254. * 1.2.0 -> FilmAffinityPlus por Javier Arias
  255. * 1.2.0, 26 de agosto de 2008
  256. Añadida la opción para abrir los enlaces en nueva ventana (muy solicitado).
  257. Ahora se utiliza la versión en castellano de IMDb.
  258. Cambio de imagen del panel de configuración.
  259. Añadido el sitio de información general Rotten Tomatoes (petición de Jerry Lucas).
  260. Añadidos los siguientes sitios de descargas: aRGENTeaM, titles.box.sk y fileheaven (petición de aixa-impaciente).
  261. Añadido el sitio de descarga directa Taringa!.
  262. Arreglada la búsqueda en CINeol.
  263. Se indica cuáles de los sitios web a los que enlaza el script requieren registro.
  264. En el log se muestra la versión del script, útil para buscar y corregir errores.
  265. Se puede acceder fácilmente a la información de depurado pulsando en el título de la barra de FilmAffinityPlus.
  266. * 1.1.0, 27 de junio de 2008
  267. Añadida una barra en la parte superior izquierda de la pantalla, con botones para acceder al panel de configuración, a la web oficial y para añadir FilmAffinity a los motores de búsqueda de Firefox.
  268. Añadida una opción para cambiar el estilo de las estrellas de puntuación. Se incluyen dos esquemas: uno de estrellas rojas y otro de estrellas amarillas, además de la posibilidad de dejar las estrellas que vienen por defecto.
  269. Los enlaces a otros sitios web se muestran también en la página de resultados de una búsqueda.
  270. Tras realizar una búsqueda se guarda la opción de búsqueda realizada (ej: una búsqueda por "Reparto" deja seleccionada la opción "Reparto", actualmente tras cualquier tipo de búsqueda la opción seleccionada es siempre "Todas"). Además, tras la búsqueda el cuadro de búsqueda se queda con el foco del teclado.
  271. Arreglada la búsqueda en otros sitios web cuando los títulos contenían caracteres "raros", como tildes o acentos circunflejos (gracias aka_IDIOT).
  272. Se cambia el enlace a la versión inglesa de FilmAffinity para que apunte a la misma página en inglés, actualmente apunta siempre a la página principal (ej: desde la ficha de una película se va a la versión inglesa de la ficha).
  273. Cambiado el antiguo webchat por su nueva versión en flash.
  274. Recuperado el sitio de subtítulos solosubtitulos.com pues parece que vuelve a funcionar.
  275. Añadido un enlace externo a "el grupo de last.fm que surgió del foro que surgió de FilmAffinity" (sugerencia de VicenteJavier).
  276. Se muestra la bandera de cada país en la sección "Mis datos", también en la búsqueda avanzada y en los TOP FilmAffinity.
  277. En la sección "Mis datos" se añade a las estadísticas el número de países diferentes con películas vistas.
  278. Las búsquedas para AllZine (gracias VicenteJavier) y para Cinépatas (gracias pohc) se realizan con el título traducido debido a que la tasa de aciertos es mucho mayor que con el título original.
  279. Añadido el sitio de descargas Vagos.es (petición de Soisa y de un usuario anónimo).
  280. Correcciones menores.
  281. * 1.0.1, 14 de mayo de 2008
  282. Cambiado ligeramente el CSS del panel de configuración.
  283. Correcciones menores.
  284. * 1.0.0, 12 de mayo de 2008
  285. Primera versión pública.
  286. Eliminada la búsqueda de subtítulos en solosubtitulos.com pues la página ha desaparecido.
  287. * 0.9.9, 25 de abril de 2008
  288. Arreglada la búsqueda en La Butaca.
  289. * 0.9.8, 23 de abril de 2008
  290. Para los enlaces a otros sitios web se utiliza el título original, no el traducido.
  291. Arreglada de nuevo la búsqueda en Google (gracias jota724).
  292. La notificación de cambios en el número de votos de Mis amigos también funciona para usuarios validadores de críticas, tal vez funcione para el resto de administradores (gracias jota724).
  293. * 0.9.7, 21 de abril de 2008
  294. Ahora el script funciona también para usuarios validadores de críticas, tal vez funcione para el resto de administradores (gracias jota724).
  295. Si no hay seleccionado ningún enlace de alguna categoría no se muestra ésta en la ficha de la película (gracias Zopilote).
  296. Arreglada la búsqueda en Alpacine (gracias Manhoman).
  297. Añadido DivX Clásico (petición de Grandine).
  298. * 0.9.6, 20 de abril de 2008
  299. 'Secciones externas' aparecía incorrectamente en las páginas de estadísticas (gracias aka_IDIOT).
  300. Arreglada la búsqueda en Google (gracias aka_IDIOT).
  301. Arreglado pequeño fallo al cargar las preferencias cuando el tipo de dato era 'undefined'.
  302. Añadido Cine-Clásico (petición de Grandine).
  303. Añadido Cinépatas (petición de Zopilote).
  304. Añadido AllZine (petición de Grandine).
  305. * 0.9.5, 18 de abril de 2008
  306. Primera versión beta pública.
  307. */
  308. // ==UserScript==
  309. // @name FilmAffinity++
  310. // @namespace http://www.filmaffinity.com/
  311. // @description Mejoras en FilmAffinity
  312. // @include http://www.filmaffinity.com/es/*
  313. // @include http://www.imdb.com/*
  314. // @version 3.2.8
  315. // ==/UserScript==
  316. //window.addEventListener("load", function () {
  317. doFAPP();
  318. //}, false);
  319. function doFAPP() {
  320. var d = document;
  321. var appName = "FilmAffinity++";
  322. var appVersion = '3.2.8';
  323. var homepage = 'http://userscripts.org/scripts/show/118708';
  324. var url = d.location.href;
  325. //Trim es una función que nos permite eliminar los carácteres en blanco al principio y fin de una cadena.
  326. String.prototype.trim = function() {
  327. return this.replace(/^\s+|\s+$/g, '');
  328. };
  329. //Quita el título alternativo entre paréntesis
  330. String.prototype.clearTitle = function()
  331. {
  332. return (this.indexOf('(') > 1) ? this.substr(0, this.indexOf('(')).trim() : this.trim();
  333. };
  334. //Invierte la cadena
  335. String.prototype.reverse = function() {
  336. return this.split("").reverse().join("");
  337. };
  338. //
  339. // var node = document.evaluate(xpath,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
  340. String.prototype.findNode = function(context)
  341. {
  342. //Si no se pasa ningún argumento, context = document
  343. //var xpathResult = document.evaluate( xpathExpression, contextNode, namespaceResolver, resultType, result );
  344. // -xpathExpression: expresión que queremos buscar en el XML
  345. // -contextNode: nodo padre del que dependerá la expresión (con document se puede acceder a todo)
  346. // -namespaceResolver: null para html
  347. // -resultType: constante que indica el tipo en que queremos recibir el resultado (FIRST... -> primer nodo del resultado
  348. // -result: sirve para reutilizar el objeto xpathresult, con null uno nuevo
  349. if (typeof context == "undefined") context = d;
  350. var nodo = document.evaluate(this, context, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
  351. if (typeof nodo == "undefined" || nodo == null) {
  352. log("Nodo no encontrado: " + this);
  353. nodo = null;
  354. }
  355. return nodo;
  356. };
  357. String.prototype.findNodes = function(context)
  358. {
  359. if (typeof context == "undefined") context = d;
  360. return findNodes(context, this);
  361. };
  362. String.prototype.findNodesArray = function(context)
  363. {
  364. if (typeof context == "undefined") context = d;
  365. return findNodesArray(context, this);
  366. };
  367. /*
  368. Sustituye las cadenas {propiedad} en la cadena por la propiedad del objeto
  369. */
  370. String.prototype.replaceObject = function(object)
  371. {
  372. var string = this;
  373. for (var property in object) {
  374. var value = object[property];
  375. var regexpr = eval("/{" + property + "}/g");
  376. string = string.replace(regexpr, value);
  377. }
  378. return string;
  379. };
  380. //Función sólo usada para ver cambios de almas gemelas
  381. /**
  382. * Returns the week number for this date. dowOffset is the day of week the week
  383. * "starts" on for your locale - it can be from 0 to 6. If dowOffset is 1 (Monday),
  384. * the week returned is the ISO 8601 week number.
  385. * @param int dowOffset
  386. * @return int
  387. */
  388. Date.prototype.getWeek = function (dowOffset) {
  389. /*getWeek() was developed by Nick Baicoianu at MeanFreePath: http://www.meanfreepath.com */
  390. dowOffset = typeof(dowOffset) == 'int' ? dowOffset : 0; //default dowOffset to zero
  391. var newYear = new Date(this.getFullYear(), 0, 1);
  392. var day = newYear.getDay() - dowOffset; //the day of week the year begins on
  393. day = (day >= 0 ? day : day + 7);
  394. var daynum = Math.floor((this.getTime() - newYear.getTime() -
  395. (this.getTimezoneOffset() - newYear.getTimezoneOffset()) * 60000) / 86400000) + 1;
  396. var weeknum;
  397. //if the year starts before the middle of a week
  398. if (day < 4) {
  399. weeknum = Math.floor((daynum + day - 1) / 7) + 1;
  400. if (weeknum > 52) {
  401. var nYear = new Date(this.getFullYear() + 1, 0, 1);
  402. var nday = nYear.getDay() - dowOffset;
  403. nday = nday >= 0 ? nday : nday + 7;
  404. /*if the next year starts before the middle of
  405. the week, it is week #1 of that year*/
  406. weeknum = nday < 4 ? 1 : 53;
  407. }
  408. }
  409. else {
  410. weeknum = Math.floor((daynum + day - 1) / 7);
  411. }
  412. return weeknum;
  413. };
  414. var logged = isLogged();
  415. //var userId = (logged) ? getUserId() : '';
  416. var userId = getUserId();
  417. var isAdmin = d.body.innerHTML.search(/\/es\/adm\/reviews_val\.php/ig) > -1;
  418. var methodEncode = function(txt) {
  419. return encodeURIComponent(txt);
  420. };
  421. var methodEscape = function(txt) {
  422. return escape(txt.replace(/\s/g, '+'));
  423. };
  424. var _TFILM = 1;
  425. var _TGEN = 2;
  426. var _TDOWN = 3;
  427. var _TSUB = 4;
  428. var DIST_REGIONS = 0;
  429. var DIST_CONTINENTS = 1;
  430. var ANCHOR_AFTER = 1;
  431. var ANCHOR_BEFORE = 2;
  432. var NUM_SM = 20;
  433. var debuglog = '<u><strong>INFORMACIÓN DE DEPURADO</strong></u>';
  434. var XPATH_SML = '//table[@class="list2"]';
  435. //http://www.iconarchive.com/category/funny/kidcons-icons-by-iconfactory.html
  436. var ratingStyles = {
  437. red: { name: 'Estrellas rojas', code: 'red', iconOn: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9gFFA4sOtCB5EwAAAJhSURBVDjLbdNNaJxVGAXg537zTWca8zOkdVBoU61dtCBBq4hVEcEYRFyIaFcSFDcuuigiXbjwN2ipC0E3IkVExYVEF9GFhYgt1Y0UFbGodVNUEgxpE2JIJpnMvC5yI7PwwuEuLueew/ueIyJsA8V+xav7pd/xMIZQQ+F/TkToJUPtJUM//OT6uFe5hKfRRB+qGfV8V5DKng/T1mNleLKY80J3YGhK5+0PrI12+XZEuumo2q2XrN/4ie6HeB+ttK2eUkpontS4xNLgKvrU7FG1oR2llA7oqKs6bHUax7FQZDIUu6Wxpug/quHlcyuGrfvOmgU70mRqKbUds9rFN7gG5bb1sql4YsqeufFCxN7bIiKiO9ONeKMT3bGLMVEV0wYCF/OAD2GwrEt3P6P/xXEDYxfMOZOOcPY8syEtEtfyzswRjTrT7Q6cx2pGuzhl4LNnHRx7Jc1arnTEV2e4rmCBWN+azw12u7pJY8vxP5ncwmZxwvLn7/q59VbsckunNH7/IA89RT82SH/z4JMXrOB2O5TchcgAw3i04NPn9a98RLxXijjXjRk3xwRxUi0OF2KyIh5T7+IE9mFnwk4M5I8e+Fjj1Lyl+gEjTpd/eG5zS6VQNaiqtM9Bv/yGx/GnHNNaju3II8qzrxETNfGjvXGPSvRJVwal+TtZG006mMUdaKaeFFZQb0ivf2/02Ly/3OeqlvgSU3l4NezCfF7nbJmTGCmlDjaWxa9LWia2yF/jdCYsYj0LdrdX2Rtl2cUhfIHLeDOT57CEdk93OminniZKKRW5bcPZqqy8iLWs/F+bEf8CaxrvLdIwvxgAAAAASUVORK5CYII=',
  438. iconOff: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9gFFA4hJnEuxk4AAALqSURBVDjLbZNBSCNXHMZ/8+ZNMrGuKcYEQmpCacEuSCBGUOxhiaQXWVBphYJ3b+3Ncw8Fwfawh+KtB6U9ilDqofVSomsED/VQJRsqxiRiSRCNJiYzk5lMD51sPeyDDx7v8f2+B+//4boufQEimUx+m0wm/9Z1/SUQBPyA4B3Ldd3/LxRFQUqppdPpl/Pz8x9PT0//rGnaFx5EBzRAk1L296qiKIp8AlSEELqqqsNHR0ek0+lgJBL54eDgIOk4zmEsFvtofHw8VavVPszn8z+1Wq1NwHgKwAO8H4lEqFar6LoeWFpa+rrX630lhFCCwSCJRIJ8Pn8N/ArciP7zARGPx7NSysFUKsXa2ho+n49KpYJhGMr+/j4Ae3t7PcuyXgPvAVIq/7nVsbGxLxcWFr4/PDwUMzMzxGIxVldXubm5oVQqUavVMAyD09PTN5ZlFQAHcGQ0Gv00k8l8Mzo6mq1WqywvLzM7O0uz2cQwDAKBALlcDl3XKZVKdLvdA6DtqSsWFxd3pqamsrlcDtM0yWazDA4OYpomvV4PgKGhIVqtFoFAAKDpmQ3AVuv1+ieapj2fnJyUQgg2NzeJRqPE43EajQadTodwOMzx8TGJRIJisUin0/kduAMM9f7+/nWhUPjz5ORESyQS8XA47Lu4uGBiYoKtrS22t7epVCpcX1+jaRqRSOSDy8vLc8dxikBHAQLAM2DY7/d/trKy8t3Dw4MeCoU4OzsjlUoBIKVE13VUVWV9fb3YaDSWgKoETKAHmKZp/lIoFD4Ph8Mvzs/PyWQy7O7ucnV1dSuEcEZGRp7Ztu0Dhrxgn/TMVv9byuXyX3Nzcy8eHx/Z2NigVqv9Ztv2tuu6zXK57BdChIC6F+xKr0SuoigOYN3e3r5ptVrs7OxQr9f/sCzrR89w5ziO6TgOXmgbaCseoD+N6sDAwHNN03Zt275st9uvXNetA/8ADaD7ZPIdoPsW4EGE17xhIOQd33nqeMlv2wy4/wJOnkltDSAWfgAAAABJRU5ErkJggg==',
  439. iconHalf: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9gFFA8tIUI9dtYAAAKsSURBVDjLbZNfiExhGMZ/7zfHnp05s2fraMa27DLYrJU/bWz+bDbiRkq0KxfccCv5U7IpNoQIcYmkpC3hAmWVskUhNf4sa0OLxWrHyDTGzpiZM58L32oufPX0XT3v8/S+z4PWmjEAqj4w/mBMqt8Cq4FqwAYU/3laa8rJAPYOd9HT50zTS5mSArYAUSAEjDOoNH8AkPIBAlR32os+drjou0T0Rmf+aCAQOK2UWh+JRDpbW1uvNDQ0PAG2AS5QIWPqIiJA9Chz3ryPZdy0pZj9boQ7S5spFotaRCQUCqGUoqen5wawHUgqQwZQjvJWREmFVzmTOHv5BZ/nTiWdTuM4jvT39+P7PvF4vAQ8ABzAsoxywCay4WJpxvFz9gN1qGEZ4QVBuo49Y9B9zODgIENDQ4gIiURiAHgN+ICvwF6yuarl9nUmXOqdMFyza/k25p28QOEL5FMQDofp7u6moqKCZDIJcB8YNSioE9a0610/wysOuC/57CmW7D+CFVXkk5DP/T2N53lks1mCwSDAT0POAUW1x39381RoJHcmXU/76w+sWRvmzY4urCoo5CGTydDe3k6pVMJxHERkMaAN/goA60Cu7aycmbkEunPedP29V+vDLft0Y2Ojbmtr0zU1Nbq5uVk3NTWVgN3AZCAYMENGgIcPi8n3HUxZ9lUVrPijAeIfTzJu6mxEhNraWlzXJRaLSV9fXz1wA/iFialtYlu/MjS5d69TpTdNRD+lUdfV1WnLsr7btp2IRqNZz/N8YBhoAaJiHIiJZmVIqo/06Vlbv/GJhXwDcj3AVbM8GxgPJIBXwLBlkqhFxAfyozo9kAI2qjSUcveA84bwA/htBEtjpyyPMsbFTOAW8AE4ZchfgRRQKCujDxSkrImIiDJt84xVjPIPIGuU/7UZ0H8AV94JRR0cbigAAAAASUVORK5CYII=' },
  440. yellow: { name: 'Estrellas amarillas', code: 'yellow', iconOn: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACdUlEQVR42pVRW0gUYRT+/rmtq+stlIIy00mlB8MHKdSgoHwIQrrYQyEp+FIaUVg9FUpET6Iv2dKFLpAFGURPW0hCG2xQka5Blrcu3iHF1HV05p/5O4NbVNaCA9/858w5853/+w5DjId3tpbjbBWUduvh/3pYLAKrrbgXgddQb1q5Kybge9Usp4YN4AMHC0i6GuCfVkRgVmuNqDPrMETJba1Ru2+eWRlBvacfJyt1fLsG+D2DWtOi/k8C/uZeAWa7k/Hs8gJUvgbpcoITrxU5G+dqpcJHDMYeOC8VoQz7rtij8yExZEZgYIJNy5qYcKYY35VSKXLtZlFZlAzrOWDbDHmHGFIqAKebzLgBSB+Br5QGmcCYEGxGAl5I08LgxxnfqsUJjiqu203yAduLIrrXqtOAwinoo5+n6DSA8S6gk8IemtGhGRgVpxizbv3yYGGLmiN5RAD7uY4y+pCRR6/MJZsi74HgEJx2SoOePkeRd8e/nR9YZiIvVCTkqUHnvFGCbCLgq2n4NDBCUkiF7fcFvR1z22Nuwdin+uUa6yiyKZlzWQkkGYNEcD3O732yUPM3QRxBi8YiUiGF1cPOBkQoGyEohPVuhVb7QPviazU3/+x1t+0GiYQkQmpFGrKvlqNN3QHN6SDpYc8IFm0k5PO1UimwGFLMY232wbuTop/6XXdnf5egjJbgXFoB6vk4w3BYDeX2mw1uoVdHwzodxUoO8P2dtz49aFyKivvTg5l8KSxr0qbQJGsu/Wzdibrg9iQ9zcSRbT7phKMqPYldZsEyE6vToF5IZS1jNtoLB8Xj6AQnWnZt1F5loSxDZjtbIqL24tjSDX4AdFTzI/nnv+kAAAAASUVORK5CYII%3D',
  441. iconOff: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9gFFA4bKl0xVBwAAAKOSURBVDjLlZJNaxNRFIbfeydzuTNpMhga8lULtUkp7aKBuhEXCrpQKUVE8B+00FqoG/+A4EZEhFJpd6XgSqjShYKrFtpFoSQgBiWRfoATJjiZmElnksnNxI2VLozSsz3PeThfEv4R+Xz+vizLY3t7e4VeTOA/gqeKogDAm14M7ZVYXFwcsm07rWlaemFhYejcAsbYPOec9PX1EcbY3LkFqqreHRsbQzAYhKIo93pxJJfLZU3T1HZ2dpqEkDjnPBgIBK5wzuenpqbI1tYWqtVqVwixbNv2bqPROOl0OoYQgrmuWw2sra1NBIPBF5OTk5phGPB9n4yPj5N0Oo1arYZwOAxKKXEcZ77Vas0pitIVQsA0zVqn03koZbPZr47jmLqu31QUhWmaRgYGBtBoNFCr1UApBeccjuNACEGEEMSyrKbneY8BvCans8zMzGQkSXqfTCaHk8kkYrEYVFUFAFiWhaOjIxiGAdM0i5TS26urq98AgJxdyOzsLA2Hw9sjIyNXE4kEGGNoNpsol8uwbRuHh4fbS0tL13peYWVlxfc875PrujAMAwcHB9B1Hd1uF4QQEEI+/+0TOQD2u5supfSW7/uwLAuu64JSClVVQQiBLMt3AIRPWQBeAIAMIATgQiaTuSRJUrLdbqNSqcCyrO9CCEQikVQsFoMkSYlMJnO9WCyWAFQBdCQAHgAbQHV6evpBKBS6YZomdF3fXV9ff5TP59+lUqnhdrt9kXMuxePxL/v7+28B1AG0pTPj+Nls9mWr1YocHx8/39jYeAKgDKBaKBQ+9vf3n1BKLwOI5nK55dOiP4LR0VE5Go1O1Ov1Z5ubm68AVADUAPwE8KNUKm0PDg4WCCGMMfahXC77APAL7BgSZ+fkffYAAAAASUVORK5CYII=',
  442. iconHalf: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9gFFA8wOa49gpwAAAJ5SURBVDjLlZJPSBRhHIafb2Zn3NldW6mVtFUj/BN0qUAEkUioQ3UIqSACwUPQIfPQLbp0CLpERVAG4rVCIqqTgnhIRGrRFKOlWE1k0cXcP+bO7sp+38x0CCOCFfqdn/eBl/ens8upueeXcmb0SCwWi1ditN0E3uLTe5Zl3duNqShQPcYhLzzTEg6HWwYGBg79t8DdJ/ppKItQKCRM07z+/xUaRA/11wgGg1iWdaESJtTMi2PkF8JMPNnGUHXU6kE3YHa6LXa/1v5GjLzKkc1mPaXUYD6fn7Ztu+A4zrpSyiyVSlmhTtf0eW3OI6+vM4x8D44jOHxFUNML7gKj423Ytk2xWGRjY8MrlUqeUopMJrMppbzhI18c4SOWk554qF90LDqB0H5gFLQElnUU0zQpl8v4/X4hpRS5XK7kOM5tIcRrsdNlu8No1aq8US6oZs4DjYeBg0xN3SKXy7GyssL6+jqZTCahadrZoaGhJQDfjsAfkwnV7mtjxpp0z5a6fm+5jW3bpNNpXNelUChMDg8Pn6y4gm9GubKoPpMEkt8gMcna2hqe5yGEQAjx5d8VfIAfMAEBeG7QOaNL4BOwCplChkAggBACwzDOAXt2WKCsAQZQDTT2Rugm5B5gC9xxyL+sWk0kEqvJZBIpJbqu17e2tnYDUSAA6DpQBvJAduw4l6sPcErFBMkP5nTj5/LN+fn5d9FotFlK2ej3+/W6urqvs7Ozb4EtQOp/f++dGu2xl9L3Ti/pDzq+y7tACsjG4/HxSCRS0DStHaidm5sb3An9EVyNYHQZHF0uevdPLDvPgB/AJvATSC8uLk42NTXFhRCmaZpjqVTKBfgFwF0VMjiLGusAAAAASUVORK5CYII=' }
  443. };
  444. var img_plus = "http://www.imageconverterplus.com/img/tree-menu/signplus.gif";
  445. var img_minus = "http://www.imageconverterplus.com/img/tree-menu/signminus.gif";
  446. var redstar = "http://i60.tinypic.com/1zchfo4.png";
  447. var closeimg = "http://www.buxo.org/content/fapp/icons/close.png";
  448. var upimg = /*"http://neokben.host-ed.me/fa/src/arrowupfa.jpg";*/ "http://i46.tinypic.com/2cyp1s9.gif";
  449. var upimg10 = "http://www.freeiconsweb.com/Icons/16x16_arrow_icons/arrow_17.gif";
  450. var downimg = "http://i45.tinypic.com/2vdp3eb.gif";
  451. var downimg10 = "http://cinemakb.freehostingcloud.com/src/arrow_1810.gif";
  452. var logoimdb = "http://s3.subirimagenes.com:81/otros/previo/thump_7805471logoimdb2.jpg";
  453. var newimg = "http://www.buxo.org/content/fapp/icons/new.png";
  454. var upload_img = "data:image/gif;base64,R0lGODlhEAAQAPQAAPD09qUJCe3u8LQ8PcuCg6YNDa8rK%2BPO0NWkpaodHcd1dsJmZ%2Bfb3NGVlt%2B%2FwLpLS75XWAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH%2FC05FVFNDQVBFMi4wAwEAAAAh%2FhpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh%2BQQJCgAAACwAAAAAEAAQAAAFUCAgjmRpnqUwFGwhKoRgqq2YFMaRGjWA8AbZiIBbjQQ8AmmFUJEQhQGJhaKOrCksgEla%2BKIkYvC6SJKQOISoNSYdeIk1ayA8ExTyeR3F749CACH5BAkKAAAALAAAAAAQABAAAAVoICCKR9KMaCoaxeCoqEAkRX3AwMHWxQIIjJSAZWgUEgzBwCBAEQpMwIDwY1FHgwJCtOW2UDWYIDyqNVVkUbYr6CK%2Bo2eUMKgWrqKhj0FrEM8jQQALPFA3MAc8CQSAMA5ZBjgqDQmHIyEAIfkECQoAAAAsAAAAABAAEAAABWAgII4j85Ao2hRIKgrEUBQJLaSHMe8zgQo6Q8sxS7RIhILhBkgumCTZsXkACBC%2B0cwF2GoLLoFXREDcDlkAojBICRaFLDCOQtQKjmsQSubtDFU%2FNXcDBHwkaw1cKQ8MiyEAIfkECQoAAAAsAAAAABAAEAAABVIgII5kaZ6AIJQCMRTFQKiDQx4GrBfGa4uCnAEhQuRgPwCBtwK%2BkCNFgjh6QlFYgGO7baJ2CxIioSDpwqNggWCGDVVGphly3BkOpXDrKfNm%2F4AhACH5BAkKAAAALAAAAAAQABAAAAVgICCOZGmeqEAMRTEQwskYbV0Yx7kYSIzQhtgoBxCKBDQCIOcoLBimRiFhSABYU5gIgW01pLUBYkRItAYAqrlhYiwKjiWAcDMWY8QjsCf4DewiBzQ2N1AmKlgvgCiMjSQhACH5BAkKAAAALAAAAAAQABAAAAVfICCOZGmeqEgUxUAIpkA0AMKyxkEiSZEIsJqhYAg%2BboUFSTAkiBiNHks3sg1ILAfBiS10gyqCg0UaFBCkwy3RYKiIYMAC%2BRAxiQgYsJdAjw5DN2gILzEEZgVcKYuMJiEAOwAAAAAAAAAAAA%3D%3D";
  455. var download_img = "data:image/gif;base64,R0lGODlhEAAQAPQAAPD09hi7Q%2Bry8UbGaofXnxy7RjfDXM3q2abguCm%2FUnvVlW7Qitnu4pjdrcDnzVXKdWDNfwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH%2FC05FVFNDQVBFMi4wAwEAAAAh%2FhpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh%2BQQJCgAAACwAAAAAEAAQAAAFUCAgjmRpnqUwFGwhKoRgqq2YFMaRGjWA8AbZiIBbjQQ8AmmFUJEQhQGJhaKOrCksgEla%2BKIkYvC6SJKQOISoNSYdeIk1ayA8ExTyeR3F749CACH5BAkKAAAALAAAAAAQABAAAAVoICCKR9KMaCoaxeCoqEAkRX3AwMHWxQIIjJSAZWgUEgzBwCBAEQpMwIDwY1FHgwJCtOW2UDWYIDyqNVVkUbYr6CK%2Bo2eUMKgWrqKhj0FrEM8jQQALPFA3MAc8CQSAMA5ZBjgqDQmHIyEAIfkECQoAAAAsAAAAABAAEAAABWAgII4j85Ao2hRIKgrEUBQJLaSHMe8zgQo6Q8sxS7RIhILhBkgumCTZsXkACBC%2B0cwF2GoLLoFXREDcDlkAojBICRaFLDCOQtQKjmsQSubtDFU%2FNXcDBHwkaw1cKQ8MiyEAIfkECQoAAAAsAAAAABAAEAAABVIgII5kaZ6AIJQCMRTFQKiDQx4GrBfGa4uCnAEhQuRgPwCBtwK%2BkCNFgjh6QlFYgGO7baJ2CxIioSDpwqNggWCGDVVGphly3BkOpXDrKfNm%2F4AhACH5BAkKAAAALAAAAAAQABAAAAVgICCOZGmeqEAMRTEQwskYbV0Yx7kYSIzQhtgoBxCKBDQCIOcoLBimRiFhSABYU5gIgW01pLUBYkRItAYAqrlhYiwKjiWAcDMWY8QjsCf4DewiBzQ2N1AmKlgvgCiMjSQhACH5BAkKAAAALAAAAAAQABAAAAVfICCOZGmeqEgUxUAIpkA0AMKyxkEiSZEIsJqhYAg%2BboUFSTAkiBiNHks3sg1ILAfBiS10gyqCg0UaFBCkwy3RYKiIYMAC%2BRAxiQgYsJdAjw5DN2gILzEEZgVcKYuMJiEAOwAAAAAAAAAAAA%3D%3D";
  456. var link_img = "data:image/jpeg;base64,%2F9j%2F4AAQSkZJRgABAQAAAQABAAD%2F2wBDAAkGBwgHBgkIBwgKCgkLDRYPDQwMDRsUFRAWIB0iIiAdHx8kKDQsJCYxJx8fLT0tMTU3Ojo6Iys%2FRD84QzQ5Ojf%2F2wBDAQoKCg0MDRoPDxo3JR8lNzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzf%2FwAARCAAMAAwDASIAAhEBAxEB%2F8QAFgABAQEAAAAAAAAAAAAAAAAABQMG%2F8QAIhAAAgEDBAMBAQAAAAAAAAAAAQIDBBESAAUTIQYUMSNC%2F8QAFAEBAAAAAAAAAAAAAAAAAAAABP%2FEABwRAAIBBQEAAAAAAAAAAAAAAAECAwARMWGR8P%2FaAAwDAQACEQMRAD8A3u8b3NPUx%2ByVotuppZnnkSskVpER2itZVU5Fh0FYgf0PmmvGJOWGtdPcFOan8RVs7Oo448hdyT0%2BYPf0HU6rxmOpimhbcaxYJXmbjCQHDlLF8WMZYXzYfb2OntOnYJGFAzvd%2B0OEFnLE49yv%2F9k%3D";
  457. var ratings = {
  458. 1: "Muy mala",
  459. 2: "Mala",
  460. 3: "Floja",
  461. 4: "Regular",
  462. 5: "Pasable",
  463. 6: "Interesante",
  464. 7: "Buena",
  465. 8: "Notable",
  466. 9: "Muy buena",
  467. 10: "Excelente"
  468. };
  469. var menus = {
  470. 0: {name:'SECCIONES EXTERNAS',anchor:'TOPs',cond:'SHOWSEMENU',
  471. options: {0:{title: 'El Foro que surgió de FilmAffinity',
  472. href:'http://filmaffinity.mforos.com',
  473. target:'_blank'},
  474. 1:{title: 'Chat NO OFICIAL en iRC-Hispano',
  475. href:'http://www.irc-hispano.es/webchat/flash.php?canal=filmaffinity',
  476. target:'_blank'},
  477. 2:{title: 'El grupo de last.fm que surgió del foro que surgió de FilmAffinity',
  478. href:'http://www.lastfm.es/group/El+grupo+que+surgi%C3%B3+del+foro+que+surgi%C3%B3+de+Filmaffinity',
  479. target:'_blank'}
  480. }
  481. },
  482. 1: {name:'FilmAffinity++',anchor:'USUARIOS',position:ANCHOR_BEFORE,cond:'SHOWSCRIPTMENU',
  483. options: {0: {title:'Panel de Configuración',href:'#',target:'',onclick:preferences},
  484. 1: {title:'Hilo Oficial FA++',href:'http://filmaffinity.mforos.com/1360515/9537533-filmaffinity-plus-disponible-vol-ii/#84559313',target:'_blank'},
  485. 2: {title:'Añadir motor busqueda',href:'#',target:'',onclick:installSearchEngine},
  486. 3: {title:'Información de depurado',href:'#',target:'',onclick:showLog}
  487. }
  488. },
  489. 2: {name:'Premios++', anchor:'INFORMACIÓN', position:ANCHOR_BEFORE,cond:'SHOWEXTRAPRIZES',
  490. options: { 0: {title:'BAFTA', href:'#',target:'',onclick:showBAFTA},
  491. 1: {title:'Berlín', href:'#',target:'',onclick:showBerlin},
  492. 2: {title:'Cannes', href:'#',target:'',onclick:showCannes},
  493. 3: {title:'Cine Europeo', href:'#',target:'',onclick:showCineEuropeo},
  494. //4: {title:'Críticos de NY', href:'#',target:'',onclick:showCriticosNY},
  495. 4: {title:'Emmy', href:'#',target:'',onclick:showEmmy},
  496. 5: {title:'Gijón', href:'#',target:'',onclick:showGijon},
  497. 6: {title:'Globos de Oro', href:'#',target:'',onclick:showGoldenGlobe},
  498. 7: {title:'Goya', href:'#',target:'',onclick:showGoya},
  499. //8: {title:'Gotham', href:'#',target:'',onclick:showGotham},
  500. 8: {title:'Málaga', href:'#',target:'',onclick:showMalaga},
  501. 9: {title:'Razzie', href:'#',target:'',onclick:showRazzie},
  502. //10: {title:'NBR', href:'#',target:'',onclick:showNBR},
  503. 10: {title:'San Sebastián', href:'#',target:'',onclick:showSS},
  504. //12: {title:'Satellite', href:'#',target:'',onclick:showSatellite},
  505. 11: {title:'Sevilla', href:'#',target:'',onclick:showSevilla},
  506. 12: {title:'Sitges', href:'#',target:'',onclick:showSitges},
  507. 13: {title:'Spirit', href:'#',target:'',onclick:showSpirit},
  508. 14: {title:'Sundance', href:'#',target:'',onclick:showSundance},
  509. 15: {title:'Tribeca', href:'#',target:'',onclick:showTribeca},
  510. 16: {title:'Valladolid', href:'#',target:'',onclick:showValladolid},
  511. 17: {title:'Venecia', href:'#',target:'',onclick:showVenecia},
  512. }
  513. }};
  514. // todo: modificar para no usar indices en esta lista de preferencias.
  515. var preferencesOptions = {
  516. //Opciones de Menus
  517. 0:{name:'SHOWSCRIPTMENU',text:'Mostrar el menú FilmAffinity++',def:true},
  518. 1:{name:'SHOWSEMENU',text:'Mostrar el menú Secciones Externas',def:true},
  519. 2:{name:'SHOWEXTRAPRIZES',text:'Mostrar el menú Premios II', def:true},
  520. //Opciones de listas
  521. 3:{name:'FAVLISTS',text:'Activar Listas Favoritas',def:true},
  522. 4:{name:'SHOWQUICKLIST',text:'Mostrar icono para añadir rápidamente a listas',def:true},
  523. 5:{name:'FETCHFILMLISTS',text:'Mostrar las listas a las que pertenece la pelicula en el menú de listas rapidas',def:false},
  524. 6:{name:'MEDIALISTS',text:'Mostrar medias de votaciones en listas',def:true},
  525. 7:{name:'SHOWVOTESONFRIENDLISTS',text:'Mostrar mis votos en las listas de otros usuarios y en los resultados de búsquedas',def:true},
  526. //Opciones de Mis Datos
  527. 8:{name:'FLAGSINMYDATA',text:'Mostrar banderas de países',def:true},
  528. 9:{name:'SHOWCLASIF',text:'Mostrar clasificaciones',def:true},
  529. 10:{name:'SHOWMFINDEXES',text:'Mostrar índices de votaciones',def:true},
  530. 11:{name:'SHOWYEARDATA',text:'Mostrar tabla de votos por años',def:false},
  531. 12:{name:'COUNTRYDISTS',text:'Mostrar tabla de votos por paises agrupados',def:false},
  532. //Otras opciones
  533. 13:{name:'FLAGSINOPTIONS',text:'Mostrar banderas en desplegables de selección de país',def:true},
  534. //14:{name:'FLAGSINFRIENDS',text:'Mostrar banderas en la lista de Amigos',def:true},
  535. 14:{name:'FLAGSCOPRODUCTIONS',text:'Mostrar banderas de coproducciones en fichas de películas',def:true},
  536. //16:{name:'SHOWEXTRAGROUPS',text:'Mostrar votos de otros grupos en fichas de películas',def:true},
  537. 15:{name:'SHOWMYSTATS',text:'Mostrar mis estadísticas en estadísticas de otros', def:true},
  538. 16:{name:'SHOWEXTERNALS',text:'Mostrar enlaces externos en búsquedas', def:true},
  539. 17:{name:'SHOWEXTPAGES',text:'Mostrar información de otras páginas en fichas',def:true},
  540. //Opciones de almas gemelas (No activas por el momento)
  541. //2:{name:'SHOWSMCHANGES',text:'Mostrar cambios en las almas gemelas.',def:true},
  542. //3:{name:'SHOWSMFALLEN',text:'Mostrar las almas gemelas caidas de la lista.',def:true},
  543. //4:{name:'KEEPSMCHANGES',text:'Mantener los cambios en las almas gemelas mientras no se produzcan nuevos cambios.',def:true},
  544. //7:{name:'OMITTVSHOWS',text:'Ocultar series de TV (experimental)',def:false},
  545. //12:{name:'ENABLEVOTES',text:'Permitir votar desde mis listas, listas de otros usuarios y resultados de busqueda',def:true},
  546. //13:{name:'CENTERPAGE',text:'Centrar pagina en la ventana del navegador',def:false},
  547. //14:{name:'FOLDMENUS',text:'Permitir plegar los menús',def:false},
  548. //15:{name:'SEARCHFORLIST',text:'Añadir buscar en listas',def:true},
  549. //22:{name:'COMPACTVOTES',text:'Notas compactas',def:true},
  550. 18:{name:'CHANGELIMIT',text:'Cambiar el n&deg; de peliculas a mostrar en Recomendaciones y TOP',def:false}
  551. //
  552. };
  553. var sections = {
  554. MyFriends:'/myfriends2\\.php/ig',
  555. Stats:'/userrep\\.php\\?user_id\\=/ig',
  556. UserRatting:'/userratings\\.php\\?user_id\\=/ig',
  557. Film:'/\\/film/ig',
  558. Search:'/\\/search\\.php/ig',
  559. MyData:'/\\/mydata\\.php/ig',
  560. TopGen:'/\\/topgen\\.php/ig',
  561. AdvSearch:'/\\/advsearch\\.php/ig',
  562. SoulMates: '/\\/soulmates\\.php/ig',
  563. MyLists:'/\\/mylists\\.php/ig',
  564. MyList:'/\\/mylist\\.php/ig',
  565. Tour:'/\\/tour\\.php/ig',
  566. SoulMatesRec:'/\\/smsrec\\.php/ig',
  567. UserRec: '/\\/userrec\\.php/ig',
  568. UserList: '/\\userlist\\.php/ig',
  569. UserLists: '/\\userlists\\.php/ig',
  570. UserReviews: '/\\/userreviews/ig',
  571. MyVotes: '/\\/myvotes\\.php/ig',
  572. AutoTour:'/\\/autotour\\.php/ig',
  573. EditMovieList: '/\\edtmovielists\\.php/ig',
  574. UptMyData: '/\\updmydata\\.php/ig',
  575. Topics: '/movietopic\\.php\\?topic\\=/ig',
  576. IMDBLists: '/\\/list/ig',
  577. AddMovie:'/\\/addmovie\\.php/ig',
  578. Awards:'/\\/awards\\.php/ig',
  579. Reviews:'/reviews/g'
  580. };
  581. var patches = {
  582. // Añade el icono para añadir a listas favoritas (IMDB)
  583. addAddToFavListsIMDB:{browser:['FF'],sections:['IMDBLists'],method:doAddToFavListsIMDB,preference:'FAVLISTS',def:true},
  584. // Centrar la página en la ventana del navegador
  585. centerPage:{browser:['FF','OP'],preference:'CENTERPAGE',def:false,method:doCenterPage},
  586. // Añadir menús a las opciones
  587. addMenus:{browser:['FF'],method:doMenus},
  588. // Redirigir en caso de que la busqueda de 0 resultados
  589. //redirectSearch:{browser:['FF'],sections:['Search'],method:doRedirectSearch},
  590. // Captura el valor de UCD, usado para subir votos
  591. captureUCD:{browser:['FF'],sections:['AutoTour'],method:doCaptureUCD},
  592. // Copia la configuraciones desde monousuario al usuario actual
  593. // updateFromMonoUser:{logged:true,preference:'MUMP',def:true,browser:['FF'],method:doUpdateMultiuser},
  594. // Registra los comandos GM
  595. registerCommands:{browser:['FF'],method:doRegisterCommands},
  596. // Estilo de las puntuaciones
  597. changeRatingStyle:{browser:['FF'],method:doRatingStyle},
  598. // Cambios en la lista de amigos
  599. friendsRatingChange:{browser:['FF'],sections:['MyFriends'],method:doFriendsRatingChange},
  600. // Añade enlaces en la lista de amigos
  601. //friendsLinks:{browser:['FF'],sections:['MyFriends'],method:addFriendsLinks},
  602. // Enlaces Externos
  603. externalLinks:{browser:['FF','OP'],sections:['Film','Search'],method:doExternalLinks},
  604. //Añade enlaces en fichas para guion, musica, ...
  605. addOtherLinksInFilms:{browser:['FF'],sections:['Film'],method:doAddOtherLinks},
  606. //Añade fecha de votacion de una pelicula
  607. addFechaVoto:{browser:['FF'],sections:['Film'],method:doAddFechaVoto},
  608. //Cambia aspecto críticas
  609. changeStyleReviews:{browser:['FF'],sections:['Reviews'],method:doChangeStyleReviews},
  610. // Cambios en almas gemelas
  611. //soulMatesChanges:{browser:['FF'],sections:['SoulMates'],preference:'SHOWSMCHANGES',def:true,method:doSoulMates},
  612. // Ordenación de las peliculas de una lista
  613. //sortFilmsInList:{browser:['FF'],sections:['MyList'],method:doSortFilmsInList},
  614. // Captura los nombres de nuestras listas
  615. //captureLists:{browser:['FF'],sections:['MyLists'],method:doCaptureLists},
  616. // Add External link to myLists
  617. addExternalLinkMyLists:{browser:['FF'],sections:['MyLists'],method:doAddExternalLinkLists},
  618. // Añade link para vaciar lista temporal y mostrar panel configuracion
  619. addLinkEmptyWorkList:{browser:['FF'], method:doAddLinkEmptyWorkList},
  620. // Añade funcionalidad para rellenar automaticamente fichas a partir de IMDB
  621. addDataFromIMDB:{browser:['FF'], sections:['AddMovie'], method:doAddDataFromIMDB},
  622. // Añade votos de contactos adicionales en las fichas de las peliculas
  623. //addExtraVotes:{browser:['FF'],sections:['Film'],method:doAddExtraVotes,preference:'SHOWEXTRAVOTES',def:true},
  624. // Añade notas de otras páginas
  625. addExtraRatings:{browser:['FF'],sections:['Film'],method:doAddExtraRatings,preference:'SHOWEXTPAGES',def:true},
  626. // Añade las listas favoritas a la pagina de Mis Listas
  627. addFavLists:{browser:['FF'],sections:['MyLists'],method:doAddFavLists,preference:'FAVLISTS',def:true},
  628. // Cambiar el color de los votos en Mis Listas
  629. changeColorVotesLists:{browser:['FF'],preference:'CHANGECOLORVOTES',sections:['MyList'],method:dochangeColorVotesLists,def:true},
  630. // Añade el icono para añadir a listas favoritas
  631. addAddToFavLists:{browser:['FF'],sections:['UserLists'],method:doAddToFavLists,preference:'FAVLISTS',def:true},
  632. // Añadir rapidamente a lista
  633. //quickList:{logged:true,browser:['FF'],sections:['UserList','AdvSearch','MyList','Film','Tour','SoulMatesRec','UserRec','MyVotes','AutoTour','UserRatting','TopGen','Search'],preference:'SHOWQUICKLIST',def:true,method:doQuickList},
  634. // Muestra nuestra puntuación en listas que no lo incorporan de serie
  635. showVote:{logged:true,browser:['FF'],preference:'SHOWVOTESONFRIENDLISTS',def:true,sections:['Search','UserList','Topics','AdvSearch','UserRatting'],method:doShowVote},
  636. //Mostras medias de votaciones de listas
  637. addMediaInLists:{browser:['FF'],sections:['MyList','UserList'],method:doAddMediaInLists},
  638. // Nos permite votar en listas ajenas, nuestras listas, ##NO FUNC##
  639. //enableVotes:{logged:true,browser:['FF'],preference:'ENABLEVOTES',def:true,sections:['MyList','Search','UserList'],method:doEnableVotes},
  640. // Edita el control de busqueda tras buscar
  641. processSearch:{browser:['FF'],sections:['Search'],method:doProcessSearch},
  642. // Añade banderas a la lista de amigos
  643. //addFlagsToFriends:{browser:['FF','OP'],preference:'FLAGSINFRIENDS',def:true,sections:['MyFriends'],method:doAddFlagsToFriends},
  644. // Añade banderas a las opciones de los combo box de paises
  645. addFlagsToOptions:{browser:['FF'],preference:'FLAGSINOPTIONS',def:true,sections:['TopGen','AdvSearch','UptMyData'],method:doAddFlagsToOptionsSel},
  646. // Añade las banderas a las estadisticas de 'mis datos'
  647. addFlagsMyData:{browser:['FF','OP'],preference:'FLAGSINMYDATA',def:true,sections:['MyData'],method:doAddFlagsMyData},
  648. // Banderas de coproductoras
  649. addCoproductionFlags:{browser:['FF','OP'],preference:'FLAGSCOPRODUCTIONS',def:true,sections:['Film'],method:doAddCoproductionFlags},
  650. // Añade estadisticas adicionales en myData
  651. doMyDataMod:{browser:['FF','OP'],sections:['MyData'],method:doMyDataMod},
  652. // Añade clasificaciones en myData
  653. addClasif:{browser:['FF'],preference:'SHOWCLASIF',sections:['MyData'],method:doAddClasif,def:true},
  654. // Captura las puntuaciones de las criticas, para analizar
  655. captureReviews:{browser:['FF'],sections:['Reviews'],method:doCaptureReviews},
  656. // Cambia el nº de resultados en los listados de TOPs ##NO FUNC##
  657. //alterLimits:{browser:['FF','OP'],method:doAlterLimits,preference:'CHANGELIMIT',def:true},
  658. // Modifica los titles de las imagenes para que coincidan con el alt
  659. alt2Title:{browser:['FF','OP'],method:doAlt2Title},
  660. // Corrige los enlaces a la web inglesa
  661. fixEnglishLinks:{browser:['FF','OP'],method:doFixEnglishLink},
  662. // Corrige la posición del icono de zoom al centrar la página
  663. //fixZoomIcon:{browser:['FF','OP'],sections:['Film'],method:doFixZoomIcon},
  664. // Botones para cambiar de año en las categorias de los premios
  665. buttonAwards:{browser:['FF'],sections:['Awards'],method:doButtonAwards},
  666. // TODO: Aplicar esto al resto de paginas del usuario
  667. // Captura los datos de los nuevos Contactos
  668. //captureContactData:{browser:['FF'],sections:['UserRatting'],method:doCaptureContactData,preference:'ADITIONALFRIENDS',def:true},
  669. //Compactar generos, paises, y años en estadísticas
  670. //addCompactCountries:{browser:['FF'],sections:['Stats'],method:doAddCompactCountries,def:true},
  671. //Compactar topics
  672. //addCompactTopics:{browser:['FF'],sections:['Topics'],method:doAddCompactTopics,def:true},
  673. //Añade nuestras estadísticas en las páginas de estadísticas de otros usuarios
  674. //addMyStatsToOthers:{browser:['FF'],sections:['Stats'],method:doAddMyStatsToOthers,preference:'SHOWMYSTATS',def:true},
  675. // Compacta votos para copiar y pegar
  676. addCompactVotes:{browser:['FF'],sections:['UserRatting'],method:doAddCompactVotes,preference:'COMPACTVOTES',def:true},
  677. // Add Search for lists
  678. //addSearchForListsOption:{browser:['FF'],method:doAddSearchListsOption,preference:'SEARCHFORLIST',def:true}
  679. };
  680. var linkSitesTypes = {
  681. 1:{caption:'Ficha en: ',preference:'verCine'},
  682. 2:{caption:'Buscar en: ',preference:'verGeneral'},
  683. 3:{caption:'Descargar de: ',preference:'verDescargas'},
  684. 4:{caption:'Subtítulos en: ',preference:'verSubtitulos'}
  685. };
  686. var linkSites = {
  687. abandomoviez : { name: 'Abandomoviez',
  688. icon: 'http://www.abandomoviez.net/favicon.ico',
  689. search: 'http://www.abandomoviez.net/db/busca_titulo_o.php?busco2=%searchvo',
  690. method: methodEscape,
  691. type: _TFILM
  692. },
  693. aullidos : { name: 'Aullidos',
  694. icon: 'http://www.aullidos.com/imagenes/scream-16.ico',
  695. search: 'http://www.aullidos.com/buscador.asp?txtBusqueda=%searchtr',
  696. method: methodEncode,
  697. type: _TFILM
  698. },
  699. cineol : { name: 'CINeol',
  700. icon: 'http://www.cineol.net/favicon.ico',
  701. search: 'http://www.cineol.net/multisearch.php?fan=1&where=movies&search=%searchvo',
  702. method: methodEscape,
  703. type: _TFILM
  704. },
  705. cinepatas : { name: 'Cinépatas',
  706. icon: 'http://www.cinepatas.com/favicon.ico',
  707. search: 'http://www.cinepatas.com/forum/searcher.php?search_keywords=%searchtr&easy_search=titles',
  708. method: methodEscape,
  709. type: _TFILM
  710. },
  711. imdb : { name: 'IMDb',
  712. icon: 'http://www.imdb.com/favicon.ico',
  713. search: 'http://www.imdb.com/find?q=%searchvo',
  714. method: methodEncode,
  715. type: _TFILM
  716. },
  717. labutaca : { name: 'La Butaca',
  718. icon: 'http://www.labutaca.net/favicon.ico',
  719. search: 'http://www.google.com/custom?q=%searchvo&sa=Buscar+en&sitesearch=www.labutaca.net&q=&domains=www.labutaca.net',
  720. method: methodEncode,
  721.  
  722. },
  723. mrskin : { name: 'Mr. Skin',
  724. icon: 'http://www.mrskin.com/favicon.ico',
  725. search: 'http://www.mrskin.com/search/search?term=%searchvo',
  726. method: methodEscape,
  727. type: _TFILM
  728. },
  729. myanimelist : { name: 'MyAnimeList',
  730. icon: 'http://cdn.myanimelist.net/images/faviconv5.ico',
  731. search: 'http://myanimelist.net/anime.php?q=%searchanm',
  732. method: methodEscape,
  733. type: _TFILM
  734. },
  735. rotten : { name: 'Rotten Tomatoes',
  736. icon: 'http://www.rottentomatoes.com/favicon.ico',
  737. search: 'http://www.rottentomatoes.com/search/full_search.php?search=%searchvo',
  738. method: methodEscape,
  739. type: _TFILM
  740. },
  741. yahoo : { name: 'Yahoo! Movies',
  742. icon: 'http://movies.yahoo.com/favicon.ico',
  743. search: 'http://movies.yahoo.com/mv/search?p=%searchvo&x=0&y=0&fr=ush-movies&toggle=1&cop=&ei=UTF-8',
  744. method: methodEscape,
  745. type: _TFILM
  746. },
  747. wikipedia : { name: 'Wikipedia',
  748. icon: 'http://en.wikipedia.org/favicon.ico',
  749. search: 'http://en.wikipedia.org/wiki/Special:Search?search=%searchvo&go=Go',
  750. method: methodEncode,
  751. type: _TGEN
  752. },
  753. wikipediaES : { name: 'Wikipedia ES',
  754. icon: 'data:image/x-icon;base64,AAABAAEAEBAAAAEACABoBQAAFgAAACgAAAAQAAAAIAAAAAEACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAgQAGRgZACgoKAAAAP8APDo8AEhHSABXWFcAaWppAHp7egCEg4QAmJiYAKmoqQC5urkAyMfIANjZ2ADp6OkAAP//APz9/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEREREREREREREQMDAwMDAxERERERDA0REREDAwMDAwMREREREQUFDhEREBAQEBAQEREREQsCAgsRDBAQEBAQEBEREREJBAgLDggDAwMDAwMRERERAgYPCwcEAwMDAwMDERERCQALEQ4EAgwRCgoREREREQUFDhEOBAUREQ4IEREREQwBCRERCgAGEREPCQwREREGAQ0RDgUCCQsREQwLEREOAQcPEQoBCw0HEREPBxERCQIMEREFAg4PCQoRDwcKDAYFDBELBQgOEQgGDg4HBhEREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=',
  755. search: 'http://es.wikipedia.org/w/index.php?title=Especial:Search&search=%searchvo&go=Go',
  756. method: methodEncode,
  757. type: _TGEN
  758. },
  759. google : { name: 'Google',
  760. icon: 'http://www.google.es/favicon.ico',
  761. search: 'http://www.google.es/search?q=%searchvo',
  762. method: methodEncode,
  763. type: _TGEN
  764. },
  765. allzine : { name: 'AllZine',
  766. icon: 'data:image/x-icon;base64,AAABAAEAEBAAAAEACABoBQAAFgAAACgAAAAQAAAAIAAAAAEACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIB7sACgm3AAoKtAAMDasACwuzAA0NrQAPDqoADQ6sABEPqAAMDLQADw+pAA8QpgAREKYAERGjAA8QqAAUEqEAEhKiABITnwAUE58AFBScABQUngAWFZoAFBaYABYVmwAWFpgAGBeVABYXlwAYGJQAFhiVABoYlAAaGZEAFxeZABoajgAaGpAAGhuNABkYmAAbGZQAGxyKAB0dhwAaHIwAHx2HABsdiQAdHYkAHR6GAB0fhQAiIX0AHB6KACEgggAhIX8AIiJ8ACgobgApKHAAMTDTADAw1gAxMtAAMzTKADU0ygAyMtIANzfBADU1yQA4NsUANjfFADg4wgA6Ob4AODm/ADY5wAA6OrwAPDu5ADc5wwA+PLcAOzq/ADo8uQA/PbQAPj21AD4+sgA8PbcAPD60AD4+tAA/PbgAQ0KpAENDpwBFRKQARkWhAEVEpgBGR58ASEmaAEpKmABRUIgAUlL4AFRU9ABUVfMAWFftAF9d3wBfXtwAYV/aAGFh1wBiYtQAZGTOAGZlzABmZc0AaGfHAGhnyQBoaMYAZmjHAGhpwwBpasAAaWrCAGtsvQBtbbkAcXKvAHR1qAByc7AAeXigAIGD/wCMiu4AjIvtAJGR3QCTk9kAlZbTAJ2fvgCrrf8Ara7/ALa2/wC5uP8AuLn/ALm8/wC9vv8Av77/AL+//wC/wP8AwMH/AMLC/wDCw/8AxMP/AMXE/wDGxf8Axsb/AMjG/wDGx/8AyMf/AMjI/wDJyv8Az876ANLT7wDU0/8A1tX/ANjZ/wDc2v8A3Nz/AN3e/wDf3v8A39//AOHg/wDj4v8A5OX/AOXm/wDm5v8A5uf/AOjn/wDq6P8A6On/AOrp/wDq6v8A7Oz/AOzt/wDt7f8A7e7/AO/u/wDv7/8A7/D/APDw/wDx8P8A8fH/APHy/wDz8v8A8/P/APT0/wD09v8A9vb/APb3/wD49/8A+Pj/APj5/wD6+f8A+vr/APv7/wD8/f8A/f3/AP/+/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAtoxUgFNig6+5ury7sYRodrKCImEqICZsrLa3r3UqKTKygSaIpXQwHmGoqGIeKmuOsYArja6onEYUfmcYQn+ks7GALoaoqKB7EAYMTpmhqrWtfidpbGtmYD0AAV1ka293in0hUCoRDRkXBAIPIxwsVzFxH36WNAmSegNYkD4UlacqBQyFnjsFlHwLWZFDIZqwTwQGiaVDDUpMDDY8JC+jtocKCIurZUtHQQY5OEVWr7mrQhKFo5lJFHkGWjY/m664sHIdY5iTOg54W3k1N5eisLSfKEgbGhMMDRoWBwslM3C3plIeXF9NFV5qZkRAaW6PubBtLXOcVS2dqaZRUaaxuAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA%3D',
  767. search: 'http://www.allzine.org/Foro/index.php?action=search2&search=%searchtr&subject_only=1',
  768. method: methodEncode,
  769. regreq: true,
  770. type: _TDOWN
  771. },
  772. argenteam : { name: 'aRGENTeaM',
  773. icon: 'http://www.argenteam.net/static/images/favicon.ico',
  774. search: 'http://www.argenteam.net/search',
  775. method: methodEncode,
  776. regreq: true,
  777. type: _TDOWN
  778. },
  779. asiatorrents : { name: 'AsiaTorrents',
  780. icon: 'http://www.asiatorrents.me/favicon.ico',
  781. search: 'http://www.asiatorrents.me/index.php?page=torrents&search=%searchvo',
  782. method: methodEncode,
  783. type: _TDOWN
  784. },
  785. cineclasico : { name: 'Cine-Clásico',
  786. icon: 'http://www.cine-clasico.com/favicon.ico',
  787. search: 'http://www.cine-clasico.com/foros/search.php?keywords=%searchvo&terms=all&author=&sc=1&sf=firstpost&sr=posts&sk=t&sd=d&st=0&ch=300&t=0&submit=Buscar',
  788. method: methodEncode,
  789. regreq: true,
  790. type: _TDOWN
  791. },
  792. cinemageddon : { name: 'Cinemageddon',
  793. icon: 'http://cinemageddon.net/favicon.ico',
  794. search: 'http://cinemageddon.net/browse.php?search=%searchvo',
  795. method: methodEncode,
  796. regreq: true,
  797. type: _TDOWN
  798. },
  799. clansa : { name: 'Clan-Sudamérica',
  800. icon: 'http://www.clan-sudamerica.net/invision/favicon.ico',
  801. search: 'http://www.clan-sudamerica.net/invision/index.php?act=Search&CODE=show&searchid=827b042d37e3387690c2085b3dc9e1f5&search_in=posts&result_type=topics&highlite=%searchtr',
  802. method: methodEncode,
  803. regreq: true,
  804. type: _TDOWN
  805. },
  806. divxclasico : { name: 'DivX Clásico',
  807. icon: 'http://www.divxclasico.com/favicon.ico',
  808. search: 'http://www.divxclasico.com/foro/search.php?search_keywords=%searchvo&highlight=%searchvo',
  809. method: methodEncode,
  810. regreq: false,
  811. type: _TDOWN
  812. },
  813. eutorrents : { name: 'EuTorrents',
  814. icon: 'http://eutorrents.ph/favicon.ico',
  815. search: 'http://eutorrents.ph/index.php?page=torrents&search=%searchvo',
  816. method: methodEncode,
  817. type: _TDOWN
  818. },
  819. fileheaven : { name: 'fileheaven',
  820. icon: 'http://www.fileheaven.com/favicon.ico',
  821. search: 'http://www.fileheaven.org/forum/search.php?mode=results&search_keywords=%searchvo&search_terms=all&search_author=&search_forum=-1&search_time=0&search_fields=subjonly&search_cat=-1&sort_by=0&sort_dir=DESC&show_results=topics&return_chars=200',
  822. method: methodEncode,
  823. regreq: true,
  824. type: _TDOWN
  825. },
  826. isohunt : { name: 'isoHunt',
  827. icon: 'http://isohunt.com/favicon.ico',
  828. search: 'http://isohunt.com/torrents/%searchvo?ihs1=2&iho1=d&iht=1',
  829. method: methodEncode,
  830. type: _TDOWN
  831. },
  832. karagarga : { name: 'Karagarga',
  833. icon: 'http://karagarga.net/favicon.ico',
  834. search: 'https://karagarga.net/browse.php?search=%searchvo&search_type=title',
  835. method: methodEncode,
  836. regreq: true,
  837. type: _TDOWN
  838. },
  839. kickass : { name: 'KickAss Torrents',
  840. icon: 'http://kastatic.com/images/favicon.ico',
  841. search: 'http://kickass.to/usearch/%searchvo',
  842. method: methodEncode,
  843. type: _TDOWN
  844. },
  845. mcanime : { name: 'MCAnime',
  846. icon: 'http://www.mcanime.net/favicon.ico',
  847. search: 'http://www.mcanime.net/busqueda/google?cx=007892940784097042092:uruccpok3vu&cof=FORID:11&q=%searchvo',
  848. method: methodEncode,
  849. regreq: true,
  850. type: _TDOWN
  851. },
  852. mininova : { name: 'Mininova',
  853. icon: 'http://www.mininova.org/favicon.ico',
  854. search: 'http://www.mininova.org/search/%searchvo/4',
  855. method: methodEncode,
  856. type: _TDOWN
  857. },
  858. patio : { name: 'Patio de Butacas',
  859. icon: 'http://www.patiodebutacas.org/foro/favicon.ico',
  860. search: 'http://www.patiodebutacas.org/foro/search.php?query=%searchvo&exactname=0&starteronly=0&forumchoice[]=0&prefixchoice[]=&childforums=1&titleonly=0&showposts=0&searchdate=0&beforeafter=after&sortby=lastpost&sortorder=descending&replyless=0&replylimit=0&searchthreadid=0&saveprefs=1&quicksearch=0&searchtype=1&nocache=0&ajax=0&userid=0&',
  861. method: methodEncode,
  862. regreq: true,
  863. type: _TDOWN
  864. },
  865. piratebay : { name: 'The Pirate Bay',
  866. icon: 'http://thepiratebay.cr/favicon.ico',
  867. search: 'http://thepiratebay.cr/search/%searchvo/0/99/200',
  868. method: methodEncode,
  869. type: _TDOWN
  870. },
  871. taringa : { name: 'Taringa!',
  872. icon: 'http://o1.t26.net/img/thumbt-es-v5.jpg',
  873. search: 'http://www.taringa.net/buscador/?q=%searchvo&categoria=13&sort_by=0&autor=',
  874. method: methodEncode,
  875. type: _TDOWN
  876. },
  877. opensubtitles : { name: 'OpenSubtitles',
  878. icon: 'http://static.opensubtitles.org/favicon.ico',
  879. search: 'http://www.opensubtitles.com/es/search2/sublanguageid-spa/moviename-%searchvo',
  880. method: methodEncode,
  881. type: _TSUB
  882. },
  883. subdivx : { name: 'SubDivX',
  884. icon: 'http://www.subdivx.com/favicon.ico',
  885. search: 'http://www.subdivx.com/index.php?buscar=%searchvo&accion=5&subtitulos=1&realiza_b=1',
  886. method: methodEscape,
  887. type: _TSUB
  888. },
  889. titles : { name: 'titles.box.sk',
  890. icon: 'data:image/gif;base64,R0lGODlhEAAQAKEAAAAAAIfb9a7b9QAAACH5BAEKAAMALAAAAAAQABAAAAJOhI95wu18RJi0TmFEUCgIIwTcEQiGEBiTMRmBYAiBMRmTEQiGYBmWYHgEDIGH4REwBB4Gx8QwcRgcAUTAYXAEEAGHwWEJOA6PsmCEBhQAADs%3D',
  891. search: 'http://titles.box.sk/index.php?z3=%searchvo&rad1=an&aka=1&alt=1&jaz=9&z=datum+desc&days=0&pid=subt2&p=as&cas=1215777572&bt1=ADVANCED+SEARCH',
  892. method: methodEscape,
  893. type: _TSUB
  894. },
  895. daleya: {name: 'DaleYA',
  896. icon: 'http://www.daleya.com/Images/icons/cur.gif',
  897. search: 'http://www.daleya.com/?query=%searchvo{OPTIONS}',
  898. method:methodEscape,
  899. type: _TDOWN,
  900. options: {1:{name:'Megaupload',text:'megaupload.com'},
  901. 2:{name:'Badongo',text:'badongo.com'},
  902. 3:{name:'Rapidshare',text:'rapidshare.com'},
  903. 4:{name:'Mediafire',text:'mediafire.com'},
  904. 5:{name:'Gigasize',text:'gigasize.com'},
  905. 6:{name:'SeriesYonkis',text:'seriesyonkis.com'},
  906. 7:{name:'FileFactory',text:'filefactory.com'},
  907. 8:{name:'FileFront',text:'filefront.com'},
  908. 9:{name:'PeliculasYonkis',text:'peliculasyonkis.com'},
  909. 10:{name:'TurboUpload',text:'turboupload.com'},
  910. 11:{name:'Multiply',text:'multiply.com'},
  911. 12:{name:'SendSpace',text:'sendspace.com'}
  912. } ,
  913. getOptions:function() {
  914. var tmp = "";
  915. for (opt in this.options) {
  916. var option = this.options[opt];
  917. if (getPreference(this.name + ".opt." + option.name, true)) {
  918. tmp += "&daleyaid[]=" + opt;
  919. }
  920. }
  921. return tmp;
  922. }
  923. }
  924. };
  925. function $id(v) {
  926. return(d.getElementById(v));
  927. }
  928. /*
  929. getElementsByClassName
  930. Written by Jonathan Snook, http://www.snook.ca/jonathan
  931. Add-ons by Robert Nyman, http://www.robertnyman.com
  932. */
  933. function getElementsByClassName(oElm, strTagName, strClassName) {
  934. var arrElements = (strTagName == "*" && oElm.all) ? oElm.all : oElm.getElementsByTagName(strTagName);
  935. var arrReturnElements = new Array();
  936. strClassName = strClassName.replace(/\-/g, "\\-");
  937. var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
  938. var oElement;
  939. for (var i = 0; i < arrElements.length; i++) {
  940. oElement = arrElements[i];
  941. if (oRegExp.test(oElement.className)) {
  942. arrReturnElements.push(oElement);
  943. }
  944. }
  945. return (arrReturnElements);
  946. }
  947. function formatDate(fDate) {
  948. if (typeof fDate != 'undefined') {
  949. var yyyy = fDate.getFullYear();
  950. var m = fDate.getMonth() + 1;
  951. var d = fDate.getDate();
  952. var h = fDate.getHours();
  953. var n = fDate.getMinutes();
  954. var nn = n < 10 ? "0" + n : n;
  955. var s = fDate.getSeconds();
  956. var ss = s < 10 ? "0" + s : s;
  957. return d + "/" + m + "/" + yyyy + " a las " + h + ":" + nn + ":" + ss;
  958. } else {
  959. return "";
  960. }
  961. }
  962. function deFormatDate(cadena) {
  963. var date = new Date();
  964. var dia = cadena.split('/')[0];
  965. var mes = cadena.split('/')[1];
  966. var anio = cadena.split('/')[2].split(" ")[0];
  967. var hora = cadena.split(' ')[3].split(":")[0];
  968. var minuto = cadena.split(':')[1];
  969. var segundo = cadena.split(':')[2];
  970. date.setFullYear(anio, mes - 1, dia);
  971. date.setHours(hora, minuto, segundo, 0);
  972. return date;
  973. }
  974. function inArray(a, property, value) {
  975. if (property != "") property = "." + property;
  976. for (var ix in a) {
  977. var v = eval('a[' + ix + ']' + property);
  978. if (typeof v != "undefined") {
  979. if (v == value) return ix;
  980. }
  981. }
  982. return false;
  983. }
  984. function inArray2(a, property, value, p2, value2) {
  985. if (property != "") property = "." + property;
  986. if (p2 != "") p2 = "." + p2;
  987. for (var ix in a) {
  988. var v = eval('a[' + ix + ']' + property);
  989. var v2 = eval('a[' + ix + ']' + p2);
  990. if (typeof v != "undefined") {
  991. if (v == value && value2 == v2) return ix;
  992. }
  993. }
  994. return false;
  995. }
  996. function arrayReplace(a, property, obj) {
  997. for (var ix in a) {
  998. var v = eval('a[' + ix + '].' + property);
  999. var value = eval("obj." + property);
  1000. if (typeof v != "undefined") {
  1001. if (v == value) {
  1002. a[ix] = obj;
  1003. }
  1004. }
  1005. }
  1006. return a;
  1007. }
  1008. function findNodes(context, xpath) {
  1009. return d.evaluate(xpath, context, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null);
  1010. }
  1011. function findNodesArray(context, xpath) {
  1012. var nodes = [];
  1013. var node;
  1014. var iterator = findNodes(context, xpath);
  1015. while ((node = iterator.iterateNext()) != null) {
  1016. nodes.push(node);
  1017. }
  1018. return nodes;
  1019. }
  1020. function replaceAll( text, busca, reemplaza ){
  1021. while (text.toString().indexOf(busca) != -1)
  1022. text = text.toString().replace(busca,reemplaza);
  1023. return text;
  1024. }
  1025.  
  1026. function doPost(url, data, cb) {
  1027. GM_xmlhttpRequest({
  1028. method: "POST",
  1029. url: url,
  1030. headers:{'Content-type':'application/x-www-form-urlencoded'},
  1031. data:encodeURI(data),
  1032. onload: function(xhr) {
  1033. cb(xhr.responseText);
  1034. },
  1035. onerror: function (details) {
  1036. log("Error en el Post");
  1037. log(" Status: " + details.status);
  1038. log(" Status Text: " + details.statusText);
  1039. log(" Response headers: " + details.responseHeaders);
  1040. log(" Response Text: " + details.responseText);
  1041. }
  1042. });
  1043. }
  1044. function doGet(url, cb) {
  1045. GM_xmlhttpRequest({
  1046. method: "GET",
  1047. url: url,
  1048. onload: function(xhr) {
  1049. cb(xhr.responseText);
  1050. }
  1051. });
  1052. }
  1053. function log(msg) {
  1054. debuglog += '<br/>' + msg;
  1055. // Si tenemos Firebug -->
  1056. // if(unsafeWindow.console){
  1057. // unsafeWindow.console.log(msg);
  1058. // } else {
  1059. console.log(msg);
  1060. // }
  1061. }
  1062. function setPreference(name, value) {
  1063. GM_setValue(userId + '.cfg.' + name, value);
  1064. }
  1065. function getPreference(name, def) {
  1066. def = (typeof def == "undefined") ? false : def;
  1067. var r = GM_getValue(userId + '.cfg.' + name);
  1068. return (typeof r == "undefined") ? def : r;
  1069. }
  1070. function getValues(start) {
  1071. var result = new Array();
  1072. var values = GM_listValues();
  1073. for (ix in values) {
  1074. var name = values[ix];
  1075. if (name.indexOf(start) == 0) {
  1076. result.push(name.substr(start.length));
  1077. }
  1078. }
  1079. return result;
  1080. }
  1081. function deleteValues(start) {
  1082. var values = GM_listValues();
  1083. for (var ix in values) {
  1084. var name = values[ix];
  1085. if (name.indexOf(start) == 0) {
  1086. GM_deleteValue(name);
  1087. }
  1088. }
  1089. }
  1090. function showLog() {
  1091. GM_addStyle('#backgroundLayer { width: 100%; height: 100%; background-color: black; position: fixed; left: 0; right: 0; top: 0; bottom: 0; opacity: .7; }');
  1092. GM_addStyle('#board { color: black; background-color: #def; text-align: left; border: 4px solid gray; width: 50%; height: 70%; opacity: 1; margin: auto; position: fixed; left: 0; right: 0; top: 0; bottom: 0; overflow: auto; }');
  1093. var background = d.createElement('DIV');
  1094. background.id = 'backgroundLayer';
  1095. var board = d.createElement('div');
  1096. board.id = 'board';
  1097. board.innerHTML = '<code>' + debuglog + '</code>';
  1098. d.body.appendChild(background);
  1099. d.body.appendChild(board);
  1100. $id("backgroundLayer").addEventListener("click", hideLog, true);
  1101. }
  1102. function hideLog() {
  1103. d.body.removeChild($id('board'));
  1104. d.body.removeChild($id('backgroundLayer'));
  1105. }
  1106. function showBAFTA(){
  1107. var anio = prompt('Año (1948-2013)');
  1108. var aux = parseInt(anio);
  1109. if(aux > 1947 && aux < 2014)
  1110. location.href = "http://www.filmaffinity.com/es/awards.php?award_id=bafta&year=" + aux;
  1111. }
  1112. function showBerlin(){
  1113. var anio = prompt('Año (1951-2013)');
  1114. var aux = parseInt(anio);
  1115. if(aux > 1950 && aux < 2014)
  1116. location.href = "http://www.filmaffinity.com/es/awards.php?award_id=berlin&year=" + aux;
  1117. }
  1118. function showCannes(){
  1119. var anio = prompt('Año (1939-2013)');
  1120. var aux = parseInt(anio);
  1121. if(aux > 1945 && aux < 2014 && aux != 1948 && aux != 1950 && aux != 1968 || aux == 1939)
  1122. location.href = "http://www.filmaffinity.com/es/awards.php?award_id=cannes&year=" + aux;
  1123. }
  1124. function showCineEuropeo(){
  1125. var anio = prompt('Año (1988-2012)');
  1126. var aux = parseInt(anio);
  1127. if(aux > 1987 && aux < 2013)
  1128. location.href = "http://www.filmaffinity.com/es/awards.php?award_id=european&year=" + aux;
  1129. }
  1130. function showGijon(){
  1131. var anio = prompt('Año (1994-2012)');
  1132. var aux = parseInt(anio);
  1133. if(aux > 1993 && aux < 2013)
  1134. location.href = "http://www.filmaffinity.com/es/awards.php?award_id=gijon&year=" + aux;
  1135. }
  1136. function showEmmy(){
  1137. var anio = prompt('Año (1949-2013)');
  1138. var aux = parseInt(anio);
  1139. if(aux > 1948 && aux < 2014)
  1140. location.href = "http://www.filmaffinity.com/es/awards.php?award_id=emmy&year=" + aux;
  1141. }
  1142. function showGoldenGlobe(){
  1143. var anio = prompt('Año (1944-2013)');
  1144. var aux = parseInt(anio);
  1145. if(aux > 1943 && aux < 2014)
  1146. location.href = "http://www.filmaffinity.com/es/awards.php?award_id=goldenglobes&year=" + aux;
  1147. }
  1148. function showGoya(){
  1149. var anio = prompt('Año (1987-2013)');
  1150. var aux = parseInt(anio);
  1151. if(aux > 1986 && aux < 2014)
  1152. location.href = "http://www.filmaffinity.com/es/awards.php?award_id=goya&year=" + aux;
  1153. }
  1154. function showMalaga(){
  1155. var anio = prompt('Año (1998-2013)');
  1156. var aux = parseInt(anio);
  1157. if(aux > 1997 && aux < 2014)
  1158. location.href = "http://www.filmaffinity.com/es/awards.php?award_id=malaga&year=" + aux;
  1159. }
  1160. function showRazzie(){
  1161. var anio = prompt('Año (1981-2013)');
  1162. var aux = parseInt(anio);
  1163. if(aux > 1980 && aux < 2014)
  1164. location.href = "http://www.filmaffinity.com/es/awards.php?award_id=razzie&year=" + aux;
  1165. }
  1166. function showSevilla(){
  1167. var anio = prompt('Año (2004-2012)');
  1168. var aux = parseInt(anio);
  1169. if(aux > 2003 && aux < 2013)
  1170. location.href = "http://www.filmaffinity.com/es/awards.php?award_id=sevilla&year=" + aux;
  1171. }
  1172. function showSS(){
  1173. var anio = prompt('Año (1953-2012)');
  1174. var aux = parseInt(anio);
  1175. if(aux > 1952 && aux < 2013)
  1176. location.href = "http://www.filmaffinity.com/es/awards.php?award_id=ss&year=" + aux;
  1177. }
  1178. function showSitges(){
  1179. var anio = prompt('Año (1971-2013)');
  1180. var aux = parseInt(anio);
  1181. if(aux > 1970 && aux < 2014)
  1182. location.href = "http://www.filmaffinity.com/es/awards.php?award_id=sitges&year=" + aux;
  1183. }
  1184. function showSpirit(){
  1185. var anio = prompt('Año (1986-2013)');
  1186. var aux = parseInt(anio);
  1187. if(aux > 1985 && aux < 2014)
  1188. location.href = "http://www.filmaffinity.com/es/awards.php?award_id=spirit&year=" + aux;
  1189. }
  1190. function showSundance(){
  1191. var anio = prompt('Año (1985-2013)');
  1192. var aux = parseInt(anio);
  1193. if(aux > 1984 && aux < 2014)
  1194. location.href = "http://www.filmaffinity.com/es/awards.php?award_id=sundance&year=" + aux;
  1195. }
  1196. function showTribeca(){
  1197. var anio = prompt('Año (2002-2013)');
  1198. var aux = parseInt(anio);
  1199. if(aux > 2001 && aux < 2014)
  1200. location.href = "http://www.filmaffinity.com/es/awards.php?award_id=tribeca&year=" + aux;
  1201. }
  1202. function showValladolid(){
  1203. var anio = prompt('Año (1960-2012)');
  1204. var aux = parseInt(anio);
  1205. if(aux > 1959 && aux < 2013)
  1206. location.href = "http://www.filmaffinity.com/es/awards.php?award_id=seminci&year=" + aux;
  1207. }
  1208. function showVenecia(){
  1209. var anio = prompt('Año (1947-2012)');
  1210. var aux = parseInt(anio);
  1211. if(aux > 1946 && aux < 2013)
  1212. location.href = "http://www.filmaffinity.com/es/awards.php?award_id=venice&year=" + aux;
  1213. }
  1214. function goToHomepage() {
  1215. location.href = homepage;
  1216. }
  1217. function isFlagImg(img) {
  1218. return img.src.search(/\/countries\//ig) > -1;
  1219. }
  1220. function inSection(section) {
  1221. return url.search(eval(sections[section])) > -1;
  1222. }
  1223. function inSections(s) {
  1224. var value = false;
  1225. var i = 0;
  1226. while (!value && i < s.length) {
  1227. value = url.search(eval(sections[s[i]])) > -1;
  1228. i++;
  1229. }
  1230. return value;
  1231. }
  1232. /* Paises / contienentes
  1233. Sacado de http://en.wikipedia.org/wiki/List_of_countries_by_continent_(data_file)
  1234. */
  1235. var continents = {
  1236. "América del Norte":["AI","AG","AW","BS","BB","BZ","BM","VG","CA","KY","CR","CU","DM","DO","SV","GL","GD","GP","GT","HT","HN","JM","MQ","MX","MS","AN","NI","PA","PR","BL","KN","LC","MF","PM","VC","TT","TC","US","VI"],
  1237. Europa:["ZX","LE","RR","ZY","YU","AX","AL","AD","AT","BY","BE","BA","BG","HR","CZ","DK","EE","FO","FI","FD","FF","FR","DE","GI","GR","GG","VA","HU","IS","IE","IM","IT","JE","LV","LI","LT","LU","MK","MT","MD","MC","ME","NL","NO","PL","PT","RO","RU","SM","RS","SK","SI","ES","SJ","SE","CH","UA","GB"],
  1238. "América del Sur":["AR","BO","BR","CL","CO","EC","FK","GF","GY","PY","PE","SR","UY","VE"],
  1239. Oceanía:["AS","AU","CK","FJ","PF","GU","KI","MH","FM","NR","NC","NZ","NU","NF","MP","PW","PG","PN","WS","SB","TK","TO","TV","UM","VU","WF"],
  1240. Asia:["AF","AM","AZ","BH","BD","BT","IO","BN","KH","CN","CX","CC","CY","GE","HK","IN","ID","IR","IQ","IL","JP","JO","KZ","KP","KR","KW","KG","LA","LB","MO","MY","MV","MN","MM","NP","OM","PK","PS","PH","QA","SA","SG","LK","SY","TW","TJ","TH","TL","TR","TM","AE","UZ","VN","YE"],
  1241. África:["DZ","AO","BJ","BW","BF","BI","CD","CM","CV","CF","TD","KM","CG","CI","DJ","EG","GQ","ER","ET","GA","GM","GH","GN","GW","KE","LS","LR","LY","MG","MW","ML","MR","MU","YT","MA","MZ","NA","NE","NG","RE","RW","SH","ST","SN","SC","SL","SO","ZA","SD","SZ","TZ","TG","TN","UG","EH","ZM","ZW"]
  1242. };
  1243. var distribuciones = {
  1244. "Lingüístico": {nombre: "Lingüístico",tipo:DIST_REGIONS,autor:"zopilote",descripcion:"", data :{
  1245. "Lenguas románicas":['BJ','CV','CI','GA','GW','GQ','GN','MU','ST','SC','BZ','CR','CU','SV','GT','HT','HN','MX','NI','PA','PR','DO','AR','BO','BR','CL','CO','EC','PY','PE','SR','UY','VE','AD','BE','ES','FR','IT','MD','MC','PT','RO','SM','CH'],
  1246. "Lenguas germánicas":['GH','LR','SL','ZA','AG','BS','BB','CA','US','US','GD','JM','TT','US','FD','FF','FD','FF','DE','AT','DK','NL','IE','IS','LI','NO','FD','GB','GB','FF','SE','AU','NZ'],
  1247. "Lenguas eslavas":['BA','BG','ZX','HR','SK','SI','MK','ME','PL','CZ','RU','RR','RS','UA','ZY','ZY','ZY','YU'],
  1248. "Lenguas urálicas":['EE','FI','HU'],
  1249. "Lenguas bálticas":['LE','LT'],
  1250. "Lenguas indo-iranias":['AF','BD','IN','IR','MV','NP','PK','LK','TJ'],
  1251. "Lenguas sino-tibetanas":['BT','CN','HK','MM','TW'],
  1252. "Lenguas austronesias":['BN','PH','ID','MY','FJ'],
  1253. "Lenguas tai-kadai":['KH','TH'],
  1254. "Lenguas altaicas":['AZ','KP','KR','JP','KZ','KG','MN','TM','TR','UZ'],
  1255. "Lenguas afroasiáticas":['DZ','TD','EG','ER','ET','LY','MA','MR','NE','SO','SD','TN','SA','BH','AE','IQ','IL','JO','KW','LB','OM','QA','SY','PS','YE'],
  1256. "Indefinida / Otras":['AO','BW','BF','BI','CM','KM','CG','GM','KE','LS','MG','MW','ML','MZ','NA','NG','CF','RW','SN','SZ','TZ','TG','UG','ZM','ZW','DM','GY','AM','CY','GE','LA','SG','VN','AL','GR','LU','MT','MH','FM','PW','PG','WS','VU']}
  1257. },
  1258. "Cultural - Euroasiaticocéntrico": {nombre: "Cultural - Euroasiaticocéntrico",tipo:DIST_REGIONS,autor:"VicenteJavier",descripcion:"", data :{
  1259. 'Europeo Latino':['AD','ES','FR','IT','MT','MC','PT','SM'],'Europeo Central':['FD','FF','FD','FF','DE','AT','BE','NL','HU','LI','LU','PL','FD','CZ','FF','CH'],'Europeo Nórdico':['DK','FI','IS','NO','SE'],'Europeo Soviético':['AM','AZ','GE','KZ','KG','TJ','TM','UZ','EE','LE','LT','MD','RU','UA','ZY','ZY','ZY'],'Europeo Balcánico':['CY','AL','BA','BG','ZX','HR','SK','SI','GR','MK','ME','RO','RR','RS','YU'],'Asiático Oeste':['AF','SA','BH','AE','IQ','IR','IL','JO','KW','LB','OM','QA','SY','PS','TR','YE'],'Asiático Indostánico':['BD','BT','IN','MV','NP','PK','LK'],'Asiático Chino':['CN','HK','MN','TW'],'Asiático Sudeste':['BN','KH','PH','ID','LA','MY','MM','SG','TH','VN'],'Asiático Japonés':['JP'],'Asiático Coreano':['KP','KR'],'Anglo-sajón Británico':['IE','GB','GB'],'Anglo-sajón Norteamericano':['AG','BS','BB','CA','DM','US','US','GD','HT','JM','PR','TT','US','SR'],'Anglo-sajón Oceánico':['AU','FJ','MH','FM','NZ','PW','PG','WS','VU'],'Latinoamericano':['BZ','CR','CU','SV','GT','HN','MX','NI','PA','DO','AR','BO','BR','CL','CO','EC','PY','PE','UY','VE'],'Africano':['AO','DZ','BJ','BW','BF','BI','CV','CM','TD','KM','CG','CI','EG','ER','ET','GA','GM','GH','GW','GQ','GN','KE','LS','LR','LY','MG','MW','ML','MA','MU','MR','MZ','NA','NE','NG','CF','RW','ST','SN','SC','SL','SO','SD','ZA','SZ','TZ','TG','TN','UG','ZM','ZW']
  1260. }},
  1261. "Continental Simplificado": {nombre: "Continental Simplificado",tipo:DIST_REGIONS,autor:"Multifolio",descripcion:"", data :{
  1262. 'África':['AO','DZ','BJ','BW','BF','BI','CV','CM','TD','KM','CG','CI','EG','ER','ET','GA','GM','GH','GW','GQ','GN','KE','LS','LR','LY','MG','MW','ML','MA','MU','MR','MZ','NA','NE','NG','CF','RW','ST','SN','SC','SL','SO','SD','ZA','SZ','TZ','TG','TN','UG','ZM','ZW'],'América':['AG','BS','BB','BZ','CA','CR','CU','DM','US','SV','US','GD','GT','HT','HN','JM','MX','NI','PA','PR','DO','TT','US','AR','BO','BR','CL','CO','EC','GY','PY','PE','SR','UY','VE'],'Asia':['AF','SA','AM','AZ','BH','BD','BN','BT','KH','CN','CY','KP','KR','AE','PH','GE','HK','IN','ID','IQ','IR','IL','JP','JO','KZ','KG','KW','LA','LB','MY','MV','MN','MM','NP','OM','PK','QA','SG','SY','LK','TH','TW','TJ','PS','TM','TR','UZ','VN','YE'],'Europa':['AL','FD','FF','FD','FF','DE','AD','AT','BE','BA','BG','ZX','HR','DK','SK','SI','ES','EE','FI','FR','GR','NL','HU','IE','IS','IT','LE','LI','LT','LU','MK','MT','MD','MC','ME','NO','PL','PT','FD','GB','GB','CZ','FF','RO','RU','SM','RR','RS','SE','CH','UA','ZY','ZY','ZY','YU'],'Oceanía':['AU','FJ','MH','FM','NZ','PW','PG','WS','VU']
  1263. }}
  1264. };
  1265. var genCodes = {
  1266. "Acción":"AC","Animación":"AN","Aventuras":"AV","Bélico":"BE","Ciencia ficción":"CF",
  1267. "Cine negro":"CN","Comedia":"CO","Desconocido":"DE","Documental":"DO","Drama":"DR",
  1268. "Fantástico":"FN","Infantil":"IF","Intriga":"IT","Musical":"MU","Romance":"RO","Serie de TV":"TV",
  1269. "Terror":"TE","Thriller":"TH","Western":"WE"
  1270. };
  1271. var anioCodes = {
  1272. "1900 - 1929":"A1","1930 - 1939":"A2","1940 - 1949":"A3","1950 - 1959":"A4","1960 - 1969":"A5",
  1273. "1970 - 1979":"A6","1980 - 1989":"A7","1990 - 1999":"A8","2000":"2A","2001":"2B","2002":"2C",
  1274. "2003":"2D","2004":"2E","2005":"2F","2006":"2G","2007":"2H","2008":"2I","2009":"2J","2010":"2K",
  1275. "2011":"2L","2012":"2M","2013":"2N","2014":"2P","2015":"2Q"
  1276. };
  1277. var countriesCodes = {
  1278. "Afganistán":"AF","Albania":"AL","Alemania del Este (RDA)":"FD","Alemania del Oeste (RFA)":"FF",
  1279. "Alemania del Este":"FD","Alemania del Oeste":"FF",
  1280. "Alemania":"DE","Andorra":"AD","Angola":"AO","Antigua y Barbuda":"AG","Arabia Saudí":"SA",
  1281. "Argelia":"DZ","Argentina":"AR","Armenia":"AM","Australia":"AU","Austria":"AT","Azerbaijan":"AZ",
  1282. "Bahamas":"BS","Bahrein":"BH","Bangladesh":"BD","Barbados":"BB","Bélgica":"BE","Belize":"BZ",
  1283. "Benín":"BJ","Bielorusia":"BY","Bolivia":"BO","Bosnia y Herzegovina":"BA","Botswana":"BW","Brasil":"BR",
  1284. "Brunei":"BN","Bulgaria":"BG","Burkina Faso":"BF","Burundi":"BI","Bután":"BT","Cabo Verde":"CV",
  1285. "Camboya":"KH","Camerún":"CM","Canadá":"CA","Chad":"TD","Checoslovaquia":"ZX","Chile":"CL",
  1286. "China":"CN","Chipre":"CY","Colombia":"CO","Comores":"KM","Congo":"CG","Corea del Norte":"KP",
  1287. "Corea del Sur":"KR","Costa de Marfil":"CI","Costa Rica":"CR","Croacia":"HR","Cuba":"CU","Dinamarca":"DK",
  1288. "Dominica":"DM","Ecuador":"EC","EEUU":"US","Egipto":"EG","El Salvador":"SV","Emiratos Árabes":"AE",
  1289. "Eritrea":"ER","Eslovaquia":"SK","Eslovenia":"SI","España":"ES","Estados Unidos":"US","Estonia":"EE",
  1290. "Etiopía":"ET","Fidji":"FJ","Filipinas":"PH","Finlandia":"FI","Francia":"FR","Gabón":"GA",
  1291. "Gambia":"GM","Georgia":"GE","Ghana":"GH","Granada":"GD","Grecia":"GR","Groenlandia":"GL", "Guatemala":"GT",
  1292. "Guinea Bissau":"GW","Guinea Ecuatorial":"GQ","Guinea":"GN","Guyana":"GY","Haití":"HT","Países Bajos (Holanda)":"NL",
  1293. "Honduras":"HN","Hong Kong":"HK","Hungría":"HU","India":"IN","Indonesia":"ID","Irak":"IQ","Irán":"IR",
  1294. "Irlanda":"IE","Islandia":"IS","Israel":"IL","Italia":"IT","Jamaica":"JM","Japón":"JP","Jordania":"JO",
  1295. "Kazajstán":"KZ","Kenia":"KE","Kirguizstán":"KG","Kuwait":"KW","Laos":"LA","Lesotho":"LS",
  1296. "Letonia":"LE","Líbano":"LB","Liberia":"LR","Libia":"LY","Liechtenstein":"LI","Lituania":"LT",
  1297. "Luxemburgo":"LU","Macedonia":"MK","Madagascar":"MG","Malasia":"MY","Malawi":"MW",
  1298. "Maldivas":"MV","Mali":"ML","Malta":"MT","Marruecos":"MA","Marshall (Islas)":"MH","Mauricio (Isla)":"MU",
  1299. "Mauritania":"MR","México":"MX","Micronesia":"FM","Moldavia":"MD","Mónaco":"MC",
  1300. "Mongolia":"MN","Montenegro":"ME","Mozambique":"MZ","Myanmar - Birmania":"MM","Namibia":"NA",
  1301. "Nepal":"NP","Nicaragua":"NI","Níger":"NE","Nigeria":"NG","Noruega":"NO","Nueva Zelanda":"NZ",
  1302. "Omán":"OM","Palau":"PW","Panamá":"PA","Papuasia Nueva Guinea":"PG","Paquistán":"PK","Paraguay":"PY",
  1303. "Perú":"PE","Polonia":"PL","Portugal":"PT","Puerto Rico":"PR","Qatar":"QA","RDA":"FD",
  1304. "Reino Unido":"GB","GB":"GB","Rep. Centroafricana":"CF","Rep. Dominicana":"DO","República Checa":"CZ","República del Congo":"CD","RFA":"FF",
  1305. "Ruanda":"RW","Rumanía":"RO","Rusia":"RU","Samoa":"WS","San Marino":"SM","Santo Tomé y Príncipe":"ST",
  1306. "Senegal":"SN","Serbia y Montenegro":"RR","Serbia":"RS","Seychelles":"SC","Sierra Leona":"SL","Singapur":"SG",
  1307. "Siria":"SY","Somalia":"SO","Sri Lanka":"LK","Sudán":"SD","Suecia":"SE","Suiza":"CH","Sudáfrica":"ZA",
  1308. "Surinam":"SR","Swazilandia":"SZ","Tailandia":"TH","Taiwán":"TW","Tajikistan":"TJ","Tanzania":"TZ",
  1309. "Palestina":"PS","Togo":"TG","Trinidad y Tobago":"TT","Túnez":"TN","Turkmenistán":"TM","Turquía":"TR",
  1310. "Ucrania":"UA","Uganda":"UG","Unión Soviética (URSS)":"ZY","Unión Soviética":"ZY","URSS":"ZY","Uruguay":"UY",
  1311. "USA":"US","Uzbekistan":"UZ","Vanuatú":"VU","Venezuela":"VE","Vietnam":"VN","Yemen":"YE",
  1312. "Yugoslavia":"YU","Zambia":"ZM","Zimbabwe":"ZW"
  1313. };
  1314. var countriesSpanish = {
  1315. "Argentina":"AR","Bolivia":"BO","Chile":"CL","Colombia":"CO"
  1316. ,"Costa Rica":"CR","Cuba":"CU","Ecuador":"EC","El Salvador":"SV"
  1317. ,"España":"ES","Guatemala":"GT","Guinea Ecuatorial":"GQ","Honduras":"HN"
  1318. ,"México":"MX","Nicaragua":"NI","Panamá":"PA","Paraguay":"PY",
  1319. "Perú":"PE","Puerto Rico":"PR","Rep. Dominicana":"DO","Venezuela":"VE"
  1320. };
  1321. function getCountryCode(country) {
  1322. return countriesCodes[country];
  1323. }
  1324. function getGenCode(genre) {
  1325. return genCodes[genre];
  1326. }
  1327. function getAnioCode(anio) {
  1328. return anioCodes[anio];
  1329. }
  1330. function getContinent(countryCode) {
  1331. for (var continent in continents) {
  1332. if (inArray(continents[continent], '', countryCode)) return continent;
  1333. }
  1334. return 'NA';
  1335. }
  1336. function getRegion(distribucion, countryCode) {
  1337. var dist = distribuciones[distribucion].data;
  1338. for (var region in dist) {
  1339. if (inArray(dist[region], '', countryCode)) return region;
  1340. }
  1341. return 'NA';
  1342. }
  1343. // ************************ PREFERENCIAS *********************************************
  1344. function preferences() {
  1345. function showPreferences() {
  1346. log("Mostrar preferencias");
  1347. GM_addStyle('#backgroundLayer { width: 100%; height: 100%; background-color: black; position: fixed; left: 0; right: 0; top: 0; bottom: 0; opacity: .7; }');
  1348. GM_addStyle('#fap_prefs { color: black; background-color: #def; text-align: center; border: 4px solid gray; width: 70%; height: 90%; opacity: 1; margin: auto; position: fixed; left: 0; right: 0; top: 0; bottom: 0; overflow: auto; }');
  1349. GM_addStyle('#fap_prefs>#closeButton { width: 22px; height: 22px; margin: 0; padding: 0; position: absolute; right: 0; top: 0; background-image: url(' + closeimg + '); opacity: .5; }');
  1350. GM_addStyle('#fap_prefs>#closeButton:hover { opacity: 1; }');
  1351. GM_addStyle('#fap_prefs>h1 { font-size: x-large; }');
  1352. GM_addStyle('#fap_prefs>h2 { font-size: large; font-style: italic; }');
  1353. GM_addStyle('#fap_prefs>table { border: 1; margin-left: auto; margin-right: auto; }');
  1354. GM_addStyle('#fap_prefs>table>caption { border: 1; margin-left: auto; margin-right: auto; }');
  1355. GM_addStyle('#fap_prefs>button { margin: 2em; }');
  1356. GM_addStyle('#fap_prefs img { width: 16px; height: 16px; }');
  1357. GM_addStyle('#fap_prefs th { background-color: black; color: white; font-style: italic; }');
  1358. GM_addStyle('#fap_prefs>table { border: 1px solid black; }');
  1359. GM_addStyle('#fap_prefs td.sites { border: 1px solid black; }');
  1360. GM_addStyle('#fap_prefs label:hover { text-decoration: none; }');
  1361. GM_addStyle('#fap_prefs .puntuacion { width: 300px; margin-left: auto; margin-right: auto; }');
  1362. GM_addStyle('#fap_prefs legend { font-weight: bold; }');
  1363. GM_addStyle('#fap_prefs .regreq { font-weight: bold; color: red }');
  1364. GM_addStyle('#fap_prefs .viewSuboptions {margin-left:4px;cursor:pointer;width:9px;height:9px;}');
  1365. GM_addStyle('#fap_prefs .subOptions {background-color:#eef;display:none;border:1px solid black;margin-left:10%;font-size:90%;}');
  1366. var background = d.createElement('DIV');
  1367. background.id = 'backgroundLayer';
  1368. d.body.appendChild(background);
  1369. var prefs = d.createElement('DIV');
  1370. var iconTemplate = '<img src="{ICON}" alt="icono de {NAME}" title="{TITLE}"/>';
  1371. var linkTemplate = '<label title="{TITLE}"><input type="checkbox" name="{NAME}" checked></input>{ICON}&nbsp;{NAME}{REGISTRO}</label>{OPTIONS}</br>';
  1372. var subOptionTemplate = '<label title="{NAME}"><input type="checkbox" name="{NAME}" checked></input>{TEXT}</label><br/>';
  1373. var optTemplate = '<tr><td colspan=4><label><input type="checkbox" name="{NAME}" {CHECKED}>{TEXT}</label></td></tr>';
  1374. prefs.id = 'fap_prefs';
  1375. var tmp = '<div id="closeButton" title="Cierra el panel de configuraci&oacute;n"></div>';
  1376. tmp += '<h2>Panel de configuraci&oacute;n ' + appName + ' versi&oacute;n ' + appVersion + '</h2>';
  1377. tmp += '<table>';
  1378. tmp += '<thead><tr>';
  1379. tmp += '<th><label><input type="checkbox" name="verCine" checked>Cine</label></th>';
  1380. tmp += '<th><label><input type="checkbox" name="verGeneral" checked>General</label></th>';
  1381. tmp += '<th><label><input type="checkbox" name="verDescargas" checked>Descargas</label></th>';
  1382. tmp += '<th><label><input type="checkbox" name="verSubtitulos" checked>Subtitulos</label></th>';
  1383. tmp += '</thead><tbody><tr valign="top">';
  1384. var types = [_TFILM, _TGEN, _TDOWN, _TSUB];
  1385. for (var t in types) {
  1386. tmp += '<td class="sites">';
  1387. for (var i in linkSites) {
  1388. if (linkSites[i].type == types[t]) {
  1389. var name = linkSites[i].name;
  1390. var title = name;
  1391. if (linkSites[i].regreq) title += ' (requiere registro)';
  1392. var text = linkTemplate.replace(/{ICON}/g, iconTemplate);
  1393. text = text.replace(/{ICON}/g, linkSites[i].icon).replace(/{NAME}/g, name);
  1394. text = text.replace(/{TITLE}/g, (linkSites[i].regreq) ? name + ' (requiere registro' : name);
  1395. text = text.replace(/{REGISTRO}/g, (linkSites[i].regreq) ? ' <span class="regreq">(*)</span>' : '');
  1396. if (linkSites[i].search.indexOf("{OPTIONS}") > -1) {
  1397. var htmlOptions = '<img src=' + img_plus + ' id= "' + name + '" class="viewSuboptions"><div class="subOptions" id="subOptions' + name + '" style="display:none;">';
  1398. for (var j in linkSites[i].options) {
  1399. var option = linkSites[i].options[j];
  1400. htmlOptions += subOptionTemplate.replace(/{NAME}/g, name + ".opt." + option.name).replace(/{TEXT}/g, option.text);
  1401. }
  1402. text = text.replace(/{OPTIONS}/g, htmlOptions + '</div>');
  1403. } else {
  1404. text = text.replace(/{OPTIONS}/g, "");
  1405. }
  1406. tmp += text;
  1407. }
  1408. }
  1409. tmp += '</td>';
  1410. }
  1411. tmp += '</tr>';
  1412. tmp += optTemplate.replace(/{NAME}/g, 'newwindow').replace(/{TEXT}/g, 'Abrir enlaces en una nueva pestaña');
  1413. tmp += '<tr><td colspan=4>Los sitios marcados con <span class="regreq">(*)</span> requieren registro.</td></tr>';
  1414. tmp += '<tr><td colspan="4"><fieldset><legend>Posici&oacute;n de los enlaces a webs externas</legend>';
  1415. tmp += '<label><input type="radio" name="linksPosition" value="default">Integrados en la ficha de la pelicula</input></label>&nbsp;&nbsp;&nbsp;';
  1416. tmp += '<label><input type="radio" name="linksPosition" value="inTitle">En el título de la pelicula</input></label>';
  1417. //tmp += '<label><input type="radio" name="linksPosition" value="inPanel">Panel derecho, debajo de la puntuaci&oacute;n</input></label>';
  1418. tmp += '</fieldset><hr></td></tr>';
  1419. //Obtener Id propia
  1420. var idfinal = getPreference('idinput', 000000);
  1421. tmp += '<tr><td colspan=4><label>Introduce tu ID de usuario: <input type="text" size ="7" value="' + idfinal + '" name="idinput"></label></td></tr>';
  1422. tmp += '<tr height="18"><td align="center" bgcolor="#008000" colspan="4"><font color="#ffffff">Opciones de Menús</font></td></tr>';
  1423. // Nuevas preferencias
  1424. for (pref in preferencesOptions) {
  1425. if(pref == 3)
  1426. tmp += '<tr height="18"><td align="center" bgcolor="#008000" colspan="4"><font color="#ffffff">Opciones de Listas</font></td></tr>';
  1427. if(pref == 8){
  1428. var idltemp = getPreference('idltemp', 0000);
  1429. tmp += '<tr><td colspan=4><label>Introduce la ID de tu lista auxiliar: <input type="text" size ="7" value="' + idltemp + '" name="idltemp"></label></td></tr>';
  1430. tmp += '<tr height="18"><td align="center" bgcolor="#008000" colspan="4"><font color="#ffffff">Opciones de Mis Datos</font></td></tr>';
  1431. }
  1432. if(pref == 10){
  1433. var nusuarios = getPreference('nusers', 20);
  1434. tmp += '<tr><td colspan=4><label>Número de usuarios a mostrar en Clasificaciones: (10-150) <input type="text" size ="5" value="' + nusuarios + '" name="nusers"></label></td></tr>';
  1435. }
  1436. if(pref == 13){
  1437. tmp += '<tr height="18"><td align="center" bgcolor="#008000" colspan="4"><font color="#ffffff">Opciones de Mis amigos</font></td></tr>';
  1438. //var ret_tiempo = getPreference('retardoamigos', 750);
  1439. //tmp += '<tr><td colspan=4><label>Retardo al mostrar amigos (mínimo 200 ms): <input type="text" size ="5" value="' + ret_tiempo + '" name="retardoamigos"> ms.</label></td></tr>';
  1440. tmp += optTemplate.replace(/{NAME}/g, 'abriramigos').replace(/{TEXT}/g, 'Abrir votaciones/críticas/listas de amigos en una nueva pestaña');
  1441. tmp += '<tr height="18"><td align="center" bgcolor="#008000" colspan="4"><font color="#ffffff">Otras opciones</font></td></tr>';
  1442. }
  1443. t = optTemplate.replace(/{NAME}/g, preferencesOptions[pref].name).replace(/{TEXT}/g, preferencesOptions[pref].text);
  1444. tmp += t.replace(/{CHECKED}/g, preferencesOptions[pref].def ? 'checked' : '');
  1445. }
  1446. // Limite en recomendaciones y TOPs
  1447. var limite = getPreference('limit', 20);
  1448. tmp += '<tr><td colspan=4><label>N&deg; de pel&iacute;culas a mostrar en Recomendaciones y TOP: <input type="text" size ="5" value="' + limite + '" name="limit"></label></td></tr>';
  1449. tmp += '</tbody></table>';
  1450. tmp += '<br/><fieldset class="puntuacion"><legend>Estilo de las puntuaciones</legend><div style="text-align: left"><label><input type="radio" name="ratingStyle" value="default" >Estilo por defecto</input></label><br/>';
  1451. for (t in ratingStyles) {
  1452. tmp += '<label><input type="radio" name="ratingStyle" value="' + ratingStyles[t].code + '">' + ratingStyles[t].name + ': <img src="' + ratingStyles[t].iconOn + '"><img src="' + ratingStyles[t].iconOn + '"><img src="' + ratingStyles[t].iconOn + '"><img src="' + ratingStyles[t].iconHalf + '"><img src="' + ratingStyles[t].iconOff + '"><img src="' + ratingStyles[t].iconOff + '"></input></label><br/>';
  1453. }
  1454. tmp += '</div></fieldset>';
  1455. tmp += '<button id="saveButton" title="Guarda las preferencias y cierra el panel de configuraci&oacute;n">Guardar preferencias</button>';
  1456. prefs.innerHTML += tmp;
  1457. d.body.appendChild(prefs);
  1458. $id("saveButton").addEventListener("click", savePreferences, true);
  1459. $id("closeButton").addEventListener("click", hidePreferences, true);
  1460. $id("backgroundLayer").addEventListener("click", hidePreferences, true);
  1461. loadPreferences();
  1462. setSubOptionsEvents();
  1463. log("-mostradas preferencias");
  1464. }
  1465. function showSubOptionPanel() {
  1466. var element = $id("subOptions" + this.id);
  1467. if (element.style.display != 'none') {
  1468. element.style.display = "none";
  1469. this.src = img_plus;
  1470. } else {
  1471. element.style.display = "block";
  1472. this.src = img_minus;
  1473. }
  1474. }
  1475. function setSubOptionsEvents() {
  1476. var imagenes = getElementsByClassName(d, "img", "viewSuboptions");
  1477. for (i in imagenes) {
  1478. var img = imagenes[i];
  1479. img.addEventListener("click", showSubOptionPanel, false);
  1480. }
  1481. }
  1482. // Por ahora solo los radio, preparar para todos
  1483. function loadPreferences() {
  1484. var xpath = 'id("fap_prefs")//input';
  1485. var nodo;
  1486. var iterator = findNodes(d, xpath);
  1487. while ((nodo = iterator.iterateNext()) != null) {
  1488. var valor = getPreference(nodo.name, "undefined");
  1489. switch (nodo.type) {
  1490. case "checkbox":nodo.checked = (valor != "undefined") ? valor : nodo.checked; break;
  1491. //case "text":nodo.value = (valor != "undefined") ? valor : "";break;
  1492. case "radio":nodo.checked = (valor != "undefined") ? (nodo.value == valor) : (nodo.value == "default");break;
  1493. }
  1494. }
  1495. }
  1496. function savePreferences() {
  1497. var xpath = 'id("fap_prefs")//input';
  1498. var iterator = findNodes(d, xpath);
  1499. var nodo = null;
  1500. while (nodo = iterator.iterateNext()) {
  1501. switch (nodo.type) {
  1502. case "checkbox":setPreference(nodo.name, nodo.checked);break;
  1503. case "text":setPreference(nodo.name, nodo.value);break;
  1504. case "radio":if (nodo.checked) {
  1505. setPreference(nodo.name, nodo.value);
  1506. };break;
  1507. }
  1508. }
  1509. alert('Los cambios tendrán efecto al recargar la página.');
  1510. hidePreferences();
  1511. }
  1512. function hidePreferences() {
  1513. d.body.removeChild($id('fap_prefs'));
  1514. d.body.removeChild($id('backgroundLayer'));
  1515. }
  1516. showPreferences();
  1517. // ************************ FIN PREFERENCIAS *********************************************
  1518. }
  1519. // Coloca enlaces a las paginas de los amigos
  1520. function addFriendsLinks() {
  1521. var friendsTable = "//span[text()='Nombre/Nick']/ancestor::*[position()=4]".findNode();
  1522. var votesTpl = "<a class='lnk3' href='http://www.filmaffinity.com/es/userratings.php?user_id={ID}'>{VOTES}</a>";
  1523. var criticsTpl = "<a class='lnk3' href='http://www.filmaffinity.com/es/userreviews/1/{ID}.html?orderby=5'>{CRITICAS}</a>";
  1524. for (var i = 1; i < friendsTable.rows.length - 1; i++) {
  1525. var fiendId = friendsTable.rows[i].cells[0].firstChild.href.split('=')[1];
  1526. var ratedfilms = friendsTable.rows[i].cells[3].textContent;
  1527. var criticas = friendsTable.rows[i].cells[4].textContent;
  1528. friendsTable.rows[i].cells[3].innerHTML = votesTpl.replace(/{ID}/g, fiendId).replace(/{VOTES}/g, ratedfilms);
  1529. if (parseInt(criticas.split('.').join('')) > 0) {
  1530. friendsTable.rows[i].cells[4].innerHTML = criticsTpl.replace(/{ID}/g, fiendId).replace(/{CRITICAS}/g, criticas);
  1531. }
  1532. }
  1533. }
  1534. // Comprueba los cambios en las puntuaciones de los amigos
  1535. function doFriendsRatingChange() {
  1536. var nodselect = "//select[@id='select-group']".findNode();
  1537. var nodcab = "//strong[text()='Votaciones']/ancestor::*[position()=2]".findNode();
  1538. retardo = 700;
  1539. nodcab.childNodes[1].style.marginRight = "15px";
  1540. nodcab.childNodes[3].style.marginRight = "14px";
  1541. nodcab.childNodes[5].style.marginRight = "9px";
  1542. nodcab.style.marginTop = "8px";
  1543. nodselect.onchange = function(){cambio_grupo(retardo);}
  1544.  
  1545. //onload=function(){
  1546. setTimeout(ver_cambios_amigos, 1500)
  1547. //}
  1548. }
  1549. function dar_formato(num){
  1550. var cadena = "";
  1551. var aux;
  1552. var cont = 1,m,k;
  1553. if(num<0)
  1554. aux=1;
  1555. else
  1556. aux=0;
  1557. num=num.toString();
  1558. for(m=num.length-1; m>=0; m--){
  1559. cadena = num.charAt(m) + cadena;
  1560. if(cont%3 == 0 && m >aux)
  1561. cadena = "." + cadena;
  1562. else
  1563. cadena = cadena;
  1564. if(cont== 3)
  1565. cont = 1;
  1566. else
  1567. cont++;
  1568. }
  1569. cadena = cadena.replace(/.,/,",");
  1570. return cadena;
  1571. }
  1572. function cambio_grupo(retardo){
  1573. setTimeout(ver_cambios_amigos, retardo);
  1574. }
  1575. function ver_cambios_amigos(){
  1576. var nodselect = "//select[@id='select-group']".findNode();
  1577. var namigos = parseInt(nodselect.options[nodselect.selectedIndex].textContent.split('[')[1].split(']')[0]);
  1578. var nodmaster = "//div[@id='user-friends-container']".findNode();
  1579. var nhijos = nodmaster.childNodes.length;
  1580. var prim_nodo = nhijos - namigos;
  1581. var target = getPreference('abriramigos', true) ? '_blank' : '_self';
  1582. //Mejora el aspecto de la "tabla"
  1583. nodmaster.style.padding = "0px 15px 5px 8px";
  1584. for(var j = prim_nodo; j < nhijos; j++) {
  1585. nodmaster.childNodes[j].style.padding = "0px 0px 3px";
  1586. nodmaster.childNodes[j].style.height = "18px";
  1587. }
  1588. for (var i = prim_nodo; i < nhijos; i++){
  1589. var friendId = nodmaster.childNodes[i].id.split('-')[2];
  1590. var name = nodmaster.childNodes[i].childNodes[1].childNodes[7].childNodes[1].firstChild.firstChild.textContent;
  1591. var ratedfilms = nodmaster.childNodes[i].childNodes[1].childNodes[9].firstChild.firstChild.textContent;
  1592. var criticas = nodmaster.childNodes[i].childNodes[1].childNodes[11].firstChild.firstChild.textContent;
  1593. var listas = nodmaster.childNodes[i].childNodes[1].childNodes[13].firstChild.firstChild.textContent;
  1594. var avg = nodmaster.childNodes[i].childNodes[1].childNodes[15].firstChild.firstChild.textContent;
  1595. var changenode = nodmaster.childNodes[i].childNodes[1].childNodes[9].firstChild;
  1596. changenode.parentNode.style.paddingTop = "2.2px";
  1597. nodmaster.childNodes[i].childNodes[1].childNodes[1].style.paddingTop = "1px";
  1598. //Nombre
  1599. nodmaster.childNodes[i].childNodes[1].childNodes[7].style.width = "420px";
  1600. nodmaster.childNodes[i].childNodes[1].childNodes[7].style.marginTop = "3px";
  1601. //Votos
  1602. changenode.style.width = "71px";
  1603. changenode.style.height = "14px";
  1604. changenode.style.marginLeft = "10px";
  1605. changenode.style.marginTop = "1.5px";
  1606. changenode.target = target;
  1607. //Críticas
  1608. nodmaster.childNodes[i].childNodes[1].childNodes[11].firstChild.style.width = "55px";
  1609. nodmaster.childNodes[i].childNodes[1].childNodes[11].firstChild.style.marginLeft = "10px";
  1610. nodmaster.childNodes[i].childNodes[1].childNodes[11].firstChild.style.height = "14px";
  1611. nodmaster.childNodes[i].childNodes[1].childNodes[11].firstChild.style.marginTop = "1.5px";
  1612. nodmaster.childNodes[i].childNodes[1].childNodes[11].firstChild.target = target;
  1613. nodmaster.childNodes[i].childNodes[1].childNodes[11].firstChild.href += "?orderby=5";
  1614. //Listas
  1615. nodmaster.childNodes[i].childNodes[1].childNodes[13].firstChild.style.width = "50px";
  1616. nodmaster.childNodes[i].childNodes[1].childNodes[13].firstChild.style.marginLeft = "5px";
  1617. nodmaster.childNodes[i].childNodes[1].childNodes[13].firstChild.style.height = "14px";
  1618. nodmaster.childNodes[i].childNodes[1].childNodes[13].firstChild.style.marginTop = "1.5px";
  1619. nodmaster.childNodes[i].childNodes[1].childNodes[13].firstChild.target = target;
  1620. //Media
  1621. nodmaster.childNodes[i].childNodes[1].childNodes[15].firstChild.style.width = "40px";
  1622. nodmaster.childNodes[i].childNodes[1].childNodes[15].firstChild.style.marginLeft = "10px";
  1623. nodmaster.childNodes[i].childNodes[1].childNodes[15].firstChild.style.height = "14px";
  1624. nodmaster.childNodes[i].childNodes[1].childNodes[15].firstChild.style.marginTop = "1.5px";
  1625. //Mensaje
  1626. nodmaster.childNodes[i].childNodes[1].childNodes[17].style.paddingTop = "2.5px";
  1627. var friendstr = GM_getValue(userId + ".friends." + friendId);
  1628. if (typeof friendstr != 'undefined') {
  1629. var friend = eval(friendstr);
  1630. var dif = ratedfilms - friend.films;
  1631. var prefix;
  1632. if (dif != 0) {
  1633. prefix = dif > 0 ? '+' : '';
  1634. changenode.style.backgroundColor = dif > 0 ? 'lightgreen' : '#FF6666';
  1635. changenode.firstChild.textContent = dar_formato(parseInt(ratedfilms)) + '(' + prefix + dif + ')';
  1636. }
  1637. else
  1638. changenode.firstChild.textContent = dar_formato(parseInt(ratedfilms));
  1639. //Comparar el número de críticas con la última vez (si existen datos guardados)
  1640. if (typeof friend.criticas != 'undefined') {
  1641. dif = criticas - friend.criticas;
  1642. if (dif != 0) {
  1643. prefix = dif > 0 ? '+' : '';
  1644. nodmaster.childNodes[i].childNodes[1].childNodes[11].firstChild.style.backgroundColor = dif > 0 ? 'lightgreen' : '#FF6666';
  1645. nodmaster.childNodes[i].childNodes[1].childNodes[11].firstChild.firstChild.textContent = dar_formato(parseInt(criticas)) + '(' + prefix + dif + ')';
  1646. }
  1647. else
  1648. nodmaster.childNodes[i].childNodes[1].childNodes[11].firstChild.firstChild.textContent = dar_formato(parseInt(criticas));
  1649. }
  1650. //Comparar el número de listas con la última vez (si existen datos guardados)
  1651. if (typeof friend.listas != 'undefined') {
  1652. dif = listas - friend.listas;
  1653. if (dif != 0) {
  1654. prefix = dif > 0 ? '+' : '';
  1655. nodmaster.childNodes[i].childNodes[1].childNodes[13].firstChild.style.backgroundColor = dif > 0 ? 'lightgreen' : '#FF6666';
  1656. nodmaster.childNodes[i].childNodes[1].childNodes[13].firstChild.firstChild.textContent = dar_formato(parseInt(listas)) + '(' + prefix + dif + ')';
  1657. }
  1658. else
  1659. nodmaster.childNodes[i].childNodes[1].childNodes[13].firstChild.firstChild.textContent = dar_formato(parseInt(listas));
  1660. }
  1661. }
  1662. else{
  1663. changenode.firstChild.textContent = dar_formato(parseInt(ratedfilms));
  1664. nodmaster.childNodes[i].childNodes[1].childNodes[11].firstChild.firstChild.textContent = dar_formato(parseInt(criticas));
  1665. nodmaster.childNodes[i].childNodes[1].childNodes[13].firstChild.firstChild.textContent = dar_formato(parseInt(listas));
  1666. }
  1667. GM_setValue(userId + ".friends." + friendId, {name:name,films:ratedfilms,criticas:criticas,listas:listas}.toSource());
  1668. }
  1669. }
  1670. // CAMBIOS EN ALMAS GEMELAS
  1671. // @todo: cambiar los nombres de las variables/metodos a algo medianamente coherente
  1672. function doSoulMates() {
  1673. function getSavedSoulMatesLists() {
  1674. var ssml = eval(GM_getValue(userId + ".ssml"));
  1675. if (typeof ssml == "undefined") {
  1676. ssml = new Object();
  1677. ssml.items = new Array();
  1678. ssml.last = 0;
  1679. }
  1680. return ssml;
  1681. }
  1682. function getSavedSoulMates(index) {
  1683. return eval(GM_getValue(userId + ".sml." + index));
  1684. }
  1685. function saveSoulMates(ssml, index, sm) {
  1686. GM_setValue(userId + ".sml." + index, sm.toSource());
  1687. ssml.items.push({'index':index,'date':sm.date});
  1688. ssml.last = index;
  1689. GM_setValue(userId + ".ssml", ssml.toSource());
  1690. }
  1691. function extractSoulMates(soulMatesTable) {
  1692. var soulMates = new Object;
  1693. soulMates.sm = [];
  1694. for (i = 1; i < NUM_SM; i++) {
  1695. var row = soulMatesTable.rows[i];
  1696. var id = row.cells[1].innerHTML.split("=")[2].split('"')[0];
  1697. var name = row.cells[1].firstChild.firstChild.textContent;
  1698. var affinity = row.cells[2].firstChild.firstChild.innerHTML.replace(',', '.');
  1699. var votes = row.cells[3].firstChild.innerHTML;
  1700. soulMates.sm[i] = {'id':id,'name':name,'affinity':affinity,'votes':votes};
  1701. }
  1702. soulMates.date = formatDate(new Date());
  1703. return soulMates;
  1704. }
  1705. function findChangesAllSoulMates(soulMates, previous) {
  1706. var changesAll = new Object;
  1707. var siguen = "";
  1708. changesAll.changed = false;
  1709. var rows = [];
  1710. for (j = 1; j < NUM_SM; j++) {
  1711. var changes = new Object;
  1712. var sm = soulMates.sm[j];
  1713. var found = false;
  1714. var i = 0;
  1715. while ((++i < NUM_SM) && !found) {
  1716. if (previous.sm[i]['id'] == sm['id']) {
  1717. found = true;
  1718. changes.pos = i - j;
  1719. changes.affinity = sm['affinity'] - previous.sm[i]['affinity'];
  1720. changes.votes = sm['votes'] - previous.sm[i]['votes'];
  1721. changes.changed = (changes['pos'] != 0) || (changes['affinity'] != 0) || (changes['votes'] != 0);
  1722. }
  1723. }
  1724. changes.found = found;
  1725. if (found) {
  1726. siguen += "," + sm['name'];
  1727. }
  1728. rows[j] = changes;
  1729. changesAll.changed = changesAll.changed || changes.changed || !found;
  1730. }
  1731. // Buscamos los caidos de la lista
  1732. var caidos = [];
  1733. for (j = 1; j < NUM_SM; j++) {
  1734. var user = previous.sm[j].name;
  1735. if (siguen.indexOf(user) < 0) {
  1736. caidos.push(user);
  1737. }
  1738. }
  1739. changesAll.rows = rows;
  1740. changesAll.fallen = caidos;
  1741. changesAll.date = formatDate(new Date());
  1742. return changesAll;
  1743. }
  1744. function clearSoulMatesTable(soulMatesTable) {
  1745. for (var i = 1; i < NUM_SM; i++) {
  1746. var row = soulMatesTable.rows[i];
  1747. row.cells[1].innerHTML = "&nbsp;";
  1748. row.cells[4].innerHTML = "&nbsp;";
  1749. row.cells[6].innerHTML = "&nbsp;";
  1750. }
  1751. }
  1752. function prepareSoulMatesTable(soulMatesTable) {
  1753. soulMatesTable.rows[0].cells[0].colSpan = 2;
  1754. soulMatesTable.rows[0].cells[2].colSpan = 2;
  1755. soulMatesTable.rows[0].cells[3].colSpan = 2;
  1756. for (var i = 1; i < soulMatesTable.rows.length; i++) {
  1757. var row = soulMatesTable.rows[i];
  1758. var newCell = d.createElement('TD');
  1759. //newCell.width = 25;
  1760. newCell.innerHTML = "&nbsp;";
  1761. row.insertBefore(newCell, row.cells[0].nextSibling);
  1762. newCell = d.createElement('TD');
  1763. newCell.width = 20;
  1764. newCell.innerHTML = "&nbsp;";
  1765. row.insertBefore(newCell, row.cells[3].nextSibling);
  1766. newCell = d.createElement('TD');
  1767. newCell.width = 20;
  1768. newCell.innerHTML = "&nbsp;";
  1769. row.insertBefore(newCell, row.cells[5].nextSibling);
  1770. }
  1771. }
  1772. function applySoulMatesChanges(soulMatesTable, i, changes) {
  1773. // ¿Cambio de posicion?
  1774. if (changes.pos > 0) {
  1775. soulMatesTable.rows[i].cells[1].innerHTML = '<img src="' + upimg + '"><span style="font-size:80%;color:#1FA012;">' + changes.pos + '</span>';
  1776. } else if (changes.pos < 0) {
  1777. soulMatesTable.rows[i].cells[1].innerHTML = '<img src="' + downimg + '"><span style="font-size:80%;color:#A0121F;">' + changes.pos + '</span>';
  1778. }
  1779. // ¿cambio de afinidad?
  1780. if (changes.affinity > 0) {
  1781. soulMatesTable.rows[i].cells[4].innerHTML = '<span style="font-size:85%;color:#1FA012;">(+' + changes.affinity.toFixed(2) + ')</span>';
  1782. } else if (changes.affinity < 0) {
  1783. soulMatesTable.rows[i].cells[4].innerHTML = '<span style="font-size:85%;color:#A0121F;">(' + changes.affinity.toFixed(2) + ')</span>';
  1784. }
  1785. // ¿cambio de valoradas?
  1786. if (changes.votes > 0) {
  1787. soulMatesTable.rows[i].cells[6].innerHTML = '<span style="font-size:85%;color:#1FA012;">(+' + changes.votes + ')</span>';
  1788. } else if (changes.votes < 0) {
  1789. soulMatesTable.rows[i].cells[6].innerHTML = '<span style="font-size:85%;color:#A0121F;">(' + changes.votes + ')</span>';
  1790. }
  1791. }
  1792. function applyNewSoulMate(soulMatesTable, i) {
  1793. soulMatesTable.rows[i].cells[1].innerHTML = '<img src="' + newimg + '">';
  1794. }
  1795. // A&ntilde;ade la leyenda de los caidos
  1796. function injectLostSM(soulMatesTable, fallen) {
  1797. log("Mostrando caidos");
  1798. if (fallen.length > 0) {
  1799. var tr = d.createElement('TR');
  1800. var td = d.createElement('TD');
  1801. td.innerHTML = 'Almas gemelas caidas de la lista: <b>' + fallen.join(', ') + '</b>';
  1802. td.colSpan = 7;
  1803. tr.appendChild(td);
  1804. soulMatesTable.rows[1].parentNode.appendChild(tr);
  1805. }
  1806. }
  1807. function injectLastChangeTime(soulMatesTable, date) {
  1808. if (typeof date != "undefined") {
  1809. var tr = d.createElement('TR');
  1810. var td = d.createElement('TD');
  1811. td.innerHTML = 'Ultimos cambios detectados el ' + date;
  1812. td.colSpan = 7;
  1813. tr.appendChild(td);
  1814. soulMatesTable.rows[1].parentNode.appendChild(tr);
  1815. }
  1816. }
  1817. function injectDateCombobox(soulMatesTable, newChanges, ssml) {
  1818. var currentTS = new Date();
  1819. var lastWeek = 0;
  1820. if (!newChanges) ssml.items.pop(); // Eliminamos el tiempo actual.
  1821. if (ssml.items.length > 1) {
  1822. ssml.items.sort(function(a, b) {
  1823. return b.index - a.index;
  1824. });
  1825. var tr = d.createElement('TR');
  1826. var td = d.createElement('TD');
  1827. var html = 'Comparar con: <select id="HSML" name="HSML">';
  1828. for (var ix in ssml.items) {
  1829. var index = ssml.items[ix].index;
  1830. var date = ssml.items[ix].date;
  1831. var dateTS = deFormatDate(date);
  1832. dateTS.setDate(dateTS.getDate() + 15);
  1833. var week = dateTS.getWeek(1);
  1834. // Si la fecha es de hace mas de quince dias, solo ponemos una
  1835. // por semana
  1836. if (dateTS > currentTS || week != lastWeek) {
  1837. lastWeek = week;
  1838. html += '<option value=' + index + '>' + date + '</option>';
  1839. }
  1840. }
  1841. html += "</select>";
  1842. td.innerHTML = html;
  1843. td.colSpan = 7;
  1844. tr.appendChild(td);
  1845. soulMatesTable.rows[1].parentNode.appendChild(tr);
  1846. $id("HSML").firstChild.selected = true;
  1847. $id("HSML").addEventListener("change", doSoulMatesHist, false);
  1848. }
  1849. }
  1850. function doSoulMatesChanges(soulMatesTable, newChanges, changesList, ssml, historic) {
  1851. // comparar y modificar
  1852. var changes;
  1853. for (i = 1; i < NUM_SM; i++) {
  1854. changes = changesList.rows[i];
  1855. if (changes.found) {
  1856. // ya la teniamos
  1857. if (changes.changed) {
  1858. applySoulMatesChanges(soulMatesTable, i, changes);
  1859. }
  1860. }
  1861. else {
  1862. // Es un alma gemela nueva
  1863. applyNewSoulMate(soulMatesTable, i);
  1864. }
  1865. }
  1866. if (getPreference("SHOWSMFALLEN", true) && !historic) {
  1867. injectLostSM(soulMatesTable, changesList.fallen);
  1868. }
  1869. if ((newChanges || getPreference("KEEPSMCHANGES"),true) && !historic) {
  1870. injectLastChangeTime(soulMatesTable, changesList.date);
  1871. }
  1872. /* Mostrar el combo para comparar con el historico */
  1873. if (!historic) injectDateCombobox(soulMatesTable, newChanges, ssml);
  1874. }
  1875. function getHSMSelectedIndex() {
  1876. var select = $id("HSML");
  1877. var index = 0;
  1878. var nodo = select.firstChild;
  1879. while (nodo != null && index == 0) {
  1880. if (nodo.selected) {
  1881. index = nodo.value;
  1882. }
  1883. nodo = nodo.nextSibling;
  1884. }
  1885. return index;
  1886. }
  1887. // Comparamos los ultimos datos con el historico.
  1888. function doSoulMatesHist() {
  1889. var soulMatesTable = XPATH_SML.findNode();
  1890. var ssml = getSavedSoulMatesLists();
  1891. var currentSM = getSavedSoulMates(ssml.last);
  1892. var index = getHSMSelectedIndex();
  1893. var historicSM = getSavedSoulMates(index);
  1894. var changes = findChangesAllSoulMates(currentSM, historicSM);
  1895. log("Comparando:" + currentSM.toSource());
  1896. log("Historico:" + historicSM.toSource());
  1897. clearSoulMatesTable(soulMatesTable);
  1898. doSoulMatesChanges(soulMatesTable, false, changes, ssml, true);
  1899. }
  1900. function doSoulMates() {
  1901. // Leer las almas gemelas del HTML
  1902. var soulMatesTable = XPATH_SML.findNode();
  1903. var ssml = getSavedSoulMatesLists();
  1904. var currentSoulMates = extractSoulMates(soulMatesTable);
  1905. if (ssml.last > 0) {
  1906. prepareSoulMatesTable(soulMatesTable);
  1907. var previousSoulMates = getSavedSoulMates(ssml.last);
  1908. var changes = findChangesAllSoulMates(currentSoulMates, previousSoulMates);
  1909. var newChanges = changes.changed;
  1910. var previousChanges = eval(GM_getValue(userId + '.smc'));
  1911. if (!changes.changed && (previousChanges != undefined)) {
  1912. log("No hay Cambios");
  1913. if (getPreference("KEEPSMCHANGES", true)) {
  1914. changes = previousChanges;
  1915. }
  1916. }
  1917. else {
  1918. log("Guardando los nuevos cambios");
  1919. GM_setValue(userId + '.smc', changes.toSource());
  1920. }
  1921. doSoulMatesChanges(soulMatesTable, newChanges, changes, ssml, false);
  1922. if (newChanges) {
  1923. saveSoulMates(ssml, ssml.last + 1, currentSoulMates);
  1924. }
  1925. }
  1926. else {
  1927. // Primera vez que detectamos Almas gemelas, borramos la lista de cambios
  1928. // por si acaso
  1929. GM_deleteValue(userId + '.smc');
  1930. saveSoulMates(ssml, ssml.last + 1, currentSoulMates);
  1931. }
  1932. }
  1933. doSoulMates();
  1934. /*
  1935. FIN ALMAS GEMELAS
  1936. */
  1937. }
  1938. function doAlt2Title() {
  1939. var imgs = d.getElementsByTagName('img');
  1940. for (var i = 0; i < imgs.length; ++i)
  1941. if (imgs[i].hasAttribute('alt') && !imgs[i].hasAttribute('title'))
  1942. imgs[i].setAttribute('title', imgs[i].getAttribute('alt'));
  1943. }
  1944. function doAddFechaVoto(){
  1945. var voto = '//div[@class="rating-img"]/img'.findNode();
  1946. if(voto.src.indexOf('ns') == -1){
  1947. var url = 'http://neokben.host-ed.me/fa/src/votosfecha.php?userid=' + getUserId() + '&movieid=' + d.URL.split('/film')[1].split('.')[0];
  1948. doGet(url, function (response) {
  1949. var emptydiv = document.createElement('div');
  1950. emptydiv.innerHTML = response;
  1951. var lineav = '//strong'.findNode(emptydiv);
  1952. var fecha = lineav.textContent.split('#')[2];
  1953. var nodov = '//div[@class="rating-img"]'.findNode();
  1954. var divvotada = d.createElement('div');
  1955. divvotada.className = "rt-wr-sd";
  1956. divvotada.textContent = "Votada el:";
  1957. var divfecha = d.createElement('div');
  1958. divfecha.textContent = fecha.split('-')[2] + "-" + fecha.split('-')[1] + "-" + fecha.split('-')[0];
  1959. divfecha.style.color = "white";
  1960. divfecha.style.padding = "5px 0px";
  1961. divfecha.style.backgroundColor = "steelblue";
  1962. divfecha.style.fontSize = "15px";
  1963. divfecha.style.fontWeight = "bold";
  1964. divfecha.style.letterSpacing = "1px";
  1965. nodov.parentNode.appendChild(divvotada);
  1966. nodov.parentNode.appendChild(divfecha);
  1967. });
  1968. }
  1969. }
  1970. function doAddOtherLinks() {
  1971. function linkYear(){
  1972. var nodoanio = "//dt[text()='Año']/following-sibling::*".findNode();
  1973. if(nodoanio != null) {
  1974. var anio = nodoanio.lastChild.textContent.trim();
  1975. nodoanio.removeChild(nodoanio.lastChild);
  1976. var newa = d.createElement('a');
  1977. newa.textContent = anio;
  1978. newa.href = "http://www.filmaffinity.com/es/advsearch.php?stext=&stype[]=title&genre=&country=&fromyear="+anio+"&toyear="+anio;
  1979. newa.target = "";
  1980. newa.style.color = "inherit";
  1981. newa.style.textDecoration = "none";
  1982. nodoanio.appendChild(newa);
  1983. }
  1984. }
  1985. function linkGuion(){
  1986. var nguion = "//dt[text()='Guión']/following-sibling::*".findNode();
  1987. if(nguion != null) {
  1988. var linea = nguion.textContent;
  1989. if(linea != ""){
  1990. nguion.removeChild(nguion.lastChild);
  1991. var aux = linea.split('(');
  1992. var gnistas = aux[0].split(',');
  1993. var txt = "";
  1994. var nombre = "";
  1995. for(ix in gnistas){
  1996. nombre = gnistas[ix].split(' ');
  1997. txt += '<a href="http://www.filmaffinity.com/es/advsearch.php?stext=' + gnistas[ix] + '&stype[]=script&genre=&country=&fromyear=&toyear=" ';
  1998. txt += 'target="" style="text-decoration: none; color:inherit">' + gnistas[ix] + '</a>';
  1999. if(ix != gnistas.length -1)
  2000. txt += ', ' ;
  2001. }
  2002. if(aux.length > 1){
  2003. txt += '(';
  2004. txt += aux[1];
  2005. }
  2006. nguion.innerHTML = txt;
  2007. }
  2008. }
  2009. }
  2010. function linkMusica(){
  2011. var nmusic = "//dt[text()='Música']/following-sibling::*".findNode();
  2012. if(nmusic != null) {
  2013. var linea = nmusic.textContent;
  2014. if(linea != ""){
  2015. nmusic.removeChild(nmusic.lastChild);
  2016. var aux = linea.split('(');
  2017. var musicos = aux[0].split(',');
  2018. var txt = "";
  2019. for(ix in musicos){
  2020. txt += '<a href="http://www.filmaffinity.com/es/advsearch.php?stext=' + musicos[ix] + '&stype[]=music&genre=&country=&fromyear=&toyear=" ';
  2021. txt += 'target="" style="text-decoration: none; color:inherit">' + musicos[ix] + '</a>';
  2022. if(ix != musicos.length -1)
  2023. txt += ', ' ;
  2024. }
  2025. if(aux.length > 1){
  2026. txt += '(';
  2027. txt += aux[1];
  2028. }
  2029. nmusic.innerHTML = txt;
  2030. }
  2031. }
  2032. }
  2033. function linkFoto(){
  2034. var nfoto = "//dt[text()='Fotografía']/following-sibling::*".findNode();
  2035. if(nfoto != null) {
  2036. var linea = nfoto.textContent;
  2037. if(linea != ""){
  2038. nfoto.removeChild(nfoto.lastChild);
  2039. var aux = linea.split('(');
  2040. var fotogs = aux[0].split(',');
  2041. var txt = "";
  2042. for(ix in fotogs){
  2043. txt += '<a href="http://www.filmaffinity.com/es/advsearch.php?stext=' + fotogs[ix] + '&stype[]=photo&genre=&country=&fromyear=&toyear=" ';
  2044. txt += 'target="" style="text-decoration: none; color:inherit">' + fotogs[ix] + '</a>';
  2045. if(ix != fotogs.length -1)
  2046. txt += ', ' ;
  2047. }
  2048. if(aux.length > 1){
  2049. txt += '(';
  2050. txt += aux[1];
  2051. }
  2052. nfoto.innerHTML = txt;
  2053. }
  2054. }
  2055. }
  2056. linkYear();
  2057. linkGuion();
  2058. linkMusica();
  2059. linkFoto();
  2060. }
  2061. function doExternalLinks() {
  2062. function extractTranslatedTitle() {
  2063. var nodo = "//h1[@id='main-title']".findNode();
  2064. return nodo.lastChild.textContent.clearTitle();
  2065. }
  2066. function extractOriginalTitle()
  2067. {
  2068. var nodo = "//dt[contains(text(),'tulo original')]/following-sibling::*".findNode();
  2069. return nodo.textContent.clearTitle();
  2070. }
  2071. function getLinkSitesCode(type, title, titletr, titleanm) {
  2072. var linkSiteTemplate = ' <a href="{LINK}" target="{TARGET}" ><img src="{ICON}" width=16 height=16 alt="{TITLE}" title="{TITLE}"></a>';
  2073. var html = '';
  2074. for (var i in linkSites) {
  2075. // @todo: si la preferencia es false la consulta se hace dos veces, optimizar
  2076. if (linkSites[i].type == type && ( getPreference(linkSites[i].name, true))) {
  2077. var sicon = linkSites[i].icon;
  2078. var stit = linkSites[i].name;
  2079. var sstr = '';
  2080. var target = getPreference('newwindow', true) ? '_blank' : '_self';
  2081. if (linkSites[i].search.search(/%searchtr/) > -1)
  2082. sstr = linkSites[i].search.replace(/%searchtr/, linkSites[i].method(titletr));
  2083. else if(linkSites[i].search.search(/%searchvo/) > -1)
  2084. sstr = linkSites[i].search.replace(/%searchvo/, linkSites[i].method(title));
  2085. else
  2086. sstr = linkSites[i].search.replace(/%searchanm/, linkSites[i].method(titleanm));
  2087. // Si tiene Opciones adicionales
  2088. if (linkSites[i].search.indexOf("{OPTIONS}") > -1) {
  2089. sstr = sstr.replace(/{OPTIONS}/g, linkSites[i].getOptions());
  2090. }
  2091. html += linkSiteTemplate.replace(/{LINK}/g, sstr).replace(/{ICON}/g, sicon).replace(/{TARGET}/g, target).replace(/{TITLE}/g, stit);
  2092. }
  2093. }
  2094. return html;
  2095. }
  2096. //Añadir enlaces en título
  2097. function doAddLinksInTitle() {
  2098. var translatedTitle = extractTranslatedTitle();
  2099. var originalTitle = extractOriginalTitle();
  2100. if ("//span[@itemprop='name']".findNode().textContent.indexOf("Serie de TV") > -1){
  2101. var auxanm = "//dt[contains(text(),'tulo original')]/following-sibling::*".findNode().textContent;
  2102. var coincidencias = auxanm.match(/\(/g);
  2103. var numcars = coincidencias ? coincidencias.length : 0;
  2104. if(numcars == 1)
  2105. var animeTitle = originalTitle;
  2106. else
  2107. var animeTitle = auxanm.split('(')[1].split(')')[0];
  2108. }
  2109. else {
  2110. var auxanm = "//dt[contains(text(),'tulo original')]/following-sibling::*".findNode().textContent;
  2111. var coincidencias = auxanm.match(/\(/g);
  2112. var numcars = coincidencias ? coincidencias.length : 0;
  2113. if(numcars == 1)
  2114. var animeTitle = auxanm.split('(')[1].split(')')[0];
  2115. else
  2116. var animeTitle = originalTitle;
  2117. }
  2118. //var titlediv = "//img[@src='http://www.filmaffinity.com/images/movie.gif']/parent::*/parent::*".findNode();
  2119. var titlediv = "//h1[@id='main-title']/span".findNode();
  2120. var midiv = d.createElement('div');
  2121. midiv.style.marginTop = "-4px";
  2122. var types = [_TFILM, _TGEN, _TDOWN, _TSUB];
  2123. for (var t in types) {
  2124. var tmp = '';
  2125. var txt = linkSitesTypes[types[t]].caption;
  2126. if (getPreference(linkSitesTypes[types[t]].preference, true)) {
  2127. tmp += getLinkSitesCode(types[t], originalTitle, translatedTitle, animeTitle);
  2128. }
  2129. if (tmp != '')
  2130. midiv.innerHTML += '<span style="color:#000000; font-size:11px; font-family: Arial; font-weight: bold; padding-left: 1em; font-style: normal;">' + txt + tmp + '</span>';
  2131. }
  2132. titlediv.appendChild(midiv);
  2133. }
  2134. //
  2135. // Añade los enlaces Externos en el panel de la derecha
  2136. //
  2137. function doAddLinksOnPanel() {
  2138. var nodo = "//div[text()='Listas']".findNode();
  2139. nodo = nodo.parentNode;
  2140. var originalTitle = extractOriginalTitle();
  2141. var translatedTitle = extractTranslatedTitle();
  2142. if ("//span[@itemprop='name']".findNode().textContent.indexOf("Serie de TV") > -1)
  2143. var animeTitle = "//dt[contains(text(),'tulo original')]/following-sibling::*".findNode().textContent.split('(')[1].split(')')[0];
  2144. else
  2145. var animeTitle = originalTitle;
  2146. /*
  2147. var html = '<td align="center">\n<table bgcolor="#ddddff" border="0" cellpadding="0" cellspacing="1" width="100%">\n <tbody>';
  2148. html += '<tr><td bgcolor="#ffffff">\n\n<table border="0" cellpadding="2" cellspacing="2" width="100%">\n<tbody>';
  2149. html += '{LINKS}\n</tbody></table>\n\n </td></tr>\n </tbody></table>\n </td>';*/
  2150. var html = '<div class="add-movie-list-cont"><div>{TITLE}</div></div>';
  2151. var linkTemplate = '<tr>\n <td align="center">\n <div style="position: relative;">\n\n';
  2152. linkTemplate += '<div style="color: rgb(0, 51, 102); font-size: 12px;"><b>{TITLE}</b></div>\n\n</div>\n\n </td>\n </tr>\n';
  2153. linkTemplate += '<tr><td align="center">{LINKS}</td></tr>';
  2154. var links = "";
  2155. var texto;
  2156. if (getPreference("verCine", true)) {
  2157. texto = getLinkSitesCode(_TFILM, originalTitle, translatedTitle, animeTitle);
  2158. if (texto != '') links += linkTemplate.replace(/{TITLE}/g, "Ficha").replace(/{LINKS}/g, texto);
  2159. }
  2160. if (getPreference("verGeneral", true)) {
  2161. texto = getLinkSitesCode(_TGEN, originalTitle, translatedTitle, animeTitle);
  2162. if (texto != '') links += linkTemplate.replace(/{TITLE}/g, "Buscar").replace(/{LINKS}/g, texto);
  2163. }
  2164. if (getPreference("verDescargas", true)) {
  2165. texto = getLinkSitesCode(_TDOWN, originalTitle, translatedTitle, animeTitle);
  2166. if (texto != '') links += linkTemplate.replace(/{TITLE}/g, "Descargas").replace(/{LINKS}/g, texto);
  2167. }
  2168. if (getPreference("verSubtitulos", true)) {
  2169. texto = getLinkSitesCode(_TSUB, originalTitle, translatedTitle, animeTitle);
  2170. if (texto != '') links += linkTemplate.replace(/{TITLE}/g, "Subtitulos").replace(/{LINKS}/g, texto);
  2171. }
  2172. var spacer = document.createElement("TR");
  2173. spacer.innerHTML = "<td>&nbsp;</td>";
  2174. nodo.parentNode.insertBefore(spacer, nodo);
  2175. var nodoTr = document.createElement("TR");
  2176. nodo.parentNode.insertBefore(nodoTr, nodo.previousSibling);
  2177. nodoTr.innerHTML = html.replace(/{LINKS}/g, links);
  2178. }
  2179. //
  2180. // Añade los enlaces Externos en la ficha de la pelicula
  2181. //
  2182. function doAddLinksInline() {
  2183. var originalTitle = extractOriginalTitle();
  2184. var translatedTitle = extractTranslatedTitle();
  2185. var animeTitle = "";
  2186. if ("//span[@itemprop='name']".findNode().textContent.indexOf("Serie de TV") > -1){
  2187. var auxanm = "//dt[contains(text(),'tulo original')]/following-sibling::*".findNode().textContent;
  2188. var coincidencias = auxanm.match(/\(/g);
  2189. var numcars = coincidencias ? coincidencias.length : 0;
  2190. if(numcars == 1)
  2191. animeTitle = originalTitle;
  2192. else
  2193. animeTitle = auxanm.split('(')[1].split(')')[0];
  2194. }
  2195. else {
  2196. var auxanm = "//dt[contains(text(),'tulo original')]/following-sibling::*".findNode().textContent;
  2197. var coincidencias = auxanm.match(/\(/g);
  2198. var numcars = coincidencias ? coincidencias.length : 0;
  2199. if(numcars == 1)
  2200. animeTitle = auxanm.split('(')[1].split(')')[0];
  2201. else
  2202. animeTitle = originalTitle;
  2203. }
  2204. log("-T&iacute;tulo original: " + originalTitle + " - T&iacute;tulo traducido: " + translatedTitle);
  2205. // recogemos el tr padre de la columna 'productora'
  2206. var nodoProductora = "//dt[text()='Productora']".findNode();
  2207. // Fichas
  2208. addDataRow(nodoProductora, "verSubtitulos", 'Subtitulos', _TSUB, originalTitle, translatedTitle, animeTitle);
  2209. addDataRow(nodoProductora, "verDescargas", 'Descargas', _TDOWN, originalTitle, translatedTitle, animeTitle);
  2210. addDataRow(nodoProductora, "verGeneral", 'Buscar', _TGEN, originalTitle, translatedTitle, animeTitle);
  2211. addDataRow(nodoProductora, "verCine", 'Ficha', _TFILM, originalTitle, translatedTitle, animeTitle);
  2212. }
  2213. // Añadimos los enlaces en la pagina de busqueda
  2214. function doAddLinksSearch() {
  2215. var nodo = "//div[@class='sub-header-search']".findNode();
  2216. var nodog = "//div[@class='main-search-wrapper']".findNode();
  2217. nodog.style.marginRight = "0px";
  2218. if (nodo != null) {
  2219. var busqueda = d.forms[0].elements[0].value;
  2220. var types = [_TFILM, _TGEN, _TDOWN, _TSUB];
  2221. var html = "<td><b>&nbsp;Búsquedas adicionales:</b>&nbsp;&nbsp;";
  2222. for (var t in types) {
  2223. var type = types[t];
  2224. if (getPreference(linkSitesTypes[types[t]].preference, true)) {
  2225. html += getLinkSitesCode(type, busqueda, busqueda, busqueda) + "&nbsp;&nbsp;";
  2226. }
  2227. }
  2228. html += "<br></br></td>";
  2229. var nodoDiv = d.createElement('div');
  2230. nodoDiv.style.height = "25px";
  2231. nodoDiv.style.borderBottom="1px solid #000000";
  2232. nodoDiv.innerHTML = html;
  2233. nodo.parentNode.insertBefore(nodoDiv,nodo);
  2234. }
  2235. }
  2236. function addDataRow(sibling, preference, title, type, originalTitle, translatedTitle, animeTitle) {
  2237. if (getPreference(preference, true)) {
  2238. var html = getLinkSitesCode(type, originalTitle, translatedTitle, animeTitle);
  2239. if (html != "") {
  2240. var nodoDt = d.createElement('dt');
  2241. var nodoDd = d.createElement('dd');
  2242. nodoDt.textContent = title;
  2243. nodoDd.innerHTML = html;
  2244. sibling.parentNode.insertBefore(nodoDt, sibling.nextSibling.nextSibling.nextSibling);
  2245. nodoDt.parentNode.insertBefore(nodoDd, nodoDt.nextSibling);
  2246. }
  2247. }
  2248. }
  2249. if (inSection('Film')) {
  2250. var doFunction;
  2251. switch (getPreference("linksPosition", "default")) {
  2252. case "default": doFunction = doAddLinksInline;break;
  2253. case "inTitle": doFunction = doAddLinksInTitle;break;
  2254. //case "inPanel": doFunction = doAddLinksOnPanel;break;
  2255. }
  2256. doFunction();
  2257. }
  2258. else {
  2259. if(getPreference("SHOWEXTERNALS", true))
  2260. doAddLinksSearch();
  2261. }
  2262. ;
  2263. }
  2264. function installSearchEngine() {
  2265. log("Instalando buscador");
  2266. window.setTimeout("window.sidebar.addSearchEngine('http://mycroft.mozdev.org/install.php/1913/filmaffinity_es.src', 'http://mycroft.mozdev.org/install.php/1913/filmaffinity_es.gif', 'FilmAffinity ES', 'as');", 50);
  2267. log("-instalado");
  2268. }
  2269. //var limitUrls = ['/es/topgen.php','/es/smsrec.php'];
  2270. /*
  2271. * Modifica los men&uacute;s originales de FA
  2272. */
  2273. function doAlterLimits() {
  2274. /*
  2275. var nodo = null;
  2276. var limit = getPreference("limit", 20);
  2277. for (ix in limitUrls) {
  2278. nodo = ('//a[@href="' + limitUrls[ix] + '"]').findNode();
  2279. if (nodo != null && typeof nodo != "undefined") {
  2280. nodo.href = nodo.href + "?limit=" + limit;
  2281. }
  2282. }*/
  2283. }
  2284. function doCaptureLists() {
  2285. var myid = getPreference('idinput');
  2286. var nlists = "//div[@id='my-lists-count']/span".findNode().textContent;
  2287. nlists = parseInt(nlists);
  2288. var npages = Math.ceil(nlists/100);
  2289. deleteValues(userId + ".list.");
  2290. var npage = 1;
  2291. while(npage <= npages){
  2292. url = "http://www.filmaffinity.com/es/userlists.php?user_id=" + myid + "&p=" + npage;
  2293. doGet(url, function(response) {
  2294. response = response.replace("<img", "<omg"); // Para que no se ponga a cargar las peliculas
  2295. var emptydiv = document.createElement('div');
  2296. emptydiv.innerHTML = response;
  2297. capturar_listas(emptydiv);
  2298. });
  2299. npage++;
  2300. }
  2301. function capturar_listas(div){
  2302. var t_lists = '//div[@class="list-name-wrapper"]/a'.findNodesArray(div);
  2303. var listas = [];
  2304. var nlistasa = 0;
  2305. for (var i = 0; i < t_lists.length; i++) {
  2306. var listName = t_lists[i].textContent;
  2307. var listId = t_lists[i].href.split('=')[2];
  2308. listas[i] = {'id':listId,'name':listName};
  2309. GM_setValue(userId + ".list." + listId, listName);
  2310. nlistasa = getValues(userId + ".list.");
  2311. log("Listas añadidas: " + nlistasa.length);
  2312. }
  2313. }
  2314. }
  2315. function doRatingStyle() {
  2316. // TODO: modificar
  2317. function getRatingFromImg(img) {
  2318. if (img.src.indexOf('ns.gif') > - 1) return 0;
  2319. return img.src.split('ratings/')[1].split('.')[0];
  2320. }
  2321. function getRatingImageCode(j, rating, schema) {
  2322. var imgTemplate = "<img src='{SOURCE}' class='ratingimg' alt='" + rating + ' - ' + ratings[rating] + "'>";
  2323. return imgTemplate.replace(/{SOURCE}/g, j > rating ? ratingStyles[schema].iconOff : ratingStyles[schema].iconOn);
  2324. }
  2325. function doChangeRatingStyle() {
  2326. log("Cambiar estilo de las puntuaciones");
  2327. var schema = getPreference('ratingStyle', 'default');
  2328. if (schema == 'default') return;
  2329. // Obtenemos las imagenes a cambiar
  2330. var images = "//img[contains(@src,'ratings')]".findNodesArray();
  2331. for (var ix in images) {
  2332. var img = images[ix];
  2333. var rating = getRatingFromImg(img);
  2334. if (rating > 0) {
  2335. var html = "";
  2336. for (var j = 1; j < 11; j++) {
  2337. html += getRatingImageCode(j, rating, schema);
  2338. }
  2339. var divNode = d.createElement('DIV');
  2340. divNode.style.width = "160";
  2341. divNode.innerHTML = html;
  2342. img.parentNode.insertBefore(divNode, img);
  2343. img.parentNode.removeChild(img);
  2344. }
  2345. }
  2346. }
  2347. doChangeRatingStyle();
  2348. }
  2349. function doAddFlagsMyData() {
  2350. var styleTemplate = 'padding-left: 21px; background: url("{URL}") no-repeat scroll center left';
  2351. var baseUrl = "http://www.filmaffinity.com/imgs/countries/";
  2352. var countriesTable = "//td[text()='Estados Unidos']/ancestor::*[position()=2]".findNode();
  2353. var aux = "//h1[text()='Mis Datos']".findNode();
  2354. aux = aux.parentNode.parentNode.parentNode.parentNode.parentNode;
  2355. aux.style.width = "100%";
  2356. for (var i = 0; i < countriesTable.rows.length; ++i) {
  2357. countriesTable.rows[i].cells[0].setAttribute('class','odd_votes');
  2358. countriesTable.rows[i].cells[0].setAttribute('style',
  2359. styleTemplate.replace(/{URL}/g, baseUrl + getCountryCode(countriesTable.rows[i].cells[0].textContent) + ".jpg"));
  2360. }
  2361. }
  2362. function doAddFlagsToOptionsSel() {
  2363. if (inSection('TopGen'))
  2364. doAddFlagsToOptions(d.forms[1].elements[2]);
  2365. else if (inSection('AdvSearch'))
  2366. doAddFlagsToOptions(d.forms[1].elements[9]);
  2367. else if (inSection('UptMyData'))
  2368. doAddFlagsToOptions(d.forms[1].elements[5]);
  2369. }
  2370. function doAddFlagsToOptions(o) {
  2371. //var paises = "";
  2372. //var code = "";
  2373. log("Añadir banderas a options");
  2374. for (var i = 0; i < o.options.length; ++i) {
  2375. o.options[i].setAttribute('style', 'padding-left: 19px; background: white url("http://www.filmaffinity.com/imgs/countries/' + o.options[i].value + '.jpg") no-repeat scroll center left');
  2376. if (typeof getCountryCode(o.options[i].textContent) == "undefined") {
  2377. //paises += o.options[i].textContent + ",";
  2378. //code += '"' + o.options[i].textContent + '":"' + o.options[i].value + '",';
  2379. }
  2380. }
  2381. //log(paises);
  2382. //log(code);
  2383. o.setAttribute('style', 'padding-left: 19px; background: white url("http://www.filmaffinity.com/imgs/countries/' + o.options[o.selectedIndex].value + '.jpg") no-repeat scroll center left');
  2384. o.addEventListener("change", doAddFlagsToOptionsSel, true);
  2385. o.addEventListener("keyup", doAddFlagsToOptionsSel, true);
  2386. log("-fin banderas a options");
  2387. }
  2388. function poner_banderas(){
  2389. var nprub = "//div[@class='user-friend-info']".findNodesArray();
  2390. var ndatos = "//td[@class='avg-ratings']".findNode();
  2391. //alert(ndatos.childNodes.length);
  2392. }
  2393. function doAddFlagsToFriends() {
  2394. /*
  2395. window.onload=function(){
  2396. setTimeout(poner_banderas, 200)
  2397. }
  2398. */
  2399. //alert('entro');
  2400. // var nprub = "//div[@id='user-friend-878650']".findNode();
  2401. // alert(nprub.nodeName);
  2402. /*var friendsTable = "//span[text()='Nombre/Nick']/ancestor::*[position()=4]".findNode();
  2403. for (var i = 1; i < friendsTable.rows.length - 1; i++) {
  2404. var localidad = friendsTable.rows[i].cells[1].textContent.reverse();
  2405. var pais = localidad.substr(1, localidad.indexOf('(') - 1).reverse();
  2406. var code = getCountryCode(pais);
  2407. friendsTable.rows[i].cells[1].setAttribute('style', 'padding-left: 22px; background: white url("http://www.filmaffinity.com/imgs/countries/' + code + '.jpg") no-repeat scroll center left');
  2408. }*/
  2409. }
  2410. function doAddFlagsToExtraContacts() {
  2411. var contactsTable = "//table[@id='newFriends']".findNode();
  2412. for (var i = 1; i < contactsTable.rows.length; i++) {
  2413. var localidad = contactsTable.rows[i].cells[1].textContent.reverse();
  2414. var pais = localidad.substr(1, localidad.indexOf('(') - 1).reverse();
  2415. var code = getCountryCode(pais);
  2416. contactsTable.rows[i].cells[1].setAttribute('style', 'padding-left: 22px; background: white url("http://www.filmaffinity.com/imgs/countries/' + code + '.jpg") no-repeat scroll center left');
  2417. }
  2418. }
  2419. var contentPrefix = "";
  2420. function doEnableVotes() {
  2421. function doFilmVote(id, current) {
  2422. var url = "http://www.filmaffinity.com/es/ratemovie.php?id={PELICULA}&rating={VOTO}&ucd={UCD}&ts=" + (new Date()).valueOf();
  2423. var pelicula = id.split(':')[1];
  2424. var voto = id.split(':')[2];
  2425. var nodename = pelicula + ":" + ((current == 0) ? '-' : current);
  2426. var nodo = $id(nodename);
  2427. var ucd = getPreference("UCD", false);
  2428. if (typeof ucd != "undefined" && ucd) {
  2429. if (voto != current) {
  2430. nodo.innerHTML = contentPrefix + "<img src='" + upload_img + "'/>";
  2431. url = url.replace(/{PELICULA}/g, pelicula).replace(/{VOTO}/g, voto).replace(/{UCD}/g, ucd);
  2432. doGet(url, function (response) {
  2433. if (voto == 0) {
  2434. nodo.innerHTML = contentPrefix + "-";
  2435. nodo.id = pelicula + ":-";
  2436. }
  2437. else {
  2438. nodo.innerHTML = contentPrefix + voto;
  2439. nodo.id = pelicula + ":" + voto;
  2440. }
  2441. });
  2442. }
  2443. }
  2444. hideVoteMenu();
  2445. }
  2446. function hideVoteMenu() {
  2447. d.body.removeChild($id('panel_votacion'));
  2448. d.body.removeChild($id('backgroundLayer'));
  2449. }
  2450. var puntuaciones = { 0:'No vista',
  2451. 10:'Excelente',
  2452. 9:'Muy buena',
  2453. 8:'Notable',
  2454. 7:'Buena',
  2455. 6:'Interesante',
  2456. 5:'Pasable',
  2457. 4:'Regular',
  2458. 3:'Floja',
  2459. 2:'Mala',
  2460. 1:'Muy mala'};
  2461. function showVoteMenu(e) {
  2462. var listItemTemplate = '<td class="menu"><span class="{CLASS}" id="{ID}" href="#">{NAME}</span></td>';
  2463. var ancho = 80;
  2464. var pelicula = this.id.split(':')[0];
  2465. var voto = this.id.split(':')[1];
  2466. if (voto == '-') voto = 0;
  2467. var numItems = 11;
  2468. var numColumns = 1;
  2469. var numItemsPerColumn = 11;
  2470. var alto = (Math.min(numItems, numItemsPerColumn)) * 15;
  2471. var ucd = getPreference("UCD", false);
  2472. if (typeof ucd == "undefined" || !ucd) {
  2473. alert("Es necesario que visite la pagina de AutoTour para poder votar desde aqui.");
  2474. return;
  2475. }
  2476. if (numItems > 0) {
  2477. GM_addStyle('#backgroundLayer { width: 100%; height: 100%; background-color: white; position: fixed; left: 0; right: 0; top: 0; bottom: 0; opacity: 0; }');
  2478. GM_addStyle('#panel_votacion { color: black; background-color: #FFF; text-align: center; border: 1px solid gray; width:auto; height: ' + alto + 'px; opacity: 1; position: absolute; left: 0; top: 0; overflow: auto; }');
  2479. GM_addStyle("#panel_votacion td.menu {border-top:1px solid #EEEEEE;background-color:#FFF;}");
  2480. GM_addStyle("#panel_votacion span.emptyItem {background-color: #FFF;}");
  2481. GM_addStyle('td.menu span.listItem {cursor:pointer;padding:1px 10px 1px 5px; color: black; background-color: #FFF; font-size: 9px; font-family: Verdana,Arial,Helvetica,sans-serif; text-decoration: none; text-indent: 3px; cursor: hand; display: block}');
  2482. GM_addStyle('td.menu span.listItem:hover {padding:1px 10px 1px 5px; color: #003366; background-color: #FFCC00; font-size: 9px; font-family: Verdana,Arial,Helvetica,sans-serif; text-decoration: none; text-indent: 3px; cursor: hand; display: block }');
  2483. GM_addStyle('td.menu span.delListItem {cursor:pointer;padding:1px 10px 1px 5px; color: black; background-color: #E0FFE0; font-size: 9px; font-family: Verdana,Arial,Helvetica,sans-serif; text-decoration: none; text-indent: 3px; cursor: hand; display: block}');
  2484. GM_addStyle('td.menu span.delListItem:hover {padding:1px 10px 1px 5px; color: #003366; background-color: #FF6666; font-size: 9px; font-family: Verdana,Arial,Helvetica,sans-serif; text-decoration: none; text-indent: 3px; cursor: hand; display: block }');
  2485. var background = d.createElement('DIV');
  2486. background.id = 'backgroundLayer';
  2487. d.body.appendChild(background);
  2488. var panel = d.createElement('DIV');
  2489. panel.id = 'panel_votacion';
  2490. var html = '<table width="auto" cellspacing="0" cellpadding="0" border="0" bgcolor="#415570" class="rmenu">';
  2491. html += '<tbody>';
  2492. for (var ix in puntuaciones) {
  2493. html += '<tr>';
  2494. var text = ((ix > 0) ? ix + ' - ' : '') + puntuaciones[ix];
  2495. var clase = ((ix == voto) ? 'delListItem' : 'listItem');
  2496. var id = "VOTO:" + pelicula + ":" + ix;
  2497. html += listItemTemplate.replace(/{ID}/g, id).replace(/{NAME}/g, text).replace(/{CLASS}/g, clase);
  2498. html += '</tr>';
  2499. }
  2500. html += '</tbody></table>';
  2501. panel.innerHTML = html;
  2502. var centro;
  2503. var left = e.clientX;
  2504. var top = e.clientY;
  2505. if (left + (ancho * numColumns + 2) > document.body.clientWidth) {
  2506. centro = (document.body.clientWidth / 2) - ((ancho * numColumns + 2) / 2);
  2507. left = Math.max(document.body.clientWidth - (ancho * numColumns + 2) - 10, centro);
  2508. }
  2509. if ((top + alto) > document.body.clientHeight) {
  2510. centro = (document.body.clientHeight / 2) - (alto / 2);
  2511. top = Math.max(document.body.clientHeight - (alto + 20), centro);
  2512. }
  2513. panel.style.left = left + document.body.scrollLeft;
  2514. panel.style.top = top + document.body.scrollTop;
  2515. d.body.appendChild(panel);
  2516. $id("backgroundLayer").addEventListener("click", hideVoteMenu, true);
  2517. for (ix in puntuaciones) {
  2518. id = "VOTO:" + pelicula + ":" + ix;
  2519. $id(id).addEventListener("click", function() {
  2520. doFilmVote(this.id, voto);
  2521. }, false);
  2522. }
  2523. } else {
  2524. alert("Error interno");
  2525. }
  2526. }
  2527. //
  2528. // añade el envento onClick a las celdas ultima-posicion de las filas en rows
  2529. //
  2530. function insertEventListeners(rows, posicion, skipStart, skipEnd) {
  2531. for (var i = skipStart; i < (rows.length - skipEnd); i++) {
  2532. var row = rows[i];
  2533. var celda = row.cells[row.cells.length - 1 - posicion];
  2534. celda.addEventListener("click", showVoteMenu, true);
  2535. }
  2536. }
  2537. function prepareTable_MyList() {
  2538. var filmsTable = "//b[text()='Tu voto']/ancestor::*[position()=4]".findNode();
  2539. for (var i = 1; i < filmsTable.rows.length - 2; i++) {
  2540. var row = filmsTable.rows[i];
  2541. var pelicula = "td/a[@class='posn']/@id".findNode(row).textContent.split('ch')[1];
  2542. var celda = row.cells[row.cells.length - 2];
  2543. celda.style.cursor = "pointer";
  2544. celda.id = pelicula + ":" + celda.textContent;
  2545. }
  2546. }
  2547. if (inSection('UserList')) {
  2548. if (getPreference('SHOWVOTESONFRIENDLISTS'))
  2549. insertEventListeners("//b[text()='Su voto']/ancestor::*[position()=4]".findNode().rows, 0, 1, 0);
  2550. } else if (inSection('Search')) {
  2551. if (getPreference('SHOWVOTESONFRIENDLISTS'))
  2552. insertEventListeners("//img[contains(@src,'countries')]/ancestor::*[position()=6]".findNodesArray(), 0, 0, 0);
  2553. } else if (inSection('MyList')) {
  2554. prepareTable_MyList();
  2555. insertEventListeners("//b[text()='Tu voto']/ancestor::*[position()=4]".findNode().rows, 1, 1, 1);
  2556. }
  2557. }
  2558. //Función que añade un link para vaciar la lista temporal
  2559. function doAddLinkEmptyWorkList(){
  2560. var nodo = '//a[contains(@href,"contact_us.php")]'.findNode();
  2561. //Panel de configuracion
  2562. var newlipn = d.createElement('li');
  2563. var newa2 = d.createElement('a');
  2564. newa2.textContent = "Panel de Configuración";
  2565. newa2.href = "#";
  2566. newa2.addEventListener("click",preferences, false);
  2567. newlipn.appendChild(newa2);
  2568. nodo.parentNode.parentNode.appendChild(newlipn);
  2569. var newli = d.createElement('li');
  2570. var newa = d.createElement('a');
  2571. newa.id = "vaciar-lista";
  2572. newa.textContent = "Vaciar lista temporal";
  2573. newa.href = "#vaciar-lista";
  2574. newa.addEventListener("click", vaciar_ltemp, true);
  2575. newli.appendChild(newa);
  2576. nodo.parentNode.parentNode.appendChild(newli);
  2577. function emptyWorkList(votos) {
  2578. var workList = getPreference("idltemp");
  2579. if (workList != 'none') {
  2580. var url = "http://www.filmaffinity.com/es/rcmlistmovies.php";
  2581. var data = "action=remove";
  2582. data += "&list_id=" + workList;
  2583. data += "&rc=js/esp.js";
  2584. for (var ix in votos) {
  2585. data += "&movie_ids[]=" + votos[ix].pelicula;
  2586. }
  2587. doPost(url, data, function (result) {
  2588. log("lista temporal vaciada");
  2589. });
  2590. }
  2591. }
  2592. function extractVotesFromList(div) {
  2593. //var nodos = "//img[contains(@src,'countries')]/parent::*/a".findNodesArray(div);
  2594. var nodos = "//div[@class='mc-title']/a".findNodesArray(div);
  2595. var votes = "//div[@class='rat-movie']".findNodesArray(div);
  2596. var votos = [];
  2597. for (var ix in nodos) {
  2598. var pelicula = nodos[ix].href.split("es/film")[1].split(".")[0];
  2599. //var temp = "ancestor::*[position()=10]".findNode(nodos[ix]);
  2600. //var voto = temp.parentNode.cells[temp.cellIndex + 1].textContent;
  2601. var voto = votes[ix].textContent;
  2602. votos.push({pelicula:pelicula,puntuacion:voto});
  2603. }
  2604. return votos;
  2605. }
  2606. function vaciar_ltemp(){
  2607. var myid = getUserId();
  2608. var list = getPreference("idltemp");
  2609. var url = "http://www.filmaffinity.com/es/userlist.php?user_id=" + myid + "&list_id=" + list;
  2610. doGet(url, function(response) {
  2611. response = response.replace("<img", "<omg"); // Para que no se ponga a cargar las peliculas
  2612. var emptydiv = document.createElement('div');
  2613. emptydiv.innerHTML = response;
  2614. var votos = extractVotesFromList(emptydiv);
  2615. v1 = votos.length;
  2616. // Borrar lista temporal
  2617. if(v1 > 0)
  2618. emptyWorkList(votos);
  2619. });
  2620. }
  2621. }
  2622. function doAddDataFromIMDB(){
  2623. function rellenarDesdeIMDB(){
  2624. var nodoi = "//input[@name='imdb_code']".findNode();
  2625. var codigoIMDB = nodoi.value;
  2626. var nodop = "//input[@name='otitle']".findNode();
  2627. if(codigoIMDB.length == 7 && nodop.value == ""){
  2628. // Metemos directores, reparto, fotografia y musica
  2629. url = "http://www.imdb.com/title/tt" + codigoIMDB + "/fullcredits";
  2630. doGet(url, function(response) {
  2631. response = response.replace("<img", "<omg"); // Para que no se ponga a cargar las peliculas
  2632. var emptydiv = document.createElement('div');
  2633. emptydiv.innerHTML = response;
  2634. var nododr = "//input[@name='director']".findNode();
  2635. var nododri = "//a[contains(@href,'ttfc_fc_dr')]".findNodesArray(emptydiv);
  2636. var directores = "";
  2637. if(nododri.length > 0){
  2638. for(i = 0; i < nododri.length; i++){
  2639. directores += nododri[i].textContent.substring(1, nododri[i].textContent.length-1);
  2640. if(i != nododri.length-1)
  2641. directores += ", ";
  2642. }
  2643. }
  2644. nododr.value = directores;
  2645. var nodogui1 = "//input[@name='script_en']".findNode();
  2646. var nodogui2 = "//input[@name='script_es']".findNode();
  2647. var nodoguii = "//a[contains(@href,'fc_wr')]".findNodesArray(emptydiv);
  2648. var aux1 = "", aux2 = "";
  2649. if(nodoguii.length > 0){
  2650. for(i = 0; i < nodoguii.length; i++){
  2651. var auxg = nodoguii[i].textContent.substring(1,nodoguii[i].textContent.length);
  2652. if(nodoguii[i].parentNode.parentNode.textContent.indexOf("novel") > 0)
  2653. aux2 += auxg + ", ";
  2654. else
  2655. aux1 += auxg + ", ";
  2656. }
  2657. nodogui1.value = aux1.substring(0, aux1.length-2);
  2658. nodogui2.value = aux1.substring(0, aux1.length-2);
  2659. if(aux2 != ""){
  2660. nodogui1.value += " (Novel: " + aux2.substring(0, aux2.length-2) + ")";
  2661. nodogui2.value += " (Novela: " + aux2.substring(0, aux2.length-2) + ")";
  2662. }
  2663. }
  2664. var nodorep = "//textarea[@name='cast']".findNode();
  2665. var nodorepi = "//td[@itemprop='actor']".findNodesArray(emptydiv);
  2666. var reparto = "";
  2667. if(nodorepi.length > 0){
  2668. for(i = 0; i < nodorepi.length && i < 12; i++){
  2669. reparto += nodorepi[i].childNodes[1].childNodes[1].textContent;
  2670. if(i != nodorepi.length-1 && i != 11)
  2671. reparto += ", ";
  2672. }
  2673. }
  2674. nodorep.value = reparto;
  2675. var nodofot = "//input[@name='photo']".findNode();
  2676. var nodofoti = "//h4[contains(text(),'Cinematography by')]".findNode(emptydiv);
  2677. var fotog = "";
  2678. if(nodofoti != undefined){
  2679. nodofoti = nodofoti.nextSibling.nextSibling.childNodes[3];
  2680. for(var i = 1; i < nodofoti.childNodes.length; i+=2){
  2681. fotog += nodofoti.childNodes[i].childNodes[1].childNodes[1].textContent.substring(1,nodofoti.childNodes[i].childNodes[1].childNodes[1].textContent.length-1);
  2682. if(i < nodofoti.childNodes.length-2)
  2683. fotog += ", ";
  2684. }
  2685. }
  2686. nodofot.value = fotog;
  2687. var nodomus1 = "//input[@name='music_en']".findNode();
  2688. var nodomus2 = "//input[@name='music_es']".findNode();
  2689. var nodomusi = "//h4[contains(text(),'Music by')]".findNode(emptydiv);
  2690. var music = "";
  2691. if(nodomusi != undefined){
  2692. nodomusi = nodomusi.nextSibling.nextSibling.childNodes[3];
  2693. for(var i = 1; i < nodomusi.childNodes.length; i+=2){
  2694. music += nodomusi.childNodes[i].childNodes[1].childNodes[1].textContent.substring(1,nodomusi.childNodes[i].childNodes[1].childNodes[1].textContent.length-1);
  2695. if(i < nodomusi.childNodes.length-2)
  2696. music += ", ";
  2697. }
  2698. }
  2699. nodomus1.value = music;
  2700. nodomus2.value = music;
  2701. });
  2702. // Metemos el resto (titulos, guion, año, duracion, sinopsis ingles, productora
  2703. url = "http://www.imdb.com/title/tt" + codigoIMDB;
  2704. doGet(url, function(response) {
  2705. response = response.replace("<img", "<omg"); // Para que no se ponga a cargar las peliculas
  2706. var emptydiv = document.createElement('div');
  2707. emptydiv.innerHTML = response;
  2708.  
  2709. var generos = "//a[contains(@href,'_stry_gnr')]".findNodesArray(emptydiv);
  2710. var paisi = "//a[contains(@href,'country/')]".findNode(emptydiv);
  2711. var pais = "//select[@name='country']".findNode();
  2712. if(paisi.textContent == "Spain")
  2713. pais.value = "ES";
  2714. else if(paisi.textContent == "Japan")
  2715. pais.value = "JP";
  2716. else if(paisi.textContent == "Germany")
  2717. pais.value = "DE";
  2718. else if(paisi.textContent == "UK")
  2719. pais.value = "GB";
  2720. else if(paisi.textContent == "Italy")
  2721. pais.value = "IT";
  2722. else if(paisi.textContent == "West Germany")
  2723. pais.value = "FF";
  2724. else if(paisi.textContent == "Afghanistan")
  2725. pais.value = "AF";
  2726. else if(paisi.textContent == "Argentina")
  2727. pais.value = "AR";
  2728. else if(paisi.textContent == "Austria")
  2729. pais.value = "AT";
  2730. else if(paisi.textContent == "Australia")
  2731. pais.value = "AU";
  2732. else if(paisi.textContent == "Belgium")
  2733. pais.value = "BE";
  2734. else if(paisi.textContent == "Belarus")
  2735. pais.value = "BY";
  2736. else if(paisi.textContent == "Bolivia")
  2737. pais.value = "BO";
  2738. else if(paisi.textContent == "Bosnia and Herzegovina")
  2739. pais.value = "BA";
  2740. else if(paisi.textContent == "Bulgaria")
  2741. pais.value = "BG";
  2742. else if(paisi.textContent == "Brazil")
  2743. pais.value = "BR";
  2744. else if(paisi.textContent == "Canada")
  2745. pais.value = "CA";
  2746. else if(paisi.textContent == "Czechoslovakia")
  2747. pais.value = "ZX";
  2748. else if(paisi.textContent == "Chile")
  2749. pais.value = "CL";
  2750. else if(paisi.textContent == "Czechoslovakia")
  2751. pais.value = "CN";
  2752. else if(paisi.textContent == "Colombia")
  2753. pais.value = "CO";
  2754. else if(paisi.textContent == "South Korea")
  2755. pais.value = "KR";
  2756. else if(paisi.textContent == "Croatia")
  2757. pais.value = "HR";
  2758. else if(paisi.textContent == "Cuba")
  2759. pais.value = "CU";
  2760. else if(paisi.textContent == "Denmark")
  2761. pais.value = "DK";
  2762. else if(paisi.textContent == "Ecuador")
  2763. pais.value = "EC";
  2764. else if(paisi.textContent == "Egypt")
  2765. pais.value = "EG";
  2766. else if(paisi.textContent == "Estonia")
  2767. pais.value = "EE";
  2768. else if(paisi.textContent == "Philippines")
  2769. pais.value = "PH";
  2770. else if(paisi.textContent == "Finland")
  2771. pais.value = "FI";
  2772. else if(paisi.textContent == "France")
  2773. pais.value = "FR";
  2774. else if(paisi.textContent == "Greece")
  2775. pais.value = "GR";
  2776. else if(paisi.textContent == "Hong Kong")
  2777. pais.value = "HK";
  2778. else if(paisi.textContent == "Hungary")
  2779. pais.value = "HU";
  2780. else if(paisi.textContent == "India")
  2781. pais.value = "IN";
  2782. else if(paisi.textContent == "Indonesia")
  2783. pais.value = "ID";
  2784. else if(paisi.textContent == "Iran")
  2785. pais.value = "IR";
  2786. else if(paisi.textContent == "Ireland")
  2787. pais.value = "IE";
  2788. else if(paisi.textContent == "Iceland")
  2789. pais.value = "IS";
  2790. else if(paisi.textContent == "Israel")
  2791. pais.value = "IL";
  2792. else if(paisi.textContent == "Lebanon")
  2793. pais.value = "LB";
  2794. else if(paisi.textContent == "Malaysia")
  2795. pais.value = "MY";
  2796. else if(paisi.textContent == "Morocco")
  2797. pais.value = "MA";
  2798. else if(paisi.textContent == "Mexico")
  2799. pais.value = "MX";
  2800. else if(paisi.textContent == "Mongolia")
  2801. pais.value = "MN";
  2802. else if(paisi.textContent == "Nicaragua")
  2803. pais.value = "NI";
  2804. else if(paisi.textContent == "Nigeria")
  2805. pais.value = "NG";
  2806. else if(paisi.textContent == "Norway")
  2807. pais.value = "NO";
  2808. else if(paisi.textContent == "New Zealand")
  2809. pais.value = "NZ";
  2810. else if(paisi.textContent == "Netherlands")
  2811. pais.value = "NL";
  2812. else if(paisi.textContent == "Paraguay")
  2813. pais.value = "PY";
  2814. else if(paisi.textContent == "Peru")
  2815. pais.value = "PE";
  2816. else if(paisi.textContent == "Poland")
  2817. pais.value = "PL";
  2818. else if(paisi.textContent == "Portugal")
  2819. pais.value = "PT";
  2820. else if(paisi.textContent == "Czech Republic")
  2821. pais.value = "CZ";
  2822. else if(paisi.textContent == "Romania")
  2823. pais.value = "RO";
  2824. else if(paisi.textContent == "Russia")
  2825. pais.value = "RU";
  2826. else if(paisi.textContent == "Serbia")
  2827. pais.value = "RS";
  2828. else if(paisi.textContent == "Serbia and Montenegro")
  2829. pais.value = "RR";
  2830. else if(paisi.textContent == "Singapore")
  2831. pais.value = "SG";
  2832. else if(paisi.textContent == "Sweden")
  2833. pais.value = "SE";
  2834. else if(paisi.textContent == "Switzerland")
  2835. pais.value = "CH";
  2836. else if(paisi.textContent == "Thailand")
  2837. pais.value = "TH";
  2838. else if(paisi.textContent == "Taiwan")
  2839. pais.value = "TW";
  2840. else if(paisi.textContent == "Turkey")
  2841. pais.value = "TR";
  2842. else if(paisi.textContent == "Ukraine")
  2843. pais.value = "UA";
  2844. else if(paisi.textContent == "Soviet Union")
  2845. pais.value = "ZY";
  2846. else if(paisi.textContent == "Uruguay")
  2847. pais.value = "UY";
  2848. else if(paisi.textContent == "Venezuela")
  2849. pais.value = "VE";
  2850. else if(paisi.textContent == "Vietnam")
  2851. pais.value = "VN";
  2852. else if(paisi.textContent == "Federal Republic of Yugoslavia")
  2853. pais.value = "YU";
  2854. var nodote = "//input[@name='title_es']".findNode();
  2855. var nodotei = "//title".findNode(emptydiv);
  2856. nodote.value = nodotei.textContent.split(" (")[0];
  2857. var nodoto = "//input[@name='otitle']".findNode();
  2858. var nodotoi = "//span[@class='title-extra']".findNode(emptydiv);
  2859. if(nodotoi != undefined)
  2860. nodoto.value = nodotoi.textContent.split("\"")[1];
  2861. else
  2862. nodoto.value = nodote.value;
  2863. var nododur = "//input[@name='runtime']".findNode();
  2864. var nododuri = "//time[@itemprop='duration']".findNode(emptydiv);
  2865. if(nododuri != undefined){
  2866. var duracion = nododuri.textContent.trim().split("min")[0];
  2867. nododur.value = duracion;
  2868. }
  2869. //Añadir generos
  2870. if("//td[contains(text(),'Series cast summary')]".findNode(emptydiv) != undefined){
  2871. javascript:addGenre('TV_SE');
  2872. nodote.value = nodote.value + " (Serie de TV)";
  2873. nodoto.value = nodoto.value + " (TV Series)";
  2874. }
  2875. var nodofot = "//input[@name='photo']".findNode();
  2876. var isAnim = false;
  2877. var isCom = false, isTer = false, isRom = false, isDr = false;
  2878. for(var ix in generos){
  2879. if(generos[ix].textContent.trim() == "Animation"){
  2880. nodofot.value = "Animation";
  2881. var nodorep = "//textarea[@name='cast']".findNode();
  2882. nodorep.value = "Animation";
  2883. javascript:addGenre('AN');
  2884. isAnim = true;
  2885. }
  2886. else if(generos[ix].textContent.trim() == "Documentary"){
  2887. var nodorep = "//textarea[@name='cast']".findNode();
  2888. nodorep.value = "Documentary, " + nodorep.value;
  2889. javascript:addGenre('DO');
  2890. }
  2891. else if(generos[ix].textContent.trim() == "Action")
  2892. javascript:addGenre('AC');
  2893. else if(generos[ix].textContent.trim() == "Adventure")
  2894. javascript:addGenre('AV');
  2895. else if(generos[ix].textContent.trim() == "War")
  2896. javascript:addGenre('BE');
  2897. else if(generos[ix].textContent.trim() == "Drama"){
  2898. javascript:addGenre('DR');
  2899. isDr = true;
  2900. }
  2901. else if(generos[ix].textContent.trim() == "Comedy"){
  2902. javascript:addGenre('CO');
  2903. isCom = true;
  2904. }
  2905. else if(generos[ix].textContent.trim() == "Fantasy")
  2906. javascript:addGenre('FAN');
  2907. else if(generos[ix].textContent.trim() == "Family")
  2908. javascript:addTopic('685184');
  2909. else if(generos[ix].textContent.trim() == "Film-Noir")
  2910. javascript:addGenre('F-N');
  2911. else if(generos[ix].textContent.trim() == "Mystery")
  2912. javascript:addGenre('INT');
  2913. else if(generos[ix].textContent.trim() == "Musical")
  2914. javascript:addGenre('MU');
  2915. else if(generos[ix].textContent.trim() == "Romance"){
  2916. javascript:addGenre('RO');
  2917. isRom = true;
  2918. }
  2919. else if(generos[ix].textContent.trim() == "Horror"){
  2920. javascript:addGenre('TE');
  2921. isTer = true;
  2922. }
  2923. else if(generos[ix].textContent.trim() == "Thriller")
  2924. javascript:addGenre('TH');
  2925. else if(generos[ix].textContent.trim() == "Western")
  2926. javascript:addGenre('WE');
  2927. else if(generos[ix].textContent.trim() == "Sci-Fi")
  2928. javascript:addGenre('C-F');
  2929. else if(generos[ix].textContent.trim() == "Crime")
  2930. javascript:addTopic('524594');
  2931. }
  2932. if(isCom && isTer)
  2933. javascript:addTopic('689483');
  2934. if(isCom && isRom)
  2935. javascript:addTopic('848078');
  2936. if(isCom && isDr)
  2937. javascript:addTopic('899776');
  2938. if(isDr && isRom)
  2939. javascript:addTopic('424086');
  2940. var color = "//h4[contains(text(),'Color:')]".findNode(emptydiv);
  2941. color = color.nextSibling.nextSibling;
  2942. if(color.textContent.indexOf("lack and White") > 0)
  2943. nodofot.value = nodofot.value + " (B&W)";
  2944. var mudo = "//h4[contains(text(),'Sound Mix:')]".findNode(emptydiv);
  2945. if(mudo != undefined){
  2946. mudo = mudo.nextSibling.nextSibling;
  2947. if(mudo.textContent.indexOf("ilent") > 0){
  2948. javascript:addTopic('728806');
  2949. var nodomus1 = "//input[@name='music_en']".findNode();
  2950. nodomus1.value = "Silent film";
  2951. var nodomus2 = "//input[@name='music_es']".findNode();
  2952. nodomus2.value = "Película muda";
  2953. }
  2954. }
  2955. if(isAnim && duracion <= 20)
  2956. javascript:addTopic('251997');
  2957. else if(!isAnim && duracion <= 20){
  2958. nodoto.value += " (S)";
  2959. nodote.value += " (C)";
  2960. javascript:addTopic('280405');
  2961. }
  2962. if(duracion < 60 && duracion > 20)
  2963. javascript:addTopic('180914');
  2964. var nodoteng = "//input[@name='title_en']".findNode();
  2965. var nodotengi = "//h4[contains(text(),'Also Known As')]".findNode(emptydiv);
  2966. if(nodotengi != undefined){
  2967. if(paisi.textContent == "Japan"){
  2968. nodoteng.value = nodotengi.nextSibling.textContent.substring(1,nodotengi.nextSibling.textContent.length-6);
  2969. nodote.value = nodoteng.value;
  2970. }
  2971. }
  2972. else
  2973. nodoteng.value = nodoto.value;
  2974. if(paisi.textContent == "UK" || paisi.textContent == "USA" || paisi.textContent == "Canada" || paisi.textContent == "Australia" || paisi.textContent == "Ireland" || paisi.textContent == "New Zealand")
  2975. nodoteng.value = nodoto.value;
  2976. var nodoanio = "//input[@name='year']".findNode();
  2977. var nodoanioi = "//title".findNode(emptydiv).textContent;
  2978. var anio = nodoanioi.split('(')[1].split(')')[0].split('–')[0];
  2979. if(anio.indexOf("eries") > 0)
  2980. anio = anio.split("es ")[1];
  2981. if(anio.indexOf("ideo") > 0)
  2982. anio = anio.split("ideo ")[1];
  2983. if(anio.indexOf("V Movie") > 0){
  2984. anio = anio.split("ovie ")[1];
  2985. javascript:addTopic('574004');
  2986. nodoto.value += " (TV)";
  2987. nodoteng.value += " (TV)";
  2988. nodote.value += " (TV)";
  2989. }
  2990. nodoanio.value = anio; //nodoanioi.substring(nodoanioi.length-12,nodoanioi.length-8);
  2991. if(nodoanio.value < 1915)
  2992. javascript:addTopic('898346');
  2993. var nodosyn = "//textarea[@name='synopsis_en']".findNode();
  2994. var nodosyni = "//div[@itemprop='description']/p".findNode(emptydiv);
  2995. if(nodosyni != undefined)
  2996. nodosyn.value = nodosyni.textContent.substring(1, nodosyni.textContent.length-1).split("Written b")[0];
  2997. var nodosyne = "//textarea[@name='synopsis_es']".findNode();
  2998. nodosyne.value = "(FILMAFFINITY)";
  2999. var nodoprd1 = "//input[@name='producer_en']".findNode();
  3000. var nodoprd2 = "//input[@name='producer_es']".findNode();
  3001. var nodosprdi = "//a[contains(@href,'/company/')]".findNodesArray(emptydiv);
  3002. var productores = "";
  3003. if(nodosprdi.length > 0){
  3004. for(i = 0; i < nodosprdi.length; i++){
  3005. productores += nodosprdi[i].childNodes[0].textContent;
  3006. if(i != nodosprdi.length-1)
  3007. productores += " / ";
  3008. }
  3009. }
  3010. nodoprd1.value = productores;
  3011. nodoprd2.value = productores;
  3012. });
  3013. url = "http://www.imdb.com/title/tt" + codigoIMDB + "/keywords";
  3014. doGet(url, function(response) {
  3015. response = response.replace("<img", "<omg"); // Para que no se ponga a cargar las peliculas
  3016. var emptydiv = document.createElement('div');
  3017. emptydiv.innerHTML = response;
  3018. var keywords = "//a[contains(@href,'ttkw_kw')]".findNodesArray(emptydiv);
  3019. var pais = "//select[@name='country']".findNode();
  3020. for(var ix in keywords){
  3021. if(keywords[ix].textContent == "3d")
  3022. javascript:addTopic('461156');
  3023. else if(keywords[ix].textContent == "sexual abuse")
  3024. javascript:addTopic('836459');
  3025. else if(keywords[ix].textContent == "bullying")
  3026. javascript:addTopic('791958');
  3027. else if(keywords[ix].textContent == "africa")
  3028. javascript:addTopic('644424');
  3029. else if(keywords[ix].textContent == "adult animation")
  3030. javascript:addTopic('470842');
  3031. else if(keywords[ix].textContent == "ancient greece")
  3032. javascript:addTopic('195438');
  3033. else if(keywords[ix].textContent == "ancient rome")
  3034. javascript:addTopic('414531');
  3035. else if(keywords[ix].textContent == "ancient egypt")
  3036. javascript:addTopic('246278');
  3037. else if(keywords[ix].textContent == "1900s")
  3038. javascript:addTopic('195379');
  3039. else if(keywords[ix].textContent == "1910s")
  3040. javascript:addTopic('168876');
  3041. else if(keywords[ix].textContent == "1920s")
  3042. javascript:addTopic('986798');
  3043. else if(keywords[ix].textContent == "1930s")
  3044. javascript:addTopic('751350');
  3045. else if(keywords[ix].textContent == "1940s")
  3046. javascript:addTopic('503186');
  3047. else if(keywords[ix].textContent == "1950s")
  3048. javascript:addTopic('306617');
  3049. else if(keywords[ix].textContent == "1960s")
  3050. javascript:addTopic('322214');
  3051. else if(keywords[ix].textContent == "1970s")
  3052. javascript:addTopic('499166');
  3053. else if(keywords[ix].textContent == "1980s")
  3054. javascript:addTopic('432971');
  3055. else if(keywords[ix].textContent == "1990s")
  3056. javascript:addTopic('853858');
  3057. else if(keywords[ix].textContent == "spider")
  3058. javascript:addTopic('969387');
  3059. else if(keywords[ix].textContent == "martial arts")
  3060. javascript:addTopic('458310');
  3061. else if(keywords[ix].textContent == "serial killer")
  3062. javascript:addTopic('299106');
  3063. else if(keywords[ix].textContent == "space travel")
  3064. javascript:addTopic('624971');
  3065. else if(keywords[ix].textContent == "blaxploitation")
  3066. javascript:addTopic('369866');
  3067. else if(keywords[ix].textContent == "boxing")
  3068. javascript:addTopic('667395');
  3069. else if(keywords[ix].textContent == "witchcraft")
  3070. javascript:addTopic('946896');
  3071. else if(keywords[ix].textContent == "haunted house")
  3072. javascript:addTopic('477313');
  3073. else if(keywords[ix].textContent == "film within a film")
  3074. javascript:addTopic('742444');
  3075. else if(keywords[ix].textContent == "experimental film")
  3076. javascript:addTopic('416484');
  3077. else if(keywords[ix].textContent == "independent film" && pais.value == "US")
  3078. javascript:addTopic('485586');
  3079. else if(keywords[ix].textContent == "clay animation")
  3080. javascript:addTopic('896486');
  3081. else if(keywords[ix].textContent == "absurd humor")
  3082. javascript:addTopic('586472');
  3083. else if(keywords[ix].textContent == "based on comic")
  3084. javascript:addTopic('725819');
  3085. else if(keywords[ix].textContent == "cyberpunk")
  3086. javascript:addTopic('874320');
  3087. else if(keywords[ix].textContent == "dc comics")
  3088. javascript:addTopic('549998');
  3089. else if(keywords[ix].textContent == "dinosaur")
  3090. javascript:addTopic('470603');
  3091. else if(keywords[ix].textContent == "dystopia")
  3092. javascript:addTopic('212308');
  3093. else if(keywords[ix].textContent == "doctor who")
  3094. javascript:addTopic('108082');
  3095. else if(keywords[ix].textContent == "erotica")
  3096. javascript:addTopic('848307');
  3097. else if(keywords[ix].textContent == "alien")
  3098. javascript:addTopic('191870');
  3099. else if(keywords[ix].textContent == "mockumentary")
  3100. javascript:addTopic('548806');
  3101. else if(keywords[ix].textContent == "post apocalypse")
  3102. javascript:addTopic('369658');
  3103. else if(keywords[ix].textContent == "giallo")
  3104. javascript:addTopic('150356');
  3105. else if(keywords[ix].textContent == "gore")
  3106. javascript:addTopic('696548');
  3107. else if(keywords[ix].textContent == "karate")
  3108. javascript:addTopic('490078');
  3109. else if(keywords[ix].textContent == "based on manga")
  3110. javascript:addTopic('912178');
  3111. else if(keywords[ix].textContent == "pirate")
  3112. javascript:addTopic('654286');
  3113. else if(keywords[ix].textContent == "sequel")
  3114. javascript:addTopic('638971');
  3115. else if(keywords[ix].textContent == "vampire")
  3116. javascript:addTopic('344682');
  3117. else if(keywords[ix].textContent == "revenge")
  3118. javascript:addTopic('326213');
  3119. else if(keywords[ix].textContent == "zombie")
  3120. javascript:addTopic('173777');
  3121. }
  3122. });
  3123. }
  3124. }
  3125. var nodop = "//input[@name='otitle']".findNode();
  3126. nodop.addEventListener('focus', rellenarDesdeIMDB, false);
  3127. }
  3128. function doChangeStyleReviews(){
  3129. var nodos = '//div[@class="review-text1"]'.findNodesArray();
  3130. var nodos2 = '//div[@class="rate-review"]'.findNodesArray();
  3131. for(var ix in nodos){
  3132. nodos[ix].style.padding = "10px 15px";
  3133. nodos[ix].style.margin = "10px 0px";
  3134. nodos[ix].style.color = "#201C1C";
  3135. nodos[ix].style.backgroundColor = "rgb(227, 229, 240)";
  3136. nodos[ix].style.boxShadow = "5px 5px 5px #888888";
  3137. nodos2[ix].style.marginTop = "-10px";
  3138. nodos2[ix].style.paddingBottom = "10px";
  3139. }
  3140. }
  3141. function doShowVote() {
  3142.  
  3143. function emptyWorkList(votos) {
  3144. var workList = getPreference("idltemp");
  3145. if (workList != 'none') {
  3146. var url = "http://www.filmaffinity.com/es/rcmlistmovies.php";
  3147. var data = "action=remove";
  3148. data += "&list_id=" + workList;
  3149. data += "&rc=js/esp.js";
  3150. for (var ix in votos) {
  3151. data += "&movie_ids[]=" + votos[ix].pelicula;
  3152. }
  3153. doPost(url, data, function (result) {
  3154. log("lista temporal vaciada");
  3155. });
  3156. }
  3157. }
  3158. function prepareTableUserList() {
  3159. var position = "//div[@class='rat-movie']".findNodesArray();
  3160. var ndiv = d.createElement('DIV');
  3161. for (n = 0; n < position.length; n++) {
  3162. position[n].previousSibling.previousSibling.style.cssText = 'width:612px !Important';
  3163. ndiv = d.createElement('DIV');
  3164. ndiv.innerHTML = "-";
  3165. ndiv.className = "rat-movie";
  3166. ndiv.style.backgroundColor = "#447CAD";
  3167. position[n].parentNode.appendChild(ndiv);
  3168. }
  3169. }
  3170. function injectVotes(votos, numero) {
  3171.  
  3172. function injectVotesUserList(votos) {
  3173. var nodosrat = "//div[@class='rat-movie']".findNodesArray();
  3174. for (ix in votos) {
  3175. var voto = votos[ix];
  3176. var aux = parseInt(ix)+1;
  3177. nodosrat[(ix*2)+1].innerHTML = voto.puntuacion;
  3178. }
  3179. }
  3180. function injectVotesSearch(votos, numero) {
  3181. var aux = 0;
  3182. var numaux = 0;
  3183. var cont = 0;
  3184. if(numero == 2)
  3185. aux = 50;
  3186. else if(numero == 3)
  3187. aux = 100;
  3188.  
  3189. var nodost = '//div[@class="sub-header-search"]'.findNode();
  3190. nodost.style.paddingTop = "10px";
  3191. var contens = "//div[@class='mc-info-container']".findNodesArray();
  3192. var is_firefox = navigator.userAgent.toLowerCase().indexOf('firefox/') > -1;
  3193. contens[0].parentNode.parentNode.parentNode.style.width = "795px";
  3194. for(var ix in votos) {
  3195. numaux = aux + cont;
  3196. contens[numaux].style.width = "675px";
  3197. var newd = d.createElement('div');
  3198. if(is_firefox)
  3199. newd.style.cssFloat = "right";
  3200. else
  3201. newd.style.float = "right";
  3202. var color1 = "", color2 = "";
  3203. if(votos[ix].puntuacion == "10"){
  3204. color1 = "#008B00";
  3205. color2 = "#DAEBDA";
  3206. }
  3207. else if(votos[ix].puntuacion == "9" || votos[ix].puntuacion == "8" || votos[ix].puntuacion == "7"){
  3208. color1 = "#00B200";
  3209. color2 = "#DAEBDA";
  3210. }
  3211. else if(votos[ix].puntuacion == "6" || votos[ix].puntuacion == "5" || votos[ix].puntuacion == "4"){
  3212. color1 = "#F2C522";
  3213. color2 = "#F6EECF";
  3214. }
  3215. else if(votos[ix].puntuacion == "3" || votos[ix].puntuacion == "2" || votos[ix].puntuacion == "1"){
  3216. color1 = "#FF0000";
  3217. color2 = "#FCDBDB";
  3218. }
  3219. //newd.style.background = "linear-gradient(to right, " + color2 + ", " + color1 + ", " + color1 + ", " + color1 + ", " + color2 + ")";
  3220. newd.style.backgroundColor = color1;
  3221. newd.style.fontSize = "25px";
  3222. newd.style.height = "111px";
  3223. newd.style.width = "55px";
  3224. if(votos[ix].puntuacion != "-")
  3225. newd.style.color = '#ffffff';
  3226. else
  3227. newd.style.color = '#4682B4';
  3228. newd.style.textAlign = "center";
  3229. newd.style.lineHeight = "111px";
  3230. newd.style.margin = "-6px 0px 0px 15px";
  3231. newd.textContent = votos[ix].puntuacion;
  3232. contens[numaux].parentNode.insertBefore(newd,contens[numaux]);
  3233. cont++;
  3234. }
  3235. }
  3236. function injectVotesAdvSearch(votos, numero) {
  3237. var aux = 0;
  3238. var numaux = 0;
  3239. var cont = 0;
  3240. if(numero == 2)
  3241. aux = 50;
  3242. else if(numero == 3)
  3243. aux = 100;
  3244. var contens = "//div[@class='mc-info-container']".findNodesArray();
  3245. var is_firefox = navigator.userAgent.toLowerCase().indexOf('firefox/') > -1;
  3246. contens[0].parentNode.parentNode.parentNode.style.width = "795px";
  3247. for(var ix in votos) {
  3248. numaux = aux + cont;
  3249. contens[numaux].style.width = "675px";
  3250. var newd = d.createElement('div');
  3251. if(is_firefox)
  3252. newd.style.cssFloat = "right";
  3253. else
  3254. newd.style.float = "right";
  3255. var color1 = "", color2 = "";
  3256. if(votos[ix].puntuacion == "10"){
  3257. color1 = "#008B00";
  3258. color2 = "#DAEBDA";
  3259. }
  3260. else if(votos[ix].puntuacion == "9" || votos[ix].puntuacion == "8" || votos[ix].puntuacion == "7"){
  3261. color1 = "#00B200";
  3262. color2 = "#DAEBDA";
  3263. }
  3264. else if(votos[ix].puntuacion == "6" || votos[ix].puntuacion == "5" || votos[ix].puntuacion == "4"){
  3265. color1 = "#F2C522";
  3266. color2 = "#F6EECF";
  3267. }
  3268. else if(votos[ix].puntuacion == "3" || votos[ix].puntuacion == "2" || votos[ix].puntuacion == "1"){
  3269. color1 = "#FF0000";
  3270. color2 = "#FCDBDB";
  3271. }
  3272. //newd.style.background = "linear-gradient(to right, " + color2 + ", " + color1 + ", " + color1 + ", " + color1 + ", " + color2 + ")";
  3273. newd.style.backgroundColor = color1;
  3274. newd.style.fontSize = "25px";
  3275. newd.style.height = "105px";
  3276. newd.style.width = "55px";
  3277. if(votos[ix].puntuacion != "-")
  3278. newd.style.color = '#ffffff';
  3279. else
  3280. newd.style.color = '#4682B4';
  3281. newd.style.textAlign = "center";
  3282. newd.style.lineHeight = "105px";
  3283. //newd.style.fontWeight = "bold";
  3284. newd.style.margin = "-5px 5px 0px 15px";
  3285. newd.textContent = votos[ix].puntuacion;
  3286. contens[numaux].parentNode.insertBefore(newd,contens[numaux]);
  3287. cont++;
  3288. }
  3289. }
  3290. function injectVotesUserRatings(votos, numero) {
  3291. var aux = 0;
  3292. var numaux = 0;
  3293. var cont = 0;
  3294. var nota = 0;
  3295. if(numero == 2)
  3296. aux = 50;
  3297. var contens = "//div[@class='user-ratings-movie-rating']".findNodesArray();
  3298. var is_firefox = navigator.userAgent.toLowerCase().indexOf('firefox/') > -1;
  3299. var puser = d.title.split("de ")[1].split("- Film")[0];
  3300. var ruser = '//span[@id="user-nick"]/a'.findNode().textContent;
  3301. for(var ix in votos) {
  3302. numaux = aux + cont;
  3303. nota = contens[numaux].childNodes[1].textContent;
  3304. var numnodos = contens[numaux].childNodes.length;
  3305. for(var i = 0; i < numnodos; i++)
  3306. contens[numaux].removeChild(contens[numaux].firstChild);
  3307. var color1 = "", color2 = "";
  3308. if(nota == "10")
  3309. color1 = "#008B00";
  3310. else if (nota == "9" || nota == "8" || nota == "7")
  3311. color1 = "#00B200";
  3312. else if (nota == "6" || nota == "5" || nota == "4")
  3313. color1 = "#F2C522";
  3314. else
  3315. color1 = "#FF0000";
  3316. if(votos[ix].puntuacion == "10")
  3317. color2 = "#008B00";
  3318. else if (votos[ix].puntuacion == "9" || votos[ix].puntuacion == "8" || votos[ix].puntuacion == "7")
  3319. color2 = "#00B200";
  3320. else if (votos[ix].puntuacion == "6" || votos[ix].puntuacion == "5" || votos[ix].puntuacion == "4")
  3321. color2 = "#F2C522";
  3322. else if (votos[ix].puntuacion == "3" || votos[ix].puntuacion == "2" || votos[ix].puntuacion == "1")
  3323. color2 = "#FF0000";
  3324. else
  3325. color2 = "#4682B4";
  3326. var txt = "";
  3327. txt += "<div style=\"color:#666666; font-size:16px; padding: 4px 0px;\">Votos</div>";
  3328. txt += "<div style=\"float:left; width:40px; height:40px; line-height:40px; margin: 5px 10px 10px 10px; color:white; font-weight:bold; font-size:150%; background-color: " + color1 + ";\" title=\"Voto de " + puser + "\">" + nota + "</div>";
  3329. txt += "<div style=\"float:right; width:40px; height:40px; line-height:40px; margin: 5px 10px 10px 10px; color:white; font-weight:bold; font-size:150%; background-color: " + color2 + ";\" title=\"Voto de " + ruser + "\">" + votos[ix].puntuacion + "</div>";
  3330. contens[numaux].innerHTML = txt;
  3331. cont++;
  3332. }
  3333. }
  3334. function injectVotesTopics(votos, numero){
  3335. var aux = 0;
  3336. var numaux = 0;
  3337. var cont = 0;
  3338. if(numero == 2)
  3339. aux = 50;
  3340. else if(numero == 3)
  3341. aux = 100;
  3342. var contens = "//div[@class='card']".findNodesArray();
  3343. var ltopics = "//span[@class='related-topics']".findNodesArray();
  3344. var urlact = location.href;
  3345. var is_firefox = navigator.userAgent.toLowerCase().indexOf('firefox/') > -1;
  3346. for(var ix in votos) {
  3347. numaux = aux + cont;
  3348. contens[numaux].style.width = "730px";
  3349. ltopics[numaux].style.marginRight = "85px";
  3350. var newd = d.createElement('div');
  3351.  
  3352. if(is_firefox)
  3353. newd.style.cssFloat = "right";
  3354. else
  3355. newd.style.float = "right";
  3356. newd.style.fontSize = "25px";
  3357. newd.style.height = "103px";
  3358. newd.style.lineHeight = "103px";
  3359. newd.style.width = "50px";
  3360. if(votos[ix].puntuacion != "-")
  3361. newd.style.color = '#ffffff';
  3362. else
  3363. newd.style.color = '#4682B4';
  3364. if(votos[ix].puntuacion == 10){
  3365. newd.style.backgroundColor = '#008B00';
  3366. newd.style.border = "1px solid #008B00";
  3367. }
  3368. else if(votos[ix].puntuacion == 9 || votos[ix].puntuacion == 8 || votos[ix].puntuacion == 7){
  3369. newd.style.backgroundColor = '#00B200';
  3370. newd.style.border = "1px solid #00B200";
  3371. }
  3372. else if(votos[ix].puntuacion == 6 || votos[ix].puntuacion == 5 || votos[ix].puntuacion == 4){
  3373. newd.style.backgroundColor = '#F2C522';
  3374. newd.style.border = "1px solid #F2C522";
  3375. }
  3376. else if(votos[ix].puntuacion == 3 || votos[ix].puntuacion == 2 || votos[ix].puntuacion == 1){
  3377. newd.style.backgroundColor = '#FF0000';
  3378. newd.style.border = "1px solid #FF0000";
  3379. }
  3380. newd.style.textAlign = "center";
  3381. newd.style.margin = "-5px 10px 0px 20px";
  3382. newd.textContent = votos[ix].puntuacion;
  3383. contens[numaux].parentNode.insertBefore(newd,contens[numaux]);
  3384. cont++;
  3385. }
  3386. }
  3387. if (inSection('UserList')) {
  3388. injectVotesUserList(votos);
  3389. } else if(inSection('Search')){
  3390. injectVotesSearch(votos, numero);
  3391. } else if(inSection('AdvSearch')){
  3392. injectVotesAdvSearch(votos, numero);
  3393. } else if(inSection('UserRatting')){
  3394. injectVotesUserRatings(votos, numero);
  3395. }
  3396. else {
  3397. injectVotesTopics(votos, numero);
  3398. }
  3399. }
  3400.  
  3401. function extractVotesFromList(div) {
  3402. //var nodos = "//img[contains(@src,'countries')]/parent::*/a".findNodesArray(div);
  3403. var nodos = "//div[@class='mc-title']/a".findNodesArray(div);
  3404. var votes = "//div[@class='rat-movie']".findNodesArray(div);
  3405. var votos = [];
  3406. for (var ix in nodos) {
  3407. var pelicula = nodos[ix].href.split("es/film")[1].split(".")[0];
  3408. //var temp = "ancestor::*[position()=10]".findNode(nodos[ix]);
  3409. //var voto = temp.parentNode.cells[temp.cellIndex + 1].textContent;
  3410. var voto = votes[ix].textContent;
  3411. votos.push({pelicula:pelicula,puntuacion:voto});
  3412. }
  3413. return votos;
  3414. }
  3415. function readVotes(list) {
  3416. var myid = getUserId();
  3417. var url1 = "http://www.filmaffinity.com/es/userlist.php?user_id=" + myid + "&list_id=" + list;
  3418. var url2 = "http://www.filmaffinity.com/es/userlist.php?user_id=" + myid + "&list_id=" + list + "&page=2";
  3419. if(inSection('Topics')){
  3420. var anchors = '//div[@class="title"]/a'.findNodesArray();
  3421. }
  3422. else {
  3423. var anchors = "//img[contains(@src,'countries')]/parent::*/a".findNodesArray();
  3424. }
  3425. var long = anchors.length;
  3426. var v1 = 0;
  3427. setTimeout(function(){
  3428. doGet(url1, function(response) {
  3429. response = response.replace("<img", "<omg"); // Para que no se ponga a cargar las peliculas
  3430. var emptydiv = document.createElement('div');
  3431. emptydiv.innerHTML = response;
  3432. var votos = extractVotesFromList(emptydiv);
  3433. v1 = votos.length;
  3434. // Borrar lista temporal
  3435. injectVotes(votos);
  3436. emptyWorkList(votos);
  3437. });
  3438. if(long > 50){
  3439. doGet(url2, function(response) {
  3440. response = response.replace("<img", "<omg"); // Para que no se ponga a cargar las peliculas
  3441. var emptydiv = document.createElement('div');
  3442. emptydiv.innerHTML = response;
  3443. var votos = extractVotesFromList(emptydiv);
  3444. // Borrar lista temporal
  3445. injectVotes(votos, 2);
  3446. emptyWorkList(votos);
  3447. });
  3448. }
  3449. }, 550);
  3450. }
  3451. var workList = getPreference("idltemp");
  3452. var url = "http://www.filmaffinity.com/es/rcmlistmovies.php";
  3453. if(inSection('Topics')){
  3454. var anchors = '//div[@class="title"]/a'.findNodesArray();
  3455. }
  3456. else {
  3457. var anchors = "//img[contains(@src,'countries')]/parent::*/a".findNodesArray();
  3458. }
  3459. if(inSection('UserList')){
  3460. prepareTableUserList();
  3461. }
  3462. if (anchors.length > 0) {
  3463. var data = "action=copy";
  3464. data += "&list_id2=" + workList;
  3465. data += "&list_id=1001";
  3466. data += "&rc=js/esp.js";
  3467. for (var ix in anchors) {
  3468. data += "&movie_ids[]=" + anchors[ix].href.split("es/film")[1].split(".")[0];
  3469. }
  3470. doPost(url, data, function (result) {
  3471. readVotes(workList);
  3472. //log(result);
  3473. /*if (notEmpty(workList, result)) {
  3474. resetWorkList(url, data, workList);
  3475. } else {
  3476. readVotes(workList);
  3477. }*/
  3478. });
  3479.  
  3480. }
  3481. }
  3482. // Funcion que crea los botones para cambiar de año en las categorias de los premios
  3483. function doButtonAwards() {
  3484. if(url.indexOf('cat_id') != -1){
  3485. var nodo = '//h1[@id="main-title"]'.findNode();
  3486. var div1 = d.createElement('div');
  3487. var anio = url.split('ear=')[1].split('&')[0];
  3488. var txt1 = "";
  3489. txt1 += "<a href=\"" + url.split('ear=')[0] + "ear=" + (anio-1) + url.split(anio)[1] + "\">" + (anio - 1) + "</a>&nbsp;&nbsp;<<";
  3490. div1.innerHTML = txt1;
  3491. div1.style.padding = "9px";
  3492. div1.style.paddingBottom = "0px";
  3493. div1.style.float = "left";
  3494. div1.style.fontSize = "15px";
  3495. nodo.parentNode.insertBefore(div1, nodo);
  3496. var div2 = d.createElement('div');
  3497. var txt2 = "";
  3498. var anio2 = parseInt(anio)+1;
  3499. txt2 = "&nbsp;<<&nbsp;&nbsp;<a href=\"" + url.split('ear=')[0] + "ear=" + anio2 + url.split(anio)[1] + "\">" + anio2 + "</a>";
  3500. div2.innerHTML = txt2;
  3501. div2.style.padding = "10px";
  3502. div2.style.paddingBottom = "0px";
  3503. div2.style.float = "float";
  3504. div2.style.fontSize = "15px";
  3505. nodo.parentNode.insertBefore(div2, nodo.nextSibling);
  3506. nodo.style.float = "left";
  3507. }
  3508. }
  3509. //Fin de nuestros votos en listas de otros
  3510. //Función para añadir películas a listas mediente un enlace
  3511. function doQuickList() {
  3512. function hideQuickListPanel() {
  3513. d.body.removeChild($id('panel_listas'));
  3514. d.body.removeChild($id('backgroundLayer'));
  3515. }
  3516. function getNumOfLists() {
  3517. var anchorTr = "//div/b[text()='LISTAS']/ancestor::*[position()=3]".findNode();
  3518. if (anchorTr.parentNode.rows.length == 2) {
  3519. return 0;
  3520. } else {
  3521. var texto = anchorTr.parentNode.rows[1].firstChild.textContent;
  3522. return parseInt(texto.split(" en ")[1].split(" de ")[0]);
  3523. }
  3524. }
  3525. function updateListCount(delta) {
  3526. var comentario = "Esta película se encuentra en <b>{NUM}</b> de tus listas.";
  3527. var actual = getNumOfLists();
  3528. var nuevo = actual + delta;
  3529. var nodo;
  3530. var texto = "";
  3531. var anchorTr = "//div/b[text()='LISTAS']/ancestor::*[position()=3]".findNode();
  3532. if (actual == 0) {
  3533. var nodoTr = d.createElement("TR");
  3534. var nodoTd = d.createElement('TD');
  3535. nodoTd.align = "center";
  3536. nodoTd.innerHTML = "nbsp;";
  3537. nodoTr.appendChild(nodoTd);
  3538. anchorTr.parentNode.insertBefore(nodoTr, anchorTr.nextSibling);
  3539. }
  3540. if (nuevo > 0) {
  3541. texto = comentario.replace(/{NUM}/g, nuevo);
  3542. nodo = anchorTr.parentNode.rows[1].cells[0];
  3543. nodo.innerHTML = texto;
  3544. } else {
  3545. anchorTr.parentNode.removeChild(anchorTr.parentNode.rows[1]);
  3546. }
  3547. }
  3548. function doAddFilmToList(film, list) {
  3549. var nodo = $id(list);
  3550. var remove = false;
  3551. if (nodo.className == "delListItem") {
  3552. if (confirm("¿Desea eliminar la pelicula de esta lista?")) {
  3553. remove = true;
  3554. } else {
  3555. hideQuickListPanel();
  3556. return;
  3557. }
  3558. }
  3559. var url = "http://www.filmaffinity.com/es/edtmovielists.php?movie_id=";
  3560. url += film + "&rp=/favicon.ico";
  3561. $id("backgroundLayer").removeEventListener("click", hideQuickListPanel, true);
  3562. hideQuickListPanel();
  3563. log("url: " + url);
  3564. log("añadir: " + !remove);
  3565. var estado = document.body.style.cursor;
  3566. document.body.style.cursor = 'wait';
  3567. doPost(url, (!remove ? "atl" : "rfl") + "[]=" + list, function(result) {
  3568. log("Datos enviados con exito");
  3569. log("resultado: " + result.length);
  3570. log("resultado: " + result);
  3571. //hideQuickListPanel();
  3572. if (inSection('Film')) {
  3573. updateListCount(remove ? -1 : 1);
  3574. }
  3575. });
  3576. document.body.style.cursor = estado;
  3577. }
  3578. // TODO: esto seria "//input[@name='rfl[]']/@value".findNodeArray(emptydiv)
  3579. function extractFilmLists(emptydiv) {
  3580. var xpath = "//input[@name='rfl[]']/@value";
  3581. var iterator = findNodes(emptydiv, xpath);
  3582. var nodo;
  3583. var lists = [];
  3584. while ((nodo = iterator.iterateNext()) != null) {
  3585. lists.push(nodo.value);
  3586. }
  3587. return lists;
  3588. }
  3589. function readLists(id) {
  3590. var url = "http://www.filmaffinity.com/es/edtmovielists.php?movie_id=" + id;
  3591. doGet(url, function(response) {
  3592. response = response.replace("<img", "<omg");
  3593. var emptydiv = document.createElement('div');
  3594. emptydiv.innerHTML = response;
  3595. var listas = extractFilmLists(emptydiv);
  3596. for (ix in listas) {
  3597. var lista = listas[ix];
  3598. var nodo = $id(lista);
  3599. if (typeof nodo != "undefined") {
  3600. //nodo.style.backgroundColor = "#E0FFE0";
  3601. nodo.className = "delListItem";
  3602. }
  3603. }
  3604. });
  3605. }
  3606. function openQuickListPanel(e) {
  3607. var listItemTemplate = '<td class="menu"><span class="listItem" id="{ID}" href="#">{NAME}</span></td>';
  3608. var ancho = 320;
  3609. var pelicula = this.id;
  3610. //Obtenemos las listas desde la configuración
  3611. var listas = getValues(userId + ".list.");
  3612. listas.sort(function(a, b) {
  3613. return a - b;
  3614. });
  3615. // Por si queremos simular mas listas
  3616. //for (n=1;n<63;n++) listas.push(listas[0]);
  3617. log("Nº de listas:" + listas.length);
  3618. var numItems = listas.length;
  3619. var maxItemsPerColumn = Math.floor((document.body.clientHeight * 0.75) / 14);
  3620. var numColumns = Math.ceil(numItems / maxItemsPerColumn);
  3621. var numItemsPerColumn = Math.ceil(numItems / numColumns);
  3622. var alto = (Math.min(numItems, numItemsPerColumn)) * 15;
  3623. var id;
  3624. if (numItems > 0) {
  3625. GM_addStyle('#backgroundLayer { width: 100%; height: 100%; background-color: white; position: fixed; left: 0; right: 0; top: 0; bottom: 0; opacity: 0; }');
  3626. GM_addStyle('#panel_listas { color: black; background-color: #FFF; text-align: center; border: 1px solid gray; width:auto; height: ' + alto + 'px; opacity: 1; position: absolute; left: 0; top: 0; overflow: auto; }');
  3627. GM_addStyle("#panel_listas td.menu {border-top:1px solid #EEEEEE;background-color:#FFF;}");
  3628. GM_addStyle("#panel_listas span.emptyItem {background-color: #FFF;}");
  3629. GM_addStyle('td.menu span.listItem {cursor:pointer;padding:1px 10px 1px 5px; color: black; background-color: #FFF; font-size: 9px; font-family: Verdana,Arial,Helvetica,sans-serif; text-decoration: none; text-indent: 3px; cursor: hand; display: block}');
  3630. GM_addStyle('td.menu span.listItem:hover {padding:1px 10px 1px 5px; color: #003366; background-color: #FFCC00; font-size: 9px; font-family: Verdana,Arial,Helvetica,sans-serif; text-decoration: none; text-indent: 3px; cursor: hand; display: block }');
  3631. GM_addStyle('td.menu span.delListItem {cursor:pointer;padding:1px 10px 1px 5px; color: black; background-color: #E0FFE0; font-size: 9px; font-family: Verdana,Arial,Helvetica,sans-serif; text-decoration: none; text-indent: 3px; cursor: hand; display: block}');
  3632. GM_addStyle('td.menu span.delListItem:hover {padding:1px 10px 1px 5px; color: #003366; background-color: #FF6666; font-size: 9px; font-family: Verdana,Arial,Helvetica,sans-serif; text-decoration: none; text-indent: 3px; cursor: hand; display: block }');
  3633. var background = d.createElement('DIV');
  3634. background.id = 'backgroundLayer';
  3635. d.body.appendChild(background);
  3636. var panel = d.createElement('DIV');
  3637. panel.id = 'panel_listas';
  3638. var html = '<table width="auto" cellspacing="0" cellpadding="0" border="0" bgcolor="#415570" class="rmenu">';
  3639. html += '<tbody>';
  3640. for (var row = 0; row < numItemsPerColumn; row++) {
  3641. html += '<tr>';
  3642. for (var col = 0; col < numColumns; col++) {
  3643. var i = (numItemsPerColumn * col) + row;
  3644. if (i < numItems) {
  3645. id = listas[i];
  3646. var name = GM_getValue(userId + '.list.' + listas[i]);
  3647. html += listItemTemplate.replace(/{ID}/g, id).replace(/{NAME}/g, name);
  3648. } else {
  3649. html += '<td class="menu"><span class="emptyItem" style="background-color:#FFF;">&nbsp;</span></td>';
  3650. }
  3651. }
  3652. html += '</tr>';
  3653. }
  3654. html += '</tbody></table>';
  3655. panel.innerHTML = html;
  3656. var centro;
  3657. var left = e.clientX;
  3658. var top = e.clientY;
  3659. if (left + (ancho * numColumns + 2) > document.body.clientWidth) {
  3660. centro = (document.body.clientWidth / 2) - ((ancho * numColumns + 2) / 2);
  3661. left = Math.max(document.body.clientWidth - (ancho * numColumns + 2) - 10, centro);
  3662. }
  3663. if ((top + alto) > document.body.clientHeight) {
  3664. centro = (document.body.clientHeight / 2) - (alto / 2);
  3665. top = Math.max(document.body.clientHeight - (alto + 20), centro);
  3666. }
  3667. panel.style.left = left + document.body.scrollLeft;
  3668. panel.style.top = top + document.body.scrollTop;
  3669. d.body.appendChild(panel);
  3670. $id("backgroundLayer").addEventListener("click", hideQuickListPanel, true);
  3671. for (i = 0; i < listas.length; i++) {
  3672. id = listas[i];
  3673. $id(id).addEventListener("click", function() {
  3674. log('Seleccionada lista: ' + this.id + " nombre: " + this.textContent);
  3675. doAddFilmToList(pelicula, this.id);
  3676. }, false);
  3677. }
  3678. if (getPreference('FETCHFILMLISTS', false)) readLists(pelicula);
  3679. } else {
  3680. alert("Visite primero la página MIS LISTAS");
  3681. }
  3682. return false;
  3683. }
  3684. function createButtonNode(pelicula) {
  3685. var button = d.createElement('IMG');
  3686. button.className = 'addToList';
  3687. button.src = img_plus;
  3688. button.alt = "Añadir pelicula a listas";
  3689. button.id = pelicula;
  3690. button.addEventListener("click", openQuickListPanel, false);
  3691. return button;
  3692. }
  3693. // Añade el icono de añadir a listas rapidas en las listas de peliculas
  3694. function addQuickListSearch() {
  3695. GM_addStyle('.addToList {margin-left:5px;cursor:pointer;width:12px;height:12px;}');
  3696. var anchors = getElementsByClassName(d, 'a', 'addl');
  3697. var posic = getElementsByClassName(d, 'div', 'mc-title');
  3698. for (var i = 0; i < anchors.length; i++) {
  3699. var anchor = anchors[i];
  3700. if (anchor.textContent.indexOf('a listas') >= 0) {
  3701. var pelicula = anchor.href.split('=')[1].split('&')[0];
  3702. posic[i].appendChild(createButtonNode(pelicula));
  3703. }
  3704. }
  3705. }
  3706. function addQuickListList() {
  3707. GM_addStyle('.addToList {margin-left:5px;cursor:pointer;width:12px;height:12px;}');
  3708. var anchors = "//img[contains(@src,'countries')]/parent::*/b/a".findNodesArray();
  3709. for (var ix in anchors) {
  3710. var pelicula = anchors[ix].href.split("es/film")[1].split(".")[0];
  3711. anchors[ix].parentNode.parentNode.appendChild(createButtonNode(pelicula));
  3712. }
  3713. }
  3714. // Añade el enlace a listas rapidas en la ficha de la pelicula
  3715. function addQuickListFilm() {
  3716. GM_addStyle('.addToList {margin-left:5px;cursor:pointer;width:12px;height:12px;}');
  3717. var pelicula = document.location.href.split('/film')[1].split('.')[0];
  3718. anchor = '//dt[text()="Título original"]/following-sibling::*'.findNode();
  3719. if (anchor != null) {
  3720. anchor.appendChild(createButtonNode(pelicula));
  3721. }
  3722. }
  3723. if (inSection('Film')) addQuickListFilm(); else
  3724. if (inSection('MyList') || inSection('UserList')) addQuickListList(); else addQuickListSearch();
  3725. }
  3726.  
  3727. function doAddMediaInLists(){
  3728. function afinidades_milista(){
  3729. var username = '//span[@id="user-nick"]'.findNode().textContent;
  3730. var notasfa = '//img[contains(@src, "com/imgs/ratings/")]'.findNodesArray();
  3731. var notaspl = '//div[@class="rat-movie"]'.findNodesArray();
  3732. //Variables para los cálculos
  3733. var snotasul = 0;
  3734. var snotasfa = 0;
  3735. var pvistasul = 0;
  3736. var mediauser;
  3737. var hacer_todo = false;
  3738. var afinidad = 0.00;
  3739. var n1 = 0;
  3740. var n2 = 0;
  3741. var dif = 0;
  3742. var coincfa = 0;
  3743. if(notaspl.length == notasfa.length)
  3744. hacer_todo = true;
  3745. var nodoTit = '//h1[@id="main-title"]'.findNode();
  3746. var tituloaux = nodoTit.textContent.split(':');
  3747. var titulo = "";
  3748. if(tituloaux.length > 2)
  3749. for(i = 1; i < tituloaux.length ; i++)
  3750. titulo += tituloaux[i];
  3751. else
  3752. titulo = tituloaux[1];
  3753. var anchotabla = titulo.length;
  3754. var nodob = '//div[@id="total-movies"]/span'.findNode();
  3755. var pvistasfa = 0;
  3756. var peliculas = nodob.textContent;
  3757. peliculas = parseInt(peliculas);
  3758. if(d.URL.indexOf("page=") > -1){
  3759. titulo += " - " + d.URL.split("page=")[1] + "/" + Math.ceil(peliculas/50);
  3760. anchotabla += 7;
  3761. }
  3762. for(i=0; i < notaspl.length; i++){
  3763. if(notaspl[i].textContent != "-"){
  3764. n1 = parseInt(notaspl[i].textContent);
  3765. snotasul += n1;
  3766. pvistasul++;
  3767. if(hacer_todo){
  3768. n2 = notasfa[i].src.split('/')[5].split('.')[0];
  3769. if(n2 > n1)
  3770. dif += 90 - (n2*10 - n1*10)*1.5;
  3771. else if(n1 > n2)
  3772. dif += 90 - (n1*10 - n2*10)*1.5;
  3773. else {
  3774. dif += 100;
  3775. coincfa++;
  3776. }
  3777. }
  3778. }
  3779. }
  3780. for(j=0; j < notasfa.length; j++){
  3781. var auxnotasfa = notasfa[j].src.split('/')[5].split('.')[0];
  3782. snotasfa += parseInt(auxnotasfa);
  3783. pvistasfa++;
  3784. }
  3785. if(pvistasul == 0)
  3786. mediauser = "-,--";
  3787. else {
  3788. mediauser = snotasul/parseInt(pvistasul);
  3789. mediauser = mediauser.toFixed(2);
  3790. mediauser = mediauser.replace('.',',');
  3791. }
  3792. var mediafa = snotasfa/parseInt(pvistasfa);
  3793. mediafa = mediafa.toFixed(2);
  3794. mediafa = mediafa.replace('.',',');
  3795. if(hacer_todo){
  3796. if(pvistasul > 0){
  3797. afinidad = dif/pvistasul;
  3798. afinidad = (afinidad.toFixed(2)).replace('.',',');
  3799. }
  3800. else
  3801. afinidad = "-,--";
  3802. }
  3803. if(anchotabla < 35)
  3804. anchotabla = 35;
  3805. var newdiv = d.createElement('div');
  3806. newdiv.style.align = "center";
  3807. newdiv.id = "tabla-afinidades";
  3808. var txt = "";
  3809. txt += '<td bgcolor="#ffffff" colspan="4" align="center"><br/><table align="center" bgcolor="#dcdcdc" width="' + anchotabla*7 + '">';
  3810. txt += '<tr><th height="30" colspan = "2" align="center" bgcolor="#3C6E99"><font color="#ffffff">' + titulo + '</font></th></tr>';
  3811. txt += '<tr><td align="left">Media <b>' + username + '</b>: </td><td align="right">' + mediauser + '</td></tr>';
  3812. txt += '<tr><td width="200" align="left">Media <b>FA</b>: </td><td width="80" align="right">' + mediafa + '</td></tr>';
  3813. if(hacer_todo){
  3814. txt += '<tr><td width="*" align="left">Afinidad con <b>FA</b>: </td><td align="right">' + afinidad + ' %</td></tr>';
  3815. txt += '<tr><td width="*" align="left">Coincidencias con <b>FA</b>: </td><td align="right">' + coincfa + '/' + pvistasul + '</td></tr>';
  3816. }
  3817. txt += '</table></td>';
  3818. newdiv.innerHTML = txt;
  3819. nodoTit.parentNode.appendChild(newdiv);
  3820. }//Fin de afinidades en listas propias
  3821. function afinidades_lista_otro(){
  3822. var username = '//span[@id="user-nick"]'.findNode().textContent;
  3823. var notasfa = '//img[contains(@src, "com/imgs/ratings/")]'.findNodesArray();
  3824. var notaspl = '//div[@class="rat-movie"]'.findNodesArray();
  3825. //Variables para los cálculos
  3826. var snotasul = 0;
  3827. var snotasfa = 0;
  3828. var pvistasul = 0;
  3829. var mediauser;
  3830. var hacer_todo = false;
  3831. var afinidad = 0.00;
  3832. var n1 = 0;
  3833. var n2 = 0;
  3834. var dif = 0;
  3835. var coincfa = 0;
  3836. var peliculas = parseInt('//div[@class="movie-count"]'.findNode().textContent.split(':')[1]);
  3837. if(peliculas == notasfa.length)
  3838. hacer_todo = true;
  3839. var userlist = '//div[@class="user-nick-wrapper"]/h2'.findNode().textContent;
  3840. var nodoTit = '//div[@class="user-title-sec"]'.findNode();
  3841. var tituloaux = nodoTit.textContent.split(':');
  3842. var titulo = "";
  3843. if(tituloaux.length > 2)
  3844. for(i = 1; i < tituloaux.length ; i++)
  3845. titulo += tituloaux[i];
  3846. else
  3847. titulo = tituloaux[1];
  3848. var anchotabla = titulo.length;
  3849. //Distintas variables para las sumas y los cálculos
  3850. var snotasv = 0;
  3851. var pvistasv = 0;
  3852. var pvistasc = 0;
  3853. var afinidad2 = 0.00;
  3854. var afinidad3 = 0.00;
  3855. var mediauser2;
  3856. var n3 = 0;
  3857. var difu = 0;
  3858. var dif3 = 0;
  3859. var coincfau = 0;
  3860. var coinc3 = 0;
  3861. var entro1 = false;
  3862. var entro2 = false;
  3863. var notasu = '//div[@class="rat-movie"]'.findNodesArray();
  3864. var i = 0, j = 0;
  3865. while(i < notaspl.length){
  3866. entro1 = false;
  3867. entro2 = false;
  3868. //Primero para el autor de la lista
  3869. if(notaspl[i].textContent != "-"){
  3870. entro1 = true;
  3871. n1 = parseInt(notaspl[i].textContent);
  3872. snotasul += n1;
  3873. pvistasul++;
  3874. if(hacer_todo){
  3875. n2 = notasfa[j].src.split('/')[5].split('.')[0];
  3876. if(n2 > n1)
  3877. dif += 90 - (n2*10 - n1*10)*1.5;
  3878. else if(n1 > n2)
  3879. dif += 90 - (n1*10 - n2*10)*1.5;
  3880. else {
  3881. dif += 100;
  3882. coincfa++;
  3883. }//else
  3884. }//if
  3885. }//if
  3886. i++;
  3887. //Luego para el visitante de la lista
  3888. if(notaspl[i].textContent != "-"){
  3889. entro2 = true;
  3890. n3 = parseInt(notaspl[i].textContent);
  3891. snotasv += n3;
  3892. pvistasv++;
  3893. if(hacer_todo){
  3894. if(n2 > n3)
  3895. difu += 90 - (n2*10 - n3*10)*1.5;
  3896. else if(n3 > n2)
  3897. difu += 90 - (n3*10 - n2*10)*1.5;
  3898. else {
  3899. difu += 100;
  3900. coincfau++;
  3901. }//else
  3902. }//if
  3903. }//if
  3904. i++;
  3905. j++;
  3906. //Si los dos la han votado
  3907. if(entro1 && entro2){
  3908. pvistasc++;
  3909. if(n1 > n3)
  3910. dif3 += 90 - (n1*10 - n3*10)*1.5;
  3911. else if(n3 > n1)
  3912. dif3 += 90 - (n3*10 - n1*10)*1.5;
  3913. else {
  3914. dif3 += 100;
  3915. coinc3++;
  3916. }
  3917. }
  3918. }
  3919. for(j=0; j < notasfa.length; j++){
  3920. var auxnotasfa = notasfa[j].src.split('/')[5].split('.')[0];
  3921. snotasfa += parseInt(auxnotasfa);
  3922. }
  3923. if(pvistasul == 0)
  3924. mediauser = "-,--";
  3925. else {
  3926. mediauser = snotasul/parseInt(pvistasul);
  3927. mediauser = mediauser.toFixed(2);
  3928. mediauser = mediauser.replace('.',',');
  3929. }
  3930. if(pvistasv == 0)
  3931. mediauser2 = "-,--";
  3932. else {
  3933. mediauser2 = snotasv/parseInt(pvistasv);
  3934. mediauser2 = mediauser2.toFixed(2);
  3935. mediauser2 = mediauser2.replace('.',',');
  3936. }
  3937. var mediafa = snotasfa/parseInt(notasfa.length);
  3938. mediafa = mediafa.toFixed(2);
  3939. mediafa = mediafa.replace('.',',');
  3940. if(hacer_todo){
  3941. if(pvistasul == 0)
  3942. afinidad = "-,--";
  3943. else {
  3944. afinidad = dif/pvistasul;
  3945. afinidad = (afinidad.toFixed(2)).replace('.',',');
  3946. }
  3947. if(pvistasv == 0)
  3948. afinidad2 = "-,--";
  3949. else {
  3950. afinidad2 = difu/pvistasv;
  3951. afinidad2 = (afinidad2.toFixed(2)).replace('.',',');
  3952. }
  3953. if(pvistasc == 0)
  3954. afinidad3 = "-,--";
  3955. else {
  3956. afinidad3 = dif3/pvistasc;
  3957. afinidad3 = (afinidad3.toFixed(2)).replace('.',',');
  3958. }
  3959. }
  3960. var long1 = username.length + userlist.length;
  3961. var long2 = (long1*10)+15;
  3962. if(anchotabla < 35)
  3963. anchotabla = 35;
  3964. var newdiv = d.createElement('div');
  3965. newdiv.style.align = "center";
  3966. var txt = "";
  3967. txt += '<td bgcolor="#ffffff" colspan="4" align="center"><br/><table align="center" bgcolor="#dcdcdc" width="' + anchotabla*7 + '">';
  3968. txt += '<tr><th height="30" colspan = "2" align="center" bgcolor="#5FACF3"><font color="#ffffff">' + titulo + '</font></th></tr>';
  3969. txt += '<tr><td height="18" bgcolor="#4169E1" colspan="2" align="center"><font color="#FFD700"><b>Media</b></font></td></tr>';
  3970. txt += '<tr><td width="*" align="center"><b>' + username + '</b></td><td align="right">' + mediauser2 + '</td></tr>';
  3971. txt += '<tr><td width="*" align="center"><b>' + userlist + '</b></td><td align="right">' + mediauser + '</td></tr>';
  3972. txt += '<tr><td width="*" align="center"><b>FA</b></td><td align="right">' + mediafa + '</td></tr>';
  3973. if(hacer_todo){
  3974. txt += '<tr><td height="18" bgcolor="#4169E1" colspan="2" align="center"><font color="#FFD700"><b>Afinidades</b></font></td></tr>';
  3975. txt += '<tr><td width="*" align="center"><b>' + username + '</b> <-> <b>FA</b></td><td align="right">' + afinidad2 + ' %</td></tr>';
  3976. txt += '<tr><td width="*" align="center"><b>' + userlist + '</b> <-> <b>FA</b></td><td width="70" align="right">' + afinidad + ' %</td></tr>';
  3977. txt += '<tr><td width="' + long2 + '" align="center"><b>' + username + '</b> <-> <b>' + userlist + '</b></td><td align="right">' + afinidad3 + ' %</td></tr>';
  3978. txt += '<tr><td height="18" bgcolor="#4169E1" colspan="2" align="center"><font color="#FFD700"><b>Coincidencias</b></font></td></tr>';
  3979. txt += '<tr><td width="*" align="center"><b>' + username + '</b> <-> <b>FA</b></td><td align="right">' + coincfau + '/' + peliculas + '</td></tr>';
  3980. txt += '<tr><td width="*" align="center"><b>' + userlist + '</b> <-> <b>FA</b></td><td align="right">' + coincfa + '/' + peliculas + '</td></tr>';
  3981. txt += '<tr><td width="*" align="center"><b>' + username + '</b> <-> <b>' + userlist + '</b></td><td align="right">' + coinc3 + '/' + pvistasc + '</td></tr>';
  3982. }
  3983. txt += '</table></td>';
  3984. newdiv.innerHTML = txt;
  3985. nodoTit.parentNode.appendChild(newdiv);
  3986. }
  3987. if(inSection('MyList'))
  3988. setTimeout(afinidades_milista, 1500)
  3989. else {
  3990. if (getPreference('SHOWVOTESONFRIENDLISTS'))
  3991. setTimeout(afinidades_lista_otro,2000);
  3992. }
  3993. }
  3994. // Soporte para plegar los menús
  3995. function doMenus() {
  3996. // Muestra u oculta el menu que enviamos
  3997. // recibe el nodo TD que contiene el titulo
  3998. function doFold(menu, fold) {
  3999. //alert(menu.textContent);
  4000. var nodo = menu.parentNode.nextSibling;
  4001. while (nodo != null) {
  4002. if (nodo.nodeType != 3) {
  4003. if (fold) nodo.style.display = "none";
  4004. else nodo.style.display = "";
  4005. }
  4006. nodo = nodo.nextSibling;
  4007. }
  4008. }
  4009. function onFold() {
  4010. var nodo = this.parentNode.nextSibling;
  4011. var folded = nodo.style.display == "none";
  4012. doFold(this, !folded);
  4013. setPreference("menuFolded." + this.textContent, !folded);
  4014. }
  4015. function injectFoldCode() {
  4016. var menus = "//td[@class='menutitle']".findNodesArray();
  4017. for (var ix in menus) {
  4018. var menu = menus[ix];
  4019. menu.style.cursor = "pointer";
  4020. menu.addEventListener("click", onFold, true);
  4021. //alert(menu.textContent);
  4022. doFold(menu, getPreference("menuFolded." + menu.textContent, false));
  4023. }
  4024. }
  4025. //injectNewMenus();
  4026. //if (getPreference('FOLDMENUS', false)) {
  4027. // injectFoldCode();
  4028. //}
  4029. for(var ix in menus) {
  4030. var menu = menus[ix];
  4031. if(getPreference(menu.cond, true)){
  4032. var numaux = parseInt(ix);
  4033. switch(numaux){
  4034. case 0:
  4035. var nodo = "//div[@class='lsmheader' and contains(text(), 'TOPs')]".findNode();
  4036. break;
  4037. case 1:
  4038. var nodo = "//div[@class='lsmheader' and contains(text(), 'Usuarios')]".findNode();
  4039. break;
  4040. case 2:
  4041. var nodo = "//div[@class='lsmheader' and contains(text(), 'Informaci')]".findNode();
  4042. break;
  4043. }
  4044. var newdiv = d.createElement('div');
  4045. newdiv.textContent = menu['name'];
  4046. newdiv.className = "lsmheader";
  4047. var newul = d.createElement('ul');
  4048. for(var ox in menu['options']){
  4049. var option = menu['options'][ox];
  4050. var newli = d.createElement('li');
  4051. var newa = d.createElement('a');
  4052. newa.textContent = option['title'];
  4053. newa.href = option['href'];
  4054. newa.target = option['target'];
  4055. if(option['onclick'] != null){
  4056. newa.addEventListener("click", option['onclick'], true);
  4057. }
  4058. newul.appendChild(newli);
  4059. newli.appendChild(newa);
  4060. }
  4061. nodo.parentNode.insertBefore(newdiv, nodo);
  4062. nodo.parentNode.insertBefore(newul, nodo);
  4063. }
  4064. }
  4065. }
  4066. // Añade enlaces a la pagina de busqueda
  4067. function doProcessSearch() {
  4068. /* todo: reparar, no funciona correctamente
  4069. var stype = url.substr(url.lastIndexOf('=') + 1).replace('#','');
  4070. log("Process Search: "+stype);
  4071. var nodo = "//option[@value='" + stype + "']".findNode();
  4072. var elem = d.forms[0].elements[1];
  4073. if (nodo != null && typeof nodo != "undefined") elem.selectedIndex = nodo.index;
  4074. d.forms[0].elements[0].focus();
  4075. */
  4076. }
  4077. function doFixEnglishLink() {
  4078. for (var i = 0; i < d.links.length; ++i)
  4079. if (d.links[i].href == 'http://www.filmaffinity.com/en/main.html')
  4080. d.links[i].href = url.replace('/es/', '/en/');
  4081. }
  4082. function hideTVShows(ancestor) {
  4083. var nodos = ("//a[contains(text(),'(Serie de TV)')]/ancestor::*[position()=" + ancestor + "]").findNodesArray();
  4084. for (ix in nodos) {
  4085. nodos[ix].style.display = "none";
  4086. }
  4087. }
  4088. function addCountryFlag(country) {
  4089. var imgTemplate = '<img style="margin-left:5px;" border="0" align="middle" title="{NAME}" src="/imgs/countries/{CODE}.jpg"/>';
  4090. var nodo = "//b[text()='PAÍS']/../following-sibling::*/img".findNode();
  4091. if (nodo != null && typeof nodo != "undefined") {
  4092. var code = getCountryCode(country);
  4093. var html = nodo.parentNode.innerHTML;
  4094. if (html.indexOf(code + ".jpg") == -1) {
  4095. nodo.parentNode.innerHTML = html + imgTemplate.replace(/{NAME}/g, country).replace(/{CODE}/g, getCountryCode(country));
  4096. }
  4097. }
  4098. }
  4099. // Banderas de los paises coproductores.
  4100. function doAddCoproductionFlags() {
  4101. var productora = '//dt[text()="Productora"]/following-sibling::*'.findNode().textContent.toLowerCase().split(';')[0];
  4102. var codigos = [];
  4103. for (ix in countriesCodes) {
  4104. codigos.push(ix);
  4105. }
  4106. codigos.sort(function(a, b) {
  4107. return b.length - a.length;
  4108. });
  4109. if (productora.indexOf('coproducción') > -1)
  4110. for (var ix in codigos) {
  4111. var pais = codigos[ix];
  4112. if (productora.indexOf(pais.toLowerCase()) > -1) {
  4113. addCountryFlag(pais);
  4114. productora = productora.replace(pais.toLowerCase(), '');
  4115. }
  4116. }
  4117. }
  4118. //Centrado de la página en la ventana del navegador
  4119. function doCenterPage() {
  4120. GM_addStyle('.ot {margin-left:auto;margin-right:auto;');
  4121. }
  4122. // Registra los comandos de GM
  4123. function doRegisterCommands() {
  4124. GM_registerMenuCommand('Configurar ' + appName + ' ' + appVersion + '...', preferences);
  4125. GM_registerMenuCommand('Ver información de depurado', showLog);
  4126. }
  4127. // Alinear el icono de zoom a la imagen, por si hemos centrado con el script o
  4128. // via stylish
  4129. function doFixZoomIcon() {
  4130. // Todo: Supongo que este classname sera temporal
  4131. var icon = "//img[@class='foto']".findNode();
  4132. log("icono: " + icon);
  4133. if (icon != null && typeof icon != "undefined") {
  4134. var thumb = "//img[@class='foto']/../a/img".findNode();
  4135. icon.style.position = "relative";
  4136. icon.style.left = "-" + (thumb.width / 2 - 7) + "px"; // Las miniaturas tienen 100 de ancho - mitad de icono
  4137. icon.style.top = "15px"; // bajamos el icono para sobreponerlo a la miniatura
  4138. }
  4139. }
  4140. var browserCodes = {'Netscape':'FF','Opera':'OP'};
  4141. function getBrowserCode() {
  4142. var browserName = navigator.appName;
  4143. return browserCodes[browserName];
  4144. }
  4145. function isLogged() {
  4146. //var nodo = "//td[@class='menu2']/a[text()='Salir']".findNode();
  4147. var nodo = "//li/a[text()='Cerrar sesión']".findNode();
  4148. return nodo != null;
  4149. }
  4150. function getUserId() {
  4151. //var nodo = "//li/a[contains(text(),'ticas favoritas')]".findNode();
  4152. myid = parseInt(getPreference('idinput'));
  4153. var usuario = myid;
  4154. log('Usuario: ' + usuario);
  4155. return usuario;
  4156. }
  4157. function doUpdateMultiuser() {
  4158. var sections = ['cfg.','friends.','list.','sml.'];
  4159. // Copiamos los valores de configuración
  4160. // La lista de amigos
  4161. // SoulMates
  4162. for (i in sections) {
  4163. var section = sections[i];
  4164. var values = getValues(section);
  4165. for (ix in values) {
  4166. var c = values[ix];
  4167. var valor = GM_getValue(section + c);
  4168. log('migrando valor: ' + section + c + " :: " + valor);
  4169. if (typeof valor != 'undefined') {
  4170. GM_setValue(userId + "." + section + c, valor);
  4171. GM_deleteValue(section + c);
  4172. }
  4173. }
  4174. }
  4175. var valueNames = ['smc','ssml'];
  4176. for (ix in valueNames) {
  4177. valor = GM_getValue(valueNames[ix]);
  4178. if (typeof valor != 'undefined') {
  4179. GM_setValue(userId + '.' + valueNames[ix], valor);
  4180. GM_deleteValue(valueNames[ix]);
  4181. }
  4182. ;
  4183. }
  4184. ;
  4185. setPreference('MUMP', false);
  4186. }
  4187. ;
  4188. // Nos redirige a la pagina de busqueda global en caso de que no tengamos resultados
  4189. function doRedirectSearch() {
  4190. var anchors = "//img[contains(@src,'countries')]/parent::*/b/a".findNodesArray();
  4191. if (anchors.length == 0) {
  4192. var global = "//a[text()='buscador global']".findNode();
  4193. location.href = global.href;
  4194. return false;
  4195. }
  4196. return true;
  4197. }
  4198. // Obtiene el valor UCD necesario para subir votos
  4199. function doCaptureUCD() {
  4200. var ucd = "//select[contains(@id,'rate')]/@onchange".findNode().textContent.split("'")[3];
  4201. setPreference("UCD", ucd);
  4202. }
  4203. // Simplemente captura las puntuaciones y las mandamos al log
  4204. function doCaptureReviews() {
  4205. var nodos = "//img[contains(@src,'myratings')]/ancestor::*[position()=6]/preceding-sibling::*[1]/td".findNodesArray();
  4206. var tmp = GM_getValue("reviews");
  4207. var reviews;
  4208. if (typeof tmp == "undefined") {
  4209. reviews = [];
  4210. } else {
  4211. reviews = eval(tmp);
  4212. }
  4213. for (var ix in nodos) {
  4214. var sies = nodos[ix].textContent.split('de')[0];
  4215. var total = nodos[ix].textContent.split('de')[1].split('usuarios')[0];
  4216. reviews.push({si:sies,total:total});
  4217. }
  4218. for (ix in reviews) {
  4219. log(reviews[ix].si + ";" + reviews[ix].total);
  4220. }
  4221. GM_setValue("reviews", reviews.toSource());
  4222. }
  4223. function afinidad_votos(diferencia){
  4224. if(diferencia > 24)
  4225. return 0.0;
  4226. else if (diferencia > 17)
  4227. return 0.25;
  4228. else if (diferencia > 12)
  4229. return 0.5;
  4230. else if (diferencia > 9)
  4231. return 0.75;
  4232. else if (diferencia > 5)
  4233. return 1.0;
  4234. else if (diferencia > 3)
  4235. return 1.25;
  4236. else if (diferencia > 1.5)
  4237. return 1.55;
  4238. else if (diferencia > 0.7)
  4239. return 1.75;
  4240. else
  4241. return 2.0;
  4242. }
  4243. function afinidad_votos_años(diferencia){
  4244. if(diferencia > 10.909)
  4245. return 0.0;
  4246. else if (diferencia > 7.727)
  4247. return 0.25;
  4248. else if (diferencia > 5.454)
  4249. return 0.5;
  4250. else if (diferencia > 4.090)
  4251. return 0.75;
  4252. else if (diferencia > 2.272)
  4253. return 1.0;
  4254. else if (diferencia > 1.363)
  4255. return 1.25;
  4256. else if (diferencia > 0.681)
  4257. return 1.55;
  4258. else if (diferencia > 0.318)
  4259. return 1.75;
  4260. else
  4261. return 2.0;
  4262. }
  4263. function afinidad_medias(diferencia){
  4264. if(diferencia > 5)
  4265. return 0.0;
  4266. else if (diferencia > 4)
  4267. return 0.15;
  4268. else if (diferencia > 3)
  4269. return 0.4;
  4270. else if (diferencia > 1.5)
  4271. return 0.75;
  4272. else if (diferencia > 0.7)
  4273. return 1.3;
  4274. else if (diferencia > 0.3)
  4275. return 1.75;
  4276. else
  4277. return 2.0;
  4278. }
  4279. function afinidad_npaises(diferencia){
  4280. if(diferencia > 40)
  4281. return 0.0;
  4282. else if (diferencia > 25)
  4283. return 0.15;
  4284. else if (diferencia > 15)
  4285. return 0.5;
  4286. else if (diferencia > 10)
  4287. return 1;
  4288. else if (diferencia > 5)
  4289. return 1.5;
  4290. else
  4291. return 2.0;
  4292. }
  4293. function doAddMyStatsToOthers(){
  4294. var myid = "";
  4295. myid = getPreference('idinput');
  4296. var suid = d.URL.split('=')[1];
  4297. if(myid == suid)
  4298. return 0;
  4299. var nodotodo = '//caption[contains(text(),"Votaciones por valor")]/ancestor::*[position()=2]'.findNode();
  4300. var nodoval = '//caption[contains(text(),"Votaciones por valor")]/following-sibling::*'.findNode();
  4301. var nodogen = '//caption[contains(text(),"Votaciones por g")]/following-sibling::*'.findNode();
  4302. var nodopais = '//caption[contains(text(),"Votaciones por pa")]/following-sibling::*'.findNode();
  4303. var nodoanios = '//caption[contains(text(),"Votaciones por años")]/following-sibling::*'.findNode();
  4304. var nick1 = '//span[@id="nick"]'.findNode().textContent;
  4305. var nodonick2 = '//span[contains(text(),"Hola,")]'.findNode();
  4306. var nick2 = nodonick2.nextSibling.lastChild.textContent;
  4307. var anchob = 0;
  4308. var txt2 = "";
  4309. var tablagen = d.createElement('table');
  4310. //Para afinidad entre géneros
  4311. var datosGeneros = [
  4312. {nombre:"Drama",votos:0,media:0},
  4313. {nombre:'Comedia',votos:0,media:0},
  4314. {nombre:"Thriller",votos:0,media:0},
  4315. {nombre:'Romance',votos:0,media:0},
  4316. {nombre:'Acción',votos:0,media:0},
  4317. {nombre:'Fantástico',votos:0,media:0},
  4318. {nombre:'Intriga',votos:0,media:0},
  4319. {nombre:"Ciencia ficción",votos:0,media:0},
  4320. {nombre:'Aventuras',votos:0,media:0},
  4321. {nombre:"Animación",votos:0,media:0},
  4322. {nombre:'Terror',votos:0,media:0},
  4323. {nombre:'Documental',votos:0,media:0},
  4324. {nombre:'Infantil',votos:0,media:0},
  4325. {nombre:'Musical',votos:0,media:0},
  4326. {nombre:"Western",votos:0,media:0},
  4327. {nombre:'Bélico',votos:0,media:0},
  4328. {nombre:"Cine negro",votos:0,media:0},
  4329. {nombre:'Serie de TV',votos:0,media:0}
  4330. ];
  4331. var totalGens = nodogen.rows.length-1;
  4332. for (var i = 1; i <= totalGens; i++) {
  4333. var genero = nodogen.rows[i].cells[1].textContent;
  4334. var votos = parseInt(nodogen.rows[i].cells[0].textContent);
  4335. var media = parseFloat(nodogen.rows[i].cells[2].textContent.replace(',', '.'));
  4336. var ix = inArray(datosGeneros, 'nombre', genero);
  4337. datosGeneros[ix].votos = votos;
  4338. datosGeneros[ix].media = media;
  4339. }
  4340. datosGeneros.sort(function(a, b) {
  4341. return (a.nombre - b.nombre);
  4342. });
  4343. //Afinidad Paises
  4344. var datosPaises = [
  4345. {nombre:"Afganistán",votos:0,media:0},
  4346. {nombre:"Albania",votos:0,media:0},
  4347. {nombre:"Alemania",votos:0,media:0},
  4348. {nombre:"Alemania del Este (RDA)",votos:0,media:0},
  4349. {nombre:"Alemania del Oeste (RFA)",votos:0,media:0},
  4350. {nombre:"Andorra",votos:0,media:0},
  4351. {nombre:"Angola",votos:0,media:0},
  4352. {nombre:"Antigua y Barbuda",votos:0,media:0},
  4353. {nombre:"Arabia Saudí",votos:0,media:0},
  4354. {nombre:"Argelia",votos:0,media:0},
  4355. {nombre:"Argentina",votos:0,media:0},
  4356. {nombre:"Armenia",votos:0,media:0},
  4357. {nombre:"Australia",votos:0,media:0},
  4358. {nombre:"Austria",votos:0,media:0},
  4359. {nombre:"Azerbaijan",votos:0,media:0},
  4360. {nombre:"Bahamas",votos:0,media:0},
  4361. {nombre:"Bahrein",votos:0,media:0},
  4362. {nombre:"Bangladesh",votos:0,media:0},
  4363. {nombre:"Barbados",votos:0,media:0},
  4364. {nombre:"Bélgica",votos:0,media:0},
  4365. {nombre:"Belize",votos:0,media:0},
  4366. {nombre:"Benín",votos:0,media:0},
  4367. {nombre:"Bielorusia",votos:0,media:0},
  4368. {nombre:"Bolivia",votos:0,media:0},
  4369. {nombre:"Bosnia y Herzegovina",votos:0,media:0},
  4370. {nombre:"Botswana",votos:0,media:0},
  4371. {nombre:"Brasil",votos:0,media:0},
  4372. {nombre:"Brunei",votos:0,media:0},
  4373. {nombre:"Bulgaria",votos:0,media:0},
  4374. {nombre:"Burkina Faso",votos:0,media:0},
  4375. {nombre:"Burundi",votos:0,media:0},
  4376. {nombre:"Bután",votos:0,media:0},
  4377. {nombre:"Cabo Verde",votos:0,media:0},
  4378. {nombre:"Camboya",votos:0,media:0},
  4379. {nombre:"Camerún",votos:0,media:0},
  4380. {nombre:"Canadá",votos:0,media:0},
  4381. {nombre:"Chad",votos:0,media:0},
  4382. {nombre:"Checoslovaquia",votos:0,media:0},
  4383. {nombre:"Chile",votos:0,media:0},
  4384. {nombre:"China",votos:0,media:0},
  4385. {nombre:"Chipre",votos:0,media:0},
  4386. {nombre:"Colombia",votos:0,media:0},
  4387. {nombre:"Comores",votos:0,media:0},
  4388. {nombre:"Congo",votos:0,media:0},
  4389. {nombre:"Corea del Norte",votos:0,media:0},
  4390. {nombre:"Corea del Sur",votos:0,media:0},
  4391. {nombre:"Costa de Marfil",votos:0,media:0},
  4392. {nombre:"Costa Rica",votos:0,media:0},
  4393. {nombre:"Croacia",votos:0,media:0},
  4394. {nombre:"Cuba",votos:0,media:0},
  4395. {nombre:"Dinamarca",votos:0,media:0},
  4396. {nombre:"Dominica",votos:0,media:0},
  4397. {nombre:"Ecuador",votos:0,media:0},
  4398. {nombre:"Egipto",votos:0,media:0},
  4399. {nombre:"El Salvador",votos:0,media:0},
  4400. {nombre:"Emiratos Árabes",votos:0,media:0},
  4401. {nombre:"Eritrea",votos:0,media:0},
  4402. {nombre:"Eslovaquia",votos:0,media:0},
  4403. {nombre:"Eslovenia",votos:0,media:0},
  4404. {nombre:"España",votos:0,media:0},
  4405. {nombre:"Estados Unidos",votos:0,media:0},
  4406. {nombre:"Estonia",votos:0,media:0},
  4407. {nombre:"Etiopía",votos:0,media:0},
  4408. {nombre:"Fidji",votos:0,media:0},
  4409. {nombre:"Filipinas",votos:0,media:0},
  4410. {nombre:"Finlandia",votos:0,media:0},
  4411. {nombre:"Francia",votos:0,media:0},
  4412. {nombre:"Gabón",votos:0,media:0},
  4413. {nombre:"Gambia",votos:0,media:0},
  4414. {nombre:"Georgia",votos:0,media:0},
  4415. {nombre:"Ghana",votos:0,media:0},
  4416. {nombre:"Granada",votos:0,media:0},
  4417. {nombre:"Grecia",votos:0,media:0},
  4418. {nombre:"Groenlandia",votos:0,media:0},
  4419. {nombre:"Guatemala",votos:0,media:0},
  4420. {nombre:"Guinea",votos:0,media:0},
  4421. {nombre:"Guinea Bissau",votos:0,media:0},
  4422. {nombre:"Guinea Ecuatorial",votos:0,media:0},
  4423. {nombre:"Guyana",votos:0,media:0},
  4424. {nombre:"Haití",votos:0,media:0},
  4425. {nombre:"Honduras",votos:0,media:0},
  4426. {nombre:"Hong Kong",votos:0,media:0},
  4427. {nombre:"Hungría",votos:0,media:0},
  4428. {nombre:"India",votos:0,media:0},
  4429. {nombre:"Indonesia",votos:0,media:0},
  4430. {nombre:"Irak",votos:0,media:0},
  4431. {nombre:"Irán",votos:0,media:0},
  4432. {nombre:"Irlanda",votos:0,media:0},
  4433. {nombre:"Islandia",votos:0,media:0},
  4434. {nombre:"Israel",votos:0,media:0},
  4435. {nombre:"Italia",votos:0,media:0},
  4436. {nombre:"Jamaica",votos:0,media:0},
  4437. {nombre:"Japón",votos:0,media:0},
  4438. {nombre:"Jordania",votos:0,media:0},
  4439. {nombre:"Kazajstán",votos:0,media:0},
  4440. {nombre:"Kenia",votos:0,media:0},
  4441. {nombre:"Kirguizstán",votos:0,media:0},
  4442. {nombre:"Kuwait",votos:0,media:0},
  4443. {nombre:"Laos",votos:0,media:0},
  4444. {nombre:"Lesotho",votos:0,media:0},
  4445. {nombre:"Letonia",votos:0,media:0},
  4446. {nombre:"Líbano",votos:0,media:0},
  4447. {nombre:"Liberia",votos:0,media:0},
  4448. {nombre:"Libia",votos:0,media:0},
  4449. {nombre:"Liechtenstein",votos:0,media:0},
  4450. {nombre:"Lituania",votos:0,media:0},
  4451. {nombre:"Luxemburgo",votos:0,media:0},
  4452. {nombre:"Macedonia",votos:0,media:0},
  4453. {nombre:"Madagascar",votos:0,media:0},
  4454. {nombre:"Malasia",votos:0,media:0},
  4455. {nombre:"Malawi",votos:0,media:0},
  4456. {nombre:"Maldivas",votos:0,media:0},
  4457. {nombre:"Mali",votos:0,media:0},
  4458. {nombre:"Malta",votos:0,media:0},
  4459. {nombre:"Marruecos",votos:0,media:0},
  4460. {nombre:"Marshall (Islas)",votos:0,media:0},
  4461. {nombre:"Mauricio (Isla)",votos:0,media:0},
  4462. {nombre:"Mauritania",votos:0,media:0},
  4463. {nombre:"México",votos:0,media:0},
  4464. {nombre:"Micronesia",votos:0,media:0},
  4465. {nombre:"Moldavia",votos:0,media:0},
  4466. {nombre:"Mónaco",votos:0,media:0},
  4467. {nombre:"Mongolia",votos:0,media:0},
  4468. {nombre:"Montenegro",votos:0,media:0},
  4469. {nombre:"Mozambique",votos:0,media:0},
  4470. {nombre:"Myanmar - Birmania",votos:0,media:0},
  4471. {nombre:"Namibia",votos:0,media:0},
  4472. {nombre:"Nepal",votos:0,media:0},
  4473. {nombre:"Nicaragua",votos:0,media:0},
  4474. {nombre:"Níger",votos:0,media:0},
  4475. {nombre:"Nigeria",votos:0,media:0},
  4476. {nombre:"Noruega",votos:0,media:0},
  4477. {nombre:"Nueva Zelanda",votos:0,media:0},
  4478. {nombre:"Omán",votos:0,media:0},
  4479. {nombre:"Países Bajos (Holanda)",votos:0,media:0},
  4480. {nombre:"Palestina",votos:0,media:0},
  4481. {nombre:"Panamá",votos:0,media:0},
  4482. {nombre:"Papuasia Nueva Guinea",votos:0,media:0},
  4483. {nombre:"Paquistán",votos:0,media:0},
  4484. {nombre:"Paraguay",votos:0,media:0},
  4485. {nombre:"Perú",votos:0,media:0},
  4486. {nombre:"Polonia",votos:0,media:0},
  4487. {nombre:"Portugal",votos:0,media:0},
  4488. {nombre:"Puerto Rico",votos:0,media:0},
  4489. {nombre:"Qatar",votos:0,media:0},
  4490. {nombre:"Reino Unido",votos:0,media:0},
  4491. {nombre:"Rep. Centroafricana",votos:0,media:0},
  4492. {nombre:"Rep. Dominicana",votos:0,media:0},
  4493. {nombre:"República Checa",votos:0,media:0},
  4494. {nombre:"República del Congo",votos:0,media:0},
  4495. {nombre:"Ruanda",votos:0,media:0},
  4496. {nombre:"Rumanía",votos:0,media:0},
  4497. {nombre:"Rusia",votos:0,media:0},
  4498. {nombre:"Samoa",votos:0,media:0},
  4499. {nombre:"San Marino",votos:0,media:0},
  4500. {nombre:"Senegal",votos:0,media:0},
  4501. {nombre:"Serbia",votos:0,media:0},
  4502. {nombre:"Serbia y Montenegro",votos:0,media:0},
  4503. {nombre:"Seychelles",votos:0,media:0},
  4504. {nombre:"Sierra Leona",votos:0,media:0},
  4505. {nombre:"Singapur",votos:0,media:0},
  4506. {nombre:"Siria",votos:0,media:0},
  4507. {nombre:"Somalia",votos:0,media:0},
  4508. {nombre:"Sri Lanka",votos:0,media:0},
  4509. {nombre:"Sudáfrica",votos:0,media:0},
  4510. {nombre:"Sudán",votos:0,media:0},
  4511. {nombre:"Suecia",votos:0,media:0},
  4512. {nombre:"Suiza",votos:0,media:0},
  4513. {nombre:"Surinam",votos:0,media:0},
  4514. {nombre:"Swazilandia",votos:0,media:0},
  4515. {nombre:"Tailandia",votos:0,media:0},
  4516. {nombre:"Taiwán",votos:0,media:0},
  4517. {nombre:"Tajikistan",votos:0,media:0},
  4518. {nombre:"Tanzania",votos:0,media:0},
  4519. {nombre:"Togo",votos:0,media:0},
  4520. {nombre:"Trinidad y Tobago",votos:0,media:0},
  4521. {nombre:"Túnez",votos:0,media:0},
  4522. {nombre:"Turkmenistán",votos:0,media:0},
  4523. {nombre:"Turquía",votos:0,media:0},
  4524. {nombre:"Ucrania",votos:0,media:0},
  4525. {nombre:"Uganda",votos:0,media:0},
  4526. {nombre:"Unión Soviética (URSS)",votos:0,media:0},
  4527. {nombre:"Uruguay",votos:0,media:0},
  4528. {nombre:"Uzbekistan",votos:0,media:0},
  4529. {nombre:"Venezuela",votos:0,media:0},
  4530. {nombre:"Vietnam",votos:0,media:0},
  4531. {nombre:"Yemen",votos:0,media:0},
  4532. {nombre:"Yugoslavia",votos:0,media:0},
  4533. {nombre:"Zambia",votos:0,media:0},
  4534. {nombre:"Zimbabwe",votos:0,media:0}
  4535. ];
  4536. //Calculo datos continentes otro user
  4537. var datosContinentes = [
  4538. {nombre:"América del Norte",votos:0,media:0},
  4539. {nombre:'Europa',votos:0,media:0},
  4540. {nombre:"América del Sur",votos:0,media:0},
  4541. {nombre:'Oceanía',votos:0,media:0},
  4542. {nombre:'Asia',votos:0,media:0},
  4543. {nombre:'África',votos:0,media:0},
  4544. {nombre:'NA',votos:0,media:0}
  4545. ];
  4546. var totalPaises = nodopais.rows.length-1;
  4547. var totalVotos = 0;
  4548. var contador = 1;
  4549. for (var i = 1; i <= totalPaises; i++) {
  4550. var pais = nodopais.rows[i].cells[1].textContent;
  4551. var votos = parseInt(nodopais.rows[i].cells[0].textContent);
  4552. totalVotos += votos;
  4553. var media = parseFloat(nodopais.rows[i].cells[2].textContent.replace(',', '.'));
  4554. var continente = getContinent(getCountryCode(pais));
  4555. var ix = inArray(datosContinentes, 'nombre', continente);
  4556. var iy = inArray(datosPaises, 'nombre', pais);
  4557. var oldVotos = datosContinentes[ix].votos;
  4558. var oldMedia = datosContinentes[ix].media;
  4559. datosContinentes[ix].votos = oldVotos + votos;
  4560. datosContinentes[ix].media = ((oldVotos * oldMedia) + (votos * media)) / (oldVotos + votos);
  4561. datosPaises[iy].votos = votos;
  4562. datosPaises[iy].media = media;
  4563. }
  4564. datosContinentes.sort(function(a, b) {
  4565. return (b.votos - a.votos);
  4566. });
  4567. datosPaises.sort(function(a, b) {
  4568. return (a.nombre - b.nombre);
  4569. });
  4570. //tablagen.className = "reptable";
  4571. tablagen.width = "100%";
  4572. tablagen.border = "0";
  4573. var txt1 = "";
  4574. var url = "http://www.filmaffinity.com/es/userrep.php?user_id=" + myid;
  4575. doGet(url, function(response) {
  4576. var emptydiv = document.createElement('div');
  4577. emptydiv.innerHTML = response;
  4578. var nodo2val = '//caption[contains(text(),"Votaciones por valor")]/following-sibling::*'.findNode(emptydiv);
  4579. var nodo2gen = '//caption[contains(text(),"Votaciones por g")]/following-sibling::*'.findNode(emptydiv);
  4580. var nodo2pais = '//caption[contains(text(),"Votaciones por pa")]/following-sibling::*'.findNode(emptydiv);
  4581. var nodo2anios = '//caption[contains(text(),"Votaciones por a")]/following-sibling::*'.findNode(emptydiv);
  4582. //Para nosotros
  4583. //Afinidad Paises
  4584. var datosPaises2 = [
  4585. {nombre:"Afganistán",votos:0,media:0},
  4586. {nombre:"Albania",votos:0,media:0},
  4587. {nombre:"Alemania",votos:0,media:0},
  4588. {nombre:"Alemania del Este (RDA)",votos:0,media:0},
  4589. {nombre:"Alemania del Oeste (RFA)",votos:0,media:0},
  4590. {nombre:"Andorra",votos:0,media:0},
  4591. {nombre:"Angola",votos:0,media:0},
  4592. {nombre:"Antigua y Barbuda",votos:0,media:0},
  4593. {nombre:"Arabia Saudí",votos:0,media:0},
  4594. {nombre:"Argelia",votos:0,media:0},
  4595. {nombre:"Argentina",votos:0,media:0},
  4596. {nombre:"Armenia",votos:0,media:0},
  4597. {nombre:"Australia",votos:0,media:0},
  4598. {nombre:"Austria",votos:0,media:0},
  4599. {nombre:"Azerbaijan",votos:0,media:0},
  4600. {nombre:"Bahamas",votos:0,media:0},
  4601. {nombre:"Bahrein",votos:0,media:0},
  4602. {nombre:"Bangladesh",votos:0,media:0},
  4603. {nombre:"Barbados",votos:0,media:0},
  4604. {nombre:"Bélgica",votos:0,media:0},
  4605. {nombre:"Belize",votos:0,media:0},
  4606. {nombre:"Benín",votos:0,media:0},
  4607. {nombre:"Bielorusia",votos:0,media:0},
  4608. {nombre:"Bolivia",votos:0,media:0},
  4609. {nombre:"Bosnia y Herzegovina",votos:0,media:0},
  4610. {nombre:"Botswana",votos:0,media:0},
  4611. {nombre:"Brasil",votos:0,media:0},
  4612. {nombre:"Brunei",votos:0,media:0},
  4613. {nombre:"Bulgaria",votos:0,media:0},
  4614. {nombre:"Burkina Faso",votos:0,media:0},
  4615. {nombre:"Burundi",votos:0,media:0},
  4616. {nombre:"Bután",votos:0,media:0},
  4617. {nombre:"Cabo Verde",votos:0,media:0},
  4618. {nombre:"Camboya",votos:0,media:0},
  4619. {nombre:"Camerún",votos:0,media:0},
  4620. {nombre:"Canadá",votos:0,media:0},
  4621. {nombre:"Chad",votos:0,media:0},
  4622. {nombre:"Checoslovaquia",votos:0,media:0},
  4623. {nombre:"Chile",votos:0,media:0},
  4624. {nombre:"China",votos:0,media:0},
  4625. {nombre:"Chipre",votos:0,media:0},
  4626. {nombre:"Colombia",votos:0,media:0},
  4627. {nombre:"Comores",votos:0,media:0},
  4628. {nombre:"Congo",votos:0,media:0},
  4629. {nombre:"Corea del Norte",votos:0,media:0},
  4630. {nombre:"Corea del Sur",votos:0,media:0},
  4631. {nombre:"Costa de Marfil",votos:0,media:0},
  4632. {nombre:"Costa Rica",votos:0,media:0},
  4633. {nombre:"Croacia",votos:0,media:0},
  4634. {nombre:"Cuba",votos:0,media:0},
  4635. {nombre:"Dinamarca",votos:0,media:0},
  4636. {nombre:"Dominica",votos:0,media:0},
  4637. {nombre:"Ecuador",votos:0,media:0},
  4638. {nombre:"Egipto",votos:0,media:0},
  4639. {nombre:"El Salvador",votos:0,media:0},
  4640. {nombre:"Emiratos Árabes",votos:0,media:0},
  4641. {nombre:"Eritrea",votos:0,media:0},
  4642. {nombre:"Eslovaquia",votos:0,media:0},
  4643. {nombre:"Eslovenia",votos:0,media:0},
  4644. {nombre:"España",votos:0,media:0},
  4645. {nombre:"Estados Unidos",votos:0,media:0},
  4646. {nombre:"Estonia",votos:0,media:0},
  4647. {nombre:"Etiopía",votos:0,media:0},
  4648. {nombre:"Fidji",votos:0,media:0},
  4649. {nombre:"Filipinas",votos:0,media:0},
  4650. {nombre:"Finlandia",votos:0,media:0},
  4651. {nombre:"Francia",votos:0,media:0},
  4652. {nombre:"Gabón",votos:0,media:0},
  4653. {nombre:"Gambia",votos:0,media:0},
  4654. {nombre:"Georgia",votos:0,media:0},
  4655. {nombre:"Ghana",votos:0,media:0},
  4656. {nombre:"Granada",votos:0,media:0},
  4657. {nombre:"Grecia",votos:0,media:0},
  4658. {nombre:"Groenlandia",votos:0,media:0},
  4659. {nombre:"Guatemala",votos:0,media:0},
  4660. {nombre:"Guinea",votos:0,media:0},
  4661. {nombre:"Guinea Bissau",votos:0,media:0},
  4662. {nombre:"Guinea Ecuatorial",votos:0,media:0},
  4663. {nombre:"Guyana",votos:0,media:0},
  4664. {nombre:"Haití",votos:0,media:0},
  4665. {nombre:"Honduras",votos:0,media:0},
  4666. {nombre:"Hong Kong",votos:0,media:0},
  4667. {nombre:"Hungría",votos:0,media:0},
  4668. {nombre:"India",votos:0,media:0},
  4669. {nombre:"Indonesia",votos:0,media:0},
  4670. {nombre:"Irak",votos:0,media:0},
  4671. {nombre:"Irán",votos:0,media:0},
  4672. {nombre:"Irlanda",votos:0,media:0},
  4673. {nombre:"Islandia",votos:0,media:0},
  4674. {nombre:"Israel",votos:0,media:0},
  4675. {nombre:"Italia",votos:0,media:0},
  4676. {nombre:"Jamaica",votos:0,media:0},
  4677. {nombre:"Japón",votos:0,media:0},
  4678. {nombre:"Jordania",votos:0,media:0},
  4679. {nombre:"Kazajstán",votos:0,media:0},
  4680. {nombre:"Kenia",votos:0,media:0},
  4681. {nombre:"Kirguizstán",votos:0,media:0},
  4682. {nombre:"Kuwait",votos:0,media:0},
  4683. {nombre:"Laos",votos:0,media:0},
  4684. {nombre:"Lesotho",votos:0,media:0},
  4685. {nombre:"Letonia",votos:0,media:0},
  4686. {nombre:"Líbano",votos:0,media:0},
  4687. {nombre:"Liberia",votos:0,media:0},
  4688. {nombre:"Libia",votos:0,media:0},
  4689. {nombre:"Liechtenstein",votos:0,media:0},
  4690. {nombre:"Lituania",votos:0,media:0},
  4691. {nombre:"Luxemburgo",votos:0,media:0},
  4692. {nombre:"Macedonia",votos:0,media:0},
  4693. {nombre:"Madagascar",votos:0,media:0},
  4694. {nombre:"Malasia",votos:0,media:0},
  4695. {nombre:"Malawi",votos:0,media:0},
  4696. {nombre:"Maldivas",votos:0,media:0},
  4697. {nombre:"Mali",votos:0,media:0},
  4698. {nombre:"Malta",votos:0,media:0},
  4699. {nombre:"Marruecos",votos:0,media:0},
  4700. {nombre:"Marshall (Islas)",votos:0,media:0},
  4701. {nombre:"Mauricio (Isla)",votos:0,media:0},
  4702. {nombre:"Mauritania",votos:0,media:0},
  4703. {nombre:"México",votos:0,media:0},
  4704. {nombre:"Micronesia",votos:0,media:0},
  4705. {nombre:"Moldavia",votos:0,media:0},
  4706. {nombre:"Mónaco",votos:0,media:0},
  4707. {nombre:"Mongolia",votos:0,media:0},
  4708. {nombre:"Montenegro",votos:0,media:0},
  4709. {nombre:"Mozambique",votos:0,media:0},
  4710. {nombre:"Myanmar - Birmania",votos:0,media:0},
  4711. {nombre:"Namibia",votos:0,media:0},
  4712. {nombre:"Nepal",votos:0,media:0},
  4713. {nombre:"Nicaragua",votos:0,media:0},
  4714. {nombre:"Níger",votos:0,media:0},
  4715. {nombre:"Nigeria",votos:0,media:0},
  4716. {nombre:"Noruega",votos:0,media:0},
  4717. {nombre:"Nueva Zelanda",votos:0,media:0},
  4718. {nombre:"Omán",votos:0,media:0},
  4719. {nombre:"Países Bajos (Holanda)",votos:0,media:0},
  4720. {nombre:"Palestina",votos:0,media:0},
  4721. {nombre:"Panamá",votos:0,media:0},
  4722. {nombre:"Papuasia Nueva Guinea",votos:0,media:0},
  4723. {nombre:"Paquistán",votos:0,media:0},
  4724. {nombre:"Paraguay",votos:0,media:0},
  4725. {nombre:"Perú",votos:0,media:0},
  4726. {nombre:"Polonia",votos:0,media:0},
  4727. {nombre:"Portugal",votos:0,media:0},
  4728. {nombre:"Puerto Rico",votos:0,media:0},
  4729. {nombre:"Qatar",votos:0,media:0},
  4730. {nombre:"Reino Unido",votos:0,media:0},
  4731. {nombre:"Rep. Centroafricana",votos:0,media:0},
  4732. {nombre:"Rep. Dominicana",votos:0,media:0},
  4733. {nombre:"República Checa",votos:0,media:0},
  4734. {nombre:"República del Congo",votos:0,media:0},
  4735. {nombre:"Ruanda",votos:0,media:0},
  4736. {nombre:"Rumanía",votos:0,media:0},
  4737. {nombre:"Rusia",votos:0,media:0},
  4738. {nombre:"Samoa",votos:0,media:0},
  4739. {nombre:"San Marino",votos:0,media:0},
  4740. {nombre:"Senegal",votos:0,media:0},
  4741. {nombre:"Serbia",votos:0,media:0},
  4742. {nombre:"Serbia y Montenegro",votos:0,media:0},
  4743. {nombre:"Seychelles",votos:0,media:0},
  4744. {nombre:"Sierra Leona",votos:0,media:0},
  4745. {nombre:"Singapur",votos:0,media:0},
  4746. {nombre:"Siria",votos:0,media:0},
  4747. {nombre:"Somalia",votos:0,media:0},
  4748. {nombre:"Sri Lanka",votos:0,media:0},
  4749. {nombre:"Sudáfrica",votos:0,media:0},
  4750. {nombre:"Sudán",votos:0,media:0},
  4751. {nombre:"Suecia",votos:0,media:0},
  4752. {nombre:"Suiza",votos:0,media:0},
  4753. {nombre:"Surinam",votos:0,media:0},
  4754. {nombre:"Swazilandia",votos:0,media:0},
  4755. {nombre:"Tailandia",votos:0,media:0},
  4756. {nombre:"Taiwán",votos:0,media:0},
  4757. {nombre:"Tajikistan",votos:0,media:0},
  4758. {nombre:"Tanzania",votos:0,media:0},
  4759. {nombre:"Togo",votos:0,media:0},
  4760. {nombre:"Trinidad y Tobago",votos:0,media:0},
  4761. {nombre:"Túnez",votos:0,media:0},
  4762. {nombre:"Turkmenistán",votos:0,media:0},
  4763. {nombre:"Turquía",votos:0,media:0},
  4764. {nombre:"Ucrania",votos:0,media:0},
  4765. {nombre:"Uganda",votos:0,media:0},
  4766. {nombre:"Unión Soviética (URSS)",votos:0,media:0},
  4767. {nombre:"Uruguay",votos:0,media:0},
  4768. {nombre:"Uzbekistan",votos:0,media:0},
  4769. {nombre:"Venezuela",votos:0,media:0},
  4770. {nombre:"Vietnam",votos:0,media:0},
  4771. {nombre:"Yemen",votos:0,media:0},
  4772. {nombre:"Yugoslavia",votos:0,media:0},
  4773. {nombre:"Zambia",votos:0,media:0},
  4774. {nombre:"Zimbabwe",votos:0,media:0}
  4775. ];
  4776. var datosContinentes2 = [
  4777. {nombre:"América del Norte",votos:0,media:0},
  4778. {nombre:'Europa',votos:0,media:0},
  4779. {nombre:"América del Sur",votos:0,media:0},
  4780. {nombre:'Oceanía',votos:0,media:0},
  4781. {nombre:'Asia',votos:0,media:0},
  4782. {nombre:'África',votos:0,media:0},
  4783. {nombre:'NA',votos:0,media:0}
  4784. ];
  4785. var totalPaises2 = nodo2pais.rows.length-1;
  4786. var totalVotos2 = 0;
  4787. var contador2 = 1;
  4788. for (var j = 1; j <= totalPaises2; j++) {
  4789. var pais2 = nodo2pais.rows[j].cells[1].textContent;
  4790. //Arreglamos el nombre del pais
  4791. if(pais2.indexOf("n Sovi") != -1)
  4792. pais2 = 'Unión Soviética (URSS)';
  4793. else if(pais2.indexOf("Jap") != -1)
  4794. pais2 = 'Japón';
  4795. else if(pais2.indexOf("Espa") != -1)
  4796. pais2 = 'España';
  4797. else if(pais2.indexOf("Canad") != -1)
  4798. pais2 = 'Canadá';
  4799. else if(pais2.indexOf("Taiw") != -1)
  4800. pais2 = 'Taiwán';
  4801. else if(pais2.indexOf("xico") != -1)
  4802. pais2 = 'México';
  4803. else if(pais2.indexOf("lgica") != -1)
  4804. pais2 = 'Bélgica';
  4805. else if(pais2.indexOf("Ruman") != -1)
  4806. pais2 = 'Rumanía';
  4807. else if(pais2.indexOf("frica") != -1)
  4808. pais2 = 'Sudáfrica';
  4809. else if(pais2.indexOf("Turq") != -1)
  4810. pais2 = 'Turquía';
  4811. else if(pais2.indexOf("nia del Oest") != -1)
  4812. pais2 = 'Alemania del Oeste (RFA)';
  4813. else if(pais2.indexOf("nia del Est") != -1)
  4814. pais2 = 'Alemania del Este (RDA)';
  4815. else if(pais2.indexOf("ca Checa") != -1)
  4816. pais2 = 'República Checa';
  4817. else if(pais2.indexOf("Ir") == 0 && pais2.indexOf("Irl") == -1)
  4818. pais2 = 'Irán';
  4819. else if(pais2.indexOf("Paquist") != -1)
  4820. pais2 = 'Paquistán';
  4821. else if(pais2.indexOf("bano") != -1)
  4822. pais2 = 'Líbano';
  4823. else if(pais2.indexOf("Hungr") != -1)
  4824. pais2 = 'Hungría';
  4825. else if(pais2.indexOf("Afganis") != -1)
  4826. pais2 = 'Afganistán';
  4827. else if(pais2.indexOf("Kazajs") != -1)
  4828. pais2 = 'Kazajstán';
  4829. else if(pais2.indexOf("But") != -1)
  4830. pais2 = 'Bután';
  4831. else if(pais2.indexOf("Etiop") != -1)
  4832. pais2 = 'Etiopía';
  4833. else if(pais2.indexOf("Panam") != -1)
  4834. pais2 = 'Panamá';
  4835. else if(pais2.indexOf("Emiratos") != -1)
  4836. pais2 = 'Emiratos Árabes';
  4837. else if(pais2.indexOf("Camer") != -1)
  4838. pais2 = 'Camerún';
  4839. else if(pais2.indexOf("Per") != -1)
  4840. pais2 = 'Perú';
  4841. else if(pais2.indexOf("ses Bajos") != -1)
  4842. pais2 = 'Países Bajos (Holanda)';
  4843. else if(pais2.indexOf("T") == 0 && pais2.indexOf("nez") != -1)
  4844. pais2 = 'Túnez';
  4845. else if(pais2.indexOf("rabia Sau") != -1)
  4846. pais2 = 'Arabia Saudí';
  4847. else if(pais2.indexOf("rabia Sau") != -1)
  4848. pais2 = 'Arabia Saudí';
  4849. else if(pais2.indexOf("Ben") != -1 && pais2.length == 5)
  4850. pais2 = 'Benín';
  4851. else if(pais2.indexOf("Gab") != -1)
  4852. pais2 = 'Gabón';
  4853. else if(pais2.indexOf("Hait") != -1)
  4854. pais2 = 'Haití';
  4855. else if(pais2.indexOf("Kirg") != -1)
  4856. pais2 = 'Kirguizstán';
  4857. else if(pais2.indexOf("naco") != -1)
  4858. pais2 = 'Mónaco';
  4859. else if(pais2.indexOf("ger") != -1 && pais2.length == 5)
  4860. pais2 = 'Níger';
  4861. else if(pais2.indexOf("Om") != -1)
  4862. pais2 = 'Omán';
  4863. else if(pais2.indexOf("lica del Con") != -1)
  4864. pais2 = 'República del Congo';
  4865. else if(pais2.indexOf("Turkmenist") != -1)
  4866. pais2 = 'Turkmenistán';
  4867. var votos2 = parseInt(nodo2pais.rows[j].cells[0].textContent);
  4868. totalVotos2 += votos2;
  4869. var media2 = parseFloat(nodo2pais.rows[j].cells[2].textContent.replace(',', '.'));
  4870. var continente2 = getContinent(getCountryCode(pais2));
  4871. var ix = inArray(datosContinentes2, 'nombre', continente2);
  4872. var it = inArray(datosPaises2, 'nombre', pais2);
  4873. var oldVotos2 = datosContinentes2[ix].votos;
  4874. var oldMedia2 = datosContinentes2[ix].media;
  4875. datosContinentes2[ix].votos = oldVotos2 + votos2;
  4876. datosContinentes2[ix].media = ((oldVotos2 * oldMedia2) + (votos2 * media2)) / (oldVotos2 + votos2);
  4877. datosPaises2[it].votos = votos2;
  4878. datosPaises2[it].media = media2;
  4879. }
  4880. datosContinentes2.sort(function(a, b) {
  4881. return (b.votos - a.votos);
  4882. });
  4883. datosPaises2.sort(function(a, b) {
  4884. return (a.nombre - b.nombre);
  4885. });
  4886. //Afinidad géneros
  4887. var datosGeneros2 = [
  4888. {nombre:"Drama",votos:0,media:0},
  4889. {nombre:'Comedia',votos:0,media:0},
  4890. {nombre:"Thriller",votos:0,media:0},
  4891. {nombre:'Romance',votos:0,media:0},
  4892. {nombre:'Acción',votos:0,media:0},
  4893. {nombre:'Fantástico',votos:0,media:0},
  4894. {nombre:'Intriga',votos:0,media:0},
  4895. {nombre:"Ciencia ficción",votos:0,media:0},
  4896. {nombre:'Aventuras',votos:0,media:0},
  4897. {nombre:"Animación",votos:0,media:0},
  4898. {nombre:'Terror',votos:0,media:0},
  4899. {nombre:'Documental',votos:0,media:0},
  4900. {nombre:'Infantil',votos:0,media:0},
  4901. {nombre:'Musical',votos:0,media:0},
  4902. {nombre:"Western",votos:0,media:0},
  4903. {nombre:'Bélico',votos:0,media:0},
  4904. {nombre:"Cine negro",votos:0,media:0},
  4905. {nombre:'Serie de TV',votos:0,media:0}
  4906. ];
  4907. var totalGens2 = nodo2gen.rows.length-1;
  4908. for (var i = 1; i <= totalGens2; i++) {
  4909. var genero2 = nodo2gen.rows[i].cells[1].textContent;
  4910. var votos2 = parseInt(nodo2gen.rows[i].cells[0].textContent);
  4911. var media2 = parseFloat(nodo2gen.rows[i].cells[2].textContent.replace(',', '.'));
  4912. if(genero2.indexOf("Acci") != -1)
  4913. genero2 = 'Acción';
  4914. else if(genero2.indexOf("Fant") != -1)
  4915. genero2 = 'Fantástico';
  4916. else if(genero2.indexOf("Ciencia fic") != -1)
  4917. genero2 = 'Ciencia ficción';
  4918. else if(genero2.indexOf("Animaci") != -1)
  4919. genero2 = 'Animación';
  4920. else if(genero2.indexOf("lico") != -1)
  4921. genero2 = 'Bélico';
  4922. var ix2 = inArray(datosGeneros2, 'nombre', genero2);
  4923. datosGeneros2[ix2].votos = votos2;
  4924. datosGeneros2[ix2].media = media2;
  4925. }
  4926. datosGeneros2.sort(function(a, b) {
  4927. return (a.nombre - b.nombre);
  4928. });
  4929. //Afinidad Paises
  4930. txt1 += '<tbody>';
  4931. //Tablas de VALORACIONES
  4932. txt1 += '<tr><td align="center" colspan="2"><b><FONT SIZE=4>Votaciones por valoración</FONT></b></td></tr>';
  4933. txt1 += '<tr><td width="50%" align="center"><b><FONT SIZE=2 COLOR=BLUE>' + nick1 + '</FONT></b></td><td width="50%" align="center"><b><FONT SIZE=2 COLOR=GREEN>' + nick2 + '</FONT></b></td></tr>';
  4934. txt1 += '<tr><td><table class="reptable" align="center"><tbody>';
  4935. txt1 += '<tr><th>' + nodoval.rows[0].cells[0].textContent + '</th><th>' + nodoval.rows[0].cells[1].textContent + '</th><th>' + nodoval.rows[0].cells[2].textContent + '</th></tr>';
  4936. for(i = 1; i < nodoval.rows.length; i++) {
  4937. txt1 += '<tr><td class="repitem" align="center"><b>' + nodoval.rows[i].cells[0].textContent + '</b></td>'; //Valoración
  4938. txt1 += '<td><img align="top" src="/images/bars/bar1.gif" border="0" width="' + Math.round(parseInt(nodoval.rows[i].cells[1].firstChild.width)*0.82) + '" height="14" border="1">' + nodoval.rows[i].cells[1].textContent + '</td>'; //Porcentaje
  4939. txt1 += '<td align="right">' + nodoval.rows[i].cells[2].textContent + '</td></tr>'; //Votos
  4940. }
  4941. txt1 += '</table></td>';
  4942. txt1 += '<td><table class="reptable" align="center"><tbody>';
  4943. txt1 += '<tr><th>' + nodoval.rows[0].cells[0].textContent + '</th><th>' + nodoval.rows[0].cells[1].textContent + '</th><th>' + nodoval.rows[0].cells[2].textContent + '</th></tr>';
  4944. for(i = 1; i < nodo2val.rows.length; i++) {
  4945. txt1 += '<tr><td class="repitem" align="center"><b>' + nodo2val.rows[i].cells[0].textContent + '</b></td>'; //Valoración
  4946. txt1 += '<td><img align="top" src="/images/bars/bar1.gif" border="0" width="' + Math.round(parseInt(nodo2val.rows[i].cells[1].firstChild.width)*0.82) + '" height="14" border="1">' + nodo2val.rows[i].cells[1].textContent + '</td>'; //Porcentaje
  4947. txt1 += '<td align="right">' + nodo2val.rows[i].cells[2].textContent + '</td></tr>'; //Votos
  4948. }
  4949. txt1 += '</table></td></tr>';
  4950. //Tablas de GENEROS
  4951. txt1 += '<tr><td>&nbsp;</td></tr>';
  4952. txt1 += '<tr><td align="center" colspan="2"><b><FONT SIZE=4>Votaciones por géneros</FONT></b></td></tr>';
  4953. txt1 += '<tr><td width="50%" align="center"><b><FONT SIZE=2 COLOR=BLUE>' + nick1 + '</FONT></b></td><td width="50%" align="center"><b><FONT SIZE=2 COLOR=GREEN>' + nick2 + '</FONT></b></td></tr>';
  4954. txt1 += '<tr><td><table class="reptable" align="center"><tbody>';
  4955. txt1 += '<tr><th>' + nodogen.rows[0].cells[0].textContent + '</th><th>' + nodogen.rows[0].cells[1].textContent + '</th><th>' + nodogen.rows[0].cells[2].textContent + '</th></tr>';
  4956. for(i = 1; i < nodogen.rows.length; i++) {
  4957. txt1 += '<tr><td align="right">' + nodogen.rows[i].cells[0].textContent + '<img align="top" src="/images/bars/bar1.gif" border="0" width="' + Math.round(parseInt(nodogen.rows[i].cells[0].lastChild.width)*0.91) + '" height="14" border="1"></td>';
  4958. txt1 += '<td class="repitem" align="center">' + nodogen.rows[i].cells[1].textContent + '</td>';
  4959. txt1 += '<td><img align="top" src="/images/bars/bar1.gif" border="0" width="' + Math.round(parseInt(nodogen.rows[i].cells[2].firstChild.width)*0.91) + '" height="14" border="1">' + nodogen.rows[i].cells[2].textContent + '</td></tr>';
  4960. }
  4961. txt1 += '</table></td>';
  4962. txt1 += '<td><table class="reptable" align="center"><tbody>';
  4963. txt1 += '<tr><th>' + nodogen.rows[0].cells[0].textContent + '</th><th>' + nodogen.rows[0].cells[1].textContent + '</th><th>' + nodogen.rows[0].cells[2].textContent + '</th></tr>';
  4964. for(i = 1; i < nodo2gen.rows.length; i++) {
  4965. txt1 += '<tr><td align="right">' + nodo2gen.rows[i].cells[0].textContent + '<img align="top" src="/images/bars/bar1.gif" border="0" width="' + Math.round(parseInt(nodo2gen.rows[i].cells[0].lastChild.width)*0.91) + '" height="14" border="1"></td>';
  4966. txt1 += '<td class="repitem" align="center">';
  4967. txt2 = nodo2gen.rows[i].cells[1].textContent;
  4968. if(txt2.indexOf("Acci") != -1)
  4969. txt1 += 'Acción</td>';
  4970. else if(txt2.indexOf("Fant") != -1)
  4971. txt1 += 'Fantástico</td>';
  4972. else if(txt2.indexOf("Ciencia fic") != -1)
  4973. txt1 += 'Ciencia ficción</td>';
  4974. else if(txt2.indexOf("Animaci") != -1)
  4975. txt1 += 'Animación</td>';
  4976. else if(txt2.indexOf("lico") != -1)
  4977. txt1 += 'Bélico</td>';
  4978. else
  4979. txt1 += txt2 + '</td>';
  4980. txt1 += '<td><img align="top" src="/images/bars/bar1.gif" border="0" width="' + Math.round(parseInt(nodo2gen.rows[i].cells[2].firstChild.width)*0.91) + '" height="14" border="1">' + nodo2gen.rows[i].cells[2].textContent + '</td></tr>';
  4981. }
  4982. txt1 += '</table></td></tr>';
  4983. //Tablas de PAISES
  4984. txt1 += '<tr><td>&nbsp;</td></tr>';
  4985. txt1 += '<tr><td align="center" colspan="2"><b><FONT SIZE=4>Votaciones por países</FONT></b></td></tr>';
  4986. txt1 += '<tr><td width="50%" align="center"><b><FONT SIZE=2 COLOR=BLUE>' + nick1 + '</FONT></b></td><td width="50%" align="center"><b><FONT SIZE=2 COLOR=GREEN>' + nick2 + '</FONT></b></td></tr>';
  4987. txt1 += '<tr><td style="vertical-align:top"><table class="reptable" align="center"><tbody>';
  4988. txt1 += '<tr><th>' + nodopais.rows[0].cells[0].textContent + '</th><th>' + nodopais.rows[0].cells[1].textContent + '</th><th>' + nodopais.rows[0].cells[2].textContent + '</th></tr>';
  4989. for(i = 1; i < nodopais.rows.length; i++) {
  4990. txt1 += '<tr><td align="right">' + nodopais.rows[i].cells[0].textContent + '<img align="top" src="/images/bars/bar1.gif" border="0" width="' + Math.round(parseInt(nodopais.rows[i].cells[0].lastChild.width)*0.75) + '" height="14" border="1"></td>';
  4991. txt2 = nodopais.rows[i].cells[1].textContent;
  4992. txt1 += '<td class="repitem" align="center">';
  4993. if(txt2.indexOf("n Sovi") != -1)
  4994. txt1 += 'Unión Soviética</td>';
  4995. else if(txt2.indexOf("nia del Oest") != -1)
  4996. txt1 += 'Alemania del Oeste</td>';
  4997. else if(txt2.indexOf("nia del Est") != -1)
  4998. txt1 += 'Alemania del Este</td>';
  4999. else if(txt2.indexOf("ses Bajos") != -1)
  5000. txt1 += 'Holanda</td>';
  5001. else
  5002. txt1 += nodopais.rows[i].cells[1].textContent + '</td>';
  5003. txt1 += '<td><img align="top" src="/images/bars/bar1.gif" border="0" width="' + Math.round(parseInt(nodopais.rows[i].cells[2].firstChild.width)*0.78) + '" height="14" border="1">' + nodopais.rows[i].cells[2].textContent + '</td></tr>';
  5004. }
  5005. txt1 += '</table></td>';
  5006. txt1 += '<td style="vertical-align:top"><table class="reptable" align="center"><tbody>';
  5007. txt1 += '<tr><th>' + nodopais.rows[0].cells[0].textContent + '</th><th>' + nodopais.rows[0].cells[1].textContent + '</th><th>' + nodopais.rows[0].cells[2].textContent + '</th></tr>';
  5008. for(i = 1; i < nodo2pais.rows.length; i++) {
  5009. txt1 += '<tr><td align="right">' + nodo2pais.rows[i].cells[0].textContent + '<img align="top" src="/images/bars/bar1.gif" border="0" width="' + Math.round(parseInt(nodo2pais.rows[i].cells[0].lastChild.width)*0.75) + '" height="14" border="1"></td>';
  5010. txt2 = nodo2pais.rows[i].cells[1].textContent;
  5011. txt1 += '<td class="repitem" align="center">';
  5012. if(txt2.indexOf("n Sovi") != -1)
  5013. txt1 += 'Unión Soviética</td>';
  5014. else if(txt2.indexOf("Jap") != -1)
  5015. txt1 += 'Japón</td>';
  5016. else if(txt2.indexOf("Espa") != -1)
  5017. txt1 += 'España</td>';
  5018. else if(txt2.indexOf("Canad") != -1)
  5019. txt1 += 'Canadá</td>';
  5020. else if(txt2.indexOf("Taiw") != -1)
  5021. txt1 += 'Taiwán</td>';
  5022. else if(txt2.indexOf("xico") != -1)
  5023. txt1 += 'México</td>';
  5024. else if(txt2.indexOf("lgica") != -1)
  5025. txt1 += 'Bélgica</td>';
  5026. else if(txt2.indexOf("Ruman") != -1)
  5027. txt1 += 'Rumanía</td>';
  5028. else if(txt2.indexOf("frica") != -1)
  5029. txt1 += 'Suráfrica</td>';
  5030. else if(txt2.indexOf("Turq") != -1)
  5031. txt1 += 'Turquía</td>';
  5032. else if(txt2.indexOf("nia del Oest") != -1)
  5033. txt1 += 'Alemania del Oeste</td>';
  5034. else if(txt2.indexOf("nia del Est") != -1)
  5035. txt1 += 'Alemania del Este</td>';
  5036. else if(txt2.indexOf("ca Checa") != -1)
  5037. txt1 += 'República Checa</td>';
  5038. else if(txt2.indexOf("Ir") == 0 && txt2.indexOf("Irl") == -1)
  5039. txt1 += 'Irán</td>';
  5040. else if(txt2.indexOf("Paquist") != -1)
  5041. txt1 += 'Paquistán</td>';
  5042. else if(txt2.indexOf("bano") != -1)
  5043. txt1 += 'Líbano</td>';
  5044. else if(txt2.indexOf("Hungr") != -1)
  5045. txt1 += 'Hungría</td>';
  5046. else if(txt2.indexOf("Afganis") != -1)
  5047. txt1 += 'Afganistán</td>';
  5048. else if(txt2.indexOf("Kazajs") != -1)
  5049. txt1 += 'Kazajstán</td>';
  5050. else if(txt2.indexOf("But") != -1)
  5051. txt1 += 'Bután</td>';
  5052. else if(txt2.indexOf("Etiop") != -1)
  5053. txt1 += 'Etiopía</td>';
  5054. else if(txt2.indexOf("Panam") != -1)
  5055. txt1 += 'Panamá</td>';
  5056. else if(txt2.indexOf("Emiratos") != -1)
  5057. txt1 += 'Emiratos Árabes</td>';
  5058. else if(txt2.indexOf("Camer") != -1)
  5059. txt1 += 'Camerún</td>';
  5060. else if(txt2.indexOf("Per") != -1)
  5061. txt1 += 'Perú</td>';
  5062. else if(txt2.indexOf("ses Bajos") != -1)
  5063. txt1 += 'Holanda</td>';
  5064. else if(txt2.indexOf("T") == 0 && txt2.indexOf("nez") != -1)
  5065. txt1 += 'Túnez</td>';
  5066. else
  5067. txt1 += txt2 + '</td>';
  5068. txt1 += '<td><img align="top" src="/images/bars/bar1.gif" border="0" width="' + Math.round(parseInt(nodo2pais.rows[i].cells[2].firstChild.width)*0.78) + '" height="14" border="1">' + nodo2pais.rows[i].cells[2].textContent + '</td></tr>';
  5069. }
  5070. txt1 += '</table></td></tr>';
  5071. //Tabla de continentes
  5072. txt1 += '<tr><td>&nbsp;</td></tr>';
  5073. txt1 += '<tr><td align="center" colspan="2"><b><FONT SIZE=4>Votaciones por continentes</FONT></b></td></tr>';
  5074. txt1 += '<tr><td width="50%" align="center"><b><FONT SIZE=2 COLOR=BLUE>' + nick1 + '</FONT></b></td><td width="50%" align="center"><b><FONT SIZE=2 COLOR=GREEN>' + nick2 + '</FONT></b></td></tr>';
  5075. txt1 += '<tr><td><table class="reptable" align="center" width="355px"><tbody>';
  5076. txt1 += '<tr><th>' + nodopais.rows[0].cells[0].textContent + '</th><th>' + "Continente" + '</th><th>' + nodopais.rows[0].cells[2].textContent + '</th></tr>';
  5077. for(i = 0; i < 6; i++){
  5078. txt1 += '<tr><td align="right">' + datosContinentes[i].votos + ' <img align="top" src="/images/bars/bar1.gif" border="0" width="' + Math.round(Math.sqrt((datosContinentes[i].votos*120)/totalVotos)*8) + '" height="14" border="1"></td>';
  5079. txt1 += '<td class="repitem" align="center">' + datosContinentes[i].nombre + '</td>';
  5080. txt1 += '<td><img align="top" src="/images/bars/bar1.gif" border="0" width="' + Math.round(((Math.round(datosContinentes[i].media*10)/10)*120)/10) + '" height="14" border="1"> ' + ((Math.round(datosContinentes[i].media*10)/10).toFixed(1) + '').replace('.', ',') + '</td></tr>';
  5081. }
  5082. txt1 += '</table></td>';
  5083. txt1 += '<td><table class="reptable" align="center" width="355px"><tbody>';
  5084. txt1 += '<tr><th>' + nodopais.rows[0].cells[0].textContent + '</th><th>' + "Continente" + '</th><th>' + nodopais.rows[0].cells[2].textContent + '</th></tr>';
  5085. for(i = 0; i < 6; i++) {
  5086. txt1 += '<tr><td align="right">' + datosContinentes2[i].votos + ' <img align="top" src="/images/bars/bar1.gif" border="0" width="' + Math.round(Math.sqrt((datosContinentes2[i].votos*120)/totalVotos2)*8) + '" height="14" border="1"></td>';
  5087. txt1 += '<td class="repitem" align="center">' + datosContinentes2[i].nombre + '</td>';
  5088. txt1 += '<td><img align="top" src="/images/bars/bar1.gif" border="0" width="' + Math.round(((Math.round(datosContinentes2[i].media*10)/10)*120)/10) + '" height="14" border="1"> ' + ((Math.round(datosContinentes2[i].media*10)/10).toFixed(1) + '').replace('.', ',') + '</td></tr>';
  5089. }
  5090. txt1 += '</table></td></tr>';
  5091. //Tabla de años
  5092. txt1 += '<tr><td>&nbsp;</td></tr>';
  5093. txt1 += '<tr><td align="center" colspan="2"><b><FONT SIZE=4>Votaciones por años</FONT></b></td></tr>';
  5094. txt1 += '<tr><td width="50%" align="center"><b><FONT SIZE=2 COLOR=BLUE>' + nick1 + '</FONT></b></td><td width="50%" align="center"><b><FONT SIZE=2 COLOR=GREEN>' + nick2 + '</FONT></b></td></tr>';
  5095. txt1 += '<tr><td><table class="reptable" align="center"><tbody>';
  5096. txt1 += '<tr><th>' + nodoanios.rows[0].cells[0].textContent + '</th><th>' + nodoanios.rows[0].cells[1].textContent + '</th><th>' + nodoanios.rows[0].cells[2].textContent + '</th></tr>';
  5097. for(i = 1; i < nodoanios.rows.length; i++) {
  5098. txt1 += '<tr><td align="right">' + nodoanios.rows[i].cells[0].textContent + '<img align="top" src="/images/bars/bar1.gif" border="0" width="' + Math.round(parseInt(nodoanios.rows[i].cells[0].lastChild.width)*0.93) + '" height="14" border="1"></td>';
  5099. txt1 += '<td class="repitem" align="center">' + nodoanios.rows[i].cells[1].textContent + '</td>';
  5100. txt1 += '<td><img align="top" src="/images/bars/bar1.gif" border="0" width="' + Math.round(parseInt(nodoanios.rows[i].cells[2].firstChild.width)*0.93) + '" height="14" border="1">' + nodoanios.rows[i].cells[2].textContent + '</td></tr>';
  5101. }
  5102. txt1 += '</table></td>';
  5103. txt1 += '<td><table class="reptable" align="center"><tbody>';
  5104. txt1 += '<tr><th>' + nodoanios.rows[0].cells[0].textContent + '</th><th>' + nodoanios.rows[0].cells[1].textContent + '</th><th>' + nodoanios.rows[0].cells[2].textContent + '</th></tr>';
  5105. for(i = 1; i < nodo2anios.rows.length; i++) {
  5106. txt1 += '<tr><td align="right">' + nodo2anios.rows[i].cells[0].textContent + '<img align="top" src="/images/bars/bar1.gif" border="0" width="' + Math.round(parseInt(nodo2anios.rows[i].cells[0].lastChild.width)*0.93) + '" height="14" border="1"></td>';
  5107. txt1 += '<td class="repitem" align="center">' + nodo2anios.rows[i].cells[1].textContent + '</td>';
  5108. txt1 += '<td><img align="top" src="/images/bars/bar1.gif" border="0" width="' + Math.round(parseInt(nodo2anios.rows[i].cells[2].firstChild.width)*0.93) + '" height="14" border="1">' + nodo2anios.rows[i].cells[2].textContent + '</td></tr>';
  5109. }
  5110. txt1 += '</table></td></tr>';
  5111. //Afinidad
  5112. txt1 += '<tr><td>&nbsp;</td></tr>';
  5113. txt1 += '<tr><td align="center" colspan="2"><b><FONT SIZE=4>Afinidad (<FONT SIZE=3 COLOR=BLUE>' + nick1 + "</FONT> - <FONT SIZE=3 COLOR=GREEN>" + nick2 + '</FONT>)</FONT></b></td></tr>';
  5114. //Valoración
  5115. var afnvot = 0.0, afnvot2 = 0.0;
  5116. for(i = 1; i <= 10; i++){
  5117. var porcv1 = nodoval.rows[i].cells[1].textContent.split('%')[0].replace(',','.');
  5118. var porcv2 = nodo2val.rows[i].cells[1].textContent.split('%')[0].replace(',','.');
  5119. var difn2 = Math.abs(parseFloat(porcv1)-parseFloat(porcv2));
  5120. afnvot2 += afinidad_votos(difn2);
  5121. }
  5122. afnvot = afnvot2;
  5123. afnvot2 = 5*afnvot2;
  5124. txt1 += '<tr><td align="center" colspan="2" style="padding-top:2px" width="180px"><b><FONT SIZE=3 COLOR="#447CAD">Valoración</FONT>&nbsp;&nbsp;&nbsp;' + afnvot2.toFixed(1) + ' %</b></td></tr>';
  5125. //Géneros
  5126. var afngen = 0.0, afngen2 = 0.0, afngen3 = 0.0;
  5127. for(i = 0; i <= 17; i++){
  5128. var porcg1 = datosGeneros[i].votos/totalVotos;
  5129. var porcg2 = datosGeneros2[i].votos/totalVotos2;
  5130. var medg1 = datosGeneros[i].media;
  5131. var medg2 = datosGeneros2[i].media;
  5132. var difn = Math.abs((porcg1*100)-(porcg2*100));
  5133. var difn2 = Math.abs(parseFloat(medg1)-parseFloat(medg2));
  5134. afngen += afinidad_votos(difn)*0.5;
  5135. afngen2 += afinidad_medias(difn2)*0.5;
  5136. }
  5137. afngen3 = (afngen+afngen2)*2.78;
  5138. txt1 += '<tr><td align="center" colspan="2" width="180px"><b><FONT SIZE=3 COLOR="#447CAD">Géneros</FONT>&nbsp;&nbsp;&nbsp;' + afngen3.toFixed(1) + ' %</b></td></tr>';
  5139. //Afinidad paises
  5140. var afnnpaises = afinidad_npaises(Math.abs(totalPaises-totalPaises2))*2.5;
  5141. var afnp = 0.0, afnp2 = 0.0, afnp3 = 0.0, afnp4 = 0.0;
  5142. var contp = 0;
  5143. for(i = 0; i <= 189; i++){
  5144. if(datosPaises[i].votos != 0 && datosPaises2[i].votos != 0){
  5145. contp++;
  5146. var porcg1 = datosPaises[i].votos/totalVotos;
  5147. var porcg2 = datosPaises2[i].votos/totalVotos2;
  5148. var medg1 = datosPaises[i].media;
  5149. var medg2 = datosPaises2[i].media;
  5150. var difn = Math.abs((porcg1*100)-(porcg2*100));
  5151. var difn2 = Math.abs(parseFloat(medg1)-parseFloat(medg2));
  5152. afnp += afinidad_votos(difn);
  5153. afnp2 += afinidad_medias(difn2);
  5154. }
  5155. }
  5156. afnp3 = ((afnp*8.5)/(2*contp)) + ((afnp2*8.5)/(2*contp));
  5157. afnp4 = (afnp3*5.588235294117647)+afnnpaises;
  5158. txt1 += '<tr><td align="center" colspan="2" width="180px"><b><FONT SIZE=3 COLOR="#447CAD">Países</FONT>&nbsp;&nbsp;&nbsp;' + afnp4.toFixed(1) + ' %</b></td></tr>';
  5159. //Años
  5160. var afnanios = 0.0, afnanios2 = 0.0, afnanios3 = 0.0;
  5161. for(i = 1; i <= 22; i++){
  5162. var porcg1 = parseFloat(nodoanios.rows[i].cells[0].textContent)/totalVotos;
  5163. var porcg2 = parseFloat(nodo2anios.rows[i].cells[0].textContent)/totalVotos2;
  5164. var medg1 = parseFloat(nodoanios.rows[i].cells[2].textContent.replace(',', '.'));
  5165. var medg2 = parseFloat(nodo2anios.rows[i].cells[2].textContent.replace(',', '.'));
  5166. porcg1 = porcg1*100;
  5167. porcg2 = porcg2*100;
  5168. var difn = Math.abs(porcg1-porcg2);
  5169. var difn2 = Math.abs(parseFloat(medg1)-parseFloat(medg2));
  5170. afnanios += afinidad_votos_años(difn);
  5171. afnanios2 += afinidad_medias(difn2);
  5172. }
  5173. afnanios = afnanios*0.375;
  5174. afnanios2 = afnanios2*0.125;
  5175. afnanios3 = (afnanios+afnanios2)*4.545454545454545;
  5176. txt1 += '<tr><td align="center" colspan="2" width="180px"><b><FONT SIZE=3 COLOR="#447CAD">Años</FONT>&nbsp;&nbsp;' + afnanios3.toFixed(1) + ' %</b></td></tr>';
  5177. //Afinidad total
  5178. // 20% afnvot - 18% votos gen - 18% media gen - 5% npaises - 17% paises - 16,5% votos anios - 5,5 medias anios
  5179. var afntotal = afnvot + afngen + afngen2 + afnp3 + afnnpaises + afnanios + afnanios2;
  5180. //alert(afnvot + "-" + afngen + "-" + afngen2 + "-" + afnp3 + "-" + afnnpaises + "-" + afnanios + "-" + afnanios2);
  5181. txt1 += '<tr><td align="center" colspan="2" width="180px" style="padding-top:2px"><b><FONT SIZE=5 COLOR="F0860C">TOTAL</FONT>&nbsp;&nbsp;&nbsp;<FONT SIZE=5>' + afntotal.toFixed(1) + ' </FONT>%</b></td></tr>';
  5182. tablagen.innerHTML = txt1;
  5183. nodotodo.parentNode.insertBefore(tablagen, nodotodo);
  5184. });
  5185. nodoval.parentNode.parentNode.removeChild(nodoval.parentNode);
  5186. nodogen.parentNode.parentNode.removeChild(nodogen.parentNode);
  5187. nodopais.parentNode.parentNode.removeChild(nodopais.parentNode);
  5188. nodoanios.parentNode.parentNode.removeChild(nodoanios.parentNode);
  5189. }
  5190. //Añade información (nota+votos) de otras páginas
  5191. function doAddExtraRatings(){
  5192. function extractTranslatedTitle() {
  5193. var nodo = "//span[@itemprop='name']".findNode();
  5194. return nodo.textContent.clearTitle();
  5195. }
  5196. function extractOriginalTitle(){
  5197. var nodo = "//dt[contains(text(),'tulo original')]/following-sibling::*".findNode();
  5198. return nodo.textContent.clearTitle();
  5199. }
  5200. var isSerie = false;
  5201. var tit_traducido = extractTranslatedTitle().split(' ').join('+');
  5202. var tit_original = extractOriginalTitle().split(' ').join('+');
  5203. var anio = "//dt[text()='Año']/following-sibling::*".findNode().lastChild.textContent.trim();
  5204. //Para animes
  5205. var isAnime = false;
  5206. var generoanm = '//dt[text()="Reparto"]/following-sibling::*/a'.findNode();
  5207. var paisanm = '//dt[text()="País"]/following-sibling::*'.findNode();
  5208. var urlmal = "";
  5209. var animeTitle = "";
  5210. if(generoanm.textContent == "Animation" && paisanm.textContent.trim() == "Japón"){
  5211. isAnime = true;
  5212. if ("//span[@itemprop='name']".findNode().textContent.indexOf("Serie de TV") > -1){
  5213. var auxanm = "//dt[contains(text(),'tulo original')]/following-sibling::*".findNode().textContent;
  5214. var coincidencias = auxanm.match(/\(/g);
  5215. var numcars = coincidencias ? coincidencias.length : 0;
  5216. if(numcars == 1)
  5217. animeTitle = tit_original;
  5218. else
  5219. animeTitle = auxanm.split('(')[1].split(')')[0];
  5220. }
  5221. else {
  5222. var auxanm = "//dt[contains(text(),'tulo original')]/following-sibling::*".findNode().textContent;
  5223. var coincidencias = auxanm.match(/\(/g);
  5224. var numcars = coincidencias ? coincidencias.length : 0;
  5225. if(numcars >= 1)
  5226. animeTitle = auxanm.split('(')[1].split(')')[0];
  5227. else
  5228. animeTitle = tit_original;
  5229. }
  5230. urlmal = "https://www.google.es/search?q=" + animeTitle.split(' ').join('+') + "+score+users+myanimelist";
  5231. }
  5232. //Comprobar si es serie de tv
  5233. if ("//span[@itemprop='name']".findNode().textContent.indexOf("Serie de TV") > -1)
  5234. isSerie = true;
  5235. //Urls
  5236. var urlimdb = "https://www.google.es/search?q=" + tit_original.replace('#',' ') + "+" + anio + "+imdb";
  5237. var urlrtn = "https://www.google.es/search?q=" + tit_original.replace('#',' ') + "+" + anio + '+tomatoes+"user+ratings:"+liked+it';
  5238. var urlrtn2 = "https://www.google.es/search?q=" + tit_original.replace('#',' ') + '+"User+Ratings:"+"Average+Rating"+"liked+it."+site:www.rottentomatoes.com';
  5239. //var urlabd = "https://www.google.es/search?q=" + tit_traducido.replace('#',' ') + "+" + anio + "+abandomoviez+puntos+total";
  5240. //var urlabd2 = "https://www.google.es/search?q=" + tit_traducido.replace('#',' ') + "+" + anio + '+pts+"(Total:"+www.abandomoviez.net/movil/';
  5241. var nodop = '//div[@class="share-links-movie"]'.findNode();
  5242. //Creamos un nuevo cuadro para las notas
  5243. var newdiv = d.createElement('div');
  5244. newdiv.style.backgroundColor = "#F0F0F0";
  5245. newdiv.style.border = "1px solid #CDDCEB";
  5246. newdiv.style.textAlign = "center";
  5247. newdiv.style.margin = "10px";
  5248. newdiv.style.display = "block";
  5249. var auximdb;
  5250. var notaimdb;
  5251. var votosimdb;
  5252. var auxrtn;
  5253. var notartn;
  5254. var votosrtn;
  5255. //var auxabd, notaabd, votosabd;
  5256. var auxmal, notamal, votosmal;
  5257. var tmp = "";
  5258. tmp += '<div style="text-align:center;">';
  5259. tmp += '<div style="padding:10px 0 4px; color:#4682B4; font-size:13px"><strong>OTRAS PÁGINAS</strong></div>';
  5260. //tmp += '<img id="logoimdb" src="' + logoimdb + '">';
  5261. if(!isAnime){
  5262. //IMDB
  5263. tmp += '<div style="margin: 5px 15px; padding:4px 0; color:#A58500; background-color:#ffffff; font-size:18px;font-weight: bold;border:1px solid #A58500;">IMDB';
  5264. tmp += '<div>';
  5265. tmp += '<div id="cnimdb" style="padding:6px;font-size:22px;color:#136CB2;font-weight: bold;">-,-</div>';
  5266. tmp += '<div id="vtimdb" style="font-size:12px;color:#A58500;padding:1px 0px;"></div></div></div>';
  5267. //RottenTomatoes
  5268. tmp += '<div style="margin: 12px 15px; padding:4px 0; color:#627D11; background-color:#ffffff; font-size:18px;font-weight: bold;border:1px solid #627D11;">Rotten Tomatoes';
  5269. tmp += '<div>';
  5270. tmp += '<div id="notartn" style="padding:6px; color:#CF4400; font-size:22px;font-weight: bold;">-,-</div>';
  5271. tmp += '<div id="vrtn" style="font-size:12px;color:#627D11;padding:1px 0px;">NO</div></div></div>';
  5272. //Abandomoviez
  5273. /*tmp += '<div style="margin: 5px 15px 10px; padding:4px 0; color:#000000; background-color:#ffffff; font-size:16px;font-weight: bold;border:1px solid #000000;">Abandomoviez';
  5274. tmp += '<div>';
  5275. tmp += '<div id="notaabd" style="padding:6px; color:#310100; font-size:22px;font-weight: bold;">-,-</div>';
  5276. tmp += '<div id="vabd" style="font-size:12px;color:#000000;padding:1px 0px;">NO</div></div></div>';*/
  5277. }
  5278. else {
  5279. //MyAnimeList
  5280. tmp += '<div style="margin: 5px 15px 10px; padding:4px 0; color:#2e51a2; background-color:#ffffff; font-size:16px;font-weight: bold;border:1px solid #2e51a2;">MyAnimeList';
  5281. tmp += '<div>';
  5282. tmp += '<div id="notamal" style="padding:6px; color:#000000; font-size:22px;font-weight: bold;">-,-</div>';
  5283. tmp += '<div id="vmal" style="font-size:12px;color:#2e51a2;padding:1px 0px;">NO</div></div></div>';
  5284. }
  5285. tmp += '</div>';
  5286. newdiv.innerHTML = tmp;
  5287. nodop.parentNode.insertBefore(newdiv, nodop);
  5288. if(!isAnime){
  5289. doGet(urlimdb, function (response) {
  5290. var emptydiv = document.createElement('div');
  5291. emptydiv.innerHTML = response;
  5292. auximdb = '//div[contains(text(),"Valoraci")]'.findNode(emptydiv).textContent;
  5293. notaimdb = auximdb.split(" ")[2].split("/")[0];
  5294. votosimdb = auximdb.split(" ")[4].split(" ")[0];
  5295. var notabien = notaimdb.replace('.',',');
  5296. var nodnota = '//div[@id="cnimdb"]'.findNode();
  5297. var nodvotos = '//div[@id="vtimdb"]'.findNode();
  5298. if(notabien.length == 1)
  5299. nodnota.textContent = notabien + ",0";
  5300. else
  5301. nodnota.textContent = notabien;
  5302. nodvotos.textContent = votosimdb + " votos";
  5303. });
  5304. if(!isSerie){
  5305. doGet(urlrtn, function (response) {
  5306. var emptydiv = document.createElement('div');
  5307. emptydiv.innerHTML = response;
  5308. //notartn = '//span[@class="st"]'.findNode(emptydiv).textContent.split("it. Average Rating: ")[1].split('/')[0];
  5309. auxrtn = '//span[@class="st"]'.findNode(emptydiv).textContent;
  5310. var coincidencias = auxrtn.match(/it. Average Rating/g);
  5311. var nodvotos = '//div[@id="vrtn"]'.findNode();
  5312. if(coincidencias != null){
  5313. notartn = auxrtn.split("it. Average Rating: ")[1].split('/')[0];
  5314. votosrtn = auxrtn.split("User Ratings: ")[1].split("...")[0].trim();
  5315. var notabien = (parseFloat(notartn)*2).toFixed(1).replace('.',',');
  5316. var nodnota = '//div[@id="notartn"]'.findNode();
  5317. nodnota.textContent = notabien;
  5318. var votosbien = votosrtn.split(',').join('.');
  5319. nodvotos.textContent = votosbien + " votos";
  5320. }
  5321. if(nodvotos.textContent == "NO"){
  5322. doGet(urlrtn2, function (response) {
  5323. var nodvotos = '//div[@id="vrtn"]'.findNode();
  5324. var emptydiv = document.createElement('div');
  5325. emptydiv.innerHTML = response;
  5326. //notartn = '//span[@class="st"]'.findNode(emptydiv).textContent.split("it. Average Rating: ")[1].split('/')[0];
  5327. auxrtn = '//span[@class="st"]'.findNode(emptydiv).textContent;
  5328. var coincidencias = auxrtn.match(/it. Average Rating/g);
  5329. if(coincidencias != null){
  5330. notartn = auxrtn.split("it. Average Rating: ")[1].split('/')[0];
  5331. votosrtn = auxrtn.split("User Ratings: ")[1].split("...")[0].trim();
  5332. var notabien = (parseFloat(notartn)*2).toFixed(1).replace('.',',');
  5333. var nodnota = '//div[@id="notartn"]'.findNode();
  5334. nodnota.textContent = notabien;
  5335. var votosbien = votosrtn.split(',').join('.');
  5336. nodvotos.textContent = votosbien + " votos";
  5337. }});
  5338. }});
  5339. }
  5340. /*doGet(urlabd2, function (response) {
  5341. var emptydiv = document.createElement('div');
  5342. emptydiv.innerHTML = response;
  5343. //auxabd = '//em[text()="Total"]/ancestor::*[position()=1]'.findNode(emptydiv).textContent;
  5344. auxabd = '//em[text()="Total"]'.findNode(emptydiv).parentNode.textContent;
  5345. votosabd = auxabd.split("Total: ")[1].split(')')[0];
  5346. notaabd = auxabd.split("'. ")[1].split(" pts")[0];
  5347. var notabien = (parseFloat(notaabd)).toFixed(1).replace('.',',');
  5348. var nodnota = '//div[@id="notaabd"]'.findNode();
  5349. nodnota.textContent = notabien;
  5350. var nodvotos = '//div[@id="vabd"]'.findNode();
  5351. nodvotos.textContent = addMiles(votosabd) + " votos";
  5352. }); */
  5353. }
  5354. else {
  5355. doGet(urlmal, function (response) {
  5356. var emptydiv = document.createElement('div');
  5357. emptydiv.innerHTML = response;
  5358. auxmal = '//em[text()="scored"]'.findNode(emptydiv).parentNode.textContent;
  5359. votosmal = auxmal.split("scored by ")[1].split(' users)')[0];
  5360. notamal = auxmal.split("Score: ")[1].split(" (scored")[0];
  5361. var notabien = (parseFloat(notamal)).toFixed(1).replace('.',',');
  5362. var nodnota = '//div[@id="notamal"]'.findNode();
  5363. nodnota.textContent = notabien;
  5364. var nodvotos = '//div[@id="vmal"]'.findNode();
  5365. nodvotos.textContent = addMiles(votosmal) + " votos";
  5366. });
  5367. }
  5368. var disclai = '//div[@class="movie-disclaimer"]'.findNode();
  5369. disclai.style.padding = "0px 20px";
  5370. }
  5371. function addMiles(nStr)
  5372. {
  5373. nStr += '';
  5374. x = nStr.split('.');
  5375. x1 = x[0];
  5376. x2 = x.length > 1 ? '.' + x[1] : '';
  5377. var rgx = /(\d+)(\d{3})/;
  5378. while (rgx.test(x1)) {
  5379. x1 = x1.replace(rgx, '$1' + '.' + '$2');
  5380. }
  5381. return x1 + x2;
  5382. }
  5383. function doAddExtraVotes(){
  5384. var nodot = '//b[contains(text(),"Votaciones de tus Amigos")]/ancestor::*[position()=7]'.findNode();
  5385. var clon1 = nodot.cloneNode(true);
  5386. var aux = '/td[2]/table/tbody/tr'.findNode(clon1);
  5387. aux.style.backgroundColor = "#CAFF70";
  5388. //Nodo span titulo tabla
  5389. aux = '/td[2]/table/tbody/tr/td/span'.findNode(clon1);
  5390. aux.style.color="#308014";
  5391. aux.lastChild.textContent = "Votaciones de tus contactos adicionales:";
  5392. //Eliminamos los votos de amigos
  5393. var votesTable = '/td[2]/table'.findNode(clon1);
  5394. var tBody = votesTable.lastChild;
  5395. while(votesTable.rows.length > 1) {
  5396. tBody.removeChild(votesTable.rows[1]);
  5397. }
  5398. //Añadimos por defecto que nadie haya votado
  5399. var trnadie = d.createElement('tr');
  5400. var tdnadie = d.createElement('td');
  5401. tdnadie.colSpan = 3;
  5402. tdnadie.textContent = "Tus contactos adicionales no han valorado esta película.";
  5403. trnadie.appendChild(tdnadie);
  5404. tBody.appendChild(trnadie);
  5405. //Añadimos la fila vacía del final para mejorar aspecto
  5406. var trvacia = d.createElement('tr');
  5407. var tdvacia = d.createElement('td');
  5408. tdvacia.colSpan = 3;
  5409. tdvacia.textContent = "";
  5410. trvacia.appendChild(tdvacia);
  5411. tBody.appendChild(trvacia);
  5412. //Obtenemos los contactos
  5413. var friendsStr = GM_getValue(userId + '.extraFriends');
  5414. var eFriends;
  5415. if (typeof friendsStr != 'undefined') {
  5416. eFriends = eval(friendsStr);
  5417. } else {
  5418. eFriends = [];
  5419. }
  5420. eFriends.sort(function(a, b) {
  5421. return a.name.toLowerCase() > b.name.toLowerCase();
  5422. });
  5423. //Obtenemos id de la película
  5424. var nodo3 = '//a[contains(text(),"Añade tu crítica") or contains(text(),"Eliminar crítica")]'.findNode();
  5425. var aux3 = nodo3.href.split('=');
  5426. var idpeli = aux3[1];
  5427. var nota = "";
  5428. var numvista = 0;
  5429. var sumavotos = 0;
  5430. var url = 'http://cinemakb.freehostingcloud.com/src/prueba.php?pelicula=' + idpeli;
  5431. doGet(url, function (response) {
  5432. var emptydiv = document.createElement('div');
  5433. emptydiv.innerHTML = response;
  5434. var nodos = '//strong'.findNodesArray(emptydiv);
  5435. if(nodos.length > 0){
  5436. var aids = new Array(nodos.length);
  5437. var anotas = new Array(nodos.length);
  5438. for(i = 0; i < nodos.length; i++){
  5439. aids[i] = nodos[i].textContent.split('-')[0];
  5440. anotas[i] = nodos[i].textContent.split('-')[1];
  5441. }
  5442. for(ix in eFriends)
  5443. for(j = 0; j < aids.length; j++)
  5444. if(eFriends[ix].id == aids[j])
  5445. nueva_fila(eFriends[ix].id, eFriends[ix].name, anotas[j]);
  5446. }
  5447. });
  5448. function nueva_fila(numero, nombre, nota){
  5449. numvista++;
  5450. sumavotos += parseInt(nota);
  5451. var notamedia = 0.0;
  5452. //Creamos la fila con nick + compartir + nota
  5453. var newtr = d.createElement('tr');
  5454. var txtfila = "";
  5455. txtfila += '<td width="300"><a class="lnk3" href="/es/userlastratings.php?user_id=' + numero + '"><b>' + nombre + '</b></a></td>';
  5456. txtfila += '<td><span class="share-link" style="float:none"><a href="/es/sharerating/' + numero + '/' + idpeli + '.html">Compartir</a></span></td>';
  5457. txtfila += '<td width="140" align="center"><img src="http://www.filmaffinity.com/imgs/myratings/' + nota + '.gif" width="112" height="11"></td>';
  5458. newtr.innerHTML = txtfila;
  5459. //Media votaciones
  5460. var trmedia = d.createElement('tr');
  5461. trmedia.style.backgroundColor = "#eeeeee";
  5462. var tdmedia = d.createElement('td');
  5463. tdmedia.colSpan = 2;
  5464. var spanmedia = d.createElement('span');
  5465. spanmedia.style.color = "#606020";
  5466. spanmedia.textContent = "La votación media de tus contactos adicionales es ";
  5467. var bmedia = d.createElement('b');
  5468. spanmedia.appendChild(bmedia);
  5469. tdmedia.appendChild(spanmedia);
  5470. trmedia.appendChild(tdmedia);
  5471. var tdmediaimg = d.createElement('td');
  5472. tdmediaimg.align = "center";
  5473. var imgmediaimg = d.createElement('img');
  5474. imgmediaimg.src = "";
  5475. imgmediaimg.id = "pruebaimg";
  5476. tdmediaimg.appendChild(imgmediaimg);
  5477. trmedia.appendChild(tdmediaimg);
  5478. if(numvista == 2){
  5479. notamedia = (sumavotos/numvista).toFixed(1);
  5480. imgmediaimg.src = "http://www.filmaffinity.com/imgs/myratings/" + Math.round(notamedia) + ".gif";
  5481. bmedia.textContent = notamedia.replace('.',',');
  5482. votesTable.rows[0].parentNode.insertBefore(newtr, votesTable.rows[0].parentNode.lastChild );
  5483. votesTable.rows[0].parentNode.insertBefore(trmedia,votesTable.rows[0].parentNode.lastChild);
  5484. }
  5485. else if(numvista > 2){
  5486. var nspan = '//span[contains(text(),"tactos adicionales es")]'.findNode();
  5487. var nodob = nspan.lastChild;
  5488. var nimg = '//img[@id="pruebaimg"]'.findNode();
  5489. notamedia = (sumavotos/numvista).toFixed(1);
  5490. nimg.src = "http://www.filmaffinity.com/imgs/myratings/" + Math.round(notamedia) + ".gif";
  5491. nodob.textContent = notamedia.replace('.',',');
  5492. votesTable.rows[0].parentNode.insertBefore(newtr, votesTable.rows[0].parentNode.lastChild.previousSibling);
  5493. }
  5494. else {
  5495. votesTable.rows[0].parentNode.removeChild(votesTable.rows[0].parentNode.lastChild.previousSibling);
  5496. votesTable.rows[0].parentNode.insertBefore(newtr,votesTable.rows[0].parentNode.lastChild);
  5497. }
  5498. }
  5499. nodot.parentNode.appendChild(clon1);
  5500. }
  5501. function extractUserData() {
  5502. var user = url.split('user_id=')[1].split("&")[0];
  5503. var nombre = '//span[@id="nick"]'.findNode().textContent;
  5504. var valoradas = '//strong[contains(text(),"Media votos")]/../following-sibling::*'.findNode().textContent;
  5505. var criticas = '//a[contains(text(),"valoradas")]/../following-sibling::*'.findNode().textContent;
  5506. if(criticas != 0)
  5507. var listas = '//a[text()="Críticas"]/../following-sibling::*'.findNode().textContent;
  5508. else
  5509. var listas = '//dd[text()="Críticas"]/following-sibling::*'.findNode().textContent;
  5510. var ciudad = d.getElementById("loc").textContent;
  5511. var pais = ciudad.split('-')[1].trim();
  5512. ciudad = ciudad.split('-')[0].trim();
  5513. dir = ciudad + ' (' + pais + ')';
  5514. return {id:user,name:nombre,city:dir,votes:valoradas,reviews:criticas,lists:listas};
  5515. }
  5516. // Captura los datos del usuario si lo tenemos en la lista de Contactos y actualiza los datos
  5517. function doCaptureContactData() {
  5518. var user = url.split('user_id=')[1].split("#")[0];
  5519. var friendsStr = GM_getValue(userId + '.extraFriends');
  5520. // Añadimos los nuevos amigos
  5521. if (typeof friendsStr != 'undefined') {
  5522. var eFriends = eval(friendsStr);
  5523. if (inArray(eFriends, 'id', user)) {
  5524. var friend = extractUserData();
  5525. eFriends = arrayReplace(eFriends, 'id', friend);
  5526. GM_setValue(userId + '.extraFriends', eFriends.toSource());
  5527. }
  5528. }
  5529. }
  5530. function doAddCompactTopics(){
  5531. var topic = '//h1'.findNode().textContent;
  5532. var nompelis = '//div[@class="title"]/a'.findNodesArray();
  5533. var nodofin = '//a[@href="/es/abouttopics.php"]'.findNode();
  5534. for(var ix in nompelis){
  5535. var titlep2 = nompelis[ix].textContent;
  5536. //var titlep = titlep2.replace('\'','\\\'');
  5537. //var titlep = replaceAll(titlep2,'\'','\\\'');
  5538. var titlep = titlep2.replace(/'/g,"\\\'");
  5539. var aux = nompelis[ix].href;
  5540. var idpeli = aux.split('/film')[1].split('.')[0];
  5541. //aux = aux.split('/')[1];
  5542. var newa = d.createElement('div');
  5543. newa.textContent = "\nINSERT INTO Topics (topic, movietitle, movieid) VALUES ('" + topic + "','" + titlep + "'," + idpeli + ");";
  5544. nodofin.parentNode.appendChild(newa);
  5545. }}
  5546. function doAddCompactCountries(){
  5547. var users = [924191, 878650, 474985, 177697, 348700, 976346, 144434, 540308, 981629, 590705, 597200, 875263, 887714, 137856, 657063, 589644, 121592,
  5548. 737874, 490208, 497388, 690687, 671651, 705164, 764150, 111084, 257981, 394088, 135983, 908337, 842869, 752302, 294230, 184588, 754665,
  5549. 219396, 330506, 185714, 168031, 160297, 914125, 988909, 523226, 747725, 555951, 171552, 540682, 972101, 122658, 517374, 991334, 809610,
  5550. 880103, 487742, 518698, 756330, 686717, 359606, 923024, 273407, 957487, 716868, 895600, 858723, 574888, 894359, 673828, 704789, 352669,
  5551. 978268, 688414, 630795, 125994, 287229, 260922, 990342, 776261, 625526, 621667, 337507, 973245, 606658, 696516, 364238, 568017, 771651,
  5552. 753770, 797457, 314140, 951662, 262690, 382637, 178257, 701552, 455908, 676524, 264127, 829861, 369212, 729641, 740465, 564844, 469105,
  5553. 169666, 728433, 641330, 423357, 170541, 453676, 650024, 426745, 859508, 285350, 320483, 457524, 964605, 611087, 415953, 120344, 833515,
  5554. 778888, 815985, 448184, 173945, 921495, 834784, 411060, 344015, 448370, 587109, 433484, 235274, 349357, 461147, 316001, 391357, 179758,
  5555. 799711, 964016, 141531, 663655, 988980, 377949, 821782, 459581, 534286, 215932, 373527, 162878, 454691, 809373, 317215, 271052, 801029,
  5556. 192337, 399803, 631652, 735650, 404719, 629405, 399540, 255737, 582394];
  5557. var nodopais = '//div[text()="País"]'.findNode();
  5558. var nodogen = '//div[text()="Género"]'.findNode();
  5559. var nodoanios = '//div[text()="Años"]'.findNode();
  5560. var nodofin = '//ul[@class="userrep-explan"]'.findNode();
  5561. var nombre = '//div[@class="user-nick-wrapper"]/h2'.findNode().textContent;
  5562. var nid = url.split('user_id=')[1];
  5563. var txt = "";
  5564. var cant = "";
  5565. var txt2 = "";
  5566. var media = "";
  5567. /*var paginas = "";
  5568. if(nid == 878650){
  5569. for(var ix in users){
  5570. //paginas += "http://www.filmaffinity.com/es/userrep.php?user_id=" + users[ix] + "\n";
  5571. var divpag = d.createElement('div');
  5572. divpag.textContent = "http://www.filmaffinity.com/es/userrep.php?user_id=" + users[ix];
  5573. nodofin.parentNode.appendChild(divpag);
  5574. }
  5575. }
  5576. */
  5577. var newdel1 = d.createElement('div');
  5578. var newdel2 = d.createElement('div');
  5579. var newdel3 = d.createElement('div');
  5580. newdel1.textContent = "DELETE FROM Generos WHERE userid = " + nid + ";";
  5581. newdel2.textContent = "DELETE FROM Paises WHERE userid = " + nid + ";";
  5582. newdel3.textContent = "DELETE FROM Anios WHERE userid = " + nid + ";";
  5583. nodofin.parentNode.appendChild(newdel1);
  5584. nodofin.parentNode.appendChild(newdel2);
  5585. nodofin.parentNode.appendChild(newdel3);
  5586.  
  5587. for(var i = 3; i < nodogen.parentNode.childNodes.length; i+= 2){
  5588. txt = nodogen.parentNode.childNodes[i].textContent;
  5589. var nodosg = d.querySelectorAll('rect[title="' + txt + '"]');
  5590. cant = nodosg[0].nextSibling.nextSibling.textContent;
  5591. media = nodosg[1].nextSibling.nextSibling.textContent;
  5592. txt2 = getGenCode(txt);
  5593. var newa = d.createElement('div');
  5594. newa.textContent = "\nINSERT INTO Generos (nick, userid, gen, cant, avg) VALUES ('" + nombre + "'," + nid + ",'" + txt2 + "'," + cant + ",'" + media + "');";
  5595. nodofin.parentNode.appendChild(newa);
  5596. }
  5597. for(var i = 3; i < nodopais.parentNode.childNodes.length; i+= 2){
  5598. txt = nodopais.parentNode.childNodes[i].textContent;
  5599. var nodosp = d.querySelectorAll('rect[title="' + txt + '"]');
  5600. cant = nodosp[0].nextSibling.nextSibling.textContent;
  5601. media = nodosp[1].nextSibling.nextSibling.textContent;
  5602. txt2 = getCountryCode(txt);
  5603. var newa = d.createElement('div');
  5604. newa.textContent = "\nINSERT INTO Paises (nick, userid, pais, cant, avg) VALUES ('" + nombre + "'," + nid + ",'" + txt2 + "'," + cant + ",'" + media + "');";
  5605. nodofin.parentNode.appendChild(newa);
  5606. }
  5607. for(var i = 3; i < nodoanios.parentNode.childNodes.length; i+= 2){
  5608. txt = nodoanios.parentNode.childNodes[i].textContent;
  5609. var nodosa = d.querySelectorAll('rect[title="' + txt + '"]');
  5610. cant = nodosa[0].nextSibling.nextSibling.textContent;
  5611. media = nodosa[1].nextSibling.nextSibling.textContent;
  5612. txt2 = getAnioCode(txt);
  5613. var newa = d.createElement('div');
  5614. newa.textContent = "\nINSERT INTO Anios (nick, userid, anio, cant, avg) VALUES ('" + nombre + "'," + nid + ",'" + txt2 + "'," + cant + ",'" + media + "');";
  5615. nodofin.parentNode.appendChild(newa);
  5616. }
  5617. }
  5618. function doAddCompactVotes(){
  5619. var nodosfecha = '//div[@class="user-ratings-header"]'.findNodesArray();
  5620. for(var ix in nodosfecha)
  5621. log(nodosfecha[ix].parentNode.childNodes.length);
  5622. /*var nodos = '//a[contains(@href,"sharerating/")]'.findNodesArray();
  5623. var notas = '//img[contains(@src,"images/myratings")]'.findNodesArray();
  5624. var anios = '//a[@class="ntext"]'.findNodesArray();
  5625. var nodofin = '//a[contains(text(),"Ir arriba")]'.findNode();
  5626. var nick = '//span[@id="nick"]'.findNode().textContent;
  5627. for(var ix in nodos){
  5628. var cad = nodos[ix].href;
  5629. usuario = cad.split('/')[5];
  5630. var pelid = cad.split('/')[6].split('.')[0];
  5631. cad = notas[ix].src;
  5632. var nota = cad.split('/')[5].split('.')[0];
  5633. var anio = anios[ix].parentNode.nextSibling.textContent.replace(/[()]/gi,"").trim();
  5634. var newa = d.createElement('div');
  5635. //newa.textContent = "\nINSERT INTO Votos (movieid, nick, userid, rating, anio) VALUES (" + pelid + ",'" + nick + "'," + usuario + "," + nota + "," + anio + ");";
  5636. newa.textContent = "\nINSERT INTO Votos (movieid, nick, userid, rating, anio, fecha) VALUES (" + pelid + ",'" + nick + "'," + usuario + "," + nota + "," + anio + ");";
  5637. nodofin.parentNode.appendChild(newa);
  5638. }
  5639. */
  5640. }
  5641. function doAddExternalLinkLists() {
  5642. var linkTPL = "http://www.filmaffinity.com/es/userlist.php?user_id={USER}&list_id={LIST}";
  5643. var links = getElementsByClassName(d, "a", "llnk");
  5644. for (var ix = 0; ix < links.length; ix++) {
  5645. var link = links[ix];
  5646. var listID = link.href.split('=')[1];
  5647. var a = d.createElement('a');
  5648. a.id = listID;
  5649. a.href = linkTPL.replace(/{USER}/g, userId).replace(/{LIST}/g, listID);
  5650. a.innerHTML = "<img style='margin-left:5px;' src='" + link_img + "'>";
  5651. a.alt = "Enlace externo para otros usuarios";
  5652. a.title = a.alt;
  5653. link.parentNode.appendChild(a);
  5654. }
  5655. }
  5656. function doAddSearchListsOption() {
  5657. function OnSearchButtonClick() {
  5658. var nodoSelect = "//select[@name='stype']".findNode();
  5659. if (nodoSelect.value != "lists") {
  5660. // Enviamos el form de forma normal
  5661. nodoSelect.form.submit();
  5662. } else {
  5663. var texto = "//input[@name='stext']".findNode().value;
  5664. // var search = texto + ' "listas de:" site:filmaffinity.com -list_id -búsqueda -"crítica de" -"críticas de" -"votaciones de"';
  5665. // var url = "http://www.google.es/search?hl=es&q="+search;
  5666. // De momento, nos vamos a google
  5667. window.location.href = url;
  5668. //doGet(url,function (result) {
  5669. // log(result);
  5670. //})
  5671. }
  5672. }
  5673. function injectSearchListsOption() {
  5674. // Localizamos el combo de busquedas.
  5675. var nodoSelect = "//select[@name='stype']".findNode();
  5676. if (nodoSelect != null) {
  5677. // añadimos la opción listas
  5678. var option = d.createElement("option");
  5679. option.value = "lists";
  5680. option.text = "Listas";
  5681. nodoSelect.appendChild(option);
  5682. // modificamos el codigo del boton.
  5683. var boton = nodoSelect.nextSibling;
  5684. boton.type = "button";
  5685. boton.addEventListener("click", OnSearchButtonClick, true);
  5686. }
  5687. }
  5688. injectSearchListsOption();
  5689. }
  5690. function doMyDataMod() {
  5691. function doAddExtraStats() {
  5692. var countriesTable = "//div[text()='Votos por países']/following-sibling::*".findNode();
  5693. var totalCountries = countriesTable.rows.length;
  5694. var parrafo = d.createElement("p");
  5695. var imagen = d.createElement('img');
  5696. var elem_strong = document.createElement('strong');
  5697. var cont1 = d.createTextNode( " " + totalCountries);
  5698. var cont2 = d.createTextNode(" Nº países diferentes");
  5699. imagen.setAttribute('src', 'http://www.filmaffinity.com/images/arrow.gif');
  5700. parrafo.setAttribute("class","profile_activity");
  5701. parrafo.appendChild(imagen);
  5702. elem_strong.appendChild(cont1);
  5703. parrafo.appendChild(elem_strong);
  5704. parrafo.appendChild(cont2);
  5705. var divpelis = "//div[text()='Estadísticas']/following-sibling::*".findNode();
  5706. divpelis.appendChild(parrafo);
  5707. }
  5708. /*
  5709. Añade estadisticas por continente
  5710. */
  5711. var datosContinentes = [
  5712. {nombre:"América del Norte",votos:0,media:0},
  5713. {nombre:'Europa',votos:0,media:0},
  5714. {nombre:"América del Sur",votos:0,media:0},
  5715. {nombre:'Oceanía',votos:0,media:0},
  5716. {nombre:'Asia',votos:0,media:0},
  5717. {nombre:'África',votos:0,media:0},
  5718. {nombre:'NA',votos:0,media:0}
  5719. ];
  5720. function addLine2Table(table, text, value, media, cont) {
  5721. var clon = table.rows[table.rows.length - 2].cloneNode(true);
  5722. if(cont%2 == 0)
  5723. clon.className = "odd_votes";
  5724. clon.cells[0].width = "*";
  5725. clon.cells[0].textContent = text;
  5726. clon.cells[0].setAttribute('style', '');
  5727. clon.cells[1].innerHTML = "<b>" + value + "</b>";
  5728. clon.cells[2].innerHTML = "<b>" + media + "</b>";
  5729. table.rows[table.rows.length - 1].parentNode.appendChild(clon);
  5730. }
  5731. function addLine2RegionsTable(table, text, value, media, cont){
  5732. newttr = d.createElement('tr');
  5733. if(cont%2 == 0)
  5734. newttr.className = "odd_votes";
  5735. newttd1 = d.createElement('td');
  5736. newttd2 = d.createElement('td');
  5737. btd2 = d.createElement('b');
  5738. btd3 = d.createElement('b');
  5739. newttd3 = d.createElement('td');
  5740. newttd1.width = "165px";
  5741. newttd1.textContent = text;
  5742. newttd2.align = "right";
  5743. newttd2.width = "40px";
  5744. btd2.textContent = value;
  5745. newttd2.appendChild(btd2);
  5746. newttd3.align = "right";
  5747. newttd3.width = "40px";
  5748. btd3.textContent = media;
  5749. newttd3.appendChild(btd3);
  5750. newttr.appendChild(newttd1);
  5751. newttr.appendChild(newttd2);
  5752. newttr.appendChild(newttd3);
  5753. table.appendChild(newttr);
  5754. }
  5755. function addlinenewtable(table, text, value, media, contador, anchoc){
  5756. newttr = d.createElement('tr');
  5757. if(contador%2 == 0)
  5758. newttr.className = "odd_votes";
  5759. newttd1 = d.createElement('td');
  5760. newttd2 = d.createElement('td');
  5761. btd2 = d.createElement('b');
  5762. btd3 = d.createElement('b');
  5763. newttd3 = d.createElement('td');
  5764. newttd1.width = anchoc;
  5765. newttd1.textContent = text;
  5766. newttd2.align = "right";
  5767. newttd2.width = "40px";
  5768. btd2.textContent = value;
  5769. newttd2.appendChild(btd2);
  5770. newttd3.align = "right";
  5771. newttd3.width = "40px";
  5772. btd3.textContent = media;
  5773. newttd3.appendChild(btd3);
  5774. newttr.appendChild(newttd1);
  5775. newttr.appendChild(newttd2);
  5776. newttr.appendChild(newttd3);
  5777. table.appendChild(newttr);
  5778. }
  5779. function doAddContinentStats() {
  5780. var countriesTable = "//div[text()='Votos por países']/following-sibling::*".findNode();
  5781. var totalPaises = countriesTable.rows.length;
  5782. var contador = 1;
  5783. for (var i = 0; i < totalPaises; i++) {
  5784. var pais = countriesTable.rows[i].cells[0].textContent;
  5785. var votos = parseInt(countriesTable.rows[i].cells[1].textContent);
  5786. var media = parseFloat(countriesTable.rows[i].cells[2].textContent.replace(',', '.'));
  5787. var continente = getContinent(getCountryCode(pais));
  5788. var ix = inArray(datosContinentes, 'nombre', continente);
  5789. var oldVotos = datosContinentes[ix].votos;
  5790. var oldMedia = datosContinentes[ix].media;
  5791. datosContinentes[ix].votos = oldVotos + votos;
  5792. datosContinentes[ix].media = ((oldVotos * oldMedia) + (votos * media)) / (oldVotos + votos);
  5793. }
  5794. datosContinentes.sort(function(a, b) {
  5795. return (b.votos - a.votos);
  5796. });
  5797. //Creamos la tabla y ajustamos el tamaño
  5798. var continentTable = d.createElement('table');
  5799. var anchura = "160px";
  5800. if(getPreference("FLAGSINMYDATA", false))
  5801. anchura = "181px";
  5802. for(it = 0; it < totalPaises ; it++)
  5803. countriesTable.rows[it].cells[0].width = anchura;
  5804. for (ix in datosContinentes) {
  5805. if (datosContinentes[ix].votos > 0) {
  5806. contador++;
  5807. addlinenewtable(continentTable, datosContinentes[ix].nombre, datosContinentes[ix].votos, datosContinentes[ix].media.toFixed(1).replace('.', ','), contador, anchura);
  5808. }
  5809. }
  5810. var newtr = d.createElement('tr');
  5811. var divcont = d.createElement('div');
  5812. divcont.textContent = "Votos por continentes";
  5813. divcont.className = "title_profile_votes";
  5814. var divpcont = d.createElement('div');
  5815. divpcont.className = "profile_cont_votes";
  5816. divpcont.style.float = "left";
  5817. divpcont.appendChild(divcont);
  5818. divpcont.appendChild(continentTable);
  5819. newtr.appendChild(divpcont);
  5820. countriesTable.parentNode.parentNode.appendChild(newtr);
  5821. log(datosContinentes.toSource());
  5822. }
  5823. function doChangeDistribution() {
  5824. var index = this.options.selectedIndex;
  5825. var name = this.options[index].value;
  5826. // Eliminamos la tabla actual y creamos una nueva
  5827. $id("REGION_TABLE").parentNode.removeChild($id("REGION_TABLE"));
  5828. doAddRegionsStats(name, DIST_REGIONS, true);
  5829. }
  5830. /*
  5831. Inserta el combobox en la tabla, con los nombres de las distribuciones
  5832. del tipo 'type'
  5833. */
  5834. function insertDistributionCombo(table, current, type) {
  5835. var html = "&nbsp;<select id='DIST_SELECT' name='DIST_SELECT' >";
  5836. for (var ix in distribuciones) {
  5837. if (distribuciones[ix].tipo == type) {
  5838. html += "<option value='" + ix + "'";
  5839. if (ix == current) html += " selected ";
  5840. html += ">" + distribuciones[ix].nombre + "</option>";
  5841. }
  5842. }
  5843. html += "</select>";
  5844. var trcombo = d.createElement('tr');
  5845. var tdcombo = d.createElement('td');
  5846. tdcombo.innerHTML = " criterio: " + html;
  5847. trcombo.appendChild(tdcombo);
  5848. table.rows[0].parentNode.parentNode.insertBefore(trcombo, table.rows[0].parentNode);
  5849. $id("DIST_SELECT").addEventListener("change", doChangeDistribution, false);
  5850. }
  5851. function doAddRegionsStats(distributionName, type, cambio) {
  5852. var datosRegiones = [];
  5853. var cont = 1;
  5854. var countriesTable = "//div[text()='Votos por países']/following-sibling::*".findNode();
  5855. var votesTable = "//div[text()='Votos por nota']/following-sibling::*".findNode();
  5856. var totalPaises = countriesTable.rows.length;
  5857. for (var i = 0; i < totalPaises; i++) {
  5858. var pais = countriesTable.rows[i].cells[0].textContent;
  5859. var votos = parseInt(countriesTable.rows[i].cells[1].textContent);
  5860. var media = parseFloat(countriesTable.rows[i].cells[2].textContent.replace(',', '.'));
  5861. var region = getRegion(distributionName, getCountryCode(pais));
  5862. var ix = inArray(datosRegiones, 'nombre', region);
  5863. if (!ix) {
  5864. var dato = {nombre:region,votos:0,media:0};
  5865. datosRegiones.push(dato);
  5866. ix = inArray(datosRegiones, 'nombre', region);
  5867. }
  5868. var oldVotos = datosRegiones[ix].votos;
  5869. var oldMedia = datosRegiones[ix].media;
  5870. datosRegiones[ix].votos = oldVotos + votos;
  5871. datosRegiones[ix].media = ((oldVotos * oldMedia) + (votos * media)) / (oldVotos + votos);
  5872. }
  5873. datosRegiones.sort(function(a, b) {
  5874. return (b.votos - a.votos);
  5875. });
  5876. /*
  5877. Clonamos la tabla de los paises y metemos los datos
  5878. */
  5879. var regionTable = countriesTable.cloneNode(true);
  5880. for (ix in datosRegiones) {
  5881. if (datosRegiones[ix].votos > 0) {
  5882. cont++;
  5883. addLine2RegionsTable(regionTable, datosRegiones[ix].nombre, datosRegiones[ix].votos, datosRegiones[ix].media.toFixed(1).replace('.', ','), cont);
  5884. // addLine2Table(regionTable, datosRegiones[ix].nombre, datosRegiones[ix].votos, datosRegiones[ix].media.toFixed(1).replace('.', ','), cont);
  5885. }
  5886. }
  5887. for (var n = 0; n < totalPaises; n++) {
  5888. regionTable.rows[0].parentNode.removeChild(regionTable.rows[0]);
  5889. }
  5890. //regionTable.rows[0].cells[0].firstChild.firstChild.textContent = "Mis votos por país agrupados según";
  5891. regionTable.id = "REGION_TABLE";
  5892. if(cambio){
  5893. var nodoborrar = "//div[text()='Votos por regiones']/ancestor::*[position()=1]".findNode();
  5894. nodoborrar.parentNode.removeChild(nodoborrar);
  5895. }
  5896. var newtr = d.createElement('tr');
  5897. divregion = d.createElement('div');
  5898. divregion.className = "title_profile_votes";
  5899. divregion.textContent = "Votos por regiones";
  5900. divpregion = d.createElement('div');
  5901. divpregion.className = "profile_cont_votes";
  5902. divpregion.appendChild(divregion);
  5903. divpregion.appendChild(regionTable);
  5904. newtr.appendChild(divpregion);
  5905. votesTable.parentNode.parentNode.appendChild(newtr);
  5906. insertDistributionCombo(regionTable, distributionName, type);
  5907. }
  5908. /*
  5909. * Modifica la apariencia de la tabla Mis Votos por Valor en Mis Datos
  5910. */
  5911. function doAlterMyVotes() {
  5912. var votesTable = "//div[text()='Votos por nota']/following-sibling::*".findNode();
  5913. const ANCHO_MAXIMO = 153;
  5914. var imgTpl = '<img height="14" width="{WIDTH}" border="0" align="top" src="/images/bars/bar1.gif"/><span style="font-size:80%;">&nbsp;{PCT}%</span>';
  5915. //var imgTpl = '<img height="14" width="{WIDTH}" border="0" align="top" src="http://cinemakb.freehostingcloud.com/src/bar1.gif"/><span style="font-size:80%;">&nbsp;{PCT}%</span>';
  5916. var votosTotal = "//img[@src='/images/arrow.gif']/following-sibling::*".findNode().textContent;
  5917. var maxVotos = 0;
  5918. var n;
  5919. var votos;
  5920. for (n = 1; n < votesTable.rows.length; n++) {
  5921. votos = parseInt(votesTable.rows[n].cells[2].textContent);
  5922. if (votos > maxVotos) {
  5923. maxVotos = votos;
  5924. }
  5925. }
  5926. for (n = 0; n < votesTable.rows.length; n++) {
  5927. var row = votesTable.rows[n];
  5928. row.cells[0].innerHTML = "<b>" + (10 - n) + "</b>&nbsp;";
  5929. row.cells[0].title = row.cells[1].textContent;
  5930. row.cells[1].title = row.cells[1].textContent;
  5931. row.cells[2].title = row.cells[1].textContent;
  5932. row.cells[0].align = "left";
  5933. row.cells[1].align = "left";
  5934. row.cells[0].width = "20";
  5935. votos = parseInt(row.cells[2].textContent);
  5936. var pct = (100 * votos) / votosTotal;
  5937. var width = (ANCHO_MAXIMO * votos) / maxVotos;
  5938. row.cells[1].innerHTML = imgTpl.replace(/{WIDTH}/g, width).replace(/{PCT}/g, pct.toFixed(2));
  5939. }
  5940. }
  5941. //Preparar la tabla para los distintos datos
  5942. function prepareMyDataTables() {
  5943. var countriesTable = "//div[text()='Votos por países']/ancestor::*[position()=1]".findNode();
  5944. var votesTable = "//div[text()='Votos por nota']/ancestor::*[position()=1]".findNode();
  5945. var genTable = "//div[text()='Votos por género']/ancestor::*[position()=1]".findNode();
  5946. //Clonamos las 3 tablas
  5947. var clonVotes = votesTable.cloneNode(true);
  5948. var clonGen = genTable.cloneNode(true);
  5949. var clonPaises = countriesTable.cloneNode(true);
  5950. //Borramos las 3 en la página para meterlas en una tabla
  5951. votesTable.parentNode.removeChild(votesTable);
  5952. genTable.parentNode.removeChild(genTable);
  5953. countriesTable.parentNode.removeChild(countriesTable);
  5954. var todo = "//div[text()='Estadísticas']/ancestor::*[position()=1]".findNode();
  5955. var tablaextra = d.createElement('table');
  5956. tablaextra.width = "100%";
  5957. tablaextra.border = "0";
  5958. var tr1 = d.createElement('tr');
  5959. var td1 = d.createElement('td');
  5960. var td2 = d.createElement('td');
  5961. var td3 = d.createElement('td');
  5962. td1.width = "280px";
  5963. td1.appendChild(clonVotes);
  5964. td1.style.verticalAlign = "top";
  5965. td2.width = "230px";
  5966. td2.appendChild(clonGen);
  5967. td2.style.verticalAlign = "top";
  5968. td3.appendChild(clonPaises);
  5969. td3.style.verticalAlign = "top";
  5970. tr1.appendChild(td1);
  5971. tr1.appendChild(td2);
  5972. tr1.appendChild(td3);
  5973. tablaextra.appendChild(tr1);
  5974. todo.appendChild(tablaextra);
  5975. }
  5976. /*
  5977. Indices sobre nuestras votaciones
  5978. ver http://filmaffinity.mforos.com/1360515/7122665-indices-indicadores-e-indicios/
  5979. */
  5980. function doAddDataIndexes() {
  5981. var countriesTable = "//div[text()='Votos por países']/following-sibling::*".findNode();
  5982. var genTable = "//div[text()='Votos por género']/following-sibling::*".findNode();
  5983. var votesTable = "//div[text()='Votos por nota']/following-sibling::*".findNode();
  5984. statsTable = d.createElement('table');
  5985. divindices = d.createElement('div');
  5986. divpindices = d.createElement('div');
  5987. divindices.className = "title_profile_votes";
  5988. divindices.textContent = "Índices";
  5989. divpindices.className = "profile_cont_votes";
  5990. divpindices.appendChild(divindices);
  5991. divpindices.appendChild(statsTable);
  5992. contindices = 0;
  5993. function getIndiceRareza() {
  5994. /*
  5995. Si, ya se que esta duplicada esta función, quizas haga algo con ello algún dia
  5996. */
  5997. function getSavedSoulMatesLists() {
  5998. var ssml = eval(GM_getValue(userId + ".ssml"));
  5999. if (typeof ssml == "undefined") {
  6000. ssml = new Object();
  6001. ssml.items = new Array();
  6002. ssml.last = 0;
  6003. }
  6004. return ssml;
  6005. }
  6006. // Obtenemos las ultimas almas gemelas
  6007. var ssml = getSavedSoulMatesLists();
  6008. if (ssml.last > 0) {
  6009. var lista = eval(GM_getValue(userId + ".sml." + ssml.last));
  6010. // Si son 20, devolvemos el indice de la ultima
  6011. if (lista.length < 20) {
  6012. return 20 - lista.length;
  6013. } else {
  6014. return (100 / lista.sm[20].affinity).toFixed(2);
  6015. }
  6016. // Si son menos, 20-nº almas gemelas.
  6017. } else {
  6018. return 0;
  6019. }
  6020. }
  6021. function addIndexHeader(delta) {
  6022. GM_addStyle('a.bindexeslink {color:white;cursor:pointer;font-size:80%;text-decoration:none;} !important');
  6023. GM_addStyle('a.bindexeslink:visited {color:white;cursor:pointer;font-size:80%;text-decoration:none;} !important');
  6024. var clon = statsTable.rows[0].cloneNode(true);
  6025. clon.cells[0].firstChild.firstChild.innerHTML = "Índices <a class='bindexeslink' href='http://filmaffinity.mforos.com/1360515/7122665-indices-indicadores-e-indicios/'>(Detalles)</a>";
  6026. statsTable.rows[statsTable.rows.length - 2].parentNode.insertBefore(clon, statsTable.rows[statsTable.rows.length - delta]);
  6027. }
  6028. function addToStatsTable(text, value, hint) {
  6029. //var clon = statsTable.rows[statsTable.rows.length - 2].cloneNode(true);
  6030. contindices++;
  6031. var newtr = d.createElement('tr');
  6032. if(contindices%2 == 0)
  6033. newtr.className = "odd_votes";
  6034. var tdtxt = d.createElement('td');
  6035. var tdval = d.createElement('td');
  6036. var bval = d.createElement('b');
  6037. tdtxt.textContent = text;
  6038. tdtxt.title = hint;
  6039. bval.textContent = value;
  6040. tdval.appendChild(bval);
  6041. /* clon.cells[0].textContent = text;
  6042. clon.cells[1].innerHTML = "<b>" + value + "</b>";
  6043. clon.cells[0].title = hint;
  6044. statsTable.rows[statsTable.rows.length - 2].parentNode.insertBefore(clon, statsTable.rows[statsTable.rows.length - 1]);*/
  6045. newtr.appendChild(tdtxt);
  6046. newtr.appendChild(tdval);
  6047. statsTable.appendChild(newtr);
  6048. }
  6049. var bPais = "//img[contains(@src,'imgs/countries')]".findNode();
  6050. var miPais = bPais.title;
  6051. var rowEEUU = "//td[text()='Estados Unidos']/..".findNode(countriesTable);
  6052. var vistasEEUU = 0;
  6053. var mediaEEUU = 0;
  6054. if (rowEEUU != null) {
  6055. vistasEEUU = rowEEUU.cells[1].textContent;
  6056. mediaEEUU = parseFloat(rowEEUU.cells[2].textContent.replace(',', '.'));
  6057. }
  6058. var rowPais = "//td[text()='{PAIS}']/..".replace(/{PAIS}/g, miPais).findNode(countriesTable);
  6059. var mediaPais = 0;
  6060. var vistasPais = 0;
  6061. if (rowPais != null) {
  6062. mediaPais = parseFloat(rowPais.cells[2].textContent.replace(',', '.'));
  6063. vistasPais = rowPais.cells[1].textContent;
  6064. }
  6065. var rowDocumentales = "//td[text()='Documental']/..".findNode(genTable);
  6066. var vistosDocumentales = 0;
  6067. var mediaDocumentales = 0;
  6068. if (rowDocumentales != null) {
  6069. vistosDocumentales = rowDocumentales.cells[1].textContent;
  6070. mediaDocumentales = parseFloat(rowDocumentales.cells[2].textContent.replace(',', '.'));
  6071. }
  6072. // Obtenemos las variables basicas
  6073. var totalPaises = countriesTable.rows.length;
  6074. var vistasTotal = "//img[@src='/images/arrow.gif']/following-sibling::*".findNode().textContent;
  6075. var mediaux = "//div[@id='ignore_film']/following-sibling::*/strong".findNode().textContent;
  6076. var mediaTotal = parseFloat(mediaux.replace(',', '.'));
  6077. var vistasCastellano = 0;
  6078. var paisesUnaPelicula = 0;
  6079. var paisesUnaPeliculaVoto8910 = 0;
  6080. var paisesCastellano = 0;
  6081. var paisesPromedioMayorEEUU = 0;
  6082. var paisesPromedioMenorEEUU = 0;
  6083. // Recorremos la tabla de paises para obtener el resto de
  6084. // datos
  6085. for (var i = 0; i < totalPaises; i++) {
  6086. var pais = countriesTable.rows[i].cells[0].textContent;
  6087. var peliculas = parseInt(countriesTable.rows[i].cells[1].textContent);
  6088. var media = parseFloat(countriesTable.rows[i].cells[2].textContent.replace(',', '.'));
  6089. if (typeof countriesSpanish[pais] != "undefined") {
  6090. vistasCastellano += peliculas;
  6091. paisesCastellano++;
  6092. }
  6093. if (peliculas == 1) {
  6094. paisesUnaPelicula++;
  6095. if (media >= 8) {
  6096. paisesUnaPeliculaVoto8910++;
  6097. }
  6098. }
  6099. if (peliculas > 1) {
  6100. if (media > mediaEEUU) {
  6101. paisesPromedioMayorEEUU++;
  6102. } else if (media < mediaEEUU) {
  6103. paisesPromedioMenorEEUU++;
  6104. }
  6105. }
  6106. }
  6107. /*
  6108. Calculamos los indices
  6109. */
  6110. if (vistasTotal > 0) {
  6111. var IUI = (100 * vistasCastellano) / vistasTotal;
  6112. var IAO = (100 * (vistasCastellano - vistasPais)) / vistasTotal;
  6113. var IB = (100 * vistasEEUU) / vistasTotal;
  6114. }
  6115. if (totalPaises > 0) {
  6116. var IBI = (100 * paisesUnaPelicula) / totalPaises;
  6117. }
  6118. var II = paisesUnaPeliculaVoto8910;
  6119. var IAA = 10 * (mediaPais - mediaTotal);
  6120. var IDC = paisesCastellano;
  6121. var IPCH = 0;
  6122. if (paisesPromedioMayorEEUU > 0) {
  6123. IPCH = paisesPromedioMenorEEUU / paisesPromedioMayorEEUU;
  6124. }
  6125. var IBD = 0;
  6126. if (vistosDocumentales > 0) {
  6127. IBD = (100 * vistosDocumentales) / vistasTotal;
  6128. }
  6129. addToStatsTable("General: ", IB.toFixed(2) + "%", "Numero de películas de EE.UU. en relación al número de películas vistas.");
  6130. addToStatsTable("Búsqueda infructuosa: ", IBI.toFixed(2) + "%", "Número de países con una sola película votada en relación al total de países votados.");
  6131. addToStatsTable("Ingratitud: ", II, "Número de países con una sola película pero con 8, 9 ó 10 de votación.");
  6132. addToStatsTable("Autoaceptación: ", IAA.toFixed(2), "Diez veces la diferencia entre la votación promedio de tu propio país y tu votación promedio.");
  6133. addToStatsTable("Uso del idioma: ", IUI.toFixed(2) + "%", "Número de películas en castellano, en relación al número de películas votadas.");
  6134. addToStatsTable("Aceptación del otro: ", IAO.toFixed(2) + "%", "Número de películas en castellano, sin contar las de tu país en relación al número de películas votadas.");
  6135. addToStatsTable("Difusión: ", IDC, "Número de países votados de habla castellana.");
  6136. //addToStatsTable("Rareza: ", getIndiceRareza(), "Inverso del grado de afinidad de tu última Alma Gemela.");
  6137. addToStatsTable("Percepción de la Calidad de Hollywood: ", IPCH.toFixed(2), "Número de países con votación promedio menor que la de EE.UU. en relación a los países con votación promedio mayor a la de EE.UU. Excluyendo los países con una sola película votada.");
  6138. addToStatsTable("Bien Documentado:", IBD.toFixed(2) + "%", "Porcentaje de documentales que has votado sobre el total votado.");
  6139. //addIndexHeader(11);
  6140. // Como ahora duplicamos la tabla, borramos los restos de la tabla anterior
  6141. /*for (var n = 0; n < 6; n++) {
  6142. statsTable.rows[0].parentNode.removeChild(statsTable.rows[0]);
  6143. }
  6144. // y la ultima fila
  6145. statsTable.rows[0].parentNode.removeChild(statsTable.rows[statsTable.rows.length - 1]);*/
  6146. var newtr = d.createElement('tr');
  6147. newtr.appendChild(divpindices);
  6148. votesTable.parentNode.parentNode.appendChild(newtr);
  6149. }
  6150. function addLine2YearTable(table, text, votos, media, cont){
  6151. newttr = d.createElement('tr');
  6152. if(cont%2 == 0)
  6153. newttr.className = "odd_votes";
  6154. else
  6155. newttr.style.backgroundColor = "#ffffff";
  6156. newttd1 = d.createElement('td');
  6157. newttd2 = d.createElement('td');
  6158. newttd3 = d.createElement('td');
  6159. btd1 = d.createElement('b');
  6160. btd2 = d.createElement('b');
  6161. btd3 = d.createElement('b');
  6162. newttd1.width = "122px";
  6163. newttd1.align = "center";
  6164. newttd1.style.color = "blue";
  6165. btd1.textContent = text;
  6166. newttd1.appendChild(btd1);
  6167. newttd2.align = "right";
  6168. newttd2.width = "40px";
  6169. btd2.textContent = votos;
  6170. newttd2.appendChild(btd2);
  6171. newttd3.align = "right";
  6172. newttd3.width = "40px";
  6173. btd3.textContent = media;
  6174. newttd3.appendChild(btd3);
  6175. newttr.appendChild(newttd1);
  6176. newttr.appendChild(newttd2);
  6177. newttr.appendChild(newttd3);
  6178. table.appendChild(newttr);
  6179. }
  6180. function doAddVotesYear() {
  6181. var url = "http://www.filmaffinity.com/es/userrep.php?user_id=" + userId;
  6182. var cont = 1;
  6183. doGet(url, function(response) {
  6184. // Procesamos los datos
  6185. var genTable = "//div[text()='Votos por género']/following-sibling::*".findNode();
  6186. var yearTable = d.createElement('table');
  6187. var emptydiv = document.createElement('div');
  6188. emptydiv.innerHTML = response;
  6189. var statsYearTable = "//caption[contains(text(),'Votaciones por a')]/..".findNode(emptydiv);
  6190. if (statsYearTable != null) {
  6191. for (var n = 1; n < statsYearTable.rows.length; n++) {
  6192. cont++;
  6193. var year = statsYearTable.rows[n].cells[1].textContent;
  6194. var votes = statsYearTable.rows[n].cells[0].textContent;
  6195. var mean = statsYearTable.rows[n].cells[2].textContent;
  6196. addLine2YearTable(yearTable, year, votes, mean, cont);
  6197. }
  6198. /*for (n = 0; n < countriesTable.rows.length; n++) {
  6199. yearTable.rows[0].parentNode.removeChild(yearTable.rows[0]);
  6200. }
  6201. */
  6202. divanios = d.createElement('div');
  6203. divpanios = d.createElement('div');
  6204. divanios.className = "title_profile_votes";
  6205. divanios.textContent = "Votos por año";
  6206. divpanios.className = "profile_cont_votes";
  6207. divpanios.appendChild(divanios);
  6208. divpanios.appendChild(yearTable);
  6209. var newtr = d.createElement('tr');
  6210. newtr.appendChild(divpanios);
  6211. genTable.parentNode.parentNode.appendChild(newtr);
  6212. }
  6213. });
  6214. }
  6215. function doAlterMyGens(){
  6216. var media = 0.0;
  6217. var mauz = 0.0;
  6218. var genTable = "//div[text()='Votos por género']/following-sibling::*".findNode();
  6219. var vistasTotal = "//img[@src='/images/arrow.gif']/following-sibling::*".findNode().textContent;
  6220. for(i = 0; i < genTable.rows.length ; i++){
  6221. var m = genTable.rows[i].insertCell(-1);
  6222. m.align = "right";
  6223. m.width = "50px";
  6224. mauz = genTable.rows[i].cells[1].textContent;
  6225. media = (parseFloat(mauz)/vistasTotal)*100;
  6226. media = media.toFixed(2);
  6227. //m.innerHTML = '<b>' + media + "%" + '</b>';
  6228. m.innerHTML = media + "%";
  6229. }
  6230. }
  6231. /*function doAddTopicStats(){
  6232. var nodoadd = '//span[contains(text(),"Redes sociales")]/ancestor::*[position()=1]'.findNode();
  6233. var ndivclas = d.createElement('div');
  6234. ndivclas.className = "title_profile";
  6235. ndivclas.textContent = "Topics";
  6236. var ntopicclas = d.createElement('table');
  6237. ntopicclas.style.width = "100%";
  6238. var txt = "";
  6239. txt += '<tbody><tr>';
  6240. txt += '<td style="vertical-align:top;" width="270px"><div class="profile_cont_votes" width="260px">';
  6241. txt += '<div class="title_profile_votes">A-H</div>';
  6242. txt += '<table id="TOPICSAH"><tbody>';
  6243. txt += '<td width="180" align="left">Animación para adultos</td>';
  6244. txt += '<td align="right" width="40"><b>12</b></td>';
  6245. txt += '<td align="right" width="40"><b>5,7</b></td>';
  6246. txt += '</table></div></td>';
  6247. txt += '<td style="vertical-align:top;" width="270px"><div class="profile_cont_votes" width="260px">';
  6248. txt += '<div class="title_profile_votes">I-N</div>';
  6249. txt += '<table id="TOPICSI-N"><tbody>';
  6250. txt += '<td align="center"><b><font color="#CDAD00">3-D</font></b></td>';
  6251. txt += '<td align="center"><b><font color="#CDAD00">12</font></b></td>';
  6252. txt += '<td align="center"><b><font color="#CDAD00">5,7</font></b></td>';
  6253. txt += '</table></div></td>';
  6254. txt += '<td style="vertical-align:top;" width="270px"><div class="profile_cont_votes" width="260px">';
  6255. txt += '<div class="title_profile_votes">O-Z</div>';
  6256. txt += '<table id="TOPICSOZ"><tbody>';
  6257. txt += '<td align="center"><b><font color="#CDAD00">3-D</font></b></td>';
  6258. txt += '<td align="center"><b><font color="#CDAD00">12</font></b></td>';
  6259. txt += '<td align="center"><b><font color="#CDAD00">5,7</font></b></td>';
  6260. txt += '</table></div></td></tr>';
  6261. ntopicclas.innerHTML = txt;
  6262. nodoadd.parentNode.appendChild(ndivclas);
  6263. nodoadd.parentNode.appendChild(ntopicclas);
  6264. }
  6265. */
  6266. doAddExtraStats();
  6267. prepareMyDataTables();
  6268. doAlterMyVotes();
  6269. if (getPreference("SHOWMFINDEXES", true)) doAddDataIndexes();
  6270. doAddContinentStats();
  6271. if (getPreference("COUNTRYDISTS", false)) doAddRegionsStats("Lingüístico", DIST_REGIONS, false);
  6272. if (getPreference("SHOWYEARDATA", false)) doAddVotesYear();
  6273. doAlterMyGens();
  6274. //doAddTopicStats();
  6275. }
  6276. //Función que añade a Mis Datos distintas clasificaciones
  6277. function doAddClasif(){
  6278. function doClasPais(){
  6279. function injectFilesGeneral(codigo, clas){
  6280. var order = 6;
  6281. var url = 'http://www.neokben.host-ed.me/fa/src/';
  6282. if(clas == "paises"){
  6283. url += 'paises.php?cpais=';
  6284. var nodot = '//table[@id="CLAS_PAISES"]'.findNode();
  6285. order = 6;
  6286. }
  6287. else if(clas == "generos"){
  6288. url += 'generos.php?cgenre=';
  6289. var nodot = '//table[@id="CLAS_GENEROS"]'.findNode();
  6290. order = 8;
  6291. }
  6292. else if(clas == "anios"){
  6293. url += 'anios.php?canio=';
  6294. var nodot = '//table[@id="CLAS_ANIOS"]'.findNode();
  6295. order = 1;
  6296. }
  6297. url += codigo;
  6298. var nodoid = '//a[contains(text(),"ticas favoritas")]'.findNode();
  6299. var idprop = getUserId();
  6300. var tbody = nodot.lastChild;
  6301. var name = "";
  6302. var nusuarios = parseInt(getPreference('nusers'));
  6303. if(nusuarios < 10 || nusuarios > 150)
  6304. nusuarios = 20;
  6305. //Primero limpiamos la tabla
  6306. while(nodot.rows.length > 1) {
  6307. tbody.removeChild(nodot.rows[1]);
  6308. }
  6309. //Luego añadimos los nuevos datos
  6310. doGet(url, function (response) {
  6311. var emptydiv = document.createElement('div');
  6312. emptydiv.innerHTML = response;
  6313. var nodos = '//strong'.findNodesArray(emptydiv);
  6314. if(nodos.length > 0){
  6315. for(i = 0; i < nodos.length && i < nusuarios; i++){
  6316. name = nodos[i].textContent.split('-')[0];
  6317. if(name.indexOf("h e r m a n") != -1)
  6318. name = "hermanônegrö";
  6319. if(name.indexOf("latra") != -1)
  6320. name = "ególatra";
  6321. if(name.indexOf("Fili") != -1)
  6322. name = "Filiûs de Fructüs";
  6323. if(name.indexOf("Atticus") != -1)
  6324. name = "Atticus Fiúncho";
  6325. if(name.indexOf("dovicum") != -1)
  6326. name = "Luis (Ludovicum)";
  6327. if(name.indexOf("Iv") == 0)
  6328. name = "Iván";
  6329. if(name.indexOf("es Martes") != -1)
  6330. name = "Sonríe es Martes";
  6331. if(name.indexOf("ManuFdez") != -1)
  6332. name = "ManuFdezReinón";
  6333. if(name.indexOf("Atrapa") != -1)
  6334. name = "Atrapasueños";
  6335. var newtr = d.createElement('tr');
  6336. if(i%2 == 0)
  6337. newtr.className = "odd_votes";
  6338. var txtfila = "";
  6339. if(i == 0){
  6340. txtfila += '<td align="center"><b><font color="#CDAD00">' + (i+1) + '</font></b></td>';
  6341. txtfila += '<td width="140px">';
  6342. txtfila += '<a href="http://www.filmaffinity.com/es/userratings.php?user_id=' + nodos[i].textContent.split('-')[1] + '&orderby=' + order + '"';
  6343. txtfila += 'target="_blank" style="text-decoration: none; color:inherit">';
  6344. txtfila += '<b><font color="#CDAD00">' + name + '</font></b></a></td>';
  6345. txtfila += '<td align="right" width="35px"><b><font color="#CDAD00">' + nodos[i].textContent.split('-')[2] + '</font></b></td>';
  6346. txtfila += '<td align="right" width="35px"><b><font color="#CDAD00">' + nodos[i].textContent.split('-')[3] + '</font></b></td>';
  6347. }
  6348. else if(i ==1){
  6349. txtfila += '<td align="center"><b><font color="#B7B7B7">' + (i+1) + '</font></b></td>';
  6350. txtfila += '<td width="140px">';
  6351. txtfila += '<a href="http://www.filmaffinity.com/es/userratings.php?user_id=' + nodos[i].textContent.split('-')[1] + '&orderby=' + order + '"';
  6352. txtfila += 'target="_blank" style="text-decoration: none; color:inherit">';
  6353. txtfila += '<b><font color="#B7B7B7">' + name + '</font></b></a></td>';
  6354. txtfila += '<td align="right" width="35px"><b><font color="#B7B7B7">' + nodos[i].textContent.split('-')[2] + '</font></b></td>';
  6355. txtfila += '<td align="right" width="35px"><b><font color="#B7B7B7">' + nodos[i].textContent.split('-')[3] + '</font></b></td>';}
  6356. else if(i ==2){
  6357. txtfila += '<td align="center"><b><font color="#B87333">' + (i+1) + '</font></b></td>';
  6358. txtfila += '<td width="140px">';
  6359. txtfila += '<a href="http://www.filmaffinity.com/es/userratings.php?user_id=' + nodos[i].textContent.split('-')[1] + '&orderby=' + order + '"';
  6360. txtfila += 'target="_blank" style="text-decoration: none; color:inherit">';
  6361. txtfila += '<b><font color="#B87333">' + name + '</b></font></a></td>';
  6362. txtfila += '<td align="right" width="35px"><b><font color="#B87333">' + nodos[i].textContent.split('-')[2] + '</font></b></td>';
  6363. txtfila += '<td align="right" width="35px"><b><font color="#B87333">' + nodos[i].textContent.split('-')[3] + '</font></b></td>';}
  6364. else {
  6365. if(idprop == nodos[i].textContent.split('-')[1]){
  6366. txtfila += '<td align="center"><b><font color="blue">' + (i+1) + '</font></b></td>';
  6367. txtfila += '<td width="140px">';
  6368. txtfila += '<a href="http://www.filmaffinity.com/es/userratings.php?user_id=' + nodos[i].textContent.split('-')[1] + '&orderby=' + order + '"';
  6369. txtfila += 'target="_blank" style="text-decoration: none; color:inherit"><b><font color="blue">';
  6370. txtfila += name + '</font></b></a></td>';
  6371. txtfila += '<td align="right" width="35px"><b><font color="blue">' + nodos[i].textContent.split('-')[2] + '</font></b></td>';
  6372. txtfila += '<td align="right" width="35px"><b><font color="blue">' + nodos[i].textContent.split('-')[3] + '</font></b></td>';
  6373. }
  6374. else {
  6375. txtfila += '<td align="center"><b>' + (i+1) + '</b></td>';
  6376. txtfila += '<td width="140px">';
  6377. txtfila += '<a href="http://www.filmaffinity.com/es/userratings.php?user_id=' + nodos[i].textContent.split('-')[1] + '&orderby=' + order + '"';
  6378. txtfila += 'target="_blank" style="text-decoration: none; color:inherit">';
  6379. txtfila += name + '</a></td>';
  6380. txtfila += '<td align="right" width="35px"><b>' + nodos[i].textContent.split('-')[2] + '</b></td>';
  6381. txtfila += '<td align="right" width="35px"><b>' + nodos[i].textContent.split('-')[3] + '</b></td>';
  6382. }
  6383. }
  6384. newtr.innerHTML = txtfila;
  6385. nodot.rows[0].parentNode.appendChild(newtr);
  6386. }
  6387. }
  6388. });
  6389. }
  6390. function doChangeGen() {
  6391. var index = this.options.selectedIndex;
  6392. var name = this.options[index].value;
  6393. injectFilesGeneral(name,'generos');
  6394. }
  6395. function doChangeAnio() {
  6396. var index = this.options.selectedIndex;
  6397. var name = this.options[index].value;
  6398. injectFilesGeneral(name,'anios');
  6399. }
  6400. function doChangePais() {
  6401. var index = this.options.selectedIndex;
  6402. var name = this.options[index].value;
  6403. this.setAttribute('style', 'padding-left: 19px; background: white url("http://www.filmaffinity.com/imgs/countries/' + this.options[this.selectedIndex].value + '.jpg") no-repeat scroll center left');
  6404. injectFilesGeneral(name,'paises');
  6405. // Eliminamos la tabla actual y creamos una nueva
  6406. /*$id("REGION_TABLE").parentNode.removeChild($id("REGION_TABLE"));
  6407. doAddRegionsStats(name, DIST_REGIONS, true);*/
  6408. }
  6409. var nodoadd = '//span[contains(text(),"Redes sociales")]/ancestor::*[position()=1]'.findNode();
  6410. var ndivclas = d.createElement('div');
  6411. ndivclas.className = "title_profile";
  6412. ndivclas.textContent = "Clasificaciones";
  6413. var ntableclas = d.createElement('table');
  6414. ntableclas.style.width = "100%";
  6415. var txt = "";
  6416. txt += '<tbody><tr>';
  6417. txt += '<td style="vertical-align:top;" width="270px"><div class="profile_cont_votes" width="260px">';
  6418. txt += '<div class="title_profile_votes">Por países</div>';
  6419. txt += '<table id="CLAS_PAISES"><tbody>';
  6420. txt += '<tr><td width="20px"><b>País:</b></td>';
  6421. txt += '<td colspan="3"><select style="padding-left: 19px; background-image: url(http://www.filmaffinity.com/imgs/countries/ES.jpg) no-repeat scroll center left white;" id="PAIS_SELECT" name="PAIS_SELECT">';
  6422. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/AF.jpg) no-repeat scroll center left white;" value="AF">Afganistán</option>';
  6423. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/DE.jpg) no-repeat scroll center left white;" value="DE">Alemania</option>';
  6424. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/FD.jpg) no-repeat scroll center left white;" value="FD">Alemania del Este (RDA)</option>';
  6425. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/FF.jpg) no-repeat scroll center left white;" value="FF">Alemania del Oeste (RFA)</option>';
  6426. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/AD.jpg) no-repeat scroll center left white;" value="AD">Andorra</option>';
  6427. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/AO.jpg) no-repeat scroll center left white;" value="AO">Angola</option>';
  6428. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/AG.jpg) no-repeat scroll center left white;" value="AG">Antigua y Barbuda</option>';
  6429. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/SA.jpg) no-repeat scroll center left white;" value="SA">Arabia Saud&iacute;</option>';
  6430. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/DZ.jpg) no-repeat scroll center left white;" value="DZ">Argelia</option>';
  6431. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/AR.jpg) no-repeat scroll center left white;" value="AR">Argentina</option>';
  6432. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/AM.jpg) no-repeat scroll center left white;" value="AM">Armenia</option>';
  6433. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/AU.jpg) no-repeat scroll center left white;" value="AU">Australia</option>';
  6434. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/AT.jpg) no-repeat scroll center left white;" value="AT">Austria</option>';
  6435. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/AZ.jpg) no-repeat scroll center left white;" value="AZ">Azerbaijan</option>';
  6436. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/BS.jpg) no-repeat scroll center left white;" value="BS">Bahamas</option>';
  6437. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/BH.jpg) no-repeat scroll center left white;" value="BH">Bahrein</option>';
  6438. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/BD.jpg) no-repeat scroll center left white;" value="BD">Bangladesh</option>';
  6439. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/BB.jpg) no-repeat scroll center left white;" value="BB">Barbados</option>';
  6440. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/BE.jpg) no-repeat scroll center left white;" value="BE">B&eacute;lgica</option>';
  6441. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/BZ.jpg) no-repeat scroll center left white;" value="BZ">Belize</option>';
  6442. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/BJ.jpg) no-repeat scroll center left white;" value="BJ">Ben&iacute;n</option>';
  6443. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/BY.jpg) no-repeat scroll center left white;" value="BY">Bielorusia</option>';
  6444. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/BO.jpg) no-repeat scroll center left white;" value="BO">Bolivia</option>';
  6445. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/BA.jpg) no-repeat scroll center left white;" value="BA">Bosnia y Herzegovina</option>';
  6446. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/BW.jpg) no-repeat scroll center left white;" value="BW">Botswana</option>';
  6447. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/BR.jpg) no-repeat scroll center left white;" value="BR">Brasil</option>';
  6448. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/BG.jpg) no-repeat scroll center left white;" value="BG">Bulgaria</option>';
  6449. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/BF.jpg) no-repeat scroll center left white;" value="BF">Burkina Faso</option>';
  6450. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/BI.jpg) no-repeat scroll center left white;" value="BI">Burundi</option>';
  6451. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/BT.jpg) no-repeat scroll center left white;" value="BT">But&aacute;n</option>';
  6452. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/CV.jpg) no-repeat scroll center left white;" value="CV">Cabo Verde</option>';
  6453. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/KH.jpg) no-repeat scroll center left white;" value="KH">Camboya</option>';
  6454. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/CM.jpg) no-repeat scroll center left white;" value="CM">Camer&uacute;n</option>';
  6455. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/CA.jpg) no-repeat scroll center left white;" value="CA">Canad&aacute;</option>';
  6456. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/TD.jpg) no-repeat scroll center left white;" value="TD">Chad</option>';
  6457. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/ZX.jpg) no-repeat scroll center left white;" value="ZX">Checoslovaquia</option>';
  6458. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/CL.jpg) no-repeat scroll center left white;" value="CL">Chile</option>';
  6459. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/CN.jpg) no-repeat scroll center left white;" value="CN">China</option>';
  6460. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/CY.jpg) no-repeat scroll center left white;" value="CY">Chipre</option>';
  6461. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/CO.jpg) no-repeat scroll center left white;" value="CO">Colombia</option>';
  6462. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/KM.jpg) no-repeat scroll center left white;" value="KM">Comores</option>';
  6463. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/CG.jpg) no-repeat scroll center left white;" value="CG">Congo</option>';
  6464. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/KP.jpg) no-repeat scroll center left white;" value="KP">Corea del Norte</option>';
  6465. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/KR.jpg) no-repeat scroll center left white;" value="KR">Corea del Sur</option>';
  6466. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/CI.jpg) no-repeat scroll center left white;" value="CI">Costa de Marfil</option>';
  6467. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/CR.jpg) no-repeat scroll center left white;" value="CR">Costa Rica</option>';
  6468. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/HR.jpg) no-repeat scroll center left white;" value="HR">Croacia</option>';
  6469. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/CU.jpg) no-repeat scroll center left white;" value="CU">Cuba</option>';
  6470. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/DK.jpg) no-repeat scroll center left white;" value="DK">Dinamarca</option>';
  6471. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/DM.jpg) no-repeat scroll center left white;" value="DM">Dominica</option>';
  6472. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/EC.jpg) no-repeat scroll center left white;" value="EC">Ecuador</option>';
  6473. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/EG.jpg) no-repeat scroll center left white;" value="EG">Egipto</option>';
  6474. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/SV.jpg) no-repeat scroll center left white;" value="SV">El Salvador</option>';
  6475. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/AE.jpg) no-repeat scroll center left white;" value="AE">Emiratos &Aacute;rabes</option>';
  6476. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/ER.jpg) no-repeat scroll center left white;" value="ER">Eritrea</option>';
  6477. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/SK.jpg) no-repeat scroll center left white;" value="SK">Eslovaquia</option>';
  6478. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/SI.jpg) no-repeat scroll center left white;" value="SI">Eslovenia</option>';
  6479. txt += '<option selected style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/ES.jpg) no-repeat scroll center left white;" value="ES">Espa&ntilde;a</option>';
  6480. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/US.jpg) no-repeat scroll center left white;" value="US">Estados Unidos</option>';
  6481. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/EE.jpg) no-repeat scroll center left white;" value="EE">Estonia</option>';
  6482. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/ET.jpg) no-repeat scroll center left white;" value="ET">Etiop&iacute;a</option>';
  6483. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/FJ.jpg) no-repeat scroll center left white;" value="FJ">Fidji</option>';
  6484. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/PH.jpg) no-repeat scroll center left white;" value="PH">Filipinas</option>';
  6485. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/FI.jpg) no-repeat scroll center left white;" value="FI">Finlandia</option>';
  6486. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/FR.jpg) no-repeat scroll center left white;" value="FR">Francia</option>';
  6487. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/GA.jpg) no-repeat scroll center left white;" value="GA">Gab&oacute;n</option>';
  6488. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/GM.jpg) no-repeat scroll center left white;" value="GM">Gambia</option>';
  6489. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/GE.jpg) no-repeat scroll center left white;" value="GE">Georgia</option>';
  6490. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/GR.jpg) no-repeat scroll center left white;" value="GR">Grecia</option>';
  6491. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/GL.jpg) no-repeat scroll center left white;" value="GL">Groenlandia</option>';
  6492. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/GT.jpg) no-repeat scroll center left white;" value="GT">Guatemala</option>';
  6493. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/GN.jpg) no-repeat scroll center left white;" value="GN">Guinea</option>';
  6494. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/GW.jpg) no-repeat scroll center left white;" value="GW">Guinea Bissau</option>';
  6495. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/GQ.jpg) no-repeat scroll center left white;" value="GQ">Guinea Ecuatorial</option>';
  6496. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/GY.jpg) no-repeat scroll center left white;" value="GY">Guyana</option>';
  6497. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/HT.jpg) no-repeat scroll center left white;" value="HT">Hait&iacute;</option>';
  6498. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/NL.jpg) no-repeat scroll center left white;" value="NL">Holanda</option>';
  6499. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/HN.jpg) no-repeat scroll center left white;" value="HN">Honduras</option>';
  6500. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/HK.jpg) no-repeat scroll center left white;" value="HK">Hong Kong</option>';
  6501. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/HU.jpg) no-repeat scroll center left white;" value="HU">Hungr&iacute;a</option>';
  6502. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/IN.jpg) no-repeat scroll center left white;" value="IN">India</option>';
  6503. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/ID.jpg) no-repeat scroll center left white;" value="ID">Indonesia</option>';
  6504. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/IQ.jpg) no-repeat scroll center left white;" value="IQ">Irak</option>';
  6505. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/IR.jpg) no-repeat scroll center left white;" value="IR">Ir&aacute;n</option>';
  6506. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/IE.jpg) no-repeat scroll center left white;" value="IE">Irlanda</option>';
  6507. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/IS.jpg) no-repeat scroll center left white;" value="IS">Islandia</option>';
  6508. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/IL.jpg) no-repeat scroll center left white;" value="IL">Israel</option>';
  6509. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/IT.jpg) no-repeat scroll center left white;" value="IT">Italia</option>';
  6510. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/JM.jpg) no-repeat scroll center left white;" value="JM">Jamaica</option>';
  6511. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/JP.jpg) no-repeat scroll center left white;" value="JP">Jap&oacute;n</option>';
  6512. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/JO.jpg) no-repeat scroll center left white;" value="JO">Jordania</option>';
  6513. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/KZ.jpg) no-repeat scroll center left white;" value="KZ">Kazajst&aacute;n</option>';
  6514. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/KE.jpg) no-repeat scroll center left white;" value="KE">Kenia</option>';
  6515. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/KG.jpg) no-repeat scroll center left white;" value="KG">Kirguizst&aacute;n</option>';
  6516. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/KW.jpg) no-repeat scroll center left white;" value="KW">Kuwait</option>';
  6517. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/LA.jpg) no-repeat scroll center left white;" value="LA">Laos</option>';
  6518. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/LS.jpg) no-repeat scroll center left white;" value="LS">Lesotho</option>';
  6519. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/LE.jpg) no-repeat scroll center left white;" value="LE">Letonia</option>';
  6520. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/LB.jpg) no-repeat scroll center left white;" value="LB">L&iacute;bano</option>';
  6521. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/LR.jpg) no-repeat scroll center left white;" value="LR">Liberia</option>';
  6522. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/LY.jpg) no-repeat scroll center left white;" value="LY">Libia</option>';
  6523. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/LI.jpg) no-repeat scroll center left white;" value="LI">Liechtenstein</option>';
  6524. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/LT.jpg) no-repeat scroll center left white;" value="LT">Lituania</option>';
  6525. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/LU.jpg) no-repeat scroll center left white;" value="LU">Luxemburgo</option>';
  6526. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/MK.jpg) no-repeat scroll center left white;" value="MK">Macedonia</option>';
  6527. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/MG.jpg) no-repeat scroll center left white;" value="MG">Madagascar</option>';
  6528. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/MY.jpg) no-repeat scroll center left white;" value="MY">Malasia</option>';
  6529. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/MW.jpg) no-repeat scroll center left white;" value="MW">Malawi</option>';
  6530. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/MV.jpg) no-repeat scroll center left white;" value="MV">Maldivas</option>';
  6531. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/ML.jpg) no-repeat scroll center left white;" value="ML">Mali</option>';
  6532. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/MT.jpg) no-repeat scroll center left white;" value="MT">Malta</option>';
  6533. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/MA.jpg) no-repeat scroll center left white;" value="MA">Marruecos</option>';
  6534. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/MH.jpg) no-repeat scroll center left white;" value="MH">Marshall (Islas)</option>';
  6535. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/MU.jpg) no-repeat scroll center left white;" value="MU">Mauricio (Isla)</option>';
  6536. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/MR.jpg) no-repeat scroll center left white;" value="MR">Mauritania</option>';
  6537. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/MX.jpg) no-repeat scroll center left white;" value="MX">M&eacute;xico</option>';
  6538. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/FM.jpg) no-repeat scroll center left white;" value="FM">Micronesia</option>';
  6539. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/MD.jpg) no-repeat scroll center left white;" value="MD">Moldavia</option>';
  6540. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/MC.jpg) no-repeat scroll center left white;" value="MC">M&oacute;naco</option>';
  6541. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/MN.jpg) no-repeat scroll center left white;" value="MN">Mongolia</option>';
  6542. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/ME.jpg) no-repeat scroll center left white;" value="ME">Montenegro</option>';
  6543. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/MZ.jpg) no-repeat scroll center left white;" value="MZ">Mozambique</option>';
  6544. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/MM.jpg) no-repeat scroll center left white;" value="MM">Myamnmar - Birmania</option>';
  6545. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/NA.jpg) no-repeat scroll center left white;" value="NA">Namibia</option>';
  6546. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/NP.jpg) no-repeat scroll center left white;" value="NP">Nepal</option>';
  6547. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/NI.jpg) no-repeat scroll center left white;" value="NI">Nicaragua</option>';
  6548. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/NE.jpg) no-repeat scroll center left white;" value="NE">N&iacute;ger</option>';
  6549. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/NG.jpg) no-repeat scroll center left white;" value="NG">Nigeria</option>';
  6550. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/NO.jpg) no-repeat scroll center left white;" value="NO">Noruega</option>';
  6551. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/NZ.jpg) no-repeat scroll center left white;" value="NZ">Nueva Zelanda</option>';
  6552. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/OM.jpg) no-repeat scroll center left white;" value="OM">Om&aacute;n</option>';
  6553. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/PS.jpg) no-repeat scroll center left white;" value="PS">Palestina</option>';
  6554. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/PA.jpg) no-repeat scroll center left white;" value="PA">Panam&aacute;</option>';
  6555. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/PG.jpg) no-repeat scroll center left white;" value="PG">Papuasia Nueva Guinea</option>';
  6556. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/PK.jpg) no-repeat scroll center left white;" value="PK">Paquist&aacute;n</option>';
  6557. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/PY.jpg) no-repeat scroll center left white;" value="PY">Paraguay</option>';
  6558. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/PE.jpg) no-repeat scroll center left white;" value="PE">Per&uacute;</option>';
  6559. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/PL.jpg) no-repeat scroll center left white;" value="PL">Polonia</option>';
  6560. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/PT.jpg) no-repeat scroll center left white;" value="PT">Portugal</option>';
  6561. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/PR.jpg) no-repeat scroll center left white;" value="PR">Puerto Rico</option>';
  6562. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/QA.jpg) no-repeat scroll center left white;" value="QA">Qatar</option>';
  6563. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/GB.jpg) no-repeat scroll center left white;" value="GB">Reino Unido</option>';
  6564. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/CF.jpg) no-repeat scroll center left white;" value="CF">Rep. Centroafricana</option>';
  6565. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/DO.jpg) no-repeat scroll center left white;" value="DO">Rep. Dominicana</option>';
  6566. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/CZ.jpg) no-repeat scroll center left white;" value="CZ">Rep&uacute;blica Checa</option>';
  6567. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/CD.jpg) no-repeat scroll center left white;" value="CD">Rep&uacute;blica del Congo</option>';
  6568. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/RW.jpg) no-repeat scroll center left white;" value="RW">Ruanda</option>';
  6569. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/RO.jpg) no-repeat scroll center left white;" value="RO">Ruman&iacute;a</option>';
  6570. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/RU.jpg) no-repeat scroll center left white;" value="RU">Rusia</option>';
  6571. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/WS.jpg) no-repeat scroll center left white;" value="WS">Samoa</option>';
  6572. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/SN.jpg) no-repeat scroll center left white;" value="SN">Senegal</option>';
  6573. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/RS.jpg) no-repeat scroll center left white;" value="RS">Serbia</option>';
  6574. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/RR.jpg) no-repeat scroll center left white;" value="RR">Serbia y Montenegro</option>';
  6575. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/SL.jpg) no-repeat scroll center left white;" value="SL">Sierra Leona</option>';
  6576. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/SG.jpg) no-repeat scroll center left white;" value="SG">Singapur</option>';
  6577. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/SY.jpg) no-repeat scroll center left white;" value="SY">Siria</option>';
  6578. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/LK.jpg) no-repeat scroll center left white;" value="LK">Sri Lanka</option>';
  6579. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/SD.jpg) no-repeat scroll center left white;" value="SD">Sud&aacute;n</option>';
  6580. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/SE.jpg) no-repeat scroll center left white;" value="SE">Suecia</option>';
  6581. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/CH.jpg) no-repeat scroll center left white;" value="CH">Suiza</option>';
  6582. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/ZA.jpg) no-repeat scroll center left white;" value="ZA">Sur&aacute;frica</option>';
  6583. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/SR.jpg) no-repeat scroll center left white;" value="SR">Surinam</option>';
  6584. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/SZ.jpg) no-repeat scroll center left white;" value="SZ">Swazilandia</option>';
  6585. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/TH.jpg) no-repeat scroll center left white;" value="TH">Tailandia</option>';
  6586. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/TW.jpg) no-repeat scroll center left white;" value="TW">Taiw&aacute;n</option>';
  6587. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/TJ.jpg) no-repeat scroll center left white;" value="TJ">Tajikistan</option>';
  6588. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/TZ.jpg) no-repeat scroll center left white;" value="TZ">Tanzania</option>';
  6589. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/TG.jpg) no-repeat scroll center left white;" value="TG">Togo</option>';
  6590. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/TT.jpg) no-repeat scroll center left white;" value="TT">Trinidad y Tobago</option>';
  6591. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/TN.jpg) no-repeat scroll center left white;" value="TN">T&uacute;nez</option>';
  6592. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/TM.jpg) no-repeat scroll center left white;" value="TM">Turkmenist&aacute;n</option>';
  6593. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/TR.jpg) no-repeat scroll center left white;" value="TR">Turqu&iacute;a</option>';
  6594. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/UA.jpg) no-repeat scroll center left white;" value="UA">Ucrania</option>';
  6595. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/UG.jpg) no-repeat scroll center left white;" value="UG">Uganda</option>';
  6596. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/ZY.jpg) no-repeat scroll center left white;" value="ZY">Uni&oacute;n Sovi&eacute;tica (URSS)</option>';
  6597. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/UY.jpg) no-repeat scroll center left white;" value="UY">Uruguay</option>';
  6598. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/UZ.jpg) no-repeat scroll center left white;" value="UZ">Uzbekistan</option>';
  6599. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/VE.jpg) no-repeat scroll center left white;" value="VE">Venezuela</option>';
  6600. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/VN.jpg) no-repeat scroll center left white;" value="VN">Vietnam</option>';
  6601. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/YE.jpg) no-repeat scroll center left white;" value="YE">Yemen</option>';
  6602. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/YU.jpg) no-repeat scroll center left white;" value="YU">Yugoslavia</option>';
  6603. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/ZM.jpg) no-repeat scroll center left white;" value="ZM">Zambia</option>';
  6604. txt += '<option style="padding-left: 19px; background: url(http://www.filmaffinity.com/imgs/countries/ZW.jpg) no-repeat scroll center left white;" value="ZW">Zimbabwe</option>';
  6605. txt += '</select></td></tr></table></div></td>';
  6606. //<--------------------- Clasif. por GENEROS --------------------------------->
  6607. txt += '<td style="vertical-align:top;" width="270px"><div class="profile_cont_votes" width="260px">';
  6608. txt += '<div class="title_profile_votes">Por géneros</div>';
  6609. txt += '<table id="CLAS_GENEROS"><tbody>';
  6610. txt += '<tr><td><b>Género:</b></td>';
  6611. txt += '<td colspan="2"><select id="GEN_SELECT" name="GEN_SELECT">';
  6612. txt += '<option value="AC">Acción</option>';
  6613. txt += '<option value="AN">Animación</option>';
  6614. txt += '<option value="AV">Aventuras</option>';
  6615. txt += '<option value="BE">Bélico</option>';
  6616. txt += '<option value="CF">Ciencia ficción</option>';
  6617. txt += '<option value="CN">Cine negro</option>';
  6618. txt += '<option value="CO">Comedia</option>';
  6619. txt += '<option value="DO">Documental</option>';
  6620. txt += '<option value="DR">Drama</option>';
  6621. txt += '<option value="FN">Fantástico</option>';
  6622. txt += '<option value="IF">Infantil</option>';
  6623. txt += '<option value="IT">Intriga</option>';
  6624. txt += '<option value="MU">Musical</option>';
  6625. txt += '<option value="RO">Romance</option>';
  6626. txt += '<option value="TV">Serie de TV</option>';
  6627. txt += '<option value="TE">Terror</option>';
  6628. txt += '<option value="TH">Thriller</option>';
  6629. txt += '<option value="WE">Western</option>';
  6630. txt += '</select></td></tr></table></div></td>';
  6631. //<--------------------- Clasif. por AÑOS --------------------------------->
  6632. txt += '<td style="vertical-align:top;" width="270px"><div class="profile_cont_votes" width="260px">';
  6633. txt += '<div class="title_profile_votes">Por años</div>';
  6634. txt += '<table id="CLAS_ANIOS"><tbody>';
  6635. txt += '<tr><td><b>Años:</b></td>';
  6636. txt += '<td colspan="2"><select style="text-align: center;" id="ANIO_SELECT" name="ANIO_SELECT">';
  6637. /*txt += '<option style="text-align: center;" value="AA1">18XX - 1899</option>';
  6638. txt += '<option style="text-align: center;" value="AA2">1900 - 1909</option>';
  6639. txt += '<option style="text-align: center;" value="AA3">1910 - 1919</option>';
  6640. txt += '<option style="text-align: center;" value="AA4">1920 - 1929</option>';
  6641. */txt += '<option style="text-align: center;" value="A1">18XX - 1929</option>';
  6642. txt += '<option style="text-align: center;" value="A2">1930 - 1939</option>';
  6643. txt += '<option style="text-align: center;" value="A3">1940 - 1949</option>';
  6644. txt += '<option style="text-align: center;" value="A4">1950 - 1959</option>';
  6645. txt += '<option style="text-align: center;" value="A5">1960 - 1969</option>';
  6646. txt += '<option style="text-align: center;" value="A6">1970 - 1979</option>';
  6647. txt += '<option style="text-align: center;" value="A7">1980 - 1989</option>';
  6648. txt += '<option style="text-align: center;" value="A8">1990 - 1999</option>';
  6649. txt += '<option style="text-align: center;" value="2A">2000</option>';
  6650. txt += '<option style="text-align: center;" value="2B">2001</option>';
  6651. txt += '<option style="text-align: center;" value="2C">2002</option>';
  6652. txt += '<option style="text-align: center;" value="2D">2003</option>';
  6653. txt += '<option style="text-align: center;" value="2E">2004</option>';
  6654. txt += '<option style="text-align: center;" value="2F">2005</option>';
  6655. txt += '<option style="text-align: center;" value="2G">2006</option>';
  6656. txt += '<option style="text-align: center;" value="2H">2007</option>';
  6657. txt += '<option style="text-align: center;" value="2I">2008</option>';
  6658. txt += '<option style="text-align: center;" value="2J">2009</option>';
  6659. txt += '<option style="text-align: center;" value="2K">2010</option>';
  6660. txt += '<option style="text-align: center;" value="2L">2011</option>';
  6661. txt += '<option style="text-align: center;" value="2M">2012</option>';
  6662. txt += '<option style="text-align: center;" value="2N">2013</option>';
  6663. txt += '<option selected style="text-align: center;" value="2P">2014</option>';
  6664. txt += '<option style="text-align: center;" value="2Q">2015</option>';
  6665. txt += '</select></td></tr></table></div></td></tr>';
  6666. ntableclas.innerHTML = txt;
  6667. nodoadd.parentNode.appendChild(ndivclas);
  6668. nodoadd.parentNode.appendChild(ntableclas);
  6669. injectFilesGeneral('ES','paises');
  6670. $id("PAIS_SELECT").addEventListener("change", doChangePais, false);
  6671. injectFilesGeneral('AC','generos');
  6672. $id("GEN_SELECT").addEventListener("change", doChangeGen, false);
  6673. injectFilesGeneral('2P','anios');
  6674. $id("ANIO_SELECT").addEventListener("change", doChangeAnio, false);
  6675. }
  6676. doClasPais();
  6677. }
  6678. //Función para cambiar los colores de los votos en nuestraslistas
  6679. function dochangeColorVotesLists(){
  6680. log('cambio color de votos');
  6681. setTimeout(cambiar_colores, 1500)
  6682. function cambiar_colores(){
  6683. var npages = "//div[@class='pager']/a".findNodesArray();
  6684. for(var j = 0; j < npages.length; j++){
  6685. npages[j].onclick = function(){
  6686. setTimeout(cambiar_colores, 3000);
  6687. document.getElementById("tabla-afinidades").remove();
  6688. doAddMediaInLists();
  6689. };
  6690. }
  6691. var nvotos = "//div[@class='rat-movie']".findNodesArray();
  6692. for(var i = 0; i < nvotos.length; i++){
  6693. //if(nvotos[i].parentNode.className = "hide-movie")
  6694. if(nvotos[i].parentNode.className != undefined){;
  6695. if(nvotos[i].textContent != "-"){
  6696. if((+nvotos[i].textContent)>6)
  6697. nvotos[i].style.backgroundColor = "#00AA10";
  6698. else if((+nvotos[i].textContent)>3)
  6699. nvotos[i].style.backgroundColor = "#F2AA1D";
  6700. } //if
  6701. else
  6702. nvotos[i].style.backgroundColor = "#447CAD";
  6703. }// if
  6704. }//for
  6705. }//cambiar_colores
  6706. }
  6707. /*
  6708. doAddFavList
  6709. Añade las listas favoritas a la página de Mis listas
  6710. Creado: 18/5/2009 - David Buxó
  6711. Mod: 19/5/2009 - David Buxó - Añadido elminar listas
  6712. Comentarios: Por ahora tenemos que tener alguna lista nuestra para que funcione correctamente.
  6713. */
  6714. function doAddFavLists() {
  6715. function removeListFromFavorites() {
  6716. if (confirm("¿Desea eliminar esta lista de sus Listas Favoritas?")) {
  6717. var favListsStr = GM_getValue(getUserId() + '.favlists');
  6718. var favoritas = eval(favListsStr);
  6719. var user_id = this.id.split(':')[0];
  6720. var list_id = this.id.split(':')[1];
  6721. var ix = inArray2(favoritas, 'list_id', list_id, 'user_id', user_id);
  6722. if (ix) {
  6723. favoritas.splice(ix, 1);
  6724. GM_setValue(getUserId() + '.favlists', favoritas.toSource());
  6725. var row = this.parentNode.parentNode;
  6726. row.parentNode.removeChild(row);
  6727. }
  6728. }
  6729. }
  6730. function removeListIMDBFromFavorites() {
  6731. if (confirm("¿Desea eliminar esta lista de sus Listas Favoritas?")) {
  6732. var favListsStr = GM_getValue(getUserId() + '.favlistsim');
  6733. var favoritas = eval(favListsStr);
  6734. var titulol = this.id.split(':')[0];
  6735. var useraut = this.id.split(':')[1];
  6736. var ix = inArray2(favoritas, 'titulo', titulol, 'user', useraut);
  6737. if (ix) {
  6738. favoritas.splice(ix, 1);
  6739. GM_setValue(getUserId() + '.favlistsim', favoritas.toSource());
  6740. var row = this.parentNode.parentNode;
  6741. row.parentNode.removeChild(row);
  6742. }
  6743. }
  6744. }
  6745. GM_addStyle('.addToFavorites {margin-left:5px;cursor:pointer;width:12px;height:12px;}');
  6746. var MyListsTable = '//div[@class="leyend-bottom"]'.findNode();
  6747. var favListsStr = GM_getValue(getUserId() + '.favlists');
  6748. log(typeof favListsStr);
  6749. if (typeof favListsStr != 'undefined') {
  6750. var tpl = "<a class='llnk' href='/es/userlist.php?user_id={user_id}&list_id={list_id}'>{list_name}</a>";
  6751. //Divs contenedores: títulos + tablas
  6752. var divfav = d.createElement('div');
  6753. divfav.id = "mt-content-cell";
  6754. divfav.innerHTML = '<h1 id="main-title">Mis Listas Favoritas</h1>';
  6755. var divimdb = d.createElement('div');
  6756. divimdb.id = "mt-content-cell";
  6757. divimdb.innerHTML = '<h1 id="main-title">Mis Listas Favoritas (IMDB)</h1>';
  6758. var tabfav = d.createElement('table');
  6759. tabfav.className = "llstd";
  6760. tabfav.width = "100%";
  6761. tabfav.border = "0";
  6762. tabfav.cellPadding = "0";
  6763. tabfav.cellSpacing = "0";
  6764. var tabimdb = d.createElement('table');
  6765. tabimdb.className = "llstd";
  6766. tabimdb.width = "100%";
  6767. tabimdb.border = "0";
  6768. tabimdb.cellPadding = "0";
  6769. tabimdb.cellSpacing = "0";
  6770. //Cabeceras
  6771. var txtt = "";
  6772. txtt += '<tr bgcolor="#006633"><td><span style="font-size:10px; font-weight: bold; color:#ffffff">&nbsp;Nombre</span></td>';
  6773. txtt += '<td align="center"><span style="font-size:10px; font-weight: bold; color:#ffffff">Usuario</span></td>';
  6774. txtt += '<td>&nbsp;</td></tr></tbody>';
  6775. tabfav.innerHTML = txtt;
  6776. var txtti = "";
  6777. txtti += '<tr bgcolor="#DDDB3F"><td><span style="font-size:10px; font-weight: bold; color:#000000">&nbsp;Nombre</span></td>';
  6778. txtti += '<td align="center"><span style="font-size:10px; font-weight: bold; color:#000000">Usuario</span></td>';
  6779. txtti += '<td>&nbsp;</td></tr>';
  6780. tabimdb.innerHTML = txtti;
  6781.  
  6782. var favlists = eval(favListsStr);
  6783. favlists.sort(function(a, b) {
  6784. return b.list_name.toLowerCase() > a.list_name.toLowerCase();
  6785. });
  6786. for (var ix in favlists) {
  6787. var list = favlists[ix];
  6788. var content = tpl.replaceObject(list);
  6789. var tri = d.createElement('tr');
  6790. tri.className = "list-item";
  6791. tri.style.backgroundColor = "#ffffff";
  6792. tri.addEventListener("mouseover", function() {
  6793. this.style.backgroundColor = "#f0f0f0";
  6794. }, false);
  6795. tri.addEventListener("mouseout", function() {
  6796. this.style.backgroundColor = "#ffffff";
  6797. }, false);
  6798. var tdi1 = d.createElement('td');
  6799. tdi1.style.padding = "3px 1px";
  6800. tdi1.style.color = "#444444";
  6801. tdi1.style.fontSize = "14px";
  6802. tdi1.style.borderTop = "1px solid #e2e2e2";
  6803. var tdi2 = d.createElement('td');
  6804. tdi2.style.padding = "3px 1px";
  6805. tdi2.style.color = "#444444";
  6806. tdi2.style.fontSize = "14px";
  6807. tdi2.style.borderTop = "1px solid #e2e2e2";
  6808. tdi2.width = "90px";
  6809. tdi2.align = "center";
  6810. var tdi3 = d.createElement('td');
  6811. tdi3.style.padding = "3px 1px";
  6812. tdi3.style.color = "#444444";
  6813. tdi3.style.fontSize = "14px";
  6814. tdi3.style.borderTop = "1px solid #e2e2e2";
  6815. tdi3.width = "20px";
  6816. tdi1.innerHTML = content;
  6817. tdi2.innerHTML = "<b>" + list.user_name.replace(" ", "&nbsp;") + "</b>";// "<b>" + list.films + "</b>";
  6818. var button = d.createElement('IMG');
  6819. button.className = 'addToFavorites';
  6820. button.src = img_minus;
  6821. button.alt = "Eliminar lista de Favoritas";
  6822. button.id = list.titulo + ":" + list.user;
  6823. button.addEventListener("click", removeListFromFavorites, false);
  6824. tdi3.appendChild(button);
  6825. tri.appendChild(tdi1);
  6826. tri.appendChild(tdi2);
  6827. tri.appendChild(tdi3);
  6828. tabfav.appendChild(tri);
  6829. }
  6830. // Insertamos las listas (Favoritas -> IMDB)
  6831. var favListsStr2 = GM_getValue(getUserId() + '.favlistsim');
  6832. if (typeof favListsStr2 != 'undefined') {
  6833. var tpl2 = "<a href='{direccion}/?view=compact' class='llnk' target='_blank'>{titulo} ({nelements} elem.)</a>";
  6834. }
  6835. var favlists2 = eval(favListsStr2);
  6836. favlists2.sort(function(a, b) {
  6837. var titA = a.titulo.toLowerCase();
  6838. var titB = b.titulo.toLowerCase();
  6839. //return b.titulo.toLowerCase() > a.titulo.toLowerCase();
  6840. if (titA < titB) //sort string ascending
  6841. return -1
  6842. if (titA > titB)
  6843. return 1
  6844. return 0 //default return value (no sorting)
  6845. });
  6846. for (var ix2 in favlists2) {
  6847. var list2 = favlists2[ix2];
  6848. var content2 = tpl2.replaceObject(list2);
  6849. var tri = d.createElement('tr');
  6850. tri.className = "list-item";
  6851. tri.style.backgroundColor = "#ffffff";
  6852. tri.addEventListener("mouseover", function() {
  6853. this.style.backgroundColor = "#f0f0f0";
  6854. }, false);
  6855. tri.addEventListener("mouseout", function() {
  6856. this.style.backgroundColor = "#ffffff";
  6857. }, false);
  6858. var tdi1 = d.createElement('td');
  6859. tdi1.style.padding = "3px 1px";
  6860. tdi1.style.color = "#444444";
  6861. tdi1.style.fontSize = "14px";
  6862. tdi1.style.borderTop = "1px solid #e2e2e2";
  6863. var tdi2 = d.createElement('td');
  6864. tdi2.style.padding = "3px 1px";
  6865. tdi2.style.color = "#444444";
  6866. tdi2.style.fontSize = "14px";
  6867. tdi2.style.borderTop = "1px solid #e2e2e2";
  6868. tdi2.width = "90px";
  6869. tdi2.align = "center";
  6870. var tdi3 = d.createElement('td');
  6871. tdi3.style.padding = "3px 1px";
  6872. tdi3.style.color = "#444444";
  6873. tdi3.style.fontSize = "14px";
  6874. tdi3.style.borderTop = "1px solid #e2e2e2";
  6875. tdi3.width = "20px";
  6876. tdi1.innerHTML = content2;
  6877. tdi2.innerHTML = "<b>" + list2.user.replace(" ", "&nbsp;") + "</b>";// "<b>" + list2.films + "</b>";
  6878. var button2 = d.createElement('IMG');
  6879. button2.className = 'addToFavorites';
  6880. button2.src = img_minus;
  6881. button2.alt = "Eliminar lista de Favoritas";
  6882. button2.id = list2.titulo + ":" + list2.user;
  6883. button2.addEventListener("click", removeListIMDBFromFavorites, false);
  6884. tdi3.appendChild(button2);
  6885. tri.appendChild(tdi1);
  6886. tri.appendChild(tdi2);
  6887. tri.appendChild(tdi3);
  6888. tabimdb.appendChild(tri);
  6889. }
  6890. var nodop = '//div[@id="mt-content-cell"]'.findNode();
  6891. MyListsTable.parentNode.removeChild(MyListsTable.parentNode.lastChild);
  6892. divfav.appendChild(tabfav);
  6893. divimdb.appendChild(tabimdb);
  6894. nodop.parentNode.insertBefore(divfav, nodop.nextSibling);
  6895. nodop.parentNode.insertBefore(divimdb, nodop.nextSibling.nextSibling);
  6896. }
  6897. }
  6898.  
  6899. /*
  6900. doAddToFavList
  6901. Añade el icono para añadir las listas a las Listas Favoritas
  6902. Creado: 19/5/2009 - David Buxó
  6903. */
  6904. function doAddToFavLists() {
  6905. var favoritas;
  6906. function addListToFavorites() {
  6907. var anchor = ("//img[@id='" + this.id + "']").findNode().previousSibling;
  6908. var name = "//h1[@id='main-title']".findNode();
  6909. var list = { user_id:url.split('=')[1].split('#')[0],
  6910. list_id:anchor.href.split('=')[2],
  6911. list_name:anchor.textContent,
  6912. user_name:name.textContent.split(': ')[1]};
  6913. if (confirm("¿Desea añadir esta lista a sus Listas Favoritas?")) {
  6914. favoritas.push(list);
  6915. GM_setValue(getUserId() + '.favlists', favoritas.toSource());
  6916. this.parentNode.removeChild(this);
  6917. }
  6918. }
  6919. function injectCode() {
  6920. GM_addStyle('.addToFavorites {margin-right:6px;padding-top:2px;width:12px;height:12px;}');
  6921. var user_id = url.split('=')[1].split('#')[0];
  6922. var links = "//div[@class='list-name-wrapper']/a".findNodesArray();
  6923. var favListsStr = GM_getValue(getUserId() + '.favlists');
  6924. if (typeof favListsStr != 'undefined') {
  6925. favoritas = eval(favListsStr);
  6926. } else {
  6927. favoritas = [];
  6928. }
  6929. ;
  6930. for (var ix in links) {
  6931. var anchor = links[ix];
  6932. var list_id = anchor.href.split('=')[2];
  6933. if (!inArray2(favoritas, 'user_id', user_id, 'list_id', list_id)) {
  6934. anchor.style.cssFloat = 'left';
  6935. var button = d.createElement('IMG');
  6936. button.className = 'addToFavorites';
  6937. button.src = img_plus;
  6938. button.style.cursor = "pointer";
  6939. button.style.cssFloat = 'left';
  6940. button.alt = "Añadir lista a Favoritas";
  6941. button.id = anchor.href.split('=')[2];
  6942. button.addEventListener("click", addListToFavorites, false);
  6943. anchor.parentNode.insertBefore(button, anchor);
  6944. //anchor.parentNode.appendChild(button);
  6945. }
  6946. else {
  6947. anchor.style.cssFloat = 'left';
  6948. var button = d.createElement('IMG');
  6949. button.className = 'addToFavorites';
  6950. button.src = redstar;
  6951. button.style.cssFloat = 'left';
  6952. button.alt = "Lista Favorita";
  6953. anchor.parentNode.insertBefore(button, anchor);
  6954. }
  6955. }
  6956. }
  6957. injectCode();
  6958. }
  6959. /*
  6960. doAddToFavListsIMDB
  6961. Añade el icono para añadir las listas a las Listas Favoritas (en IMDB)
  6962. Creado: 28/12/12 - Benjani
  6963. */
  6964. function doAddToFavListsIMDB() {
  6965. var favoritas;
  6966. function addListToFavorites() {
  6967. var titulol = "//h1[@class='header']".findNode();
  6968. var user_aut = "//h3[contains(text(),'Other Lists By')]".findNode();
  6969. user_aut = user_aut.textContent.split(' ')[3];
  6970. var elementos = "//div[@class='desc']".findNode();
  6971. var nelementos = elementos.getAttribute("data-size",0);
  6972. var basedir = "http://www.imdb.com/list/";
  6973. var dir = url.split('/')[4];
  6974. var finaldir = basedir + dir;
  6975. var list = { titulo:titulol.textContent,
  6976. user:user_aut,
  6977. nelements:nelementos,
  6978. direccion:finaldir};
  6979. if (confirm("¿Desea añadir esta lista a sus Listas Favoritas (IMDB)?")) {
  6980. favoritas.push(list);
  6981. GM_setValue(getUserId() + '.favlistsim', favoritas.toSource());
  6982. this.parentNode.removeChild(this);
  6983. }
  6984. }
  6985. function extractUserData() {
  6986. var titulol = "//h1[@class='header']".findNode();
  6987. var user_aut = "//h3[contains(text(),'Other Lists By')]".findNode();
  6988. user_aut = user_aut.textContent.split(' ')[3];
  6989. var elementos = "//div[@class='desc']".findNode();
  6990. var basedir = "http://www.imdb.com/list/";
  6991. var dir = url.split('/')[4];
  6992. var finaldir = basedir + dir;
  6993. var nelementos = elementos.getAttribute("data-size",0);
  6994. return {titulo:titulol.textContent,
  6995. user:user_aut,
  6996. nelements:nelementos,
  6997. direccion:finaldir};
  6998. }
  6999. function injectCode() {
  7000. GM_addStyle('.addToFavorites {margin-left:5px;cursor:pointer;width:12px;height:12px;}');
  7001. var titulo = "//h1[@class='header']".findNode();
  7002. var user_aut = "//h3[contains(text(),'Other Lists By')]".findNode();
  7003. user_aut = user_aut.textContent.split(' ')[3];
  7004. var favListsStrIM = GM_getValue(getUserId() + '.favlistsim');
  7005. if (typeof favListsStrIM != 'undefined') {
  7006. favoritas = eval(favListsStrIM);
  7007. } else {
  7008. favoritas = [];
  7009. }
  7010. ;
  7011. if (!inArray2(favoritas, 'titulo', titulo.textContent, 'user', user_aut)) {
  7012. var button = d.createElement('IMG');
  7013. button.className = 'addToFavorites';
  7014. button.src = img_plus;
  7015. button.alt = "Añadir lista a Favoritas";
  7016. button.id = user_aut;
  7017. button.addEventListener("click", addListToFavorites, false);
  7018. titulo.parentNode.insertBefore(button, titulo.nextSibling);
  7019. }
  7020. else{
  7021. var listas_im = extractUserData();
  7022. favoritas = arrayReplace(favoritas,'titulo',listas_im);
  7023. GM_setValue(getUserId() + '.favlistsim', favoritas.toSource());
  7024. }
  7025. }
  7026. injectCode();
  7027. }
  7028. // Inicio codigo principal
  7029. var browser = getBrowserCode();
  7030. var date = new Date();
  7031. log('Iniciando ' + appName + ' ' + appVersion + ' (' + date + ') ');
  7032. log(navigator.appName + ' ' + navigator.appVersion);
  7033. log('Logeado: ' + logged);
  7034. log('Administrador: ' + isAdmin);
  7035. if (url.search(/\/filter\.php/ig) > -1) return;
  7036. // Parcheador
  7037. // TODO: Comprobar browser y compatibilidad
  7038. for (var patchName in patches) {
  7039. var patch = patches[patchName];
  7040. if (patch.browser.indexOf(browser) > -1) {
  7041. var enabled = (typeof patch.sections == "undefined") || inSections(patch.sections);
  7042. if (typeof patch.preference != "undefined") {
  7043. enabled = enabled && getPreference(patch.preference, patch.def);
  7044. }
  7045. if (typeof patch.logged != "undefined") {
  7046. enabled = enabled && (logged || !patch.logged);
  7047. }
  7048. if (enabled) {
  7049. log("parche activado: " + patchName);
  7050. var resultado = patch.method();
  7051. // Si el parche devuelve false, finalizamos la ejecución
  7052. if (typeof resultado != "undefined" && !resultado) {
  7053. return;
  7054. }
  7055. }
  7056. }
  7057. }
  7058. log("Fin (" + date + ")");
  7059. }
  7060. ;