// ==UserScript== // @include http://meetic.fr/* // @include http://*.meetic.fr/* // ==/UserScript== function sr_failure(el) { alert('Erreur: impossible de trouver ' + el); GM_setValue('etat', 0); return 0; } var sr_state = GM_getValue('etat', 1); if (!sr_state || 'meeticmain' != self.name) { return; } if (1 == sr_state) { var sr_mtcMenu = document.getElementById('mtcMenu'); if (null == sr_mtcMenu) return sr_failure('mtcMenu'); var sr_a = sr_mtcMenu.getElementsByTagName('a'); if (!sr_a.length) return sr_failure('mtcMenu.a'); GM_setValue('etat', 2); document.location = sr_a[0].href; return; } if (2 == sr_state) { var sr_form = document.getElementsByTagName('form'); if (!sr_form.length) return sr_failure('form'); for (var i = 0; i < sr_form.length; i++) { var sr_select = sr_form[i].getElementsByTagName('select'); if (1 == sr_select.length && 'launch_mypref_search' == sr_select[0].name) { GM_setValue('etat', 3); sr_select[0].value = 4; sr_form[i].submit(); return; } } return; } if (3 == sr_state) { var sr_mtcBody = document.getElementById('mtcBody'); if (null == sr_mtcBody) return sr_failure('mtcBody'); var sr_div = sr_mtcBody.getElementsByTagName('div'); if (!sr_div.length) return sr_failure('mtcBody.div'); for (var i = 0; i < sr_div.length; i++) { if ('mtcBoxG2' == sr_div[i].className) { var sr_a = sr_div[i].getElementsByTagName('a'); if (!sr_a.length) return sr_failure('mtcBoxG2.a'); for (var j = 0; j < sr_a.length; j++) { if ('mtcLoadingPicture94' == sr_a[j].className) { GM_setValue('etat', 4); document.location = sr_a[j].href; return; } } } } return; } if (4 == sr_state) { var sr_flashs = 1; var sr_visites = 1; var sr_mtcBox2 = document.getElementById('mtcBox2'); if (null == sr_mtcBox2) return sr_failure('mtcBox2'); var sr_p = sr_mtcBox2.getElementsByTagName('p'); if (!sr_p.length) return sr_failure('mtcBox2.p'); for (var i = 0; i < sr_p.length; i++) { var sr_rev = /visites\D+(\d+)/; var sr_ref = /flashs\D+(\d+)/; var sr_str = sr_p[i].textContent; if (null == sr_str) return sr_failure('mtcBox2.p.textContent'); var sr_match = sr_str.match(sr_rev); if (null != sr_match) sr_visites = sr_match[1]; else { sr_match = sr_str.match(sr_ref); if (null != sr_match) sr_flashs = sr_match[1]; } } }