Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2021
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name       HOL Ignore List
  3. // @namespace  http://www.hardwareonline.dk
  4. // @description  HOL Ignore List functionallity with added filtering of guests.
  5. // @match      http://www.hardwareonline.dk/*
  6. // @match      https://www.hardwareonline.dk/*
  7. // @require    https://code.jquery.com/jquery-latest.min.js
  8. // @copyright  2014, John Nielsen <nielsen.john@gmail.com> - Tux, modified/extended by Wut with guest filtering
  9. // ==/UserScript==
  10.  
  11. jQuery( document ).ready(function($) {
  12.  
  13.     var ignoreArray = [], id = '', name = '', item = '', rank = '', newElem = '', guestName = '';
  14.     ignoreArray.push('Brugernavn1');
  15.     ignoreArray.push('Brugernavn2');
  16.  
  17.     $('.t47-svar').each(function() {
  18.  
  19.         var item = $(this);
  20.         id = item.find('.t47-svar-top A:first').attr('name');
  21.         name = item.find('A B').text();
  22.         rank = item.find('.bruger').text();
  23.         guestName = item.find('.bolditalic').text();
  24.  
  25.         if(ignoreArray.indexOf(name) > -1)
  26.         {
  27.             newElem = $('<div/>', {
  28.                 text: '#' + id + ': ' + name + ' (' + rank + ')',
  29.                 style: 'font-weight: bold; cursor: pointer; color: #15649f;',
  30.                 class: 't47-svar'
  31.             }).click(function() { item.toggle(); });
  32.  
  33.             item.before(newElem);
  34.             item.toggle();
  35.         }
  36.         else if( rank == 'Gæst')
  37.         {
  38.             newElem = $('<div/>', {
  39.                 text: '#' + id + ' : ' + guestName + ' (Gæst)' ,
  40.                 style: 'font-weight: bold; cursor: pointer; color: #15649f;',
  41.                 class: 't47-svar'
  42.             }).click(function() { item.toggle(); });
  43.  
  44.             item.before(newElem);
  45.             item.toggle();
  46.         }
  47.  
  48.     });
  49. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement