(function($) { $.Redactor.prototype.scriptbuttons = function() { return { init: function() { var sup = this.button.add('superscript', 'Superscript'); var sub = this.button.add('subscript', 'Subscript'); this.button.addCallback(sup, this.scriptbuttons.formatSup); this.button.addCallback(sub, this.scriptbuttons.formatSub); // Set icons this.button.setIcon(sup, ''); this.button.setIcon(sub, ''); }, formatSup: function() { this.inline.format('sup'); }, formatSub: function() { this.inline.format('sub'); } }; }; })(jQuery);