Created
January 3, 2018 13:17
-
-
Save andrecarlucci/fb1ad3caf46af7eea33cc3bf67d264d9 to your computer and use it in GitHub Desktop.
Tampermonkey script tp add #gratidao to all messages on whatsapp web #ironic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name MVP Gratidao | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description add #gratidao to all messages on whatsapp web | |
// @author You | |
// @match https://web.whatsapp.com/ | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
function appendContentInContainer(selector, content) { | |
var nodeList = document.querySelectorAll(selector); | |
for (var i = 0, length = nodeList.length; i < length; i++) { | |
if(nodeList[i].nodeName === 'SPAN' && !nodeList[i].innerHTML.endsWith(content)) { | |
nodeList[i].innerHTML = nodeList[i].innerHTML + content; | |
} | |
} | |
} | |
setInterval(function() { | |
appendContentInContainer('.selectable-text', ' #gratidao'); | |
}, 250); | |
console.log('gratidao started'); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment