[Sie-announce] SIEコード [1353] 0. 52統合

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 10月 21日 (水) 22:39:22 JST


Revision: 1353
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1353
Author:   dhrname
Date:     2009-10-21 22:39:22 +0900 (Wed, 21 Oct 2009)

Log Message:
-----------
0.52統合

Modified Paths:
--------------
    branches/05x/sie.js

Property Changed:
----------------
    branches/05x/sie.js

Modified: branches/05x/sie.js
===================================================================
--- branches/05x/sie.js	2009-10-21 13:34:15 UTC (rev 1352)
+++ branches/05x/sie.js	2009-10-21 13:39:22 UTC (rev 1353)
@@ -43,7 +43,7 @@
  * ***** END LICENSE BLOCK ***** */
 
 //これを頭に付けたら、内部処理用
-var  NAIBU = {};
+var NAIBU = {};
 //documentを速くするために
 /*@cc_on  _d=document;eval('var  document=_d')@*/
 //bookmarkletから呼び出されたらtrue
@@ -73,7 +73,8 @@
         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 {
-        ait = ait.replace(/\shref=/g, " target='_top' xlink:href=");
+        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]);
       }
@@ -457,9 +458,9 @@
       tancx = tancy = textLength / 2;
     }
     if (this.paint.writingMode.indexOf("tb") === 0) { //縦書きならば、x座標に影響を与えない
-      tancx = -fontSize * 0.04; //さらにディセンダの調整を行う
+      tancx = -fontSize * 0.25; //さらにディセンダの調整を行う
     } else {
-      tancy = -fontSize * 0.04;
+      tancy = -fontSize * 0.25;
     }
     tts.left = ptm.x - tancx;
     tts.top = ptm.y - tancy;
@@ -1410,6 +1411,7 @@
   this.writingMode = tts.writingMode;
   tts.marginTop = (this.writingMode === "tb-rl") ? "0px" : -parseFloat(tts.fontSize)+ "px";
   tts.textIndent = "0px";
+  tts.lineHeight = this.fontSize+ "px"
  } catch(e){stlog.add(e,1185);}
 }
 
@@ -1764,6 +1766,7 @@
 NAIBU.XLink = function( /*element*/ ele) {
   this.tar = ele;
   var href = ele.getAttribute("xlink:href");
+  this.title = ele.getAttribute("xlink:title");
   if (href) { //xlink:href属性が指定されたとき
     this.show = ele.getAttribute("xlink:show");
     var base;
@@ -1823,6 +1826,15 @@
     }
     this.tar.setAttribute("href",uri);
   }
+  if (this.title) {
+    var node = this.tar.firstChild;
+    while(node) {
+      if (node.nodeType === 1) {
+        node.setAttribute("title", this.title);
+      }
+      node = node.nextSibling;
+    }
+  }
   } catch(e) {stlog.add(e,17155);}
 }
 
@@ -1835,13 +1847,21 @@
 
 //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;
+  /*Safari3.xでは、DOMParser方式だと、文字が表示されないバグがあるため、
+   *dataスキーム方式を採用する
+   */
+  if (navigator.userAgent.indexOf('WebKit') > -1 || navigator.userAgent.indexOf('Safari') > -1) { //WebKit系ならば
+    var data = 'data:image/svg+xml;charset=utf-8,' + 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;
+  } else {
+    var doc = (new DOMParser()).parseFromString(source, "text/xml");
+    return (document.importNode(doc.documentElement, true));
+  }
 }
 
 //XMLHttpRequestオブジェクトの作成


Property changes on: branches/05x/sie.js
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/04x/040/sie.js:812-829
/branches/04x/041/sie.js:891-923
/branches/04x/042/sie.js:927-967
/branches/04x/043/sie.js:969-1013
/branches/04x/044/sie.js:1015-1067
/branches/04x/045/sie.js:1069-1078
/branches/04x/046/sie.js:1080-1129
/branches/04x/047/sie.js:1131-1164
/branches/04x/048/sie.js:1166-1180
/branches/04x/sie.js:830-1181
/branches/05x/050/sie.js:1183-1201
/branches/05x/051/sie.js:1207-1323
   + /branches/04x/040/sie.js:812-829
/branches/04x/041/sie.js:891-923
/branches/04x/042/sie.js:927-967
/branches/04x/043/sie.js:969-1013
/branches/04x/044/sie.js:1015-1067
/branches/04x/045/sie.js:1069-1078
/branches/04x/046/sie.js:1080-1129
/branches/04x/047/sie.js:1131-1164
/branches/04x/048/sie.js:1166-1180
/branches/04x/sie.js:830-1181
/branches/05x/050/sie.js:1183-1201
/branches/05x/051/sie.js:1207-1323
/branches/05x/052/sie.js:1325-1352




Sie-announce メーリングリストの案内
Back to archive index