43 |
|
|
44 |
<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
45 |
id="presentation" |
id="presentation" |
46 |
xmlns:html="http:/www.w3.org/1999/xhtml" |
xmlns:html="http://www.w3.org/1999/xhtml" |
47 |
orient="vertical" |
orient="vertical" |
48 |
onkeypress="Presentation.onKeyPress(event);"> |
onkeypress="Presentation.onKeyPress(event);"> |
49 |
|
|
59 |
操作 |
操作 |
60 |
---- |
---- |
61 |
HEADER::操作 |
HEADER::操作 |
|
基本的に |
|
|
高橋メソッド |
|
|
in XUL |
|
|
と同じ |
|
|
---- |
|
62 |
ALIGN::left |
ALIGN::left |
63 |
Enterか |
基本的な操作 |
64 |
Page Downか |
|次のページ|→,↓,Enter,Page Down,左クリック |
65 |
左クリック |
|前のページ|←,↑,Back Space,Page Up,右クリック |
66 |
で[次のページ] |
|最初のページ|Home |
67 |
---- |
|最後のページ|End |
68 |
ALIGN::right |
|リロード|Ctrl-R |
69 |
→でも |
|編集モード|Ctrl-E |
|
↓でも |
|
|
次のページ |
|
70 |
---- |
---- |
71 |
ALIGN::center |
ALIGN::center |
72 |
キーボード操作時は |
キーボード操作時は |
73 |
次のページへ進む操作で |
次のページへ進む操作で |
74 |
ラベルをめくれます |
[ラベル]をめくれます |
75 |
(めくっていない |
(めくっていない |
76 |
ラベルがなければ |
[ラベル]がなければ |
77 |
そのまま次のページへ) |
そのまま次のページへ) |
78 |
---- |
---- |
79 |
一度めくったラベルは |
一度めくったラベルは |
85 |
ここですよここ!」 |
ここですよここ!」 |
86 |
ができる |
ができる |
87 |
---- |
---- |
|
Back Spaceか |
|
|
Page Upか |
|
|
右クリック |
|
|
で[前のページ] |
|
|
---- |
|
|
←でも |
|
|
↑でも |
|
|
前のページ |
|
|
---- |
|
|
ALIGN::right |
|
|
Homeで |
|
|
最初の |
|
|
ページ |
|
|
---- |
|
|
ALIGN::left |
|
|
Endで |
|
|
最後の |
|
|
ページ |
|
|
---- |
|
|
Ctrl-R |
|
|
で[リロード] |
|
|
---- |
|
|
Ctrl-Eで |
|
|
[編集]モード |
|
|
突入 |
|
|
---- |
|
88 |
HEADER:: |
HEADER:: |
89 |
CHAPTER::編集機能 |
CHAPTER::編集機能 |
90 |
編集 |
編集 |
91 |
---- |
---- |
92 |
HEADER::編集 |
HEADER::編集 |
93 |
編集モード時は |
編集モード時の基本操作 |
94 |
Ctrl-Nで新しい |
|新しいページの追加|Ctrl-N |
|
ページの追加 |
|
95 |
---- |
---- |
96 |
HEADER::機能 |
HEADER::機能 |
97 |
部分 |
部分 |
125 |
</html>:PRE]] |
</html>:PRE]] |
126 |
ソースコードの例示などに使える |
ソースコードの例示などに使える |
127 |
---- |
---- |
128 |
|
表 |
129 |
|
|~見出し<br/>セル|セル1|セル2 |
130 |
|
|~見出し<br/>セル|セル3|セル4 |
131 |
|
データの例示などにどうぞ。 |
132 |
|
[[PRE: |
133 |
|
|~見出し<br/>セル|セル1|セル2 |
134 |
|
|~見出し<br/>セル|セル3|セル4 |
135 |
|
]] |
136 |
|
---- |
137 |
|
XUL |
138 |
|
[[RAW: |
139 |
|
<vbox align="center"> |
140 |
|
<button label="ボタン"/> |
141 |
|
|
142 |
|
<hbox> |
143 |
|
|
144 |
|
<menulist label="既定の値" style="width: 10em;"> |
145 |
|
<menupopup> |
146 |
|
<menuitem label="既定の値"/> |
147 |
|
<menuseparator/> |
148 |
|
<menuitem label="項目1"/> |
149 |
|
<menuitem label="項目2"/> |
150 |
|
<menuitem label="項目3"/> |
151 |
|
</menupopup> |
152 |
|
</menulist> |
153 |
|
|
154 |
|
<menulist label="既定の値" style="width: 10em;" editable="true"> |
155 |
|
<menupopup> |
156 |
|
<menuitem label="既定の値"/> |
157 |
|
<menuseparator/> |
158 |
|
<menuitem label="項目1"/> |
159 |
|
<menuitem label="項目2"/> |
160 |
|
<menuitem label="項目3"/> |
161 |
|
</menupopup> |
162 |
|
</menulist> |
163 |
|
|
164 |
|
</hbox> |
165 |
|
|
166 |
|
<toolbar style="background: ThreeDFace; border: 1px -moz-bg-outset;"> |
167 |
|
|
168 |
|
<toolbarbutton label="ボタン"/> |
169 |
|
|
170 |
|
<toolbarbutton label="ボタン" type="menu"> |
171 |
|
<menupopup> |
172 |
|
<menuitem label="項目1"/> |
173 |
|
<menuitem label="項目2"/> |
174 |
|
<menuitem label="項目3"/> |
175 |
|
<menu label="サブメニュー"> |
176 |
|
<menupopup> |
177 |
|
<menuitem label="項目1"/> |
178 |
|
<menuitem label="項目2"/> |
179 |
|
<menuitem label="項目3"/> |
180 |
|
</menupopup> |
181 |
|
</menu> |
182 |
|
</menupopup> |
183 |
|
</toolbarbutton> |
184 |
|
|
185 |
|
<toolbarbutton label="ボタン" type="menu-button"> |
186 |
|
<menupopup> |
187 |
|
<menuitem label="項目1"/> |
188 |
|
<menuitem label="項目2"/> |
189 |
|
<menuitem label="項目3"/> |
190 |
|
</menupopup> |
191 |
|
</toolbarbutton> |
192 |
|
|
193 |
|
</toolbar> |
194 |
|
|
195 |
|
</vbox> |
196 |
|
]] |
197 |
|
---- |
198 |
|
SVG |
199 |
|
[[RAW: |
200 |
|
<svg xmlns="http://www.w3.org/2000/svg" xml:space="default" width="220" height="200"> |
201 |
|
<rect x="60" y="60" width="100" height="80" fill="lime" stroke="red" |
202 |
|
stroke-width="5"/> |
203 |
|
<rect x="30" y="20" width="80" opacity="0.6" height="100" fill="aqua" stroke="blue" |
204 |
|
stroke-width="5"/> |
205 |
|
</svg> |
206 |
|
]] |
207 |
|
---- |
208 |
|
XHTML |
209 |
|
[[RAW: |
210 |
|
<table xmlns="http://www.w3.org/1999/xhtml" border="1"> |
211 |
|
<tbody> |
212 |
|
<tr><th>10進数</th><td>0</td><td>51</td><td>102</td><td>153</td><td>204</td><td>255</td></tr> |
213 |
|
<tr><th>16進数</th><td>0</td><td>33</td><td>66</td><td>99</td><td>CC</td><td>FF</td></tr> |
214 |
|
</tbody> |
215 |
|
</table> |
216 |
|
]] |
217 |
|
---- |
218 |
|
HIDDEN::true |
219 |
|
MathML |
220 |
|
[[RAW: |
221 |
|
<math xmlns="http://www.w3.org/1998/Math/MathML"> |
222 |
|
<mrow> |
223 |
|
<mrow> |
224 |
|
<munder> |
225 |
|
<mo form="prefix" movablelimits="false">lim</mo> |
226 |
|
<mrow> |
227 |
|
<mi>n</mi> |
228 |
|
<mo>→</mo> |
229 |
|
|
230 |
|
<mi>N</mi> |
231 |
|
</mrow> |
232 |
|
</munder> |
233 |
|
<msup> |
234 |
|
<mrow> |
235 |
|
<mo>(</mo> |
236 |
|
<mrow> |
237 |
|
<mn>1</mn> |
238 |
|
|
239 |
|
<mo>+</mo> |
240 |
|
<mfrac> |
241 |
|
<mn>1</mn> |
242 |
|
<mi>n</mi> |
243 |
|
</mfrac> |
244 |
|
</mrow> |
245 |
|
<mo>)</mo> |
246 |
|
|
247 |
|
</mrow> |
248 |
|
<mi>n</mi> |
249 |
|
</msup> |
250 |
|
</mrow> |
251 |
|
<mo>?</mo> |
252 |
|
<msup> |
253 |
|
<mi>e</mi> |
254 |
|
|
255 |
|
<mi>N</mi> |
256 |
|
</msup> |
257 |
|
</mrow> |
258 |
|
</math> |
259 |
|
]] |
260 |
|
|
261 |
|
---- |
262 |
|
XMLの埋め込み |
263 |
|
なんかもできる |
264 |
|
[[PRE: |
265 |
|
[[raw: |
266 |
|
<toolbar xmlns="http://www.mozilla.org/keymaster |
267 |
|
/gatekeeper/there.is.only.xul"> |
268 |
|
<toolbarbutton type="menu" label="メニュー1"/> |
269 |
|
<menupopup> |
270 |
|
<menuitem label="項目1"/> |
271 |
|
<menuitem label="項目2"/> |
272 |
|
<menuitem label="項目3"/> |
273 |
|
</menupopup> |
274 |
|
</toolbarbutton> |
275 |
|
</toolbar> |
276 |
|
]­] |
277 |
|
]] |
278 |
|
(でもちょっとバギー) |
279 |
|
---- |
280 |
リンク |
リンク |
281 |
[[PRE: |
[[PRE: |
282 |
[[URI]­] |
[[URI]­] |
387 |
パラ |
パラ |
388 |
メータ |
メータ |
389 |
---- |
---- |
390 |
?page=[数値] |
|表示ページを指定して起動|?page=[数値] |
391 |
---- |
|外部データファイルを使用|?data=[パス] |
392 |
表示ページを |
|編集モードで起動|?edit=true |
|
指定して起動 |
|
|
---- |
|
|
?data=[パス] |
|
|
---- |
|
|
外部データ |
|
|
ファイルを |
|
|
読み込み |
|
|
---- |
|
|
?edit=true |
|
|
---- |
|
|
編集モード |
|
|
の状態で起動 |
|
393 |
---- |
---- |
394 |
HEADER:: |
HEADER:: |
395 |
CHAPTER::このアプリケーションについて |
CHAPTER::このアプリケーションについて |
466 |
<spacer flex="1"/> |
<spacer flex="1"/> |
467 |
</vbox> |
</vbox> |
468 |
<toolbarseparator/> |
<toolbarseparator/> |
|
<hbox> |
|
|
<toolbarbutton label="timer" |
|
|
oncommand="Presentation.setTimer();" /> |
|
|
</hbox> |
|
|
<spacer flex="1"/> |
|
|
<hbox> |
|
|
<toolbarbutton label="auto" |
|
|
id="autoButton" |
|
|
type="checkbox" |
|
|
autoCheck="false" |
|
|
oncommand="Presentation.toggleAutoCruiseMode();" /> |
|
|
<toolbarbutton id="auto-interval-button" |
|
|
type="menu" |
|
|
label="Interval" |
|
|
tooltiptext="Change Interval" |
|
|
class="dropmarker-button"> |
|
|
<menupopup id="auto-interval-list" |
|
|
onpopupshowing=" |
|
|
Presentation.preventToShowHideToolbar = true; |
|
|
(this.getElementsByAttribute('value', Presentation.autoCruiseInterval)[0] || this.lastChild).setAttribute('checked', true); |
|
|
" |
|
|
onpopuphiding="Presentation.preventToShowHideToolbar = false;" |
|
|
oncommand="Presentation.changeAutoCruiseInterval(parseInt(event.target.value));"> |
|
|
<menuitem type="radio" radiogroup="autocruise-interval" |
|
|
label="1 sec" value="1000"/> |
|
|
<menuitem type="radio" radiogroup="autocruise-interval" |
|
|
label="2 sec" value="2000"/> |
|
|
<menuitem type="radio" radiogroup="autocruise-interval" |
|
|
label="3 sec" value="3000"/> |
|
|
<menuitem type="radio" radiogroup="autocruise-interval" |
|
|
label="4 sec" value="4000"/> |
|
|
<menuitem type="radio" radiogroup="autocruise-interval" |
|
|
label="5 sec" value="5000"/> |
|
|
<menuseparator/> |
|
|
<menuitem type="radio" radiogroup="autocruise-interval" |
|
|
label="1 min" value="60000"/> |
|
|
<menuitem type="radio" radiogroup="autocruise-interval" |
|
|
label="2 min" value="120000"/> |
|
|
<menuitem type="radio" radiogroup="autocruise-interval" |
|
|
label="3 min" value="180000"/> |
|
|
<menuitem type="radio" radiogroup="autocruise-interval" |
|
|
label="4 min" value="240000"/> |
|
|
<menuitem type="radio" radiogroup="autocruise-interval" |
|
|
label="5 min" value="300000"/> |
|
|
<menuseparator/> |
|
|
<menuitem type="radio" radiogroup="autocruise-interval" |
|
|
label="Custom" |
|
|
oncommand=" |
|
|
var current = Presentation.autoCruiseInterval; |
|
|
var val = parseInt(prompt('input interval (sec)', parseInt(current/1000))); |
|
|
if (isNaN(val)) { |
|
|
event.preventBubble(); |
|
|
return; |
|
|
} |
|
|
else |
|
|
val = val * 1000; |
|
|
this.value = val; |
|
|
"/> |
|
|
</menupopup> |
|
|
</toolbarbutton> |
|
|
</hbox> |
|
469 |
<toolbarbutton label="Pen" |
<toolbarbutton label="Pen" |
470 |
id="penButton" |
id="penButton" |
471 |
type="checkbox" |
type="checkbox" |
472 |
autoCheck="false" |
autoCheck="false" |
473 |
oncommand="StrokablePresentationService.toggleCheck();"/> |
oncommand="StrokablePresentationService.toggleCheck();"/> |
474 |
<toolbarseparator/> |
<spacer flex="1"/> |
475 |
<toolbarbutton id="toggleEva" label="Eva" |
<toolbarbutton id="func-menu-button" |
476 |
type="checkbox" |
type="menu" |
477 |
autoCheck="false" |
label="Function"> |
478 |
oncommand="Presentation.toggleEvaMode();"/> |
<menupopup |
479 |
|
onpopupshowing="Presentation.preventToShowHideToolbar = true;" |
480 |
|
onpopuphiding="Presentation.preventToShowHideToolbar = false;"> |
481 |
|
<menuitem label="Set Timer" |
482 |
|
oncommand="Presentation.setTimer();" /> |
483 |
|
<menuseparator/> |
484 |
|
<menuitem label="Start Auto-Cruise" |
485 |
|
id="autoButton" |
486 |
|
type="checkbox" |
487 |
|
autoCheck="false" |
488 |
|
oncommand="Presentation.toggleAutoCruiseMode();" /> |
489 |
|
<menu id="auto-interval-button" |
490 |
|
label="Change Interval"> |
491 |
|
<menupopup id="auto-interval-list" |
492 |
|
onpopupshowing="(this.getElementsByAttribute('value', Presentation.autoCruiseInterval)[0] || this.lastChild).setAttribute('checked', true);" |
493 |
|
oncommand="Presentation.changeAutoCruiseInterval(parseInt(event.target.value));"> |
494 |
|
<menuitem type="radio" radiogroup="autocruise-interval" |
495 |
|
label="1 sec" value="1000"/> |
496 |
|
<menuitem type="radio" radiogroup="autocruise-interval" |
497 |
|
label="2 sec" value="2000"/> |
498 |
|
<menuitem type="radio" radiogroup="autocruise-interval" |
499 |
|
label="3 sec" value="3000"/> |
500 |
|
<menuitem type="radio" radiogroup="autocruise-interval" |
501 |
|
label="4 sec" value="4000"/> |
502 |
|
<menuitem type="radio" radiogroup="autocruise-interval" |
503 |
|
label="5 sec" value="5000"/> |
504 |
|
<menuseparator/> |
505 |
|
<menuitem type="radio" radiogroup="autocruise-interval" |
506 |
|
label="1 min" value="60000"/> |
507 |
|
<menuitem type="radio" radiogroup="autocruise-interval" |
508 |
|
label="2 min" value="120000"/> |
509 |
|
<menuitem type="radio" radiogroup="autocruise-interval" |
510 |
|
label="3 min" value="180000"/> |
511 |
|
<menuitem type="radio" radiogroup="autocruise-interval" |
512 |
|
label="4 min" value="240000"/> |
513 |
|
<menuitem type="radio" radiogroup="autocruise-interval" |
514 |
|
label="5 min" value="300000"/> |
515 |
|
<menuseparator/> |
516 |
|
<menuitem type="radio" radiogroup="autocruise-interval" |
517 |
|
label="Custom" |
518 |
|
oncommand=" |
519 |
|
var current = Presentation.autoCruiseInterval; |
520 |
|
var val = parseInt(prompt('input interval (sec)', parseInt(current/1000))); |
521 |
|
if (isNaN(val)) { |
522 |
|
event.preventBubble(); |
523 |
|
return; |
524 |
|
} |
525 |
|
else |
526 |
|
val = val * 1000; |
527 |
|
this.value = val; |
528 |
|
"/> |
529 |
|
</menupopup> |
530 |
|
</menu> |
531 |
|
<menuseparator/> |
532 |
|
<menuitem oncommand="Presentation.print();" label="Print"/> |
533 |
|
<menu id="auto-interval-button" |
534 |
|
label="Thumbnail Format"> |
535 |
|
<menupopup |
536 |
|
onpopupshowing="(this.getElementsByAttribute('value', Presentation.imageType)[0] || this.firstChild).setAttribute('checked', true);" |
537 |
|
oncommand="Presentation.imageType = event.target.value;"> |
538 |
|
<menuitem type="radio" radiogroup="print-image-type" |
539 |
|
label="PNG" value="png"/> |
540 |
|
<menuitem type="radio" radiogroup="print-image-type" |
541 |
|
label="JPEG (50%)" value="jpeg"/> |
542 |
|
</menupopup> |
543 |
|
</menu> |
544 |
|
<menuseparator/> |
545 |
|
<menuitem id="toggleEva" label="Eva Mode" |
546 |
|
type="checkbox" |
547 |
|
autoCheck="false" |
548 |
|
oncommand="Presentation.toggleEvaMode();"/> |
549 |
|
</menupopup> |
550 |
|
</toolbarbutton> |
551 |
<toolbarseparator/> |
<toolbarseparator/> |
552 |
<toolbarbutton label="Edit" |
<toolbarbutton label="Edit" |
553 |
oncommand="Presentation.toggleEditMode();"/> |
oncommand="Presentation.toggleEditMode();"/> |
560 |
<hbox id="headerBox" flex="1"> |
<hbox id="headerBox" flex="1"> |
561 |
<label id="header"/> |
<label id="header"/> |
562 |
<spacer flex="1"/> |
<spacer flex="1"/> |
563 |
|
<vbox> |
564 |
|
<image id="logo"/> |
565 |
|
<spacer flex="1"/> |
566 |
|
</vbox> |
567 |
</hbox> |
</hbox> |
568 |
<spacer flex="19"/> |
<spacer flex="19"/> |
569 |
<hbox id="footerBox" flex="1"> |
<hbox id="footerBox" flex="1"> |
692 |
key="s" modifiers="accel" oncommand="Presentation.output();"/> |
key="s" modifiers="accel" oncommand="Presentation.output();"/> |
693 |
<key id="key_reload" |
<key id="key_reload" |
694 |
key="r" modifiers="accel" oncommand="Presentation.reload();"/> |
key="r" modifiers="accel" oncommand="Presentation.reload();"/> |
695 |
|
<key id="key_reload" |
696 |
|
key="p" modifiers="accel" oncommand="Presentation.print();"/> |
697 |
|
|
698 |
<key key="e" modifiers="accel" oncommand="Presentation.toggleEditMode();"/> |
<key key="e" modifiers="accel" oncommand="Presentation.toggleEditMode();"/> |
699 |
<key key="e" modifiers="accel,shift" oncommand="Presentation.toggleEvaMode();"/> |
<key key="e" modifiers="accel,shift" oncommand="Presentation.toggleEvaMode();"/> |
700 |
</keyset> |
</keyset> |
701 |
|
|
702 |
|
|
703 |
<script type="application/x-javascript"><![CDATA[ |
<script type="application/x-javascript; e4x=1"><![CDATA[ |
704 |
|
|
705 |
|
const XULNS = 'http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'; |
706 |
|
const XHTMLNS = 'http://www.w3.org/1999/xhtml'; |
707 |
|
|
708 |
var Presentation = { |
var Presentation = { |
709 |
|
|
723 |
|
|
724 |
dragStartDelta : 8, |
dragStartDelta : 8, |
725 |
|
|
726 |
|
imageType : 'jpeg', |
727 |
|
|
728 |
|
|
729 |
initialized : false, |
initialized : false, |
730 |
|
|
733 |
showMontaKeywordTimeout : 100, |
showMontaKeywordTimeout : 100, |
734 |
autoCruiseInterval : 2000, |
autoCruiseInterval : 2000, |
735 |
timerUpdatingInterval : 30000, |
timerUpdatingInterval : 30000, |
736 |
standByMontaLabels : [], |
|
737 |
shownMontaLabels : [], |
cachedContents : [], |
738 |
|
|
739 |
init : function(option){ |
init : function(option){ |
740 |
if (this.initialized) { |
if (this.initialized) { |
749 |
this.content = document.getElementById('content'); |
this.content = document.getElementById('content'); |
750 |
this.header = document.getElementById('header'); |
this.header = document.getElementById('header'); |
751 |
this.footer = document.getElementById('footer'); |
this.footer = document.getElementById('footer'); |
752 |
|
this.logo = document.getElementById('logo'); |
753 |
this.next = document.getElementById('nextPage'); |
this.next = document.getElementById('nextPage'); |
754 |
|
|
755 |
this.indicatorBar = document.getElementById('indicatorBar'); |
this.indicatorBar = document.getElementById('indicatorBar'); |
770 |
|
|
771 |
window.addEventListener('resize', this, false); |
window.addEventListener('resize', this, false); |
772 |
window.addEventListener('contextmenu', this, false); |
window.addEventListener('contextmenu', this, false); |
773 |
|
window.addEventListener('CanvasContentAdded', this, false); |
774 |
|
|
775 |
|
this.canvas.addEventListener('DOMMouseScroll', this, false); |
776 |
|
this.indicatorBar.addEventListener('DOMMouseScroll', this, false); |
777 |
|
|
778 |
if(option){ |
if(option){ |
779 |
for(var i in option){this[i] = option[i]} |
for(var i in option){this[i] = option[i]} |
780 |
} |
} |
781 |
|
|
782 |
|
this.cachedContents = []; |
783 |
|
|
784 |
if (this.readParameter()) { |
if (this.readParameter()) { |
785 |
this.startPresentation(); |
this.startPresentation(); |
786 |
} |
} |
797 |
}, |
}, |
798 |
|
|
799 |
takahashi : function() { |
takahashi : function() { |
800 |
|
this.isRendering = true; |
801 |
|
|
802 |
if(!this.data[this.offset]){ |
if(!this.data[this.offset]){ |
803 |
this.offset = this.data.length-1; |
this.offset = this.data.length-1; |
804 |
} |
} |
823 |
this.canvas.setAttribute('rendering', true); |
this.canvas.setAttribute('rendering', true); |
824 |
|
|
825 |
|
|
|
|
|
826 |
this.header.removeAttribute('style'); |
this.header.removeAttribute('style'); |
827 |
this.footer.removeAttribute('style'); |
this.footer.removeAttribute('style'); |
828 |
this.content.removeAttribute('style'); |
this.content.removeAttribute('style'); |
829 |
|
|
|
this.standByMontaLabels = []; |
|
830 |
this.clickableNodes = []; |
this.clickableNodes = []; |
831 |
|
|
832 |
|
|
838 |
this.footer.setAttribute('style', 'font-size:10px;'); |
this.footer.setAttribute('style', 'font-size:10px;'); |
839 |
this.footer.value = this.data[this.offset].footer; |
this.footer.value = this.data[this.offset].footer; |
840 |
|
|
841 |
var text = this.data[this.offset].text; |
var page = this.content.getAttribute('page'); |
842 |
var range = document.createRange(); |
var range = document.createRange(); |
843 |
range.selectNodeContents(this.content); |
range.selectNodeContents(this.content); |
844 |
range.deleteContents(); |
this.cachedContents[page] = { |
845 |
|
fragment : range.extractContents(), |
846 |
|
offsetWidth : parseInt(this.content.getAttribute('offsetWidth')), |
847 |
|
offsetHeight : parseInt(this.content.getAttribute('offsetHeight')) |
848 |
|
}; |
849 |
range.detach(); |
range.detach(); |
850 |
|
|
851 |
|
|
852 |
|
if (this.data[this.offset].load) { |
853 |
|
this.isRendering = false; |
854 |
|
location.href = location.href.split('?')[0] + '?'+this.data[this.offset].load; |
855 |
|
return; |
856 |
|
} |
857 |
|
|
858 |
|
var content = (this.offset in this.cachedContents) ? |
859 |
|
this.cachedContents[this.offset] : |
860 |
|
this.createContent(); |
861 |
|
|
862 |
|
this.content.setAttribute('style', 'font-size:10px;'); |
863 |
|
this.content.setAttribute('page', this.offset); |
864 |
|
this.content.setAttribute('offsetWidth', content.offsetWidth); |
865 |
|
this.content.setAttribute('offsetHeight', content.offsetHeight); |
866 |
|
|
867 |
|
this.content.appendChild(content.fragment); |
868 |
|
|
869 |
|
this.clickableNodes.push(this.content); |
870 |
|
|
871 |
|
|
872 |
|
this.fitHeaderFooterToCanvas(); |
873 |
|
this.fitMainContentToCanvas(); |
874 |
|
|
875 |
|
|
876 |
|
try { |
877 |
|
var checkedItems = this.list.getElementsByAttribute('checked', 'true'); |
878 |
|
max = checkedItems.length; |
879 |
|
for (i = max-1; i > -1 ; i--) |
880 |
|
checkedItems[i].removeAttribute('checked'); |
881 |
|
} |
882 |
|
catch(e) { |
883 |
|
} |
884 |
|
|
885 |
|
this.list.getElementsByAttribute('value', this.offset)[0].setAttribute('checked', true); |
886 |
|
|
887 |
|
this.canvas.removeAttribute('rendering'); |
888 |
|
this.isRendering = false; |
889 |
|
this.setHash('page', 'page'+(this.offset+1)); |
890 |
|
|
891 |
|
this.next.value = (this.offset <= this.data.length-2) ? (this.data[this.offset+1].plain.join('') || this.data[this.offset+1].text.join('')).replace(/\s+/g, ' ') : '(no page)' ; |
892 |
|
this.remainder.setAttribute('value', this.offset == 0 ? 0 : parseInt(((this.offset)/(this.data.length-1))*100)); |
893 |
|
|
894 |
|
var event = document.createEvent('Events'); |
895 |
|
event.initEvent('PresentationRedraw', false, true); |
896 |
|
this.canvas.dispatchEvent(event); |
897 |
|
}, |
898 |
|
createContent : function() |
899 |
|
{ |
900 |
|
var retVal = { |
901 |
|
offsetWidth : 0, |
902 |
|
offsetHeight : 0 |
903 |
|
}; |
904 |
|
var text = this.data[this.offset].text; |
905 |
var line; |
var line; |
906 |
var newLine; |
var newLine; |
907 |
var uri; |
var uri; |
908 |
var image_width; |
var image_width; |
|
var image_total_width = 0; |
|
909 |
var image_height; |
var image_height; |
|
var image_total_height = 0; |
|
910 |
var image_src; |
var image_src; |
911 |
|
|
912 |
var labelId = 0; |
var labelId = 0; |
913 |
var lineRegExp = this.makePhraseRegExp('^([^%O]+)?(%O%Oem:((.+?)(:em)?%C%C)?|%O%Opre:((.+?)(:pre)?%C%C)?|%O%O\#[^:]+:((.+?)%C%C)?|%O%Oima?ge? +src="([^"]+)" +width="([0-9]+)" +height="([0-9]+)"[^%C]*%C%C|%O%O(([^\|]+)?\\||)([^%C]+)%C%C|%O([^%C]+)%C)(.+)?', 'i'); |
var lineRegExp = this.makePhraseRegExp('^([^%O]+)?(%O%Oem:((.+?)(:em)?%C%C)?|%O%O(raw|encoded):((.+?)(:raw|:encoded)?%C%C)?|%O%Opre:((.+?)(:pre)?%C%C)?|%O%O\#[^:]+:((.+?)%C%C)?|%O%Oima?ge? +src="([^"]+)" +width="([0-9]+)" +height="([0-9]+)"[^%C]*%C%C|%O%O(([^\|]+)?\\||)([^%C]+)%C%C|%O([^%C]+)%C)(.+)?', 'i'); |
914 |
|
|
915 |
var emRegExp = this.makePhraseRegExp('^([^%O]+)?%O%Oem:(.+?)(:em)?%C%C', 'i'); |
var emRegExp = this.makePhraseRegExp('^([^%O]+)?%O%Oem:(.+?)()?%C%C', 'i'); |
916 |
var emStartRegExp = this.makePhraseRegExp('^([^%O]+)?%O%Oem:(.*)', 'i'); |
var emStartRegExp = this.makePhraseRegExp('^([^%O]+)?%O%Oem:(.*)', 'i'); |
917 |
var emEndRegExp = this.makePhraseRegExp('^(.*?)((:em)?%C%C)', 'i'); |
var emEndRegExp = this.makePhraseRegExp('^(.*?)((:em)?%C%C)', 'i'); |
918 |
|
|
920 |
var preStartRegExp = this.makePhraseRegExp('^([^%O]+)?%O%Opre:(.*)', 'i'); |
var preStartRegExp = this.makePhraseRegExp('^([^%O]+)?%O%Opre:(.*)', 'i'); |
921 |
var preEndRegExp = this.makePhraseRegExp('^(.*?)((:pre)?%C%C)', 'i'); |
var preEndRegExp = this.makePhraseRegExp('^(.*?)((:pre)?%C%C)', 'i'); |
922 |
|
|
923 |
|
var rawRegExp = this.makePhraseRegExp('^([^%O]+)?%O%O(raw|encoded):(.+?)(:raw|:encoded)?%C%C', 'i'); |
924 |
|
var rawStartRegExp = this.makePhraseRegExp('^([^%O]+)?%O%O(raw|encoded):(.*)', 'i'); |
925 |
|
var rawEndRegExp = this.makePhraseRegExp('^(.*?)((:raw|:encoded)?%C%C)', 'i'); |
926 |
|
|
927 |
var styleRegExp = this.makePhraseRegExp('^([^%O]+)?%O%O\\#([^:]+):(.+?)%C%C', ''); |
var styleRegExp = this.makePhraseRegExp('^([^%O]+)?%O%O\\#([^:]+):(.+?)%C%C', ''); |
928 |
var styleStartRegExp = this.makePhraseRegExp('^([^%O]+)?%O%O\\#([^:]+):(.*)', ''); |
var styleStartRegExp = this.makePhraseRegExp('^([^%O]+)?%O%O\\#([^:]+):(.*)', ''); |
929 |
var styleEndRegExp = this.makePhraseRegExp('^(.*?)(%C%C)', ''); |
var styleEndRegExp = this.makePhraseRegExp('^(.*?)(%C%C)', ''); |
932 |
|
|
933 |
var linksRegExp = this.makePhraseRegExp('^([^%O]+)?%O%O(([^|]+)?\\||)([^%C]+)%C%C', ''); |
var linksRegExp = this.makePhraseRegExp('^([^%O]+)?%O%O(([^|]+)?\\||)([^%C]+)%C%C', ''); |
934 |
|
|
935 |
var wikiRegExp = this.makePhraseRegExp('^([^%O]+)?%O([0-9]*)([#!])?([:\/\*_])([^%C]+)[:\/\*_]%C', ''); |
var wikiRegExp = this.makePhraseRegExp('^([^%O]+)?%O([0-9]*)([#!])?([:\/\*_-])([^%C]+)[:\/\*_-]%C', ''); |
936 |
|
|
937 |
var montaRegExp = this.makePhraseRegExp('^([^%O]+)?%O([^%C]+)%C', ''); |
var montaRegExp = this.makePhraseRegExp('^([^%O]+)?%O([^%C]+)%C', ''); |
938 |
|
|
940 |
blockClass = '', |
blockClass = '', |
941 |
blockContents = []; |
blockContents = []; |
942 |
|
|
943 |
|
var inGrid = false, |
944 |
|
gridContents = null; |
945 |
|
|
946 |
var fragment = document.createDocumentFragment(); |
var fragment = document.createDocumentFragment(); |
947 |
|
|
948 |
|
var lineBox; |
949 |
for (var i = 0, max = text.length; i < max; i++) |
for (var i = 0, max = text.length; i < max; i++) |
950 |
{ |
{ |
951 |
fragment.appendChild(document.createElement('hbox')); |
lineBox = document.createElement('hbox'); |
952 |
fragment.lastChild.setAttribute('align', 'center'); |
lineBox.setAttribute('align', 'center'); |
953 |
fragment.lastChild.setAttribute('pack', this.data[this.offset].align); |
lineBox.setAttribute('pack', this.data[this.offset].align); |
954 |
|
|
955 |
line = text[i]; |
line = text[i]; |
956 |
image_width = 0; |
image_width = 0; |
958 |
if (!line) line = ' '; |
if (!line) line = ' '; |
959 |
|
|
960 |
if (inBlock) { |
if (inBlock) { |
961 |
if (blockClass == 'preformatted-text' && |
if (blockClass == 'raw' && |
962 |
|
rawEndRegExp.test(line)) { |
963 |
|
inBlock = false; |
964 |
|
blockContents.push(RegExp.$1); |
965 |
|
line = line.substring((RegExp.$1+RegExp.$2).length); |
966 |
|
|
967 |
|
eval('var xml = <hbox class="raw" onclick="event.stopPropagation();" onkeypress="event.stopPropagation();">'+blockContents.join('\n')+'</hbox>;'); |
968 |
|
importNodeTreeWithDelay(importE4XNode(xml, document, XULNS), lineBox, XULNS); |
969 |
|
|
970 |
|
blockClass = ''; |
971 |
|
blockContents = []; |
972 |
|
} |
973 |
|
else if (blockClass == 'preformatted-text' && |
974 |
preEndRegExp.test(line)) { |
preEndRegExp.test(line)) { |
975 |
inBlock = false; |
inBlock = false; |
976 |
blockContents.push(RegExp.$1); |
blockContents.push(RegExp.$1); |
977 |
line = line.substring((RegExp.$1+RegExp.$2).length); |
line = line.substring((RegExp.$1+RegExp.$2).length); |
978 |
|
|
979 |
fragment.lastChild.appendChild(document.createElement('description')); |
lineBox.appendChild(document.createElement('description')); |
980 |
fragment.lastChild.lastChild.setAttribute('class', 'preformatted-text block'); |
lineBox.lastChild.setAttribute('class', 'preformatted-text block'); |
981 |
fragment.lastChild.lastChild.appendChild(document.createTextNode( |
lineBox.lastChild.appendChild(document.createTextNode( |
982 |
blockContents.join('\n') |
blockContents.join('\n') |
983 |
.replace(/^[\r\n\s]+/, '') |
.replace(/^[\r\n\s]+/, '') |
984 |
.replace(/[\r\n\s]+$/, '') |
.replace(/[\r\n\s]+$/, '') |
996 |
blockContents.push(RegExp.$1); |
blockContents.push(RegExp.$1); |
997 |
line = line.substring((RegExp.$1+RegExp.$2).length); |
line = line.substring((RegExp.$1+RegExp.$2).length); |
998 |
|
|
999 |
fragment.lastChild.appendChild(document.createElement('vbox')); |
lineBox.appendChild(document.createElement('vbox')); |
1000 |
fragment.lastChild.lastChild.setAttribute('class', blockClass+' block'); |
lineBox.lastChild.setAttribute('class', blockClass+' block'); |
1001 |
fragment.lastChild.lastChild.setAttribute('align', this.data[this.offset].align); |
lineBox.lastChild.setAttribute('align', this.data[this.offset].align); |
1002 |
blockContents = blockContents.join('\n') |
blockContents = blockContents.join('\n') |
1003 |
.replace(/^[\r\n\s]+/, '') |
.replace(/^[\r\n\s]+/, '') |
1004 |
.replace(/[\r\n\s]+$/, '') |
.replace(/[\r\n\s]+$/, '') |
1005 |
.split('\n'); |
.split('\n'); |
1006 |
for (var j = 0, jmax = blockContents.length; j < jmax; j++) |
for (var j = 0, jmax = blockContents.length; j < jmax; j++) |
1007 |
{ |
{ |
1008 |
fragment.lastChild.lastChild.appendChild(document.createElement('description')); |
lineBox.lastChild.appendChild(document.createElement('description')); |
1009 |
fragment.lastChild.lastChild.lastChild.setAttribute('value', blockContents[j]); |
lineBox.lastChild.lastChild.setAttribute('value', blockContents[j]); |
1010 |
} |
} |
1011 |
|
|
1012 |
blockClass = ''; |
blockClass = ''; |
1018 |
} |
} |
1019 |
} |
} |
1020 |
|
|
1021 |
|
if (line.indexOf('|') == 0) { |
1022 |
|
fragment.appendChild(lineBox); |
1023 |
|
|
1024 |
|
if (fragment.childNodes.length == 1 || |
1025 |
|
!fragment.childNodes[fragment.childNodes.length-2] || |
1026 |
|
!fragment.childNodes[fragment.childNodes.length-2].lastChild || |
1027 |
|
fragment.childNodes[fragment.childNodes.length-2].lastChild.localName != 'grid') { |
1028 |
|
fragment.lastChild.appendChild(document.createElement('grid')); |
1029 |
|
fragment.lastChild.lastChild.appendChild(document.createElement('columns')); |
1030 |
|
fragment.lastChild.lastChild.appendChild(document.createElement('rows')); |
1031 |
|
} |
1032 |
|
else { |
1033 |
|
fragment.removeChild(fragment.lastChild); |
1034 |
|
} |
1035 |
|
fragment.lastChild.lastChild.lastChild.appendChild(document.createElement('row')); |
1036 |
|
fragment.lastChild.lastChild.lastChild.lastChild.setAttribute('flex', 1); |
1037 |
|
|
1038 |
|
line = line.split('|'); |
1039 |
|
for (var j = 1, jmax = line.length; j < jmax; j++) |
1040 |
|
{ |
1041 |
|
fragment.lastChild.lastChild.lastChild.lastChild.appendChild(document.createElement('vbox')); |
1042 |
|
fragment.lastChild.lastChild.lastChild.lastChild.lastChild.setAttribute('align', this.data[this.offset].align); |
1043 |
|
fragment.lastChild.lastChild.lastChild.lastChild.lastChild.setAttribute('pack', 'center'); |
1044 |
|
if (line[j].charAt(0) == '~') { |
1045 |
|
fragment.lastChild.lastChild.lastChild.lastChild.lastChild.setAttribute('class', 'special'); |
1046 |
|
line[j] = line[j].substring(1); |
1047 |
|
} |
1048 |
|
line[j] = line[j].split(/<br\s*\/>/g); |
1049 |
|
for (var k = 0, kmax = line[j].length; k < kmax; k++) |
1050 |
|
{ |
1051 |
|
fragment.lastChild.lastChild.lastChild.lastChild.lastChild.appendChild(document.createElement('description')); |
1052 |
|
fragment.lastChild.lastChild.lastChild.lastChild.lastChild.lastChild.appendChild(document.createTextNode(line[j][k].replace(/^\s+|\s+$/g, ''))); |
1053 |
|
} |
1054 |
|
if (fragment.lastChild.lastChild.firstChild.childNodes.length < j) { |
1055 |
|
fragment.lastChild.lastChild.firstChild.appendChild(document.createElement('column')); |
1056 |
|
fragment.lastChild.lastChild.firstChild.lastChild.setAttribute('flex', 1); |
1057 |
|
} |
1058 |
|
} |
1059 |
|
continue; |
1060 |
|
} |
1061 |
|
|
1062 |
|
|
1063 |
while (line.match(lineRegExp)) |
while (line.match(lineRegExp)) |
1064 |
{ |
{ |
1065 |
if (RegExp.$1) { |
if (RegExp.$1) { |
1066 |
fragment.lastChild.appendChild(document.createElement('description')); |
lineBox.appendChild(document.createElement('description')); |
1067 |
fragment.lastChild.lastChild.setAttribute('value', RegExp.$1); |
lineBox.lastChild.setAttribute('value', RegExp.$1); |
1068 |
} |
} |
1069 |
newLine = line.substring((RegExp.$1+RegExp.$2).length); |
newLine = line.substring((RegExp.$1+RegExp.$2).length); |
1070 |
|
|
1071 |
|
// Raw Codes: Parsed as XML |
1072 |
|
if (rawRegExp.test(line)) { |
1073 |
|
eval('var xml = <hbox class="raw" onclick="event.stopPropagation();" onkeypress="event.stopPropagation();">'+RegExp.$3+'</hbox>;'); |
1074 |
|
importNodeTreeWithDelay(importE4XNode(xml, document, XULNS), lineBox, XULNS); |
1075 |
|
} |
1076 |
|
else if (rawStartRegExp.test(line)) { |
1077 |
|
inBlock = true; |
1078 |
|
blockClass = 'raw'; |
1079 |
|
blockContents = [RegExp.$3]; |
1080 |
|
newLine = ''; |
1081 |
|
} |
1082 |
|
|
1083 |
// Preformatted Text |
// Preformatted Text |
1084 |
if (preRegExp.test(line)) { |
if (preRegExp.test(line)) { |
1085 |
fragment.lastChild.appendChild(document.createElement('description')); |
lineBox.appendChild(document.createElement('description')); |
1086 |
fragment.lastChild.lastChild.setAttribute('value', RegExp.$2); |
lineBox.lastChild.setAttribute('value', RegExp.$2); |
1087 |
fragment.lastChild.lastChild.setAttribute('class', 'preformatted-text'); |
lineBox.lastChild.setAttribute('class', 'preformatted-text'); |
1088 |
} |
} |
1089 |
else if (preStartRegExp.test(line)) { |
else if (preStartRegExp.test(line)) { |
1090 |
inBlock = true; |
inBlock = true; |
1095 |
|
|
1096 |
// Emphasis |
// Emphasis |
1097 |
else if (emRegExp.test(line)) { |
else if (emRegExp.test(line)) { |
1098 |
fragment.lastChild.appendChild(document.createElement('description')); |
lineBox.appendChild(document.createElement('description')); |
1099 |
fragment.lastChild.lastChild.setAttribute('value', RegExp.$2); |
lineBox.lastChild.setAttribute('value', RegExp.$2); |
1100 |
fragment.lastChild.lastChild.setAttribute('class', 'em-text'); |
lineBox.lastChild.setAttribute('class', 'em-text'); |
1101 |
} |
} |
1102 |
else if (emStartRegExp.test(line)) { |
else if (emStartRegExp.test(line)) { |
1103 |
inBlock = true; |
inBlock = true; |
1108 |
|
|
1109 |
// User-defined Styles |
// User-defined Styles |
1110 |
else if (styleRegExp.test(line)) { |
else if (styleRegExp.test(line)) { |
1111 |
fragment.lastChild.appendChild(document.createElement('description')); |
lineBox.appendChild(document.createElement('description')); |
1112 |
fragment.lastChild.lastChild.setAttribute('value', RegExp.$3); |
lineBox.lastChild.setAttribute('value', RegExp.$3); |
1113 |
fragment.lastChild.lastChild.setAttribute('class', RegExp.$2); |
lineBox.lastChild.setAttribute('class', RegExp.$2); |
1114 |
} |
} |
1115 |
else if (styleStartRegExp.test(line)) { |
else if (styleStartRegExp.test(line)) { |
1116 |
inBlock = true; |
inBlock = true; |
1121 |
|
|
1122 |
// Images |
// Images |
1123 |
else if (imagesRegExp.test(line)) { |
else if (imagesRegExp.test(line)) { |
1124 |
fragment.lastChild.appendChild(document.createElement('image')); |
lineBox.appendChild(document.createElement('image')); |
1125 |
image_src = RegExp.$2; |
image_src = RegExp.$2; |
1126 |
if (image_src.indexOf('http://') < 0 && |
if (image_src.indexOf('http://') < 0 && |
1127 |
image_src.indexOf('https://') < 0) |
image_src.indexOf('https://') < 0) |
1128 |
image_src = this.dataFolder+image_src; |
image_src = this.dataFolder+image_src; |
1129 |
fragment.lastChild.lastChild.setAttribute('src', image_src); |
lineBox.lastChild.setAttribute('src', image_src); |
1130 |
fragment.lastChild.lastChild.setAttribute('width', parseInt(RegExp.$3 || '0')); |
lineBox.lastChild.setAttribute('width', parseInt(RegExp.$3 || '0')); |
1131 |
fragment.lastChild.lastChild.setAttribute('height', parseInt(RegExp.$4 || '0')); |
lineBox.lastChild.setAttribute('height', parseInt(RegExp.$4 || '0')); |
1132 |
image_width += parseInt(RegExp.$3 || '0'); |
image_width += parseInt(RegExp.$3 || '0'); |
1133 |
image_height = Math.max(image_height, parseInt(RegExp.$4 || '0')); |
image_height = Math.max(image_height, parseInt(RegExp.$4 || '0')); |
1134 |
} |
} |
1138 |
uri = RegExp.$4; |
uri = RegExp.$4; |
1139 |
if (uri.indexOf('://') < 0) |
if (uri.indexOf('://') < 0) |
1140 |
uri = this.dataFolder+uri; |
uri = this.dataFolder+uri; |
1141 |
fragment.lastChild.appendChild(document.createElement('description')); |
lineBox.appendChild(document.createElement('description')); |
1142 |
fragment.lastChild.lastChild.setAttribute('value', RegExp.$3 || RegExp.$4); |
lineBox.lastChild.setAttribute('value', RegExp.$3 || RegExp.$4); |
1143 |
fragment.lastChild.lastChild.setAttribute('href', uri); |
lineBox.lastChild.setAttribute('href', uri); |
1144 |
fragment.lastChild.lastChild.setAttribute('tooltiptext', uri); |
lineBox.lastChild.setAttribute('tooltiptext', uri); |
1145 |
fragment.lastChild.lastChild.setAttribute('statustext', uri); |
lineBox.lastChild.setAttribute('statustext', uri); |
1146 |
fragment.lastChild.lastChild.setAttribute('class', 'link-text'); |
lineBox.lastChild.setAttribute('class', 'link-text'); |
1147 |
|
|
1148 |
this.clickableNodes.push(fragment.lastChild.lastChild); |
this.clickableNodes.push(lineBox.lastChild); |
1149 |
} |
} |
1150 |
|
|
1151 |
// modify font size and wiki-style |
// modify font size and wiki-style |
1152 |
else if (wikiRegExp.test(line)) { |
else if (wikiRegExp.test(line)) { |
1153 |
fragment.lastChild.appendChild(document.createElement('description')); |
lineBox.appendChild(document.createElement('description')); |
1154 |
fragment.lastChild.lastChild.setAttribute('value', RegExp.$5); |
lineBox.lastChild.setAttribute('value', RegExp.$5); |
1155 |
var style = 'font-size:'+ ( RegExp.$2 || 100 ) +'%'; |
var style = 'font-size:'+ ( RegExp.$2 || 100 ) +'%'; |
1156 |
if (RegExp.$4 == '*') { |
if (RegExp.$4 == '*') { |
1157 |
style += '; font-weight: bold;'; |
style += '; font-weight: bold;'; |
1159 |
style += '; font-style: italic;'; |
style += '; font-style: italic;'; |
1160 |
} else if (RegExp.$4 == '_') { |
} else if (RegExp.$4 == '_') { |
1161 |
style += '; text-decoration: underline;'; |
style += '; text-decoration: underline;'; |
1162 |
|
} else if (RegExp.$4 == '-') { |
1163 |
|
style += '; text-decoration: line-through;'; |
1164 |
} |
} |
1165 |
fragment.lastChild.lastChild.setAttribute('style', style); |
lineBox.lastChild.setAttribute('style', style); |
1166 |
if (RegExp.$3 == '!') fragment.lastChild.lastChild.setAttribute('class', 'em-text'); |
if (RegExp.$3 == '!') lineBox.lastChild.setAttribute('class', 'em-text'); |
1167 |
else if (RegExp.$3 == '#') fragment.lastChild.lastChild.setAttribute('class', 'preformatted-text'); |
else if (RegExp.$3 == '#') lineBox.lastChild.setAttribute('class', 'preformatted-text'); |
1168 |
} |
} |
1169 |
|
|
1170 |
// Monta |
// Monta |
1171 |
else if (montaRegExp.test(line)) { |
else if (montaRegExp.test(line)) { |
1172 |
fragment.lastChild.appendChild(document.createElement('stack')); |
lineBox.appendChild(document.createElement('stack')); |
1173 |
|
|
1174 |
fragment.lastChild.lastChild.appendChild(document.createElement('description')); |
lineBox.lastChild.appendChild(document.createElement('description')); |
1175 |
fragment.lastChild.lastChild.lastChild.setAttribute('value', RegExp.$2); |
lineBox.lastChild.lastChild.setAttribute('value', RegExp.$2); |
1176 |
fragment.lastChild.lastChild.lastChild.setAttribute('class', 'monta-text'); |
lineBox.lastChild.lastChild.setAttribute('class', 'monta-text'); |
1177 |
|
|
1178 |
fragment.lastChild.lastChild.appendChild(document.createElement('spacer')); |
lineBox.lastChild.appendChild(document.createElement('spacer')); |
1179 |
fragment.lastChild.lastChild.lastChild.setAttribute('flex', 1); |
lineBox.lastChild.lastChild.setAttribute('flex', 1); |
1180 |
fragment.lastChild.lastChild.lastChild.setAttribute('class', 'monta-label'); |
lineBox.lastChild.lastChild.setAttribute('class', 'monta-label'); |
1181 |
|
|
1182 |
fragment.lastChild.lastChild.lastChild.setAttribute('label-id', 'label-' + (++labelId)); |
lineBox.lastChild.lastChild.setAttribute('label-id', 'label-' + (++labelId)); |
1183 |
|
|
1184 |
if (!this.shownMontaLabels[this.offset] || !this.shownMontaLabels[this.offset]['label-'+labelId]) { |
lineBox.lastChild.lastChild.setAttribute('monta-hidden', 'true'); |
|
fragment.lastChild.lastChild.lastChild.setAttribute('monta-hidden', 'true'); |
|
|
this.standByMontaLabels[this.standByMontaLabels.length] = fragment.lastChild.lastChild.lastChild; |
|
|
} |
|
|
else { |
|
|
fragment.lastChild.lastChild.lastChild.setAttribute('monta-hidden', 'false'); |
|
|
} |
|
1185 |
|
|
1186 |
this.clickableNodes.push(fragment.lastChild.lastChild.lastChild); |
this.clickableNodes.push(lineBox.lastChild.lastChild); |
1187 |
} |
} |
1188 |
|
|
1189 |
line = newLine; |
line = newLine; |
1190 |
} |
} |
1191 |
|
|
1192 |
if (line) { |
if (line) { |
1193 |
fragment.lastChild.appendChild(document.createElement('description')); |
lineBox.appendChild(document.createElement('description')); |
1194 |
fragment.lastChild.lastChild.setAttribute('value', line); |
lineBox.lastChild.setAttribute('value', line); |
1195 |
} |
} |
1196 |
|
|
1197 |
image_total_width = Math.max(image_total_width, image_width); |
retVal.offsetWidth = Math.max(retVal.offsetWidth, image_width); |
1198 |
image_total_height += image_height; |
retVal.offsetHeight += image_height; |
|
} |
|
|
|
|
|
this.content.setAttribute('style', 'font-size:10px;'); |
|
|
this.content.appendChild(fragment); |
|
|
|
|
|
this.clickableNodes.push(this.content); |
|
|
|
|
|
|
|
|
this.fitToCanvas(this.header, this.header.parentNode, 0, 0); |
|
|
this.fitToCanvas(this.footer, this.footer.parentNode, 0, 0); |
|
|
this.fitToCanvas( |
|
|
this.content, |
|
|
this.canvas, |
|
|
image_total_width, |
|
|
image_total_height |
|
|
+(this.header.boxObject.height*2) |
|
|
// +(this.footer.boxObject.height*2) |
|
|
); |
|
|
|
|
|
|
|
|
var checkedItems = this.list.getElementsByAttribute('checked', 'true'); |
|
|
max = checkedItems.length; |
|
|
for (i = 0; i < max; i++) |
|
|
checkedItems[i].removeAttribute('checked'); |
|
|
|
|
|
this.list.getElementsByAttribute('value', this.offset)[0].setAttribute('checked', true); |
|
1199 |
|
|
1200 |
this.canvas.removeAttribute('rendering'); |
if (lineBox.hasChildNodes()) |
1201 |
this.setHash('page', 'page'+(this.offset+1)); |
fragment.appendChild(lineBox); |
1202 |
|
} |
|
this.next.value = (this.offset <= this.data.length-2) ? (this.data[this.offset+1].plain.join('') || this.data[this.offset+1].text.join('')).replace(/\s+/g, ' ') : '(no page)' ; |
|
|
this.remainder.setAttribute('value', this.offset == 0 ? 0 : parseInt(((this.offset)/(this.data.length-1))*100)); |
|
1203 |
|
|
1204 |
var event = document.createEvent('Events'); |
retVal.fragment = fragment; |
1205 |
event.initEvent('PresentationRedraw', false, true); |
return retVal; |
|
this.canvas.dispatchEvent(event); |
|
1206 |
}, |
}, |
1207 |
|
|
1208 |
fitToCanvas : function(aContent, aCanvas, aOffsetWidth, aOffsetHeight) |
fitToCanvas : function(aContent, aCanvas, aOffsetWidth, aOffsetHeight) |
1209 |
{ |
{ |
1210 |
aContent.removeAttribute('style'); |
aContent.removeAttribute('style'); |
1211 |
aContent.setAttribute('style', 'font-size:10px;'); |
aContent.setAttribute('style', 'font-size:10px;'); |
1212 |
|
|
1213 |
|
var grids = aContent.getElementsByTagName('grid'); |
1214 |
|
var gridsCount = grids.length; |
1215 |
|
|
1216 |
if (!aContent.boxObject.width) return; |
if (!aContent.boxObject.width) return; |
1217 |
|
|
1218 |
var canvas_w = aCanvas.boxObject.width; |
var canvas_w = aCanvas.boxObject.width; |
1222 |
var new_fs = Math.round((canvas_w/content_w) * this.size); |
var new_fs = Math.round((canvas_w/content_w) * this.size); |
1223 |
aContent.setAttribute('style', 'font-size:'+ new_fs + "px"); |
aContent.setAttribute('style', 'font-size:'+ new_fs + "px"); |
1224 |
|
|
1225 |
|
for (var i = 0; i < gridsCount; i++) |
1226 |
|
{ |
1227 |
|
grids[i].firstChild.lastChild.removeAttribute('flex', 1); |
1228 |
|
grids[i].firstChild.lastChild.setAttribute('flex', 1); |
1229 |
|
} |
1230 |
|
|
1231 |
if (aContent.boxObject.width < aOffsetWidth) { |
if (aContent.boxObject.width < aOffsetWidth) { |
1232 |
content_w = aOffsetWidth; |
content_w = aOffsetWidth; |
1233 |
new_fs = Math.round((canvas_w/content_w) * this.size); |
new_fs = Math.round((canvas_w/content_w) * this.size); |
1234 |
aContent.setAttribute('style', 'font-size:'+ new_fs + "px"); |
aContent.setAttribute('style', 'font-size:'+ new_fs + "px"); |
1235 |
|
|
1236 |
|
for (var i = 0; i < gridsCount; i++) |
1237 |
|
{ |
1238 |
|
grids[i].firstChild.lastChild.removeAttribute('flex', 1); |
1239 |
|
grids[i].firstChild.lastChild.setAttribute('flex', 1); |
1240 |
|
} |
1241 |
} |
} |
1242 |
|
|
1243 |
var content_h = aContent.boxObject.height; |
var content_h = aContent.boxObject.height; |
1246 |
content_h = aContent.boxObject.height; |
content_h = aContent.boxObject.height; |
1247 |
new_fs = Math.round((canvas_h/content_h) * new_fs); |
new_fs = Math.round((canvas_h/content_h) * new_fs); |
1248 |
aContent.setAttribute('style', 'font-size:'+ new_fs + "px"); |
aContent.setAttribute('style', 'font-size:'+ new_fs + "px"); |
1249 |
|
|
1250 |
|
for (var i = 0; i < gridsCount; i++) |
1251 |
|
{ |
1252 |
|
grids[i].firstChild.lastChild.removeAttribute('flex', 1); |
1253 |
|
grids[i].firstChild.lastChild.setAttribute('flex', 1); |
1254 |
|
} |
1255 |
} |
} |
1256 |
}, |
}, |
1257 |
|
fitMainContentToCanvas : function() |
1258 |
|
{ |
1259 |
|
this.fitToCanvas( |
1260 |
|
this.content, |
1261 |
|
this.canvas, |
1262 |
|
parseInt(this.content.getAttribute('offsetWidth')), |
1263 |
|
parseInt(this.content.getAttribute('offsetHeight')) |
1264 |
|
+this.header.boxObject.height |
1265 |
|
+this.footer.boxObject.height |
1266 |
|
); |
1267 |
|
}, |
1268 |
|
fitHeaderFooterToCanvas : function() |
1269 |
|
{ |
1270 |
|
this.fitToCanvas(this.header, this.header.parentNode, 0, 0); |
1271 |
|
this.fitToCanvas(this.footer, this.footer.parentNode, 0, 0); |
1272 |
|
}, |
1273 |
|
|
1274 |
reload : function() { |
reload : function() { |
1275 |
var file = String(location.href).replace(/#.+$/, ''); |
var file = String(location.href).replace(/#.+$/, ''); |
1276 |
if (this.dataPath != file) { |
if (this.dataPath != file) { |
1277 |
var path = this.dataPath; |
var path = this.dataPath; |
1278 |
var request = new XMLHttpRequest(); |
var request = new XMLHttpRequest(); |
1279 |
request.open('GET', path); |
request.open('GET', path + '?rand=' + Math.random() ); |
1280 |
request.onload = function() { |
request.onload = function() { |
1281 |
Presentation.textbox.value = request.responseText; |
Presentation.textbox.value = request.responseText; |
1282 |
Presentation.data = Presentation.textbox.value; |
Presentation.data = Presentation.textbox.value; |
1292 |
}, |
}, |
1293 |
|
|
1294 |
forward : function(){ |
forward : function(){ |
1295 |
|
if (!this.canForward) return; |
1296 |
this.offset++; |
this.offset++; |
1297 |
this.takahashi(); |
this.takahashi(); |
1298 |
}, |
}, |
1299 |
forwardStep : function(){ |
forwardStep : function(){ |
1300 |
if (this.standByMontaLabels.length > 0) { |
if (!this.canForward) return; |
1301 |
while (this.standByMontaLabels.length && |
var monta = document.getElementsByAttribute('monta-hidden', 'true'); |
1302 |
this.standByMontaLabels[0].getAttribute('monta-hidden') != 'true') |
if (monta && monta.length) { |
1303 |
this.standByMontaLabels.splice(0, 1); |
this.showMontaKeyword(monta[0]); |
|
|
|
|
if (this.standByMontaLabels.length) { |
|
|
this.showMontaKeyword(this.standByMontaLabels[0]); |
|
|
this.standByMontaLabels.splice(0, 1); |
|
|
} |
|
1304 |
} |
} |
1305 |
else |
else |
1306 |
this.forward(); |
this.forward(); |
1307 |
}, |
}, |
1308 |
back : function(){ |
back : function(){ |
1309 |
|
if (!this.canBack) return; |
1310 |
this.offset--; |
this.offset--; |
1311 |
if(this.offset < 0){this.offset = 0} |
if(this.offset < 0){this.offset = 0} |
1312 |
this.takahashi(); |
this.takahashi(); |
1313 |
}, |
}, |
1314 |
home : function(){ |
home : function(){ |
1315 |
|
if (!this.canMove) return; |
1316 |
this.offset = 0; |
this.offset = 0; |
1317 |
this.takahashi(); |
this.takahashi(); |
1318 |
}, |
}, |
1319 |
end : function(){ |
end : function(){ |
1320 |
|
if (!this.canMove) return; |
1321 |
this.offset = this.data.length-1; |
this.offset = this.data.length-1; |
1322 |
this.takahashi(); |
this.takahashi(); |
1323 |
}, |
}, |
1324 |
showPage : function(aPageOffset){ |
showPage : function(aPageOffset){ |
1325 |
|
if (!this.canMove) return; |
1326 |
this.offset = aPageOffset ? aPageOffset : 0 ; |
this.offset = aPageOffset ? aPageOffset : 0 ; |
1327 |
this.takahashi(); |
this.takahashi(); |
1328 |
}, |
}, |
1329 |
|
|
1330 |
|
get canMove() |
1331 |
|
{ |
1332 |
|
return ( |
1333 |
|
this.isRendering || |
1334 |
|
importNodeTreeWithDelayTimers || |
1335 |
|
this.montaAnimating |
1336 |
|
) ? false : true ; |
1337 |
|
}, |
1338 |
|
get canBack() |
1339 |
|
{ |
1340 |
|
return this.canMove; |
1341 |
|
}, |
1342 |
|
get canForward() |
1343 |
|
{ |
1344 |
|
return this.canMove; |
1345 |
|
}, |
1346 |
|
|
1347 |
|
|
1348 |
insert : function(aType) { |
insert : function(aType) { |
1349 |
switch (aType) |
switch (aType) |
1350 |
{ |
{ |
1405 |
var check = document.getElementById('toggleEva'); |
var check = document.getElementById('toggleEva'); |
1406 |
if (this.canvas.getAttribute('eva') == 'true') { |
if (this.canvas.getAttribute('eva') == 'true') { |
1407 |
this.canvas.removeAttribute('eva'); |
this.canvas.removeAttribute('eva'); |
1408 |
|
this.logo.removeAttribute('eva'); |
1409 |
check.checked = false; |
check.checked = false; |
1410 |
} |
} |
1411 |
else { |
else { |
1412 |
this.canvas.setAttribute('eva', true); |
this.canvas.setAttribute('eva', true); |
1413 |
|
this.logo.setAttribute('eva',true); |
1414 |
check.checked = true; |
check.checked = true; |
1415 |
} |
} |
1416 |
this.setHash('eva', check.checked ? 'eva' : '' ); |
this.setHash('eva', check.checked ? 'eva' : '' ); |
1448 |
var autoCruise = document.getElementById('autoButton'); |
var autoCruise = document.getElementById('autoButton'); |
1449 |
if (!autoCruise.checked) return; |
if (!autoCruise.checked) return; |
1450 |
|
|
1451 |
if(Presentation.offset == Presentation.data.length-1) { |
if (Presentation.offset == Presentation.data.length-1) { |
1452 |
Presentation.home(); |
if (Presentation.canMove) |
1453 |
|
Presentation.home(); |
1454 |
} |
} |
1455 |
else { |
else { |
1456 |
Presentation.forwardStep(); |
if (Presentation.canForward) |
1457 |
|
Presentation.forwardStep(); |
1458 |
} |
} |
1459 |
Presentation.autoCruiseTimer = window.setTimeout(arguments.callee, Presentation.autoCruiseInterval); |
Presentation.autoCruiseTimer = window.setTimeout(arguments.callee, Presentation.autoCruiseInterval); |
1460 |
}, |
}, |
1478 |
}, |
}, |
1479 |
|
|
1480 |
|
|
1481 |
showMontaKeyword : function(aNode) { |
showMontaKeyword : function(aNode, aWithoutAnimation) { |
1482 |
if (aNode.getAttribute('monta-hidden') != 'true') return; |
if (aNode.getAttribute('monta-hidden') != 'true') return; |
1483 |
|
|
1484 |
|
if (aWithoutAnimation) { |
1485 |
|
aNode.setAttribute('monta-hidden', 'false'); |
1486 |
|
return; |
1487 |
|
} |
1488 |
|
|
1489 |
aNode.setAttribute('monta-hidden', 'progress'); |
aNode.setAttribute('monta-hidden', 'progress'); |
1490 |
|
|
1491 |
|
this.montaAnimating = true; |
1492 |
|
|
1493 |
window.setTimeout(this.showMontaKeywordCallback, 0, { |
window.setTimeout(this.showMontaKeywordCallback, 0, { |
1494 |
position : -100, |
position : -100, |
1495 |
node : aNode, |
node : aNode, |
1499 |
showMontaKeywordCallback : function(aInfo) { |
showMontaKeywordCallback : function(aInfo) { |
1500 |
if (aInfo.position >= aInfo.node.boxObject.width) { |
if (aInfo.position >= aInfo.node.boxObject.width) { |
1501 |
aInfo.node.setAttribute('monta-hidden', 'false'); |
aInfo.node.setAttribute('monta-hidden', 'false'); |
1502 |
if (!Presentation.shownMontaLabels[Presentation.offset]) |
Presentation.montaAnimating = false; |
|
Presentation.shownMontaLabels[Presentation.offset] = []; |
|
|
Presentation.shownMontaLabels[Presentation.offset][aInfo.node.getAttribute('label-id')] = true; |
|
1503 |
return; |
return; |
1504 |
} |
} |
1505 |
|
|
1507 |
aInfo.node.setAttribute('style', 'background-position: '+aInfo.position+'px 0 !important;'); |
aInfo.node.setAttribute('style', 'background-position: '+aInfo.position+'px 0 !important;'); |
1508 |
window.setTimeout(arguments.callee, aInfo.interval, aInfo); |
window.setTimeout(arguments.callee, aInfo.interval, aInfo); |
1509 |
}, |
}, |
1510 |
|
montaAnimating : false, |
1511 |
|
|
1512 |
|
|
1513 |
|
|
1514 |
onPresentationClick : function(aEvent) |
onPresentationClick : function(aEvent) |
1515 |
{ |
{ |
1516 |
|
if (this.isPrinting) { |
1517 |
|
if (confirm('Do you want printing operation to be stopped?')) { |
1518 |
|
this.stopPrint(); |
1519 |
|
} |
1520 |
|
return; |
1521 |
|
} |
1522 |
|
|
1523 |
if (!this.isToolbarHidden) |
if (!this.isToolbarHidden) |
1524 |
this.showHideToolbar(); |
this.showHideToolbar(); |
1525 |
|
|
1559 |
}, |
}, |
1560 |
|
|
1561 |
onScrollerDragStart : function(){ |
onScrollerDragStart : function(){ |
1562 |
|
if (this.isPrinting) return; |
1563 |
|
|
1564 |
this.scroller.dragging = true; |
this.scroller.dragging = true; |
1565 |
}, |
}, |
1566 |
onScrollerDragMove : function(){ |
onScrollerDragMove : function(){ |
1567 |
|
if (this.isPrinting) return; |
1568 |
|
|
1569 |
if (this.scroller.dragging) |
if (this.scroller.dragging) |
1570 |
this.showPage(parseInt(this.scroller.getAttribute('curpos'))); |
this.showPage(parseInt(this.scroller.getAttribute('curpos'))); |
1571 |
}, |
}, |
1572 |
onScrollerDragDrop : function(){ |
onScrollerDragDrop : function(){ |
1573 |
|
if (this.isPrinting) return; |
1574 |
|
|
1575 |
this.onScrollerDragMove(); |
this.onScrollerDragMove(); |
1576 |
this.scroller.dragging = false; |
this.scroller.dragging = false; |
1577 |
}, |
}, |
1578 |
|
|
1579 |
onIndicatorBarClick : function(aEvent) |
onIndicatorBarClick : function(aEvent) |
1580 |
{ |
{ |
1581 |
|
if (this.isPrinting) return; |
1582 |
|
|
1583 |
var bar = this.indicatorBar; |
var bar = this.indicatorBar; |
1584 |
this.showPage(Math.round((aEvent.screenX - bar.boxObject.screenX) / bar.boxObject.width * this.data.length)); |
this.showPage(Math.round((aEvent.screenX - bar.boxObject.screenX) / bar.boxObject.width * this.data.length)); |
1585 |
}, |
}, |
1586 |
onIndicatorBarDragStart : function() |
onIndicatorBarDragStart : function() |
1587 |
{ |
{ |
1588 |
|
if (this.isPrinting) return; |
1589 |
|
|
1590 |
this.indicatorBar.dragging = true; |
this.indicatorBar.dragging = true; |
1591 |
}, |
}, |
1592 |
onIndicatorBarDragMove : function(aEvent) |
onIndicatorBarDragMove : function(aEvent) |
1593 |
{ |
{ |
1594 |
|
if (this.isPrinting) return; |
1595 |
|
|
1596 |
var bar = this.indicatorBar; |
var bar = this.indicatorBar; |
1597 |
this.showPage(Math.round((aEvent.screenX - bar.boxObject.screenX) / bar.boxObject.width * this.data.length)); |
this.showPage(Math.round((aEvent.screenX - bar.boxObject.screenX) / bar.boxObject.width * this.data.length)); |
1598 |
}, |
}, |
1599 |
onIndicatorBarDragEnd : function(aEvent) |
onIndicatorBarDragEnd : function(aEvent) |
1600 |
{ |
{ |
1601 |
|
if (this.isPrinting) return; |
1602 |
|
|
1603 |
this.onIndicatorBarDragMove(aEvent); |
this.onIndicatorBarDragMove(aEvent); |
1604 |
this.indicatorBar.dragging = false; |
this.indicatorBar.dragging = false; |
1605 |
}, |
}, |
1606 |
|
|
1607 |
onEdit : function() { |
onEdit : function() { |
1608 |
|
if (this.isPrinting) return; |
1609 |
|
|
1610 |
this.data = this.textbox.value; |
this.data = this.textbox.value; |
1611 |
this.init(); |
this.init(); |
1612 |
}, |
}, |
1613 |
|
|
1614 |
onKeyPress : function(aEvent) { |
onKeyPress : function(aEvent) { |
1615 |
|
if (this.isPrinting) return; |
1616 |
|
|
1617 |
switch(aEvent.keyCode) |
switch(aEvent.keyCode) |
1618 |
{ |
{ |
1619 |
case aEvent.DOM_VK_BACK_SPACE: |
case aEvent.DOM_VK_BACK_SPACE: |
1632 |
|
|
1633 |
handleEvent : function(aEvent) |
handleEvent : function(aEvent) |
1634 |
{ |
{ |
1635 |
|
if (this.isPrinting) return; |
1636 |
|
|
1637 |
|
var node = aEvent.target; |
1638 |
|
var inRawContents = false; |
1639 |
|
do { |
1640 |
|
if (node.nodeType == Node.ELEMENT_NODE && |
1641 |
|
/\braw\b/i.test(node.getAttribute('class'))) { |
1642 |
|
inRawContents = true; |
1643 |
|
break; |
1644 |
|
} |
1645 |
|
|
1646 |
|
node = node.parentNode; |
1647 |
|
} |
1648 |
|
while (node.parentNode) |
1649 |
|
|
1650 |
|
|
1651 |
switch (aEvent.type) |
switch (aEvent.type) |
1652 |
{ |
{ |
1653 |
default: |
default: |
1666 |
|
|
1667 |
|
|
1668 |
case 'mouseup': |
case 'mouseup': |
1669 |
|
if (inRawContents) return; |
1670 |
this.dragStartX = -1; |
this.dragStartX = -1; |
1671 |
this.dragStartY = -1; |
this.dragStartY = -1; |
1672 |
if (this.indicatorBar.dragging) |
if (this.indicatorBar.dragging) |
1674 |
break; |
break; |
1675 |
|
|
1676 |
case 'mousedown': |
case 'mousedown': |
1677 |
|
if (inRawContents) return; |
1678 |
if (this.dragStartX < 0) { |
if (this.dragStartX < 0) { |
1679 |
this.dragStartX = aEvent.clientX; |
this.dragStartX = aEvent.clientX; |
1680 |
this.dragStartY = aEvent.clientY; |
this.dragStartY = aEvent.clientY; |
1688 |
break; |
break; |
1689 |
|
|
1690 |
case 'mousemove': |
case 'mousemove': |
1691 |
|
if (inRawContents) return; |
1692 |
this.checkShowHideToolbar(aEvent); |
this.checkShowHideToolbar(aEvent); |
1693 |
if (this.indicatorBar.dragging) { |
if (this.indicatorBar.dragging) { |
1694 |
this.onIndicatorBarDragMove(aEvent); |
this.onIndicatorBarDragMove(aEvent); |
1704 |
} |
} |
1705 |
break; |
break; |
1706 |
|
|
1707 |
|
case 'CanvasContentAdded': |
1708 |
|
if (this.fitToCanvasTimer) { |
1709 |
|
window.clearTimeout(this.fitToCanvasTimer); |
1710 |
|
this.fitToCanvasTimer = null; |
1711 |
|
} |
1712 |
|
this.fitToCanvasTimer = window.setTimeout('Presentation.fitMainContentToCanvas()', 100); |
1713 |
|
break; |
1714 |
|
|
1715 |
|
case 'DOMMouseScroll': |
1716 |
|
if ( |
1717 |
|
(aEvent.detail > 0 && this.scrollCounter < 0) || |
1718 |
|
(aEvent.detail < 0 && this.scrollCounter > 0) |
1719 |
|
) |
1720 |
|
this.scrollCounter = 0; |
1721 |
|
|
1722 |
|
this.scrollCounter += aEvent.detail; |
1723 |
|
if (Math.abs(this.scrollCounter) >= this.scrollThreshold) { |
1724 |
|
if (aEvent.detail > 0) |
1725 |
|
Presentation.forwardStep(); |
1726 |
|
else |
1727 |
|
Presentation.back(); |
1728 |
|
|
1729 |
|
this.scrollCounter = 0; |
1730 |
|
} |
1731 |
|
break; |
1732 |
} |
} |
1733 |
}, |
}, |
1734 |
dragStartX : -1, |
dragStartX : -1, |
1735 |
dragStartY : -1, |
dragStartY : -1, |
1736 |
|
scrollCounter : 0, |
1737 |
|
scrollThreshold : 10, |
1738 |
|
|
1739 |
|
|
1740 |
|
|
1744 |
toolbarTimer : null, |
toolbarTimer : null, |
1745 |
isToolbarHidden : false, |
isToolbarHidden : false, |
1746 |
checkShowHideToolbar : function(aEvent) { |
checkShowHideToolbar : function(aEvent) { |
1747 |
if (this.scroller.dragging || this.preventToShowHideToolbar) return; |
if (!this.scroller || this.scroller.dragging || this.preventToShowHideToolbar) return; |
1748 |
|
|
1749 |
this.onToolbarArea = (aEvent.clientY < this.toolbarHeight); |
this.onToolbarArea = (aEvent.clientY < this.toolbarHeight); |
1750 |
|
|
1762 |
toolbarAnimationSteps : 5, |
toolbarAnimationSteps : 5, |
1763 |
toolbarAnimationInfo : null, |
toolbarAnimationInfo : null, |
1764 |
toolbarAnimationTimer : null, |
toolbarAnimationTimer : null, |
1765 |
showHideToolbar : function() |
showHideToolbar : function(aWithoutAnimation) |
1766 |
{ |
{ |
1767 |
|
if (this.isPrinting) return; |
1768 |
|
|
1769 |
if (this.toolbarAnimationTimer) window.clearTimeout(this.toolbarAnimationTimer); |
if (this.toolbarAnimationTimer) window.clearTimeout(this.toolbarAnimationTimer); |
1770 |
|
|
1771 |
this.toolbarAnimationInfo = { count : 0 }; |
this.toolbarAnimationInfo = { count : 0 }; |
1781 |
|
|
1782 |
this.toolbar.setAttribute('style', 'margin-top:'+(0-(this.toolbarHeight-this.toolbarAnimationInfo.start))+'px; margin-bottom:'+(0-this.toolbarAnimationInfo.start)+'px;'); |
this.toolbar.setAttribute('style', 'margin-top:'+(0-(this.toolbarHeight-this.toolbarAnimationInfo.start))+'px; margin-bottom:'+(0-this.toolbarAnimationInfo.start)+'px;'); |
1783 |
|
|
1784 |
this.toolbarAnimationTimer = window.setTimeout('Presentation.animateToolbar()', this.toolbarAnimationDelay/this.toolbarAnimationSteps); |
if (aWithoutAnimation) { |
1785 |
|
this.toolbarAnimationInfo.current = this.toolbarHeight; |
1786 |
|
Presentation.animateToolbar(); |
1787 |
|
} |
1788 |
|
else { |
1789 |
|
this.toolbarAnimationTimer = window.setTimeout('Presentation.animateToolbar()', this.toolbarAnimationDelay/this.toolbarAnimationSteps); |
1790 |
|
} |
1791 |
}, |
}, |
1792 |
animateToolbar : function() |
animateToolbar : function() |
1793 |
{ |
{ |
1828 |
}, |
}, |
1829 |
|
|
1830 |
get data(){ |
get data(){ |
1831 |
|
var codes = document.getElementById('builtinCode'); |
1832 |
if (!this._data) { |
if (!this._data) { |
1833 |
// mozilla splits very long text node into multiple text nodes whose length is less than 4096 bytes. |
// mozilla splits very long text node into multiple text nodes whose length is less than 4096 bytes. |
1834 |
// so, we must concat all the text nodes. |
// so, we must concat all the text nodes. |
1835 |
this.textbox.value = ""; |
this.textbox.value = ""; |
1836 |
for (var i = 0; i < document.getElementById('builtinCode').childNodes.length; i++) { |
for (var i = 0; i < codes.childNodes.length; i++) { |
1837 |
this.textbox.value += document.getElementById('builtinCode').childNodes[i].nodeValue; |
this.textbox.value += codes.childNodes[i].nodeValue; |
1838 |
} |
} |
1839 |
|
|
1840 |
this._data = this.textbox.value.split(/----+/); |
this._data = this.textbox.value.split(/----+/); |
1841 |
this.initData(); |
this.initData(); |
1842 |
} |
} |
1843 |
|
if (codes) |
1844 |
|
codes.parentNode.removeChild(codes); |
1845 |
|
|
1846 |
return this._data; |
return this._data; |
1847 |
}, |
}, |
1883 |
|
|
1884 |
var plainTextRegExp = this.makePhraseRegExp('(%O%O\#[^:]+:(.+)%C%C|%O%OEM:(.+)(:EM)?%C%C|%O%OPRE:(.+)(:PRE)?%C%C|%O%Oima?ge? +src="[^"]*"[^%C]+%C%C|%O%O([^\\|%C]+)(\\|[^%C]+)?%C%C|%O([^%O]+)%C)', 'gi'); |
var plainTextRegExp = this.makePhraseRegExp('(%O%O\#[^:]+:(.+)%C%C|%O%OEM:(.+)(:EM)?%C%C|%O%OPRE:(.+)(:PRE)?%C%C|%O%Oima?ge? +src="[^"]*"[^%C]+%C%C|%O%O([^\\|%C]+)(\\|[^%C]+)?%C%C|%O([^%O]+)%C)', 'gi'); |
1885 |
|
|
1886 |
|
var hiddenRegExp = /^(HIDDEN|IGNORE)::true\n?/im; |
1887 |
|
|
1888 |
|
var loadRegExp = /^LOAD::(.+)\n?/im; |
1889 |
|
|
1890 |
var dataObj; |
var dataObj; |
1891 |
var i, j, |
var i, j, |
1892 |
max = this._data.length; |
max = this._data.length; |
1893 |
var fragment = document.createDocumentFragment(); |
var fragment = document.createDocumentFragment(); |
1894 |
var popup; |
var popup; |
1895 |
|
var dataPath; |
1896 |
for (i = 0; i < max; i++) |
for (i = 0; i < max; i++) |
1897 |
{ |
{ |
1898 |
image_src = null; |
image_src = null; |
1899 |
align = null; |
align = null; |
1900 |
|
dataPath = ''; |
1901 |
|
|
1902 |
this._data[i] = this._data[i] |
this._data[i] = this._data[i] |
1903 |
.replace(regexp[0], '') |
.replace(regexp[0], '') |
1904 |
.replace(regexp[1], '') |
.replace(regexp[1], '') |
1905 |
.replace(regexp[2], '\n'); |
.replace(regexp[2], '\n'); |
1906 |
|
|
1907 |
|
if (loadRegExp.test(this._data[i])) { |
1908 |
|
this._data[i] = this._data[i].replace(loadRegExp, ''); |
1909 |
|
dataPath = RegExp.$1; |
1910 |
|
} |
1911 |
|
|
1912 |
|
if (hiddenRegExp.test(this._data[i])) { |
1913 |
|
this._data.splice(i, 1); |
1914 |
|
max--; |
1915 |
|
i--; |
1916 |
|
continue; |
1917 |
|
} |
1918 |
|
|
1919 |
while (titleRegExp.test(this._data[i])) { |
while (titleRegExp.test(this._data[i])) { |
1920 |
this._data[i] = this._data[i].replace(titleRegExp, ''); |
this._data[i] = this._data[i].replace(titleRegExp, ''); |
1921 |
if (String(RegExp.$1).toUpperCase() == 'TITLE::') |
if (String(RegExp.$1).toUpperCase() == 'TITLE::') |
1962 |
} |
} |
1963 |
|
|
1964 |
this._data[i] = { |
this._data[i] = { |
1965 |
|
load : dataPath, |
1966 |
header : header, |
header : header, |
1967 |
footer : footer, |
footer : footer, |
1968 |
text : this._data[i].split('\n'), |
text : this._data[i].split('\n'), |
2097 |
} |
} |
2098 |
|
|
2099 |
if (param.match(/data=([^&;]+)/i)) { |
if (param.match(/data=([^&;]+)/i)) { |
2100 |
var path = unescape(RegExp.$1); |
this.loadData(RegExp.$1); |
|
this.dataPath = path; |
|
|
var request = new XMLHttpRequest(); |
|
|
request.open('GET', path); |
|
|
request.onload = function() { |
|
|
Presentation.textbox.value = request.responseText; |
|
|
Presentation.data = Presentation.textbox.value; |
|
|
Presentation.init(); |
|
|
}; |
|
|
request.send(null); |
|
2101 |
return false; |
return false; |
2102 |
} |
} |
2103 |
} |
} |
2104 |
return true; |
return true; |
2105 |
}, |
}, |
2106 |
|
loadData : function(aPath) |
2107 |
|
{ |
2108 |
|
this.dataPath = aPath; |
2109 |
|
var request = new XMLHttpRequest(); |
2110 |
|
request.open('GET', aPath); |
2111 |
|
request.onload = function() { |
2112 |
|
Presentation.textbox.value = request.responseText; |
2113 |
|
Presentation.data = Presentation.textbox.value; |
2114 |
|
Presentation.init(); |
2115 |
|
}; |
2116 |
|
request.send(null); |
2117 |
|
}, |
2118 |
|
|
2119 |
|
|
2120 |
|
|
2183 |
}, |
}, |
2184 |
timerStart : 0, |
timerStart : 0, |
2185 |
timerEnd : 0, |
timerEnd : 0, |
2186 |
timerTimer : null |
timerTimer : null, |
2187 |
|
|
2188 |
|
|
2189 |
|
|
2190 |
|
print : function() |
2191 |
|
{ |
2192 |
|
if (!this.canMove) { |
2193 |
|
alert('Please wait for a while, and retry later.'); |
2194 |
|
return; |
2195 |
|
} |
2196 |
|
|
2197 |
|
this.stopPrint(); |
2198 |
|
if (this.printWindow) { |
2199 |
|
this.printWindow.close(); |
2200 |
|
this.printWindow = null; |
2201 |
|
} |
2202 |
|
|
2203 |
|
if (!this.isToolbarHidden) |
2204 |
|
this.showHideToolbar(true); |
2205 |
|
|
2206 |
|
this.printWindow = window.open('output.htm', 'PresentationPrint', 'dependent=yes,hotkeys=yes,location=yes,menubar=yes,personalbar=yes,scrollbars=yes,status=yes,toolbar=yes'); |
2207 |
|
if (!this.printWindow) return; |
2208 |
|
|
2209 |
|
this.isPrinting = true; |
2210 |
|
|
2211 |
|
if (!this.printCanvas) |
2212 |
|
this.printCanvas = document.createElementNS(XHTMLNS, 'canvas'); |
2213 |
|
|
2214 |
|
this.printWindow.document.write('<html><head><title>'+document.title+'</title></head><body></body></html>'); |
2215 |
|
this.home(); |
2216 |
|
this.printTimer = window.setInterval(this.printCallback, 0, this); |
2217 |
|
}, |
2218 |
|
printCallback : function(aThis) |
2219 |
|
{ |
2220 |
|
if ( |
2221 |
|
!aThis.canMove |
2222 |
|
) |
2223 |
|
return; |
2224 |
|
|
2225 |
|
var monta = document.getElementsByAttribute('monta-hidden', 'true'); |
2226 |
|
if (monta && monta.length) { |
2227 |
|
for (var i = monta.length-1; i > -1; i--) |
2228 |
|
aThis.showMontaKeyword(monta[i], true); |
2229 |
|
} |
2230 |
|
|
2231 |
|
var doc = aThis.printWindow.document; |
2232 |
|
var body = doc.getElementsByTagName('body')[0]; |
2233 |
|
var img = doc.createElement('img'); |
2234 |
|
|
2235 |
|
if ((aThis.offset+1) % 2 == 1) { |
2236 |
|
body.appendChild(doc.createElement('div')); |
2237 |
|
// body.lastChild.style.clear = 'both'; |
2238 |
|
} |
2239 |
|
var box = doc.createElement('div'); |
2240 |
|
box.appendChild(doc.createElement('div')); |
2241 |
|
box.lastChild.appendChild(document.createTextNode(aThis.offset+1)); |
2242 |
|
body.lastChild.appendChild(box); |
2243 |
|
|
2244 |
|
var w = window.innerWidth; |
2245 |
|
var h = window.innerHeight; |
2246 |
|
var canvasW = parseInt(w * aThis.printSize); |
2247 |
|
var canvasH = parseInt(h * aThis.printSize); |
2248 |
|
|
2249 |
|
aThis.printCanvas.width = canvasW; |
2250 |
|
aThis.printCanvas.height = canvasH; |
2251 |
|
aThis.printCanvas.style.border = 'black solid medium'; |
2252 |
|
|
2253 |
|
img.style.border = 'black solid medium'; |
2254 |
|
img.style.width = canvasW+'px'; |
2255 |
|
img.style.height = canvasH+'px'; |
2256 |
|
|
2257 |
|
box.style.margin = '1em'; |
2258 |
|
box.style.width = parseInt(w * aThis.printSize)+'px'; |
2259 |
|
box.style.cssFloat = ((aThis.offset+1) % 2 == 1) ? 'left' : 'right' ; |
2260 |
|
|
2261 |
|
try { |
2262 |
|
netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead'); |
2263 |
|
|
2264 |
|
var ctx = aThis.printCanvas.getContext('2d'); |
2265 |
|
ctx.clearRect(0, 0, canvasW, canvasH); |
2266 |
|
ctx.save(); |
2267 |
|
ctx.scale(aThis.printSize, aThis.printSize); |
2268 |
|
ctx.drawWindow(window, 0, 0, w, h, 'rgb(255,255,255)'); |
2269 |
|
ctx.restore(); |
2270 |
|
try { |
2271 |
|
if (aThis.imageType == 'jpeg') |
2272 |
|
img.src = aThis.printCanvas.toDataURL('image/jpeg', 'quality=50'); |
2273 |
|
else |
2274 |
|
img.src = aThis.printCanvas.toDataURL('image/png', 'transparency=none'); |
2275 |
|
|
2276 |
|
box.appendChild(img); |
2277 |
|
} |
2278 |
|
catch(e) { |
2279 |
|
box.appendChild(aThis.printCanvas.cloneNode(true)); |
2280 |
|
ctx = box.lastChild.getContext('2d'); |
2281 |
|
ctx.clearRect(0, 0, canvasW, canvasH); |
2282 |
|
ctx.save(); |
2283 |
|
ctx.scale(aThis.printSize, aThis.printSize); |
2284 |
|
ctx.drawWindow(window, 0, 0, w, h, 'rgb(255,255,255)'); |
2285 |
|
ctx.restore(); |
2286 |
|
} |
2287 |
|
} |
2288 |
|
catch(e) { |
2289 |
|
alert('Error: Failed to create a document for printing.\n\n------\n'+e); |
2290 |
|
aThis.stopPrint(); |
2291 |
|
return; |
2292 |
|
} |
2293 |
|
|
2294 |
|
if (aThis.offset == aThis.data.length-1) { |
2295 |
|
aThis.stopPrint(); |
2296 |
|
aThis.printWindow.focus(); |
2297 |
|
} |
2298 |
|
else { |
2299 |
|
aThis.forward(); |
2300 |
|
} |
2301 |
|
}, |
2302 |
|
stopPrint : function() |
2303 |
|
{ |
2304 |
|
window.clearInterval(this.printTimer); |
2305 |
|
this.printTimer = null; |
2306 |
|
this.isPrinting = false; |
2307 |
|
}, |
2308 |
|
printSize : 0.4, |
2309 |
|
printTimer : null, |
2310 |
|
printWindow : null, |
2311 |
|
printCanvas : null |
2312 |
|
|
2313 |
}; |
}; |
2314 |
|
|
2706 |
window.addEventListener('load', init, false); |
window.addEventListener('load', init, false); |
2707 |
|
|
2708 |
|
|
2709 |
|
|
2710 |
|
|
2711 |
|
// http://ecmanaut.blogspot.com/2006/03/e4x-and-dom.html |
2712 |
|
|
2713 |
|
|
2714 |
|
function importE4XNode( e4x, doc, aDefaultNS ) |
2715 |
|
{ |
2716 |
|
aDefaultNS = aDefaultNS || XHTMLNS; |
2717 |
|
var root, domTree, importMe; |
2718 |
|
this.Const = this.Const || { mimeType: 'text/xml' }; |
2719 |
|
this.Static = this.Static || {}; |
2720 |
|
this.Static.parser = this.Static.parser || new DOMParser; |
2721 |
|
eval('root = <testing xmlns="'+aDefaultNS+'" />;'); |
2722 |
|
root.test = e4x; |
2723 |
|
domTree = this.Static.parser.parseFromString( root.toXMLString(), |
2724 |
|
this.Const.mimeType ); |
2725 |
|
importMe = domTree.documentElement.firstChild; |
2726 |
|
while( importMe && importMe.nodeType != 1 ) |
2727 |
|
importMe = importMe.nextSibling; |
2728 |
|
if( !doc ) doc = document; |
2729 |
|
return importMe ? doc.importNode( importMe, true ) : null; |
2730 |
|
} |
2731 |
|
|
2732 |
|
function appendE4XTo( e4x, node, doc, aDefaultNS ) |
2733 |
|
{ |
2734 |
|
return node.appendChild( importE4XNode( e4x, (doc || node.ownerDocument), aDefaultNS ) ); |
2735 |
|
} |
2736 |
|
|
2737 |
|
function setE4XContent( e4x, node, aDefaultNS ) |
2738 |
|
{ |
2739 |
|
while( node.firstChild ) |
2740 |
|
node.removeChild( node.firstChild ); |
2741 |
|
appendE4XTo( e4x, node, aDefaultNS ); |
2742 |
|
} |
2743 |
|
|
2744 |
|
// importE4XNodeで得たノードツリーを埋め込むと、XULでバインディングが適用されないことがある。 |
2745 |
|
// 遅延処理でこの問題を一部避けることができる(が、これでもまだダメな場合がある。menuとか。) |
2746 |
|
// とりあえずXULとSVGとXHTMLはいけた。MathMLはダメだった。 |
2747 |
|
function importNodeTreeWithDelay(aNode, aParent, aDefaultNS, aFromTimeout) |
2748 |
|
{ |
2749 |
|
if (aFromTimeout) { |
2750 |
|
importNodeTreeWithDelayTimers--; |
2751 |
|
} |
2752 |
|
|
2753 |
|
var node; |
2754 |
|
var delay = 1; |
2755 |
|
switch (aNode.nodeType) |
2756 |
|
{ |
2757 |
|
case Node.ELEMENT_NODE: |
2758 |
|
var ns = (aNode.namespaceURI || aDefaultNS); |
2759 |
|
node = document.createElementNS(ns, aNode.localName); |
2760 |
|
aParent.appendChild(node); |
2761 |
|
|
2762 |
|
var attr = aNode.attributes; |
2763 |
|
for (var i = 0, maxi = attr.length; i < maxi; i++) |
2764 |
|
node.setAttribute(attr[i].name, attr[i].value); |
2765 |
|
|
2766 |
|
if (ns == XULNS) delay = 1; else delay = 0; |
2767 |
|
|
2768 |
|
var children = aNode.childNodes; |
2769 |
|
for (var i = 0, maxi = children.length; i < maxi; i++) |
2770 |
|
if (delay) { |
2771 |
|
importNodeTreeWithDelayTimers++; |
2772 |
|
window.setTimeout(importNodeTreeWithDelay, delay, children[i], node, aDefaultNS, true); |
2773 |
|
} |
2774 |
|
else |
2775 |
|
importNodeTreeWithDelay(children[i], node, aDefaultNS); |
2776 |
|
break; |
2777 |
|
|
2778 |
|
default: |
2779 |
|
if ( |
2780 |
|
aNode.nodeType == Node.TEXT_NODE && |
2781 |
|
/^\s*$/.test(aNode.nodeValue) && |
2782 |
|
(aNode.parentNode.namespaceURI || aDefaultNS) != XHTMLNS |
2783 |
|
) |
2784 |
|
return; |
2785 |
|
node = aParent.appendChild(aNode.cloneNode(true)); |
2786 |
|
break; |
2787 |
|
} |
2788 |
|
|
2789 |
|
var event = document.createEvent('Events'); |
2790 |
|
event.initEvent('CanvasContentAdded', true, true); |
2791 |
|
node.dispatchEvent(event); |
2792 |
|
|
2793 |
|
return node; |
2794 |
|
} |
2795 |
|
var importNodeTreeWithDelayTimers = 0; |
2796 |
|
|
2797 |
]]></script> |
]]></script> |
2798 |
|
|
2799 |
</page> |
</page> |