togostanza 2.1.2 → 2.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/togostanza/stanza/base.rb +15 -18
- data/lib/togostanza/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9832851ad481133efaecae7cf4969c861917bde
|
4
|
+
data.tar.gz: 8f415cbbe23ff74fa730dbed91012ee6beaa8788
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acff51cd4ed064a6e8e63d1b77b05be98a04708de1f7aacad904a6274dc20d6b6b5a3fac01c1fe201f824e218ecd0007413a212a36475d9618274687e39b87ad
|
7
|
+
data.tar.gz: be79b5df113831f5ca041d374dec93bb3bc72560c63dfebad625ef95576ffe9c3725685a73610ae7b707e95381187fb1b68c6a29f8e840b2ce4c07f8021ced21
|
@@ -15,7 +15,7 @@ FS.register_helper :download_csv do
|
|
15
15
|
<<-HTML.strip_heredoc.html_safe
|
16
16
|
<script>$(function() {
|
17
17
|
#{init_download_script}
|
18
|
-
$("div#stanza_buttons").append("<a id='download_csv' href='#'><i class='fa fa-file-o'></i> CSV</a>");
|
18
|
+
$("div#stanza_buttons").append("<a id='download_csv' download='stanza.csv' href='#'><i class='fa fa-file-o'></i> CSV</a>");
|
19
19
|
|
20
20
|
var csv = '';
|
21
21
|
var tables = $('body > table');
|
@@ -51,10 +51,9 @@ FS.register_helper :download_csv do
|
|
51
51
|
}
|
52
52
|
}
|
53
53
|
|
54
|
-
|
55
|
-
|
54
|
+
document.querySelector('#download_csv').addEventListener('click', (e) => {
|
55
|
+
e.target.href = 'data:text/plain;charset=UTF-8' + (window.btoa ? ';base64,' + btoa(csv) : ',' + csv);
|
56
56
|
});
|
57
|
-
|
58
57
|
});
|
59
58
|
</script>
|
60
59
|
HTML
|
@@ -66,11 +65,11 @@ FS.register_helper :download_json do
|
|
66
65
|
<<-HTML.strip_heredoc.html_safe
|
67
66
|
<script>$(function() {
|
68
67
|
#{init_download_script}
|
69
|
-
$("div#stanza_buttons").append("<a id='download_json' href='#'><i class='fa fa-file-o'></i> JSON</a>");
|
70
|
-
var json_str = JSON.stringify(#{json},
|
68
|
+
$("div#stanza_buttons").append("<a id='download_json' download='stanza.json' href='#'><i class='fa fa-file-o'></i> JSON</a>");
|
69
|
+
var json_str = JSON.stringify(#{json}, null, '\t');
|
71
70
|
|
72
|
-
|
73
|
-
|
71
|
+
document.querySelector('#download_json').addEventListener('click', (e) => {
|
72
|
+
e.target.href = 'data:application/json;charset=UTF-8' + (window.btoa ? ';base64,' + btoa(json_str) : ',' + json_str);
|
74
73
|
});
|
75
74
|
});
|
76
75
|
</script>
|
@@ -81,9 +80,9 @@ FS.register_helper :download_svg do
|
|
81
80
|
<<-HTML.strip_heredoc.html_safe
|
82
81
|
<script>$(function() {
|
83
82
|
#{init_download_script}
|
84
|
-
$("div#stanza_buttons").append("<a id='download_svg' href='#'><i class='fa fa-file-o'></i> SVG</a>");
|
83
|
+
$("div#stanza_buttons").append("<a id='download_svg' download='stanza.svg' href='#'><i class='fa fa-file-o'></i> SVG</a>");
|
85
84
|
|
86
|
-
|
85
|
+
document.querySelector('#download_svg').addEventListener('click', (e) => {
|
87
86
|
var svg = $("svg");
|
88
87
|
if (svg[0]) {
|
89
88
|
if (!svg.attr("xmlns")) {
|
@@ -94,13 +93,12 @@ FS.register_helper :download_svg do
|
|
94
93
|
}
|
95
94
|
|
96
95
|
var svgText = svg.wrap('<div>').parent().html();
|
97
|
-
|
96
|
+
e.target.href = 'data:image/svg+xml' + (window.btoa ? ';base64,' + btoa(svgText) : ',' + svgText);
|
98
97
|
} else {
|
99
98
|
// TODO...
|
100
99
|
console.log("Can't open svg file");
|
101
100
|
}
|
102
101
|
});
|
103
|
-
|
104
102
|
});
|
105
103
|
</script>
|
106
104
|
HTML
|
@@ -116,30 +114,29 @@ FS.register_helper :download_image do
|
|
116
114
|
|
117
115
|
<script>$(function() {
|
118
116
|
#{init_download_script}
|
119
|
-
$("div#stanza_buttons").append("<a id='download_image' href='#'><i class='fa fa-file-o'></i> IMAGE</a>");
|
117
|
+
$("div#stanza_buttons").append("<a id='download_image' download='stanza.png' href='#'><i class='fa fa-file-o'></i> IMAGE</a>");
|
120
118
|
|
121
119
|
$("body").append("<div style='display: none;'><canvas id='drawarea'></canvas></div>");
|
122
120
|
|
123
|
-
|
121
|
+
document.querySelector('#download_image').addEventListener('click', (e) => {
|
124
122
|
var svg = $("svg");
|
125
123
|
if (svg[0]) {
|
126
124
|
var svgText = svg.wrap('<div>').parent().html();
|
127
|
-
canvg('drawarea', svgText, {
|
125
|
+
canvg('drawarea', svgText, {
|
126
|
+
renderCallback: function() {
|
128
127
|
var canvas = $("#drawarea")[0];
|
129
128
|
|
130
129
|
canvas.toBlob(function(blob) {
|
131
130
|
var blob_url = window.URL.createObjectURL(blob);
|
132
|
-
|
131
|
+
e.target.href = blob_url;
|
133
132
|
}, "image/png");
|
134
133
|
}
|
135
134
|
});
|
136
|
-
|
137
135
|
} else {
|
138
136
|
// TODO...
|
139
137
|
console.log("Can't open image file");
|
140
138
|
}
|
141
139
|
});
|
142
|
-
|
143
140
|
});
|
144
141
|
</script>
|
145
142
|
HTML
|
data/lib/togostanza/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: togostanza
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keita Urashima
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|