Advertisement
Guest User

RU-Board WhosOnline mod

a guest
Apr 3rd, 2014
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name           RU-Board WhosOnline mod
  3. // @author         Zloy_Gelud
  4. // @namespace      http://userscripts.org/scripts/show/159445
  5. // @include        http*://forum.ru-board.com/topic.cgi?forum=*
  6. // @include        http*://72.233.112.78/topic.cgi?forum=*
  7. // @include        http*://forum.ru-board.com/forum.cgi?forum=bm*
  8. // @include        http*://72.233.112.78/forum.cgi?forum=bm*
  9. // @icon           http://forum.ru-board.com/favicon.ico
  10. // @description    Highlights users online
  11. // @require        http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
  12. // @version        0.3.3
  13. // @run-at         document-end
  14. // ==/UserScript==
  15.  
  16. $(document).ready(function () {
  17.     $.ajax({
  18.         type: "GET", url: "http://forum.ru-board.com/whosonline.cgi", cache: false,
  19.         success: function (data) {
  20.             var Users = [];
  21.             var html = $.parseHTML(data);
  22.             $('tr.dats td:first-child b a', $(html)).each(function (col) {
  23.                 var Moderator = $(this).find('font');
  24.                 if (Moderator.length > 0) {
  25.                     Users[$(Moderator).html()] = 'mod';
  26.                 } else {
  27.                     Users[$(this).html()] = 'mem';
  28.                 }
  29.             });
  30.             $('a.m b, tr[bgcolor="#FFFFFF"] td:last-child.dats>a', $(document)).each(function (user) {
  31.                 var div = $('<div>');
  32.                 if (Users[$(this).html()] == 'mod') {
  33.                     div.attr({
  34.                         style: "width:4px;height:4px;left:4px;top:-1px;background:#cc4f4f;border:1px solid #ff3126;border-radius:100%;position:relative;display:inline-block;box-shadow: 0 0 2px rgba(125,0,0,0.9)",
  35.                         title: "Moderator online"
  36.                     });
  37.                 } else if (Users[$(this).html()] == 'mem') {
  38.                     div.attr({
  39.                         style: "width:4px;height:4px;left:4px;top:-1px;background:#7AC774;border:1px solid #54B94E;border-radius:100%;position:relative;display:inline-block;box-shadow: 0 0 2px rgba(0,125,0,0.9)",
  40.                         title: "User online"
  41.                     });
  42.                 } else {
  43.                     div.attr({
  44.                         style: "width:4px;height:4px;left:4px;top:-1px;background:#C0C0C0;border:1px solid #A0A0A0;border-radius:100%;position:relative;display:inline-block;box-shadow: 0 0 2px rgba(51,51,51,0.9)",
  45.                         title: "User offline"
  46.                     });
  47.                 }
  48.                 div.appendTo($(this).parent());
  49.             });
  50.         }
  51.     });
  52. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement