source: trunk/popups/link.html @ 76

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

ticket #98: new i18n-system:

  • changed every use of HTMLArea.I18N to HTMLArea._lc-function
  • implemented HTMLArea._loadlang
  • converted all language-files into the new system
  • converted all language-files into utf-8
  • removed all jp-* language-files except jp-utf8.js (and renamed it into jp.js)
  • removed all en.js-files (not needed by the new system)
  • removed all empty i18n-files
  • Property svn:keywords set to LastChangedDate LastChangedRevision LastChangedBy HeadURL Id
File size: 4.3 KB
Line 
1<html>
2
3<head>
4  <title>Insert/Modify Link</title>
5  <script type="text/javascript" src="popup.js"></script>
6  <script type="text/javascript">
7    window.resizeTo(400, 200);
8
9HTMLArea = window.opener.HTMLArea;
10
11function i18n(str) {
12  return (HTMLArea._lc(str, 'HTMLArea'));
13};
14
15function onTargetChanged() {
16  var f = document.getElementById("f_other_target");
17  if (this.value == "_other") {
18    f.style.visibility = "visible";
19    f.select();
20    f.focus();
21  } else f.style.visibility = "hidden";
22};
23
24function Init() {
25  __dlg_translate('HTMLArea');
26  __dlg_init();
27  var param = window.dialogArguments;
28  var target_select = document.getElementById("f_target");
29  var use_target = true;
30  if (param) {
31    if ( typeof param["f_usetarget"] != "undefined" ) {
32      use_target = param["f_usetarget"];
33    }
34    if ( typeof param["f_href"] != "undefined" ) {
35      document.getElementById("f_href").value = param["f_href"];
36      document.getElementById("f_title").value = param["f_title"];
37      comboSelectValue(target_select, param["f_target"]);
38      if (target_select.value != param.f_target) {
39        var opt = document.createElement("option");
40        opt.value = param.f_target;
41        opt.innerHTML = opt.value;
42        target_select.appendChild(opt);
43        opt.selected = true;
44      }
45    }
46  }
47  if (! use_target) {
48    document.getElementById("f_target_label").style.visibility = "hidden";
49    document.getElementById("f_target").style.visibility = "hidden";
50    document.getElementById("f_target_other").style.visibility = "hidden";
51  }
52  var opt = document.createElement("option");
53  opt.value = "_other";
54  opt.innerHTML = i18n("Other");
55  target_select.appendChild(opt);
56  target_select.onchange = onTargetChanged;
57  document.getElementById("f_href").focus();
58  document.getElementById("f_href").select();
59};
60
61function onOK() {
62  var required = {
63    // f_href shouldn't be required or otherwise removing the link by entering an empty
64    // url isn't possible anymore.
65    // "f_href": i18n("You must enter the URL where this link points to")
66  };
67  for (var i in required) {
68    var el = document.getElementById(i);
69    if (!el.value) {
70      alert(required[i]);
71      el.focus();
72      return false;
73    }
74  }
75  // pass data back to the calling window
76  var fields = ["f_href", "f_title", "f_target" ];
77  var param = new Object();
78  for (var i in fields) {
79    var id = fields[i];
80    var el = document.getElementById(id);
81    param[id] = el.value;
82  }
83  if (param.f_target == "_other")
84    param.f_target = document.getElementById("f_other_target").value;
85  __dlg_close(param);
86  return false;
87};
88
89function onCancel() {
90  __dlg_close(null);
91  return false;
92};
93
94</script>
95
96<style type="text/css">
97html, body {
98  background: ButtonFace;
99  color: ButtonText;
100  font: 11px Tahoma,Verdana,sans-serif;
101  margin: 0px;
102  padding: 0px;
103}
104body { padding: 5px; }
105table {
106  font: 11px Tahoma,Verdana,sans-serif;
107}
108select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
109button { width: 70px; }
110table .label { text-align: right; width: 8em; }
111
112.title { background: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px;
113border-bottom: 1px solid black; letter-spacing: 2px;
114}
115
116#buttons {
117      margin-top: 1em; border-top: 1px solid #999;
118      padding: 2px; text-align: right;
119}
120</style>
121
122</head>
123
124<body onload="Init()">
125<div class="title">Insert/Modify Link</div>
126<form>
127<table border="0" style="width: 100%;">
128  <tr>
129    <td class="label">URL:</td>
130    <td><input type="text" id="f_href" style="width: 100%" /></td>
131  </tr>
132  <tr>
133    <td class="label">Title (tooltip):</td>
134    <td><input type="text" id="f_title" style="width: 100%" /></td>
135  </tr>
136  <tr>
137    <td class="label"><span id="f_target_label">Target:</span></td>
138    <td><select id="f_target">
139      <option value="">None (use implicit)</option>
140      <option value="_blank">New window (_blank)</option>
141      <option value="_self">Same frame (_self)</option>
142      <option value="_top">Top frame (_top)</option>
143    </select>
144    <input type="text" name="f_other_target" id="f_other_target" size="10" style="visibility: hidden" />
145    </td>
146  </tr>
147</table>
148
149<div id="buttons">
150  <button type="submit" name="ok" onclick="return onOK();">OK</button>
151  <button type="button" name="cancel" onclick="return onCancel();">Cancel</button>
152</div>
153</form>
154</body>
155</html>
Note: See TracBrowser for help on using the repository browser.