Skip to content

Instantly share code, notes, and snippets.

@Eibwen
Created September 6, 2019 14:44
Show Gist options
  • Save Eibwen/596150303fc8bc8131e5dc3f458975e8 to your computer and use it in GitHub Desktop.
Save Eibwen/596150303fc8bc8131e5dc3f458975e8 to your computer and use it in GitHub Desktop.
Super simple tampermonkey scirpt that collects data then displays it
// ==UserScript==
// @name Insert info panel - template
// @namespace http://tampermonkey.net/
// @version 0.1
// @description A template to make pulling information then displaying it in a simple div easier
// @author You
// @match https://www.google.com/
// @grant none
// ==/UserScript==
// A CSS selector, will use the first match
const targetSelector = "#tophf";
const dataCollectorFunctions =
[
() => { return document.querySelector('.gb_lb').innerText; }
];
(function() {
'use strict';
var match = document.querySelector(targetSelector);
var data = dataCollectorFunctions.map(e => e());
var el = document.createElement('div');
el.innerHTML = '<p>Hello World! Aka ' + data + '</p>';
match.appendChild(el);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment