= greasemonkey =

The purpose of Greasemonkey is to manage user scripts. User scripts allow the user to control the way they use the web, by customizing it with scripting. The Greasemonkey extension won't do any good without any scripts installed. 

 * https://wiki.greasespot.net/Tutorials
 * https://wiki.greasespot.net/Greasemonkey_Manual
 * Any file that ends in .user.js is a user script.
 * window is an XPCNativeWrapper of the content window.
 * document is the document object of the XPCNativeWrapper window object.

== Remove nonio popup ==
''' remove_nonio_popup.user.js '''
{{{#!highlight javascript
// ==UserScript==
// @name         Remove Nonio Popup
// @author       
// @namespace    
// @homepage     
// @description  Remove nonio popup
// @version      
// @supportURL   
// @match        https://*.aquelamaquina.pt/*
// @match        https://*.xl.pt/*
// @match        https://*.publico.pt/*
// @match        https://*.sapo.pt/*
// @match        https://*.blitz.pt/*
// @match        https://*.visao.pt/*
// @match        https://*.expressoemprego.pt/*
// @match        https://*.cmjornal.pt/*
// @match        https://*.record.pt/*
// @match        https://*.jornaldenegocios.pt/*
// @match        https://*.jn.pt/*
// @match        https://*.dn.pt/*
// @match        https://*.tsf.pt/*
// @match        https://*.sabado.pt/*
// @match        https://*.ojogo.pt/*
// @match        https://*.dinheirovivo.pt/*
// @match        https://*.iol.pt/*
// @match        https://*.flash.pt/*
// @match        https://*.vidas.pt/*
// @match        https://*.maxima.pt/*
// @grant        none
// ==/UserScript==

function applyStuff(){
  //console.log("Is ready");
  var stringified_style = JSON.stringify(document.getElementsByTagName("body")[0].style );
  
  //if( stringified_style != "{}"){
  if( true ){
    console.log("Applied stuff");
    console.log( stringified_style );
    var element = document.getElementsByTagName("iframe");
    var index;

    for (index = element.length - 1; index >= 0; index--) {
      element[index].parentNode.removeChild(element[index]);
    } 
    document.getElementsByTagName("body")[0].style="overflow: auto!important;";
    
    var divs = document.getElementsByTagName("div");
    
    for(var i=0; i< divs.length;i++){
      var node = divs[i];
       console.log(node.id); 
       if(node.id.lastIndexOf("layer_gatting")>=0 ){
         node.parentNode.removeChild( node);
       }
    }
  }
}

// call each second
window.setInterval( applyStuff , 2000);

}}}

== Remove observador paywall ==
{{{#!highlight javascript
// ==UserScript==
// @name     Remove observador paywall
// @version  1.1
// @include *
// ==/UserScript==
// Remove observador paywall
var divNode = document.createElement('div');
divNode.innerHTML = '<button id="removePaywall" type="button">Remove paywall</button>'
divNode.setAttribute('id', 'buttonContainer');
divNode.setAttribute('style','position: fixed;left: 0;top: 50px;');
document.body.appendChild(divNode);

//--- Activate the newly added button.
document.getElementById ("removePaywall").addEventListener ("click", ButtonClickAction, false);
 
function ButtonClickAction (zEvent) {
  if( window.location.href.lastIndexOf('observador.pt') >=0 ){
    try{
      document.title = "Applied " + new Date().toString();
      var paywall = document.getElementById('paywall-block');
      if(paywall!==null){
        paywall.remove(); // remove paywall
      }
      var article = document.getElementsByClassName('article-body-wrapper');
      article[0].style=""; // remove max height
      //alert('aaa');
    }
    catch(ex){
      document.title = "Error:" + ex.message;
    }
  }

}

}}}