Warn user if MathJax can't be fetched from notebook closes #744 #868

Merged
merged 3 commits into from Oct 15, 2011

Conversation

Projects
None yet
3 participants
@Carreau
Member

Carreau commented Oct 13, 2011

just put this in notebook.html

There was an issues trying to fetch MathJax.js from the internet. You might
wan't to consider using "install_mathjax()" to be able to use the Notebook
fonctionnality offline

And hide it at <body>'s onload if window.mathjax found.

@@ -49,6 +56,12 @@
<span id="kernel_status">Idle</span>
</div>
+<div id="MatjaxFetchingWarning">
+ There was an issues trying to fetch MathJax.js from the internet. You might

This comment has been minimized.

@fperez

fperez Oct 14, 2011

Member

typo: issue

@fperez

fperez Oct 14, 2011

Member

typo: issue

@@ -49,6 +56,12 @@
<span id="kernel_status">Idle</span>
</div>
+<div id="MatjaxFetchingWarning">
+ There was an issues trying to fetch MathJax.js from the internet. You might
+ wan't to consider using "install_mathjax()" to be able to use the Notebook

This comment has been minimized.

@fperez

fperez Oct 14, 2011

Member

s/wan't/want/

The instructions should say instead:

You may want to consider running "from IPython.external import mathjax; mathjax.install_mathjax()" in order to be able to use the Notebook. Note that this will require a working internet connection when run, and it will try to install MathJax into the directory where you installed IPython. If you installed IPython to a location that requires administrative privileges to write, you will need to make this call as an administrator. On OSX/Linux/Unix, this can be done at the command-line via 'sudo python -c "from IPython.external import mathjax; mathjax.install_mathjax"'.

This will be much clearer and directly useful.

@fperez

fperez Oct 14, 2011

Member

s/wan't/want/

The instructions should say instead:

You may want to consider running "from IPython.external import mathjax; mathjax.install_mathjax()" in order to be able to use the Notebook. Note that this will require a working internet connection when run, and it will try to install MathJax into the directory where you installed IPython. If you installed IPython to a location that requires administrative privileges to write, you will need to make this call as an administrator. On OSX/Linux/Unix, this can be done at the command-line via 'sudo python -c "from IPython.external import mathjax; mathjax.install_mathjax"'.

This will be much clearer and directly useful.

@@ -12,6 +12,13 @@
<!-- <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML" charset="utf-8"></script> -->
<script type='text/javascript' src='static/mathjax/MathJax.js?config=TeX-AMS_HTML' charset='utf-8'></script>
+ <script language="Javascript">

This comment has been minimized.

@fperez

fperez Oct 14, 2011

Member

shouldn't this be merged with the next script section immediately below, which is also about mathjax anyway?

@fperez

fperez Oct 14, 2011

Member

shouldn't this be merged with the next script section immediately below, which is also about mathjax anyway?

Matjax Warning message improvement.
	merge '<script>' balises.
	Improve message text and style.
	Remove instead of hide
@Carreau

This comment has been minimized.

Show comment
Hide comment
@Carreau

Carreau Oct 14, 2011

Member

Fixed,
with some styling inlined in HTML.
I've also change from hide to removeChild

Member

Carreau commented Oct 14, 2011

Fixed,
with some styling inlined in HTML.
I've also change from hide to removeChild

@@ -12,7 +12,13 @@
<!-- <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML" charset="utf-8"></script> -->
<script type='text/javascript' src='static/mathjax/MathJax.js?config=TeX-AMS_HTML' charset='utf-8'></script>
- <script type="text/javascript">
+ <script language="Javascript">

This comment has been minimized.

@minrk

minrk Oct 14, 2011

Member

As I understand it, language="javascript" is deprecated, and type="text/javascript" is officially the way to declare script type.

@minrk

minrk Oct 14, 2011

Member

As I understand it, language="javascript" is deprecated, and type="text/javascript" is officially the way to declare script type.

This comment has been minimized.

@Carreau

Carreau Oct 14, 2011

Member

I've never done javascript before, so I trust you.

@Carreau

Carreau Oct 14, 2011

Member

I've never done javascript before, so I trust you.

This comment has been minimized.

@minrk

minrk Oct 14, 2011

Member

No worries, I didn't know either, but when I saw the inconsistency I Google'd it. We are pretty much all js novices here.

@minrk

minrk Oct 14, 2011

Member

No worries, I didn't know either, but when I saw the inconsistency I Google'd it. We are pretty much all js novices here.

This comment has been minimized.

@fperez

fperez Oct 14, 2011

Member

On Fri, Oct 14, 2011 at 11:48 AM, Min RK
reply@reply.github.com
wrote:

No worries, I didn't know either, but when I saw the inconsistency I Google'd it.  We are pretty much all js novices here.

Very true. It took me 2hours last night to get CodeMirror to toggle
line-numbers on a per cell basis :) (pull request coming soon after I
clean it up a little).

Question: are we ready to merge this one, or is further cleanup needed?

@fperez

fperez Oct 14, 2011

Member

On Fri, Oct 14, 2011 at 11:48 AM, Min RK
reply@reply.github.com
wrote:

