Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name openhab2-screensaver
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description try to take over the world!
- // @author You
- // @match http://demo.openhab.org:8080/*
- // @require http://code.jquery.com/jquery-latest.min.js
- // @grant none
- // @run-at document-idle
- // ==/UserScript==
- // helpful: http://www.jonasjohn.de/snippets/javascript/greasemonkey-template.htm
- (function() {
- 'use strict';
- //object constructor
- function example(){
- // modify the stylesheet
- this.append_stylesheet('.container,.drawer { display: none; }');
- };
- //create a stylesheet
- example.prototype.append_stylesheet = function(css){
- var styletag = document.createElement("style");
- styletag.setAttribute('type', 'text/css');
- styletag.setAttribute('media', 'screen');
- styletag.appendChild(document.createTextNode(css));
- document.getElementsByTagName('head')[0].appendChild(styletag);
- };
- //instantiate and run
- var example = new example();
- $('body').append(
- '<img id="myNewImage" src="https://www.openhab.org/assets/images/openhab-logo-square.png">'
- );
- $("#myNewImage").css ( {
- position: "fixed",
- width: "640px",
- height: "480px",
- top: "0",
- left: "0"
- } );
- console.log("we arrived");
- $('document.body').css ( {
- display: none
- } );
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement