Last change
on this file since 29468 was 29468, checked in by sjs49, 9 years ago |
Initial commit for editor.method.ac for flag design
|
-
Property svn:executable
set to
*
|
File size:
1.8 KB
|
Rev | Line | |
---|
[29468] | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
---|
| 2 | <html xmlns="http://www.w3.org/1999/xhtml" >
|
---|
| 3 | <head>
|
---|
| 4 | <title></title>
|
---|
| 5 | </head>
|
---|
| 6 | <body>
|
---|
| 7 |
|
---|
| 8 | <script type="text/javascript" src="embedapi.js"></script>
|
---|
| 9 | <script type="text/javascript">
|
---|
| 10 | var svgCanvas = null;
|
---|
| 11 |
|
---|
| 12 | function init_embed() {
|
---|
| 13 | var frame = document.getElementById('svgedit');
|
---|
| 14 | svgCanvas = new embedded_svg_edit(frame);
|
---|
| 15 |
|
---|
| 16 | // Hide main button, as we will be controlling new/load/save etc from the host document
|
---|
| 17 | var doc;
|
---|
| 18 | doc = frame.contentDocument;
|
---|
| 19 | if (!doc)
|
---|
| 20 | {
|
---|
| 21 | doc = frame.contentWindow.document;
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | var mainButton = doc.getElementById('main_button');
|
---|
| 25 | mainButton.style.display = 'none';
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | function handleSvgData(data, error) {
|
---|
| 29 | if (error)
|
---|
| 30 | {
|
---|
| 31 | alert('error ' + error);
|
---|
| 32 | }
|
---|
| 33 | else
|
---|
| 34 | {
|
---|
| 35 | alert('Congratulations. Your SVG string is back in the host page, do with it what you will\n\n' + data);
|
---|
| 36 | }
|
---|
| 37 | }
|
---|
| 38 |
|
---|
| 39 | function loadSvg() {
|
---|
| 40 | var svgexample = '<svg width="640" height="480" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg"><g><title>Layer 1</title><rect stroke-width="5" stroke="#000000" fill="#FF0000" id="svg_1" height="35" width="51" y="35" x="32"/><ellipse ry="15" rx="24" stroke-width="5" stroke="#000000" fill="#0000ff" id="svg_2" cy="60" cx="66"/></g></svg>';
|
---|
| 41 | svgCanvas.setSvgString(svgexample);
|
---|
| 42 | }
|
---|
| 43 |
|
---|
| 44 | function saveSvg() {
|
---|
| 45 | svgCanvas.getSvgString()(handleSvgData);
|
---|
| 46 | }
|
---|
| 47 | </script>
|
---|
| 48 |
|
---|
| 49 |
|
---|
| 50 | <button onclick="loadSvg();">Load example</button>
|
---|
| 51 | <button onclick="saveSvg();">Save data</button>
|
---|
| 52 | <br/>
|
---|
| 53 |
|
---|
| 54 | <iframe src="index.html" width="900px" height="600px" id="svgedit" onload="init_embed()"></iframe>
|
---|
| 55 | </body>
|
---|
| 56 | </html>
|
---|
Note:
See
TracBrowser
for help on using the repository browser.