1 var svgeditor_path
= 'http://svg-edit.googlecode.com/svn/branches/stable/editor/'; //online stable
2 //var svgeditor_path = 'http://svg-edit.googlecode.com/svn/trunk/editor/'; //online latest (unstable)
3 //var svgeditor_path = DOKU_BASE+'lib/plugins/svgedit/svg-edit/'; //offline
6 var head
= document
.getElementsByTagName("head")[0];
7 script
= document
.createElement('script');
8 script
.type
= 'text/javascript';
9 script
.src
= svgeditor_path
+ 'embedapi.js';
10 head
.appendChild(script
);
12 function svgedit_load() {
13 var field
= $('wiki__text');
16 var timeout
= setTimeout('svgedit_load();', 500); //load ASAP
17 window
.svgedit
.setSvgString(field
.value
) (function(a
) {
18 clearTimeout(timeout
);
22 function svgedit_save(page
) {
23 window
.svgedit
.getSvgString()(function(data
) {
24 var field
= $('wiki__text');
26 field
.value
= data
; if (page
) {
27 field
= $('edbtn__save'); field
.click();}
32 function showhide(elem
) {
33 elem
.style
.display
= (elem
.style
.display
== 'none' ? '' : 'none');
36 function insertAfter(newNode
, preNode
) {
37 if (preNode
.nextSibling
)
38 preNode
.parentNode
.insertBefore(newNode
, preNode
.nextSibling
);
40 preNode
.parentNode(newNode
);
44 function svgedit_init() {
45 var field
= $('wiki__text');
51 showhide($('tool__bar'));
52 showhide($('edbtn__save'));
60 var el
= document
.createElement('iframe');
61 el
.setAttribute("src", svgeditor_path
+ 'svg-editor.html');
62 el
.setAttribute("id", "svg__edit");
63 el
.setAttribute("name", "svg__edit");
64 el
.setAttribute("frameborder", "0");
65 el
.setAttribute("width", "100%");
66 el
.setAttribute("height", "70%");
67 el
.setAttribute("style", "min-height: 400px;");
68 insertAfter(el
, field
);
71 field
= $('edbtn__save');
74 el
= document
.createElement('input');
75 el
.setAttribute("type", "button");
76 el
.setAttribute("onclick", "svgedit_save(true)");
77 el
.setAttribute("value", "SVG-SAVE");
78 el
.setAttribute("title", "Save SVG to server");
79 el
.setAttribute("class", "button");
80 field
.parentNode
.insertBefore(el
, field
);
82 el
= document
.createElement('input');
83 el
.setAttribute("type", "button");
84 el
.setAttribute("onclick", "svgedit_load()");
85 el
.setAttribute("value", "TXT->SVG");
86 el
.setAttribute("title", "Copy SVG from textarea to svg-editor");
87 el
.setAttribute("class", "button");
88 field
.parentNode
.insertBefore(el
, field
);
90 el
= document
.createElement('input');
91 el
.setAttribute("type", "button");
92 el
.setAttribute("onclick", "svgedit_save()");
93 el
.setAttribute("value", "SVG->TXT");
94 el
.setAttribute("title", "Copy SVG from svg-editor to textarea");
95 el
.setAttribute("class", "button");
96 field
.parentNode
.insertBefore(el
, field
);
99 window
.svgedit
= new embedded_svg_edit($('svg__edit'));
105 addInitEvent(function() {
106 if (!$('wiki__text') || $('wiki__text').readOnly
) return;
107 var field
= $('tool__bar');
109 field
.style
.float = 'left';
110 var el
= document
.createElement('button');
111 el
.setAttribute("id", "TZT");
112 el
.setAttribute("class", "toolbutton");
113 el
.setAttribute("onclick", "svgedit_init();");
114 el
.setAttribute("title", "Edit this page as SVG!");
115 el
.setAttribute("style", "float: left;");
116 field
.parentNode
.insertBefore(el
, field
);
117 el
.appendChild(document
.createTextNode("SVG"));
118 var el
= document
.createElement('br');
119 el
.setAttribute('style', "clear: left;");
120 field
.appendChild(el
);}) ;
This page took 0.367757 seconds and 5 git commands to generate.