source: trunk/examples/files/Extended.html @ 1406

Last change on this file since 1406 was 1406, checked in by gogo, 21 months ago

A little quick tidy up of examples.

  • Property svn:keywords set to LastChangedDate LastChangedRevision LastChangedBy HeadURL Id
File size: 12.4 KB
Line 
1<html>
2
3<head>
4  <title>Settings</title>
5  <link rel="stylesheet" type="text/css" href="../../popups/popup.css" />
6  <script type="text/javascript">
7
8function getAbsolutePos(el) {
9  var r = { x: el.offsetLeft, y: el.offsetTop };
10  if (el.offsetParent) {
11    var tmp = getAbsolutePos(el.offsetParent);
12    r.x += tmp.x;
13    r.y += tmp.y;
14  }
15  return r;
16};
17
18function getSelectedValue(el) {
19  if(!el)
20    return "";
21  return el[el.selectedIndex].value;
22}
23
24function setSelectedValue(el, val) {
25  if(!el)
26    return "";
27  var ops = el.getElementsByTagName("option");
28  for (var i = ops.length; --i >= 0;) {
29    var op = ops[i];
30    op.selected = (op.value == val);
31  }
32  el.value = val;
33}
34
35function getCheckedValue(el) {
36  if(!el)
37    return "";
38  var radioLength = el.length;
39  if(radioLength == undefined)
40    if(el.checked)
41      return el.value;
42    else
43      return "false";
44  for(var i = 0; i < radioLength; i++) {
45    if(el[i].checked) {
46      return el[i].value;
47    }
48  }
49  return "";
50}
51
52function setCheckedValue(el, val) {
53  if(!el)
54    return;
55  var radioLength = el.length;
56  if(radioLength == undefined) {
57    el.checked = (el.value == val.toString());
58    return;
59  }
60  for(var i = 0; i < radioLength; i++) {
61    el[i].checked = false;
62    if(el[i].value == val.toString()) {
63      el[i].checked = true;
64    }
65  }
66}
67
68function __dlg_onclose() {
69  opener.Dialog._return(null);
70};
71
72// closes the dialog and passes the return info upper.
73function __dlg_close(val) {
74  opener.Dialog._return(val);
75  window.close();
76};
77
78function __dlg_close_on_esc(ev) {
79  ev || (ev = window.event);
80  if (ev.keyCode == 27) {
81    window.close();
82    return false;
83  }
84  return true;
85};
86
87function __dlg_init(bottom) {
88  var body = document.body;
89  var body_height = 0;
90  if (typeof bottom == "undefined") {
91    var div = document.createElement("div");
92    body.appendChild(div);
93    var pos = getAbsolutePos(div);
94    body_height = pos.y;
95  } else {
96    var pos = getAbsolutePos(bottom);
97    body_height = pos.y + bottom.offsetHeight;
98  }
99  if (!window.dialogArguments && opener.Dialog._arguments)
100  {
101    window.dialogArguments = opener.Dialog._arguments;
102  }
103  if (!document.all) {
104   if(window.sizeToContent)
105   {
106    window.sizeToContent();
107    window.sizeToContent();  // for reasons beyond understanding,
108          // only if we call it twice we get the
109          // correct size.
110    }
111    window.addEventListener("unload", __dlg_onclose, true);
112    window.innerWidth = body.offsetWidth + 5;
113    window.innerHeight = body_height + 2;
114    // center on parent
115    var x = opener.screenX + (opener.outerWidth - window.outerWidth) / 2;
116    var y = opener.screenY + (opener.outerHeight - window.outerHeight) / 2;
117    window.moveTo(x, y);
118  } else {
119    // window.dialogHeight = body.offsetHeight + 50 + "px";
120    // window.dialogWidth = body.offsetWidth + "px";
121    window.resizeTo(body.offsetWidth, body_height);
122    var ch = body.clientHeight;
123    var cw = body.clientWidth;
124    window.resizeBy(body.offsetWidth - cw, body_height - ch);
125    var W = body.offsetWidth;
126    var H = 2 * body_height - ch;
127    var x = (screen.availWidth - W) / 2;
128    var y = (screen.availHeight - H) / 2;
129    window.moveTo(x, y);
130  }
131  document.body.onkeypress = __dlg_close_on_esc;
132};
133
134function placeFocus() {
135var bFound = false;
136  // for each form
137  for (f=0; f < document.forms.length; f++) {
138    // for each element in each form
139    for(i=0; i < document.forms[f].length; i++) {
140      // if it's not a hidden element
141      if (document.forms[f][i].type != "hidden") {
142        // and it's not disabled
143        if (document.forms[f][i].disabled != true) {
144            // set the focus to it
145            document.forms[f][i].focus();
146            var bFound = true;
147        }
148      }
149      // if found in this element, stop looking
150      if (bFound == true)
151        break;
152    }
153    // if found in this form, stop looking
154    if (bFound == true)
155      break;
156  }
157}
158
159function Init() {
160  __dlg_init();
161  var param = window.dialogArguments;
162  if(param) {
163    var el;
164    for (var field in param) {
165      //alert(field + '="' + param[field] + '"');
166      el = document.getElementById(field);
167      if (el.tagName.toLowerCase()=="input"){
168        if ((el.type.toLowerCase()=="radio") || (el.type.toLowerCase()=="checkbox")){
169          setCheckedValue(el, param[field]);
170        } else {
171          el.value = param[field];
172        }
173      } else if (el.tagName.toLowerCase()=="select"){
174        setSelectedValue(el, param[field]);
175      } else if (el.tagName.toLowerCase()=="textarea"){
176        el.value = param[field];
177      }
178    }
179  }
180  placeFocus();
181};
182
183// pass data back to the calling window
184function onOK() {
185  var param = new Object();
186  var el = document.getElementsByTagName('input');
187  for (var i=0; i<el.length;i++){
188    if ((el[i].type.toLowerCase()=="radio") || (el[i].type.toLowerCase()=="checkbox")){
189      if (getCheckedValue(el[i])!=''){
190        param[el[i].id] = getCheckedValue(el[i]);
191      }
192    } else {
193      param[el[i].id] = el[i].value;
194    }
195  }
196  el = document.getElementsByTagName('select');
197  for (var i=0; i<el.length;i++){
198    param[el[i].id] = getSelectedValue(el[i]);
199  }
200  el = document.getElementsByTagName('textarea');
201  for (var i=0; i<el.length;i++){
202    param[el[i].id] = el[i].value;
203  }
204  __dlg_close(param);
205  return false;
206};
207
208function onCancel() {
209  __dlg_close(null);
210  return false;
211};
212
213</script>
214
215<style type="text/css">
216  label { width: 16em; float: left; padding: 2px 5px; text-align: right; }
217  br { clear: both; }
218</style>
219
220</head>
221
222<body class="dialog" onload="Init(); window.resizeTo(420, 820);">
223<div class="title">Settings</div>
224  <form action="" method="get">
225  <fieldset>
226    <legend>Xinha options</legend>
227    <label for="width">Editor width:</label>
228    <input type="text" name="width" id="width" title="Allowed values are 'auto', 'toolbar' or a numeric value followed by 'px'." /><br />
229    <label for="height">Editor height:</label>
230    <input type="text" name="height" id="height" title="Allowed values are 'auto' or a numeric value followed by 'px'." /><br />
231    <label for="sizeIncludesBars">Size includes bars</label>
232    <input type="checkbox" name="sizeIncludesBars" id="sizeIncludesBars" value="true" title="Specifies whether the toolbar should be included in the size, or are extra to it." /><br />
233    <label for="sizeIncludesPanels">Size includes panels</label>
234    <input type="checkbox" name="sizeIncludesPanels" id="sizeIncludesPanels" value="true" title="Specifies whether the panels should be included in the size, or are extra to it." /><br />
235    <label for="statusBar">Status Bar</label>
236    <input type="checkbox" name="statusBar" id="statusBar" value="true" title="Enable creation of the status bar?" /><br />
237    <label for="htmlareaPaste">Htmlarea Paste</label>
238    <input type="checkbox" name="htmlareaPaste" id="htmlareaPaste" value="true" title="Intercept ^V and use the Xinha paste command" /><br />
239    <label for="mozParaHandler">Mozilla Parameter Handler:</label>
240    <select name="mozParaHandler" id="mozParaHandler" title="Gecko only: Let the built-in routine for handling the return key decide if to enter br or p tags or use a custom implementation.">
241    <option value="built-in">built-in</option>
242    <option value="dirty">dirty</option>
243    <option value="best">best</option>
244    </select><br />
245    <label for="getHtmlMethod">GetHtml Method:</label>
246    <select name="getHtmlMethod" id="getHtmlMethod" title="This determines the method how the HTML output is generated.">
247    <option value="DOMwalk">DOMwalk</option>
248    <option value="TransformInnerHTML">TransformInnerHTML</option>
249    </select><br />
250    <label for="undoSteps">Undo steps:</label>
251    <input type="text" name="undoSteps" id="undoSteps" title="Maximum size of the undo queue."  /><br />
252    <label for="undoTimeout">Undo Timeout:</label>
253    <input type="text" name="undoTimeout" id="undoTimeout" title="The time interval at which undo samples are taken, default: 500 (1/2 sec)."  /><br />
254    <label for="changeJustifyWithDirection">change justify with direction</label>
255    <input type="checkbox" name="changeJustifyWithDirection" id="changeJustifyWithDirection" value="true" title="Set this to true if you want to explicitly right-justify when setting the text direction to right-to-left" /><br />
256    <label for="fullPage">full Page</label>
257    <input type="checkbox" name="fullPage" id="fullPage" value="true" title="If true then Xinha will retrieve the full HTML, starting with the HTML-tag." /><br />
258    <label for="pageStyle">Page style:</label>
259    <textarea name="pageStyle" id="pageStyle" title="Raw style definitions included in the edited document"></textarea>
260<!--    pageStyleSheets -->
261    <label for="baseHref">Base href:</label>
262    <input type="text" name="baseHref" id="baseHref" title="specify a base href for relative links" /><br />
263    <label for="expandRelativeUrl">expand relative Url</label>
264    <input type="checkbox" name="expandRelativeUrl" id="expandRelativeUrl" value="true" title="If true, relative URLs (../) will be made absolute"/><br />
265    <label for="stripBaseHref">Strip base href</label>
266    <input type="checkbox" name="stripBaseHref" id="stripBaseHref" value="true" title="We can strip the server part out of URL to make/leave them semi-absolute" /><br />
267    <label for="stripSelfNamedAnchors">Strip self named anchors</label>
268    <input type="checkbox" name="stripSelfNamedAnchors" id="stripSelfNamedAnchors" value="true" title="We can strip the url of the editor page from named links" /><br />
269    <label for="only7BitPrintablesInURLs">only 7bit printables in URLs</label>
270    <input type="checkbox" name="only7BitPrintablesInURLs" id="only7BitPrintablesInURLs" value="true" title="In URLs all characters above ASCII value 127 have to be encoded using % codes" /><br />
271    <label for="sevenBitClean">7bit Clean</label>
272    <input type="checkbox" name="sevenBitClean" id="sevenBitClean" value="true" title="If you are putting the HTML written in Xinha into an email you might want it to be 7-bit characters only." /><br />
273    <label for="killWordOnPaste">kill Word on paste</label>
274    <input type="checkbox" name="killWordOnPaste" id="killWordOnPaste" value="true" title="Set to true if you want Word code to be cleaned upon Paste." /><br />
275    <label for="makeLinkShowsTarget">make Link Shows Target</label>
276    <input type="checkbox" name="makeLinkShowsTarget" id="makeLinkShowsTarget" value="true" title="Enable the 'Target' field in the Make Link dialog." /><br />
277    <label for="flowToolbars">flow toolbars</label>
278    <input type="checkbox" name="flowToolbars" id="flowToolbars" value="true" /><br />
279    <label for="stripScripts">strip Scripts</label>
280    <input type="checkbox" name="stripScripts" id="stripScripts" value="true" title="Set to false if you want to allow JavaScript in the content" /><br />
281    <label for="showLoading">show loading</label>
282    <input type="checkbox" name="showLoading" id="showLoading" value="true" /><br />
283  </fieldset>
284
285  <fieldset id="CharacterMapOptions" class="options">
286    <legend>CharacterMap options</legend>
287    <label for="CharacterMapMode">Mode :</label>
288    <select id="CharacterMapMode" name="CharacterMapMode">
289    <option value="popup">popup</option>
290    <option value="panel">panel</option>
291    </select>
292  </fieldset>
293
294  <fieldset id="ListTypeOptions" class="options">
295    <legend>ListType options</legend>
296    <label class="ListTypeMode">Mode :</label>
297    <select id="ListTypeMode" name="ListTypeMode">
298    <option value="toolbar">toolbar</option>
299    <option value="panel">panel</option>
300    </select>
301  </fieldset>
302
303  <fieldset id="CharCounterOptions" class="options">
304    <legend>CharCounter options</legend>
305    <label for="showChar">show Char :</label>
306    <input type="checkbox" name="showChar" id="showChar" value="true" /><br />
307    <label for="showWord">show Word :</label>
308    <input type="checkbox" name="showWord" id="showWord" value="true" /><br />
309    <label for="showHtml">show Html :</label>
310    <input type="checkbox" name="showHtml" id="showHtml" value="true" /><br />
311  </fieldset>
312  <br />
313
314  <div id="buttons">
315    <button type="submit" name="ok" onclick="return onOK();">OK</button>
316    <button type="button" name="cancel" onclick="return onCancel();">Cancel</button>
317  </div>
318</form>
319</body>
320</html>
Note: See TracBrowser for help on using the repository browser.