Created
November 30, 2015 23:08
-
-
Save mrjacobbloom/1fea4aef1af5534795cc to your computer and use it in GitHub Desktop.
This file contains hidden or 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 :package2: adder | |
| // @version 0.1 | |
| // @description replaces :package2: with the bbcode for package | |
| // @author NickyNouse | |
| // @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(/:package2:/g, "[img[]]http[color=inherit]:[/color]//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