Guest User

Show Oglaf Alt Text

a guest
Jun 5th, 2019
843
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         Display Oglaf Alt Texts
  3. // @namespace    http://tampermonkey.net/
  4. // @version      0.1
  5. // @description  try to take over the world!
  6. // @author       JavaJesus
  7. // @match        https://www.oglaf.com/*
  8. // @grant        none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12.     'use strict';
  13.  
  14.     var clearDiv = '<div style="clear: both;"></div>';
  15.     var altTextDiv = '<div style="margin-top: 5px; margin-left: 5px;">';
  16.     var titleText = document.getElementById('strip').getAttribute('title');
  17.     var altText = document.getElementById('strip').getAttribute('alt');
  18.     var completedAddition = clearDiv + altTextDiv + titleText;
  19.     if(altText === null){
  20.         document.getElementsByClassName('content')[0].style.height = document.getElementsByClassName('content')[0].clientHeight + 25 + 'px';
  21.     }
  22.     else{
  23.         document.getElementsByClassName('content')[0].style.height = document.getElementsByClassName('content')[0].clientHeight + 63 + 'px';
  24.         completedAddition += '<hr>' + altText;
  25.     }
  26.     completedAddition += '</div>';
  27.     document.getElementsByClassName('content')[0].insertAdjacentHTML('beforeend', completedAddition);
  28. })();
Advertisement
Add Comment
Please, Sign In to add comment