Created
November 23, 2015 04:43
-
-
Save MegaApuTurkUltra/4b9540507a551add8d71 to your computer and use it in GitHub Desktop.
Scratch 📦 adder
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 :package: adder | |
// @namespace http://aputurk.tk/ | |
// @version 0.1 | |
// @description Adds the :package: emoticon | |
// @author MegaApuTurkUltra | |
// @match https://scratch.mit.edu/discuss/* | |
// @grant none | |
// ==/UserScript== | |
/* jshint -W097 */ | |
'use strict'; | |
var test = document.getElementsByClassName("markItUpEditor"); | |
if(test.length > 0){ | |
var editor = test[0]; | |
var emoticonFunc = function(){ | |
editor.value = editor.value.replace(/:package:/g, "[img]http://i67.tinypic.com/24wsdo6.png[/img]"); | |
}; | |
if(editor.onkeyup != null){ | |
var delegate = editor.onkeyup; | |
editor.onkeyup = function(){ | |
emoticonFunc(); | |
delegate(); | |
}; | |
} else { | |
editor.onkeyup = emoticonFunc; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment