mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-21 17:34:03 +08:00
2 lines
30 KiB
JavaScript
2 lines
30 KiB
JavaScript
|
/*! wavedrom 2016-07-28 */
|
||
|
!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){"use strict";function d(a,b){function c(a){var b=parseInt(e.style.left,10),d=parseInt(e.style.top,10);(a.x<b||a.x>b+e.offsetWidth||a.y<d||a.y>d+e.offsetHeight)&&(e.parentNode.removeChild(e),document.body.removeEventListener("mousedown",c,!1))}var d,e;d=document.getElementById(b+a),d.childNodes[0].addEventListener("contextmenu",function(f){var g,h,i;e=document.createElement("div"),e.className="wavedromMenu",e.style.top=f.y+"px",e.style.left=f.x+"px",g=document.createElement("ul"),h=document.createElement("li"),h.innerHTML="Save as PNG",g.appendChild(h),i=document.createElement("li"),i.innerHTML="Save as SVG",g.appendChild(i),e.appendChild(g),document.body.appendChild(e),h.addEventListener("click",function(){var f,g,h,i,j,k,l,m;f="",0!==a&&(g=document.getElementById(b+0),f+=g.innerHTML.substring(166,g.innerHTML.indexOf('<g id="waves_0">'))),f=[d.innerHTML.slice(0,166),f,d.innerHTML.slice(166)].join(""),h="data:image/svg+xml;base64,"+btoa(f),i=new Image,i.src=h,j=document.createElement("canvas"),j.width=i.width,j.height=i.height,k=j.getContext("2d"),k.drawImage(i,0,0),l=j.toDataURL("image/png"),m=document.createElement("a"),m.href=l,m.download="wavedrom.png",m.click(),e.parentNode.removeChild(e),document.body.removeEventListener("mousedown",c,!1)},!1),i.addEventListener("click",function(){var f,g,h,i;f="",0!==a&&(g=document.getElementById(b+0),f+=g.innerHTML.substring(166,g.innerHTML.indexOf('<g id="waves_0">'))),f=[d.innerHTML.slice(0,166),f,d.innerHTML.slice(166)].join(""),h="data:image/svg+xml;base64,"+btoa(f),i=document.createElement("a"),i.href=h,i.download="wavedrom.svg",i.click(),e.parentNode.removeChild(e),document.body.removeEventListener("mousedown",c,!1)},!1),e.addEventListener("contextmenu",function(a){a.preventDefault()},!1),document.body.addEventListener("mousedown",c,!1),f.preventDefault()},!1)}b.exports=d},{}],2:[function(a,b,c){"use strict";var d=a("./jsonml-parse");b.exports=d},{"./jsonml-parse":15}],3:[function(a,b,c){"use strict";function d(){f(0,e("InputJSON_0"),"WaveDrom_Display_")}var e=a("./eva"),f=a("./render-wave-form");b.exports=d},{"./eva":4,"./render-wave-form":28}],4:[function(require,module,exports){"use strict";function eva(id){function erra(a){return{signal:[{name:["tspan",["tspan",{class:"error h5"},"Error: "],a.message]}]}}var TheTextBox,source;if(TheTextBox=document.getElementById(id),TheTextBox.type&&"textarea"===TheTextBox.type)try{source=eval("("+TheTextBox.value+")")}catch(a){return erra(a)}else try{source=eval("("+TheTextBox.innerHTML+")")}catch(a){return erra(a)}if("[object Object]"!==Object.prototype.toString.call(source))return erra({message:'[Semantic]: The root has to be an Object: "{signal:[...]}"'});if(source.signal){if("[object Array]"!==Object.prototype.toString.call(source.signal))return erra({message:'[Semantic]: "signal" object has to be an Array "signal:[]"'})}else{if(!source.assign)return erra({message:'[Semantic]: "signal:[...]" or "assign:[...]" property is missing inside the root Object'});if("[object Array]"!==Object.prototype.toString.call(source.assign))return erra({message:'[Semantic]: "assign" object hasto be an Array "assign:[]"'})}return source}module.exports=eva},{}],5:[function(a,b,c){"use strict";function d(a){var b=0,c=0,d=[];return a.forEach(function(a){"vvv-2"===a||"vvv-3"===a||"vvv-4"===a||"vvv-5"===a?c+=1:0!==c&&(d.push(b-(c+1)/2),c=0),b+=1}),0!==c&&d.push(b-(c+1)/2),d}b.exports=d},{}],6:[function(a,b,c){"use strict";function d(a,b,c){var d,e,f=[];if(4===a.length){for(e=0;e<c;e+=1){for(f.push(a[0]),d=0;d<b;d+=1)f.push(a[1]);for(f.push(a[2]),d=0;d<b;d+=1)f.push(a[3])}return f}for(1===a.length&&a.push(a[
|