Skip to content

Instantly share code, notes, and snippets.

@tie-rack
Last active April 15, 2017 23:04
Show Gist options
  • Save tie-rack/0dbe63c62c1e01362e037380ee286d18 to your computer and use it in GitHub Desktop.
Save tie-rack/0dbe63c62c1e01362e037380ee286d18 to your computer and use it in GitHub Desktop.
oulipo.social pal
// ==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