6 |
<field name="NS_SLIDE">'urn:x-suika-fam-cx:markup:slide:1'</field> |
<field name="NS_SLIDE">'urn:x-suika-fam-cx:markup:slide:1'</field> |
7 |
<field name="NS_XHTML1">'http://www.w3.org/1999/xhtml'</field> |
<field name="NS_XHTML1">'http://www.w3.org/1999/xhtml'</field> |
8 |
<field name="NS_XHTML2">'http://www.w3.org/2002/06/xhtml2'</field> |
<field name="NS_XHTML2">'http://www.w3.org/2002/06/xhtml2'</field> |
9 |
|
<method name="getSlideList" type="application/x-javascript"> |
10 |
|
<body xml:space="preserve"><![CDATA[ |
11 |
|
return document.getElementsByTagNameNS (this.NS_SLIDE, 'slides')[0] |
12 |
|
.getElementsByTagNameNS (this.NS_SLIDE, 'slide'); |
13 |
|
]]></body> |
14 |
|
</method> |
15 |
|
<method name="createSlideBodyElement" type="application/x-javascript"> |
16 |
|
<parameter name="slide"/> |
17 |
|
<body xml:space="preserve"><![CDATA[ |
18 |
|
var slideBody = document.createElementNS (this.NS_SLIDE, 'slideBody'); |
19 |
|
var notes = document.createElementNS (this.NS_SLIDE, 'notes'); |
20 |
|
var slideChildren = slide.childNodes; |
21 |
|
while (slideChildren.length) { |
22 |
|
if (slideChildren[0].namespaceURI === this.NS_SLIDE |
23 |
|
&& slideChildren[0].localName === 'note') { |
24 |
|
notes.appendChild (slideChildren[0]); |
25 |
|
} else { |
26 |
|
slideBody.appendChild (slideChildren[0]); |
27 |
|
} |
28 |
|
} |
29 |
|
slide.appendChild (slideBody); |
30 |
|
if (notes.childNodes.length) |
31 |
|
slide.appendChild (notes); |
32 |
|
]]></body> |
33 |
|
</method> |
34 |
<constructor type="application/x-javascript" xml:space="preserve"><![CDATA[ |
<constructor type="application/x-javascript" xml:space="preserve"><![CDATA[ |
35 |
var slides = document.getElementsByTagNameNS (this.NS_SLIDE, 'slides')[0].getElementsByTagNameNS (this.NS_SLIDE, 'slide'); |
var topLevelNodes = document.documentElement.childNodes; |
36 |
|
for (var i = 0; i < topLevelNodes.length;) { |
37 |
|
if (topLevelNodes[i].nodeType === TEXT_NODE |
38 |
|
|| topLevelNodes[i].nodeType === COMMENT_NODE) { |
39 |
|
document.documentElement.removeChild (topLevelNodes[i]); |
40 |
|
} else { |
41 |
|
i++; |
42 |
|
} |
43 |
|
} |
44 |
|
var slides = this.getSlideList (); |
45 |
for (var i = 0; i < slides.length; i++) { |
for (var i = 0; i < slides.length; i++) { |
46 |
slides[i].setAttribute ('slideIndex', i); |
slides[i].setAttribute ('slideIndex', i); |
47 |
|
this.createSlideBodyElement (slides[i]); |
48 |
} |
} |
49 |
|
|
50 |
var h = document.getElementsByTagNameNS (this.NS_XHTML2, 'head')[0]; |
var h = document.getElementsByTagNameNS (this.NS_XHTML2, 'head')[0]; |
51 |
// Common slide style |
// Common slide style |
52 |
var l = document.createElementNS (this.NS_XHTML1, 'link'); |
var l = document.createElementNS (this.NS_XHTML1, 'link'); |
53 |
l.setAttribute ('rel', 'stylesheet'); |
l.setAttribute ('rel', 'stylesheet'); |
54 |
|
l.setAttribute ('href', this.SLIDE_XBL_BASE+'xhtml2.css'); |
55 |
|
h.appendChild (l); |
56 |
|
|
57 |
|
l = document.createElementNS (this.NS_XHTML1, 'link'); |
58 |
|
l.setAttribute ('rel', 'stylesheet'); |
59 |
l.setAttribute ('href', this.SLIDE_XBL_BASE+'slide-style.css'); |
l.setAttribute ('href', this.SLIDE_XBL_BASE+'slide-style.css'); |
60 |
h.appendChild (l); |
h.appendChild (l); |
61 |
|
|
98 |
return ret.join(''); |
return ret.join(''); |
99 |
]]></body> |
]]></body> |
100 |
</method> |
</method> |
101 |
|
<method name="getSlideList" type="application/x-javascript"> |
102 |
|
<body xml:space="preserve"><![CDATA[ |
103 |
|
return document.getElementsByTagNameNS (this.NS_SLIDE, 'slides')[0] |
104 |
|
.getElementsByTagNameNS (this.NS_SLIDE, 'slide'); |
105 |
|
]]></body> |
106 |
|
</method> |
107 |
<method name="setCurrentSlide" type="application/x-javascript"> |
<method name="setCurrentSlide" type="application/x-javascript"> |
108 |
<parameter name="n"/> |
<parameter name="n"/> |
109 |
<body xml:space="preserve"><![CDATA[ |
<body xml:space="preserve"><![CDATA[ |
110 |
var slides = document.getElementsByTagNameNS (this.NS_SLIDE, 'slides')[0].getElementsByTagNameNS (this.NS_SLIDE, 'slide'); |
var slides = this.getSlideList (); |
111 |
if (n < 0) n = slides.length + n; // -1 = slides.length-1 |
if (n < 0) n = slides.length + n; // -1 = slides.length-1 |
|
//else if (slides.length <= n) n = slides.length - 1; |
|
112 |
else if (slides.length <= n) n = 0; |
else if (slides.length <= n) n = 0; |
113 |
for (var i = 0; i < slides.length; i++) { |
for (var i = 0; i < slides.length; i++) { |
114 |
slides[i].setAttribute ('-isCurrentSlide', (i == n ? 'yes' : 'no')); |
slides[i].setAttribute ('-isCurrentSlide', (i == n ? 'yes' : 'no')); |
119 |
<method name="getSlideTitle" type="application/x-javascript"> |
<method name="getSlideTitle" type="application/x-javascript"> |
120 |
<parameter name="n"/> |
<parameter name="n"/> |
121 |
<body xml:space="preserve"><![CDATA[ |
<body xml:space="preserve"><![CDATA[ |
122 |
var slides = document.getElementsByTagNameNS (this.NS_SLIDE, 'slides')[0].getElementsByTagNameNS (this.NS_SLIDE, 'slide'); |
var slides = this.getSlideList (); |
123 |
if (n < 0) n = slides.length + n; // -1 = slides.length-1 |
if (n < 0) n = slides.length + n; // -1 = slides.length-1 |
124 |
else if (slides.length <= n) n = slides.length - 1; |
else if (slides.length <= n) n = slides.length - 1; |
125 |
if (slides[n]) { |
if (slides[n]) { |