not really known
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

0 lines
17 KiB

  1. /*! p5.js v0.5.8 March 25, 2017 */ !function(a,b){"function"==typeof define&&define.amd?define("p5.dom",["p5"],function(a){b(a)}):b("object"==typeof exports?require("../p5"):a.p5)}(this,function(a){function b(b){var c=document;return"string"==typeof b&&"#"===b[0]?(b=b.slice(1),c=document.getElementById(b)||document):b instanceof a.Element?c=b.elt:b instanceof HTMLElement&&(c=b),c}function c(b){if("INPUT"===b.tagName&&"checkbox"===b.type){var c=new a.Element(b);return c.checked=function(){return 0===arguments.length?this.elt.checked:(arguments[0]?this.elt.checked=!0:this.elt.checked=!1,this)},c}return"VIDEO"===b.tagName||"AUDIO"===b.tagName?new a.MediaElement(b):new a.Element(b)}function d(b,c,d){(c._userNode?c._userNode:document.body).appendChild(b);var e=d?new a.MediaElement(b):new a.Element(b);return c._elements.push(e),e}function e(a,b,c,e){var f=document.createElement(b),c=c||"";"string"==typeof c&&(c=[c]);for(var g=0;g<c.length;g++){var h=document.createElement("source");h.src=c[g],f.appendChild(h)}if(void 0!==e){var i=function(){e(),f.removeEventListener("canplaythrough",i)};f.addEventListener("canplaythrough",i)}var j=d(f,a,!0);return j.loadedmetadata=!1,f.addEventListener("loadedmetadata",function(){j.width=f.videoWidth,j.height=f.videoHeight,0===j.elt.width&&(j.elt.width=f.videoWidth),0===j.elt.height&&(j.elt.height=f.videoHeight),j.loadedmetadata=!0}),j}a.prototype.select=function(a,d){var e=null,f=b(d);return"."===a[0]?(a=a.slice(1),e=f.getElementsByClassName(a),e=e.length?e[0]:null):"#"===a[0]?(a=a.slice(1),e=f.getElementById(a)):(e=f.getElementsByTagName(a),e=e.length?e[0]:null),e?c(e):null},a.prototype.selectAll=function(a,d){var e,f=[],g=b(d);if("."===a[0]?(a=a.slice(1),e=g.getElementsByClassName(a)):e=g.getElementsByTagName(a),e)for(var h=0;h<e.length;h++){var i=c(e[h]);f.push(i)}return f},a.prototype.removeElements=function(a){for(var b=0;b<this._elements.length;b++)this._elements[b].elt instanceof HTMLCanvasElement||this._elements[b].remove()},["div","p","span"].forEach(function(b){var c="create"+b.charAt(0).toUpperCase()+b.slice(1);a.prototype[c]=function(a){var c=document.createElement(b);return c.innerHTML=void 0===typeof a?"":a,d(c,this)}}),a.prototype.createImg=function(){var a,b=document.createElement("img"),c=arguments,e=function(){a.width=b.offsetWidth||b.width,a.height=b.offsetHeight||b.height,c.length>1&&"function"==typeof c[1]?(a.fn=c[1],a.fn()):c.length>1&&"function"==typeof c[2]&&(a.fn=c[2],a.fn())};return b.src=c[0],c.length>1&&"string"==typeof c[1]&&(b.alt=c[1]),b.onload=function(){e()},a=d(b,this)},a.prototype.createA=function(a,b,c){var e=document.createElement("a");return e.href=a,e.innerHTML=b,c&&(e.target=c),d(e,this)},a.prototype.createSlider=function(a,b,c,e){var f=document.createElement("input");return f.type="range",f.min=a,f.max=b,0===e?f.step=1e-18:e&&(f.step=e),"number"==typeof c&&(f.value=c),d(f,this)},a.prototype.createButton=function(a,b){var c=document.createElement("button");return c.innerHTML=a,c.value=b,b&&(c.value=b),d(c,this)},a.prototype.createCheckbox=function(){var a=document.createElement("div"),b=document.createElement("input");b.type="checkbox",a.appendChild(b);var c=d(a,this);if(c.checked=function(){var a=c.elt.getElementsByTagName("input")[0];if(a){if(0===arguments.length)return a.checked;arguments[0]?a.checked=!0:a.checked=!1}return c},this.value=function(a){return c.value=a,this},arguments[0]){var e=Math.random().toString(36).slice(2),f=document.createElement("label");b.setAttribute("id",e),f.htmlFor=e,c.value(arguments[0]),f.appendChild(document.createTextNode(arguments[0])),a.appendChild(f)}return arguments[1]&&(b.checked=!0),c},a.prototype.createSelect=function(a){var b=document.createElement("select");a&&b.setAttribute("multiple","true");var c=d(b,this);return c.option=function(a,c){var d=document.createElement("option");d.innerHTML=a,arguments.length>1?d.value=c:d.value=a,b.appendChild(d)},c.selected=function(b){var c=[];if(arguments.length>0){for(var d=0;d<this.elt.length;d++)b.toString()===this.elt[d].value&&(this.elt.selectedIndex=d);return this}if(