Since Firefox does not seem to support the <base> tag for script loading, roll our own solution through the load.js calls.

This commit is contained in:
Jürg Lehni 2011-03-07 23:11:41 +00:00
parent 3dd523a683
commit 798bcd709a
26 changed files with 114 additions and 113 deletions

View file

@ -3,9 +3,9 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<base href="../../">
<script type="text/javascript" src="lib/load.js"></script>
<script type="text/javascript" src="src/load.js"></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/paperscript" canvas="canvas">
var vector = new Point(document.size.height, 0);
var point = new Point(document.size) / 2;

View file

@ -3,9 +3,9 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<base href="../../">
<script type="text/javascript" src="lib/load.js"></script>
<script type="text/javascript" src="src/load.js"></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/paperscript" canvas="canvas">
// http://en.wikipedia.org/wiki/Lenna
var raster = new Raster('lenna');

View file

@ -3,9 +3,9 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<base href="../../">
<script type="text/javascript" src="lib/load.js"></script>
<script type="text/javascript" src="src/load.js"></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/paperscript" canvas="canvas">
document.currentStyle.fillColor = 'black';
var raster = new Raster('lenna');

View file

@ -3,9 +3,9 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<base href="../../">
<script type="text/javascript" src="lib/load.js"></script>
<script type="text/javascript" src="src/load.js"></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/paperscript" canvas="canvas">
var mousePoint = document.bounds.center;

View file

@ -3,9 +3,9 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<base href="../../">
<script type="text/javascript" src="lib/load.js"></script>
<script type="text/javascript" src="src/load.js"></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/paperscript" canvas="canvas">
var layer = document.activeLayer;

View file

@ -3,9 +3,9 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<base href="../../">
<script type="text/javascript" src="lib/load.js"></script>
<script type="text/javascript" src="src/load.js"></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/paperscript" canvas="canvas">
var balls = [];

View file

@ -3,9 +3,9 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<base href="../../">
<script type="text/javascript" src="lib/load.js"></script>
<script type="text/javascript" src="src/load.js"></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/paperscript" canvas="canvas">
var point = document.bounds.center;
for (var i = 0; i < 30; i++) {

View file

@ -3,9 +3,9 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<base href="../../">
<script type="text/javascript" src="lib/load.js"></script>
<script type="text/javascript" src="src/load.js"></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/paperscript" canvas="canvas">
var center = document.bounds.center;
for (var i = 0; i < 70; i++) {

View file

@ -3,9 +3,9 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<base href="../../">
<script type="text/javascript" src="lib/load.js"></script>
<script type="text/javascript" src="src/load.js"></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/paperscript" canvas="canvas">
var letterPath = new Path(
new Segment(new Point(63.39306640625, 265.7138671875), null, new Point(10.86669921875, 6.96630859375)),

View file

@ -3,9 +3,9 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<base href="../../">
<script type="text/javascript" src="lib/load.js"></script>
<script type="text/javascript" src="src/load.js"></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/paperscript" canvas="canvas">
var count = 0;
setInterval(draw, 20);

View file

@ -3,9 +3,9 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<base href="../../">
<script type="text/javascript" src="lib/load.js"></script>
<script type="text/javascript" src="src/load.js"></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/paperscript" canvas="canvas">
var path = new Path.Rectangle([50, 50], [100, 100]);
path.strokeColor = 'black';

View file

@ -3,9 +3,9 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<base href="../../">
<script type="text/javascript" src="lib/load.js"></script>
<script type="text/javascript" src="src/load.js"></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/paperscript" canvas="canvas">
var count = 0;
setInterval(draw, 30);

View file

@ -3,9 +3,9 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<base href="../../">
<script type="text/javascript" src="lib/load.js"></script>
<script type="text/javascript" src="src/load.js"></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/paperscript" canvas="canvas">
var path = new Path.Circle(new Point(), 100);
path.strokeWidth = 30;

View file

@ -3,9 +3,9 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<base href="../../">
<script type="text/javascript" src="lib/load.js"></script>
<script type="text/javascript" src="src/load.js"></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/paperscript" canvas="canvas">
var point = new Point(document.size) / 2;
for (var i = 0; i < 30; i++) {

View file

@ -3,9 +3,9 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<base href="../../">
<script type="text/javascript" src="lib/load.js"></script>
<script type="text/javascript" src="src/load.js"></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/paperscript" canvas="canvas">
var paths = [];

View file

@ -3,9 +3,9 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<base href="../../">
<script type="text/javascript" src="lib/load.js"></script>
<script type="text/javascript" src="src/load.js"></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/paperscript" canvas="canvas">
var path = new Path([100, 150], [150, 200], [200, 150]);
path.strokeColor = 'black';

View file

@ -3,9 +3,9 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<base href="../../">
<script type="text/javascript" src="lib/load.js"></script>
<script type="text/javascript" src="src/load.js"></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/paperscript" canvas="canvas">
document.currentStyle = {
strokeColor: '#4f7aff',

View file

@ -3,9 +3,9 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<base href="../../">
<script type="text/javascript" src="lib/load.js"></script>
<script type="text/javascript" src="src/load.js"></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/paperscript" canvas="canvas">
var path;
function onMouseDrag(event) {

View file

@ -3,9 +3,9 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<base href="../../">
<script type="text/javascript" src="lib/load.js"></script>
<script type="text/javascript" src="src/load.js"></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/paperscript" canvas="canvas">
var path;
function onMouseDown(event) {

View file

@ -3,9 +3,9 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<base href="../../">
<script type="text/javascript" src="lib/load.js"></script>
<script type="text/javascript" src="src/load.js"></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/paperscript" canvas="canvas">
var path;
var minSize = 5;

View file

@ -3,9 +3,9 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<base href="../../">
<script type="text/javascript" src="lib/load.js"></script>
<script type="text/javascript" src="src/load.js"></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/paperscript" canvas="canvas">
////////////////////////////////////////////////////////////////////////////////
// This script belongs to the following tutorial:

View file

@ -3,9 +3,9 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<base href="../../">
<script type="text/javascript" src="lib/load.js"></script>
<script type="text/javascript" src="src/load.js"></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/paperscript" canvas="canvas">
/////////////////////////////////////////////////////////////////////
// Values

View file

@ -3,9 +3,9 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<base href="../../">
<script type="text/javascript" src="lib/load.js"></script>
<script type="text/javascript" src="src/load.js"></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/paperscript" canvas="canvas">
tool.fixedDistance = 30;

View file

@ -3,9 +3,9 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<base href="../../">
<script type="text/javascript" src="lib/load.js"></script>
<script type="text/javascript" src="src/load.js"></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/paperscript" canvas="canvas">
//////////////////////////////////////////////////////////////////////
// Values

View file

@ -3,9 +3,9 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<base href="../../">
<script type="text/javascript" src="lib/load.js"></script>
<script type="text/javascript" src="src/load.js"></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/paperscript" canvas="canvas">
/////////////////////////////////////////////////////////////////////
// Values

View file

@ -1,56 +1,57 @@
var id = '?' + Math.random();
var id = '?' + Math.random(),
base = loadBase || '';
load(
'lib/bootstrap.js' + id,
'lib/parse-js.js' + id
base + 'lib/bootstrap.js' + id,
base + 'lib/parse-js.js' + id
).then(
'src/paper.js' + id
base + 'src/paper.js' + id
).then(
'src/basic/Point.js' + id,
'src/basic/Size.js' + id,
'src/basic/Rectangle.js' + id,
'src/basic/Matrix.js' + id,
'src/basic/Line.js' + id
base + 'src/basic/Point.js' + id,
base + 'src/basic/Size.js' + id,
base + 'src/basic/Rectangle.js' + id,
base + 'src/basic/Matrix.js' + id,
base + 'src/basic/Line.js' + id
).then(
'src/document/DocumentView.js' + id,
'src/document/Document.js' + id,
'src/document/Symbol.js' + id
base + 'src/document/DocumentView.js' + id,
base + 'src/document/Document.js' + id,
base + 'src/document/Symbol.js' + id
).then(
'src/item/Item.js' + id
base + 'src/item/Item.js' + id
).then(
'src/item/Group.js' + id,
'src/item/Raster.js' + id,
'src/item/PlacedSymbol.js' + id,
'src/item/PathStyle.js' + id,
'src/path/PathItem.js' + id,
'src/path/Segment.js' + id,
'src/path/Curve.js' + id
base + 'src/item/Group.js' + id,
base + 'src/item/Raster.js' + id,
base + 'src/item/PlacedSymbol.js' + id,
base + 'src/item/PathStyle.js' + id,
base + 'src/path/PathItem.js' + id,
base + 'src/path/Segment.js' + id,
base + 'src/path/Curve.js' + id
).then(
// Needs Group
'src/item/Layer.js' + id,
base + 'src/item/Layer.js' + id,
// Needs PathItem
'src/path/Path.js' + id,
'src/path/CompoundPath.js' + id
base + 'src/path/Path.js' + id,
base + 'src/path/CompoundPath.js' + id
).then(
'src/path/Path.Constructors.js' + id,
'src/color/Color.js' + id
base + 'src/path/Path.Constructors.js' + id,
base + 'src/color/Color.js' + id
).then(
'src/color/RGBColor.js' + id,
'src/color/GrayColor.js' + id,
'src/color/GradientColor.js' + id,
'src/color/Gradient.js' + id,
'src/color/GradientStop.js' + id
base + 'src/color/RGBColor.js' + id,
base + 'src/color/GrayColor.js' + id,
base + 'src/color/GradientColor.js' + id,
base + 'src/color/Gradient.js' + id,
base + 'src/color/GradientStop.js' + id
).then(
'src/tool/ToolEvent.js' + id,
'src/tool/ToolHandler.js' + id
base + 'src/tool/ToolEvent.js' + id,
base + 'src/tool/ToolHandler.js' + id
).then(
// Requires ToolHandler
'src/tool/Tool.js' + id,
'src/util/BlendMode.js' + id,
'src/util/CanvasProvider.js' + id,
'src/util/Numerical.js' + id,
'src/util/Events.js' + id
base + 'src/tool/Tool.js' + id,
base + 'src/util/BlendMode.js' + id,
base + 'src/util/CanvasProvider.js' + id,
base + 'src/util/Numerical.js' + id,
base + 'src/util/Events.js' + id
).then(
'src/util/PaperScript.js' + id
base + 'src/util/PaperScript.js' + id
).thenRun(
function() {
PaperScript.install();