Skip to content

Instantly share code, notes, and snippets.

@MegaApuTurkUltra
Created November 23, 2015 04:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save MegaApuTurkUltra/4b9540507a551add8d71 to your computer and use it in GitHub Desktop.
Save MegaApuTurkUltra/4b9540507a551add8d71 to your computer and use it in GitHub Desktop.
Scratch 📦 adder
// ==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