# Additional useful buttons for our M.SE editor

Do you hate the guys trying to optimize every single part of a process? I'm one of those. Believe me, it's even harder for me. When I sit next to someone watching him writing something, taking the hand off the keyboard to mark a portion of text with the mouse, make a right-click just to copy&paste... I could explode.

Although, I'm quite fast with our SE editor, there are some things which could be further optimized. One big first step was the Image Uploader. But there is another thing I always liked to have. A fast way to insert links to the online documentation of Wolfram. If you look at the URL style of e.g.

you see, that Plot can be exchanged with most other Mathematica functions and it works, because most of them have a reference page. Now wouldn't it be awesome if we had an additional button on the editor toolbar which when clicked transforms the marked text PlotStyle into PlotStyle? This won't work for all functions but I'm sure, it helps quite a lot.

Another thing is, I'm the theta kind of guy. While I can at least live with the θ guys, I absolutely hate the \[Theta] ones. I think everyone agrees that the last option is the least readable. If there would be another editor button which just replaces the FullForm greek characters of a marked text, I'm sure this would be used very much and would help the readability of the code on our site.

Question: Is there a way to extend the editor on our main site?

• \[FullyAgree] Jul 6 '13 at 0:24
• I honestly think I thought of both of these things independently (who knows) but I lacked the ability or motivation to get this done. Thank you, thank you! Now if we can just get SE to include these in the interface itself. (I've asked, but didn't get far with it.) Jul 7 '13 at 13:51
• The Refbutton could be useful also in comments Jul 12 '13 at 15:44
• Related: MathJax buttons/hotkeys script. Feb 27 '14 at 17:08
• Given that the ASCII character → (&rarr;) does exist, is it feasible to also replace the ugly ->s? Feb 27 '14 at 17:08
• Upgraded to Firefox 31.0 and it stopped working. Perhaps the new "mandatory" @Grant ? Aug 11 '14 at 13:08
• Firefox users (WinX). I've had a problem with the script not working anymore after upgrading to FFv30. Problem solved by re-enabling the FF error console (now disabled by default). Go to about:config and set devtools.errorconsole.enabled to True Oct 7 '14 at 17:04
• I recently updated my installation of this script and the buttons no longer appeared. I also got a new notice that the page was trying to load something from jquery-utils.googlecode.com. Is this a new dependency and is it intentional? Oct 18 '14 at 18:38
• @Mr.Wizard No, this dependency has always been there since the first version. Maybe your browser got more paranoid because I never saw such a message.
– halirutan Mod
Oct 18 '14 at 23:23
• It is pretty paranoid since I run NoScript but it's odd this manifested only after the update. It seems the script is loading https://jquery-utils.googlecode.com/svn-history/r307/trunk/src/jquery.livequery.js. Not that it matters but can that resource be loaded locally (downloaded)? I still haven't bothered to learn "hello world" in JavaScript. Oct 18 '14 at 23:27
• Two small suggestions/request: 1._ When creating a reference link, remove any white space ant the end of the selection. 2._ Allowing the option of using "> " for formatted outputs instead of (* *) comments. Not sure about this one, bu what about also remove Subscript? Oct 14 '15 at 17:23
• @rhermans Your first wish is implemented. If you have Chrome, you should be able to update the script when you have installed it through the official chrome webstore. If you installed it on a different browser, please find the changes on GitHub
– halirutan Mod
Oct 15 '15 at 0:44
• @rhermans Regarding your second point, there are two types of people here. The first type (like me) have a strong opinion that markdown quoting (>) should not be misused the fake an output box. We already have a feature request whether it would be possible the get our own output-style. I don't think this is going to happen and I would like to keep the used output styles as consistent as possible. So user of my original toolbar will be forced to the comment style output. Feel free to change my implementation.
– halirutan Mod
Oct 15 '15 at 0:48

Quick installation for the impatient. Choose your browser below:

Detailed instructions for any browser are below.

