source: trunk/popups/link.html @ 109

Last change on this file since 109 was 109, checked in by niko, 15 years ago

#147
use only one global popup.css

  • Property svn:keywords set to LastChangedDate LastChangedRevision LastChangedBy HeadURL Id
File size: 3.7 KB
Line 
1<html>
2
3<head>
4  <title>Insert/Modify Link</title>
5  <script type="text/javascript" src="popup.js"></script>
6  <link rel="stylesheet" type="text/css" href="popup.css" />
7
8  <script type="text/javascript">
9    window.resizeTo(400, 200);
10
11HTMLArea = window.opener.HTMLArea;
12
13function i18n(str) {
14  return (HTMLArea._lc(str, 'HTMLArea'));
15};
16
17function onTargetChanged() {
18  var f = document.getElementById("f_other_target");
19  if (this.value == "_other") {
20    f.style.visibility = "visible";
21    f.select();
22    f.focus();
23  } else f.style.visibility = "hidden";
24};
25
26function Init() {
27  __dlg_translate('HTMLArea');
28  __dlg_init();
29  var param = window.dialogArguments;
30  var target_select = document.getElementById("f_target");
31  var use_target = true;
32  if (param) {
33    if ( typeof param["f_usetarget"] != "undefined" ) {
34      use_target = param["f_usetarget"];
35    }
36    if ( typeof param["f_href"] != "undefined" ) {
37      document.getElementById("f_href").value = param["f_href"];
38      document.getElementById("f_title").value = param["f_title"];
39      comboSelectValue(target_select, param["f_target"]);
40      if (target_select.value != param.f_target) {
41        var opt = document.createElement("option");
42        opt.value = param.f_target;
43        opt.innerHTML = opt.value;
44        target_select.appendChild(opt);
45        opt.selected = true;
46      }
47    }
48  }
49  if (! use_target) {
50    document.getElementById("f_target_label").style.visibility = "hidden";
51    document.getElementById("f_target").style.visibility = "hidden";
52    document.getElementById("f_target_other").style.visibility = "hidden";
53  }
54  var opt = document.createElement("option");
55  opt.value = "_other";
56  opt.innerHTML = i18n("Other");
57  target_select.appendChild(opt);
58  target_select.onchange = onTargetChanged;
59  document.getElementById("f_href").focus();
60  document.getElementById("f_href").select();
61};
62
63function onOK() {
64  var required = {
65    // f_href shouldn't be required or otherwise removing the link by entering an empty
66    // url isn't possible anymore.
67    // "f_href": i18n("You must enter the URL where this link points to")
68  };
69  for (var i in required) {
70    var el = document.getElementById(i);
71    if (!el.value) {
72      alert(required[i]);
73      el.focus();
74      return false;
75    }
76  }
77  // pass data back to the calling window
78  var fields = ["f_href", "f_title", "f_target" ];
79  var param = new Object();
80  for (var i in fields) {
81    var id = fields[i];
82    var el = document.getElementById(id);
83    param[id] = el.value;
84  }
85  if (param.f_target == "_other")
86    param.f_target = document.getElementById("f_other_target").value;
87  __dlg_close(param);
88  return false;
89};
90
91function onCancel() {
92  __dlg_close(null);
93  return false;
94};
95
96</script>
97
98</head>
99
100<body onload="Init()">
101<div class="title">Insert/Modify Link</div>
102<form>
103<table border="0" style="width: 100%;">
104  <tr>
105    <td class="label">URL:</td>
106    <td><input type="text" id="f_href" style="width: 100%" /></td>
107  </tr>
108  <tr>
109    <td class="label">Title (tooltip):</td>
110    <td><input type="text" id="f_title" style="width: 100%" /></td>
111  </tr>
112  <tr>
113    <td class="label"><span id="f_target_label">Target:</span></td>
114    <td><select id="f_target">
115      <option value="">None (use implicit)</option>
116      <option value="_blank">New window (_blank)</option>
117      <option value="_self">Same frame (_self)</option>
118      <option value="_top">Top frame (_top)</option>
119    </select>
120    <input type="text" name="f_other_target" id="f_other_target" size="10" style="visibility: hidden" />
121    </td>
122  </tr>
123</table>
124
125<div id="buttons">
126  <button type="submit" name="ok" onclick="return onOK();">OK</button>
127  <button type="button" name="cancel" onclick="return onCancel();">Cancel</button>
128</div>
129</form>
130</body>
131</html>
Note: See TracBrowser for help on using the repository browser.