1 | <html style="width: 398; height: 220">
|
---|
2 |
|
---|
3 | <head>
|
---|
4 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
---|
5 | <title>Insert Sound</title>
|
---|
6 |
|
---|
7 | <script type="text/javascript" src="popup.js"></script>
|
---|
8 |
|
---|
9 | <script type="text/javascript">
|
---|
10 | var preview_window = null;
|
---|
11 |
|
---|
12 | function Init() {
|
---|
13 | __dlg_init();
|
---|
14 | document.getElementById("f_url").focus();
|
---|
15 | };
|
---|
16 |
|
---|
17 | function onOK() {
|
---|
18 | var required = {
|
---|
19 | "f_url": "You must enter the URL",
|
---|
20 | "f_alt": "Please enter the alternate text"
|
---|
21 | };
|
---|
22 | for (var i in required) {
|
---|
23 | var el = document.getElementById(i);
|
---|
24 | if (!el.value) {
|
---|
25 | alert(required[i]);
|
---|
26 | el.focus();
|
---|
27 | return false;
|
---|
28 | }
|
---|
29 | }
|
---|
30 | // pass data back to the calling window
|
---|
31 | var fields = ["f_url", "f_alt", "f_type", "f_autoplay", "f_hidden", "f_loop"];
|
---|
32 | var param = new Object();
|
---|
33 | for (var i in fields) {
|
---|
34 | var id = fields[i];
|
---|
35 | var el = document.getElementById(id);
|
---|
36 | if (id == "f_autoplay" || id == "f_hidden") {
|
---|
37 | if (el.checked) {
|
---|
38 | param[id] = "true";
|
---|
39 | } else {
|
---|
40 | param[id] = "false";
|
---|
41 | }
|
---|
42 | } else {
|
---|
43 | param[id] = el.value;
|
---|
44 | }
|
---|
45 | }
|
---|
46 |
|
---|
47 | if (preview_window) {
|
---|
48 | preview_window.close();
|
---|
49 | }
|
---|
50 | __dlg_close(param);
|
---|
51 | return false;
|
---|
52 | };
|
---|
53 |
|
---|
54 | function onCancel() {
|
---|
55 | if (preview_window) {
|
---|
56 | preview_window.close();
|
---|
57 | }
|
---|
58 | __dlg_close(null);
|
---|
59 | return false;
|
---|
60 | };
|
---|
61 |
|
---|
62 | function onTestsound() {
|
---|
63 | var f_url = document.getElementById("f_url");
|
---|
64 | var url = f_url.value;
|
---|
65 | if (!url) {
|
---|
66 | alert("You have to enter an URL first");
|
---|
67 | f_url.focus();
|
---|
68 | return false;
|
---|
69 | }
|
---|
70 | var win = null;
|
---|
71 | if (!document.all) {
|
---|
72 | win = window.open(url, "ha_testsound", "width=100,height=100,toolbar=no,menubar=no,scrollbars=no,resizable=no,personalbar=no,");
|
---|
73 | } else {
|
---|
74 | win = window.open(url, "ha_testsound", "width=100,height=100,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,channelmode=no,directories=no,");
|
---|
75 | }
|
---|
76 | return false;
|
---|
77 | };
|
---|
78 |
|
---|
79 | function onChange() {
|
---|
80 | var f_attlist = document.getElementById('f_attlist');
|
---|
81 | var f_url = document.getElementById('f_url');
|
---|
82 | var f_alt = document.getElementById('f_alt');
|
---|
83 | var f_type = document.getElementById('f_type');
|
---|
84 |
|
---|
85 | var i=f_attlist.options.selectedIndex;
|
---|
86 |
|
---|
87 | f_url.value=f_attlist.options[i].value;
|
---|
88 | if (f_url.value == "") {
|
---|
89 | f_alt.value="";
|
---|
90 | f_type.value="";
|
---|
91 | } else {
|
---|
92 | f_alt.value=f_attlist.options[i].text;
|
---|
93 | var type=f_alt.value.replace(/^.*\./, "");
|
---|
94 | if ( type != '' ) {
|
---|
95 | f_type.value="audio/x-"+type;
|
---|
96 | } else {
|
---|
97 | f_type.value="audio/x-wav";
|
---|
98 | }
|
---|
99 | }
|
---|
100 | return true;
|
---|
101 | };
|
---|
102 | </script>
|
---|
103 |
|
---|
104 | <style type="text/css">
|
---|
105 | html, body {
|
---|
106 | background: ButtonFace;
|
---|
107 | color: ButtonText;
|
---|
108 | font: 11px Tahoma,Verdana,sans-serif;
|
---|
109 | margin: 0px;
|
---|
110 | padding: 0px;
|
---|
111 | }
|
---|
112 | body { padding: 5px; }
|
---|
113 | table {
|
---|
114 | font: 11px Tahoma,Verdana,sans-serif;
|
---|
115 | }
|
---|
116 | form p {
|
---|
117 | margin-top: 5px;
|
---|
118 | margin-bottom: 5px;
|
---|
119 | }
|
---|
120 | .fl { width: 6em; float: left; padding: 2px 2px; text-align: right; }
|
---|
121 | .fr { width: 7em; float: left; padding: 2px 2px; text-align: right; }
|
---|
122 | fieldset { padding: 0px 10px 5px 5px; }
|
---|
123 | select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
|
---|
124 | button { width: 70px; }
|
---|
125 | .space { padding: 2px; }
|
---|
126 |
|
---|
127 | .title { background: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px;
|
---|
128 | border-bottom: 1px solid black; letter-spacing: 2px;
|
---|
129 | }
|
---|
130 | form { padding: 0px; margin: 0px; }
|
---|
131 | </style>
|
---|
132 |
|
---|
133 | </head>
|
---|
134 |
|
---|
135 | <body onload="Init()">
|
---|
136 |
|
---|
137 | <div class="title">Insert Sound</div>
|
---|
138 |
|
---|
139 | <form action="" method="get">
|
---|
140 | <table border="0" width="100%" style="padding: 0px; margin: 0px">
|
---|
141 | <tbody>
|
---|
142 |
|
---|
143 | <tr>
|
---|
144 | <td style="width: 7em; text-align: right">Attachments:</td>
|
---|
145 | <td><select name="attlist" id="f_attlist"
|
---|
146 | onchange="return onChange();" style="witdth:100%">
|
---|
147 | <option selected value="">-- Not selected --
|
---|
148 | </select>
|
---|
149 | </td>
|
---|
150 | </tr>
|
---|
151 | <tr>
|
---|
152 | <td style="width: 7em; text-align: right">Sound URL:</td>
|
---|
153 | <td><input type="text" name="url" id="f_url" style="width:75%"
|
---|
154 | title="Enter the sound URL here" />
|
---|
155 | <button name="testsound" onclick="return onTestsound();"
|
---|
156 | title="Test the sound in a new window">TestSound</button>
|
---|
157 | </td>
|
---|
158 | </tr>
|
---|
159 | <tr>
|
---|
160 | <td style="width: 7em; text-align: right">Alternate text:</td>
|
---|
161 | <td><input type="text" name="alt" id="f_alt" style="width:100%"
|
---|
162 | title="For browsers that don't support embed tags" /></td>
|
---|
163 | <input type="hidden" name="type" id="f_type">
|
---|
164 | </tr>
|
---|
165 | </tbody>
|
---|
166 | </table>
|
---|
167 |
|
---|
168 | <p />
|
---|
169 |
|
---|
170 | <fieldset style="float:center; margin-left: 5px; margin-right: 5px;">
|
---|
171 | <legend>Attribute</legend>
|
---|
172 | <table align="center" width="100%"><tr>
|
---|
173 | <td nowrap>
|
---|
174 | <div class="fl">Auto Play:</div>
|
---|
175 | <input type="checkbox" name="autoplay" id="f_autoplay" value="1"
|
---|
176 | title="start automatically after page loading" />
|
---|
177 | </td>
|
---|
178 | <td nowrap>
|
---|
179 | <div class="fr">Hidden Control:</div>
|
---|
180 | <input type="checkbox" name="hidden" id="f_hidden" value="1"
|
---|
181 | title="Hide the sound control" />
|
---|
182 | </td>
|
---|
183 | <td nowrap>
|
---|
184 | <div class="fr">Loop:</div>
|
---|
185 | <input type="textfield" name="loop" id="f_loop" value="1" size="3"
|
---|
186 | title="Repeat count" />
|
---|
187 | </td>
|
---|
188 | </tr></table>
|
---|
189 | </fieldset>
|
---|
190 |
|
---|
191 | <div style="margin-top: 5px; text-align: right;">
|
---|
192 | <hr />
|
---|
193 | <button type="button" name="ok" onclick="return onOK();">OK</button>
|
---|
194 | <button type="button" name="cancel" onclick="return onCancel();">Cancel</button>
|
---|
195 | </div>
|
---|
196 |
|
---|
197 | </form>
|
---|
198 |
|
---|
199 | <script type="text/javascript">
|
---|
200 | var tid;
|
---|
201 | function init_attlist () {
|
---|
202 | var options=window.dialogArguments;
|
---|
203 | var sel=document.getElementById("f_attlist");
|
---|
204 | if (options) {
|
---|
205 | for (var i in options) {
|
---|
206 | if ( i.match(/\.(mid|midi|wav|mp3|ra|au|snd)$/i) ) {
|
---|
207 | var op = document.createElement("option");
|
---|
208 | op.appendChild(document.createTextNode(i));
|
---|
209 | op.value = options[i];
|
---|
210 | sel.appendChild(op);
|
---|
211 | }
|
---|
212 | }
|
---|
213 | }
|
---|
214 | clearTimeout(tid);
|
---|
215 | }
|
---|
216 | // delay 0.1 sec to ensure attlist has been loaded by Init at body onload
|
---|
217 | tid=setTimeout("init_attlist()", 100);
|
---|
218 | </script>
|
---|
219 | </body>
|
---|
220 | </html>
|
---|