summaryrefslogtreecommitdiff
path: root/public/js/extra.js
diff options
context:
space:
mode:
authorWu Cheng-Han2017-02-02 23:27:34 +0800
committerWu Cheng-Han2017-02-02 23:27:34 +0800
commit3df5507589e09b9ec75fb1f8e0c750c6590fc003 (patch)
treeaa878f59eb5e77d689df11225cf6c44dae533e44 /public/js/extra.js
parentf27fc90a7482ab51882d9eb320feaf8b14881ea1 (diff)
Upgrade viz.js to fix manual workaround and get smaller file size
Diffstat (limited to 'public/js/extra.js')
-rw-r--r--public/js/extra.js33
1 files changed, 12 insertions, 21 deletions
diff --git a/public/js/extra.js b/public/js/extra.js
index b651d9e6..b0a4bdcb 100644
--- a/public/js/extra.js
+++ b/public/js/extra.js
@@ -345,30 +345,21 @@ export function finishView(view) {
});
//graphviz
var graphvizs = view.find("div.graphviz.raw").removeClass("raw");
- function parseGraphviz(key, value) {
- var $value = $(value);
- var $ele = $(value).parent().parent();
-
- var graphviz = Viz($value.text());
- if (!graphviz) throw Error('viz.js output empty graph');
- $value.html(graphviz);
-
- $ele.addClass('graphviz');
- $value.children().unwrap().unwrap();
- }
graphvizs.each(function (key, value) {
try {
- parseGraphviz(key, value);
+ var $value = $(value);
+ var $ele = $(value).parent().parent();
+
+ var graphviz = Viz($value.text());
+ if (!graphviz) throw Error('viz.js output empty graph');
+ $value.html(graphviz);
+
+ $ele.addClass('graphviz');
+ $value.children().unwrap().unwrap();
} catch (err) {
- // workaround for graphviz not recover from error
- try {
- parseGraphviz(key, value);
- } catch (err) {
- var $value = $(value);
- $value.unwrap();
- $value.parent().append('<div class="alert alert-warning">' + err + '</div>');
- console.warn(err);
- }
+ $value.unwrap();
+ $value.parent().append('<div class="alert alert-warning">' + err + '</div>');
+ console.warn(err);
}
});
//mermaid