|
1 /* Functions for the advlink plugin popup */ |
|
2 |
|
3 tinyMCEPopup.requireLangPack(); |
|
4 |
|
5 var templates = { |
|
6 "window.open" : "window.open('${url}','${target}','${options}')" |
|
7 }; |
|
8 |
|
9 function preinit() { |
|
10 var url; |
|
11 |
|
12 if (url = tinyMCEPopup.getParam("external_link_list_url")) |
|
13 document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>'); |
|
14 } |
|
15 |
|
16 function changeClass() { |
|
17 var formObj = document.forms[0]; |
|
18 formObj.classes.value = getSelectValue(formObj, 'classlist'); |
|
19 } |
|
20 |
|
21 function init() { |
|
22 tinyMCEPopup.resizeToInnerSize(); |
|
23 |
|
24 var formObj = document.forms[0]; |
|
25 var inst = tinyMCEPopup.editor; |
|
26 var elm = inst.selection.getNode(); |
|
27 var action = "insert"; |
|
28 var html; |
|
29 |
|
30 document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser','href','file','advlink'); |
|
31 document.getElementById('popupurlbrowsercontainer').innerHTML = getBrowserHTML('popupurlbrowser','popupurl','file','advlink'); |
|
32 document.getElementById('linklisthrefcontainer').innerHTML = getLinkListHTML('linklisthref','href'); |
|
33 document.getElementById('anchorlistcontainer').innerHTML = getAnchorListHTML('anchorlist','href'); |
|
34 document.getElementById('targetlistcontainer').innerHTML = getTargetListHTML('targetlist','target'); |
|
35 |
|
36 // Link list |
|
37 html = getLinkListHTML('linklisthref','href'); |
|
38 if (html == "") |
|
39 document.getElementById("linklisthrefrow").style.display = 'none'; |
|
40 else |
|
41 document.getElementById("linklisthrefcontainer").innerHTML = html; |
|
42 |
|
43 // Resize some elements |
|
44 if (isVisible('hrefbrowser')) |
|
45 document.getElementById('href').style.width = '260px'; |
|
46 |
|
47 if (isVisible('popupurlbrowser')) |
|
48 document.getElementById('popupurl').style.width = '180px'; |
|
49 |
|
50 elm = inst.dom.getParent(elm, "A"); |
|
51 if (elm != null && elm.nodeName == "A") |
|
52 action = "update"; |
|
53 |
|
54 formObj.insert.value = tinyMCEPopup.getLang(action, 'Insert', true); |
|
55 |
|
56 setPopupControlsDisabled(true); |
|
57 |
|
58 if (action == "update") { |
|
59 var href = inst.dom.getAttrib(elm, 'href'); |
|
60 var onclick = inst.dom.getAttrib(elm, 'onclick'); |
|
61 |
|
62 // Setup form data |
|
63 setFormValue('href', href); |
|
64 setFormValue('title', inst.dom.getAttrib(elm, 'title')); |
|
65 setFormValue('id', inst.dom.getAttrib(elm, 'id')); |
|
66 setFormValue('style', inst.dom.getAttrib(elm, "style")); |
|
67 setFormValue('rel', inst.dom.getAttrib(elm, 'rel')); |
|
68 setFormValue('rev', inst.dom.getAttrib(elm, 'rev')); |
|
69 setFormValue('charset', inst.dom.getAttrib(elm, 'charset')); |
|
70 setFormValue('hreflang', inst.dom.getAttrib(elm, 'hreflang')); |
|
71 setFormValue('dir', inst.dom.getAttrib(elm, 'dir')); |
|
72 setFormValue('lang', inst.dom.getAttrib(elm, 'lang')); |
|
73 setFormValue('tabindex', inst.dom.getAttrib(elm, 'tabindex', typeof(elm.tabindex) != "undefined" ? elm.tabindex : "")); |
|
74 setFormValue('accesskey', inst.dom.getAttrib(elm, 'accesskey', typeof(elm.accesskey) != "undefined" ? elm.accesskey : "")); |
|
75 setFormValue('type', inst.dom.getAttrib(elm, 'type')); |
|
76 setFormValue('onfocus', inst.dom.getAttrib(elm, 'onfocus')); |
|
77 setFormValue('onblur', inst.dom.getAttrib(elm, 'onblur')); |
|
78 setFormValue('onclick', onclick); |
|
79 setFormValue('ondblclick', inst.dom.getAttrib(elm, 'ondblclick')); |
|
80 setFormValue('onmousedown', inst.dom.getAttrib(elm, 'onmousedown')); |
|
81 setFormValue('onmouseup', inst.dom.getAttrib(elm, 'onmouseup')); |
|
82 setFormValue('onmouseover', inst.dom.getAttrib(elm, 'onmouseover')); |
|
83 setFormValue('onmousemove', inst.dom.getAttrib(elm, 'onmousemove')); |
|
84 setFormValue('onmouseout', inst.dom.getAttrib(elm, 'onmouseout')); |
|
85 setFormValue('onkeypress', inst.dom.getAttrib(elm, 'onkeypress')); |
|
86 setFormValue('onkeydown', inst.dom.getAttrib(elm, 'onkeydown')); |
|
87 setFormValue('onkeyup', inst.dom.getAttrib(elm, 'onkeyup')); |
|
88 setFormValue('target', inst.dom.getAttrib(elm, 'target')); |
|
89 setFormValue('classes', inst.dom.getAttrib(elm, 'class')); |
|
90 |
|
91 // Parse onclick data |
|
92 if (onclick != null && onclick.indexOf('window.open') != -1) |
|
93 parseWindowOpen(onclick); |
|
94 else |
|
95 parseFunction(onclick); |
|
96 |
|
97 // Select by the values |
|
98 selectByValue(formObj, 'dir', inst.dom.getAttrib(elm, 'dir')); |
|
99 selectByValue(formObj, 'rel', inst.dom.getAttrib(elm, 'rel')); |
|
100 selectByValue(formObj, 'rev', inst.dom.getAttrib(elm, 'rev')); |
|
101 selectByValue(formObj, 'linklisthref', href); |
|
102 |
|
103 if (href.charAt(0) == '#') |
|
104 selectByValue(formObj, 'anchorlist', href); |
|
105 |
|
106 addClassesToList('classlist', 'advlink_styles'); |
|
107 |
|
108 selectByValue(formObj, 'classlist', inst.dom.getAttrib(elm, 'class'), true); |
|
109 selectByValue(formObj, 'targetlist', inst.dom.getAttrib(elm, 'target'), true); |
|
110 } else |
|
111 addClassesToList('classlist', 'advlink_styles'); |
|
112 |
|
113 window.focus(); |
|
114 } |
|
115 |
|
116 function checkPrefix(n) { |
|
117 if (Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advlink_dlg.is_email'))) |
|
118 n.value = 'mailto:' + n.value; |
|
119 |
|
120 if (/^\s*www./i.test(n.value) && confirm(tinyMCEPopup.getLang('advlink_dlg.is_external'))) |
|
121 n.value = 'http://' + n.value; |
|
122 } |
|
123 |
|
124 function setFormValue(name, value) { |
|
125 document.forms[0].elements[name].value = value; |
|
126 } |
|
127 |
|
128 function parseWindowOpen(onclick) { |
|
129 var formObj = document.forms[0]; |
|
130 |
|
131 // Preprocess center code |
|
132 if (onclick.indexOf('return false;') != -1) { |
|
133 formObj.popupreturn.checked = true; |
|
134 onclick = onclick.replace('return false;', ''); |
|
135 } else |
|
136 formObj.popupreturn.checked = false; |
|
137 |
|
138 var onClickData = parseLink(onclick); |
|
139 |
|
140 if (onClickData != null) { |
|
141 formObj.ispopup.checked = true; |
|
142 setPopupControlsDisabled(false); |
|
143 |
|
144 var onClickWindowOptions = parseOptions(onClickData['options']); |
|
145 var url = onClickData['url']; |
|
146 |
|
147 formObj.popupname.value = onClickData['target']; |
|
148 formObj.popupurl.value = url; |
|
149 formObj.popupwidth.value = getOption(onClickWindowOptions, 'width'); |
|
150 formObj.popupheight.value = getOption(onClickWindowOptions, 'height'); |
|
151 |
|
152 formObj.popupleft.value = getOption(onClickWindowOptions, 'left'); |
|
153 formObj.popuptop.value = getOption(onClickWindowOptions, 'top'); |
|
154 |
|
155 if (formObj.popupleft.value.indexOf('screen') != -1) |
|
156 formObj.popupleft.value = "c"; |
|
157 |
|
158 if (formObj.popuptop.value.indexOf('screen') != -1) |
|
159 formObj.popuptop.value = "c"; |
|
160 |
|
161 formObj.popuplocation.checked = getOption(onClickWindowOptions, 'location') == "yes"; |
|
162 formObj.popupscrollbars.checked = getOption(onClickWindowOptions, 'scrollbars') == "yes"; |
|
163 formObj.popupmenubar.checked = getOption(onClickWindowOptions, 'menubar') == "yes"; |
|
164 formObj.popupresizable.checked = getOption(onClickWindowOptions, 'resizable') == "yes"; |
|
165 formObj.popuptoolbar.checked = getOption(onClickWindowOptions, 'toolbar') == "yes"; |
|
166 formObj.popupstatus.checked = getOption(onClickWindowOptions, 'status') == "yes"; |
|
167 formObj.popupdependent.checked = getOption(onClickWindowOptions, 'dependent') == "yes"; |
|
168 |
|
169 buildOnClick(); |
|
170 } |
|
171 } |
|
172 |
|
173 function parseFunction(onclick) { |
|
174 var formObj = document.forms[0]; |
|
175 var onClickData = parseLink(onclick); |
|
176 |
|
177 // TODO: Add stuff here |
|
178 } |
|
179 |
|
180 function getOption(opts, name) { |
|
181 return typeof(opts[name]) == "undefined" ? "" : opts[name]; |
|
182 } |
|
183 |
|
184 function setPopupControlsDisabled(state) { |
|
185 var formObj = document.forms[0]; |
|
186 |
|
187 formObj.popupname.disabled = state; |
|
188 formObj.popupurl.disabled = state; |
|
189 formObj.popupwidth.disabled = state; |
|
190 formObj.popupheight.disabled = state; |
|
191 formObj.popupleft.disabled = state; |
|
192 formObj.popuptop.disabled = state; |
|
193 formObj.popuplocation.disabled = state; |
|
194 formObj.popupscrollbars.disabled = state; |
|
195 formObj.popupmenubar.disabled = state; |
|
196 formObj.popupresizable.disabled = state; |
|
197 formObj.popuptoolbar.disabled = state; |
|
198 formObj.popupstatus.disabled = state; |
|
199 formObj.popupreturn.disabled = state; |
|
200 formObj.popupdependent.disabled = state; |
|
201 |
|
202 setBrowserDisabled('popupurlbrowser', state); |
|
203 } |
|
204 |
|
205 function parseLink(link) { |
|
206 link = link.replace(new RegExp(''', 'g'), "'"); |
|
207 |
|
208 var fnName = link.replace(new RegExp("\\s*([A-Za-z0-9\.]*)\\s*\\(.*", "gi"), "$1"); |
|
209 |
|
210 // Is function name a template function |
|
211 var template = templates[fnName]; |
|
212 if (template) { |
|
213 // Build regexp |
|
214 var variableNames = template.match(new RegExp("'?\\$\\{[A-Za-z0-9\.]*\\}'?", "gi")); |
|
215 var regExp = "\\s*[A-Za-z0-9\.]*\\s*\\("; |
|
216 var replaceStr = ""; |
|
217 for (var i=0; i<variableNames.length; i++) { |
|
218 // Is string value |
|
219 if (variableNames[i].indexOf("'${") != -1) |
|
220 regExp += "'(.*)'"; |
|
221 else // Number value |
|
222 regExp += "([0-9]*)"; |
|
223 |
|
224 replaceStr += "$" + (i+1); |
|
225 |
|
226 // Cleanup variable name |
|
227 variableNames[i] = variableNames[i].replace(new RegExp("[^A-Za-z0-9]", "gi"), ""); |
|
228 |
|
229 if (i != variableNames.length-1) { |
|
230 regExp += "\\s*,\\s*"; |
|
231 replaceStr += "<delim>"; |
|
232 } else |
|
233 regExp += ".*"; |
|
234 } |
|
235 |
|
236 regExp += "\\);?"; |
|
237 |
|
238 // Build variable array |
|
239 var variables = new Array(); |
|
240 variables["_function"] = fnName; |
|
241 var variableValues = link.replace(new RegExp(regExp, "gi"), replaceStr).split('<delim>'); |
|
242 for (var i=0; i<variableNames.length; i++) |
|
243 variables[variableNames[i]] = variableValues[i]; |
|
244 |
|
245 return variables; |
|
246 } |
|
247 |
|
248 return null; |
|
249 } |
|
250 |
|
251 function parseOptions(opts) { |
|
252 if (opts == null || opts == "") |
|
253 return new Array(); |
|
254 |
|
255 // Cleanup the options |
|
256 opts = opts.toLowerCase(); |
|
257 opts = opts.replace(/;/g, ","); |
|
258 opts = opts.replace(/[^0-9a-z=,]/g, ""); |
|
259 |
|
260 var optionChunks = opts.split(','); |
|
261 var options = new Array(); |
|
262 |
|
263 for (var i=0; i<optionChunks.length; i++) { |
|
264 var parts = optionChunks[i].split('='); |
|
265 |
|
266 if (parts.length == 2) |
|
267 options[parts[0]] = parts[1]; |
|
268 } |
|
269 |
|
270 return options; |
|
271 } |
|
272 |
|
273 function buildOnClick() { |
|
274 var formObj = document.forms[0]; |
|
275 |
|
276 if (!formObj.ispopup.checked) { |
|
277 formObj.onclick.value = ""; |
|
278 return; |
|
279 } |
|
280 |
|
281 var onclick = "window.open('"; |
|
282 var url = formObj.popupurl.value; |
|
283 |
|
284 onclick += url + "','"; |
|
285 onclick += formObj.popupname.value + "','"; |
|
286 |
|
287 if (formObj.popuplocation.checked) |
|
288 onclick += "location=yes,"; |
|
289 |
|
290 if (formObj.popupscrollbars.checked) |
|
291 onclick += "scrollbars=yes,"; |
|
292 |
|
293 if (formObj.popupmenubar.checked) |
|
294 onclick += "menubar=yes,"; |
|
295 |
|
296 if (formObj.popupresizable.checked) |
|
297 onclick += "resizable=yes,"; |
|
298 |
|
299 if (formObj.popuptoolbar.checked) |
|
300 onclick += "toolbar=yes,"; |
|
301 |
|
302 if (formObj.popupstatus.checked) |
|
303 onclick += "status=yes,"; |
|
304 |
|
305 if (formObj.popupdependent.checked) |
|
306 onclick += "dependent=yes,"; |
|
307 |
|
308 if (formObj.popupwidth.value != "") |
|
309 onclick += "width=" + formObj.popupwidth.value + ","; |
|
310 |
|
311 if (formObj.popupheight.value != "") |
|
312 onclick += "height=" + formObj.popupheight.value + ","; |
|
313 |
|
314 if (formObj.popupleft.value != "") { |
|
315 if (formObj.popupleft.value != "c") |
|
316 onclick += "left=" + formObj.popupleft.value + ","; |
|
317 else |
|
318 onclick += "left='+(screen.availWidth/2-" + (formObj.popupwidth.value/2) + ")+',"; |
|
319 } |
|
320 |
|
321 if (formObj.popuptop.value != "") { |
|
322 if (formObj.popuptop.value != "c") |
|
323 onclick += "top=" + formObj.popuptop.value + ","; |
|
324 else |
|
325 onclick += "top='+(screen.availHeight/2-" + (formObj.popupheight.value/2) + ")+',"; |
|
326 } |
|
327 |
|
328 if (onclick.charAt(onclick.length-1) == ',') |
|
329 onclick = onclick.substring(0, onclick.length-1); |
|
330 |
|
331 onclick += "');"; |
|
332 |
|
333 if (formObj.popupreturn.checked) |
|
334 onclick += "return false;"; |
|
335 |
|
336 // tinyMCE.debug(onclick); |
|
337 |
|
338 formObj.onclick.value = onclick; |
|
339 |
|
340 if (formObj.href.value == "") |
|
341 formObj.href.value = url; |
|
342 } |
|
343 |
|
344 function setAttrib(elm, attrib, value) { |
|
345 var formObj = document.forms[0]; |
|
346 var valueElm = formObj.elements[attrib.toLowerCase()]; |
|
347 |
|
348 if (typeof(value) == "undefined" || value == null) { |
|
349 value = ""; |
|
350 |
|
351 if (valueElm) |
|
352 value = valueElm.value; |
|
353 } |
|
354 |
|
355 if (value != "") { |
|
356 elm.setAttribute(attrib.toLowerCase(), value); |
|
357 |
|
358 if (attrib == "style") |
|
359 attrib = "style.cssText"; |
|
360 |
|
361 if (attrib.substring(0, 2) == 'on') |
|
362 value = 'return true;' + value; |
|
363 |
|
364 if (attrib == "class") |
|
365 attrib = "className"; |
|
366 |
|
367 eval('elm.' + attrib + "=value;"); |
|
368 } else |
|
369 elm.removeAttribute(attrib); |
|
370 } |
|
371 |
|
372 function getAnchorListHTML(id, target) { |
|
373 var inst = tinyMCEPopup.editor; |
|
374 var nodes = inst.dom.select('a.mceItemAnchor,img.mceItemAnchor'), name, i; |
|
375 var html = ""; |
|
376 |
|
377 html += '<select id="' + id + '" name="' + id + '" class="mceAnchorList" o2nfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="this.form.' + target + '.value='; |
|
378 html += 'this.options[this.selectedIndex].value;">'; |
|
379 html += '<option value="">---</option>'; |
|
380 |
|
381 for (i=0; i<nodes.length; i++) { |
|
382 if ((name = inst.dom.getAttrib(nodes[i], "name")) != "") |
|
383 html += '<option value="#' + name + '">' + name + '</option>'; |
|
384 } |
|
385 |
|
386 html += '</select>'; |
|
387 |
|
388 return html; |
|
389 } |
|
390 |
|
391 function insertAction() { |
|
392 var inst = tinyMCEPopup.editor; |
|
393 var elm, elementArray, i; |
|
394 |
|
395 elm = inst.selection.getNode(); |
|
396 checkPrefix(document.forms[0].href); |
|
397 |
|
398 elm = inst.dom.getParent(elm, "A"); |
|
399 tinyMCEPopup.execCommand("mceBeginUndoLevel"); |
|
400 |
|
401 // Create new anchor elements |
|
402 if (elm == null) { |
|
403 tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#"); |
|
404 |
|
405 elementArray = tinymce.grep(inst.dom.select("a"), function(n) {return inst.dom.getAttrib(n, 'href') == '#mce_temp_url#';}); |
|
406 for (i=0; i<elementArray.length; i++) { |
|
407 elm = elementArray[i]; |
|
408 |
|
409 // Move cursor to end |
|
410 try { |
|
411 tinyMCEPopup.editor.selection.collapse(false); |
|
412 } catch (ex) { |
|
413 // Ignore |
|
414 } |
|
415 |
|
416 // Move cursor behind the new anchor |
|
417 // Don't remember why this was needed so it's now removed |
|
418 /* |
|
419 if (tinyMCE.isGecko) { |
|
420 var sp = inst.getDoc().createTextNode(" "); |
|
421 |
|
422 if (elm.nextSibling) |
|
423 elm.parentNode.insertBefore(sp, elm.nextSibling); |
|
424 else |
|
425 elm.parentNode.appendChild(sp); |
|
426 |
|
427 // Set range after link |
|
428 var rng = inst.getDoc().createRange(); |
|
429 rng.setStartAfter(elm); |
|
430 rng.setEndAfter(elm); |
|
431 |
|
432 // Update selection |
|
433 var sel = inst.getSel(); |
|
434 sel.removeAllRanges(); |
|
435 sel.addRange(rng); |
|
436 } |
|
437 */ |
|
438 |
|
439 setAllAttribs(elm); |
|
440 } |
|
441 } else |
|
442 setAllAttribs(elm); |
|
443 |
|
444 tinyMCEPopup.execCommand("mceEndUndoLevel"); |
|
445 tinyMCEPopup.close(); |
|
446 } |
|
447 |
|
448 function setAllAttribs(elm) { |
|
449 var formObj = document.forms[0]; |
|
450 var href = formObj.href.value; |
|
451 var target = getSelectValue(formObj, 'targetlist'); |
|
452 |
|
453 setAttrib(elm, 'href', href); |
|
454 setAttrib(elm, 'mce_href', href); |
|
455 setAttrib(elm, 'title'); |
|
456 setAttrib(elm, 'target', target == '_self' ? '' : target); |
|
457 setAttrib(elm, 'id'); |
|
458 setAttrib(elm, 'style'); |
|
459 setAttrib(elm, 'class', getSelectValue(formObj, 'classlist')); |
|
460 setAttrib(elm, 'rel'); |
|
461 setAttrib(elm, 'rev'); |
|
462 setAttrib(elm, 'charset'); |
|
463 setAttrib(elm, 'hreflang'); |
|
464 setAttrib(elm, 'dir'); |
|
465 setAttrib(elm, 'lang'); |
|
466 setAttrib(elm, 'tabindex'); |
|
467 setAttrib(elm, 'accesskey'); |
|
468 setAttrib(elm, 'type'); |
|
469 setAttrib(elm, 'onfocus'); |
|
470 setAttrib(elm, 'onblur'); |
|
471 setAttrib(elm, 'onclick'); |
|
472 setAttrib(elm, 'ondblclick'); |
|
473 setAttrib(elm, 'onmousedown'); |
|
474 setAttrib(elm, 'onmouseup'); |
|
475 setAttrib(elm, 'onmouseover'); |
|
476 setAttrib(elm, 'onmousemove'); |
|
477 setAttrib(elm, 'onmouseout'); |
|
478 setAttrib(elm, 'onkeypress'); |
|
479 setAttrib(elm, 'onkeydown'); |
|
480 setAttrib(elm, 'onkeyup'); |
|
481 |
|
482 // Refresh in old MSIE |
|
483 if (tinyMCE.isMSIE5) |
|
484 elm.outerHTML = elm.outerHTML; |
|
485 } |
|
486 |
|
487 function getSelectValue(form_obj, field_name) { |
|
488 var elm = form_obj.elements[field_name]; |
|
489 |
|
490 if (elm == null || elm.options == null) |
|
491 return ""; |
|
492 |
|
493 return elm.options[elm.selectedIndex].value; |
|
494 } |
|
495 |
|
496 function getLinkListHTML(elm_id, target_form_element, onchange_func) { |
|
497 if (typeof(tinyMCELinkList) == "undefined" || tinyMCELinkList.length == 0) |
|
498 return ""; |
|
499 |
|
500 var html = ""; |
|
501 |
|
502 html += '<select id="' + elm_id + '" name="' + elm_id + '"'; |
|
503 html += ' class="mceLinkList" onfoc2us="tinyMCE.addSelectAccessibility(event, this, window);" onchange="this.form.' + target_form_element + '.value='; |
|
504 html += 'this.options[this.selectedIndex].value;'; |
|
505 |
|
506 if (typeof(onchange_func) != "undefined") |
|
507 html += onchange_func + '(\'' + target_form_element + '\',this.options[this.selectedIndex].text,this.options[this.selectedIndex].value);'; |
|
508 |
|
509 html += '"><option value="">---</option>'; |
|
510 |
|
511 for (var i=0; i<tinyMCELinkList.length; i++) |
|
512 html += '<option value="' + tinyMCELinkList[i][1] + '">' + tinyMCELinkList[i][0] + '</option>'; |
|
513 |
|
514 html += '</select>'; |
|
515 |
|
516 return html; |
|
517 |
|
518 // tinyMCE.debug('-- image list start --', html, '-- image list end --'); |
|
519 } |
|
520 |
|
521 function getTargetListHTML(elm_id, target_form_element) { |
|
522 var targets = tinyMCEPopup.getParam('theme_advanced_link_targets', '').split(';'); |
|
523 var html = ''; |
|
524 |
|
525 html += '<select id="' + elm_id + '" name="' + elm_id + '" onf2ocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="this.form.' + target_form_element + '.value='; |
|
526 html += 'this.options[this.selectedIndex].value;">'; |
|
527 html += '<option value="_self">' + tinyMCEPopup.getLang('advlink_dlg.target_same') + '</option>'; |
|
528 html += '<option value="_blank">' + tinyMCEPopup.getLang('advlink_dlg.target_blank') + ' (_blank)</option>'; |
|
529 html += '<option value="_parent">' + tinyMCEPopup.getLang('advlink_dlg.target_parent') + ' (_parent)</option>'; |
|
530 html += '<option value="_top">' + tinyMCEPopup.getLang('advlink_dlg.target_top') + ' (_top)</option>'; |
|
531 |
|
532 for (var i=0; i<targets.length; i++) { |
|
533 var key, value; |
|
534 |
|
535 if (targets[i] == "") |
|
536 continue; |
|
537 |
|
538 key = targets[i].split('=')[0]; |
|
539 value = targets[i].split('=')[1]; |
|
540 |
|
541 html += '<option value="' + key + '">' + value + ' (' + key + ')</option>'; |
|
542 } |
|
543 |
|
544 html += '</select>'; |
|
545 |
|
546 return html; |
|
547 } |
|
548 |
|
549 // While loading |
|
550 preinit(); |
|
551 tinyMCEPopup.onInit.add(init); |