Last active
April 15, 2017 23:04
-
-
Save tie-rack/0dbe63c62c1e01362e037380ee286d18 to your computer and use it in GitHub Desktop.
oulipo.social pal
This file contains 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 oulipo.social pal | |
// @namespace http://kilosecond.com/ | |
// @version 0.1 | |
// @description Warn when you try to input a wrong thing | |
// @author ghosss | |
// @match https://oulipo.social/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var $ = window.$; | |
var e = /e/i; | |
var defaultColor = $("textarea").css("color"); | |
var defaultBackgroundColor = $("textarea").css("backgroundColor"); | |
var redOnE = function(event) { | |
var $textarea = $(event.target); | |
if (e.test($textarea.val())) { | |
$textarea.css("color", "red"); | |
$textarea.css("backgroundColor", "#fee"); | |
} else { | |
$textarea.css("color", defaultColor); | |
$textarea.css("backgroundColor", defaultBackgroundColor); | |
} | |
}; | |
$("textarea").on("input", redOnE); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment