summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAur??lio A. Heckert <aurium@gmail.com>2009-03-25 13:48:39 +0000
committeraurium <aurium@users.sourceforge.net>2009-03-25 13:48:39 +0000
commit7a66f52fc07240f5b850ea698fbaf83f36bf02f2 (patch)
treee71c4599a414cfaa90d1b58bcdcaed6e87afa9fb
parentcorrect labels (diff)
downloadinkscape-7a66f52fc07240f5b850ea698fbaf83f36bf02f2.tar.gz
inkscape-7a66f52fc07240f5b850ea698fbaf83f36bf02f2.zip
initial version of inkweb.js for web-transmit-att effect, and others.
(bzr r7557)
-rw-r--r--share/extensions/inkweb.js50
1 files changed, 50 insertions, 0 deletions
diff --git a/share/extensions/inkweb.js b/share/extensions/inkweb.js
new file mode 100644
index 000000000..d398d5f50
--- /dev/null
+++ b/share/extensions/inkweb.js
@@ -0,0 +1,50 @@
+/*
+** InkWeb - Inkscape's Javscript features for the open vector web
+**
+** Copyright (C) 2009 Aurelio A. Heckert, aurium (a) gmail dot com
+**
+** This program is free software: you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation, either version 3 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+var InkWeb = {
+
+ version: 0.01,
+
+ NS: {
+ svg: "http://www.w3.org/2000/svg",
+ sodipodi: "http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd",
+ inkscape: "http://www.inkscape.org/namespaces/inkscape",
+ cc: "http://creativecommons.org/ns#",
+ dc: "http://purl.org/dc/elements/1.1/",
+ rdf: "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
+ xlink: "http://www.w3.org/1999/xlink",
+ xml: "http://www.w3.org/XML/1998/namespace"
+ }
+
+};
+
+InkWeb.transmitAtt = function (conf) {
+ if ( typeof(conf.from) == "string" )
+ conf.from = document.getElementById(conf.from);
+ if ( typeof(conf.to) == "string" )
+ conf.to = document.getElementById(conf.to);
+ var s = conf.from.getAttribute("style")
+ var re = new RegExp("(^|.*;)[ ]*"+conf.att+":([^;]*)(;.*|$)")
+ if ( re.test(s) ) {
+ var val = s.replace( re, "$2" );
+ } else {
+ var val = conf.from.getAttribute(conf.att);
+ }
+ conf.to.setAttribute( conf.att, val );
+}