-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmain.js
52 lines (48 loc) · 1.59 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright (c) IPython-Contrib Team.
// Distributed under the terms of the Modified BSD License.
define([
'base/js/namespace',
'jquery',
'require',
'notebook/js/textcell',
'base/js/utils',
'services/config'
], function(IPython, $, require, textcell, utils, configmod) {
"use strict";
var rerender_on_reset = true;
var base_url = utils.get_body_data("baseUrl");
var config = new configmod.ConfigSection('notebook', {base_url: base_url});
/**
* Get option from config
*/
config.loaded.then(function() {
if (config.data.hasOwnProperty('equation_numbering_rerender') ) {
if (typeof(config.data.equation_numbering_rerender) === "boolean") {
rerender_on_reset = config.data.equation_numbering_rerender;
}
}
});
var load_ipython_extension = function() {
IPython.toolbar.add_buttons_group([
{
id: 'reset_numbering',
label: 'Reset equation numbering',
icon: 'fa-sort-numeric-asc',
callback: function () {
MathJax.Extension['TeX/AMSmath'].startNumber = 0;
if (rerender_on_reset === true) {
MathJax.Hub.Queue(["Reprocess", MathJax.Hub]);
}
$('#reset_numbering').blur();
}
}
]);
MathJax.Hub.Config({
TeX: { equationNumbers: { autoNumber: "AMS" } }
});
config.load();
};
return {
load_ipython_extension : load_ipython_extension
};
});