Advertisement
n0l0cale

Untitled

Feb 9th, 2018
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         openhab2-screensaver
  3. // @namespace    http://tampermonkey.net/
  4. // @version      0.1
  5. // @description  try to take over the world!
  6. // @author       You
  7. // @match        http://demo.openhab.org:8080/*
  8. // @require      http://code.jquery.com/jquery-latest.min.js
  9. // @grant        none
  10. // @run-at      document-idle
  11. // ==/UserScript==
  12. // helpful: http://www.jonasjohn.de/snippets/javascript/greasemonkey-template.htm
  13.  
  14. (function() {
  15.     'use strict';
  16.  
  17.     //object constructor
  18.     function example(){
  19.  
  20.         // modify the stylesheet
  21.         this.append_stylesheet('.container,.drawer { display: none; }');
  22.  
  23.     };
  24.  
  25.     //create a stylesheet
  26.     example.prototype.append_stylesheet = function(css){
  27.  
  28.         var styletag = document.createElement("style");
  29.         styletag.setAttribute('type', 'text/css');
  30.         styletag.setAttribute('media', 'screen');
  31.         styletag.appendChild(document.createTextNode(css));
  32.  
  33.         document.getElementsByTagName('head')[0].appendChild(styletag);
  34.     };
  35.  
  36.     //instantiate and run
  37.     var example = new example();
  38.  
  39.     $('body').append(
  40.     '<img id="myNewImage" src="https://www.openhab.org/assets/images/openhab-logo-square.png">'
  41.     );
  42.     $("#myNewImage").css ( {
  43.     position:   "fixed",
  44.     width:      "640px",
  45.     height:     "480px",
  46.     top:        "0",
  47.     left:       "0"
  48.     } );
  49.     console.log("we arrived");
  50.  
  51.     $('document.body').css ( {
  52.         display: none
  53.     } );
  54.  
  55. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement