[Sie-announce] SIEコード [1571] 関数_noie_svgfontの代わりに、機能をobjectembedsのreadSvgFontメソッドに集約させる

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2010年 1月 12日 (火) 23:46:10 JST


Revision: 1571
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1571
Author:   dhrname
Date:     2010-01-12 23:46:10 +0900 (Tue, 12 Jan 2010)

Log Message:
-----------
関数_noie_svgfontの代わりに、機能をobjectembedsのreadSvgFontメソッドに集約させる

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

Modified: branches/05x/058/sie.js
===================================================================
--- branches/05x/058/sie.js	2010-01-12 12:45:04 UTC (rev 1570)
+++ branches/05x/058/sie.js	2010-01-12 14:46:10 UTC (rev 1571)
@@ -100,7 +100,7 @@
       _noie_svgfont();
     } else {
       var off = (!!window.opera)? 2000 : 500;
-      NAIBU.stopFont = setTimeout(_noie_svgfont, off);
+      NAIBU.stopFont = setTimeout("NAIBU.STObject.readSvgFont()", off);
     }
   }
   window.onload = null;
@@ -325,6 +325,7 @@
   this.obj = document.getElementsByTagName("object") || {length:0};
   this.emd = document.getElementsByTagName("embed") || {length:0};
   this.onumber = this.enumber = 0;
+  this._end_ = false;
   return this;
 }
 Objectembeds.prototype.next = function(){
@@ -364,6 +365,25 @@
     this.startAnime();
   } catch(e) {stlog.add(e,294);}
 };
+Objectembeds.prototype.readSvgFont = function(){
+  if (this.onumber < this.obj.length) {
+    var s, obji = this.obj[this.onumber];
+    this.onumber++;
+    if (obji.getSVGDocument !== void 0) { //Operaでなければ、かつ、void 0はundefinedのこと
+      if (obji.contentDocument !== void 0) { //Firefoxの場合
+        s = obji.contentDocument;
+      } else {
+        s = obji.getSVGDocument();
+      }
+      NAIBU._fontSearchURI(s);
+    }
+  } else {
+    if (!this._end_) {
+      this._end_ = true;
+      NAIBU._fontSearchURI(document);
+    }
+  }
+};
 //アニメーションをスタートさせる
 Objectembeds.prototype.startAnime = function(){
   for (var i=0;i<this.obj.length;++i) {
@@ -2136,21 +2156,6 @@
   data = isTategaki = horizOrVert = em = advX = dx = dy = fontSize = fe = null;
 };
 //IE以外
-function _noie_svgfont() {
-  var obj = NAIBU.STObject.obj;
-  for (var i=0;i<obj.length;++i) {
-    var s, obji = obj[i];
-    if (obji.getSVGDocument !== void 0) { //Operaでなければ、かつ、void 0はundefinedのこと
-      if (obji.contentDocument !== void 0) { //Firefoxの場合
-        s = obji.contentDocument;
-      } else {
-        s = obji.getSVGDocument();
-      }
-      NAIBU._fontSearchURI(s);
-    }
-  }
-  NAIBU._fontSearchURI(document);
-};
 //font-face-uri要素に書かれたuriを手がかりに、Ajaxを使ってファイルを読み込む
 NAIBU._fontSearchURI = function(doc){
   var tsrc = doc.getElementsByTagNameNS(NAIBU.svgNameSpace, "font-face-uri");
@@ -2159,6 +2164,9 @@
     var ids = src.substring(src.indexOf("#")+1, src.length);
     getURL(src.replace(/#.+$/, ""), _noie_font, [ {id : ids, style : {}, docu : doc} ], 1);
   }
+  if (tsrc.length === 0) {
+    NAIBU.STObject.readSvgFont();
+  }
 };
 function _noie_font(data) {
   if (data.success) {
@@ -2176,6 +2184,7 @@
       }
     }
     doc = data = null;
+    NAIBU.STObject.readSvgFont();
   }
 };
 NAIBU._noie_createFont = function(/*Element*/ ti, /*Element*/ font) {




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