/[suikacvs]/webroot/www/js/jste/test.html
Suika

Contents of /webroot/www/js/jste/test.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.15 - (hide annotations) (download) (as text)
Sat Jan 24 07:23:09 2009 UTC (16 years, 7 months ago) by wakaba
Branch: MAIN
Changes since 1.14: +23 -1 lines
File MIME type: text/html
Force Safari redraw the viewport after insertion of balloon

1 wakaba 1.1 <!DOCTYPE HTML>
2     <html lang=en class=account-user-misc>
3     <meta charset=utf-8>
4     <title>新しい利用者アカウントの作成</title>
5     <link rel=stylesheet href="/admin/style/common">
6 wakaba 1.12 <body>
7 wakaba 1.1 <h1>新しい利用者アカウントの作成</h1>
8    
9     <form action=new-user accept-charset=utf-8 method=post>
10    
11     <p><strong>利用者識別子</strong>: <input type=text name=user-id
12     maxlength=20 size=10 required pattern="[0-9a-z-]{4,20}"> (文字「a」〜「z」、「0」〜「9」、「-」を使って 4〜10 文字の文字列を指定してください。)<p><strong>合言葉</strong>: <input type=password name=user-pass
13     size=10 required pattern=".{4,}"> (最低4文字入力してください。)<p><strong>合言葉</strong> (もう一度): <input type=password
14     name=user-pass2 size=10 required pattern=".{4,}">
15    
16 wakaba 1.12 <p><input type=submit value="作成" class=create></p></form>
17 wakaba 1.1
18     <section>
19     <html lang=en class=account-user-info>
20     <title>さん</title>
21 wakaba 1.12
22     <h1>さん</h1><section id=groups><h2>グループ</h2><section id="groups-joined"><h3>参加中のグループ</h3><ul><li><form action="group.admin-groups" accept-charset=utf-8 method=post><a href="../../groups/admin-groups/">admin-groups</a> <input type=hidden name=action value=leave><input type=submit value="このグループから抜ける"></form><li><form action="group.admin-users" accept-charset=utf-8 method=post><a href="../../groups/admin-users/">admin-users</a> <input type=hidden name=action value=leave><input type=submit value="このグループから抜ける"></form><li><form action="group.helo" accept-charset=utf-8 method=post><a href="../../groups/helo/">helo</a> <input type=hidden name=action value=leave><input type=submit value="このグループから抜ける"></form><li><form action="group.helo-admin" accept-charset=utf-8 method=post><a href="../../groups/helo-admin/">helo-admin</a> <input type=hidden name=action value=leave><input type=submit value="このグループから抜ける"></form><li><form action="group.schema-db" accept-charset=utf-8 method=post><a href="../../groups/schema-db/">schema-db</a> <input type=hidden name=action value=leave><input type=submit value="このグループから抜ける"></form><li><form action="group.spec-ja" accept-charset=utf-8 method=post><a href="../../groups/spec-ja/">spec-ja</a> <input type=hidden name=action value=leave><input type=submit value="このグループから抜ける"></form><li><form action="group.spec-ja-admin" accept-charset=utf-8 method=post><a href="../../groups/spec-ja-admin/">spec-ja-admin</a> <input type=hidden name=action value=leave><input type=submit value="このグループから抜ける"></form><li><form action="group.suikawiki" accept-charset=utf-8 method=post><a href="../../groups/suikawiki/">suikawiki</a> <input type=hidden name=action value=leave><input type=submit value="このグループから抜ける"></form><li><form action="group.test-results" accept-charset=utf-8 method=post><a href="../../groups/test-results/">test-results</a> <input type=hidden name=action value=leave><input type=submit value="このグループから抜ける"></form></ul></section><section id="groups-requested"><h3>参加申請中 (未許可) のグループ</h3><ul><li><form action="" accept-charset=utf-8 method=post><a href="../../groups//"></a> <input type=hidden name=action value=leave><input type=submit value="申請取消"></form></ul></section></section><section id=props><h2>特性</h2><p><em>これらの特性は管理者のみが見ることができますが、秘密の情報は記述しないことをお勧めします。</em></p>
23    
24     <form action="prop" accept-charset=utf-8 method=post><input type=hidden name=name value="full_name"><p><label><strong>名前</strong>: <input type="text" name="value" value=""></label> <input type=submit value="保存">
25    
26     </p></form>
27    
28 wakaba 1.13
29    
30 wakaba 1.12 <form action="prop" accept-charset=utf-8 method=post><input type=hidden name=name value="mail_addr"><p><label><strong>メイル・アドレス</strong>: <input type="email" name="value" value=""></label> <input type=submit value="保存">
31     </p></form>
32    
33     <form action="prop" accept-charset=utf-8 method=post><input type=hidden name=name value="home_url"><p><label><strong>Web サイト URL</strong>: <input type="url" name="value" value=""></label> <input type=submit value="保存">
34     </p>
35    
36     </form></section><section id=password><h2>合言葉</h2>
37 wakaba 1.1
38     <form action=password method=post accept-charset=utf-8>
39    
40     <p>合言葉を変更できます。<p><strong>新しい合言葉</strong>: <input type=password name=user-pass
41     size=10 required pattern=".{4,}"> (最低4文字入力してください。) <p><strong>新しい合言葉</strong> (もう一度): <input type=password
42     name=user-pass2 size=10 required pattern=".{4,}">
43    
44 wakaba 1.12 <p><input type=submit value="変更"></p>
45 wakaba 1.1
46     </form>
47     </section>
48    
49     <section id=disable-account><h2>アカウントの無効化</h2>
50    
51    
52     <p><label><input type=checkbox name=action value=enable checked> このアカウントを有効にする</label>
53    
54     <p><strong>警告!</strong> 自分のアカウントを無効にすると、自分で再度有効にすることはできません。<p><input type=submit value="変更"></form></section></section>
55    
56     <style>
57    
58 wakaba 1.4 section, article, menu {
59     display: block;
60 wakaba 1.5 margin: 0;
61     padding: 0;
62 wakaba 1.4 }
63    
64     .sbs-container {
65 wakaba 1.1 display: block;
66     position: absolute;
67     }
68 wakaba 1.4
69     .sbs-container.sbs-without-refelement {
70     position: fixed;
71     bottom: 1em;
72     right: 1em;
73     }
74    
75 wakaba 1.10 .sbs-selected {
76     outline: 2px blue dotted !important;
77     }
78    
79 wakaba 1.11 .mm-container {
80 wakaba 1.1 display: block;
81 wakaba 1.5 padding-bottom: 2em;
82 wakaba 1.4 background-color: white;
83 wakaba 1.5 width: 20em;
84     min-height: 5em;
85     }
86    
87 wakaba 1.11 .mm-container menu {
88 wakaba 1.5 position: absolute;
89     bottom: 0;
90     left: 0;
91     right: 0;
92     text-align: center;
93 wakaba 1.4 }
94 wakaba 1.1 </style>
95    
96 wakaba 1.12 </p>
97    
98 wakaba 1.1 <script type="text/javascript" src="uupaa-detect.mini.js"></script>
99     <script type="text/javascript" src="uupaa-selector.js"></script>
100     <script type="text/javascript" src="uupaa-selector+.js"></script>
101    
102 wakaba 1.4 <script src="../../css/noderect/NodeRect.js"></script>
103    
104 wakaba 1.1 <script id="uupaa.js" type="text/javascript" src="uupaa/uupaa.js"></script>
105    
106     <script src=tutorial.js></script>
107    
108     <script>
109    
110     window.onload = function () {
111     window.loaded = true;
112     };
113    
114     function showElement (elements) {
115     if (!window.loaded) {
116     new JSTE.Observer ('load', window, function () {
117     showElement (elements);
118     });
119     return;
120     }
121    
122     var top = Infinity;
123     var left = Infinity;
124     var topEl;
125     var leftEl;
126     elements.forEach (function (el) {
127     var rect = uu.element.rect (el);
128     if (rect.y < top) {
129     top = rect.y;
130     topEl = el;
131     }
132     if (rect.x < left) {
133     left = rect.x;
134     leftEl = el;
135     }
136     });
137    
138     var rect = uu.viewport.rect ();
139     if (rect.sh <= top && top <= rect.sh + rect.h) {
140     top = rect.sh;
141     }
142     if (rect.sw <= left && left <= rect.sw + rect.w) {
143     left = rect.sw;
144     }
145    
146     if (leftEl || topEl) {
147     var od = (leftEl || topEl).ownerDocument;
148     var point = od.createElement ('span');
149     point.style.display = 'block';
150     point.style.position = 'absolute';
151     point.style.top = top + 'px';
152     point.style.left = left + 'px';
153     point.style.width = 0;
154     point.style.height = 0;
155     od.documentElement.appendChild (point);
156     point.scrollIntoView (true);
157     point.parentNode.removeChild (point);
158     }
159     }
160    
161 wakaba 1.12 var SimpleBalloon = new JSTE.Class (function (messageContainer, refElement) {
162     if (!messageContainer) return;
163    
164 wakaba 1.5 this.element = document.createElement ('article');
165 wakaba 1.4 this.element.className = 'sbs-container';
166     document.body.appendChild (this.element);
167    
168 wakaba 1.11 this.contentElement = messageContainer;
169     this.element.appendChild (messageContainer);
170    
171 wakaba 1.10 this._renderBorder ();
172 wakaba 1.4
173 wakaba 1.10 this.refElement = refElement;
174 wakaba 1.14 this._renderPointer ();
175 wakaba 1.10 if (refElement) {
176     JSTE.Element.addClassName (refElement, 'sbs-selected');
177     JSTE.Element.addClassName (this.element, 'sbs-with-refelement');
178     } else {
179     JSTE.Element.addClassName (this.element, 'sbs-without-refelement');
180     }
181 wakaba 1.15
182     this.forceRedraw ();
183 wakaba 1.10
184     var self = this;
185     //setTimeout (function () {
186     showElement (new JSTE.List ([refElement]).onlyNonNull ());
187     //}, 2000);
188     }, {
189     SVGNS: 'http://www.w3.org/2000/svg',
190 wakaba 1.4
191 wakaba 1.10 remove: function () {
192     if (this.refElement) {
193     JSTE.Element.deleteClassName (this.refElement, 'sbs-selected');
194     }
195     }, // remove
196 wakaba 1.9
197 wakaba 1.10 _renderBorder: function () {
198     var msgRects = NR.Element.getRects (this.contentElement, window);
199     var msgRect = msgRects.borderBox;
200    
201     var bb = this.getComputedStyle ();
202    
203     var bwDelta = bb.marginLeft + bb.borderLeftWidth + bb.paddingLeft;
204     var bhDelta = bb.marginTop + bb.borderTopWidth + bb.paddingTop;
205     var boxMBWidth = msgRect.width + bwDelta
206     + bb.marginRight + bb.borderRightWidth + bb.paddingRight;
207     var boxMBHeight = msgRect.height + bhDelta
208     + bb.marginBottom + bb.borderBottomWidth + bb.paddingBottom;
209    
210     var box = document.createElementNS (this.SVGNS, 'svg');
211     box.style.display = 'block';
212     box.style.position = 'absolute';
213     box.style.top = -bhDelta + 'px';
214     box.style.left = -bwDelta + 'px';
215    
216     /* This is necessary to render the content element over the border SVG
217     element. */
218     this.contentElement.style.position = 'relative';
219    
220     box.setAttribute ('width', boxMBWidth);
221     box.setAttribute ('height', boxMBHeight);
222    
223     var bbTop = bb.marginTop + bb.borderTopWidth / 2;
224     var bbRight = boxMBWidth - bb.marginLeft - bb.borderLeftWidth / 2
225     - bb.marginRight - bb.borderRightWidth / 2;
226     var bbLeft = bb.marginLeft + bb.borderLeftWidth / 2;
227     var bbBottom = boxMBHeight - bb.marginTop - bb.marginBottom
228     - bb.borderTopWidth / 2 - bb.borderBottomWidth / 2;
229    
230     var boxBorder = document.createElementNS (this.SVGNS, 'path');
231     boxBorder.setAttribute ('d', [
232     'M', bbLeft + bb.manakaiBorderTopLeftRadiusHorizontal, bbTop,
233    
234     'L', bbRight - bb.manakaiBorderTopRightRadiusHorizontal, bbTop,
235    
236     'a',
237     bb.manakaiBorderTopRightRadiusHorizontal,
238     bb.manakaiBorderTopRightRadiusVertical, 0, 0, 1,
239     bb.manakaiBorderTopRightRadiusHorizontal,
240     bb.manakaiBorderTopRightRadiusVertical,
241 wakaba 1.4
242 wakaba 1.10 'L', bbRight, bbBottom - bb.manakaiBorderBottomRightRadiusVertical,
243    
244     'a',
245     bb.manakaiBorderBottomRightRadiusHorizontal,
246     bb.manakaiBorderBottomRightRadiusVertical, 0, 0, 1,
247     -bb.manakaiBorderBottomRightRadiusHorizontal,
248     bb.manakaiBorderBottomRightRadiusVertical,
249    
250     'L', bbLeft + bb.manakaiBorderBottomLeftRadiusHorizontal, bbBottom,
251    
252     'a',
253     bb.manakaiBorderBottomLeftRadiusHorizontal,
254     bb.manakaiBorderBottomLeftRadiusVertical, 0, 0, 1,
255     -bb.manakaiBorderBottomLeftRadiusHorizontal,
256     -bb.manakaiBorderBottomLeftRadiusVertical,
257    
258     'L', bbLeft, bbTop + bb.manakaiBorderTopLeftRadiusVertical,
259    
260     'a',
261     bb.manakaiBorderTopLeftRadiusHorizontal,
262     bb.manakaiBorderTopLeftRadiusVertical, 0, 0, 1,
263     bb.manakaiBorderTopLeftRadiusHorizontal,
264     -bb.manakaiBorderTopLeftRadiusVertical
265     ].join (' '));
266     boxBorder.setAttribute ('stroke', bb.borderColor);
267     boxBorder.setAttribute ('stroke-width', bb.borderWidth);
268     boxBorder.setAttribute ('fill', bb.backgroundColor);
269    
270     box.appendChild (boxBorder);
271    
272     this.element.insertBefore (box, this.element.firstChild);
273     }, // _renderBorder
274     _renderPointer: function () {
275 wakaba 1.14 var bb = this.getComputedStyle ();
276 wakaba 1.4
277 wakaba 1.14 if (this.refElement) {
278     var rects = NR.Element.getRects (this.refElement, window);
279     var rbb = rects.borderBox;
280    
281     var left = rbb.left + rbb.width * 3 / 4 - bb.manakaiPointerSource;
282     if (left < 0) left = bb.borderLeftWidth + bb.paddingLeft;
283     var top = rbb.bottom + bb.manakaiPointerOffset
284     + bb.manakaiPointerHeight + bb.paddingTop;
285 wakaba 1.4
286 wakaba 1.14 this.element.style.top = top + 'px';
287     this.element.style.left = left + 'px';
288     }
289 wakaba 1.5
290 wakaba 1.10 var pointerSVGElement = document.createElementNS (this.SVGNS, 'svg');
291 wakaba 1.9 pointerSVGElement.setAttribute ('width', bb.manakaiPointerWidth);
292     pointerSVGElement.setAttribute ('height', bb.manakaiPointerHeight);
293 wakaba 1.5 pointerSVGElement.style.display = 'block';
294     pointerSVGElement.style.position = 'absolute';
295 wakaba 1.9 pointerSVGElement.style.top = -(bb.manakaiPointerHeight + bb.paddingTop) + 'px';
296     pointerSVGElement.style.left = (bb.manakaiPointerSource - bb.manakaiPointerWidth / 2) + 'px';
297 wakaba 1.5
298 wakaba 1.10 var pointerElement = document.createElementNS (this.SVGNS, 'path');
299 wakaba 1.14 if (this.refElement) {
300     pointerElement.setAttribute ('d', [
301     'M', bb.manakaiPointerWidth, bb.manakaiPointerHeight,
302     'Q', bb.manakaiPointerWidth * 3 / 4, bb.manakaiPointerHeight,
303     bb.manakaiPointerWidth / 2, 0,
304     'Q', bb.manakaiPointerWidth / 4, bb.manakaiPointerHeight,
305     0, bb.manakaiPointerHeight].join (' '));
306     } else {
307     pointerElement.setAttribute ('d', [
308     'M', 0, bb.manakaiPointerHeight,
309     'L', bb.manakaiPointerWidth, bb.manakaiPointerHeight
310     ].join (' '));
311     }
312    
313 wakaba 1.9 pointerElement.setAttribute ('stroke', bb.borderColor);
314     pointerElement.setAttribute ('stroke-width', bb.borderWidth);
315     pointerElement.setAttribute ('fill', bb.backgroundColor);
316 wakaba 1.5
317     pointerSVGElement.appendChild (pointerElement);
318    
319     this.element.appendChild (pointerSVGElement);
320 wakaba 1.10 }, // _renderPointer
321 wakaba 1.9
322     getComputedStyle: function (pseudoEl) {
323     if (pseudoEl == null) {
324     var boxMargin = 1;
325 wakaba 1.14 var boxBorderWidth = 4; // use even number to avoid use of non-integer pixels not supported by VML
326 wakaba 1.9 var boxBorderColor = 'green';
327     var boxBorderRadiusHorizontal = 10;
328     var boxBorderRadiusVertical = 10;
329     var boxPadding = 10;
330 wakaba 1.14 var pointerBoxMargin = 6;
331 wakaba 1.9 var pointerBoxWidth = 20;
332     var pointerBoxHeight = 40;
333     var pointerBoxLeft = 20;
334    
335     return {
336     marginTop: boxMargin, marginRight: boxMargin, marginBottom: boxMargin,
337     marginLeft: boxMargin,
338     borderColor: boxBorderColor,
339     borderTopColor: boxBorderColor, borderRightColor: boxBorderColor,
340     borderBottomColor: boxBorderColor, borderLeftColor: boxBorderColor,
341     borderWidth: boxBorderWidth,
342     borderTopWidth: boxBorderWidth, borderRightWidth: boxBorderWidth,
343     borderBottomWidth: boxBorderWidth, borderLeftWidth: boxBorderWidth,
344     manakaiBorderTopLeftRadiusHorizontal: boxBorderRadiusHorizontal,
345     manakaiBorderTopLeftRadiusVertical: boxBorderRadiusVertical,
346     manakaiBorderTopRightRadiusHorizontal: boxBorderRadiusHorizontal,
347     manakaiBorderTopRightRadiusVertical: boxBorderRadiusVertical,
348     manakaiBorderBottomLeftRadiusHorizontal: boxBorderRadiusHorizontal,
349     manakaiBorderBottomLeftRadiusVertical: boxBorderRadiusVertical,
350     manakaiBorderBottomRightRadiusHorizontal: boxBorderRadiusHorizontal,
351     manakaiBorderBottomRightRadiusVertical: boxBorderRadiusVertical,
352     paddingTop: boxPadding, paddingRight: boxPadding,
353     paddingBottom: boxPadding, paddingLeft: boxPadding,
354     backgroundColor: this.getBackgroundColor (),
355     manakaiPointerWidth: pointerBoxWidth,
356     manakaiPointerHeight: pointerBoxHeight,
357     manakaiPointerOffset: pointerBoxMargin,
358     manakaiPointerSource: pointerBoxLeft
359     };
360     } else {
361     return {};
362     }
363     }, // getComputedStyle
364 wakaba 1.4
365     getBackgroundColor: function () {
366     var el = this.contentElement;
367     if (window.getComputedStyle) {
368     return getComputedStyle (el, null).backgroundColor;
369     } else if (el.currentStyle) {
370     return el.currentStyle.backgroundColor;
371     } else {
372     return 'white';
373     }
374 wakaba 1.15 }, // getBackgroundColor
375    
376     forceRedraw: function () {
377     // Safari 3.2.1 for Windows Vista (Aero enabled) does not always paint
378     // SVG borders correctly. (Chrome does, however.)
379     if (SimpleBalloon.isSafari) {
380     var rects = NR.View.getViewportRects (window);
381     var vp = rects.contentBox;
382     var el = document.createElement ('non-styled-element');
383     el.style.display = 'block';
384     el.style.position = 'absolute';
385     el.style.top = vp.top + 'px';
386     el.style.left = vp.left + 'px';
387     el.style.width = vp.width + 'px';
388     el.style.height = vp.height + 'px';
389     document.body.appendChild (el);
390     setTimeout (function () { document.body.removeChild (el) }, 1);
391     }
392     } // forceRedraw
393 wakaba 1.12 }); // SimpleBalloon
394 wakaba 1.15
395     SimpleBalloon.isSafari = navigator.userAgent.indexOf ("Safari") > -1;
396 wakaba 1.12
397     var SimpleBalloonVML = new JSTE.Subclass (function () {
398 wakaba 1.13 if (!document.namespaces._vml_) {
399 wakaba 1.12 document.namespaces.add ('_vml_', 'urn:schemas-microsoft-com:vml');
400     }
401    
402     var ss = document.createStyleSheet ();
403     ss.cssText = '_vml_\\:* { behavior: url(#default#VML) }';
404    
405     this._super.apply (this, arguments);
406     }, SimpleBalloon, {
407     _renderBorder: function () {
408     var msgRects = NR.Element.getRects (this.contentElement, window);
409     var msgRect = msgRects.borderBox;
410    
411     var bb = this.getComputedStyle ();
412    
413     var bwDelta = bb.marginLeft + bb.borderLeftWidth + bb.paddingLeft;
414     var bhDelta = bb.marginTop + bb.borderTopWidth + bb.paddingTop;
415     var boxMBWidth = msgRect.width + bwDelta
416     + bb.marginRight + bb.borderRightWidth + bb.paddingRight;
417     var boxMBHeight = msgRect.height + bhDelta
418     + bb.marginBottom + bb.borderBottomWidth + bb.paddingBottom;
419    
420 wakaba 1.13 var vShape = document.createElement ('_vml_:shape');
421     vShape.style.display = 'block';
422     vShape.style.position = 'absolute';
423     vShape.style.top = -bhDelta + 'px';
424     vShape.style.left = -bwDelta + 'px';
425 wakaba 1.12
426     /* This is necessary to render the content element over the border SVG
427     element. */
428     this.contentElement.style.position = 'relative';
429    
430 wakaba 1.13 vShape.style.width = boxMBWidth + 'px';
431     vShape.style.height = boxMBHeight + 'px';
432 wakaba 1.12
433     var bbTop = bb.marginTop + bb.borderTopWidth / 2;
434     var bbRight = boxMBWidth - bb.marginLeft - bb.borderLeftWidth / 2
435     - bb.marginRight - bb.borderRightWidth / 2;
436     var bbLeft = bb.marginLeft + bb.borderLeftWidth / 2;
437     var bbBottom = boxMBHeight - bb.marginTop - bb.marginBottom
438     - bb.borderTopWidth / 2 - bb.borderBottomWidth / 2;
439    
440 wakaba 1.13 var vPath = document.createElement ('_vml_:path');
441     vPath.setAttribute ('v', new JSTE.List ([
442 wakaba 1.14 'm', bb.marginLeft + bb.borderLeftWidth + bb.paddingLeft + bb.manakaiPointerSource + bb.manakaiPointerWidth / 2, bbTop,
443 wakaba 1.12
444     'l', bbRight - bb.manakaiBorderTopRightRadiusHorizontal, bbTop,
445 wakaba 1.13
446     'qx',
447     bbRight,
448     bbTop + bb.manakaiBorderTopRightRadiusVertical,
449    
450 wakaba 1.12 'l', bbRight, bbBottom - bb.manakaiBorderBottomRightRadiusVertical,
451 wakaba 1.13
452     'qy',
453     bbRight - bb.manakaiBorderBottomRightRadiusHorizontal,
454     bbBottom,
455    
456 wakaba 1.12 'l', bbLeft + bb.manakaiBorderBottomLeftRadiusHorizontal, bbBottom,
457 wakaba 1.13
458     'qx',
459     bbLeft,
460     bbBottom - bb.manakaiBorderBottomLeftRadiusVertical,
461    
462 wakaba 1.12 'l', bbLeft, bbTop + bb.manakaiBorderTopLeftRadiusVertical,
463 wakaba 1.13
464     'qy',
465     bbLeft + bb.manakaiBorderTopLeftRadiusHorizontal,
466     bbTop,
467    
468 wakaba 1.14 'l', bb.marginLeft + bb.borderLeftWidth + bb.paddingLeft + bb.manakaiPointerSource - bb.manakaiPointerWidth / 2, bbTop,
469    
470 wakaba 1.12 'e'
471 wakaba 1.13 ]).numberToInteger ().list.join (' '));
472     vShape.setAttribute ('stroke', 'true');
473     vShape.setAttribute ('strokecolor', bb.borderColor);
474     vShape.setAttribute ('strokeweight', bb.borderWidth);
475 wakaba 1.14 vShape.setAttribute ('filled', 'true');
476 wakaba 1.13 vShape.setAttribute ('fillcolor', bb.backgroundColor);
477     vShape.setAttribute ('coordorigin', '0 0');
478     vShape.setAttribute ('coordsize', boxMBWidth + ' ' + boxMBHeight);
479 wakaba 1.12
480 wakaba 1.13 vShape.appendChild (vPath);
481 wakaba 1.12
482 wakaba 1.13 this.element.insertBefore (vShape, this.element.firstChild);
483 wakaba 1.12 }, // _renderBorder
484     _renderPointer: function () {
485 wakaba 1.14 var bb = this.getComputedStyle ();
486    
487     if (this.refElement) {
488     var rects = NR.Element.getRects (this.refElement, window);
489     var rbb = rects.borderBox;
490 wakaba 1.12
491 wakaba 1.14 var left = rbb.left + rbb.width * 3 / 4 - bb.manakaiPointerSource;
492     if (left < 0) left = bb.borderLeftWidth + bb.paddingLeft;
493     var top = rbb.bottom + bb.manakaiPointerOffset
494     + bb.manakaiPointerHeight + bb.borderTopWidth + bb.paddingTop;
495 wakaba 1.12
496 wakaba 1.14 this.element.style.top = top + 'px';
497     this.element.style.left = left + 'px';
498     }
499 wakaba 1.12
500 wakaba 1.13 var vShape = document.createElement ('_vml_:shape');
501     vShape.style.width = bb.manakaiPointerWidth + 'px';
502     vShape.style.height = bb.manakaiPointerHeight + 'px';
503     vShape.style.display = 'block';
504     vShape.style.position = 'absolute';
505 wakaba 1.14 vShape.style.top = -(bb.manakaiPointerHeight + bb.paddingTop + bb.borderTopWidth / 2) + 'px';
506 wakaba 1.13 vShape.style.left = (bb.manakaiPointerSource - bb.manakaiPointerWidth / 2) + 'px';
507 wakaba 1.12
508 wakaba 1.13 var vPath = document.createElement ('_vml_:path');
509 wakaba 1.14 if (this.refElement) {
510     vPath.setAttribute ('v', new JSTE.List ([
511     'm', bb.manakaiPointerWidth, bb.manakaiPointerHeight,
512     'c',
513     bb.manakaiPointerWidth * 3 / 4, bb.manakaiPointerHeight,
514     bb.manakaiPointerWidth * 3 / 4, bb.manakaiPointerHeight,
515     bb.manakaiPointerWidth / 2, 0,
516     'c',
517     bb.manakaiPointerWidth / 4, bb.manakaiPointerHeight,
518     bb.manakaiPointerWidth / 4, bb.manakaiPointerHeight,
519     0, bb.manakaiPointerHeight,
520     'e']).numberToInteger ().list.join (' '));
521     } else {
522     vPath.setAttribute ('v', new JSTE.List ([
523     'm', 0, bb.manakaiPointerHeight,
524     'l', bb.manakaiPointerWidth, bb.manakaiPointerHeight,
525     'e']).numberToInteger ().list.join (' '));
526     }
527    
528 wakaba 1.13 vShape.setAttribute ('stroke', 'true');
529     vShape.setAttribute ('strokecolor', bb.borderColor);
530     vShape.setAttribute ('strokeweight', bb.borderWidth);
531 wakaba 1.14 vShape.setAttribute ('filled', 'true');
532 wakaba 1.13 vShape.setAttribute ('fillcolor', bb.backgroundColor);
533     vShape.setAttribute ('coordorigin', '0 0');
534     vShape.setAttribute ('coordsize', bb.manakaiPointerWidth + ' ' + bb.manakaiPointerHeight);
535 wakaba 1.12
536 wakaba 1.13 vShape.appendChild (vPath);
537 wakaba 1.12
538 wakaba 1.13 this.element.appendChild (vShape);
539 wakaba 1.12 } // _renderPointer
540    
541     }); // SimpleBalloonVML
542 wakaba 1.1
543     var MyMessage = new JSTE.Subclass (function () {
544     return this._super.apply (this, arguments);
545     }, JSTE.Message, {
546     _render: function (msgContainer, buttonContainer) {
547     var doc = this._targetDocument;
548    
549     var container = doc.createElement ('section');
550 wakaba 1.11 container.className = 'mm-container';
551 wakaba 1.1
552     container.appendChild (msgContainer);
553     container.appendChild (buttonContainer);
554    
555     var refElement = JSTE.Node.querySelector (document, this.select);
556 wakaba 1.12 if (document.all) {
557     this._simpleBalloon = new SimpleBalloonVML (container, refElement);
558     } else {
559     this._simpleBalloon = new SimpleBalloon (container, refElement);
560     }
561 wakaba 1.1
562     return this._simpleBalloon.element;
563     }, // _render
564     _remove: function () {
565     this._simpleBalloon.remove ();
566     } // _remove
567     });
568    
569     var xhr = new XMLHttpRequest ();
570     xhr.open ('GET', 'test.xml', false);
571     xhr.send (null);
572    
573    
574     document.a =
575     JSTE.Course.createFromDocument (xhr.responseXML, document);
576    
577     document.b =
578     new JSTE.Tutorial (document, document.a, {messageClass: MyMessage});
579    
580     </script>
581    
582 wakaba 1.3 <!--
583     /* ***** BEGIN LICENSE BLOCK *****
584     * Copyright 2008-2009 Wakaba <w@suika.fam.cx>. All rights reserved.
585     *
586     * This program is free software; you can redistribute it and/or
587     * modify it under the same terms as Perl itself.
588     *
589     * Alternatively, the contents of this file may be used
590     * under the following terms (the "MPL/GPL/LGPL"),
591     * in which case the provisions of the MPL/GPL/LGPL are applicable instead
592     * of those above. If you wish to allow use of your version of this file only
593     * under the terms of the MPL/GPL/LGPL, and not to allow others to
594     * use your version of this file under the terms of the Perl, indicate your
595     * decision by deleting the provisions above and replace them with the notice
596     * and other provisions required by the MPL/GPL/LGPL. If you do not delete
597     * the provisions above, a recipient may use your version of this file under
598     * the terms of any one of the Perl or the MPL/GPL/LGPL.
599     *
600     * "MPL/GPL/LGPL":
601     *
602     * Version: MPL 1.1/GPL 2.0/LGPL 2.1
603     *
604     * The contents of this file are subject to the Mozilla Public License Version
605     * 1.1 (the "License"); you may not use this file except in compliance with
606     * the License. You may obtain a copy of the License at
607     * <http://www.mozilla.org/MPL/>
608     *
609     * Software distributed under the License is distributed on an "AS IS" basis,
610     * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
611     * for the specific language governing rights and limitations under the
612     * License.
613     *
614     * The Original Code is JSTE code.
615     *
616     * The Initial Developer of the Original Code is Wakaba.
617     * Portions created by the Initial Developer are Copyright (C) 2008
618     * the Initial Developer. All Rights Reserved.
619     *
620     * Contributor(s):
621     * Wakaba <w@suika.fam.cx>
622     *
623     * Alternatively, the contents of this file may be used under the terms of
624     * either the GNU General Public License Version 2 or later (the "GPL"), or
625     * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
626     * in which case the provisions of the GPL or the LGPL are applicable instead
627     * of those above. If you wish to allow use of your version of this file only
628     * under the terms of either the GPL or the LGPL, and not to allow others to
629     * use your version of this file under the terms of the MPL, indicate your
630     * decision by deleting the provisions above and replace them with the notice
631     * and other provisions required by the LGPL or the GPL. If you do not delete
632     * the provisions above, a recipient may use your version of this file under
633     * the terms of any one of the MPL, the GPL or the LGPL.
634     *
635     * ***** END LICENSE BLOCK ***** */
636     -->

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24