From f1998c321a4eec6d75b58d84aa8610971bf21979 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Sat, 31 Jul 2021 11:35:39 -0600 Subject: move static files into static sub-dir, refactor nix a bit --- src/assets/viz/1/processing.js | 21796 --------------------------------------- 1 file changed, 21796 deletions(-) delete mode 100644 src/assets/viz/1/processing.js (limited to 'src/assets/viz/1/processing.js') diff --git a/src/assets/viz/1/processing.js b/src/assets/viz/1/processing.js deleted file mode 100644 index 7cfb7a8..0000000 --- a/src/assets/viz/1/processing.js +++ /dev/null @@ -1,21796 +0,0 @@ -(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o'); - e.print.apply(e, args); - if (e.BufferArray.length > e.BufferMax) { - e.BufferArray.splice(0, 1); - } else { - e.javaconsole.scrollTop = e.javaconsole.scrollHeight; - } - }; - - e.showconsole = function () { e.wrapper.classList.remove("hidden"); }; - e.hideconsole = function () { e.wrapper.classList.add("hidden"); }; - - e.closer.onclick = function () { e.hideconsole(); }; - - e.hideconsole(); - - return e; -}; - -},{}],6:[function(require,module,exports){ -/** - * Processing.js default scope - */ -module.exports = function(options) { - - // Building defaultScope. Changing of the prototype protects - // internal Processing code from the changes in defaultScope - function DefaultScope() {} - DefaultScope.prototype = options.PConstants; - - var defaultScope = new DefaultScope(); - - // copy over all known Object types and helper objects - Object.keys(options).forEach(function(prop) { - defaultScope[prop] = options[prop]; - }); - - //////////////////////////////////////////////////////////////////////////// - // Class inheritance helper methods - //////////////////////////////////////////////////////////////////////////// - - defaultScope.defineProperty = function(obj, name, desc) { - if("defineProperty" in Object) { - Object.defineProperty(obj, name, desc); - } else { - if (desc.hasOwnProperty("get")) { - obj.__defineGetter__(name, desc.get); - } - if (desc.hasOwnProperty("set")) { - obj.__defineSetter__(name, desc.set); - } - } - }; - - /** - * class overloading, part 1 - */ - function overloadBaseClassFunction(object, name, basefn) { - if (!object.hasOwnProperty(name) || typeof object[name] !== 'function') { - // object method is not a function or just inherited from Object.prototype - object[name] = basefn; - return; - } - var fn = object[name]; - if ("$overloads" in fn) { - // the object method already overloaded (see defaultScope.addMethod) - // let's just change a fallback method - fn.$defaultOverload = basefn; - return; - } - if (!("$overloads" in basefn) && fn.length === basefn.length) { - // special case when we just overriding the method - return; - } - var overloads, defaultOverload; - if ("$overloads" in basefn) { - // let's inherit base class overloads to speed up things - overloads = basefn.$overloads.slice(0); - overloads[fn.length] = fn; - defaultOverload = basefn.$defaultOverload; - } else { - overloads = []; - overloads[basefn.length] = basefn; - overloads[fn.length] = fn; - defaultOverload = fn; - } - var hubfn = function() { - var fn = hubfn.$overloads[arguments.length] || - ("$methodArgsIndex" in hubfn && arguments.length > hubfn.$methodArgsIndex ? - hubfn.$overloads[hubfn.$methodArgsIndex] : null) || - hubfn.$defaultOverload; - return fn.apply(this, arguments); - }; - hubfn.$overloads = overloads; - if ("$methodArgsIndex" in basefn) { - hubfn.$methodArgsIndex = basefn.$methodArgsIndex; - } - hubfn.$defaultOverload = defaultOverload; - hubfn.name = name; - object[name] = hubfn; - } - - /** - * class overloading, part 2 - */ - - function extendClass(subClass, baseClass) { - function extendGetterSetter(propertyName) { - defaultScope.defineProperty(subClass, propertyName, { - get: function() { - return baseClass[propertyName]; - }, - set: function(v) { - baseClass[propertyName]=v; - }, - enumerable: true - }); - } - - var properties = []; - for (var propertyName in baseClass) { - if (typeof baseClass[propertyName] === 'function') { - overloadBaseClassFunction(subClass, propertyName, baseClass[propertyName]); - } else if(propertyName.charAt(0) !== "$" && !(propertyName in subClass)) { - // Delaying the properties extension due to the IE9 bug (see #918). - properties.push(propertyName); - } - } - while (properties.length > 0) { - extendGetterSetter(properties.shift()); - } - - subClass.$super = baseClass; - } - - /** - * class overloading, part 3 - */ - defaultScope.extendClassChain = function(base) { - var path = [base]; - for (var self = base.$upcast; self; self = self.$upcast) { - extendClass(self, base); - path.push(self); - base = self; - } - while (path.length > 0) { - path.pop().$self=base; - } - }; - - // static - defaultScope.extendStaticMembers = function(derived, base) { - extendClass(derived, base); - }; - - // interface - defaultScope.extendInterfaceMembers = function(derived, base) { - extendClass(derived, base); - }; - - /** - * Java methods and JavaScript functions differ enough that - * we need a special function to make sure it all links up - * as classical hierarchical class chains. - */ - defaultScope.addMethod = function(object, name, fn, hasMethodArgs) { - var existingfn = object[name]; - if (existingfn || hasMethodArgs) { - var args = fn.length; - // builds the overload methods table - if ("$overloads" in existingfn) { - existingfn.$overloads[args] = fn; - } else { - var hubfn = function() { - var fn = hubfn.$overloads[arguments.length] || - ("$methodArgsIndex" in hubfn && arguments.length > hubfn.$methodArgsIndex ? - hubfn.$overloads[hubfn.$methodArgsIndex] : null) || - hubfn.$defaultOverload; - return fn.apply(this, arguments); - }; - var overloads = []; - if (existingfn) { - overloads[existingfn.length] = existingfn; - } - overloads[args] = fn; - hubfn.$overloads = overloads; - hubfn.$defaultOverload = existingfn || fn; - if (hasMethodArgs) { - hubfn.$methodArgsIndex = args; - } - hubfn.name = name; - object[name] = hubfn; - } - } else { - object[name] = fn; - } - }; - - // internal helper function - function isNumericalJavaType(type) { - if (typeof type !== "string") { - return false; - } - return ["byte", "int", "char", "color", "float", "long", "double"].indexOf(type) !== -1; - } - - /** - * Java's arrays are pre-filled when declared with - * an initial size, but no content. JS arrays are not. - */ - defaultScope.createJavaArray = function(type, bounds) { - var result = null, - defaultValue = null; - if (typeof type === "string") { - if (type === "boolean") { - defaultValue = false; - } else if (isNumericalJavaType(type)) { - defaultValue = 0; - } - } - if (typeof bounds[0] === 'number') { - var itemsCount = 0 | bounds[0]; - if (bounds.length <= 1) { - result = []; - result.length = itemsCount; - for (var i = 0; i < itemsCount; ++i) { - result[i] = defaultValue; - } - } else { - result = []; - var newBounds = bounds.slice(1); - for (var j = 0; j < itemsCount; ++j) { - result.push(defaultScope.createJavaArray(type, newBounds)); - } - } - } - return result; - }; - - // screenWidth and screenHeight are shared by all instances. - // and return the width/height of the browser's viewport. - defaultScope.defineProperty(defaultScope, 'screenWidth', - { get: function() { return window.innerWidth; } }); - - defaultScope.defineProperty(defaultScope, 'screenHeight', - { get: function() { return window.innerHeight; } }); - - return defaultScope; -}; - -},{}],7:[function(require,module,exports){ -/** - * Finalise the Processing.js object. - */ -module.exports = function finalizeProcessing(Processing, options) { - - // unpack options - var window = options.window, - document = options.document, - XMLHttpRequest = window.XMLHttpRequest, - noop = options.noop, - isDOMPresent = options.isDOMPresent, - version = options.version, - undef; - - // versioning - Processing.version = (version ? version : "@DEV-VERSION@"); - - // Share lib space - Processing.lib = {}; - - /** - * External libraries can be added to the global Processing - * objects with the `registerLibrary` function. - */ - Processing.registerLibrary = function(name, library) { - Processing.lib[name] = library; - if(library.hasOwnProperty("init")) { - library.init(defaultScope); - } - }; - - /** - * This is the object that acts as our version of PApplet. - * This can be called as Processing.Sketch() or as - * Processing.Sketch(function) in which case the function - * must be an already-compiled-to-JS sketch function. - */ - Processing.Sketch = function(attachFunction) { - this.attachFunction = attachFunction; - this.options = { - pauseOnBlur: false, - globalKeyEvents: false - }; - - /* Optional Sketch event hooks: - * onLoad - parsing/preloading is done, before sketch starts - * onSetup - setup() has been called, before first draw() - * onPause - noLoop() has been called, pausing draw loop - * onLoop - loop() has been called, resuming draw loop - * onFrameStart - draw() loop about to begin - * onFrameEnd - draw() loop finished - * onExit - exit() done being called - */ - this.onLoad = noop; - this.onSetup = noop; - this.onPause = noop; - this.onLoop = noop; - this.onFrameStart = noop; - this.onFrameEnd = noop; - this.onExit = noop; - - this.params = {}; - this.imageCache = { - pending: 0, - images: {}, - // Opera requires special administration for preloading - operaCache: {}, - // Specify an optional img arg if the image is already loaded in the DOM, - // otherwise href will get loaded. - add: function(href, img) { - // Prevent muliple loads for an image, in case it gets - // preloaded more than once, or is added via JS and then preloaded. - if (this.images[href]) { - return; - } - - if (!isDOMPresent) { - this.images[href] = null; - } - - // No image in the DOM, kick-off a background load - if (!img) { - img = new Image(); - img.onload = (function(owner) { - return function() { - owner.pending--; - }; - }(this)); - this.pending++; - img.src = href; - } - - this.images[href] = img; - - // Opera will not load images until they are inserted into the DOM. - if (window.opera) { - var div = document.createElement("div"); - div.appendChild(img); - // we can't use "display: none", since that makes it invisible, and thus not load - div.style.position = "absolute"; - div.style.opacity = 0; - div.style.width = "1px"; - div.style.height= "1px"; - if (!this.operaCache[href]) { - document.body.appendChild(div); - this.operaCache[href] = div; - } - } - } - }; - - this.sourceCode = undefined; - this.attach = function(processing) { - // either attachFunction or sourceCode must be present on attach - if(typeof this.attachFunction === "function") { - this.attachFunction(processing); - } else if(this.sourceCode) { - var func = ((new Function("return (" + this.sourceCode + ");"))()); - func(processing); - this.attachFunction = func; - } else { - throw "Unable to attach sketch to the processing instance"; - } - }; - - this.toString = function() { - var i; - var code = "((function(Sketch) {\n"; - code += "var sketch = new Sketch(\n" + this.sourceCode + ");\n"; - for(i in this.options) { - if(this.options.hasOwnProperty(i)) { - var value = this.options[i]; - code += "sketch.options." + i + " = " + - (typeof value === 'string' ? '\"' + value + '\"' : "" + value) + ";\n"; - } - } - for(i in this.imageCache) { - if(this.options.hasOwnProperty(i)) { - code += "sketch.imageCache.add(\"" + i + "\");\n"; - } - } - // TODO serialize fonts - code += "return sketch;\n})(Processing.Sketch))"; - return code; - }; - }; - - /** - * aggregate all source code into a single file, then rewrite that - * source and bind to canvas via new Processing(canvas, sourcestring). - * @param {CANVAS} canvas The html canvas element to bind to - * @param {String[]} source The array of files that must be loaded - * @param {Function} onComplete A callback, called with the sketch as the argument. - */ - var loadSketchFromSources = Processing.loadSketchFromSources = function(canvas, sources, onComplete) { - var code = [], errors = [], sourcesCount = sources.length, loaded = 0; - - function ajaxAsync(url, callback) { - var xhr = new XMLHttpRequest(); - xhr.onreadystatechange = function() { - if (xhr.readyState === 4) { - var error; - if (xhr.status !== 200 && xhr.status !== 0) { - error = "Invalid XHR status " + xhr.status; - } else if (xhr.responseText === "") { - // Give a hint when loading fails due to same-origin issues on file:/// urls - if ( ("withCredentials" in new XMLHttpRequest()) && - (new XMLHttpRequest()).withCredentials === false && - window.location.protocol === "file:" ) { - error = "XMLHttpRequest failure, possibly due to a same-origin policy violation. You can try loading this page in another browser, or load it from http://localhost using a local webserver. See the Processing.js README for a more detailed explanation of this problem and solutions."; - } else { - error = "File is empty."; - } - } - - callback(xhr.responseText, error); - } - }; - xhr.open("GET", url, true); - if (xhr.overrideMimeType) { - xhr.overrideMimeType("application/json"); - } - xhr.setRequestHeader("If-Modified-Since", "Fri, 01 Jan 1960 00:00:00 GMT"); // no cache - xhr.send(null); - } - - function loadBlock(index, filename) { - function callback(block, error) { - code[index] = block; - ++loaded; - if (error) { - errors.push(filename + " ==> " + error); - } - if (loaded === sourcesCount) { - if (errors.length === 0) { - // This used to throw, but it was constantly getting in the way of debugging where things go wrong! - var sketch = new Processing(canvas, code.join("\n")); - if (onComplete) { - onComplete(sketch); - } - } else { - throw "Processing.js: Unable to load pjs sketch files: " + errors.join("\n"); - } - } - } - if (filename.charAt(0) === '#') { - // trying to get script from the element - var scriptElement = document.getElementById(filename.substring(1)); - if (scriptElement) { - callback(scriptElement.text || scriptElement.textContent); - } else { - callback("", "Unable to load pjs sketch: element with id \'" + filename.substring(1) + "\' was not found"); - } - return; - } - - ajaxAsync(filename, callback); - } - - for (var i = 0; i < sourcesCount; ++i) { - loadBlock(i, sources[i]); - } - }; - - /** - * Automatic initialization function. - */ - var init = function() { - document.removeEventListener('DOMContentLoaded', init, false); - var i; - - // before running through init, clear the instances list, to prevent - // sketch duplication when page content is dynamically swapped without - // swapping out processing.js - while (Processing.instances.length > 0) { - for (i = Processing.instances.length - 1; i >= 0; i--) { - if (Processing.instances[i]) { - Processing.instances[i].exit(); - } - } - } - - var canvas = document.getElementsByTagName('canvas'), - filenames; - - for (i = 0, l = canvas.length; i < l; i++) { - // datasrc and data-src are deprecated. - var processingSources = canvas[i].getAttribute('data-processing-sources'); - if (processingSources === null) { - // Temporary fallback for datasrc and data-src - processingSources = canvas[i].getAttribute('data-src'); - if (processingSources === null) { - processingSources = canvas[i].getAttribute('datasrc'); - } - } - if (processingSources) { - filenames = processingSources.split(/\s+/g); - for (var j = 0; j < filenames.length;) { - if (filenames[j]) { - j++; - } else { - filenames.splice(j, 1); - } - } - loadSketchFromSources(canvas[i], filenames); - } - } - - // also process all