No worries, I didn't know either, but when I saw the inconsistency I Google'd it.  We are pretty much all js novices here.

Very true. It took me 2hours last night to get CodeMirror to toggle
line-numbers on a per cell basis :) (pull request coming soon after I
clean it up a little).

Question: are we ready to merge this one, or is further cleanup needed?

This comment has been minimized.

@Carreau

Carreau Oct 14, 2011

Member

Very true. It took me 2hours last night to get CodeMirror to toggle
line-numbers on a per cell basis :) (pull request coming soon after I
clean it up a little).

I though I was the only one :-)

Question: are we ready to merge this one, or is further cleanup needed?

Might want to test on IE6 ?
Add a message for people with JS not activated ?

@Carreau

Carreau Oct 14, 2011

Member

Very true. It took me 2hours last night to get CodeMirror to toggle
line-numbers on a per cell basis :) (pull request coming soon after I
clean it up a little).

I though I was the only one :-)

Question: are we ready to merge this one, or is further cleanup needed?

Might want to test on IE6 ?
Add a message for people with JS not activated ?

This comment has been minimized.

@fperez

fperez Oct 14, 2011

Member

On Fri, Oct 14, 2011 at 1:16 PM, Bussonnier Matthias
reply@reply.github.com
wrote:

Might want to test on IE6 ?

We don't support IE at all, period. Let alone something as ancient
as IE6. IE has no websocket support, so none of the notebook will
ever work there until they add websockets.

Add a message for people with JS not activated ?

That, on the other hand, would be good, since pretty much nothing
would work without JS. Giving an informative error would be good
usability-wise.

@fperez

fperez Oct 14, 2011

Member

On Fri, Oct 14, 2011 at 1:16 PM, Bussonnier Matthias
reply@reply.github.com
wrote:

Might want to test on IE6 ?

We don't support IE at all, period. Let alone something as ancient
as IE6. IE has no websocket support, so none of the notebook will
ever work there until they add websockets.

Add a message for people with JS not activated ?

That, on the other hand, would be good, since pretty much nothing
would work without JS. Giving an informative error would be good
usability-wise.

This comment has been minimized.

@Carreau

Carreau Oct 14, 2011

Member

IE was a joke of course.
I have no idea how to add a message that will be visible only to browser without JS, without having it "poping up" for a few millisecond for user having JS...

@Carreau

Carreau Oct 14, 2011

Member

IE was a joke of course.
I have no idea how to add a message that will be visible only to browser without JS, without having it "poping up" for a few millisecond for user having JS...

This comment has been minimized.

@minrk

minrk Oct 14, 2011

Member

Note that you can't even get to the notebook page without js, since our whole UI (including the frontpage) is jQuery.

A single line of plaintext 'IPython notebook requires javascript' shouldn't be bothersome. I don't think there's any need for more information than that these days.

@minrk

minrk Oct 14, 2011

Member

Note that you can't even get to the notebook page without js, since our whole UI (including the frontpage) is jQuery.

A single line of plaintext 'IPython notebook requires javascript' shouldn't be bothersome. I don't think there's any need for more information than that these days.

This comment has been minimized.

@minrk

minrk Oct 14, 2011

Member

Also a reason our pre-load warning messages may linger longer than others is that MathJax is huge, so loading up a notebook page can take a significant fraction of a second.

@minrk

minrk Oct 14, 2011

Member

Also a reason our pre-load warning messages may linger longer than others is that MathJax is huge, so loading up a notebook page can take a significant fraction of a second.

@minrk

This comment has been minimized.

Show comment
Hide comment
@minrk

minrk Oct 14, 2011

Member

This looks good, but as it is, you can see the MathJax warning briefly on every notebook load. We should only draw the warning when the MathJax test fails, so initially it should have display:none, and add to the check:

    function CheckMathJax(){
        var div=document.getElementById("MatjaxFetchingWarning");
        if(window.MathJax){
            document.body.removeChild(div);
        }else{
            div.style.display = "block";
        }
    }
Member

minrk commented Oct 14, 2011

This looks good, but as it is, you can see the MathJax warning briefly on every notebook load. We should only draw the warning when the MathJax test fails, so initially it should have display:none, and add to the check:

    function CheckMathJax(){
        var div=document.getElementById("MatjaxFetchingWarning");
        if(window.MathJax){
            document.body.removeChild(div);
        }else{
            div.style.display = "block";
        }
    }
@Carreau

This comment has been minimized.

Show comment
Hide comment
@Carreau

Carreau Oct 14, 2011

Member

True, I was still thinking as if it would be executed after mathjax.js was loaded... and that the 'else' would then never be executed

Member

Carreau commented Oct 14, 2011

True, I was still thinking as if it would be executed after mathjax.js was loaded... and that the 'else' would then never be executed

@fperez fperez merged commit 7a1207e into ipython:master Oct 15, 2011

@fperez

This comment has been minimized.

Show comment
Hide comment
@fperez

fperez Oct 15, 2011

Member

Thanks a lot for the work! Made some minor edits to the message before pushing.

Member

fperez commented Oct 15, 2011

Thanks a lot for the work! Made some minor edits to the message before pushing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment