Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
106 lines (85 sloc) 3.37 KB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>PaintWeb simple demo</title>
<link rel="author" type="text/html" href="http://www.robodesign.ro"
title="Marius and Mihai Şucan, ROBO Design">
<!-- $URL: http://code.google.com/p/paintweb $
$Date: 2010-06-26 22:58:27 +0300 $ -->
</head>
<body>
<h1>PaintWeb simple demo</h1>
<p>This is a demonstration page showing an image you can edit using <a
href="http://code.google.com/p/paintweb">PaintWeb</a>.</p>
<p><a title="Freshalicious"
href="http://www.robodesign.ro/marius/my-projects/images/freshalicious"><img
id="editableImage" src="freshalicious.jpg" alt="Freshalicious"></a></p>
<p><button id="buttonEditImage">Edit image!</button></p>
<div id="PaintWebTarget"></div>
<p>Do you have any feedback to provide? Please <a
href="http://groups.google.com/group/paintweb">post it in the public
mailing list</a>!</p>
<!--[if lte IE 8]>
<p>Please note that this application does not work in Internet Explorer
8. Please try this in Internet Explorer 9, or use any other modern web
browser: <a href="http://www.google.com/chrome">Chrome</a>, <a
href="http://www.mozilla.com">Firefox</a>, <a
href="http://www.apple.com/safari">Safari</a>, <a
href="http://www.opera.com">Opera</a> or <a
href="http://www.konqueror.org">Konqueror</a>.</p>
<![endif]-->
<script type="text/javascript" src="../build/paintweb.js"></script>
<script type="text/javascript"><!--
(function () {
// Function called when the user clicks the "Edit image" button.
function pwStart () {
document.body.insertBefore(loadp, btn.parentNode);
timeStart = (new Date()).getTime();
pw.init(pwInit);
};
// Function called when the PaintWeb application fires the "appInit" event.
function pwInit (ev) {
var initTime = (new Date()).getTime() - timeStart,
str = 'Demo: Yay, PaintWeb loaded in ' + initTime + ' ms! ' +
pw.toString();
document.body.removeChild(loadp);
if (ev.state === PaintWeb.INIT_ERROR) {
alert('Demo: PaintWeb initialization failed.');
return;
} else if (ev.state === PaintWeb.INIT_DONE) {
if (window.console && console.log) {
console.log(str);
} else if (window.opera) {
opera.postError(str);
}
} else {
alert('Demo: Unrecognized PaintWeb initialization state ' + ev.state);
return;
}
img.style.display = 'none';
btn.style.display = 'none';
};
var img = document.getElementById('editableImage'),
btn = document.getElementById('buttonEditImage'),
target = document.getElementById('PaintWebTarget'),
loadp = document.createElement('p'),
timeStart = null,
// Create a PaintWeb instance.
pw = new PaintWeb();
pw.config.guiPlaceholder = target;
pw.config.imageLoad = img;
pw.config.configFile = 'config-example.json';
loadp.appendChild(document.createTextNode('Loading, please wait...'));
if (btn.addEventListener) {
btn.addEventListener('click', pwStart, false);
} else if (btn.attachEvent) {
btn.attachEvent('onclick', pwStart);
} else {
btn.onclick = pwStart;
}
})();
--></script>
</body>
<!-- vim:set spell spl=en fo=tcroqwanl1 tw=80 ts=2 sw=2 sts=2 sta et ai cin fenc=utf-8 ff=unix: -->
</html>