From def5406396f26475a7c2280cbcc7607a89f1af4b Mon Sep 17 00:00:00 2001 From: aurium Date: Wed, 25 Mar 2009 13:48:39 +0000 Subject: [PATCH] initial version of inkweb.js for web-transmit-att effect, and others. --- share/extensions/inkweb.js | 50 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 share/extensions/inkweb.js 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 . +*/ + +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 ); +} -- 2.30.2