/[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.4 - (hide annotations) (download) (as text)
Mon Jan 19 03:09:15 2009 UTC (16 years, 7 months ago) by wakaba
Branch: MAIN
Changes since 1.3: +83 -14 lines
File MIME type: text/html
SVGize SimpleBaloon; Don't render message box until the document style sheet has been loaded, otherwise getBoundingClientRect does not return valid value in Opera

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     <h1>新しい利用者アカウントの作成</h1>
7    
8     <form action=new-user accept-charset=utf-8 method=post>
9    
10     <p><strong>利用者識別子</strong>: <input type=text name=user-id
11     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
12     size=10 required pattern=".{4,}"> (最低4文字入力してください。)<p><strong>合言葉</strong> (もう一度): <input type=password
13     name=user-pass2 size=10 required pattern=".{4,}">
14    
15     <p><input type=submit value="作成" class=create></form>
16    
17     <section>
18     <!DOCTYPE HTML>
19     <html lang=en class=account-user-info>
20     <title>さん</title>
21     <link rel=stylesheet href="/admin/style/common">
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><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="保存"></form><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="保存"></form><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="保存"></form></section><section id=password><h2>合言葉</h2>
23    
24     <form action=password method=post accept-charset=utf-8>
25    
26     <p>合言葉を変更できます。<p><strong>新しい合言葉</strong>: <input type=password name=user-pass
27     size=10 required pattern=".{4,}"> (最低4文字入力してください。) <p><strong>新しい合言葉</strong> (もう一度): <input type=password
28     name=user-pass2 size=10 required pattern=".{4,}">
29    
30     <p><input type=submit value="変更">
31    
32     </form>
33     </section>
34    
35     <section id=disable-account><h2>アカウントの無効化</h2>
36    
37     <form action=disabled method=post accept-charset=utf-8>
38    
39     <p><label><input type=checkbox name=action value=enable checked> このアカウントを有効にする</label>
40    
41     <p><strong>警告!</strong> 自分のアカウントを無効にすると、自分で再度有効にすることはできません。<p><input type=submit value="変更"></form></section></section>
42    
43     <style>
44    
45 wakaba 1.4 section, article, menu {
46     display: block;
47     }
48    
49     .sbs-container {
50 wakaba 1.1 display: block;
51     position: absolute;
52     }
53 wakaba 1.4
54     .sbs-container.sbs-without-refelement {
55     position: fixed;
56     bottom: 1em;
57     right: 1em;
58     }
59    
60 wakaba 1.1 .container {
61     display: block;
62 wakaba 1.4 background-color: white;
63     }
64    
65    
66     xxx.container {
67     display: block;
68 wakaba 1.1 position: relative;
69     left: 49px;
70     top: -22px /* -(10px + 34px) / 2 */;
71     min-height: 54px /* 10px + 34px + 10px */;
72     width: 20em;
73     padding: 1em;
74     background-color: rgb(128, 255, 255);
75     color: black;
76     -moz-border-radius: 16px;
77     -webkit-border-radius: 16px;
78     }
79 wakaba 1.4 xxx.pointer {
80 wakaba 1.1 display: block;
81     position: absolute;
82     left: -49px;
83     top: 10px;
84     width: 49px;
85     height: 34px;
86     background-image: url(test.png) /* 49x34 */;
87     }
88    
89     .selected {
90     outline: 2px blue dotted !important;
91     }
92     </style>
93    
94     <script type="text/javascript" src="uupaa-detect.mini.js"></script>
95     <script type="text/javascript" src="uupaa-selector.js"></script>
96     <script type="text/javascript" src="uupaa-selector+.js"></script>
97    
98 wakaba 1.4 <script src="../../css/noderect/NodeRect.js"></script>
99    
100 wakaba 1.1 <script id="uupaa.js" type="text/javascript" src="uupaa/uupaa.js"></script>
101    
102     <script src=tutorial.js></script>
103    
104     <script>
105    
106     window.onload = function () {
107     window.loaded = true;
108     };
109    
110     function showElement (elements) {
111     if (!window.loaded) {
112     new JSTE.Observer ('load', window, function () {
113     showElement (elements);
114     });
115     return;
116     }
117    
118     var top = Infinity;
119     var left = Infinity;
120     var topEl;
121     var leftEl;
122     elements.forEach (function (el) {
123     var rect = uu.element.rect (el);
124     if (rect.y < top) {
125     top = rect.y;
126     topEl = el;
127     }
128     if (rect.x < left) {
129     left = rect.x;
130     leftEl = el;
131     }
132     });
133    
134     var rect = uu.viewport.rect ();
135     if (rect.sh <= top && top <= rect.sh + rect.h) {
136     top = rect.sh;
137     }
138     if (rect.sw <= left && left <= rect.sw + rect.w) {
139     left = rect.sw;
140     }
141    
142     if (leftEl || topEl) {
143     var od = (leftEl || topEl).ownerDocument;
144     var point = od.createElement ('span');
145     point.style.display = 'block';
146     point.style.position = 'absolute';
147     point.style.top = top + 'px';
148     point.style.left = left + 'px';
149     point.style.width = 0;
150     point.style.height = 0;
151     od.documentElement.appendChild (point);
152     point.scrollIntoView (true);
153     point.parentNode.removeChild (point);
154     }
155     }
156    
157 wakaba 1.4 var SimpleBalloonSVG = new JSTE.Class (function (messageContainer, refElement) {
158     this.element = document.createElement ('div');
159     this.element.className = 'sbs-container';
160 wakaba 1.1 this.element.appendChild (messageContainer);
161 wakaba 1.4 document.body.appendChild (this.element);
162    
163     this.contentElement = messageContainer;
164    
165     var msgRects = NR.Element.getRects (messageContainer, window);
166     var msgRect = msgRects.borderBox;
167    
168     var SVGNS = 'http://www.w3.org/2000/svg';
169     var box = document.createElementNS (SVGNS, 'svg');
170    
171     box.style.display = 'block';
172     box.style.position = 'absolute';
173     box.style.top = '-10px';
174     box.style.left = '-10px';
175    
176     var boxWidth = msgRect.width + 10 * 2;
177     var boxHeight = msgRect.height + 10 * 2;
178    
179     messageContainer.style.position = 'relative';
180    
181     box.setAttribute ('width', boxWidth);
182     box.setAttribute ('height', boxHeight);
183    
184     var boxBorder = document.createElementNS (SVGNS, 'rect');
185     boxBorder.setAttribute ('x', 4);
186     boxBorder.setAttribute ('y', 4);
187     boxBorder.setAttribute ('width', boxWidth - 4 * 2);
188     boxBorder.setAttribute ('height', boxHeight - 4 * 2);
189     boxBorder.setAttribute ('stroke', 'red');
190     boxBorder.setAttribute ('stroke-width', 2);
191     boxBorder.setAttribute ('fill', this.getBackgroundColor ());
192    
193     box.appendChild (boxBorder);
194    
195     this.element.insertBefore (box, this.element.firstChild);
196 wakaba 1.1
197     if (refElement) {
198 wakaba 1.4 var rects = NR.Element.getRects (refElement, window);
199     var bb = rects.borderBox;
200 wakaba 1.1
201 wakaba 1.4 var left = bb.right;
202     var top = bb.top + bb.height / 2;
203    
204 wakaba 1.1 this.element.style.top = top + 'px';
205     this.element.style.left = left + 'px';
206 wakaba 1.4
207 wakaba 1.1 this.refElement = refElement;
208     JSTE.Element.addClassName (refElement, 'selected');
209 wakaba 1.4
210     JSTE.Element.addClassName (this.element, 'sbs-with-refelement');
211     } else {
212     JSTE.Element.addClassName (this.element, 'sbs-without-refelement');
213 wakaba 1.1 }
214    
215     var self = this;
216     //setTimeout (function () {
217     showElement (new JSTE.List ([refElement]).onlyNonNull ());
218     //}, 2000);
219     }, {
220     remove: function () {
221     if (this.refElement) {
222     JSTE.Element.deleteClassName (this.refElement, 'selected');
223     }
224 wakaba 1.4 }, // remove
225    
226     getBackgroundColor: function () {
227     var el = this.contentElement;
228     if (window.getComputedStyle) {
229     return getComputedStyle (el, null).backgroundColor;
230     } else if (el.currentStyle) {
231     return el.currentStyle.backgroundColor;
232     } else {
233     return 'white';
234     }
235     } // getBackgroundColor
236     }); // SimpleBalloonSVG
237 wakaba 1.1
238     var MyMessage = new JSTE.Subclass (function () {
239     return this._super.apply (this, arguments);
240     }, JSTE.Message, {
241     _render: function (msgContainer, buttonContainer) {
242     var doc = this._targetDocument;
243    
244     var container = doc.createElement ('section');
245     container.className = 'container';
246     var style = doc.createElement ('style');
247     style.textContent = this.select + ' { outline: red 2px solid }';
248     container.appendChild (style);
249    
250     container.appendChild (msgContainer);
251     container.appendChild (buttonContainer);
252    
253     var refElement = JSTE.Node.querySelector (document, this.select);
254    
255     if (refElement) {
256     var pointer = doc.createElement ('span');
257     pointer.className = 'pointer';
258     container.appendChild (pointer);
259     }
260    
261 wakaba 1.4 this._simpleBalloon = new SimpleBalloonSVG (container, refElement);
262 wakaba 1.1
263     return this._simpleBalloon.element;
264     }, // _render
265     _remove: function () {
266     this._simpleBalloon.remove ();
267     } // _remove
268     });
269    
270     var xhr = new XMLHttpRequest ();
271     xhr.open ('GET', 'test.xml', false);
272     xhr.send (null);
273    
274    
275     document.a =
276     JSTE.Course.createFromDocument (xhr.responseXML, document);
277    
278     document.b =
279     new JSTE.Tutorial (document, document.a, {messageClass: MyMessage});
280    
281    
282     </script>
283    
284 wakaba 1.3 <!--
285     /* ***** BEGIN LICENSE BLOCK *****
286     * Copyright 2008-2009 Wakaba <w@suika.fam.cx>. All rights reserved.
287     *
288     * This program is free software; you can redistribute it and/or
289     * modify it under the same terms as Perl itself.
290     *
291     * Alternatively, the contents of this file may be used
292     * under the following terms (the "MPL/GPL/LGPL"),
293     * in which case the provisions of the MPL/GPL/LGPL are applicable instead
294     * of those above. If you wish to allow use of your version of this file only
295     * under the terms of the MPL/GPL/LGPL, and not to allow others to
296     * use your version of this file under the terms of the Perl, indicate your
297     * decision by deleting the provisions above and replace them with the notice
298     * and other provisions required by the MPL/GPL/LGPL. If you do not delete
299     * the provisions above, a recipient may use your version of this file under
300     * the terms of any one of the Perl or the MPL/GPL/LGPL.
301     *
302     * "MPL/GPL/LGPL":
303     *
304     * Version: MPL 1.1/GPL 2.0/LGPL 2.1
305     *
306     * The contents of this file are subject to the Mozilla Public License Version
307     * 1.1 (the "License"); you may not use this file except in compliance with
308     * the License. You may obtain a copy of the License at
309     * <http://www.mozilla.org/MPL/>
310     *
311     * Software distributed under the License is distributed on an "AS IS" basis,
312     * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
313     * for the specific language governing rights and limitations under the
314     * License.
315     *
316     * The Original Code is JSTE code.
317     *
318     * The Initial Developer of the Original Code is Wakaba.
319     * Portions created by the Initial Developer are Copyright (C) 2008
320     * the Initial Developer. All Rights Reserved.
321     *
322     * Contributor(s):
323     * Wakaba <w@suika.fam.cx>
324     *
325     * Alternatively, the contents of this file may be used under the terms of
326     * either the GNU General Public License Version 2 or later (the "GPL"), or
327     * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
328     * in which case the provisions of the GPL or the LGPL are applicable instead
329     * of those above. If you wish to allow use of your version of this file only
330     * under the terms of either the GPL or the LGPL, and not to allow others to
331     * use your version of this file under the terms of the MPL, indicate your
332     * decision by deleting the provisions above and replace them with the notice
333     * and other provisions required by the LGPL or the GPL. If you do not delete
334     * the provisions above, a recipient may use your version of this file under
335     * the terms of any one of the MPL, the GPL or the LGPL.
336     *
337     * ***** END LICENSE BLOCK ***** */
338     -->

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24