Skip to content

Instantly share code, notes, and snippets.

@protorob
Created February 6, 2019 15:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save protorob/df3753ebba565a644582747cb4c0848f to your computer and use it in GitHub Desktop.
Save protorob/df3753ebba565a644582747cb4c0848f to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Get div contents and print it to console on OAM course
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://www.myatoma.com/Simulatore/*
// @require https://code.jquery.com/jquery-2.2.4.min.js
// ==/UserScript==
var $ = window.jQuery;
$( document ).ready(function() {
console.log("Sono pronto :-)");
});
//More Details https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver
// select the target node
var target = document.querySelector('#sim_domanda')
// create an observer instance
var observer = new MutationObserver(function(mutations) {
console.log($('#sim_domanda').text());
//Questa cosa non funziona
$.post("https://www.jsonstore.io/fb01957e5fe8a916d2fce4ab5f2a2b2c64e3d033b8192da25c07d509c0fc1965",
{
"Domanda" : $('#sim_domanda').text()
});
});
// configuration of the observer:
var config = { attributes: true, childList: true, characterData: true };
// pass in the target node, as well as the observer options
observer.observe(target, config);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment