-
Notifications
You must be signed in to change notification settings - Fork 0
/
bundle.js
1 lines (1 loc) · 4.24 KB
/
bundle.js
1
!function(t){var e={};function n(a){if(e[a])return e[a].exports;var r=e[a]={i:a,l:!1,exports:{}};return t[a].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=t,n.c=e,n.d=function(t,e,a){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:a})},n.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=1)}([function(t,e,n){"use strict";var a="http://www.w3.org/2000/svg";e.createKarakasaElement=function(t,e,n,r,i,o){var l,u,s,c=t/2,p=e/2,h=.98*Math.min(c,p),d=n.length*r/Math.PI,g=document.createElementNS(a,"svg");if(g.setAttributeNS(null,"version","1.1"),g.setAttribute("xmlns",a),g.setAttribute("viewBox","0 0 "+t+" "+e),g.setAttribute("width",t.toString()),g.setAttribute("height",e.toString()),i&&i.length>0){(l=document.createElementNS(a,"g")).setAttribute("font-family","serif"),l.setAttribute("font-size",o.toString()),g.appendChild(l);for(var f=(d=Math.max(d,Math.max.apply(null,i.map(function(t,e,n){return t.length}))*o*Math.SQRT1_2))*Math.SQRT2,m=f/i.length,v=0;v<i.length;v++){var b=document.createElementNS(a,"text");b.textContent=i[v],b.setAttribute("x",c.toString()),b.setAttribute("y",(p-f/2+.5*m+m*v).toString()),b.setAttribute("text-anchor","middle"),l.appendChild(b)}}for((l=document.createElementNS(a,"g")).setAttribute("font-size",r.toString()),l.setAttribute("font-family","serif"),g.appendChild(l),v=0;v<n.length;v++){for(var w=document.createElementNS(a,"text"),S=n[v],x=(u=n[v],(s=u.match(/\s/g))?s.length:0),y=(h-d-r*x)/(S.length-x),A=[],$=0,j=p+d;$<S.length;$++)A.push(j.toFixed()),j+=S.charAt($).trim().length>0?y:r;w.textContent=n[v],w.setAttribute("x",c.toString()),w.setAttribute("y",A.join(",")),w.setAttribute("writing-mode","tb"),w.setAttribute("transform","rotate("+360*v/n.length+", "+c+", "+p+")"),l.appendChild(w)}return g}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var a,r=n(0),i=["平手 友梨奈","小池 美波","原田 葵","佐藤 詩織","菅井 友香","斎藤 冬優花","石森 虹花","渡邉 理佐","上村 莉菜","尾関 梨香","織田 奈那","渡辺 梨加","土生 瑞穂","今泉 佑唯","鈴本 美愉","守屋 茜","長濱 ねる","志田 愛佳","長沢 菜々香","小林 由依","米谷 奈々未"],o=["欅坂46","革命、","お待たせ"],l=["西田 健志","西田 健志","西田 健志","西田 健志","西田 健志","西田 健志","西田 健志","西田 健志"],u=["消極性","デザイン","宣言"];function s(t){var e=new Blob([t],{type:"image/svg+xml"});return window.URL.createObjectURL(e)}window.onload=function(){var t=$("#inputNames"),e=$("#inputMessage"),n=$("#inputSize"),c=$("#inputFontSize"),p=$("#inputMessageSize"),h=$("#downloadSVG"),d=$("#downloadPNG"),g=$("#result");t.val(l.join(",")),e.val(u.join());var f=function(){var i=parseInt(n.val()),o=parseInt(c.val()),l=parseInt(p.val()),u=t.val().split(","),f=e.val().split(","),m=r.createKarakasaElement(i,i,u,o,f,l);g.empty().append(m),h.attr("href",s(g.html()));var v=function(t){var e=document.createElement("canvas");return e.width=t.width(),e.height=t.height(),e.hidden=!0,e}(g.find(":only-child")),b=new Image;b.onload=function(){var t=v.getContext("2d");t.fillStyle="white",t.fillRect(0,0,v.width,v.height),t.drawImage(b,0,0),a=v.toDataURL("image/png"),d.attr("href",a)},b.src=s(g.html()),$(".btn").removeClass("disabled")};$("#createSVGButton").click(f),$("input[type='number']").change(f),$("#keyakiButton").click(function(){t.val(i.join(",")),e.val(o.join(",")),n.val(300),c.val(12),p.val(24),f(),$(".keyaki").removeClass("hidden")}),$("#shareButton").click(function(){var t,n,r=$('<span id="loading" class="glyphicon glyphicon-refresh spinning"> </span>');$("#shareButton").prepend(r),a&&(t=a.replace(/^.*,/,""),n=function(t){console.log(t);var n="https://twitter.com/intent/tweet?text="+e.val().replace(/,/g,"")+" "+t+"%0A%23傘連判状ジェネレーター → https://goo.gl/a88chd";window.open(n,"_blank"),r.remove()},$.ajax({url:"https://api.imgur.com/3/image",type:"POST",headers:{Authorization:"Client-ID 07ac50654436ab9",Accept:"application/json"},data:{image:t,type:"base64"},success:function(t){n(t.data.link)}}))}),f()}}]);