Skip to content

Instantly share code, notes, and snippets.

@yorickvP
Created January 15, 2013 00:05
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 yorickvP/4534733 to your computer and use it in GitHub Desktop.
Save yorickvP/4534733 to your computer and use it in GitHub Desktop.
warn when you're about to tweet "thanks to me"
// ==UserScript==
// @name Warn when you're about to tweet "thanks to me"
// @namespace http://localhost/
// @version 0.1
// @description Add an alert whenever someone types "thanks to me"
// @match http://twitter.com/*
// @match https://twitter.com/*
// ==/UserScript==
(function() {
var containing = false
window.addEventListener("keyup", function(event) {
function istweetbox_p(elem) {
return elem.className.split(' ').indexOf('tweet-box') != -1 }
function contains_selfishness_p(elem) {
return !!elem.value.match(/thanks *to *me/i) }
if (istweetbox_p(event.target)) {
var tweetbox = event.target
if (contains_selfishness_p(tweetbox)) {
if (!containing) {
window.alert("You are about to tweet something containing"+
" \"thanks to me\", this was probably(hopefully) an error")
containing = true }}
else if (containing)
containing = false }}, false);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment