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?

share
10  
\[FullyAgree] –  belisarius 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.) –  Mr.Wizard Jul 7 '13 at 13:51
    
The Refbutton could be useful also in comments –  belisarius Jul 12 '13 at 15:44
    
Related: MathJax buttons/hotkeys script. –  episanty Feb 27 at 17:08
    
Given that the ASCII character → (→) does exist, is it feasible to also replace the ugly ->s? –  episanty Feb 27 at 17:08
    
@hali Is there something that could be done for converting Subscript[x_,a___] -> x[a]or similar? There is an increasing number of questions using the dreadful Subscript[] thingie! –  belisarius Mar 4 at 1:22

2 Answers 2

up vote 61 down vote accepted

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

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 with the browsers Chrome and Safari.

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.

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. The usage is straight forward: First you 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. If you now click on the above link to m_toolbar.user.js, you should see a pop-up like this

popup

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

scripts

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.
share
    
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 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 Oct 29 '13 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 Oct 29 '13 at 8:28
    
This is so cool!.. We should have an advertise for that! I discovered just now. –  Murta Jan 26 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 :( –  Julian Moore Mar 19 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 Jun 7 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... –  rasher Jun 10 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? –  Szabolcs Jun 24 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. –  Teake Nutma Jul 15 at 10:14
    
@TeakeNutma I'll fix this. I already saw your issue on GitHub. Thanks for reporting. –  halirutan Jul 15 at 11:38

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.

share

You must log in to answer this question.

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