diff --git a/index.css b/index.css index 2759ecb..fe2b58c 100644 --- a/index.css +++ b/index.css @@ -21,6 +21,20 @@ ul { list-style: none; } +#loading { + background: #fff; + box-shadow: 2px 2px 10px 2px #369; + padding: 1em 1.5em; + border: 0; + color: #369; + font-size: 2em; + min-width: 50%; + text-align: center; +} +#loading span { + display: block; +} + #header > *, #footer > *, #content, diff --git a/index.html b/index.html index ecf2e1c..56c2a51 100644 --- a/index.html +++ b/index.html @@ -128,6 +128,7 @@

NPM package

+

fg-poi

@@ -150,6 +151,9 @@

fg-poi

+ + Loading: +
diff --git a/index.js b/index.js index 4a3f6f7..8c0eab4 100644 --- a/index.js +++ b/index.js @@ -114,6 +114,35 @@ function save(opt) { $('#icon select').val('none'); switch (opt) { case 'none': break; + case 'all': { + var tab = Object.keys(glyphs) + const dload = document.getElementById('loading') + dload.showModal(); + function saveAll() { + var g = tab.pop(); + if (g) { + var glyph = glyphs[g] + dload.querySelector('span').innerText = g; + $.ajax({ + url: './svg/' + + glyph.theme + + '/u' + glyph.code.toString(16).toUpperCase() + + '-' + glyph.name +'.svg', + dataType : 'text', + success: function(rep) { + rep = rep.replace(/fill:#([^;|\"]*)/g, 'fill:' + $('#icon i').css('color')); + var blob = new Blob([rep], {type: "text/plain;charset=utf-8"}); + saveAs(blob, glyph.name + '.svg'); + saveAll() + } + }) + } else { + dload.close() + } + } + saveAll(); + break; + } case 'svg': { console.log('savesvg') $.ajax({