if (!RedactorPlugins) var RedactorPlugins = {};

RedactorPlugins.fontsize = function()
{
	return {
		init: function()
		{
			var fonts = [10, 11, 12, 14, 16, 18, 20, 24, 28, 30];
			var that = this;
			var dropdown = {};

			$.each(fonts, function(i, s)
			{
				dropdown['s' + i] = { title: s + 'px', func: function() { that.fontsize.set(s); } };
			});

			dropdown.remove = { title: 'Remove Font Size', func: that.fontsize.reset };

			var button = this.button.add('fontsize', 'Change Font Size');
			this.button.addDropdown(button, dropdown);
		},
		set: function(size)
		{
			this.inline.format('span', 'style', 'font-size: ' + size + 'px;');
		},
		reset: function()
		{
			this.inline.removeStyleRule('font-size');
		}
	};
};

if (!RedactorPlugins) var RedactorPlugins = {};
 
RedactorPlugins.scriptbuttons = function()
{
    return {
        init: function()
        {
            var sup = this.button.add('superscript', 'Superscript');
            var sub = this.button.add('subscript', 'Subscript');
 
            // make your added buttons as Font Awesome's icon
            this.button.setAwesome('superscript', 'fa-superscript');
            this.button.setAwesome('subscript', 'fa-subscript');
 
            this.button.addCallback(sup, this.scriptbuttons.formatSup);
            this.button.addCallback(sub, this.scriptbuttons.formatSub);
        },
        formatSup: function()
        {
            this.inline.format('sup');
        },
        formatSub: function()
        {
            this.inline.format('sub');
        }
    };
};

if (!RedactorPlugins) var RedactorPlugins = {};
 
RedactorPlugins.bufferbuttons = function()
{
    return {
        init: function()
        {
            var undo = this.button.addFirst('undo', 'Undo');
            var redo = this.button.addAfter('undo', 'redo', 'Redo');
 
            this.button.addCallback(undo, this.buffer.undo);
            this.button.addCallback(redo, this.buffer.redo);
        }
    };
};