I hereby proudly present a browser user-script (userscript) which adds the required functionality to the editor of mathematica.stackexchange.com. This script is the slightly changed version of the Ask Ubuntu Toolbar Buttons which only exists due to the incredible work of Nathan Osman.

Additionally, I added a button which is maybe rarely used, but when it is used, it saves a lot of tedious html-tag typing. With it you can insert shortcuts easily. Just click the button and insert the short-keys separated by space. Therefore, when you type Ctrl C in the dialog you get Ctrl+C.

# Installation

## Chrome

Additionally, the script can be found on GitHub where you can have a look at the code or download it. To install it, please use this direct link to

and install it into your browser. I have tested the script in Linux and Mac OSX.

In Chrome you install it by storing the file m_toolbar.user.js locally onto your hard-drive. Then you go in Chrome to Menu->Tools->Extensions and drag&drop the file there. After a reload of the SE page, the buttons should appear.

## Safari

In Safari (I tried OSX 10.6 and 10.8) one easy way is to use NinjaKit, which is an extension that lets you install user scripts.

First, download the file NinjaKit.safariextz and install it by double-click. After that you should see a ninja-star-like button in Safari

where you can manage your user scripts.

Safari 13: The following workaround using "Extension Builder" does not work anymore.

MacOS 10.14: Extensions such as NinjaKit are depreciated as of MacOS 10.14. Use the workaround detailed here to get around this problem. You may need to re-enable NinjaKit every time you restart Safari using the Safari menu Develop > Show Extension Builder.

Second, click on the link to m_toolbar.user.js. You should see a pop-up like this

A click on Install finishes everything up. Another click on the ninja star button shows you now the installed Mathematica script

If clicking on the above link to m_toolbar.user.js doesn't work, try the following:

2. Click the NinjaKit button then NinjaKit's "Add new script" button.
3. Copy the downloaded m_toolbar.user.jsand paste it into the "Add new script" window, overwriting the skeleton script that's already there.
4. Click the Save button at the very bottom of the window. (The name of the script embedded in the copied .js will automatically be used for the name.)

# Update:

### 8. July 2013

• Issue concerning Canceled dialog-boxes and empty input fixed
• Updated tool-tips for a better English. Thanks to m_goldberg for the help.

### 23. October 2013

• The dependent jquery.livequery.js is now loaded from googlecode
• Introduced another button for the stripping of In[3]:= and Out[3]= marks. For this you have to select the complete codeblock where the I of In is the first letter in the selection. Pressing the button removes the marks and comments out the output.
• Added \[Element] to the list of replaced glyphs
• Buttons-style is now more consistent with the webpage.

### 28. October 2013

• ssch extended the In[]/Out[] cell label remover to work with several in- and outputs. Additionally, it can handle all kinds of Forms (like FullForm or Short)
• I moved the code into an official repository which is linked under the section Installation above.

### 21. April 2015

