Advertisement
Guest User

Quick Delete

a guest
Jul 24th, 2014
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. // ==UserScript==
  2. // @name QuickDelete
  3. // @description Facilite la suppression de spam par MP sur jeuxvideo.com
  4. // @include http://www.jeuxvideo.com/messages-prives/boite-reception.php
  5. // @version 1.2
  6. // ==/UserScript==
  7.  
  8. function analyserPage() {
  9.  
  10. $('.sujet>a').each(function() {
  11.  
  12. var lienCourant = $(this);
  13.  
  14. $.ajax({
  15. url: lienCourant.attr('href'),
  16. dataType: 'text',
  17. type: 'GET',
  18. success: function(p){
  19. // XMLisation parce que sinon jQuery stoppera aux erreurs
  20. var h = document.createElement('div');
  21. h.innerHTML = p;
  22.  
  23. if(analyserMP(h))
  24. surlignerMP(lienCourant.parent().parent());
  25. }
  26. });
  27. });
  28. }
  29.  
  30. function analyserMP(mp) {
  31.  
  32. // Discussion fermée et 0 messages
  33. if(mp.getElementsByClassName('fermer').length == 1 && mp.getElementsByClassName('msg').length == 2)
  34. {
  35. return true;
  36. }
  37.  
  38. // Gens qui quittent
  39. if(mp.getElementsByClassName('liste_pseudos_elm').length > 10) {
  40. var rageQuits = 0;
  41. for(var i in mp.getElementsByClassName('generic')) {
  42. // Ne pas en prendre en compte les kick
  43. if(mp.getElementsByClassName('generic')[i].innerHTML == 'Ce pseudo vient de quitter la conversation.')
  44. rageQuits++;
  45. }
  46. if(rageQuits > 1) {
  47. return true;
  48. }
  49. }
  50.  
  51. return false;
  52. }
  53.  
  54. function surlignerMP(ligne) {
  55.  
  56. ligne.find('.c_sup>input').attr('checked', true);
  57. ligne.find('.sujet>a').css('color', 'red');
  58. ligne.addClass('select');
  59.  
  60. }
  61.  
  62. $(document).ready(function(){
  63. $('.td2b').each(function(){
  64. $(this).append(' (<a class="scan" href="#">SCAN</a>)');
  65. });
  66. $('.scan').each(function(){
  67. $(this).click(analyserPage);
  68. });
  69. });Quic
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement