Guest User

Untitled

a guest
Aug 10th, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name     wykop płeć dla daltonistów
  3. // @version  1
  4. // @grant    none
  5. // @include /wykop.pl/
  6.  
  7. (function() {
  8.   'use strict';
  9.  
  10.   var $ = document.querySelectorAll.bind(document);
  11.  
  12.   function createElement(innerText) {
  13.     var outer = document.createElement('div');
  14.     outer.style.opacity = '0.5';
  15.     outer.style.position = 'absolute';
  16.     outer.style.width = '100%';
  17.     outer.style.top = '1px';
  18.     outer.style.right = '2px';
  19.     outer.style['z-index'] = '5';
  20.  
  21.     var inner = document.createElement('div');
  22.     inner.style.display = 'block';
  23.     inner.style.color = '#fefefe';
  24.  
  25.     inner.style['text-shadow'] = '-1px -1px 0 #050505, 1px -1px 0 #050505, -1px  1px 0 #050505, 1px  1px 0 #050505';
  26.     inner.style['text-align'] = 'right';
  27.     inner.style['font-weight'] = 'bold';
  28.     inner.style['font-size'] = '1.4rem';
  29.     inner.innerHTML = innerText;
  30.     outer.appendChild(inner);
  31.     return outer;
  32.   }
  33.  
  34.   function addSex(sex) {
  35.     var elementToAdd = createElement(sex);
  36.     return function(elem) {
  37.       elem.parentNode.insertBefore(elementToAdd.cloneNode(true), elem);
  38.       elem.classList.add('sexAdded');
  39.     }
  40.   }
  41.  
  42.   $('.logged-user .avatar ')[0].classList.add('sexAdded');
  43.  
  44.   function addSexes() {
  45.     $('.avatar:not(.sexAdded):not(.small)').forEach(function(elem) {
  46.       elem.parentNode.style.position = 'relative';
  47.     });
  48.     $('.avatar.female:not(.sexAdded)').forEach(addSex('K'));
  49.     $('.avatar.male:not(.sexAdded)').forEach(addSex('M'));
  50.     $('.avatar:not(.sexAdded):not(.female):not(.male)').forEach(addSex('B'));
  51.   }
  52.  
  53.   (function addSexesTimeout() {
  54.     addSexes();
  55.     setTimeout(addSexesTimeout, 10000);
  56.   })();
  57. })();
  58.  
  59.  
  60. // ==/UserScript==
Add Comment
Please, Sign In to add comment