Index: app/controllers/repositories_controller.rb
===================================================================
--- app/controllers/repositories_controller.rb (revision 2980)
+++ app/controllers/repositories_controller.rb (working copy)
@@ -249,6 +249,7 @@
:scale_integers => true,
:step_x_labels => 2,
:show_data_values => false,
+ :no_css => true,
:graph_title => l(:label_commits_per_month),
:show_graph_title => true
)
@@ -292,6 +293,7 @@
:scale_integers => true,
:show_data_values => false,
:rotate_y_labels => false,
+ :no_css => true,
:graph_title => l(:label_commits_per_author),
:show_graph_title => true
)
Index: app/views/repositories/stats.rhtml
===================================================================
--- app/views/repositories/stats.rhtml (revision 2980)
+++ app/views/repositories/stats.rhtml (working copy)
@@ -1,12 +1,17 @@
<%= l(:label_statistics) %>
-<%= tag("embed", :width => 800, :height => 300, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :graph => "commits_per_month")) %>
+<%= content_tag("object", "", :width => 800, :height => 300, :type => "image/svg+xml", :data => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :graph => "commits_per_month")) %>
-<%= tag("embed", :width => 800, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :graph => "commits_per_author")) %>
+<%= content_tag("object", "", :width => 800, :height => 400, :type => "image/svg+xml", :data => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :graph => "commits_per_author")) %>
<%= link_to l(:button_back), :action => 'show', :id => @project %>
<% html_title(l(:label_repository), l(:label_statistics)) -%>
+
+
+<% content_for :header_tags do %>
+ <%= javascript_include_tag 'sie', :defer => "defer" %>
+<% end %>
Index: public/javascripts/sie.js
===================================================================
--- public/javascripts/sie.js (revision 0)
+++ public/javascripts/sie.js (revision 0)
@@ -0,0 +1,1969 @@
+/*SIE-SVG without Plugin under LGPL2.1 & GPL2.0 & Mozilla Public Lisence
+ *公式ページは http://sie.sourceforge.jp/
+ *利用方法は
+ */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the Mozilla SVG Cairo Renderer project.
+ *
+ * The Initial Developer of the Original Code is IBM Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2004
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Parts of this file contain code derived from the following files(s)
+ * of the Mozilla SVG project (these parts are Copyright (C) by their
+ * respective copyright-holders):
+ * layout/svg/renderer/src/libart/nsSVGLibartBPathBuilder.cpp
+ *
+ * Contributor(s):DHRNAME revulo
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+//これを頭に付けたら、内部処理用
+var NAIBU = {};
+//documentを速くするために
+/*@cc_on _d=document;eval('var document=_d')@*/
+//bookmarkletから呼び出されたらtrue
+var sieb_s;
+
+//svgtovml load時に、最初に起動する関数
+function svgtovml() {
+ //IEだったらtrueを返す
+ var isMSIE = /*@cc_on!@*/false;
+ //引数にtrueがあれば、例外処理のログを作動させる
+ stlog = new STLog(false);
+ var ary = document.getElementsByTagName("script");
+ //全script要素をチェックして、type属性がimage/svg+xmlならば、中身をSVGとして処理する
+ for (var i=0; i < ary.length; i++) {
+ var hoge = ary[i].type;
+ if (ary[i].type === "image/svg+xml") {
+ var ait = ary[i].text;
+ if (sieb_s && ait.match(/<svg/)) {
+ //ソース内のタグを除去
+ ait = ait.replace(/<.+?>/g, "");
+ //エンティティを文字に戻す
+ ait = ait.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/&/g, "&");
+ }
+ if (isMSIE) {
+ setVMLNameSpace();
+ var da = {};
+ da.obj = []; da.obj[i] = ary[i]; da.num = i + 1; da.content = ait.replace(/\shref=/g, " target='_top' xlink:href="); da.success = true;
+ ca(da);
+ } else {
+ var base = location.href.replace(/\/[^\/]+?$/,"/"); //URIの最後尾にあるファイル名は消す。例: /n/sie.js -> /n/
+ ait = ait.replace(/\shref=(['"a-z]+?):\/\//g, " target='_top' xlink:href=$1://").replace(/\shref=(.)/g, " target='_top' xlink:href=$1"+base);
+ var s = textToSVG(ait,ary[i].getAttribute("width"),ary[i].getAttribute("height"));
+ ary[i].parentNode.insertBefore(s,ary[i]);
+ }
+ }
+ }
+ NAIBU.STObject = new Objectembeds();
+ if (isMSIE) {
+ setVMLNameSpace();
+ var oba = document.createElement("div");
+ oba.setAttribute("id","_NAIBU_outline");
+ document.body.appendChild(oba);
+ NAIBU.STObject.next();
+ success = true;
+ } else if (/a/[-1] === 'a'){ //Firefoxだったらtrueを返す
+ NAIBU.STObject.ffnext();
+ }
+}
+//他のページに移動する際に起動
+function unsvgtovml() {
+ NAIBU = stlog = STLog = null;
+}
+
+//vmlの名前空間をセット(必須)
+function setVMLNameSpace() {
+ if (!document.namespaces["v"]) {
+ document.namespaces.add("v","urn:schemas-microsoft-com:vml");
+ document.namespaces.add("o","urn:schemas-microsoft-com:office:office");
+ var st = document.createStyleSheet();
+ var vmlUrl = "behavior: url(#default#VML);display:inline-block;} "; //inline-blockはIEのバグ対策
+ st.cssText = "v\\:rect{" +vmlUrl+ "v\\:image{" +vmlUrl+ "v\\:fill{" +vmlUrl+ "v\\:stroke{" +vmlUrl+ "o\\:opacity2{" +vmlUrl
+ + "dn\\:defs{display:none}"
+ + "v\\:group{text-indent:0px;position:relative;width:100%;height:100%;" +vmlUrl
+ + "v\\:shape{width:100%;height:100%;" +vmlUrl;
+ }
+}
+
+//windowに指定したイベントと関数を追加
+NAIBU.addEvent = function(evt,lis){
+ if (window.addEventListener) {
+ window.addEventListener(evt, lis, false);
+ } else if (window.attachEvent) {
+ window.attachEvent('on'+evt, lis);
+ } else {
+ window['on'+evt] = lis;
+ }
+}
+NAIBU.addEvent("load",svgtovml);
+NAIBU.addEvent("unload",unsvgtovml);
+
+//以下は例外処理のログをとるためのもの。開発者以外は削除すること
+function STLog(jou) {
+this.jo = jou;
+if (this.jo) {
+ this.p = document.createElement("div");
+ this.p.innerHTML = "例外処理のログ ";
+ document.body.insertBefore(this.p,document.body.firstChild);
+}
+ return this;
+}
+STLog.prototype.add = function(e,code) {
+if (this.jo) {
+ this.p.innerHTML += ""+code+":"+e.message+"
";
+}
+}
+
+//SVGtoVML 本体。SVGDocumentの代わりを担う
+//object要素の幅と高さがwとh(単位はpxに統一)。svg要素の幅と高さがswi.valueとshi.value。svg要素にwidth属性が指定されていない場合、swi.value=wである。
+function SVGtoVML( /*element*/ obc, /*float*/ w, /*float*/ h, /*STLength*/ swi, /*STLength*/ shi) {
+ this.rootElement = obc; this.w = w; this.h = h; this.swi = swi; this.shi = shi;
+ return this;
+}
+SVGtoVML.prototype.read = function stvread(/*element*/ ob) {
+ this.rootElement.style.visibility = "hidden";
+ this.vi = new STViewSpec(this.rootElement);
+ try{
+ this.children = []; //子要素
+ var sw = this.swi.value, sh = this.shi.value;
+ this.getObject("USE", STUseElement, "use", sw, sh); //use要素を先に処理
+ var mat = this.vi.set(sw, sh, ob); //返り値はMatrix型
+ this.chset(this.rootElement, mat, sw, sh);
+ } catch(n) {stlog.add(n,109);}
+}
+SVGtoVML.prototype.getObject = function stvgetob( /*string*/ tag, /*object*/ st, /*string*/nodes, /*float*/w, h) {
+ try {
+ var li = this.rootElement.getElementsByTagName(tag);
+ var la = [];
+ for (var i=0,lli=li ? li.length : 0;i sw ? sw : w, viewHeight = h > sh ? sh : h; //ウィンドウ枠の長さを決定する
+ var bfl = parseFloat(backrs.left), bft = parseFloat(backrs.top);
+ var bl = -this.vi._tx, bt = -this.vi._ty;
+ if (bfl !== 0 && !isNaN(bfl)) { //内部の図形にずれが生じたとき(isNaNはIE8でautoがデフォルト値のため)
+ bl = bfl;
+ tpstyle.left = -bl+ "px";
+ }
+ if (bft !== 0 && !isNaN(bfl)) {
+ bt = bft;
+ tpstyle.top = -bt+ "px";
+ }
+ var backright = bl + viewWidth + 1;
+ var backdown = bt + viewHeight + 1;
+ trstyle.clip = "rect(" +bt+ "px " +backright+ "px " +backdown+ "px " +bl+ "px)";
+ //以下、テキストの位置を修正
+ var text = this.rootElement.getElementsByTagName("div");
+ for (var i=0,textli=text.length;i 3) { //MoveToが複数の座標ならば、2番目以降の座標ペアをLineToとして処理
+ F.splice(3, 0, "l");
+ }
+ }
+ dat += F.join(" ");
+ F = null;
+ }
+ D = dd = Fli = null; //解放
+ } catch(e) {if(this.d == ""){/*d属性が空*/}else{stlog.add(e,355);}}
+ try {
+ var ele = this.tar;
+ ele.path = dat + " e";
+ ele.coordsize = w + " " + h;
+ this.paint.set(w, h, ttm);
+ dat = this.paint = ttm = this.transformable = this.d = preCom = x = y = x0 = y0 = dx = dy = tma = tmb = tmc = tmd = tme = tmf = w = h = null; //解放
+ } catch(e) {stlog.add(e,372);}
+};
+
+//QからCに変換
+NAIBU.qtoc = function (/*float*/ x, /*float*/ y, /*Array*/ F) {
+ F[0] = "c";
+ for (var i = 1; i < F.length; i += 6) {
+ var x1 = F[i], y1 = F[i+1], x2 = F[i+2], y2 = F[i+3];
+ F.splice(i, 2, (x + 2 * x1) / 3, (y + 2 * y1) / 3, (2 * x1 + x2) / 3, (2 * y1 + y2) / 3);
+ x = x2; y = y2;
+ }
+ return F;
+}
+
+//前回の座標を反転させる。それを挿入
+NAIBU.nst = function ( /*int*/ skip, /*Array*/ F, /*float*/ x1, /*float*/ y1) {
+ F.splice(1, 0, x1, y1);
+ for (var i = skip+1; i < F.length; i += skip) {
+ x1 = 2 * F[i-2] - F[i-4];
+ y1 = 2 * F[i-1] - F[i-3];
+ F.splice(i, 0, x1, y1);
+ }
+ return F;
+}
+
+//相対座標を絶対座標に変換
+NAIBU.reltoabs = function (/*float*/ x, /*float*/ y, /*Array*/ F) {
+ var skip = 2;
+ if (F[0] === "c") {
+ skip = 6;
+ } else if (F[0] === "q") {
+ skip = 4;
+ }
+ for (var i = 1, Fli = F.length; i < Fli; i += 2) {
+ F[i] += x; F[i+1] += y;
+ if ((i+1) % skip === 0) {
+ x = F[i]; y = F[i+1];
+ }
+ }
+ return F;
+}
+
+//polygon要素を処理
+function STPolygon( /*element*/ ele, /*Matrix*/ matrix) {
+ this.tar = ele;
+ this.points = ele.attributes["points"].nodeValue;
+ this.paint = new NAIBU.PaintColor(ele);
+ this.transformable = NAIBU.transformToCTM(ele,matrix);
+ return this;
+}
+STPolygon.prototype.set = function polygonset(w,h) {
+ var dat;
+ var ttm = this.transformable;
+ try {
+ var F = this.points.replace(/^\s+|\s+$/g, "").split(/[\s,]+/);
+ var pl = new PList(F);
+ var plm = pl.matrixTransform(ttm);
+ plm.list.splice(2, 0, "l");
+ dat = "m" + plm.list.join(" ") + "x e";
+ } catch(e) {stlog.add(e,395);}
+ try {
+ var ele = this.tar;
+ ele.path = dat;
+ ele.coordsize = w + " " + h;
+ this.paint.set(w, h, ttm);
+ } catch(e) {stlog.add(e,406);}
+}
+
+//polyline要素を処理
+function STPolyline( /*element*/ ele, /*Matrix*/ matrix) {
+ this.tar = ele;
+ this.points = ele.attributes["points"].nodeValue;
+ this.paint = new NAIBU.PaintColor(ele);
+ this.transformable = NAIBU.transformToCTM(ele,matrix);
+ return this;
+}
+STPolyline.prototype.set = function polylineset(w,h) {
+ var dat;
+ var ttm = this.transformable;
+ try {
+ var F = this.points.replace(/^\s+|\s+$/g, "").split(/[\s,]+/);
+ var pl = new PList(F);
+ var plm = pl.matrixTransform(ttm);
+ plm.list.splice(2, 0, "l");
+ dat = "m" + plm.list.join(" ") + "e";
+ } catch(e) {stlog.add(e,429);}
+ try {
+ var ele = this.tar;
+ ele.path = dat;
+ ele.coordsize = w + " " + h;
+ this.paint.set(w, h, ttm);
+ } catch(e) {stlog.add(e,440);}
+}
+
+//circle要素を処理
+function STCircle( /*element*/ ele, /*Matrix*/ matrix, /*float*/w, h) {
+ this.tar = ele;
+ try {
+ this.cx = new STLength((ele.getAttribute("cx") || 0), w);
+ this.cy = new STLength((ele.getAttribute("cy") || 0), h);
+ this.r = new STLength(ele.getAttribute("r"));
+ this.paint = new NAIBU.PaintColor(ele);
+ this.transformable = NAIBU.transformToCTM(ele,matrix);
+ w = h = null;
+ } catch(e) {stlog.add(e,450);}
+ return this;
+}
+//ベジェ曲線で円を表現する
+STCircle.prototype.set = function ovalset(w,h) {
+ var cx = this.cx.value, cy = this.cy.value, rx = ry = this.r.value;
+ var top = cy - ry, left = cx - rx, bottom = cy + ry, right = cx + rx;
+ try {
+ var ttm = this.transformable;
+ var rrx = rx * 0.55228, rry = ry * 0.55228;
+ var list = ["m", cx,top, "c", cx-rrx,top, left,cy-rry, left,cy, left,cy+rry, cx-rrx,bottom, cx,bottom, cx+rrx,bottom, right,cy+rry, right,cy, right,cy-rry, cx+rrx,top, cx,top, "x e"];
+ var pl = new PList(list);
+ var plm = pl.matrixTransform(ttm);
+ var dat = plm.list.join(" ");
+ } catch(e) {stlog.add(e,468);}
+ try {
+ var ele = this.tar;
+ ele.path = dat;
+ ele.coordsize = w + " " + h;
+ this.paint.set(w, h, ttm);
+ dat = list = pl = plm = this.paint = ttm = this.transformable = w = h = null; //解放
+ } catch(e) {stlog.add(e,479);}
+}
+
+//ellipse要素を処理
+function STEllipse( /*element*/ ele, /*Matrix*/ matrix, /*float*/w, h) {
+ this.tar = ele;
+ try {
+ this.cx = new STLength((ele.getAttribute("cx") || 0), w);
+ this.cy = new STLength((ele.getAttribute("cy") || 0), h);
+ this.rx = new STLength(ele.getAttribute("rx"), w);
+ this.ry = new STLength(ele.getAttribute("ry"), h);
+ this.paint = new NAIBU.PaintColor(ele);
+ this.transformable = NAIBU.transformToCTM(ele,matrix);
+ w = h = null;
+ } catch(e) {stlog.add(e,490);}
+ return this;
+}
+STEllipse.prototype.set = function elliset(w,h) {
+ var cx = this.cx.value, cy = this.cy.value, rx = this.rx.value, ry = this.ry.value;
+ var top = cy - ry, left = cx - rx, bottom = cy + ry, right = cx + rx;
+ try {
+ var ttm = this.transformable;
+ var rrx = rx * 0.55228, rry = ry * 0.55228;
+ var list = ["m", cx,top, "c", cx-rrx,top, left,cy-rry, left,cy, left,cy+rry, cx-rrx,bottom, cx,bottom, cx+rrx,bottom, right,cy+rry, right,cy, right,cy-rry, cx+rrx,top, cx,top, "x e"];
+ var pl = new PList(list);
+ var plm = pl.matrixTransform(ttm);
+ var dat = plm.list.join(" ");
+ } catch(e) {stlog.add(e,508);}
+ try {
+ var ele = this.tar;
+ ele.path = dat;
+ ele.coordsize = w + " " + h;
+ this.paint.set(w, h, ttm);
+ dat = list = pl = plm = this.paint = ttm = this.transformable = w = h = null; //解放
+ } catch(e) {stlog.add(e,519);}
+}
+
+//rect要素を処理
+function STRectElement( /*element*/ rect, /*Matrix*/ matrix, /*float*/ w, h) {
+ this.tar = rect;
+ try {
+ this.x = new STLength((rect.getAttribute("x") || 0), w);
+ this.y = new STLength((rect.getAttribute("y") || 0), h);
+ this.width = new STLength(rect.getAttribute("svgwidth"), w);
+ this.height = new STLength(rect.getAttribute("svgheight"), h);
+ var rx = rect.getAttribute("rx"), ry = rect.getAttribute("ry");
+ if (rx || ry) {
+ this.rx = new STLength((rx || ry), w);
+ this.ry = new STLength((ry || rx), h);
+ if (this.rx.value > this.width.value / 2) { //rx属性が幅より大きければ、幅の半分を属性に設定
+ this.rx.value = this.width.value / 2;
+ }
+ if (this.ry.value > this.height.value / 2) {
+ this.ry.value = this.height.value / 2;
+ }
+ }
+ this.paint = new NAIBU.PaintColor(rect);
+ this.transformable = NAIBU.transformToCTM(rect,matrix);
+ w = h = rx = ry = null;
+ } catch(ee) {stlog.add(ee,545);}
+ return this;
+}
+STRectElement.prototype.set = function rectset(w,h) {
+ try {
+ var x = this.x.value, y = this.y.value, xw = x + this.width.value, yh = y + this.height.value;
+ var list;
+ if (this.rx) {
+ var rx = this.rx.value, ry = this.ry.value;
+ var rrx = rx * 0.55228, rry = ry * 0.55228;
+ var a = xw - rx, b = x + rx, c = y + ry, d = yh - ry;
+ list = ["m",b,y, "l",a,y, "c",a+rrx,y,xw,c-rry,xw,c, "l",xw,d, "c",xw,d+rry,a+rrx,yh,a,yh, "l",b,yh, "c",b-rrx,yh,x,d+rry,x,d, "l",x,c, "c",x,c-rry,b-rrx,y,b,y];
+ } else {
+ list = ["m",x,y, "l",x,yh, xw,yh, xw,y, "x e"];
+ }
+ var ttm = this.transformable;
+ var pl = new PList(list);
+ var plm = pl.matrixTransform(ttm);
+ var dat = plm.list.join(" ");
+ } catch(e) {stlog.add(e,564);}
+ try {
+ var ele = this.tar;
+ ele.path = dat;
+ ele.coordsize = w + " " + h;
+ this.paint.set(w, h, ttm);
+ dat = list = pl = plm = this.paint = ttm = this.transformable = w = h = null; //解放
+ } catch(ee) {stlog.add(ee,576);}
+}
+
+//image要素の処理
+function STImage( /*element*/ ele, /*Matrix*/ matrix, /*float*/w, h){
+ this.tar = ele;
+ this.x = new STLength((ele.getAttribute("x") || 0), w);
+ this.y = new STLength((ele.getAttribute("y") || 0), h);
+ this.width = new STLength(ele.getAttribute("svgwidth"), w);
+ this.height = new STLength(ele.getAttribute("svgheight"), h);
+ ele.setAttribute("xlink:show", "embed");
+ this.xlink = new NAIBU.XLink(ele);
+ this.paint = new NAIBU.PaintColor(ele);
+ this.transformable = NAIBU.transformToCTM(ele,matrix);
+ w = h = null
+ return this;
+}
+STImage.prototype.set = function imagesets(w,h){
+ try {
+ var ttm = this.transformable;
+ var ts = this.tar.style;
+ ts.position = "absolute";
+ var pt = new Point(this.x.value, this.y.value);
+ var ptt = pt.matrixTransform(ttm);
+ ts.left = ptt.x+ "px";
+ ts.top = ptt.y+ "px";
+ ts.width = this.width.value * ttm.a+ "px";
+ ts.height = this.height.value * ttm.d+ "px";
+ if (ttm.b !== 0 || ttm.c !== 0 || this.paint.fillopacity != 1) {//フィルター プロパティを使うと、PNGの透過性がなくなるので注意
+ ts.filter = "progid:DXImageTransform.Microsoft.Matrix progid:DXImageTransform.Microsoft.Alpha";
+ var ttfi = this.tar.filters.item('DXImageTransform.Microsoft.Matrix');
+ ttfi.M11 = 1;
+ ttfi.M12 = ttm.b;
+ ttfi.M21 = ttm.c;
+ ttfi.M22 = 1;
+ ttfi.sizingMethod = "auto expand";
+ var ttfia = this.tar.filters.item('DXImageTransform.Microsoft.Alpha');
+ ttfia.Style = 0;
+ ttfia.Opacity = parseFloat(this.paint.fillopacity)*100;
+ }
+ this.xlink.set();
+ dat = pt = this.xlink = this.paint = ttm = this.transformable = w = h = null; //解放
+ } catch(e) {stlog.set(e,21896);}
+}
+
+/*use要素の処理*/
+function STUseElement( /*element*/ ele, /*float*/w, h){
+ this.tar = ele;
+ var tns = ele.nextSibling;
+ tns.setAttribute("xlink:show", "embed")
+ this.x = new STLength((tns.getAttribute("x") || 0), w);
+ this.y = new STLength((tns.getAttribute("y") || 0), h);
+ this.width = new STLength(tns.getAttribute("svgwidth"), w);
+ this.height = new STLength(tns.getAttribute("svgheight"), h);
+ this.xlink = new NAIBU.XLink(tns);
+ var ts = tns.getAttribute("transform") || "";
+ this.xlink.set();
+ tns.setAttribute("transform", ts+ " translate(" +this.x.value+ "," +this.y.value+ ")");
+ tns.firstChild.setAttribute("id","");
+ tns.coordorgin = "0 0";
+ this.paint = new NAIBU.PaintColor(this.xlink.resource);
+ this.paint.tar = tns;
+ w = h = null;
+ return this;
+}
+STUseElement.prototype.set = function(){
+ try {
+ this.paint.setStyle();
+ this.paint = this.xlink = null;
+ } catch(e) {stlog.add(e,85436);}
+}
+
+//色のキーワード
+//PaintColor 色、線などをすべてコントロール
+NAIBU.PaintColor = function( /*element*/ ele) {
+if (ele) {
+ this.tar = ele;
+ var defaults = this.defaults;
+ var parent = this.getParent(ele); //親要素のPaintColorオブジェクト
+ if (parent) {
+ for (var name in defaults) {
+ if (defaults.hasOwnProperty(name)) {
+ if (name === "opacity") {
+ this[name] = (this.getAttribute(name) || 1) * parent[name]; //親要素のopacityを掛け合わせる
+ } else {
+ this[name] = this.getAttribute(name) || parent[name]; //指定がなければ親要素の値を継承
+ if (this[name] === "inherit") { //値がinheritなら親のを継承
+ this[name] = parent[name];
+ } else if (this[name] === "currentColor") {
+ this[name] = this.getAttribute("color") || parent.getAttribute("color");
+ }
+ }
+ }
+ name = null;
+ }
+ } else {
+ for (var name in defaults) {
+ this[name] = this.getAttribute(name) || defaults[name]; //指定がなければデフォルト値に設定
+ name = null;
+ }
+ }
+}
+ return this;
+};
+//デフォルト値のリスト
+NAIBU.PaintColor.prototype.defaults = {
+ fill: "black",
+ fillopacity: 1,
+ stroke: "none",
+ strokewidth: "1",
+ strokelinecap: "butt",
+ strokelinejoin: "miter",
+ strokemiterlimit: "4",
+ strokedasharray: "none",
+ strokeopacity: 1,
+ opacity: 1,
+ cursor: "default"
+};
+//キャッシュ用
+NAIBU.PaintColor.prototype.cache = {};
+//親コンテナ要素のPaintColorオブジェクトを返す
+NAIBU.PaintColor.prototype.getParent = function( /*element*/ ele) {
+ var parent = ele.parentNode;
+ if (parent.tagName !== "group" && parent.tagName !== "A") {
+ return null;
+ } else {
+ var cache = this.cache;
+ var id = parent.uniqueID;
+ if (!cache[id]) {
+ cache[id] = new NAIBU.PaintColor(parent);
+ }
+ return cache[id];
+ }
+};
+NAIBU.PaintColor.prototype.getAttribute = function ( /*string*/ name) {
+ try {
+ var element = this.tar;
+ var style = element.style[name];
+ if (style) {
+ return style;
+ }
+ var attribute = element.attributes[name];
+ var s = attribute ? attribute.nodeValue : null;
+ return s;
+ } catch(e) {stlog.add(e,659); return null;}
+};
+//内部プロパティを、styleに設定する
+NAIBU.PaintColor.prototype.setStyle = function() {
+ try {
+ var tst = this.tar
+ for (var i in this) {
+ if ((typeof this[i]) === "string") { //string型以外は除く
+ tst.style[i] = this[i];
+ }
+ }
+ } catch(e) {stlog.add(e,899); return "";}
+};
+NAIBU.PaintColor.prototype._urlreg = /url\(#([^)]+)/;
+NAIBU.PaintColor.prototype.set = function (/*float*/ w, /*float*/ h, /*Matrix*/ matrix) {
+ var el = this.tar;
+ if (this.fill === "none") {
+ el.filled = "false";
+ } else {
+ var fillElement = document.createElement("v:fill");
+ var isRadial = false;
+ try {
+ if (this._urlreg.test(this.fill)) { //fill属性の値がurl(#id)ならば、idを設定したグラデーション関連要素を呼び出す
+ this.w = w; this.h = h; //radialGradientで必要
+ isRadial = this.gradient(fillElement, RegExp.$1, matrix);
+ } else {
+ fillElement.setAttribute("color", this.color(this.fill));
+ var fillOpacity = this.fillopacity * this.opacity; //opacityを掛け合わせる
+ if (fillOpacity < 1) {
+ fillElement.setAttribute("opacity", fillOpacity);
+ }
+ }
+ } catch(e) {stlog.add(e,682); fillElement.on = "true";
+ fillElement.color = "black";}
+ if (!isRadial) {
+ el.appendChild(fillElement);
+ }
+ isRadial = fillOpacity = null;
+ }
+ if (this.stroke === "none") {
+ el.stroked = "false";
+ } else {
+ var strokeElement = document.createElement("v:stroke");
+ try {
+ var sw = new STLength(this.strokewidth, Math.sqrt((w*w + h*h) / 2));
+ var swx = sw.value * Math.sqrt(Math.abs(matrix.determinant()));
+ strokeElement.setAttribute("weight", swx + "px");
+ if (this.stroke.match(/url\(#([^)]+)/)) {
+ this.gradient(strokeElement, RegExp.$1);
+ } else {
+ strokeElement.setAttribute("color", this.color(this.stroke));
+ var strokeOpacity = this.strokeopacity * this.opacity; //opacityを掛け合わせる
+ if (swx < 1) {
+ strokeOpacity *= swx; //太さが1px未満なら色を薄くする
+ }
+ if (strokeOpacity < 1) {
+ strokeElement.setAttribute("opacity", strokeOpacity);
+ }
+ strokeOpacity = null;
+ }
+ strokeElement.setAttribute("miterlimit", this.strokemiterlimit);
+ strokeElement.setAttribute("joinstyle", this.strokelinejoin);
+ if (this.strokelinecap === "butt") {
+ strokeElement.setAttribute("endcap", "flat");
+ } else {
+ strokeElement.setAttribute("endcap", this.strokelinecap);
+ }
+ var tsd = this.strokedasharray;
+ if (tsd !== "none") {
+ if (tsd.indexOf(",") > 0) { //コンマ区切りの文字列の場合
+ var strs = tsd.split(",");
+ for (var i = 0, sli = strs.length; i < sli; ++i) {
+ strs[i] = Math.ceil(parseFloat(strs[i]) / parseFloat(this.strokewidth)); //精密ではないので注意
+ }
+ this.strokedasharray = strs.join(" ");
+ if (strs.length % 2 == 1) {
+ this.strokedasharray += " " + this.strokedasharray;
+ }
+ }
+ strokeElement.setAttribute("dashstyle", this.strokedasharray);
+ tsd = strs = null;
+ }
+ } catch(e) {stlog.add(e,720); strokeElement.on = "false";}
+ el.appendChild(strokeElement);
+ sw = tsd = null;
+ }
+ if (this.cursor !== "default") {
+ this.tar.style.cursor = this.cursor;
+ }
+ w = h = null;
+};
+//色キーワード
+NAIBU.PaintColor.prototype.keywords = {
+ aliceblue: "#F0F8FF",
+ antiquewhite: "#FAEBD7",
+ aquamarine: "#7FFFD4",
+ azure: "#F0FFFF",
+ beige: "#F5F5DC",
+ bisque: "#FFE4C4",
+ blanchedalmond: "#FFEBCD",
+ blueviolet: "#8A2BE2",
+ brown: "#A52A2A",
+ burlywood: "#DEB887",
+ cadetblue: "#5F9EA0",
+ chartreuse: "#7FFF00",
+ chocolate: "#D2691E",
+ coral: "#FF7F50",
+ cornflowerblue: "#6495ED",
+ cornsilk: "#FFF8DC",
+ crimson: "#DC143C",
+ cyan: "#00FFFF",
+ darkblue: "#00008B",
+ darkcyan: "#008B8B",
+ darkgoldenrod: "#B8860B",
+ darkgray: "#A9A9A9",
+ darkgreen: "#006400",
+ darkgrey: "#A9A9A9",
+ darkkhaki: "#BDB76B",
+ darkmagenta: "#8B008B",
+ darkolivegreen: "#556B2F",
+ darkorange: "#FF8C00",
+ darkorchid: "#9932CC",
+ darkred: "#8B0000",
+ darksalmon: "#E9967A",
+ darkseagreen: "#8FBC8F",
+ darkslateblue: "#483D8B",
+ darkslategray: "#2F4F4F",
+ darkslategrey: "#2F4F4F",
+ darkturquoise: "#00CED1",
+ darkviolet: "#9400D3",
+ deeppink: "#FF1493",
+ deepskyblue: "#00BFFF",
+ dimgray: "#696969",
+ dimgrey: "#696969",
+ dodgerblue: "#1E90FF",
+ firebrick: "#B22222",
+ floralwhite: "#FFFAF0",
+ forestgreen: "#228B22",
+ gainsboro: "#DCDCDC",
+ ghostwhite: "#F8F8FF",
+ gold: "#FFD700",
+ goldenrod: "#DAA520",
+ grey: "#808080",
+ greenyellow: "#ADFF2F",
+ honeydew: "#F0FFF0",
+ hotpink: "#FF69B4",
+ indianred: "#CD5C5C",
+ indigo: "#4B0082",
+ ivory: "#FFFFF0",
+ khaki: "#F0E68C",
+ lavender: "#E6E6FA",
+ lavenderblush: "#FFF0F5",
+ lawngreen: "#7CFC00",
+ lemonchiffon: "#FFFACD",
+ lightblue: "#ADD8E6",
+ lightcoral: "#F08080",
+ lightcyan: "#E0FFFF",
+ lightgoldenrodyellow: "#FAFAD2",
+ lightgray: "#D3D3D3",
+ lightgreen: "#90EE90",
+ lightgrey: "#D3D3D3",
+ lightpink: "#FFB6C1",
+ lightsalmon: "#FFA07A",
+ lightseagreen: "#20B2AA",
+ lightskyblue: "#87CEFA",
+ lightslategray: "#778899",
+ lightslategrey: "#778899",
+ lightsteelblue: "#B0C4DE",
+ lightyellow: "#FFFFE0",
+ limegreen: "#32CD32",
+ linen: "#FAF0E6",
+ magenta: "#FF00FF",
+ mediumaquamarine: "#66CDAA",
+ mediumblue: "#0000CD",
+ mediumorchid: "#BA55D3",
+ mediumpurple: "#9370DB",
+ mediumseagreen: "#3CB371",
+ mediumslateblue: "#7B68EE",
+ mediumspringgreen: "#00FA9A",
+ mediumturquoise: "#48D1CC",
+ mediumvioletred: "#C71585",
+ midnightblue: "#191970",
+ mintcream: "#F5FFFA",
+ mistyrose: "#FFE4E1",
+ moccasin: "#FFE4B5",
+ navajowhite: "#FFDEAD",
+ oldlace: "#FDF5E6",
+ olivedrab: "#6B8E23",
+ orange: "#FFA500",
+ orangered: "#FF4500",
+ orchid: "#DA70D6",
+ palegoldenrod: "#EEE8AA",
+ palegreen: "#98FB98",
+ paleturquoise: "#AFEEEE",
+ palevioletred: "#DB7093",
+ papayawhip: "#FFEFD5",
+ peachpuff: "#FFDAB9",
+ peru: "#CD853F",
+ pink: "#FFC0CB",
+ plum: "#DDA0DD",
+ powderblue: "#B0E0E6",
+ rosybrown: "#BC8F8F",
+ royalblue: "#4169E1",
+ saddlebrown: "#8B4513",
+ salmon: "#FA8072",
+ sandybrown: "#F4A460",
+ seagreen: "#2E8B57",
+ seashell: "#FFF5EE",
+ sienna: "#A0522D",
+ skyblue: "#87CEEB",
+ slateblue: "#6A5ACD",
+ slategray: "#708090",
+ slategrey: "#708090",
+ snow: "#FFFAFA",
+ springgreen: "#00FF7F",
+ steelblue: "#4682B4",
+ tan: "#D2B48C",
+ thistle: "#D8BFD8",
+ tomato: "#FF6347",
+ turquoise: "#40E0D0",
+ violet: "#EE82EE",
+ wheat: "#F5DEB3",
+ whitesmoke: "#F5F5F5",
+ yellowgreen: "#9ACD32"
+};
+//をVML用に変換
+NAIBU.PaintColor.prototype.color = function( /*string*/ color) {
+ if (this.keywords[color]) {
+ return this.keywords[color];
+ }
+ if (color.indexOf("%", 5) > 0) { // %を含むrgb形式の場合
+ return color.replace(/[\d.]+%/g, function(s) {
+ return Math.round(2.55 * parseFloat(s));
+ });
+ }
+ return color;
+};
+//linearGradient、radialGradient要素を処理
+NAIBU.PaintColor.prototype.gradient = function ( /*element*/ ele, /*string*/ id, /*Matrix*/ matrix) {
+ var grad = document.getElementById(id);
+ if (grad) {
+ var grad2 = grad;
+ while (grad2 && !grad2.hasChildNodes()) { //stopを子要素に持つgradient要素を探す
+ grad2.getAttribute("xlink:href").match(/#(.+)/);
+ grad2 = document.getElementById(RegExp.$1);
+ }
+ var stops = grad2.getElementsByTagName("stop");
+ if (!stops) {
+ grad = grad2 = stops = null;
+ return false;
+ }
+ var length = stops.length;
+ var color = [], colors = [], opacity = [];
+ for (var i = 0; i < length; ++i) {
+ var stop = stops[i];
+ color[i] = this.color(stop.style.stopcolor || stop.getAttribute("stopcolor")) || "black";
+ colors[i] = stop.getAttribute("offset") + " " + color[i];
+ opacity[i] = (stop.style.stopopacity || stop.getAttribute("stopopacity") || 1) * this.fillopacity * this.opacity;
+ }
+ ele.setAttribute("method", "none");
+ ele.setAttribute("color", color[0]);
+ ele.setAttribute("color2", color[length-1]);
+ ele.setAttribute("colors", colors.join(","));
+ // When colors attribute is used, the meanings of opacity and o:opacity2 are reversed.
+ ele.setAttribute("opacity", opacity[length-1]);
+ ele.setAttribute("o:opacity2", opacity[0]);
+ var type = grad.getAttribute("type");
+ if (type === "gradient") {
+ try {
+ var angle;
+ var x1 = parseFloat((grad.getAttribute("x1") || "0").replace(/%/, ""));
+ var y1 = parseFloat((grad.getAttribute("y1") || "0").replace(/%/, ""));
+ var x2 = parseFloat((grad.getAttribute("x2") || "100").replace(/%/, ""));
+ var y2 = parseFloat((grad.getAttribute("y2") || "0").replace(/%/, ""));
+ angle = 270 - Math.atan2(y2-y1, x2-x1) * 180 / Math.PI;
+ if (angle >= 360) {
+ angle -= 360;
+ }
+ } catch(e) {stlog.add(e,749); angle = 270;}
+ ele.setAttribute("type", "gradient");
+ ele.setAttribute("angle", angle + "");
+ x1 = y1 = x2 = y2 = angle = null;
+ } else if (type === "gradientRadial") {
+ try{
+ ele.setAttribute("type", "gradientTitle");
+ ele.setAttribute("focus", "100%");
+ ele.setAttribute("focusposition", "0.5 0.5");
+ if (this.tar.getAttribute("tag") === "rect") {
+ var cx = parseFloat((grad.getAttribute("cx") || "0.5").replace(/%/, ""));
+ var cy = parseFloat((grad.getAttribute("cy") || "0.5").replace(/%/, ""));
+ var r = rx = ry = parseFloat((grad.getAttribute("r") || "0.5").replace(/%/, ""));
+ var el = this.w, et = this.h, er = 0, eb = 0;
+ var data = this.tar.getAttribute("path")+"";
+ var units = grad.getAttribute("gradientUnits");
+ if (!units || units === "objectBoundingBox") {
+ //%の場合は小数点に変換(10% -> 0.1)
+ cx = cx > 1 ? cx/100 : cx; cy = cy > 1 ? cy/100 : cy; r = r > 1 ? r/100 : r;
+ //要素の境界領域を求める(四隅の座標を求める)
+ var degis = data.match(/[0-9\-]+/g);
+ for (var i=0,degisli=degis.length;i nx ? nx : el;
+ et = et > ny ? ny : et;
+ er = er > nx ? er : nx;
+ eb = eb > ny ? eb : ny; nx = ny = null;
+ }
+ degis = null;
+ cx = cx*(er - el) + el; cy = cy*(eb - et) + et; rx = r*(er - el); ry = r*(eb - et);
+ }
+ var gt = grad.getAttribute("gradientTransform");
+ if (gt) {
+ grad.setAttribute("transform",gt);
+ matrix = NAIBU.transformToCTM(grad, matrix);
+ }
+ el = cx - rx; et = cy - ry; er = cx + rx; eb = cy + ry;
+ var rrx = rx * 0.55228, rry = ry * 0.55228;
+ var list = ["m", cx,et, "c", cx-rrx,et, el,cy-rry, el,cy, el,cy+rry, cx-rrx,eb, cx,eb, cx+rrx,eb, er,cy+rry, er,cy, er,cy-rry, cx+rrx,et, cx,et, "x e"];
+ var pl = new PList(list);
+ var plm = pl.matrixTransform(matrix);
+ var ellipse = plm.list.join(" ");
+ var outline = document.getElementById("_NAIBU_outline");
+ var background = document.createElement("div");
+ background.style.position = "absolute";
+ background.style.textAlign = "left"; background.style.top = "0px"; background.style.left = "0px"; background.style.width = this.w+ "px"; background.style.height = this.h+ "px";
+ outline.appendChild(background);
+ background.style.filter = "progid:DXImageTransform.Microsoft.Compositor";
+ background.filters.item('DXImageTransform.Microsoft.Compositor').Function = 23;
+ var circle = '' +ele.outerHTML+ ' ';
+ background.innerHTML = ' ';
+ background.filters[0].apply();
+ background.innerHTML = circle;
+ background.filters[0].play();
+ this.tar.parentNode.insertBefore(background, this.tar);
+ this.tar.filled = "false";
+ ellipse = circle = data = list = pl = plm = gt = cx = cy = r = null;
+ } else {
+ return false;
+ }
+ return true;
+ } catch(e) {stlog.add(e,1175);}
+ }
+ } else {
+ return false;
+ }
+ stops = type = lengh = color = colors = opacity = null;
+ return false;
+};
+
+//font属性、関連プロパティを処理する
+//PaintColorを継承
+NAIBU.FontStyle = function( /*element*/ ele) {
+ var td = this.defaults;
+ td["font-size"] = "12";
+ td["font-family"] = "sans-serif";
+ td["font-style"] = "normal";
+ td["font-weight"] = "400";
+ td["text-transform"] = "none";
+ td["text-decoration"] = "none";
+ td["writing-mode"] = "lr-tb";
+ td["text-anchor"] = "start";
+ NAIBU.PaintColor.apply(this,arguments);
+ return this;
+}
+NAIBU.FontStyle.prototype = new NAIBU.PaintColor(false);
+//キャッシュ用
+NAIBU.FontStyle.prototype.cache = {};
+//親コンテナ要素のPaintColorオブジェクトを返す
+NAIBU.FontStyle.prototype.getParent = function( /*element*/ ele) {
+ try{
+ var parent = ele.parentNode;
+ if (parent.tagName !== "group" && parent.tagName !== "A" && parent.tagName !== "DIV") {
+ return null;
+ }
+ var cache = this.cache;
+ var id = parent.uniqueID;
+ if (!cache[id]) {
+ cache[id] = new NAIBU.FontStyle(parent);
+ }
+ } catch(e){stlog.add(e,1179);}
+ return cache[id];
+}
+
+//内部プロパティを、styleに設定する
+NAIBU.FontStyle.prototype.setStyle = function() {
+ try {
+ var tst = this.tar
+ for (var i in this) {
+ var ti = this[i];
+ if ((typeof ti) === "string") { //string型以外は除く
+ var sname = i.replace(/\-([a-z])/, "-").replace(/\-/,RegExp.$1.toUpperCase());
+ if (ti === "lr") {
+ ti = "lr-tb";
+ } else if (ti === "tb") {
+ ti = "tb-rl";
+ }
+ tst.style[sname] = ti;
+ }
+ }
+ } catch(e) {stlog.add(e,1396); return "";}
+}
+NAIBU.FontStyle.prototype.fset = function( /*float*/ w, /*float*/ h, /*Matrix*/ matrix) {
+ try{
+ this.setStyle();
+ var tts = this.tar.style;
+ tts.whiteSpace = "nowrap";
+ tts.color = this.fill === "none" ? "transparent" : this.fill;
+ this.fontSize = fontset(this["font-size"],w,h,matrix);
+ tts.fontSize = this.fontSize+ "px";
+ if (this.cursor !== "default") {
+ tts.cursor = this.cursor;
+ }
+ this.writingMode = tts.writingMode;
+ tts.marginTop = (this.writingMode === "tb-rl") ? "0px" : -parseFloat(tts.fontSize)+ "px";
+ tts.textIndent = "0px";
+ } catch(e){stlog.add(e,1185);}
+}
+
+//NAIBU.transformToCTM transform属性を処理。Matrix型に変換
+//あらかじめ正規表現オブジェクトを生成しておく
+NAIBU.comaR = /[A-Za-z]+(?=\s*\()/g;
+NAIBU.listR = /\([^\)]+\)/g;
+NAIBU.degR = /[\-\d\.e]+/g;
+NAIBU.transformToCTM = function ( /*element*/ ele, /*Matrix*/ matrix) {
+ try {
+ var tft = ele.getAttribute("transform");
+ if (tft) {
+ var coma = tft.match(NAIBU.comaR); //コマンド文字にマッチ translate
+ var list = tft.match(NAIBU.listR); //カッコ内のリストにマッチ (10 20 30...)
+ var a,b,c,d,e,f,lis,deg,rad,degli,matri;
+ for (var j=0,cli=coma.length;j= 0) ? rad : 2 * Math.PI + rad;
+}
+//弧をベジェ曲線に変換
+STArc.prototype.set = function starcset(x1,y1,rx,ry,psai,fA,fS,x4,y4) {
+ var fS = parseFloat(fS), rx = parseFloat(rx), ry = parseFloat(ry), psai = parseFloat(psai), x1 = parseFloat(x1), x4 = parseFloat(x4), y1 = parseFloat(y1), y4 = parseFloat(y4);
+ if (rx === 0 || ry === 0) {throw "line";}
+ rx = Math.abs(rx); ry = Math.abs(ry);
+ var ccx = (x1 - x4) / 2, ccy = (y1 - y4) / 2;
+ var cpsi = Math.cos(psai*Math.PI/180), spsi = Math.sin(psai*Math.PI/180);
+ var x1d = cpsi*ccx + spsi*ccy, y1d = -1*spsi*ccx + cpsi*ccy;
+ var x1dd = x1d * x1d, y1dd = y1d * y1d;
+ var rxx = rx * rx, ryy = ry * ry;
+ var lamda = x1dd/rxx + y1dd/ryy;
+ var sds;
+ if (lamda > 1) {
+ rx = Math.sqrt(lamda) * rx;
+ ry = Math.sqrt(lamda) * ry;
+ sds = 0;
+ } else{
+ var seif = 1;
+ if (fA === fS) {
+ seif = -1;
+ }
+ sds = seif * Math.sqrt((rxx*ryy - rxx*y1dd - ryy*x1dd) / (rxx*y1dd + ryy*x1dd));
+ }
+ var cxd = sds*rx*y1d / ry, cyd = -1 * sds*ry*x1d / rx;
+ var cx = cpsi*cxd - spsi*cyd + (x1+x4)/2, cy = spsi*cxd + cpsi*cyd + (y1+y4)/2;
+ var s1 = this.CVAngle(1,0,(x1d-cxd)/rx,(y1d-cyd)/ry);
+ var dr = this.CVAngle((x1d-cxd)/rx,(y1d-cyd)/ry,(-x1d-cxd)/rx,(-y1d-cyd)/ry);
+ if (!fS && dr > 0) {
+ dr -= 2*Math.PI;
+ } else if (fS && dr < 0) {
+ dr += 2*Math.PI;
+ }
+ var sse = dr * 2 / Math.PI;
+ var seg = Math.ceil(sse<0 ? -1*sse : sse);
+ var segr = dr / seg;
+ var nea = [];
+ var t = 8/3 * Math.sin(segr/4) * Math.sin(segr/4) / Math.sin(segr/2);
+ var cpsirx = cpsi * rx;
+ var cpsiry = cpsi * ry;
+ var spsirx = spsi * rx;
+ var spsiry = spsi * ry;
+ var mc = Math.cos(s1);
+ var ms = Math.sin(s1);
+ var x2 = x1 - t * (cpsirx * ms + spsiry * mc);
+ var y2 = y1 - t * (spsirx * ms - cpsiry * mc);
+ for (var i = 0; i < seg; ++i) {
+ s1 += segr;
+ mc = Math.cos(s1);
+ ms = Math.sin(s1);
+ var x3 = cpsirx * mc - spsiry * ms + cx;
+ var y3 = spsirx * mc + cpsiry * ms + cy;
+ var dx = -t * (cpsirx * ms + spsiry * mc);
+ var dy = -t * (spsirx * ms - cpsiry * mc);
+ nea = nea.concat([x2, y2, x3 - dx, y3 - dy, x3, y3]);
+ x2 = x3 + dx;
+ y2 = y3 + dy;
+ }
+ this.D = (this.D ? this.D.concat(nea) : nea);
+ nea = null;
+ return true;
+}
+//setをできるだけ繰り返す
+STArc.prototype.sset = function starcsset( /*float*/ nox, /*float*/ noy, /*array*/ f, /*float*/ rx, /*float*/ ry) {
+ for (var i=1,fli=f.length;i /n/
+ } else{
+ base = location.href;
+ }
+ }
+ } else{
+ base = egbase;
+ }
+ if (href.indexOf(":") === -1) {
+ this.base = base;
+ } else{
+ this.base ="";
+ }
+ this.href = href;
+ } else {
+ this.href = null;
+ }
+ return this;
+}
+NAIBU.XLink.prototype.set = function() {
+ try {
+ if (this.href) {
+ var uri = this.base + this.href;
+ if (this.href.indexOf(".") === 0) { //相対URIの場合
+ uri = this.href;
+ }
+ switch (this.show) {
+ case "embed":
+ if (this.tar.tagName === "image") {
+ this.tar.src = uri;
+ } else{
+ uri.match(/#(.+)$/);
+ this.resource = document.getElementById(RegExp.$1);
+ this.tar.innerHTML = this.resource.outerHTML.replace(/<\/?v\:(fill|stroke)>/g, "");
+ }
+ break;
+ case "new":
+ this.tar.setAttribute("target","_blank");
+ break;
+ }
+ this.tar.setAttribute("href",uri);
+ }
+ } catch(e) {stlog.add(e,17155);}
+}
+
+function utf16( /*string*/ s) {
+ return unescape(s);
+}
+function unescapeUTF16( /*string*/ s) {
+ return s.replace(/%u\w\w\w\w/g, utf16);
+}
+
+//Text2SVG機能。SVGのソース(文章)をSVG画像に変換できる。(必須ではない)
+function textToSVG( /*string*/ source, /*float*/ w, /*float*/ h) {
+ var data = 'data:image/svg+xml,' + unescapeUTF16(escape(source));
+ var ob = document.createElement("object");
+ ob.setAttribute("data",data);
+ ob.setAttribute("width",w);
+ ob.setAttribute("height",h);
+ ob.setAttribute("type","image/svg+xml");
+ return ob;
+}
+
+//XMLHttpRequestオブジェクトの作成
+function HTTP() {
+ var xmlhttp;
+ try {
+ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
+ } catch (e) {
+ try {
+ xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
+ } catch (E) {
+ xmlhttp = false;
+ }
+ }
+ if (!xmlhttp) {
+ try {
+ xmlhttp = new XMLHttpRequest();
+ } catch (e) {
+ xmlhttp = false;
+ }
+ }
+ return xmlhttp;
+}
+var success = true;
+
+//IE用。object要素のデータからVMLを作成
+function ca( /*object*/ data) {
+if (success && data.success) {
+ try {
+ var obj = data.obj[data.num-1];
+ var obw = new STLength(obj.getAttribute("width"),obj.clientWidth), obh = new STLength(obj.getAttribute("height"),obj.clientHeight);
+ var obwidth = obw.value, obheight = obh.value;
+ } catch(e) {stlog.add(e,1209);}
+ //正規表現でソースをVML用に書き換え
+ //xmlns属性削除はバグが起きないように必須
+ var dc = data.content
+ .replace(/|\]>)/, "-->")
+ .replace(/<\?[^>]+\?>/g, "")
+ .replace(//g, "-->")
+ .replace(/xmlns="[^"]+"/g, "")
+ .replace(/)/g, "/g, "/v:group>")
+ .replace(//g, "/v:shape>")
+ .replace(//g, "/v:shape>")
+ .replace(//g, "/v:shape>")
+ .replace(//g, "/v:shape>")
+ .replace(//g, "/v:shape>")
+ .replace(//g, "/v:shape>")
+ .replace(//g, "/v:shape>")
+ .replace(/)/g, "/g, "/div>")
+ .replace(/)/g, "/g, "/v:group>")
+ .replace(//g, "/v:fill>")
+ .replace(//g, "/v:fill>")
+ .replace(/fill-/g, "fill")
+ .replace(/stroke-/g, "stroke")
+ .replace(/stop-/g, "stop")
+ .replace(/\bwidth=/g, "svgwidth=")
+ .replace(/\bheight=/g, "svgheight=")
+ .replace(//g, "/span>")
+ .replace(//g, "/v:image>")
+ .replace(//g, "/v:group>")
+ .replace(/)/g, "/g, "/dn:defs>");
+ var ob = document.createElement("v:group");
+ var obst = ob.style;
+ ob.innerHTML = dc;
+ data = dc = null;
+ var obc = ob.getElementsByTagName("group").item(0); //obcはSVGのルート要素
+ var regaw = obc.getAttribute("svgwidth") || obwidth;
+ var regah = obc.getAttribute("svgheight") || obheight;
+ var regw = new STLength(regaw,obwidth);
+ var regh = new STLength(regah,obheight);
+ var regwv = regw.value, reghv = regh.value;
+ obst.width = regwv+ "px";
+ obst.height = reghv+ "px";
+ ob.coordsize = regwv +" "+ reghv;
+ var STdocument = new SVGtoVML(obc,obwidth,obheight,regw,regh);
+ obj.parentNode.insertBefore(ob,obj);
+ STdocument.read(ob);
+ STdocument.set(ob);
+ STdocument = obw = obh = regw = regh = null;
+ NAIBU.PaintColor.prototype.cache = {}; //キャッシュの初期化
+ if (NAIBU.STObject !== void 0) {NAIBU.STObject.next();}
+}
+}
+
+//指定したURLの文章データを取得
+function getURL( /*string*/ url, /*function*/ fn, /*Array*/ ob, /*int*/ n) {
+ var xmlhttp= new HTTP();
+ if (xmlhttp) {
+ var obn = ob[n-1];
+ obn.style.display = "none";
+ xmlhttp.open("GET",url,true);
+ xmlhttp.setRequestHeader("X-Requested-With", "XMLHttpRequest");
+ xmlhttp.onreadystatechange = function() {
+ if (xmlhttp.readyState === 4 && xmlhttp.status === 200) {
+ fn({success:true,content:xmlhttp.responseText,obj:ob,num:n});
+ xmlhttp = null;
+ }
+ }
+ xmlhttp.send(null);
+ } else {
+ fn({success:false});
+ }
+}
+
+//Sieb用
+if (sieb_s) {svgtovml();}