1 |
<?xml version="1.0"?> |
<?xml version="1.0" encoding="iso-2022-jp"?> |
2 |
<bindings xmlns="http://www.mozilla.org/xbl"> |
<bindings xmlns="http://www.mozilla.org/xbl"> |
3 |
<binding id="link-hlink"> |
<binding id="link-hlink"> |
4 |
<implementation> |
<implementation> |
5 |
<method name="linkizeHTML" type="application/x-javascript"> |
<method name="linkizeHTML" type="application/x-javascript"> |
6 |
<parameter name="doc" /> |
<parameter name="doc" /> |
7 |
<body><![CDATA[ |
<body><![CDATA[ |
8 |
const XHTML1NS = 'http://www.w3.org/1999/xhtml'; |
const XHTML1NS = 'http://www.w3.org/1999/xhtml'; |
9 |
const HLinkNS = 'http://www.w3.org/2002/06/hlink'; |
const HLinkNS = 'http://www.w3.org/2002/06/hlink'; |
10 |
const XLinkNS = 'http://www.w3.org/1999/xlink'; |
const XLinkNS = 'http://www.w3.org/1999/xlink'; |
11 |
const tempNS = 'urn:x-suika-fam-cx:markup:temporary'; |
const tempNS = 'urn:x-suika-fam-cx:markup:temporary:hlink'; |
12 |
|
const XLinkPfx = ''; |
13 |
var eLinks = doc.getElementsByTagNameNS (XHTML1NS, 'link'); |
const tempPfx = ''; |
14 |
for (var i = 0; i < eLinks.length; i++) |
|
15 |
if (eLinks[i].getAttribute ('type').toLowerCase () == 'application/x-hlink+xml' |
var hObject = doc.createElementNS (tempNS, 'objects'); |
16 |
&& eLinks[i].getAttribute ('rel') == 'stylesheet' //.match (/stylesheet/i) |
doc.documentElement.appendChild (hObject); |
17 |
) linkizeByHTMLLinkElement (eLinks[i]); |
|
18 |
|
var eLinks = doc.getElementsByTagNameNS (XHTML1NS, 'link'); |
19 |
function linkizeByHTMLLinkElement (eLink) { |
for (var i = 0; i < eLinks.length; i++) |
20 |
var oHLink = eLink.ownerDocument.createElementNS (XHTML1NS, 'object'); |
if (eLinks[i].getAttribute ('type').toLowerCase () == 'application/x-hlink+xml' |
21 |
oHLink.setAttributeNS (tempNS, 'HLinkStatus', 100); |
&& eLinks[i].getAttribute ('rel') == 'stylesheet' //.match (/stylesheet/i) |
22 |
oHLink.setAttribute ('data', eLink.getAttribute ('href')); |
) this.linkizeByHTMLLinkElement (eLinks[i], hObject); |
23 |
//oHLink.setAttribute ('type', 'application/xml'); |
]]></body> |
24 |
oHLink.style.display = 'inline'; |
</method> |
25 |
oHLink.style.width = 0; |
<field name="tempNS">'urn:x-suika-fam-cx:markup:temporary:hlink'</field> |
26 |
oHLink.style.height = 0; |
<field name="tempPfx">''</field> |
27 |
oHLink.addEventListener ('load', function () { |
<field name="tempLinksNS">'http://www.w3.org/1999/xhtml'</field> |
28 |
var hlink = oHLink.contentDocument.getElementsByTagNameNS |
<field name="tempLinksElementTypeName">'div'</field> |
29 |
(HLinkNS, 'hlink'); |
<field name="XLinkNS">'http://www.w3.org/1999/xlink'</field> |
30 |
for (var k = 0; k < hlink.length; k++) linkizeElement (hlink[k]); |
<field name="XLinkPfx">''</field> |
31 |
}, false); |
<field name="XHTML1NS">'http://www.w3.org/1999/xhtml'</field> |
32 |
eLink.ownerDocument.documentElement.appendChild (oHLink); |
<field name="HLinkNS">'http://www.w3.org/2002/06/hlink'</field> |
33 |
} |
<field name="HLinkPfx">''</field> |
34 |
|
<field name="hLinkAttrList"> |
35 |
function linkizeElement (e) { |
new Array ('locator', 'effect', 'actuate', 'mediaType', 'role', 'reverseRole', 'replace'); |
36 |
var elementNS = e.getAttribute ('namespace'); |
</field> |
37 |
var elementType = e.getAttribute ('element'); |
<method name="linkizeByHTMLLinkElement" type="application/x-javascript"> |
38 |
var linkAttr = []; |
<parameter name="eLink" /> |
39 |
var linkAttrList = new Array ('locator', 'effect', 'actuate', 'mediaType', 'replacement'); |
<parameter name="hObject" /> |
40 |
for (var k = 0; k < linkAttrList.length; k++) { |
<body><![CDATA[ |
41 |
linkAttr[linkAttrList[k]] = []; |
var xT = this; |
42 |
linkAttr[linkAttrList[k]].value = e.getAttribute (linkAttrList[k]); |
|
43 |
if (linkAttr[linkAttrList[k]].value |
//var oHLink = eLink.ownerDocument.createElementNS (xT.XHTML1NS, 'object'); |
44 |
&& linkAttr[linkAttrList[k]].value.substr (0,1) == '@') { |
var oHLink = hObject.ownerDocument.createElementNS (xT.XHTML1NS, 'object'); |
45 |
linkAttr[linkAttrList[k]].attrName = linkAttr[linkAttrList[k]].value.substr (1); |
oHLink.setAttributeNS (xT.tempNS, 'HLinkStatus', 100); |
46 |
linkAttr[linkAttrList[k]].value = undefined; |
oHLink.setAttributeNS (xT.tempNS, 'HLinkType', 'HLinkDocument'); |
47 |
} |
oHLink.setAttribute ('data', eLink.getAttribute ('href')); |
48 |
} |
//oHLink.setAttribute ('type', 'application/xml'); |
49 |
var linkElements = document.getElementsByTagNameNS (elementNS, elementType); |
oHLink.style.display = 'inline'; |
50 |
for (var i = 0; i < linkElements.length; i++) { |
oHLink.style.width = 0; |
51 |
var elFlag = 1*linkElements[i].getAttributeNS (tempNS, 'HLinkStatus'); |
oHLink.style.height = 0; |
52 |
if (elFlag < 20) { |
oHLink.addEventListener ('load', function () { |
53 |
var myLinkAttr = []; |
var hlink = oHLink.contentDocument.getElementsByTagNameNS |
54 |
for (var j = 0; j < linkAttrList.length; j++) { |
(xT.HLinkNS, 'hlink'); |
55 |
myLinkAttr[linkAttrList[j]] = linkAttr[linkAttrList[j]].value; |
for (var k = 0; k < hlink.length; k++) xT.linkizeElement (hlink[k], hObject); |
56 |
if (linkAttr[linkAttrList[j]].attrName |
}, false); |
57 |
&& linkElements[i].hasAttribute |
//eLink.ownerDocument.documentElement.appendChild (oHLink); |
58 |
(linkAttr[linkAttrList[j]].attrName)) { |
hObject.appendChild (oHLink); |
59 |
myLinkAttr[linkAttrList[j]] = linkElements[i].getAttribute |
]]></body> |
60 |
(linkAttr[linkAttrList[j]].attrName); |
</method> |
61 |
} |
<method name="linkizeElement" type="application/x-javascript"> |
62 |
} |
<parameter name="e" /> |
63 |
if (myLinkAttr.locator != undefined) { |
<parameter name="hObject" /> |
64 |
if (myLinkAttr.effect == 'embed' && myLinkAttr.actuate == 'onLoad' |
<body><![CDATA[ |
65 |
&& myLinkAttr.locator != '' && myLinkAttr.locator.substr (0,1) != '#') { |
var xT = this; |
66 |
var oEl = linkElements[i].ownerDocument.createElementNS (XHTML1NS, 'object'); |
var elementNS = e.getAttribute ('namespace'); |
67 |
linkElements[i].setAttributeNS (tempNS, 'HLinkStatus', elFlag+1); |
var elementType = e.getAttribute ('element'); |
68 |
oEl.setAttributeNS (tempNS, 'HLinkStatus', 100); |
var linkAttr = []; |
69 |
oEl.setAttribute ('data', myLinkAttr.locator); |
var linkAttrList = xT.hLinkAttrList; |
70 |
oEl.setAttribute ('type', myLinkAttr.mediaType); |
for (var k = 0; k < linkAttrList.length; k++) { |
71 |
while (linkElements[i].childNodes.length) { |
linkAttr[linkAttrList[k]] = []; |
72 |
oEl.appendChild (linkElements[i].firstChild); |
linkAttr[linkAttrList[k]].value = e.getAttribute (linkAttrList[k]); |
73 |
//linkElements[i].removeChild (linkElements[i].firstChild); |
if (linkAttr[linkAttrList[k]].value |
74 |
} |
&& linkAttr[linkAttrList[k]].value.substr (0,1) == '@') { |
75 |
linkElements[i].appendChild(oEl); |
linkAttr[linkAttrList[k]].attrName = linkAttr[linkAttrList[k]].value.substr (1); |
76 |
} else if (myLinkAttr.effect == 'replace' && myLinkAttr.replacement |
linkAttr[linkAttrList[k]].value = undefined; |
77 |
&& myLinkAttr.actuate == 'onRequest') { |
} |
78 |
var aEl = linkElements[i].ownerDocument.createElementNS (XHTML1NS, 'a'); |
} |
79 |
linkElements[i].setAttributeNS (tempNS, 'HLinkStatus', elFlag+1); |
var linkElements = document.getElementsByTagNameNS (elementNS, elementType); |
80 |
aEl.setAttributeNS (tempNS, 'HLinkStatus', 100); |
for (var i = 0; i < linkElements.length; i++) { |
81 |
aEl.setAttribute ('href', myLinkAttr.locator); |
var elFlag = 1*linkElements[i].getAttributeNS (xT.tempNS, xT.tempPfx+'HLinkStatus'); |
82 |
if (myLinkAttr.mediaType) |
if (elFlag < 20) { |
83 |
aEl.setAttribute ('type', myLinkAttr.mediaType); |
var myLinkAttr = []; |
84 |
aEl.setAttribute ('target', myLinkAttr.replacement); |
for (var j = 0; j < linkAttrList.length; j++) { |
85 |
while (linkElements[i].childNodes.length) { |
myLinkAttr[linkAttrList[j]] = linkAttr[linkAttrList[j]].value; |
86 |
aEl.appendChild (linkElements[i].firstChild); |
if (linkAttr[linkAttrList[j]].attrName |
87 |
} |
&& linkElements[i].hasAttribute |
88 |
linkElements[i].appendChild(aEl); |
(linkAttr[linkAttrList[j]].attrName)) { |
89 |
} else { |
myLinkAttr[linkAttrList[j]] = linkElements[i].getAttribute |
90 |
linkElements[i].setAttributeNS (tempNS, 'HLinkStatus', elFlag+1); |
(linkAttr[linkAttrList[j]].attrName); |
91 |
linkElements[i].setAttributeNS (XLinkNS, 'type', 'simple'); |
} |
92 |
if (myLinkAttr.effect == 'submit' || myLinkAttr.effect == 'map') |
} |
93 |
myLinkAttr.effect = 'other'; |
if (myLinkAttr.locator != undefined) { |
94 |
linkElements[i].setAttributeNS (XLinkNS, 'show', myLinkAttr.effect); |
if (myLinkAttr.effect == 'embed' && myLinkAttr.actuate == 'onLoad' |
95 |
if (myLinkAttr.actuate == 'onRequestSecondary') |
&& myLinkAttr.locator != '' && myLinkAttr.locator.substr (0,1) != '#') { |
96 |
myLinkAttr.actuate = 'other'; |
var oEl = linkElements[i].ownerDocument.createElementNS (xT.XHTML1NS, 'object'); |
97 |
linkElements[i].setAttributeNS (XLinkNS, 'actuate', myLinkAttr.actuate); |
linkElements[i].setAttributeNS (xT.tempNS, xT.tempPfx+'HLinkStatus', elFlag+1); |
98 |
if (!myLinkAttr.locator) myLinkAttr.locator = '#'; |
linkElements[i].setAttributeNS (xT.tempNS, xT.tempPfx+'HLinkType', 'hyperLink'); |
99 |
linkElements[i].setAttributeNS (XLinkNS, 'href', myLinkAttr.locator); |
oEl.setAttributeNS (xT.tempNS, xT.tempPfx+'HLinkStatus', 100); |
100 |
} |
oEl.setAttribute ('data', myLinkAttr.locator); |
101 |
} |
oEl.setAttribute ('type', myLinkAttr.mediaType); |
102 |
} |
while (linkElements[i].childNodes.length) { |
103 |
} |
oEl.appendChild (linkElements[i].firstChild); |
104 |
} |
//linkElements[i].removeChild (linkElements[i].firstChild); |
105 |
]]></body> |
} |
106 |
</method> |
linkElements[i].appendChild(oEl); |
107 |
<constructor type="application/x-javascript"><![CDATA[ |
} else { |
108 |
var myThis = this; |
linkElements[i].setAttributeNS (xT.tempNS, xT.tempPfx+'HLinkStatus', elFlag+1); |
109 |
window.addEventListener ('load', function () {myThis.linkizeHTML(document)}, false); |
linkElements[i].setAttributeNS (xT.tempNS, xT.tempPfx+'HLinkType', 'hyperLink'); |
110 |
]]></constructor> |
linkElements[i].setAttributeNS (xT.XLinkNS, xT.XLinkPfx+'type', 'simple'); |
111 |
</implementation> |
if (myLinkAttr.effect == 'submit' || myLinkAttr.effect == 'map') |
112 |
</binding> |
myLinkAttr.effect = 'other'; |
113 |
<binding id="style-hlink"> |
linkElements[i].setAttributeNS (xT.XLinkNS, xT.XLinkPfx+'show', myLinkAttr.effect); |
114 |
<implementation> |
if (myLinkAttr.actuate == 'onRequestSecondary') |
115 |
<method name="linkize" type="application/x-javascript"> |
myLinkAttr.actuate = 'other'; |
116 |
<parameter name="e" /> |
linkElements[i].setAttributeNS (xT.XLinkNS, xT.XLinkPfx+'actuate', myLinkAttr.actuate); |
117 |
<body> |
if (!myLinkAttr.locator) myLinkAttr.locator = '#'; |
118 |
<![CDATA[ |
linkElements[i].setAttributeNS (xT.XLinkNS, xT.XLinkPfx+'href', myLinkAttr.locator); |
119 |
const tempNS = 'urn:x-suika-fam-cx:markup:temporary'; |
} |
120 |
const XLinkNS = 'http://www.w3.org/1999/xlink'; |
} |
121 |
const XHTML1NS = 'http://www.w3.org/1999/xhtml'; |
var eFlag = 1*linkElements[i].getAttributeNS (xT.tempNS, xT.tempPfx+'HLinkList'); |
122 |
var elementNS = e.getAttribute ('namespace'); |
if (!eFlag) { |
123 |
var elementType = e.getAttribute ('element'); |
var linkElement = linkElements[i]; |
124 |
var linkAttr = []; |
var xThis = this; |
125 |
var linkAttrList = new Array ('locator', 'effect', 'actuate', 'mediaType'); |
linkElement.setAttributeNS (xT.tempNS, xT.tempPfx+'HLinkList', 1); |
126 |
for (var i = 0; i < linkAttrList.length; i++) { |
linkElement.addEventListener ('mouseover', function (e) { |
127 |
linkAttr[linkAttrList[i]] = []; |
if (linkElement.getAttributeNS (xT.tempNS, xT.tempPfx+'HLinkType') |
128 |
linkAttr[linkAttrList[i]].value = e.getAttribute (linkAttrList[i]); |
== 'hyperLink') { |
129 |
if (linkAttr[linkAttrList[i]].value |
var doc = hObject.ownerDocument; //== linkElement.ownerDocument; |
130 |
&& linkAttr[linkAttrList[i]].value.substr (0,1) == '@') { |
if (linkElement.__HLinkListElement) { // LinkList exist |
131 |
linkAttr[linkAttrList[i]].attrName = linkAttr[linkAttrList[i]].value.substr (1); |
if (linkElement.__HLinkListElement.getAttributeNS |
132 |
linkAttr[linkAttrList[i]].value = undefined; |
(xT.tempNS, xT.tempPfx+'display') != 'yes') { |
133 |
} |
var eLinksElements = hObject.getElementsByTagNameNS |
134 |
} |
(xT.tempLinksNS, |
135 |
var linkElements = document.getElementsByTagNameNS (elementNS, elementType); |
xT.tempLinksElementTypeName); |
136 |
for (var i = 0; i < linkElements.length; i++) { |
for (var i = 0; i < eLinksElements.length; i++) { |
137 |
var elFlag = linkElements[i].getAttributeNS (tempNS, 'HLinkStatus'); |
eLinksElements[i].setAttributeNS |
138 |
if (elFlag < 20) { |
(xT.tempNS, xT.tempPfx+'display', 'no'); |
139 |
var myLinkAttr = []; |
} |
140 |
for (var j = 0; j < linkAttrList.length; j++) { |
with (linkElement.__HLinkListElement) { |
141 |
myLinkAttr[linkAttrList[j]] = linkAttr[linkAttrList[j]].value; |
setAttributeNS (xT.tempNS, xT.tempPfx+'display', 'yes'); |
142 |
if (linkAttr[linkAttrList[j]].attrName |
style.left = (e.clientX + 10) + 'px'; |
143 |
&& linkElements[i].hasAttribute |
style.top = (e.clientY + 10) + 'px'; |
144 |
(linkAttr[linkAttrList[j]].attrName)) { |
} |
145 |
myLinkAttr[linkAttrList[j]] = linkElements[i].getAttribute |
} |
146 |
(linkAttr[linkAttrList[j]].attrName); |
} else { // LinkList not exist |
147 |
} |
var eLinksElements = hObject.getElementsByTagNameNS |
148 |
} |
(xT.tempLinksNS, |
149 |
if (myLinkAttr.locator != undefined) { |
xT.tempLinksElementTypeName); |
150 |
if (myLinkAttr.effect == 'embed' && myLinkAttr.actuate == 'onLoad' |
for (var i = 0; i < eLinksElements.length; i++) { |
151 |
&& myLinkAttr.locator != '' && myLinkAttr.locator.substr (0,1) != '#') { |
eLinksElements[i].setAttributeNS |
152 |
var oEl = linkElements[i].ownerDocument.createElementNS (XHTML1NS, 'object'); |
(xT.tempNS, xT.tempPfx+'display', 'no'); |
153 |
oEl.setAttributeNS (tempNS, 'HLinkStatus', 100); |
} |
154 |
oEl.setAttribute ('data', myLinkAttr.locator); |
var eLinks = doc.createElementNS |
155 |
oEl.setAttribute ('type', myLinkAttr.mediaType); |
(xT.tempLinksNS, xT.tempLinksElementTypeName); |
156 |
while (linkElements[i].childNodes.length) { |
eLinks.setAttributeNS (xT.tempNS, xT.tempPfx+'type', 'links'); |
157 |
oEl.appendChild (linkElements[i].firstChild); |
eLinks.__HLinkTargetElement = linkElement; |
158 |
//linkElements[i].removeChild (linkElements[i].firstChild); |
xT.createLinkList (linkElement, eLinks, hObject); |
159 |
} |
eLinks.setAttributeNS |
160 |
linkElements[i].appendChild(oEl); |
(xT.tempNS, xT.tempPfx+'display', 'yes'); |
161 |
} else { |
eLinks.style.left = (e.clientX + 10) + 'px'; |
162 |
linkElements[i].setAttributeNS (tempNS, 'HLinkStatus', elFlag+1); |
eLinks.style.top = (e.clientY + 10) + 'px'; |
163 |
linkElements[i].setAttributeNS (XLinkNS, 'type', 'simple'); |
hObject.appendChild (eLinks); |
164 |
if (myLinkAttr.effect == 'submit' || myLinkAttr.effect == 'map') |
linkElement.__HLinkListElement = eLinks; |
165 |
myLinkAttr.effect = 'other'; |
} |
166 |
linkElements[i].setAttributeNS (XLinkNS, 'show', myLinkAttr.effect); |
} |
167 |
if (myLinkAttr.actuate == 'onRequestSecondary') |
},false); |
168 |
myLinkAttr.actuate = 'other'; |
} |
169 |
linkElements[i].setAttributeNS (XLinkNS, 'actuate', myLinkAttr.actuate); |
} |
170 |
if (!myLinkAttr.locator) myLinkAttr.locator = '#'; |
} |
171 |
linkElements[i].setAttributeNS (XLinkNS, 'href', myLinkAttr.locator); |
]]></body> |
172 |
} |
</method> |
173 |
} |
<method name="getHLinkAttrs" type="application/x-javascript"> |
174 |
} |
<parameter name="hLink"/> |
175 |
} |
<body><![CDATA[ |
176 |
]]> |
var linkAttr = []; |
177 |
</body> |
for (var i = 0; i < hLink.attributes.length; i++) { |
178 |
</method> |
linkAttr[hLink.attributes[i].nodeName] = []; |
179 |
<constructor type="application/x-javascript"> |
var lA = linkAttr[hLink.attributes[i].nodeName]; |
180 |
<![CDATA[ |
lA.value = hLink.attributes[i].nodeValue; |
181 |
var myThis = this; |
if (lA.value && lA.value.substr (0,1) == '@') { |
182 |
window.addEventListener ('load', function () {myThis.linkize(myThis)}, false); |
lA.valueAttrName = lA.value.substr (1); |
183 |
]]> |
lA.value = undefined; |
184 |
</constructor> |
} |
185 |
</implementation> |
} |
186 |
</binding> |
return linkAttr; |
187 |
</bindings> |
]]></body> |
188 |
<!-- ***** BEGIN LICENSE BLOCK ***** |
</method> |
189 |
- Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
<method name="getLinkAttr" type="application/x-javascript"> |
190 |
- |
<parameter name="attrName"/> |
191 |
- The contents of this file are subject to the Mozilla Public License Version |
<parameter name="hLinkAttr"/> |
192 |
- 1.1 (the "License"); you may not use this file except in compliance with |
<parameter name="e"/> |
193 |
- the License. You may obtain a copy of the License at |
<parameter name="eLink"/> |
194 |
- <http://www.mozilla.org/MPL/> |
<body><![CDATA[ |
195 |
- |
var xT = this; |
196 |
- Software distributed under the License is distributed on an "AS IS" basis, |
if (eLink.hasAttributeNS (xT.HLinkNS, xT.HLinkPfx+attrName)) { |
197 |
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
return eLink.getAttributeNS (xT.HLinkNS, xT.HLinkPfx+attrName); |
198 |
- for the specific language governing rights and limitations under the |
} else if (hLinkAttr[attrName]) { |
199 |
- License. |
var attrValue = hLinkAttr[attrName].value; |
200 |
- |
if (!attrValue) { |
201 |
- The Original Code is "HLink Memo" code. |
if (hLinkAttr[attrName].valueAttrName) { |
202 |
- |
attrValue = e.getAttribute (hLinkAttr[attrName].valueAttrName); |
203 |
- The Initial Developer of the Original Code is Wakaba. |
} |
204 |
- Portions created by the Initial Developer are Copyright (C) 2003 |
eLink.setAttribute ('attributeName', hLinkAttr[attrName].valueAttrName); |
205 |
- the Initial Developer. All Rights Reserved. |
} |
206 |
- |
if (attrValue) { |
207 |
- Contributor(s): |
eLink.setAttributeNS (xT.HLinkNS, xT.HLinkPfx+attrName, attrValue); |
208 |
- Wakaba <w@suika.fam.cx> |
} |
209 |
- |
return attrValue; |
210 |
- Alternatively, the contents of this file may be used under the terms of |
} |
211 |
- either the GNU General Public License Version 2 or later (the "GPL"), or |
return undefined; |
212 |
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
]]></body> |
213 |
- in which case the provisions of the GPL or the LGPL are applicable instead |
</method> |
214 |
- of those above. If you wish to allow use of your version of this file only |
<method name="createLinkList" type="application/x-javascript"> |
215 |
- under the terms of either the GPL or the LGPL, and not to allow others to |
<parameter name="e"/> |
216 |
- use your version of this file under the terms of the MPL, indicate your |
<parameter name="eLinks"/> |
217 |
- decision by deleting the provisions above and replace them with the notice |
<parameter name="hObject"/> |
218 |
- and other provisions required by the LGPL or the GPL. If you do not delete |
<body><![CDATA[ |
219 |
- the provisions above, a recipient may use your version of this file under |
var xT = this; |
220 |
- the terms of any one of the MPL, the GPL or the LGPL. |
var hObject = hObject.getElementsByTagNameNS (xT.XHTML1NS, 'object'); |
221 |
- |
var doc = eLinks.ownerDocument; |
222 |
- ***** END LICENSE BLOCK ***** --> |
for (var i = 0; i < hObject.length; i++) { |
223 |
|
var hLink = hObject[i].contentDocument.getElementsByTagNameNS (xT.HLinkNS, 'hlink'); |
224 |
|
for (var j = 0; j < hLink.length; j++) { |
225 |
|
if (hLink[j].getAttribute ('namespace') == e.namespaceURI |
226 |
|
&& hLink[j].getAttribute ('element') == e.localName) { |
227 |
|
var eLink = doc.createElementNS (xT.tempNS, 'link'); |
228 |
|
var hLA = xT.getHLinkAttrs(hLink[j]); |
229 |
|
var hRef = xT.getLinkAttr ('locator', hLA, e, eLink); |
230 |
|
if (hRef) { |
231 |
|
eLink.appendChild (doc.createTextNode (hRef)); |
232 |
|
eLink.setAttributeNS (xT.XLinkNS, xT.XLinkPfx+'href', hRef); |
233 |
|
eLink.setAttributeNS (xT.XLinkNS, xT.XLinkPfx+'type', 'simple'); |
234 |
|
var lANL = xT.hLinkAttrList; |
235 |
|
for (var k = 0; k < lANL.length; k++) { |
236 |
|
xT.getLinkAttr (lANL[k], hLA, e, eLink); |
237 |
|
} |
238 |
|
eLinks.appendChild (eLink); |
239 |
|
} |
240 |
|
} |
241 |
|
} |
242 |
|
} |
243 |
|
]]></body> |
244 |
|
</method> |
245 |
|
<constructor type="application/x-javascript"><![CDATA[ |
246 |
|
var myThis = this; |
247 |
|
window.addEventListener ('load', function () {myThis.linkizeHTML(document)}, false); |
248 |
|
]]></constructor> |
249 |
|
</implementation> |
250 |
|
</binding> |
251 |
|
<binding id="style-hlink"> |
252 |
|
<implementation> |
253 |
|
<method name="linkize" type="application/x-javascript"> |
254 |
|
<parameter name="e" /> |
255 |
|
<body> |
256 |
|
<![CDATA[ |
257 |
|
const tempNS = 'urn:x-suika-fam-cx:markup:temporary'; |
258 |
|
const XLinkNS = 'http://www.w3.org/1999/xlink'; |
259 |
|
const XHTML1NS = 'http://www.w3.org/1999/xhtml'; |
260 |
|
var elementNS = e.getAttribute ('namespace'); |
261 |
|
var elementType = e.getAttribute ('element'); |
262 |
|
var linkAttr = []; |
263 |
|
var linkAttrList = new Array ('locator', 'effect', 'actuate', 'mediaType'); |
264 |
|
for (var i = 0; i < linkAttrList.length; i++) { |
265 |
|
linkAttr[linkAttrList[i]] = []; |
266 |
|
linkAttr[linkAttrList[i]].value = e.getAttribute (linkAttrList[i]); |
267 |
|
if (linkAttr[linkAttrList[i]].value |
268 |
|
&& linkAttr[linkAttrList[i]].value.substr (0,1) == '@') { |
269 |
|
linkAttr[linkAttrList[i]].attrName = linkAttr[linkAttrList[i]].value.substr (1); |
270 |
|
linkAttr[linkAttrList[i]].value = undefined; |
271 |
|
} |
272 |
|
} |
273 |
|
var linkElements = document.getElementsByTagNameNS (elementNS, elementType); |
274 |
|
for (var i = 0; i < linkElements.length; i++) { |
275 |
|
var elFlag = linkElements[i].getAttributeNS (tempNS, 'HLinkStatus'); |
276 |
|
if (elFlag < 20) { |
277 |
|
var myLinkAttr = []; |
278 |
|
for (var j = 0; j < linkAttrList.length; j++) { |
279 |
|
myLinkAttr[linkAttrList[j]] = linkAttr[linkAttrList[j]].value; |
280 |
|
if (linkAttr[linkAttrList[j]].attrName |
281 |
|
&& linkElements[i].hasAttribute |
282 |
|
(linkAttr[linkAttrList[j]].attrName)) { |
283 |
|
myLinkAttr[linkAttrList[j]] = linkElements[i].getAttribute |
284 |
|
(linkAttr[linkAttrList[j]].attrName); |
285 |
|
} |
286 |
|
} |
287 |
|
if (myLinkAttr.locator != undefined) { |
288 |
|
if (myLinkAttr.effect == 'embed' && myLinkAttr.actuate == 'onLoad' |
289 |
|
&& myLinkAttr.locator != '' && myLinkAttr.locator.substr (0,1) != '#') { |
290 |
|
var oEl = linkElements[i].ownerDocument.createElementNS (XHTML1NS, 'object'); |
291 |
|
oEl.setAttributeNS (tempNS, 'HLinkStatus', 100); |
292 |
|
oEl.setAttribute ('data', myLinkAttr.locator); |
293 |
|
oEl.setAttribute ('type', myLinkAttr.mediaType); |
294 |
|
while (linkElements[i].childNodes.length) { |
295 |
|
oEl.appendChild (linkElements[i].firstChild); |
296 |
|
//linkElements[i].removeChild (linkElements[i].firstChild); |
297 |
|
} |
298 |
|
linkElements[i].appendChild(oEl); |
299 |
|
} else { |
300 |
|
linkElements[i].setAttributeNS (tempNS, 'HLinkStatus', elFlag+1); |
301 |
|
linkElements[i].setAttributeNS (XLinkNS, 'type', 'simple'); |
302 |
|
if (myLinkAttr.effect == 'submit' || myLinkAttr.effect == 'map') |
303 |
|
myLinkAttr.effect = 'other'; |
304 |
|
linkElements[i].setAttributeNS (XLinkNS, 'show', myLinkAttr.effect); |
305 |
|
if (myLinkAttr.actuate == 'onRequestSecondary') |
306 |
|
myLinkAttr.actuate = 'other'; |
307 |
|
linkElements[i].setAttributeNS (XLinkNS, 'actuate', myLinkAttr.actuate); |
308 |
|
if (!myLinkAttr.locator) myLinkAttr.locator = '#'; |
309 |
|
linkElements[i].setAttributeNS (XLinkNS, 'href', myLinkAttr.locator); |
310 |
|
} |
311 |
|
} |
312 |
|
} |
313 |
|
} |
314 |
|
]]> |
315 |
|
</body> |
316 |
|
</method> |
317 |
|
<constructor type="application/x-javascript"> |
318 |
|
<![CDATA[ |
319 |
|
var myThis = this; |
320 |
|
window.addEventListener ('load', function () {myThis.linkize(myThis)}, false); |
321 |
|
]]> |
322 |
|
</constructor> |
323 |
|
</implementation> |
324 |
|
</binding> |
325 |
|
<binding id="ll-links"> |
326 |
|
<content xmlns:t="urn:x-suika-fam-cx:markup:temporary:hlink"> |
327 |
|
<t:container xbl:inherits="" xmlns:xbl="http://www.mozilla.org/xbl"> |
328 |
|
<h:div t:type="closeBox" onclick="this.parentNode.parentNode.setAttributeNS('urn:x-suika-fam-cx:markup:temporary:hlink',''+'display','no')" xmlns:h="http://www.w3.org/1999/xhtml">×</h:div> |
329 |
|
<children/> |
330 |
|
</t:container> |
331 |
|
</content> |
332 |
|
</binding> |
333 |
|
</bindings> |
334 |
|
<!-- ***** BEGIN LICENSE BLOCK ***** |
335 |
|
- Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
336 |
|
- |
337 |
|
- The contents of this file are subject to the Mozilla Public License Version |
338 |
|
- 1.1 (the "License"); you may not use this file except in compliance with |
339 |
|
- the License. You may obtain a copy of the License at |
340 |
|
- <http://www.mozilla.org/MPL/> |
341 |
|
- |
342 |
|
- Software distributed under the License is distributed on an "AS IS" basis, |
343 |
|
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
344 |
|
- for the specific language governing rights and limitations under the |
345 |
|
- License. |
346 |
|
- |
347 |
|
- The Original Code is SuikaWiki code. |
348 |
|
- |
349 |
|
- The Initial Developer of the Original Code is Wakaba. |
350 |
|
- Portions created by the Initial Developer are Copyright (C) 2003 |
351 |
|
- the Initial Developer. All Rights Reserved. |
352 |
|
- |
353 |
|
- Contributor(s): |
354 |
|
- Wakaba <w@suika.fam.cx> |
355 |
|
- |
356 |
|
- Alternatively, the contents of this file may be used under the terms of |
357 |
|
- either the GNU General Public License Version 2 or later (the "GPL"), or |
358 |
|
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
359 |
|
- in which case the provisions of the GPL or the LGPL are applicable instead |
360 |
|
- of those above. If you wish to allow use of your version of this file only |
361 |
|
- under the terms of either the GPL or the LGPL, and not to allow others to |
362 |
|
- use your version of this file under the terms of the MPL, indicate your |
363 |
|
- decision by deleting the provisions above and replace them with the notice |
364 |
|
- and other provisions required by the LGPL or the GPL. If you do not delete |
365 |
|
- the provisions above, a recipient may use your version of this file under |
366 |
|
- the terms of any one of the MPL, the GPL or the LGPL. |
367 |
|
- |
368 |
|
- ***** END LICENSE BLOCK ***** --> |