• Using Safari on OS X, clicking on the link given in the installation section referred to in the 28 October update notice, I only get a listing of the script. No popup menu. What should I do? Oct 28 '13 at 23:58
• @m_goldberg You have to use the direct link which is given as bullet point. Try this here: direct link
– halirutan Mod
Oct 29 '13 at 2:48
• I did use the direct link. Problem turned out to be that I had Block pop-up windows checked in Safari > Preferences > Security. Oct 29 '13 at 8:28
• This is so cool!.. We should have an advertise for that! I discovered just now. Jan 26 '14 at 11:36
• Fantastic add-on but I'm having problems getting it to work. (Windows 7 64 bit) Tried Firefox (via Greasemonkey) 1st & then Chrome. Symptoms: buttons don't appear. Using InspectElement it looks as though the script is running (I can see injected elements). I found that if I removed "position: absolute;" from .wmd-button the buttons did appear. (NB greasemonkey also says something about @grant not being specified). I have lots of greek chars in my code and don't want to abuse mod format assistance. Don't know why I can't run it like others :( Mar 19 '14 at 16:05
• My last edit is just a keyword: I can never find this by searching for "userscript". Now it will be possible. Jun 7 '14 at 18:28
• Any plans on getting this into chrome store - as of today, it is disabled and cannot be re-enabled, nor can the drag-crx trick be used since it's not a package. I'd rather not switch from Chrome, or have to use a developer version of Chrome to use this very useful browser add-on...
– ciao
Jun 10 '14 at 6:42
• How that the Programming Cloud is launched and v10 is imminent, can you switch over the Ref button to use http://reference.wolfram.com/language/ as the base URL? Jun 24 '14 at 0:53
• It doesn't work over HTTPS, but that should be an easy fix. I'll post an issue on Github as well. Jul 15 '14 at 10:14
• I suggest adding \[LeftCeiling] \[RightCeiling] \[LeftFloor] \[RightFloor] to the conversion rules. I find these generally useful. Aug 8 '14 at 19:13
• The installation instructions seem to be broken for newer versions of Chrome. I can get it through Tampermonkey but directly clicking on it fails and I get sent to this page. Feb 26 '15 at 17:59
• @Mr.Wizard I have fixed the script and a new version is available in the Chrome Store. I will push the changes to the GitHub repo in a second.
– halirutan Mod
May 12 '16 at 14:23
• The direct link to install the NinjaKit extension for Safari seems broken. I found an old copy I had and put it on my website at (preston.kbs.msu.edu/NinjaKit.safariextz). Feb 4 '17 at 21:51
• Never mind, figured it out (not at all obvious): Click the NinjaKit button, click the Scripts tab, click the "Add new script" button, copy the .js and paste it into the window, overwriting the skeleton script that's already there, and finally click the Save button at the very bottom of the page. What wasn't clear was to copy-paste rather than drop the file into the window, and that the Save button at the bottom was an action on the script, not an action to add to the script. Dec 10 '17 at 18:21
• This is the best thing happened to me today. thanks a lot @halirutan Jul 16 '19 at 7:28

Important note: The Additional Editor Buttons Toolbar can directly be installed through the Chrome Webstore and the workaround below is not necessary any more:

## Workaround for Windows users with the Chrome browser

A recent update to Chrome on Windows disables extensions which do not come from the Chrome Web Store, with no simple way to re-enable them. There are various workarounds here. I have used the "import the unpacked user-script in developer mode" solution, which is working fine though you do have to cancel a "disable developer scripts" dialog every time Chrome starts.

For simplicity here are specific instructions for halirutan's script:

• Create a new folder and move the m_toolbar.user.js file into it.
• Create a new file called manifest.json in the folder with the following contents:

.

{
"manifest_version": 2,
"name": "m_toolbar",
"version": "1.0",

"content_scripts": [
{
"matches": ["http://*.mathematica.stackexchange.com/*"],
"js": ["m_toolbar.user.js"]
}
]
}

• Open the extensions page in Chrome (menu-tools-extensions or navigate to chrome://extensions/).
• Check the "Developer mode" option at the top right.
• Click the "Load unpacked extension..." button and select the folder you created.

That should be it, after reloading mathematica.stackexchange the buttons will be back.

Update extension from the author.

Mathematica Editor-buttons for StackExchange

• Thanks for pointing that out. I added it now to my developer account as well and provided descriptions, screenshots and an icon. Find it here. Do you know what has to be done so that this can be found through the search in the Chrome Web Store? Is the rating important?
– halirutan Mod
Apr 20 '15 at 22:51
• I installed the extension from google store but it does not provide the buttons, only the key button on the left. Any idea what is wrong? Apr 24 '15 at 19:32
• @leosenko and what OS and Chrome version? Apr 24 '15 at 19:33
• @m0nhawk Chrome 42.0.2311.90 32 bit, on Windows 7 x64 Apr 24 '15 at 19:43