mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Simply use document.write() for script loading, as load.js seems not ready for primetime yet (it magically half-broke QUnit on Safari).
This commit is contained in:
parent
de797aa0fe
commit
4680283ce7
29 changed files with 135 additions and 220 deletions
|
@ -4,7 +4,6 @@
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<title>Example</title>
|
<title>Example</title>
|
||||||
<script type="text/javascript">var loadBase = '../../'</script>
|
<script type="text/javascript">var loadBase = '../../'</script>
|
||||||
<script type="text/javascript" src="../../lib/load.js"></script>
|
|
||||||
<script type="text/javascript" src="../../src/load.js"></script>
|
<script type="text/javascript" src="../../src/load.js"></script>
|
||||||
<script type="text/paperscript" canvas="canvas">
|
<script type="text/paperscript" canvas="canvas">
|
||||||
var vector = new Point(document.size.height, 0);
|
var vector = new Point(document.size.height, 0);
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<title>Example</title>
|
<title>Example</title>
|
||||||
<script type="text/javascript">var loadBase = '../../'</script>
|
<script type="text/javascript">var loadBase = '../../'</script>
|
||||||
<script type="text/javascript" src="../../lib/load.js"></script>
|
|
||||||
<script type="text/javascript" src="../../src/load.js"></script>
|
<script type="text/javascript" src="../../src/load.js"></script>
|
||||||
<script type="text/paperscript" canvas="canvas">
|
<script type="text/paperscript" canvas="canvas">
|
||||||
// http://en.wikipedia.org/wiki/Lenna
|
// http://en.wikipedia.org/wiki/Lenna
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<title>Example</title>
|
<title>Example</title>
|
||||||
<script type="text/javascript">var loadBase = '../../'</script>
|
<script type="text/javascript">var loadBase = '../../'</script>
|
||||||
<script type="text/javascript" src="../../lib/load.js"></script>
|
|
||||||
<script type="text/javascript" src="../../src/load.js"></script>
|
<script type="text/javascript" src="../../src/load.js"></script>
|
||||||
<script type="text/paperscript" canvas="canvas">
|
<script type="text/paperscript" canvas="canvas">
|
||||||
document.currentStyle.fillColor = 'black';
|
document.currentStyle.fillColor = 'black';
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<title>Example</title>
|
<title>Example</title>
|
||||||
<script type="text/javascript">var loadBase = '../../'</script>
|
<script type="text/javascript">var loadBase = '../../'</script>
|
||||||
<script type="text/javascript" src="../../lib/load.js"></script>
|
|
||||||
<script type="text/javascript" src="../../src/load.js"></script>
|
<script type="text/javascript" src="../../src/load.js"></script>
|
||||||
<script type="text/paperscript" canvas="canvas">
|
<script type="text/paperscript" canvas="canvas">
|
||||||
var mousePoint = document.bounds.center;
|
var mousePoint = document.bounds.center;
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<title>Example</title>
|
<title>Example</title>
|
||||||
<script type="text/javascript">var loadBase = '../../'</script>
|
<script type="text/javascript">var loadBase = '../../'</script>
|
||||||
<script type="text/javascript" src="../../lib/load.js"></script>
|
|
||||||
<script type="text/javascript" src="../../src/load.js"></script>
|
<script type="text/javascript" src="../../src/load.js"></script>
|
||||||
<script type="text/paperscript" canvas="canvas">
|
<script type="text/paperscript" canvas="canvas">
|
||||||
var layer = document.activeLayer;
|
var layer = document.activeLayer;
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<title>Example</title>
|
<title>Example</title>
|
||||||
<script type="text/javascript">var loadBase = '../../'</script>
|
<script type="text/javascript">var loadBase = '../../'</script>
|
||||||
<script type="text/javascript" src="../../lib/load.js"></script>
|
|
||||||
<script type="text/javascript" src="../../src/load.js"></script>
|
<script type="text/javascript" src="../../src/load.js"></script>
|
||||||
<script type="text/paperscript" canvas="canvas">
|
<script type="text/paperscript" canvas="canvas">
|
||||||
var balls = [];
|
var balls = [];
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<title>Example</title>
|
<title>Example</title>
|
||||||
<script type="text/javascript">var loadBase = '../../'</script>
|
<script type="text/javascript">var loadBase = '../../'</script>
|
||||||
<script type="text/javascript" src="../../lib/load.js"></script>
|
|
||||||
<script type="text/javascript" src="../../src/load.js"></script>
|
<script type="text/javascript" src="../../src/load.js"></script>
|
||||||
<script type="text/paperscript" canvas="canvas">
|
<script type="text/paperscript" canvas="canvas">
|
||||||
var point = document.bounds.center;
|
var point = document.bounds.center;
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<title>Example</title>
|
<title>Example</title>
|
||||||
<script type="text/javascript">var loadBase = '../../'</script>
|
<script type="text/javascript">var loadBase = '../../'</script>
|
||||||
<script type="text/javascript" src="../../lib/load.js"></script>
|
|
||||||
<script type="text/javascript" src="../../src/load.js"></script>
|
<script type="text/javascript" src="../../src/load.js"></script>
|
||||||
<script type="text/paperscript" canvas="canvas">
|
<script type="text/paperscript" canvas="canvas">
|
||||||
var center = document.bounds.center;
|
var center = document.bounds.center;
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<title>Example</title>
|
<title>Example</title>
|
||||||
<script type="text/javascript">var loadBase = '../../'</script>
|
<script type="text/javascript">var loadBase = '../../'</script>
|
||||||
<script type="text/javascript" src="../../lib/load.js"></script>
|
|
||||||
<script type="text/javascript" src="../../src/load.js"></script>
|
<script type="text/javascript" src="../../src/load.js"></script>
|
||||||
<script type="text/paperscript" canvas="canvas">
|
<script type="text/paperscript" canvas="canvas">
|
||||||
var letterPath = new Path(
|
var letterPath = new Path(
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<title>Example</title>
|
<title>Example</title>
|
||||||
<script type="text/javascript">var loadBase = '../../'</script>
|
<script type="text/javascript">var loadBase = '../../'</script>
|
||||||
<script type="text/javascript" src="../../lib/load.js"></script>
|
|
||||||
<script type="text/javascript" src="../../src/load.js"></script>
|
<script type="text/javascript" src="../../src/load.js"></script>
|
||||||
<script type="text/paperscript" canvas="canvas">
|
<script type="text/paperscript" canvas="canvas">
|
||||||
var count = 0;
|
var count = 0;
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<title>Example</title>
|
<title>Example</title>
|
||||||
<script type="text/javascript">var loadBase = '../../'</script>
|
<script type="text/javascript">var loadBase = '../../'</script>
|
||||||
<script type="text/javascript" src="../../lib/load.js"></script>
|
|
||||||
<script type="text/javascript" src="../../src/load.js"></script>
|
<script type="text/javascript" src="../../src/load.js"></script>
|
||||||
<script type="text/paperscript" canvas="canvas">
|
<script type="text/paperscript" canvas="canvas">
|
||||||
var path = new Path.Rectangle([50, 50], [100, 100]);
|
var path = new Path.Rectangle([50, 50], [100, 100]);
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<title>Example</title>
|
<title>Example</title>
|
||||||
<script type="text/javascript">var loadBase = '../../'</script>
|
<script type="text/javascript">var loadBase = '../../'</script>
|
||||||
<script type="text/javascript" src="../../lib/load.js"></script>
|
|
||||||
<script type="text/javascript" src="../../src/load.js"></script>
|
<script type="text/javascript" src="../../src/load.js"></script>
|
||||||
<script type="text/paperscript" canvas="canvas">
|
<script type="text/paperscript" canvas="canvas">
|
||||||
var count = 0;
|
var count = 0;
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<title>Example</title>
|
<title>Example</title>
|
||||||
<script type="text/javascript">var loadBase = '../../'</script>
|
<script type="text/javascript">var loadBase = '../../'</script>
|
||||||
<script type="text/javascript" src="../../lib/load.js"></script>
|
|
||||||
<script type="text/javascript" src="../../src/load.js"></script>
|
<script type="text/javascript" src="../../src/load.js"></script>
|
||||||
<script type="text/paperscript" canvas="canvas">
|
<script type="text/paperscript" canvas="canvas">
|
||||||
var path = new Path.Circle(new Point(), 100);
|
var path = new Path.Circle(new Point(), 100);
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<title>Example</title>
|
<title>Example</title>
|
||||||
<script type="text/javascript">var loadBase = '../../'</script>
|
<script type="text/javascript">var loadBase = '../../'</script>
|
||||||
<script type="text/javascript" src="../../lib/load.js"></script>
|
|
||||||
<script type="text/javascript" src="../../src/load.js"></script>
|
<script type="text/javascript" src="../../src/load.js"></script>
|
||||||
<script type="text/paperscript" canvas="canvas">
|
<script type="text/paperscript" canvas="canvas">
|
||||||
var point = new Point(document.size) / 2;
|
var point = new Point(document.size) / 2;
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<title>Example</title>
|
<title>Example</title>
|
||||||
<script type="text/javascript">var loadBase = '../../'</script>
|
<script type="text/javascript">var loadBase = '../../'</script>
|
||||||
<script type="text/javascript" src="../../lib/load.js"></script>
|
|
||||||
<script type="text/javascript" src="../../src/load.js"></script>
|
<script type="text/javascript" src="../../src/load.js"></script>
|
||||||
<script type="text/paperscript" canvas="canvas">
|
<script type="text/paperscript" canvas="canvas">
|
||||||
var paths = [];
|
var paths = [];
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<title>Example</title>
|
<title>Example</title>
|
||||||
<script type="text/javascript">var loadBase = '../../'</script>
|
<script type="text/javascript">var loadBase = '../../'</script>
|
||||||
<script type="text/javascript" src="../../lib/load.js"></script>
|
|
||||||
<script type="text/javascript" src="../../src/load.js"></script>
|
<script type="text/javascript" src="../../src/load.js"></script>
|
||||||
<script type="text/paperscript" canvas="canvas">
|
<script type="text/paperscript" canvas="canvas">
|
||||||
var path = new Path([100, 150], [150, 200], [200, 150]);
|
var path = new Path([100, 150], [150, 200], [200, 150]);
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<title>Example</title>
|
<title>Example</title>
|
||||||
<script type="text/javascript">var loadBase = '../../'</script>
|
<script type="text/javascript">var loadBase = '../../'</script>
|
||||||
<script type="text/javascript" src="../../lib/load.js"></script>
|
|
||||||
<script type="text/javascript" src="../../src/load.js"></script>
|
<script type="text/javascript" src="../../src/load.js"></script>
|
||||||
<script type="text/paperscript" canvas="canvas">
|
<script type="text/paperscript" canvas="canvas">
|
||||||
document.currentStyle = {
|
document.currentStyle = {
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<title>Example</title>
|
<title>Example</title>
|
||||||
<script type="text/javascript">var loadBase = '../../'</script>
|
<script type="text/javascript">var loadBase = '../../'</script>
|
||||||
<script type="text/javascript" src="../../lib/load.js"></script>
|
|
||||||
<script type="text/javascript" src="../../src/load.js"></script>
|
<script type="text/javascript" src="../../src/load.js"></script>
|
||||||
<script type="text/paperscript" canvas="canvas">
|
<script type="text/paperscript" canvas="canvas">
|
||||||
var path;
|
var path;
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<title>Example</title>
|
<title>Example</title>
|
||||||
<script type="text/javascript">var loadBase = '../../'</script>
|
<script type="text/javascript">var loadBase = '../../'</script>
|
||||||
<script type="text/javascript" src="../../lib/load.js"></script>
|
|
||||||
<script type="text/javascript" src="../../src/load.js"></script>
|
<script type="text/javascript" src="../../src/load.js"></script>
|
||||||
<script type="text/paperscript" canvas="canvas">
|
<script type="text/paperscript" canvas="canvas">
|
||||||
var path;
|
var path;
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<title>Example</title>
|
<title>Example</title>
|
||||||
<script type="text/javascript">var loadBase = '../../'</script>
|
<script type="text/javascript">var loadBase = '../../'</script>
|
||||||
<script type="text/javascript" src="../../lib/load.js"></script>
|
|
||||||
<script type="text/javascript" src="../../src/load.js"></script>
|
<script type="text/javascript" src="../../src/load.js"></script>
|
||||||
<script type="text/paperscript" canvas="canvas">
|
<script type="text/paperscript" canvas="canvas">
|
||||||
var path;
|
var path;
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<title>Example</title>
|
<title>Example</title>
|
||||||
<script type="text/javascript">var loadBase = '../../'</script>
|
<script type="text/javascript">var loadBase = '../../'</script>
|
||||||
<script type="text/javascript" src="../../lib/load.js"></script>
|
|
||||||
<script type="text/javascript" src="../../src/load.js"></script>
|
<script type="text/javascript" src="../../src/load.js"></script>
|
||||||
<script type="text/paperscript" canvas="canvas">
|
<script type="text/paperscript" canvas="canvas">
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<title>Example</title>
|
<title>Example</title>
|
||||||
<script type="text/javascript">var loadBase = '../../'</script>
|
<script type="text/javascript">var loadBase = '../../'</script>
|
||||||
<script type="text/javascript" src="../../lib/load.js"></script>
|
|
||||||
<script type="text/javascript" src="../../src/load.js"></script>
|
<script type="text/javascript" src="../../src/load.js"></script>
|
||||||
<script type="text/paperscript" canvas="canvas">
|
<script type="text/paperscript" canvas="canvas">
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<title>Example</title>
|
<title>Example</title>
|
||||||
<script type="text/javascript">var loadBase = '../../'</script>
|
<script type="text/javascript">var loadBase = '../../'</script>
|
||||||
<script type="text/javascript" src="../../lib/load.js"></script>
|
|
||||||
<script type="text/javascript" src="../../src/load.js"></script>
|
<script type="text/javascript" src="../../src/load.js"></script>
|
||||||
<script type="text/paperscript" canvas="canvas">
|
<script type="text/paperscript" canvas="canvas">
|
||||||
tool.fixedDistance = 30;
|
tool.fixedDistance = 30;
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<title>Example</title>
|
<title>Example</title>
|
||||||
<script type="text/javascript">var loadBase = '../../'</script>
|
<script type="text/javascript">var loadBase = '../../'</script>
|
||||||
<script type="text/javascript" src="../../lib/load.js"></script>
|
|
||||||
<script type="text/javascript" src="../../src/load.js"></script>
|
<script type="text/javascript" src="../../src/load.js"></script>
|
||||||
<script type="text/paperscript" canvas="canvas">
|
<script type="text/paperscript" canvas="canvas">
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<title>Example</title>
|
<title>Example</title>
|
||||||
<script type="text/javascript">var loadBase = '../../'</script>
|
<script type="text/javascript">var loadBase = '../../'</script>
|
||||||
<script type="text/javascript" src="../../lib/load.js"></script>
|
|
||||||
<script type="text/javascript" src="../../src/load.js"></script>
|
<script type="text/javascript" src="../../src/load.js"></script>
|
||||||
<script type="text/paperscript" canvas="canvas">
|
<script type="text/paperscript" canvas="canvas">
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
/* Copyright (c) 2010 Chris O'Hara <cohara87@gmail.com>. MIT Licensed *///Include the chain.js microframework (http://github.com/chriso/chain.js)
|
|
||||||
function loadScript(a,b,c){var d=document.createElement("script");d.type="text/javascript",d.src=a,d.onload=b,d.onerror=c,d.onreadystatechange=function(){var a=this.readyState;if(a==="loaded"||a==="complete")d.onreadystatechange=null,b()},head.insertBefore(d,head.firstChild)}(function(a){a=a||{};var b={},c,d;c=function(a,d,e){var f=a.halt=!1;a.error=function(a){throw a},a.next=function(c){c&&(f=!1);if(!a.halt&&d&&d.length){var e=d.shift(),g=e.shift();f=!0;try{b[g].apply(a,[e,e.length,g])}catch(h){a.error(h)}}return a};for(var g in b){if(typeof a[g]==="function")continue;(function(e){a[e]=function(){var g=Array.prototype.slice.call(arguments);if(e==="onError"){if(d){b.onError.apply(a,[g,g.length]);return a}var h={};b.onError.apply(h,[g,g.length]);return c(h,null,"onError")}g.unshift(e);if(!d)return c({},[g],e);a.then=a[e],d.push(g);return f?a:a.next()}})(g)}e&&(a.then=a[e]),a.call=function(b,c){c.unshift(b),d.unshift(c),a.next(!0)};return a.next()},d=a.addMethod=function(d){var e=Array.prototype.slice.call(arguments),f=e.pop();for(var g=0,h=e.length;g<h;g++)typeof e[g]==="string"&&(b[e[g]]=f);--h||(b["then"+d.substr(0,1).toUpperCase()+d.substr(1)]=f),c(a)},d("chain",function(a){var b=this,c=function(){if(!b.halt){if(!a.length)return b.next(!0);try{null!=a.shift().call(b,c,b.error)&&c()}catch(d){b.error(d)}}};c()}),d("run",function(a,b){var c=this,d=function(){c.halt||--b||c.next(!0)},e=function(a){c.error(a)};for(var f=0,g=b;!c.halt&&f<g;f++)null!=a[f].call(c,d,e)&&d()}),d("defer",function(a){var b=this;setTimeout(function(){b.next(!0)},a.shift())}),d("onError",function(a,b){var c=this;this.error=function(d){c.halt=!0;for(var e=0;e<b;e++)a[e].call(c,d)}})})(this),addMethod("load",function(a,b){for(var c=[],d=0;d<b;d++)(function(b){c.push(function(c,d){loadScript(a[b],c,d)})})(d);this.call("run",c)});var head=document.getElementsByTagName("head")[0]||document.documentElement
|
|
189
src/load.js
189
src/load.js
|
@ -16,134 +16,83 @@
|
||||||
//
|
//
|
||||||
// NOTE: Any files added as includes to paper.js also need to be listed here
|
// NOTE: Any files added as includes to paper.js also need to be listed here
|
||||||
|
|
||||||
var id = '?' + Math.random(),
|
var loadBase = window.loadBase || '',
|
||||||
loadBase = window.loadBase || '',
|
loadTests = window.loadTests;
|
||||||
loadTests = window.loadTests,
|
|
||||||
loaded = false;
|
|
||||||
|
|
||||||
function addEvent(obj, type, fn) {
|
var sources = [
|
||||||
if (obj.addEventListener) {
|
'lib/bootstrap.js',
|
||||||
obj.addEventListener(type, fn, false);
|
'lib/parse-js.js',
|
||||||
} else if (obj.attachEvent) {
|
|
||||||
obj.attachEvent('on'+ type, fn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
addEvent(window, 'load', function() {
|
'src/paper.js',
|
||||||
loaded = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
// Load Paper.js library bit by bit, in chunks defined by inderdependent files.
|
'src/basic/Point.js',
|
||||||
var items = [
|
'src/basic/Size.js',
|
||||||
[
|
'src/basic/Rectangle.js',
|
||||||
'lib/bootstrap.js',
|
'src/basic/Matrix.js',
|
||||||
'lib/parse-js.js'
|
'src/basic/Line.js',
|
||||||
], [
|
|
||||||
'src/paper.js'
|
'src/document/DocumentView.js',
|
||||||
], [
|
'src/document/Document.js',
|
||||||
'src/basic/Point.js',
|
'src/document/Symbol.js',
|
||||||
'src/basic/Size.js',
|
|
||||||
'src/basic/Rectangle.js',
|
'src/item/Item.js',
|
||||||
'src/basic/Matrix.js',
|
'src/item/Group.js',
|
||||||
'src/basic/Line.js'
|
'src/item/Raster.js',
|
||||||
], [
|
'src/item/PlacedSymbol.js',
|
||||||
'src/document/DocumentView.js',
|
'src/item/PathStyle.js',
|
||||||
'src/document/Document.js',
|
'src/path/PathItem.js',
|
||||||
'src/document/Symbol.js'
|
'src/path/Segment.js',
|
||||||
], [
|
'src/path/Curve.js',
|
||||||
'src/item/Item.js'
|
|
||||||
], [
|
'src/item/Layer.js',
|
||||||
'src/item/Group.js',
|
'src/path/Path.js',
|
||||||
'src/item/Raster.js',
|
'src/path/CompoundPath.js',
|
||||||
'src/item/PlacedSymbol.js',
|
|
||||||
'src/item/PathStyle.js',
|
'src/path/Path.Constructors.js',
|
||||||
'src/path/PathItem.js',
|
|
||||||
'src/path/Segment.js',
|
'src/color/Color.js',
|
||||||
'src/path/Curve.js'
|
'src/color/RGBColor.js',
|
||||||
], [
|
'src/color/GrayColor.js',
|
||||||
// Requires Group
|
'src/color/GradientColor.js',
|
||||||
'src/item/Layer.js',
|
'src/color/Gradient.js',
|
||||||
// Requires PathItem
|
'src/color/GradientStop.js',
|
||||||
'src/path/Path.js',
|
|
||||||
'src/path/CompoundPath.js'
|
'src/tool/ToolEvent.js',
|
||||||
], [
|
'src/tool/ToolHandler.js',
|
||||||
'src/path/Path.Constructors.js',
|
'src/tool/Tool.js',
|
||||||
'src/color/Color.js'
|
|
||||||
], [
|
'src/util/BlendMode.js',
|
||||||
// Requires Color
|
'src/util/CanvasProvider.js',
|
||||||
'src/color/RGBColor.js',
|
'src/util/Numerical.js',
|
||||||
'src/color/GrayColor.js',
|
'src/util/Events.js',
|
||||||
'src/color/GradientColor.js',
|
'src/util/PaperScript.js'
|
||||||
'src/color/Gradient.js',
|
|
||||||
'src/color/GradientStop.js'
|
|
||||||
], [
|
|
||||||
'src/tool/ToolEvent.js',
|
|
||||||
'src/tool/ToolHandler.js'
|
|
||||||
], [
|
|
||||||
// Requires ToolHandler
|
|
||||||
'src/tool/Tool.js',
|
|
||||||
'src/util/BlendMode.js',
|
|
||||||
'src/util/CanvasProvider.js',
|
|
||||||
'src/util/Numerical.js',
|
|
||||||
'src/util/Events.js'
|
|
||||||
], [
|
|
||||||
// Requires Events
|
|
||||||
'src/util/PaperScript.js'
|
|
||||||
]
|
|
||||||
];
|
];
|
||||||
|
|
||||||
// Load unit tests after library if asked to do so
|
// Load unit tests after library if asked to do so
|
||||||
if (loadTests) {
|
if (loadTests) {
|
||||||
items.push(
|
sources.push(
|
||||||
[
|
'test/lib/qunit/qunit.js',
|
||||||
'test/lib/qunit/qunit.js',
|
'test/lib/test_functions.js',
|
||||||
'test/lib/test_functions.js'
|
'test/tests/Point.js',
|
||||||
],
|
'test/tests/Size.js',
|
||||||
// Load each test seperately
|
'test/tests/Rectangle.js',
|
||||||
[ 'test/tests/Point.js' ],
|
'test/tests/Color.js',
|
||||||
[ 'test/tests/Size.js' ],
|
'test/tests/Document.js',
|
||||||
[ 'test/tests/Rectangle.js' ],
|
'test/tests/Item.js',
|
||||||
[ 'test/tests/Color.js' ],
|
'test/tests/Layer.js',
|
||||||
[ 'test/tests/Document.js' ],
|
'test/tests/Group.js',
|
||||||
[ 'test/tests/Item.js' ],
|
'test/tests/Segment.js',
|
||||||
[ 'test/tests/Layer.js' ],
|
'test/tests/Path.js',
|
||||||
[ 'test/tests/Group.js' ],
|
'test/tests/Path_Shapes.js',
|
||||||
[ 'test/tests/Segment.js' ],
|
'test/tests/Path_Drawing_Commands.js',
|
||||||
[ 'test/tests/Path.js' ],
|
'test/tests/Path_Bounds.js',
|
||||||
[ 'test/tests/Path_Shapes.js' ],
|
'test/tests/Path_Length.js',
|
||||||
[ 'test/tests/Path_Drawing_Commands.js' ],
|
'test/tests/PathStyle.js',
|
||||||
[ 'test/tests/Path_Bounds.js' ],
|
'test/tests/PlacedSymbol.js'
|
||||||
[ 'test/tests/Path_Length.js' ],
|
|
||||||
[ 'test/tests/PathStyle.js' ],
|
|
||||||
[ 'test/tests/PlacedSymbol.js' ]
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This bit of code is required to convert the above lists of grouped sources
|
for (var i = 0; i < sources.length; i++) {
|
||||||
// to the odd load.js format:
|
document.write('<script type="text/javascript" src="' + loadBase
|
||||||
var loader = null;
|
+ sources[i] + '"></script>');
|
||||||
for (var i = 0; i < items.length; i++) {
|
|
||||||
var sources = items[i];
|
|
||||||
for (var j = 0; j < sources.length; j++) {
|
|
||||||
sources[j] = loadBase + sources[j] + id;
|
|
||||||
}
|
|
||||||
if (!loader) {
|
|
||||||
loader = load.apply(window, sources);
|
|
||||||
} else {
|
|
||||||
loader.then.apply(loader, sources);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// At the end of loading, run PaperScript and QUnit if required
|
|
||||||
loader.thenRun(
|
|
||||||
function() {
|
|
||||||
if (loaded) {
|
|
||||||
PaperScript.load();
|
|
||||||
if (loadTests) {
|
|
||||||
QUnit.load();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
|
@ -3,12 +3,7 @@
|
||||||
<head>
|
<head>
|
||||||
<title>Paper.js Tests</title>
|
<title>Paper.js Tests</title>
|
||||||
<link rel="stylesheet" href="lib/qunit/qunit.css" type="text/css" media="screen">
|
<link rel="stylesheet" href="lib/qunit/qunit.css" type="text/css" media="screen">
|
||||||
<!-- Paper.js Loading -->
|
<script type="text/javascript"> var loadBase = '../', loadTests = true; </script>
|
||||||
<script type="text/javascript">
|
|
||||||
var loadBase = '../',
|
|
||||||
loadTests = true;
|
|
||||||
</script>
|
|
||||||
<script type="text/javascript" src="../lib/load.js"></script>
|
|
||||||
<script type="text/javascript" src="../src/load.js"></script>
|
<script type="text/javascript" src="../src/load.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -611,72 +611,7 @@ extend(QUnit, {
|
||||||
message: output
|
message: output
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
load: function() {
|
|
||||||
QUnit.begin({});
|
|
||||||
|
|
||||||
// Initialize the config, saving the execution queue
|
|
||||||
var oldconfig = extend({}, config);
|
|
||||||
QUnit.init();
|
|
||||||
extend(config, oldconfig);
|
|
||||||
|
|
||||||
config.blocking = false;
|
|
||||||
|
|
||||||
var userAgent = id("qunit-userAgent");
|
|
||||||
if ( userAgent ) {
|
|
||||||
userAgent.innerHTML = navigator.userAgent;
|
|
||||||
}
|
|
||||||
var banner = id("qunit-header");
|
|
||||||
if ( banner ) {
|
|
||||||
var paramsIndex = location.href.lastIndexOf(location.search);
|
|
||||||
if ( paramsIndex > -1 ) {
|
|
||||||
var mainPageLocation = location.href.slice(0, paramsIndex);
|
|
||||||
if ( mainPageLocation == location.href ) {
|
|
||||||
banner.innerHTML = '<a href=""> ' + banner.innerHTML + '</a> ';
|
|
||||||
} else {
|
|
||||||
var testName = decodeURIComponent(location.search.slice(1));
|
|
||||||
banner.innerHTML = '<a href="' + mainPageLocation + '">' + banner.innerHTML + '</a> › <a href="">' + testName + '</a>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var toolbar = id("qunit-testrunner-toolbar");
|
|
||||||
if ( toolbar ) {
|
|
||||||
var filter = document.createElement("input");
|
|
||||||
filter.type = "checkbox";
|
|
||||||
filter.id = "qunit-filter-pass";
|
|
||||||
addEvent( filter, "click", function() {
|
|
||||||
var li = document.getElementsByTagName("li");
|
|
||||||
for ( var i = 0; i < li.length; i++ ) {
|
|
||||||
if ( li[i].className.indexOf("pass") > -1 ) {
|
|
||||||
li[i].style.display = filter.checked ? "none" : "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( defined.sessionStorage ) {
|
|
||||||
sessionStorage.setItem("qunit-filter-passed-tests", filter.checked ? "true" : "");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if ( defined.sessionStorage && sessionStorage.getItem("qunit-filter-passed-tests") ) {
|
|
||||||
filter.checked = true;
|
|
||||||
}
|
|
||||||
toolbar.appendChild( filter );
|
|
||||||
|
|
||||||
var label = document.createElement("label");
|
|
||||||
label.setAttribute("for", "qunit-filter-pass");
|
|
||||||
label.innerHTML = "Hide passed tests";
|
|
||||||
toolbar.appendChild( label );
|
|
||||||
}
|
|
||||||
|
|
||||||
var main = id('main') || id('qunit-fixture');
|
|
||||||
if ( main ) {
|
|
||||||
config.fixture = main.innerHTML;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.autostart) {
|
|
||||||
QUnit.start();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// Logging callbacks; all receive a single argument with the listed properties
|
// Logging callbacks; all receive a single argument with the listed properties
|
||||||
// run test/logs.html for any related changes
|
// run test/logs.html for any related changes
|
||||||
begin: function() {},
|
begin: function() {},
|
||||||
|
@ -698,7 +633,70 @@ if ( typeof document === "undefined" || document.readyState === "complete" ) {
|
||||||
config.autorun = true;
|
config.autorun = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
addEvent(window, "load", QUnit.load);
|
addEvent(window, "load", function() {
|
||||||
|
QUnit.begin({});
|
||||||
|
|
||||||
|
// Initialize the config, saving the execution queue
|
||||||
|
var oldconfig = extend({}, config);
|
||||||
|
QUnit.init();
|
||||||
|
extend(config, oldconfig);
|
||||||
|
|
||||||
|
config.blocking = false;
|
||||||
|
|
||||||
|
var userAgent = id("qunit-userAgent");
|
||||||
|
if ( userAgent ) {
|
||||||
|
userAgent.innerHTML = navigator.userAgent;
|
||||||
|
}
|
||||||
|
var banner = id("qunit-header");
|
||||||
|
if ( banner ) {
|
||||||
|
var paramsIndex = location.href.lastIndexOf(location.search);
|
||||||
|
if ( paramsIndex > -1 ) {
|
||||||
|
var mainPageLocation = location.href.slice(0, paramsIndex);
|
||||||
|
if ( mainPageLocation == location.href ) {
|
||||||
|
banner.innerHTML = '<a href=""> ' + banner.innerHTML + '</a> ';
|
||||||
|
} else {
|
||||||
|
var testName = decodeURIComponent(location.search.slice(1));
|
||||||
|
banner.innerHTML = '<a href="' + mainPageLocation + '">' + banner.innerHTML + '</a> › <a href="">' + testName + '</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var toolbar = id("qunit-testrunner-toolbar");
|
||||||
|
if ( toolbar ) {
|
||||||
|
var filter = document.createElement("input");
|
||||||
|
filter.type = "checkbox";
|
||||||
|
filter.id = "qunit-filter-pass";
|
||||||
|
addEvent( filter, "click", function() {
|
||||||
|
var li = document.getElementsByTagName("li");
|
||||||
|
for ( var i = 0; i < li.length; i++ ) {
|
||||||
|
if ( li[i].className.indexOf("pass") > -1 ) {
|
||||||
|
li[i].style.display = filter.checked ? "none" : "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( defined.sessionStorage ) {
|
||||||
|
sessionStorage.setItem("qunit-filter-passed-tests", filter.checked ? "true" : "");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if ( defined.sessionStorage && sessionStorage.getItem("qunit-filter-passed-tests") ) {
|
||||||
|
filter.checked = true;
|
||||||
|
}
|
||||||
|
toolbar.appendChild( filter );
|
||||||
|
|
||||||
|
var label = document.createElement("label");
|
||||||
|
label.setAttribute("for", "qunit-filter-pass");
|
||||||
|
label.innerHTML = "Hide passed tests";
|
||||||
|
toolbar.appendChild( label );
|
||||||
|
}
|
||||||
|
|
||||||
|
var main = id('main') || id('qunit-fixture');
|
||||||
|
if ( main ) {
|
||||||
|
config.fixture = main.innerHTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.autostart) {
|
||||||
|
QUnit.start();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
function done() {
|
function done() {
|
||||||
config.autorun = true;
|
config.autorun = true;
|
||||||
|
|
Loading…
Reference in a new issue