From 97c9c49897f0062b1217689eea8bb568e55c8f76 Mon Sep 17 00:00:00 2001 From: dhrname Date: Sun, 2 Dec 2012 23:25:38 +0900 Subject: [PATCH] Build SIE 6 --- org/sie-uncompressed.js | 195 +++++++++++++++++++++++++++--------------------- 1 file changed, 108 insertions(+), 87 deletions(-) diff --git a/org/sie-uncompressed.js b/org/sie-uncompressed.js index 5a6c2fe..3a45c2d 100644 --- a/org/sie-uncompressed.js +++ b/org/sie-uncompressed.js @@ -65,7 +65,7 @@ if (!Object._create) { s.prototype = cl.prototype; cl = void 0; return new s; - } + }; } // File: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/dom.idl /*W3CのDOMのIDLを参照にコードを起こしている @@ -867,7 +867,7 @@ Document.constructor = Node; s.systemId = importedNode.systemId; s.notationName = importedNode.notationName; } else if (imn === /*Node.PROCESSING_INSTRUCTION_NODE*/ 7) { - s = this.createProcessingInstruction(importedNode.nodeName, importedNode.nodeValue) + s = this.createProcessingInstruction(importedNode.nodeName, importedNode.nodeValue); } else if (imn === /*Node.NOTATION_NODE*/ 12) { s = new Notation(); s.publicId = importedNode.publicId; @@ -918,7 +918,7 @@ Document.constructor = Node; ti = namespaceURI = qualifiedName = prefix = localName = isSpecified = void 0; return ele; }; - dproto._document_ = document + dproto._document_ = document; /*createAttributeNSメソッド *属性ノードを作る。setAttributeNSで使うため、削除不可 */ @@ -1065,7 +1065,7 @@ EventException.prototype = Object._create(DOMException); } else if ((etime - td._limit_time_) > 1000) { /*1秒を超えたらバッファにため込んで後で使う*/ tob = td.implementation._buffer_ || []; - toli = tob.length + toli = tob.length; tob[toli] = this; tob[toli+1] = evt; td.implementation._buffer_ = tob; @@ -1376,7 +1376,7 @@ MutationEvent.prototype = Object._create(Event); te = te.parentNode; } while (te); if (s !== this.ownerDocument.documentElement) { - evt = descend = tp = rp = te = s = di = void 0; + evt = descend = tp = rp = te = s = di = void 0; return n; } evt = this.ownerDocument.createEvent("MutationEvents"); @@ -1397,7 +1397,7 @@ MutationEvent.prototype = Object._create(Event); di = null; } } - evt = descend = tp = rp = j = t = te = s = di = void 0; + evt = descend = tp = rp = j = t = te = s = di = void 0; return n; }; @@ -2522,7 +2522,7 @@ function SVGElement() { *TransformListはtransform属性を行列で表現したあとのリスト構造 */ /*readonly attribute SVGAnimatedTransformList*/ this.transform = new SVGAnimatedTransformList(); -  //描画の際、SVGStylabaleで指定しておいたプロパティの処理をする + //描画の際、SVGStylabaleで指定しておいたプロパティの処理をする this.addEventListener("DOMAttrModified", function(evt){ if (evt.eventPhase === /*Event.BUBBLING_PHASE*/ 3) { return; @@ -2568,7 +2568,7 @@ function SVGElement() { } else { if (degli === 3) { degz = +(deg[0]); - s.setRotate(degz, +(deg[1]), +(deg[2])) + s.setRotate(degz, +(deg[1]), +(deg[2])); } else if (degli <= 2) { degz = +(deg[0]); if (com === "translate") { @@ -2950,7 +2950,7 @@ SVGLength.prototype = { _s = "px"; } else if (unitType === /*SVGLength.SVG_LENGTHTYPE_PERCENTAGE*/ 2) { n = this._percent; - _s = "%" + _s = "%"; } else if (unitType === /*SVGLength.SVG_LENGTHTYPE_EMS*/ 3) { n = this._fontSize; _s = "em"; @@ -3040,9 +3040,9 @@ SVGAngle.prototype = { _s = ""; //nは各単位から度への変換数値。_sは単位の文字列を表す if (unitType === /*SVGAngle.SVG_ANGLETYPE_UNSPECIFIED*/ 1) { } else if (unitType === /*SVGAngle.SVG_ANGLETYPE_DEG*/ 2) { - _s = "deg" + _s = "deg"; } else if (unitType === /*SVGAngle.SVG_ANGLETYPE_RAD*/ 3) { - n =  Math.PI / 180; + n = Math.PI / 180; _s = "rad"; } else if (unitType === /*SVGAngle.SVG_ANGLETYPE_GRAD*/ 4) { n = 9 / 10; @@ -3118,7 +3118,7 @@ SVGColor.prototype = Object._create(CSSValue); //ノードのプロトタイプ if (rgbColor.length < 5) { r = rgbColor.charAt(1); g = rgbColor.charAt(2); - b = rgbColor.charAt(3) + b = rgbColor.charAt(3); rgbColor = "#" + r + r + g + g + b + b; } s[0] = _parseInt(rgbColor.slice(1, 3), 16)+ ""; @@ -3153,7 +3153,7 @@ SVGColor.prototype = Object._create(CSSValue); //ノードのプロトタイプ throw new SVGException(this._exceptionsvg); } colorType = rgbColor = void 0; -} +}; // raises( SVGException ); //色キーワード this._keywords = { @@ -3372,9 +3372,12 @@ function SVGURIReference() { } tar.addEventListener("DOMNodeInsertedIntoDocument", function(evt){ var tar = evt.target, - base, + base = location.href, href = tar.href.baseVal, - show, egbase, ep, b, lh, uri, xmlhttp, ui, id, doc, ele, ev; + doc = tar.ownerDocument, + durl = doc.URL, + reg = /\.+\//g, + fe, show, egbase, ep, b, uri, xmlhttp, ui, id, ele, ev; /*xlink:href属性とxml:base属性を手がかりに、 *ハイパーリンクのURIを決定する処理を行う */ @@ -3387,26 +3390,39 @@ function SVGURIReference() { b = ep.xmlbase; ep = ep.parentNode; } - base = b; - if (!b) { //xml:baseの指定がなければ - if (href.indexOf("#") !== 0) { //href属性において#が一番につかない場合 - lh = location.href; - base = lh.replace(/\/[^\/]+?$/, "/"); //URIの最後尾にあるファイル名は消す。例: /n/sie.js -> /n/ - } else { - base = location.href; + egbase = b; + } + fe = function(durl, base) { + if (href.indexOf(":") > -1) { //絶対URIの場合 + uri = href; + } else if (durl.indexOf(":") > -1) { + base = durl; + } else { + /*durlが相対URLの場合はdirecoryの名前を消す*/ + reg.lastIndex = 0; // execメソッドを使うため + while (reg.exec(durl)) { + base = base.replace(/\/[^\/]+?(\/[^\/]*?)$/, "$1"); } + base = base.replace(/\/[^\/]+?$/, "/"); //URIの最後尾にあるファイル名は消す。例: /n/sie.js -> /n/ + base = base + durl.replace(reg, ""); } - } else { - base = egbase; + return base; + }; + base = fe(durl, base); + if (egbase) { + base = fe(egbase, base); //xml:base属性の指定がある場合 } - if (href.indexOf(":") !== -1) { //絶対URIの場合 - base = ""; + if (href.indexOf("#") === 0) { //href属性において#が一番につく場合 + uri = base + href; + } else if (!uri){ + base = base.replace(/\/[^\/]+?$/, "/"); + reg.lastIndex = 0; // execメソッドを使うため + while (reg.exec(href)) { + base = base.replace(/\/[^\/]+?(\/[^\/]*?)$/, "$1"); + } + uri = base + href.replace(reg, ""); } - uri = base + href; show = tar.getAttributeNS("http://www.w3.org/1999/xlink", "show") || "embed"; - if (href.indexOf(".") === 0) { //相対URIの場合 - uri = href; - } if (show === "replace") { tar._tar.setAttribute("href", uri); } else if (show === "new") { @@ -3422,7 +3438,6 @@ function SVGURIReference() { id = null; } if (href.indexOf("#") === 0) { //URIが#で始まるのであれば - doc = tar.ownerDocument; ele = doc.getElementById(id); tar._instance = ele; ev = doc.createEvent("SVGEvents"); @@ -3432,7 +3447,7 @@ function SVGURIReference() { } else if (uri.indexOf("data:") > -1) { tar._tar.src = uri; tar = xmlhttp = void 0; - } else if ((uri.indexOf("http:") > -1) || (uri.indexOf(".") === 0)){ + } else if ((uri.indexOf("http:") > -1)){ if ((tar.localName === "image") && (uri.indexOf(".svg") === -1)) { tar._tar.src = uri; } else { @@ -3496,7 +3511,7 @@ function SVGURIReference() { } tar.ownerDocument.documentElement._svgload_limited--; } - evt = base = href = egbase = ep = b = lh = uri = ui = id = doc = ele = ev = show= void 0; + evt = base = href = egbase = fe = ep = durl = b = reg = uri = ui = id = doc = ele = ev = show= void 0; }, false); tar = evt = void 0; }, false); @@ -3695,7 +3710,7 @@ function SVGSVGElement(_doc) { } } evtt = tar = evt = tce = slist = void 0; - }, false) + }, false); evt.target.addEventListener("DOMNodeRemovedFromDocument", function(evt){ var tar = evt.target; tar._tar && tar._tar.parentNode && tar._tar.parentNode.removeChild(tar._tar); @@ -3969,14 +3984,14 @@ function SVGUseElement() { tn = tar.getScreenCTM(); svg.setAttributeNS(null, "width", tar.width.baseVal.value); svg.setAttributeNS(null, "height", tar.height.baseVal.value); -     tari.hasAttributeNS(null, "viewBox") && svg.setAttributeNS(null, "viewBox", tari.getAttributeNS(null, "viewBox")); -     tari.hasAttributeNS(null, "preserveAspectRatio") && svg.setAttributeNS(null, "preserveAspectRatio", tari.getAttributeNS(null, "preserveAspectRatio")); -    svg._cacheScreenCTM = tn.multiply(svg.getScreenCTM()); + tari.hasAttributeNS(null, "viewBox") && svg.setAttributeNS(null, "viewBox", tari.getAttributeNS(null, "viewBox")); + tari.hasAttributeNS(null, "preserveAspectRatio") && svg.setAttributeNS(null, "preserveAspectRatio", tari.getAttributeNS(null, "preserveAspectRatio")); + svg._cacheScreenCTM = tn.multiply(svg.getScreenCTM()); ti = tar.instanceRoot.firstChild; while (ti) { ta = ti.nextSibling; svg.appendChild(ti); -   ti.getScreenCTM && ti.getScreenCTM(); + ti.getScreenCTM && ti.getScreenCTM(); ti = ta; } tar.appendChild(svg); @@ -4014,7 +4029,7 @@ function SVGElementInstanceList() { }; /*SVGElementInstance*/ SVGElementInstanceList.prototype.item = function(/*unsigned long*/ index ) { return (this[index]); -} +}; function SVGImageElement(_doc) { SVGElement.apply(this, arguments); this._tar = _doc.createElement("v:image"); @@ -4108,7 +4123,9 @@ function _ca_() { } else { data = "src"; } - xmlhttp.open("GET", objei.getAttribute(data), true); + /*_baseURLプロパティはXlink言語の相対URIで使う*/ + this._baseURL = objei.getAttribute(data); + xmlhttp.open("GET", this._baseURL, true); objei.style.display = "none"; xmlhttp.setRequestHeader("X-Requested-With", "XMLHttpRequest"); this.xmlhttp = xmlhttp; @@ -4160,15 +4177,16 @@ function _ca_() { bfl, bft, bl, text, _parseFloat = parseFloat, ndoc = NAIBU.doc || this.xmlhttp.responseXML, -       oba = _doc.createElement("div"); //obaはradialGradient要素で使う + oba = _doc.createElement("div"); //obaはradialGradient要素で使う if (!ndoc) { //何らかの原因で読み込み失敗した場合、実行させないようにする this.xmlhttp.onreadystatechange = NAIBU.emptyFunction; return; } + s.URL = this._baseURL; s._iframe = ifr; //_iframeプロパティはSVGAElementでリンク置換のときに扱う oba.setAttribute("id","_NAIBU_outline"); _doc.body.appendChild(oba); - sp.style.margin = "-1px,0px,0px,-1px" + sp.style.margin = "-1px,0px,0px,-1px"; if (ifcw) { _doc.body.style.backgroundColor = objei.parentNode.currentStyle.backgroundColor; } @@ -4582,7 +4600,7 @@ SVGMatrix.prototype = { //座標(x, y)と原点の角度の分だけ、回転する /*SVGMatrix*/ rotateFromVector : function(/*float*/ x, /*float*/ y ) { if ((x === 0) || (y === 0) || !isFinite(x) || !isFinite(y)) { - throw (new SVGException(/*SVGException.SVG_INVALID_VALUE_ERR*/ 1)) + throw (new SVGException(/*SVGException.SVG_INVALID_VALUE_ERR*/ 1)); } var m = new SVGMatrix(), rad = Math.atan2(y, x); m.a = Math.cos(rad); @@ -4684,7 +4702,7 @@ function SVGTransformList() { var t = new SVGTransform(); t.setMatrix(matrix); return t; -} +}; /*SVGTransform*/ SVGTransformList.prototype.consolidate = function() { if(this.numberOfItems === 0) { return null; @@ -4697,7 +4715,7 @@ function SVGTransformList() { this.initialize(s); return s; } -} +}; function SVGAnimatedTransformList() { /*readonly SVGTransformList*/ this.animVal = this.baseVal = new SVGTransformList(); @@ -5066,13 +5084,13 @@ NAIBU._setPaint = function(tar, matrix) { el.style.cursor = cursor.cssText.split(":")[1]; } vis = style.getPropertyCSSValue("visibility"); - if (vis && !vis._isDefault) { + if (vis && !vis._isDefault) { el.style.visibility = vis.cssText.split(":")[1]; } disp = style.getPropertyCSSValue("display"); if (disp && !disp._isDefault && (disp.cssText.indexOf("none") > -1)) { el.style.display = "none"; -  } else if (disp && !disp._isDefault && (disp.cssText.indexOf("inline-block") === -1)) { + } else if (disp && !disp._isDefault && (disp.cssText.indexOf("inline-block") === -1)) { el.style.display = "inline-block"; } } @@ -5316,8 +5334,8 @@ _sproto._attrModi = function(evt){ r1 = _math.abs(ti.r1), r2 = _math.abs(ti.r2), ctx = (rx - cx) / 2, cty = (ry - cy) / 2, - cpsi = _math.cos(psai * _math.PI / 180), - spsi = _math.sin(psai * _math.PI / 180), + cpsi = _math.cos(psai * _math.PI / 180), + spsi = _math.sin(psai * _math.PI / 180), rxd = cpsi*ctx + spsi*cty, ryd = -1*spsi*ctx + cpsi*cty, rxdd = rxd * rxd, rydd = ryd * ryd, @@ -5763,7 +5781,7 @@ _sproto._com = { s.y = y; return s; }; -})(SVGPathElement.prototype) +})(SVGPathElement.prototype); NAIBU.SVGPathElement = SVGPathElement; //IE8では、SVGPathElementはローカル変数 })(document, Math); @@ -6231,7 +6249,7 @@ NAIBU._GenericSVGPolyElement = function (_doc, xclose) { evt = tar = void 0; }, false); return this; -} +}; function SVGPolylineElement(_doc) { NAIBU._GenericSVGPolyElement.call(this, _doc, "e"); _doc = void 0; @@ -6266,7 +6284,7 @@ function SVGTextContentElement(_doc) { tar._tars = []; var data = tar.data.replace(/^\s+/, "").replace(/\s+$/, ""); tar.data = data; - tar.length = data.length + tar.length = data.length; data = data.split(''); for (var i=0, tdli=data.length;i this.getNumberOfChars() || charnum < 0) { throw (new DOMException(/*DOMException.INDEX_SIZE_ERR*/ 1)); @@ -6505,7 +6523,7 @@ t.prototype = Object._create(SVGElement); ti = ti.nextSibling; } } - tar._isYokogaki = isYokogaki //getEndPositionOfCharメソッドなどで使う + tar._isYokogaki = isYokogaki; //getEndPositionOfCharメソッドなどで使う } tar = ti = tp = ptx = pty = tx = ty = chars = style = x = y = isYokogaki = kern = akern = tt = alm = tdc = tcca = p = almx = almy = tlist = tg = void 0; var s = this.ownerDocument.documentElement.createSVGPoint(); @@ -6685,7 +6703,7 @@ SVGTextPositioningElement.prototype._texto = function(evt) { for (var i=0, j=0, tli=tar.getNumberOfChars();i j) ? i - j : j - i + var ij = (i > j) ? i - j : j - i; var sty = ti._tars[ij].style, p = tar.getStartPositionOfChar(i); sty.position = "absolute"; @@ -6709,7 +6727,7 @@ SVGTextPositioningElement.prototype._texto = function(evt) { sty.marginTop = tar._isYokogaki ? -n-5+ "px" : "-5px"; sty.lineHeight = n+10+ "px"; sty.textDecoration = tedeco; - sty.display = "none" + sty.display = "none"; ttp.appendChild(ti._tars[ij]); sty = p = void 0; } @@ -6797,7 +6815,7 @@ SVGTextPositioningElement.prototype._texto = function(evt) { backr.stroked = backr.filled = "false"; ttp.appendChild(backr); } - if (vis && !vis._isDefault) { + if (vis && !vis._isDefault) { tts.visibility = vis.cssText.split(":")[1]; } /*dipslayプロパティだけはdiv要素の個々に設定しておく必要がある @@ -6805,7 +6823,7 @@ SVGTextPositioningElement.prototype._texto = function(evt) { */ if (disp && !disp._isDefault && (disp.cssText.indexOf("none") > -1)) { di = "none"; -  } else if (disp && !disp._isDefault) { + } else if (disp && !disp._isDefault) { di = "block"; } var jt = tar._tar.firstChild, @@ -7116,9 +7134,9 @@ function SVGMarkerElement(){ /*unsigned short t.SVG_MARKER_ORIENT_UNKNOWN = 0; /*unsigned short t.SVG_MARKER_ORIENT_AUTO = 1; /*unsigned short t.SVG_MARKER_ORIENT_ANGLE = 2;*/ -  t.prototype = Object._create(SVGSVGElement); -  t.prototype.getScreenCTM = SVGElement.prototype.getScreenCTM; -  /*void*/ t.prototype.setOrientToAuto = function() { + t.prototype = Object._create(SVGSVGElement); + t.prototype.getScreenCTM = SVGElement.prototype.getScreenCTM; + /*void*/ t.prototype.setOrientToAuto = function() { this.orientType.baseVal = /*t.SVG_MARKER_ORIENT_AUTO*/ 1; }; /*void*/ t.prototype.setOrientToAngle = function(/*SVGAngle*/ angle ) { @@ -7617,7 +7635,7 @@ function SVGScriptElement() { var tod = tar.ownerDocument; NAIBU._temp_doc = tod; script = script.replace(/function\s+(\w+)/g, "$1 = function"); - script = "(function(document){" +script+ "})(NAIBU._temp_doc);" + script = "(function(document){" +script+ "})(NAIBU._temp_doc);"; try { NAIBU.eval(script); } catch (e) { //IE9では、documentがconstとして定数指定されているため、引数として指定できない @@ -7762,7 +7780,7 @@ function SVGAnimationElement(es) { } else if (durv && td && !tc && endv) { ac = (tar._getOffset(td) > (end - begin)) ? tar._getOffset(td) : (end - begin); } else if (durv && !td && tc && endv) { - ac = (+tc*dur > (end - begin)) ? +tc*dur : (end - begin) + ac = (+tc*dur > (end - begin)) ? +tc*dur : (end - begin); } } catch (e) { tar.endElementAt(1); @@ -7911,7 +7929,7 @@ function SVGAnimationElement(es) { if (id && val.match(/\.([a-z]+)/i)) { that.ownerDocument.getElementById(id).addEventListener(RegExp.$1, ds); } else if (val){ - that.targetElement.addEventListener(val.match(/^[a-z]+/i)[0], ds) + that.targetElement.addEventListener(val.match(/^[a-z]+/i)[0], ds); } } val = searchId = id = void 0; @@ -7930,7 +7948,7 @@ function SVGAnimationElement(es) { } that = void 0; if (tar.hasAttributeNS("http://www.w3.org/1999/xlink", "xlink:href")) { - tar.targetElement = tar.ownerDocument.getElementById(tar.getAttributeNS("http://www.w3.org/1999/xlink", "xlink:href").slice(1)) + tar.targetElement = tar.ownerDocument.getElementById(tar.getAttributeNS("http://www.w3.org/1999/xlink", "xlink:href").slice(1)); } else { tar.targetElement = tar.parentNode; } @@ -8086,7 +8104,7 @@ NAIBU.Time = { window.onscroll = function () { screen.updateInterval = 0; screen.updateInterval = 42; - } + }; NAIBU.stop = setInterval( (function() { try { var ntc = NAIBU.Time.currentFrame, @@ -8097,7 +8115,7 @@ NAIBU.Time = { } nc[0] && nc[0].ownerDocument.documentElement.setCurrentTime(s); for (var i=0,ncli=nc.length;i 60) { //fail safe + return; + } if (/a/[-1] === 'a') { //Firefoxならば ds = true; } else if (isMSIE || isTategaki) { @@ -9067,7 +9088,7 @@ NAIBU._noie_createFont = function(/*Element*/ ti, /*Element*/ font, /*boolean*/ */ (function(){ var s = new CSSStyleDeclaration(), -      slis = s._list, + slis = s._list, n = 0, regAZ = /([A-Z])/, regm = /\-/, @@ -9125,7 +9146,7 @@ function unsvgtovml() { /*_main関数 *一番最初に起動するべき関数 */ -NAIBU._main = (function() { +NAIBU._main = function() { var xmlhttp, //XMLHttpオブジェクトを生成 _doc = document; //documentのエイリアスを作成 try { @@ -9185,7 +9206,7 @@ NAIBU._main = (function() { readyState : 4, status : 200, responseText : ait.replace(/\shref=/g, " target='_top' xlink:href=") - } + }; gsd._ca(); } else { var base = location.href.replace(/\/[^\/]+?$/,"/"); //URIの最後尾にあるファイル名は消す。例: /n/sie.js -> /n/ @@ -9249,7 +9270,7 @@ NAIBU._main = (function() { for (var i=0;i 0) { @@ -9269,14 +9290,14 @@ NAIBU._main = (function() { } } xmlhttp = _doc = void 0; -}); +}; NAIBU.addEvent("load", NAIBU._main); NAIBU.utf16 = function ( /*string*/ s) { return unescape(s); -} +}; NAIBU.unescapeUTF16 = function ( /*string*/ s) { return s.replace(/%u\w\w\w\w/g, NAIBU.utf16); -} +}; //Text2SVG機能。SVGのソース(文章)をSVG画像に変換できる。 NAIBU.textToSVG = function ( /*string*/ source, /*float*/ w, /*float*/ h) { /*Safari3.xでは、DOMParser方式だと、文字が表示されないバグがあるため、 -- 2.11.0