// ==UserScript==
// @name           deslashify_forum_post
// @namespace      http://www.fivebyfive.be/
// @description    Automagically replaces apostrophes, quotes, and backslashes in dA forum posts with HTML entities.
// @include        http://forum.deviantart.com/*
// ==/UserScript==

var deslash = {
	_entitise: function() {
		this.value = this.value.replace(
			/[\\'"]/g,
			function(str) {
				return '&#' + str.charCodeAt(0) + ';';
			}
		);
	}

	,go: function() {
		var cb = document.getElementById('commentbody');
		if(cb && cb.tabIndex == 3) // Klugey but it works
			cb.addEventListener('keyup', deslash._entitise, false);
	}
};

deslash.go();

