98

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.

http://reference.wolfram.com/mathematica/ref/Plot.html

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?

13
  • 45
    \[FullyAgree] Commented Jul 6, 2013 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.)
    – Mr.Wizard
    Commented Jul 7, 2013 at 13:51
  • 1
    The Refbutton could be useful also in comments Commented Jul 12, 2013 at 15:44
  • Related: MathJax buttons/hotkeys script. Commented Feb 27, 2014 at 17:08
  • Given that the ASCII character → (→) does exist, is it feasible to also replace the ugly ->s? Commented Feb 27, 2014 at 17:08
  • Upgraded to Firefox 31.0 and it stopped working. Perhaps the new "mandatory" @Grant ? Commented Aug 11, 2014 at 13:08
  • 1
    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 Commented Oct 7, 2014 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?
    – Mr.Wizard
    Commented Oct 18, 2014 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
    Commented Oct 18, 2014 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.
    – Mr.Wizard
    Commented Oct 18, 2014 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?
    – rhermans
    Commented Oct 14, 2015 at 17:23
  • 1
    @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
    Commented Oct 15, 2015 at 0:44
  • 1
    @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
    Commented Oct 15, 2015 at 0:48

3 Answers 3

126

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.

enter image description here

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.

animation

Installation

Chrome

Chrome users can download this extension directly in the Google Chrome Webstore.

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

safari1

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

popup

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

scripts

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

  1. Download m_toolbar.user.js](https://github.com/halirutan/SE-Editor-Buttons/raw/master/src/m_toolbar.user.js) as a text file.
  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.)

Other browsers

For other browsers please read the existing article on stackapps about how to install user scripts.

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.

27. October 2013


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

28
  • 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?
    – m_goldberg
    Commented Oct 28, 2013 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
    Commented Oct 29, 2013 at 2:48
  • 1
    I did use the direct link. Problem turned out to be that I had Block pop-up windows checked in Safari > Preferences > Security.
    – m_goldberg
    Commented Oct 29, 2013 at 8:28
  • 1
    This is so cool!.. We should have an advertise for that! I discovered just now.
    – Murta
    Commented Jan 26, 2014 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 :( Commented Mar 19, 2014 at 16:05
  • My last edit is just a keyword: I can never find this by searching for "userscript". Now it will be possible.
    – Szabolcs
    Commented Jun 7, 2014 at 18:28
  • 3
    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
    Commented Jun 10, 2014 at 6:42
  • 1
    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?
    – Szabolcs
    Commented Jun 24, 2014 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. Commented Jul 15, 2014 at 10:14
  • 1
    I suggest adding \[LeftCeiling] \[RightCeiling] \[LeftFloor] \[RightFloor] to the conversion rules. I find these generally useful.
    – Mr.Wizard
    Commented Aug 8, 2014 at 19:13
  • 1
    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. Commented Feb 26, 2015 at 17:59
  • 1
    @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
    Commented May 12, 2016 at 14:23
  • 1
    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).
    – Chris K
    Commented Feb 4, 2017 at 21:51
  • 1
    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.
    – murray
    Commented Dec 10, 2017 at 18:21
  • 1
    This is the best thing happened to me today. thanks a lot @halirutan
    – acoustics
    Commented Jul 16, 2019 at 7:28
8

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.

3

Update extension from the author.

Mathematica Editor-buttons for StackExchange

4
  • 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
    Commented Apr 20, 2015 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?
    – atapaka
    Commented Apr 24, 2015 at 19:32
  • @leosenko and what OS and Chrome version?
    – m0nhawk
    Commented Apr 24, 2015 at 19:33
  • @m0nhawk Chrome 42.0.2311.90 32 bit, on Windows 7 x64
    – atapaka
    Commented Apr 24, 2015 at 19:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .