4. Start playing Here we need to make sure the svg dom is ready first, via callback function (see constructor SVGSpace(...))
197916
function ready(bounds, elem) {
  form.scope("item", elem ); // initiate the scope which uses the svg dom as parent node
  space.bindMouse();
  space.play();
}
369238
function initWebGL() {
  gl = null;

  try {
    gl = canvas.getContext("experimental-webgl");
  }
  catch(e) {
    alert(e);
  }

  // If we don't have a GL context, give up now

  if (!gl) {
    alert("Unable to initialize WebGL. Your browser may not support it.");
  }
}
548306
function start() {
      // For dimensions, clearCanvas etc.,
      // we only care about the first element.
      var canvas = elements[0];

      if (canvas.getContext) {
        ngx = Math.ceil(canvas.width / g);
        ngy = Math.ceil(canvas.height / g);
      } else {
        var rect = canvas.getBoundingClientRect();
        ngx = Math.ceil(rect.width / g);
        ngy = Math.ceil(rect.height / g);
      }

      // Sending a wordcloudstart event which cause the previous loop to stop.
      // Do nothing if the event is canceled.
      if (!sendEvent('wordcloudstart', true)) {
        return;
      }

      // Determine the center of the word cloud
      center = (settings.origin) ?
        [settings.origin[0]/g, settings.origin[1]/g] :
        [ngx / 2, ngy / 2];

      // Maxium radius to look for space
      maxRadius = Math.floor(Math.sqrt(ngx * ngx + ngy * ngy));

      /* Clear the canvas only if the clearCanvas is set,
         if not, update the grid to the current canvas state */
      grid = [];

      var gx, gy, i;
      if (!canvas.getContext || settings.clearCanvas) {
        elements.forEach(function(el) {
          if (el.getContext) {
            var ctx = el.getContext('2d');
            ctx.fillStyle = settings.backgroundColor;
            ctx.clearRect(0, 0, ngx * (g + 1), ngy * (g + 1));
            ctx.fillRect(0, 0, ngx * (g + 1), ngy * (g + 1));
          } else {
            el.textContent = '';
            el.style.backgroundColor = settings.backgroundColor;
            el.style.position = 'relative';
          }
        });

        /* fill the grid with empty state */
        gx = ngx;
        while (gx--) {
          grid[gx] = [];
          gy = ngy;
          while (gy--) {
            grid[gx][gy] = true;
          }
        }
      } else {
        /* Determine bgPixel by creating
           another canvas and fill the specified background color. */
        var bctx = document.createElement('canvas').getContext('2d');

        bctx.fillStyle = settings.backgroundColor;
        bctx.fillRect(0, 0, 1, 1);
        var bgPixel = bctx.getImageData(0, 0, 1, 1).data;

        /* Read back the pixels of the canvas we got to tell which part of the
           canvas is empty.
           (no clearCanvas only works with a canvas, not divs) */
        var imageData =
          canvas.getContext('2d').getImageData(0, 0, ngx * g, ngy * g).data;

        gx = ngx;
        var x, y;
        while (gx--) {
          grid[gx] = [];
          gy = ngy;
          while (gy--) {
            y = g;
            singleGridLoop: while (y--) {
              x = g;
              while (x--) {
                i = 4;
                while (i--) {
                  if (imageData[((gy * g + y) * ngx * g +
                                 (gx * g + x)) * 4 + i] !== bgPixel[i]) {
                    grid[gx][gy] = false;
                    break singleGridLoop;
                  }
                }
              }
            }
            if (grid[gx][gy] !== false) {
              grid[gx][gy] = true;
            }
          }
        }

        imageData = bctx = bgPixel = undefined;
      }

      // fill the infoGrid with empty state if we need it
      if (settings.hover || settings.click) {

        interactive = true;

        /* fill the grid with empty state */
        gx = ngx + 1;
        while (gx--) {
          infoGrid[gx] = [];
        }

        if (settings.hover) {
          canvas.addEventListener('mousemove', wordcloudhover);
        }

        var touchend = function (e) {
          e.preventDefault();
        };

        if (settings.click) {
          canvas.addEventListener('click', wordcloudclick);
          canvas.addEventListener('touchstart', wordcloudclick);
          canvas.addEventListener('touchend', touchend);
          canvas.style.webkitTapHighlightColor = 'rgba(0, 0, 0, 0)';
        }

        canvas.addEventListener('wordcloudstart', function stopInteraction() {
          canvas.removeEventListener('wordcloudstart', stopInteraction);

          canvas.removeEventListener('mousemove', wordcloudhover);
          canvas.removeEventListener('click', wordcloudclick);
          canvas.removeEventListener('touchstart', wordcloudclick);
          canvas.removeEventListener('touchend', touchend);
          hovered = undefined;
        });
      }

      i = 0;
      var loopingFunction, stoppingFunction;
      if (settings.wait !== 0) {
        loopingFunction = window.setTimeout;
        stoppingFunction = window.clearTimeout;
      } else {
        loopingFunction = window.setImmediate;
        stoppingFunction = window.clearImmediate;
      }

      var addEventListener = function addEventListener(type, listener) {
        elements.forEach(function(el) {
          el.addEventListener(type, listener);
        }, this);
      };

      var removeEventListener = function removeEventListener(type, listener) {
        elements.forEach(function(el) {
          el.removeEventListener(type, listener);
        }, this);
      };

      var anotherWordCloudStart = function anotherWordCloudStart() {
        removeEventListener('wordcloudstart', anotherWordCloudStart);
        stoppingFunction(timer);
      };

      addEventListener('wordcloudstart', anotherWordCloudStart);

      var timer = loopingFunction(function loop() {
        if (i >= settings.list.length) {
          stoppingFunction(timer);
          sendEvent('wordcloudstop', false);
          removeEventListener('wordcloudstart', anotherWordCloudStart);

          return;
        }
        escapeTime = (new Date()).getTime();
        var drawn = putWord(settings.list[i]);
        var canceled = !sendEvent('wordclouddrawn', true, {
          item: settings.list[i], drawn: drawn });
        if (exceedTime() || canceled) {
          stoppingFunction(timer);
          settings.abort();
          sendEvent('wordcloudabort', false);
          sendEvent('wordcloudstop', false);
          removeEventListener('wordcloudstart', anotherWordCloudStart);
          return;
        }
        i++;
        timer = loopingFunction(loop, settings.wait);
      }, settings.wait);
    }
62590
function SVGLoader(loadItem, preferXHR) {
		this.AbstractLoader_constructor(loadItem, preferXHR, createjs.AbstractLoader.SVG);

		// public properties
		this.resultFormatter = this._formatResult;

		// protected properties
		this._tagSrcAttribute = "data";

		if (preferXHR) {
			this.setTag(document.createElement("svg"));
		} else {
			this.setTag(document.createElement("object"));
			this.getTag().type = "image/svg+xml";
		}
	}
122779
function init() {
  var root = new THREERoot();
  root.renderer.setClearColor(0x000000);
  root.camera.position.set(0, 0, 36);

  var light = new THREE.DirectionalLight(0xFF6138, 1.0);
  light.position.set(0, 1, 0);
  root.add(light);

  light = new THREE.DirectionalLight(0x00A388, 1.0);
  light.position.set(0, -1, 0);
  root.add(light);

  var pointLight = new THREE.PointLight();
  pointLight.position.set(0, 10, 0);
  root.add(pointLight);

  var animation, tween;
  var settings = {
    maxDelay: 0.0,
    timeScale: 1.0,
    backAmplitude: 2.0,
    elasticAmplitude: 1.0,
    elasticPeriod: 0.125,
    apply: function() {
      createAnimation(index);
    }
  };

  // html stuff
  var elCount = document.querySelector('.count');
  var elBtnLeft = document.querySelector('.btn.left');
  var elBtnRight = document.querySelector('.btn.right');

  var sizes = [100, 1000, 10000, 50000, 100000, 500000, 1000000];
  var index = 0;

  function createAnimation(i) {
    var count = sizes[i];

    elCount.innerHTML = count;
    elBtnRight.classList.toggle('disabled', i === sizes.length - 1);
    elBtnLeft.classList.toggle('disabled', index === 0);

    if (animation) {
      root.remove(animation);
      animation.material.dispose();
      animation.geometry.dispose();
      tween.kill();
    }

    animation = new Animation(count, settings);
    root.add(animation);

    tween = animation.animate({repeat:-1, repeatDelay: 0.0, ease:Power0.easeNone}).timeScale(settings.timeScale);
  }

  elBtnLeft.addEventListener('click', function(e) {
    e.preventDefault();
    index = Math.max(0, index - 1);
    createAnimation(index);
  });
  elBtnRight.addEventListener('click', function(e) {
    e.preventDefault();
    index = Math.min(index + 1, sizes.length - 1);
    createAnimation(index);
  });

  createAnimation(index);

  // giu
  var gui = new dat.GUI();
  gui.add(settings, 'maxDelay', 0.0, 10.0).step(0.01);
  gui.add(settings, 'timeScale', 0.0, 10.0).step(0.01).onChange(function(v) {
    tween.timeScale(v);
  });
  gui.add(settings, 'backAmplitude', 0.0, 10.0).step(0.01);
  gui.add(settings, 'elasticAmplitude', 0.0, 10.0).step(0.01);
  gui.add(settings, 'elasticPeriod', 0.0, 10.0).step(0.01);
  gui.add(settings, 'apply').name('> apply');
  gui.width = 300;
}
1300267
function ( type, css, obj, dom, id ) {

        type = type || 'div';

        if( Tools.SVG_TYPE_D.indexOf(type) !== -1 || Tools.SVG_TYPE_G.indexOf(type) !== -1 ){ // is svg element

            // create new svg if not def
            if( dom === undefined ) dom = Tools.doc.createElementNS( Tools.svgns, 'svg' );

            Tools.addAttributes( dom, type, obj, id );
            
        } else { // is html element

            if( dom === undefined ) dom = Tools.doc.createElementNS( Tools.htmls, type );
            else dom = dom.appendChild( Tools.doc.createElementNS( Tools.htmls, type ) );

        }

        if( css ) dom.style.cssText = css; 

        if( id === undefined ) return dom;
        else return dom.childNodes[ id || 0 ];

    }
298818
function init() {
    var i, j;

    // Make collapse buttons clickable
    var buttons = document.querySelectorAll('.collapse-button');
    for (i = 0; i < buttons.length; i++) {
        buttons[i].onclick = toggleCollapseButton;

        // Show by default? Then toggle now.
        if (buttons[i].className.indexOf('show') !== -1) {
            toggleCollapseButton({target: buttons[i].children[0]});
        }
    }

    var responseCodes = document.querySelectorAll('.example-names');
    for (i = 0; i < responseCodes.length; i++) {
        var tabButtons = childrenByClass(responseCodes[i], 'tab-button');
        for (j = 0; j < tabButtons.length; j++) {
            tabButtons[j].onclick = toggleTabButton;

            // Show by default?
            if (j === 0) {
                toggleTabButton({target: tabButtons[j]});
            }
        }
    }

    // Make nav items clickable to collapse/expand their content.
    var navItems = document.querySelectorAll('nav .resource-group .heading');
    for (i = 0; i < navItems.length; i++) {
        navItems[i].onclick = toggleCollapseNav;

        // Show all by default
        toggleCollapseNav({target: navItems[i].children[0]});
    }
}
1237916
function(st) {
			this._clickToDisMiss = true;
			this.statusMessage = st;
			this._init();
			//could be: responseText from xhrGet, deferred error object, or plain string
			var _status = st.responseText || st.message || st;
			//accept either a string or a JSON representation of an IStatus
			if (typeof _status === "string") {
				try {
					_status = JSON.parse(_status);
				} catch(error) {
					//it is not JSON, just continue;
				}
			}
			var message = _status.DetailedMessage || _status.Message || _status;
			var color = "#DF0000"; //$NON-NLS-0$
			if (_status.Severity) {
				switch (_status.Severity) {
				case SEV_WARNING:
					color = "#FFCC00"; //$NON-NLS-0$
					break;
				case SEV_ERROR:
					color = "#DF0000"; //$NON-NLS-0$
					break;
				case SEV_INFO:
				case SEV_OK:
					color = "green"; //$NON-NLS-0$
					break;
				}
			}
			var span = document.createElement("span");
			span.style.color = color;
			span.appendChild(document.createTextNode(message));
			var node = lib.node(this.domId);
			lib.empty(node);
			node.appendChild(span);
			this._takeDownSplash();
		}
148494
private void  viewportFill()
   {
      int    col;
      if (state.style.viewportFill instanceof SVG.Colour) {
         col = ((SVG.Colour) state.style.viewportFill).colour;
      } else if (state.style.viewportFill instanceof CurrentColor) {
         col = state.style.color.colour;
      } else {
         return;
      }
      if (state.style.viewportFillOpacity != null)
         col = colourWithOpacity(col, state.style.viewportFillOpacity);

      canvas.drawColor(col);
   }
792438
function init(g) {
    g.nodes().forEach(function(u) {
      var attrs = g.node(u);
      attrs.y = _rankSep * attrs.rank;
      if (attrs.width) {
        attrs.width = parseInt(attrs.width);
      } else {
        attrs.width = attrs.dummy ? _edgeWidth : _nodeWidth;
      }
    });
  }
788047
function initialise() {

	    DOMReady(function () {

	    	for (var i = 0; i < 10; i++) {
				createCommandHtml(true);
	    	}

			// var rellax = new Rellax('.rellax');

	    });

	    document.addEventListener('webkitAnimationEnd', onAnimationEnded);

	}
106376
function () {
    var el;
    el = document.createElement('a-entity');
    el.play = this.wrapPlay(el.play);
    el.setAttribute('mixin', this.data.mixin);
    el.object3D.visible = false;
    el.pause();
    this.container.appendChild(el);
    this.availableEls.push(el);
  }
369477
function(width, height) {
									var newImage = svgCanvas.addSvgElementFromJson({
										element: 'image',
										attr: {
											x: 0,
											y: 0,
											width: width,
											height: height,
											id: svgCanvas.getNextId(),
											style: 'pointer-events:inherit'
										}
									});
									svgCanvas.setHref(newImage, e.target.result);
									svgCanvas.selectOnly([newImage]);
									svgCanvas.alignSelectedElements('m', 'page');
									svgCanvas.alignSelectedElements('c', 'page');
									updateContextPanel();
								}
962740
function initialize() {
        var self = this;

        // NOTE: triggered before `creating`/`updating`
        this.on('saving', function onSaving(newObj, attrs, options) {
            if (options.method === 'insert') {
                // id = 0 is still a valid value for external usage
                if (_.isUndefined(newObj.id) || _.isNull(newObj.id)) {
                    newObj.setId();
                }
            }
        });

        [
            'fetching',
            'fetching:collection',
            'fetched',
            'fetched:collection',
            'creating',
            'created',
            'updating',
            'updated',
            'destroying',
            'destroyed',
            'saving',
            'saved'
        ].forEach(function (eventName) {
            var functionName = 'on' + eventName[0].toUpperCase() + eventName.slice(1);

            if (functionName.indexOf(':') !== -1) {
                functionName = functionName.slice(0, functionName.indexOf(':'))
                    + functionName[functionName.indexOf(':') + 1].toUpperCase()
                    + functionName.slice(functionName.indexOf(':') + 2);
                functionName = functionName.replace(':', '');
            }

            if (!self[functionName]) {
                return;
            }

            self.on(eventName, self[functionName]);
        });

        // @NOTE: Please keep here. If we don't initialize the parent, bookshelf-relations won't work.
        proto.initialize.call(this);
    }
467036
@PostConstruct
    public void init() {
        ArrayList<Node> children = new ArrayList<>();
        for (int i = 0; i < 20; i++) {
            StackPane child = new StackPane();
            double width = Math.random() * 100 + 100;
            child.setPrefWidth(width);
            double height = Math.random() * 100 + 100;
            child.setPrefHeight(height);
            JFXDepthManager.setDepth(child, 1);
            children.add(child);

            // create content
            StackPane header = new StackPane();
            String headerColor = getDefaultColor(i % 12);
            header.setStyle("-fx-background-radius: 5 5 0 0; -fx-background-color: " + headerColor);
            VBox.setVgrow(header, Priority.ALWAYS);
            StackPane body = new StackPane();
            body.setMinHeight(Math.random() * 20 + 50);
            VBox content = new VBox();
            content.getChildren().addAll(header, body);
            body.setStyle("-fx-background-radius: 0 0 5 5; -fx-background-color: rgb(255,255,255,0.87);");


            // create button
            JFXButton button = new JFXButton("");
            button.setButtonType(ButtonType.RAISED);
            button.setStyle("-fx-background-radius: 40;-fx-background-color: " + getDefaultColor((int) ((Math.random() * 12) % 12)));
            button.setPrefSize(40, 40);
            button.setRipplerFill(Color.valueOf(headerColor));
            button.setScaleX(0);
            button.setScaleY(0);
            SVGGlyph glyph = new SVGGlyph(-1,
                "test",
                "M1008 6.286q18.857 13.714 15.429 36.571l-146.286 877.714q-2.857 16.571-18.286 25.714-8 4.571-17.714 4.571-6.286 "
                + "0-13.714-2.857l-258.857-105.714-138.286 168.571q-10.286 13.143-28 13.143-7.429 "
                + "0-12.571-2.286-10.857-4-17.429-13.429t-6.571-20.857v-199.429l493.714-605.143-610.857 "
                + "528.571-225.714-92.571q-21.143-8-22.857-31.429-1.143-22.857 18.286-33.714l950.857-548.571q8.571-5.143 18.286-5.143"
                + " 11.429 0 20.571 6.286z",
                Color.WHITE);
            glyph.setSize(20, 20);
            button.setGraphic(glyph);
            button.translateYProperty().bind(Bindings.createDoubleBinding(() -> {
                return header.getBoundsInParent().getHeight() - button.getHeight() / 2;
            }, header.boundsInParentProperty(), button.heightProperty()));
            StackPane.setMargin(button, new Insets(0, 12, 0, 0));
            StackPane.setAlignment(button, Pos.TOP_RIGHT);

            Timeline animation = new Timeline(new KeyFrame(Duration.millis(240),
                                                           new KeyValue(button.scaleXProperty(),
                                                                        1,
                                                                        EASE_BOTH),
                                                           new KeyValue(button.scaleYProperty(),
                                                                        1,
                                                                        EASE_BOTH)));
            animation.setDelay(Duration.millis(100 * i + 1000));
            animation.play();
            child.getChildren().addAll(content, button);
        }
        masonryPane.getChildren().addAll(children);
        Platform.runLater(() -> scrollPane.requestLayout());

        JFXScrollPane.smoothScrolling(scrollPane);
    }
560120
function init() {
  'use strict';

  var wheel = document.querySelector('#wheel > svg');
  var cdn = document.querySelector('.mdl-gen__cdn .mdl-gen__cdn-link');
  var mc = new MaterialCustomizer(wheel, cdn);

  // Workaround for IE.
  var dl = document.querySelector('#download');
  dl.addEventListener('click', function() {
    if (window.navigator.msSaveBlob) {
      window.navigator.msSaveBlob(this.blob, 'material.min.css');
    }
  }.bind(mc));

  // Hook up GA event
  dl.addEventListener('click', function() {
    ga('send', {
      hitType: 'event',
      eventCategory: 'customizer',
      eventAction: 'download',
      eventLabel: mc.getSelectedPrimary() + '-' + mc.getSelectedSecondary()
    });
  });

  var clickCtr = 0;
  cdn.addEventListener('click', function() {
    var selection = window.getSelection();
    selection.removeAllRanges();

    var range = document.createRange();
    if (clickCtr === 0) {
      var link = cdn.querySelectorAll('.token.attr-value')[1];
      range.setStart(link, 2);
      range.setEnd(link, 3);
    } else {
      range.setStart(cdn, 1);
      range.setEnd(cdn, 2);
    }

    selection.addRange(range);
    clickCtr = (clickCtr + 1) % 2;
  });

  // Prevent browser's selection handling
  cdn.addEventListener('mouseup', function(ev) {
    ev.preventDefault();
  });
  cdn.addEventListener('mousedown', function(ev) {
    ev.preventDefault();
  });

  document.addEventListener('mouseup', function() {
    if (window.getSelection().toString().indexOf('.min.css') !== -1) {
      ga('send', {
        hitType: 'event',
        eventCategory: 'customizer',
        eventAction: 'copy',
        eventLabel: mc.getSelectedPrimary() + '-' + mc.getSelectedSecondary()
      });
    }
  });

  // Download template
  var req = new XMLHttpRequest();
  req.onload = function() {
    mc.template = this.responseText;
    mc.highlightField('Indigo');
    mc.highlightField('Pink');
    window.requestAnimationFrame(function() {
      mc.updateCDN();
      mc.updateStylesheet();
    });
  };
  req.open('get', '../material.min.css.template', true);
  req.send();
}
184538
function(callback) {

				// optimize as many times as the user wants
				async.timesSeries(options.optimize.input.svgo, function(i, next) {

					// tell the user that we’re optimizing
					grunt.log.writeln('Optimizing inputs with SVGO (pass ' + (i + 1) + ' of ' + options.optimize.input.svgo + ')…');

					// asynchronously loop through the files
					async.each(task.files, function(file, callback2) {

						// create a promise to optimize the SVGs
						promise = optimizeSVGO(file, options);

						// when that promise is finished, print the results onscreen
						// (if we’re being verbose)
						// and continue onwards
						promise.done(function(results) {
							if (results) {
								grunt.verbose.ok(results);
							}
							callback2(null);
						});

					}, next);

				}, callback);

			}