maj version dans config.xml
[mtweb] / mw / libs / tiny_mce / plugins / inlinepopups / editor_plugin_src.js
1 /**\r
2  * editor_plugin_src.js\r
3  *\r
4  * Copyright 2009, Moxiecode Systems AB\r
5  * Released under LGPL License.\r
6  *\r
7  * License: http://tinymce.moxiecode.com/license\r
8  * Contributing: http://tinymce.moxiecode.com/contributing\r
9  */\r
10 \r
11 (function() {\r
12         var DOM = tinymce.DOM, Element = tinymce.dom.Element, Event = tinymce.dom.Event, each = tinymce.each, is = tinymce.is;\r
13 \r
14         tinymce.create('tinymce.plugins.InlinePopups', {\r
15                 init : function(ed, url) {\r
16                         // Replace window manager\r
17                         ed.onBeforeRenderUI.add(function() {\r
18                                 ed.windowManager = new tinymce.InlineWindowManager(ed);\r
19                                 DOM.loadCSS(url + '/skins/' + (ed.settings.inlinepopups_skin || 'clearlooks2') + "/window.css");\r
20                         });\r
21                 },\r
22 \r
23                 getInfo : function() {\r
24                         return {\r
25                                 longname : 'InlinePopups',\r
26                                 author : 'Moxiecode Systems AB',\r
27                                 authorurl : 'http://tinymce.moxiecode.com',\r
28                                 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups',\r
29                                 version : tinymce.majorVersion + "." + tinymce.minorVersion\r
30                         };\r
31                 }\r
32         });\r
33 \r
34         tinymce.create('tinymce.InlineWindowManager:tinymce.WindowManager', {\r
35                 InlineWindowManager : function(ed) {\r
36                         var t = this;\r
37 \r
38                         t.parent(ed);\r
39                         t.zIndex = 300000;\r
40                         t.count = 0;\r
41                         t.windows = {};\r
42                 },\r
43 \r
44                 open : function(f, p) {\r
45                         var t = this, id, opt = '', ed = t.editor, dw = 0, dh = 0, vp, po, mdf, clf, we, w, u;\r
46 \r
47                         f = f || {};\r
48                         p = p || {};\r
49 \r
50                         // Run native windows\r
51                         if (!f.inline)\r
52                                 return t.parent(f, p);\r
53 \r
54                         // Only store selection if the type is a normal window\r
55                         if (!f.type)\r
56                                 t.bookmark = ed.selection.getBookmark(1);\r
57 \r
58                         id = DOM.uniqueId();\r
59                         vp = DOM.getViewPort();\r
60                         f.width = parseInt(f.width || 320);\r
61                         f.height = parseInt(f.height || 240) + (tinymce.isIE ? 8 : 0);\r
62                         f.min_width = parseInt(f.min_width || 150);\r
63                         f.min_height = parseInt(f.min_height || 100);\r
64                         f.max_width = parseInt(f.max_width || 2000);\r
65                         f.max_height = parseInt(f.max_height || 2000);\r
66                         f.left = f.left || Math.round(Math.max(vp.x, vp.x + (vp.w / 2.0) - (f.width / 2.0)));\r
67                         f.top = f.top || Math.round(Math.max(vp.y, vp.y + (vp.h / 2.0) - (f.height / 2.0)));\r
68                         f.movable = f.resizable = true;\r
69                         p.mce_width = f.width;\r
70                         p.mce_height = f.height;\r
71                         p.mce_inline = true;\r
72                         p.mce_window_id = id;\r
73                         p.mce_auto_focus = f.auto_focus;\r
74 \r
75                         // Transpose\r
76 //                      po = DOM.getPos(ed.getContainer());\r
77 //                      f.left -= po.x;\r
78 //                      f.top -= po.y;\r
79 \r
80                         t.features = f;\r
81                         t.params = p;\r
82                         t.onOpen.dispatch(t, f, p);\r
83 \r
84                         if (f.type) {\r
85                                 opt += ' mceModal';\r
86 \r
87                                 if (f.type)\r
88                                         opt += ' mce' + f.type.substring(0, 1).toUpperCase() + f.type.substring(1);\r
89 \r
90                                 f.resizable = false;\r
91                         }\r
92 \r
93                         if (f.statusbar)\r
94                                 opt += ' mceStatusbar';\r
95 \r
96                         if (f.resizable)\r
97                                 opt += ' mceResizable';\r
98 \r
99                         if (f.minimizable)\r
100                                 opt += ' mceMinimizable';\r
101 \r
102                         if (f.maximizable)\r
103                                 opt += ' mceMaximizable';\r
104 \r
105                         if (f.movable)\r
106                                 opt += ' mceMovable';\r
107 \r
108                         // Create DOM objects\r
109                         t._addAll(DOM.doc.body, \r
110                                 ['div', {id : id, 'class' : ed.settings.inlinepopups_skin || 'clearlooks2', style : 'width:100px;height:100px'}, \r
111                                         ['div', {id : id + '_wrapper', 'class' : 'mceWrapper' + opt},\r
112                                                 ['div', {id : id + '_top', 'class' : 'mceTop'}, \r
113                                                         ['div', {'class' : 'mceLeft'}],\r
114                                                         ['div', {'class' : 'mceCenter'}],\r
115                                                         ['div', {'class' : 'mceRight'}],\r
116                                                         ['span', {id : id + '_title'}, f.title || '']\r
117                                                 ],\r
118 \r
119                                                 ['div', {id : id + '_middle', 'class' : 'mceMiddle'}, \r
120                                                         ['div', {id : id + '_left', 'class' : 'mceLeft'}],\r
121                                                         ['span', {id : id + '_content'}],\r
122                                                         ['div', {id : id + '_right', 'class' : 'mceRight'}]\r
123                                                 ],\r
124 \r
125                                                 ['div', {id : id + '_bottom', 'class' : 'mceBottom'},\r
126                                                         ['div', {'class' : 'mceLeft'}],\r
127                                                         ['div', {'class' : 'mceCenter'}],\r
128                                                         ['div', {'class' : 'mceRight'}],\r
129                                                         ['span', {id : id + '_status'}, 'Content']\r
130                                                 ],\r
131 \r
132                                                 ['a', {'class' : 'mceMove', tabindex : '-1', href : 'javascript:;'}],\r
133                                                 ['a', {'class' : 'mceMin', tabindex : '-1', href : 'javascript:;', onmousedown : 'return false;'}],\r
134                                                 ['a', {'class' : 'mceMax', tabindex : '-1', href : 'javascript:;', onmousedown : 'return false;'}],\r
135                                                 ['a', {'class' : 'mceMed', tabindex : '-1', href : 'javascript:;', onmousedown : 'return false;'}],\r
136                                                 ['a', {'class' : 'mceClose', tabindex : '-1', href : 'javascript:;', onmousedown : 'return false;'}],\r
137                                                 ['a', {id : id + '_resize_n', 'class' : 'mceResize mceResizeN', tabindex : '-1', href : 'javascript:;'}],\r
138                                                 ['a', {id : id + '_resize_s', 'class' : 'mceResize mceResizeS', tabindex : '-1', href : 'javascript:;'}],\r
139                                                 ['a', {id : id + '_resize_w', 'class' : 'mceResize mceResizeW', tabindex : '-1', href : 'javascript:;'}],\r
140                                                 ['a', {id : id + '_resize_e', 'class' : 'mceResize mceResizeE', tabindex : '-1', href : 'javascript:;'}],\r
141                                                 ['a', {id : id + '_resize_nw', 'class' : 'mceResize mceResizeNW', tabindex : '-1', href : 'javascript:;'}],\r
142                                                 ['a', {id : id + '_resize_ne', 'class' : 'mceResize mceResizeNE', tabindex : '-1', href : 'javascript:;'}],\r
143                                                 ['a', {id : id + '_resize_sw', 'class' : 'mceResize mceResizeSW', tabindex : '-1', href : 'javascript:;'}],\r
144                                                 ['a', {id : id + '_resize_se', 'class' : 'mceResize mceResizeSE', tabindex : '-1', href : 'javascript:;'}]\r
145                                         ]\r
146                                 ]\r
147                         );\r
148 \r
149                         DOM.setStyles(id, {top : -10000, left : -10000});\r
150 \r
151                         // Fix gecko rendering bug, where the editors iframe messed with window contents\r
152                         if (tinymce.isGecko)\r
153                                 DOM.setStyle(id, 'overflow', 'auto');\r
154 \r
155                         // Measure borders\r
156                         if (!f.type) {\r
157                                 dw += DOM.get(id + '_left').clientWidth;\r
158                                 dw += DOM.get(id + '_right').clientWidth;\r
159                                 dh += DOM.get(id + '_top').clientHeight;\r
160                                 dh += DOM.get(id + '_bottom').clientHeight;\r
161                         }\r
162 \r
163                         // Resize window\r
164                         DOM.setStyles(id, {top : f.top, left : f.left, width : f.width + dw, height : f.height + dh});\r
165 \r
166                         u = f.url || f.file;\r
167                         if (u) {\r
168                                 if (tinymce.relaxedDomain)\r
169                                         u += (u.indexOf('?') == -1 ? '?' : '&') + 'mce_rdomain=' + tinymce.relaxedDomain;\r
170 \r
171                                 u = tinymce._addVer(u);\r
172                         }\r
173 \r
174                         if (!f.type) {\r
175                                 DOM.add(id + '_content', 'iframe', {id : id + '_ifr', src : 'javascript:""', frameBorder : 0, style : 'border:0;width:10px;height:10px'});\r
176                                 DOM.setStyles(id + '_ifr', {width : f.width, height : f.height});\r
177                                 DOM.setAttrib(id + '_ifr', 'src', u);\r
178                         } else {\r
179                                 DOM.add(id + '_wrapper', 'a', {id : id + '_ok', 'class' : 'mceButton mceOk', href : 'javascript:;', onmousedown : 'return false;'}, 'Ok');\r
180 \r
181                                 if (f.type == 'confirm')\r
182                                         DOM.add(id + '_wrapper', 'a', {'class' : 'mceButton mceCancel', href : 'javascript:;', onmousedown : 'return false;'}, 'Cancel');\r
183 \r
184                                 DOM.add(id + '_middle', 'div', {'class' : 'mceIcon'});\r
185                                 DOM.setHTML(id + '_content', f.content.replace('\n', '<br />'));\r
186                         }\r
187 \r
188                         // Register events\r
189                         mdf = Event.add(id, 'mousedown', function(e) {\r
190                                 var n = e.target, w, vp;\r
191 \r
192                                 w = t.windows[id];\r
193                                 t.focus(id);\r
194 \r
195                                 if (n.nodeName == 'A' || n.nodeName == 'a') {\r
196                                         if (n.className == 'mceMax') {\r
197                                                 w.oldPos = w.element.getXY();\r
198                                                 w.oldSize = w.element.getSize();\r
199 \r
200                                                 vp = DOM.getViewPort();\r
201 \r
202                                                 // Reduce viewport size to avoid scrollbars\r
203                                                 vp.w -= 2;\r
204                                                 vp.h -= 2;\r
205 \r
206                                                 w.element.moveTo(vp.x, vp.y);\r
207                                                 w.element.resizeTo(vp.w, vp.h);\r
208                                                 DOM.setStyles(id + '_ifr', {width : vp.w - w.deltaWidth, height : vp.h - w.deltaHeight});\r
209                                                 DOM.addClass(id + '_wrapper', 'mceMaximized');\r
210                                         } else if (n.className == 'mceMed') {\r
211                                                 // Reset to old size\r
212                                                 w.element.moveTo(w.oldPos.x, w.oldPos.y);\r
213                                                 w.element.resizeTo(w.oldSize.w, w.oldSize.h);\r
214                                                 w.iframeElement.resizeTo(w.oldSize.w - w.deltaWidth, w.oldSize.h - w.deltaHeight);\r
215 \r
216                                                 DOM.removeClass(id + '_wrapper', 'mceMaximized');\r
217                                         } else if (n.className == 'mceMove')\r
218                                                 return t._startDrag(id, e, n.className);\r
219                                         else if (DOM.hasClass(n, 'mceResize'))\r
220                                                 return t._startDrag(id, e, n.className.substring(13));\r
221                                 }\r
222                         });\r
223 \r
224                         clf = Event.add(id, 'click', function(e) {\r
225                                 var n = e.target;\r
226 \r
227                                 t.focus(id);\r
228 \r
229                                 if (n.nodeName == 'A' || n.nodeName == 'a') {\r
230                                         switch (n.className) {\r
231                                                 case 'mceClose':\r
232                                                         t.close(null, id);\r
233                                                         return Event.cancel(e);\r
234 \r
235                                                 case 'mceButton mceOk':\r
236                                                 case 'mceButton mceCancel':\r
237                                                         f.button_func(n.className == 'mceButton mceOk');\r
238                                                         return Event.cancel(e);\r
239                                         }\r
240                                 }\r
241                         });\r
242 \r
243                         // Add window\r
244                         w = t.windows[id] = {\r
245                                 id : id,\r
246                                 mousedown_func : mdf,\r
247                                 click_func : clf,\r
248                                 element : new Element(id, {blocker : 1, container : ed.getContainer()}),\r
249                                 iframeElement : new Element(id + '_ifr'),\r
250                                 features : f,\r
251                                 deltaWidth : dw,\r
252                                 deltaHeight : dh\r
253                         };\r
254 \r
255                         w.iframeElement.on('focus', function() {\r
256                                 t.focus(id);\r
257                         });\r
258 \r
259                         // Setup blocker\r
260                         if (t.count == 0 && t.editor.getParam('dialog_type', 'modal') == 'modal') {\r
261                                 DOM.add(DOM.doc.body, 'div', {\r
262                                         id : 'mceModalBlocker',\r
263                                         'class' : (t.editor.settings.inlinepopups_skin || 'clearlooks2') + '_modalBlocker',\r
264                                         style : {zIndex : t.zIndex - 1}\r
265                                 });\r
266 \r
267                                 DOM.show('mceModalBlocker'); // Reduces flicker in IE\r
268                         } else\r
269                                 DOM.setStyle('mceModalBlocker', 'z-index', t.zIndex - 1);\r
270 \r
271                         if (tinymce.isIE6 || /Firefox\/2\./.test(navigator.userAgent) || (tinymce.isIE && !DOM.boxModel))\r
272                                 DOM.setStyles('mceModalBlocker', {position : 'absolute', left : vp.x, top : vp.y, width : vp.w - 2, height : vp.h - 2});\r
273 \r
274                         t.focus(id);\r
275                         t._fixIELayout(id, 1);\r
276 \r
277                         // Focus ok button\r
278                         if (DOM.get(id + '_ok'))\r
279                                 DOM.get(id + '_ok').focus();\r
280 \r
281                         t.count++;\r
282 \r
283                         return w;\r
284                 },\r
285 \r
286                 focus : function(id) {\r
287                         var t = this, w;\r
288 \r
289                         if (w = t.windows[id]) {\r
290                                 w.zIndex = this.zIndex++;\r
291                                 w.element.setStyle('zIndex', w.zIndex);\r
292                                 w.element.update();\r
293 \r
294                                 id = id + '_wrapper';\r
295                                 DOM.removeClass(t.lastId, 'mceFocus');\r
296                                 DOM.addClass(id, 'mceFocus');\r
297                                 t.lastId = id;\r
298                         }\r
299                 },\r
300 \r
301                 _addAll : function(te, ne) {\r
302                         var i, n, t = this, dom = tinymce.DOM;\r
303 \r
304                         if (is(ne, 'string'))\r
305                                 te.appendChild(dom.doc.createTextNode(ne));\r
306                         else if (ne.length) {\r
307                                 te = te.appendChild(dom.create(ne[0], ne[1]));\r
308 \r
309                                 for (i=2; i<ne.length; i++)\r
310                                         t._addAll(te, ne[i]);\r
311                         }\r
312                 },\r
313 \r
314                 _startDrag : function(id, se, ac) {\r
315                         var t = this, mu, mm, d = DOM.doc, eb, w = t.windows[id], we = w.element, sp = we.getXY(), p, sz, ph, cp, vp, sx, sy, sex, sey, dx, dy, dw, dh;\r
316 \r
317                         // Get positons and sizes\r
318 //                      cp = DOM.getPos(t.editor.getContainer());\r
319                         cp = {x : 0, y : 0};\r
320                         vp = DOM.getViewPort();\r
321 \r
322                         // Reduce viewport size to avoid scrollbars while dragging\r
323                         vp.w -= 2;\r
324                         vp.h -= 2;\r
325 \r
326                         sex = se.screenX;\r
327                         sey = se.screenY;\r
328                         dx = dy = dw = dh = 0;\r
329 \r
330                         // Handle mouse up\r
331                         mu = Event.add(d, 'mouseup', function(e) {\r
332                                 Event.remove(d, 'mouseup', mu);\r
333                                 Event.remove(d, 'mousemove', mm);\r
334 \r
335                                 if (eb)\r
336                                         eb.remove();\r
337 \r
338                                 we.moveBy(dx, dy);\r
339                                 we.resizeBy(dw, dh);\r
340                                 sz = we.getSize();\r
341                                 DOM.setStyles(id + '_ifr', {width : sz.w - w.deltaWidth, height : sz.h - w.deltaHeight});\r
342                                 t._fixIELayout(id, 1);\r
343 \r
344                                 return Event.cancel(e);\r
345                         });\r
346 \r
347                         if (ac != 'Move')\r
348                                 startMove();\r
349 \r
350                         function startMove() {\r
351                                 if (eb)\r
352                                         return;\r
353 \r
354                                 t._fixIELayout(id, 0);\r
355 \r
356                                 // Setup event blocker\r
357                                 DOM.add(d.body, 'div', {\r
358                                         id : 'mceEventBlocker',\r
359                                         'class' : 'mceEventBlocker ' + (t.editor.settings.inlinepopups_skin || 'clearlooks2'),\r
360                                         style : {zIndex : t.zIndex + 1}\r
361                                 });\r
362 \r
363                                 if (tinymce.isIE6 || (tinymce.isIE && !DOM.boxModel))\r
364                                         DOM.setStyles('mceEventBlocker', {position : 'absolute', left : vp.x, top : vp.y, width : vp.w - 2, height : vp.h - 2});\r
365 \r
366                                 eb = new Element('mceEventBlocker');\r
367                                 eb.update();\r
368 \r
369                                 // Setup placeholder\r
370                                 p = we.getXY();\r
371                                 sz = we.getSize();\r
372                                 sx = cp.x + p.x - vp.x;\r
373                                 sy = cp.y + p.y - vp.y;\r
374                                 DOM.add(eb.get(), 'div', {id : 'mcePlaceHolder', 'class' : 'mcePlaceHolder', style : {left : sx, top : sy, width : sz.w, height : sz.h}});\r
375                                 ph = new Element('mcePlaceHolder');\r
376                         };\r
377 \r
378                         // Handle mouse move/drag\r
379                         mm = Event.add(d, 'mousemove', function(e) {\r
380                                 var x, y, v;\r
381 \r
382                                 startMove();\r
383 \r
384                                 x = e.screenX - sex;\r
385                                 y = e.screenY - sey;\r
386 \r
387                                 switch (ac) {\r
388                                         case 'ResizeW':\r
389                                                 dx = x;\r
390                                                 dw = 0 - x;\r
391                                                 break;\r
392 \r
393                                         case 'ResizeE':\r
394                                                 dw = x;\r
395                                                 break;\r
396 \r
397                                         case 'ResizeN':\r
398                                         case 'ResizeNW':\r
399                                         case 'ResizeNE':\r
400                                                 if (ac == "ResizeNW") {\r
401                                                         dx = x;\r
402                                                         dw = 0 - x;\r
403                                                 } else if (ac == "ResizeNE")\r
404                                                         dw = x;\r
405 \r
406                                                 dy = y;\r
407                                                 dh = 0 - y;\r
408                                                 break;\r
409 \r
410                                         case 'ResizeS':\r
411                                         case 'ResizeSW':\r
412                                         case 'ResizeSE':\r
413                                                 if (ac == "ResizeSW") {\r
414                                                         dx = x;\r
415                                                         dw = 0 - x;\r
416                                                 } else if (ac == "ResizeSE")\r
417                                                         dw = x;\r
418 \r
419                                                 dh = y;\r
420                                                 break;\r
421 \r
422                                         case 'mceMove':\r
423                                                 dx = x;\r
424                                                 dy = y;\r
425                                                 break;\r
426                                 }\r
427 \r
428                                 // Boundary check\r
429                                 if (dw < (v = w.features.min_width - sz.w)) {\r
430                                         if (dx !== 0)\r
431                                                 dx += dw - v;\r
432 \r
433                                         dw = v;\r
434                                 }\r
435         \r
436                                 if (dh < (v = w.features.min_height - sz.h)) {\r
437                                         if (dy !== 0)\r
438                                                 dy += dh - v;\r
439 \r
440                                         dh = v;\r
441                                 }\r
442 \r
443                                 dw = Math.min(dw, w.features.max_width - sz.w);\r
444                                 dh = Math.min(dh, w.features.max_height - sz.h);\r
445                                 dx = Math.max(dx, vp.x - (sx + vp.x));\r
446                                 dy = Math.max(dy, vp.y - (sy + vp.y));\r
447                                 dx = Math.min(dx, (vp.w + vp.x) - (sx + sz.w + vp.x));\r
448                                 dy = Math.min(dy, (vp.h + vp.y) - (sy + sz.h + vp.y));\r
449 \r
450                                 // Move if needed\r
451                                 if (dx + dy !== 0) {\r
452                                         if (sx + dx < 0)\r
453                                                 dx = 0;\r
454         \r
455                                         if (sy + dy < 0)\r
456                                                 dy = 0;\r
457 \r
458                                         ph.moveTo(sx + dx, sy + dy);\r
459                                 }\r
460 \r
461                                 // Resize if needed\r
462                                 if (dw + dh !== 0)\r
463                                         ph.resizeTo(sz.w + dw, sz.h + dh);\r
464 \r
465                                 return Event.cancel(e);\r
466                         });\r
467 \r
468                         return Event.cancel(se);\r
469                 },\r
470 \r
471                 resizeBy : function(dw, dh, id) {\r
472                         var w = this.windows[id];\r
473 \r
474                         if (w) {\r
475                                 w.element.resizeBy(dw, dh);\r
476                                 w.iframeElement.resizeBy(dw, dh);\r
477                         }\r
478                 },\r
479 \r
480                 close : function(win, id) {\r
481                         var t = this, w, d = DOM.doc, ix = 0, fw, id;\r
482 \r
483                         id = t._findId(id || win);\r
484 \r
485                         // Probably not inline\r
486                         if (!t.windows[id]) {\r
487                                 t.parent(win);\r
488                                 return;\r
489                         }\r
490 \r
491                         t.count--;\r
492 \r
493                         if (t.count == 0)\r
494                                 DOM.remove('mceModalBlocker');\r
495 \r
496                         if (w = t.windows[id]) {\r
497                                 t.onClose.dispatch(t);\r
498                                 Event.remove(d, 'mousedown', w.mousedownFunc);\r
499                                 Event.remove(d, 'click', w.clickFunc);\r
500                                 Event.clear(id);\r
501                                 Event.clear(id + '_ifr');\r
502 \r
503                                 DOM.setAttrib(id + '_ifr', 'src', 'javascript:""'); // Prevent leak\r
504                                 w.element.remove();\r
505                                 delete t.windows[id];\r
506 \r
507                                 // Find front most window and focus that\r
508                                 each (t.windows, function(w) {\r
509                                         if (w.zIndex > ix) {\r
510                                                 fw = w;\r
511                                                 ix = w.zIndex;\r
512                                         }\r
513                                 });\r
514 \r
515                                 if (fw)\r
516                                         t.focus(fw.id);\r
517                         }\r
518                 },\r
519 \r
520                 setTitle : function(w, ti) {\r
521                         var e;\r
522 \r
523                         w = this._findId(w);\r
524 \r
525                         if (e = DOM.get(w + '_title'))\r
526                                 e.innerHTML = DOM.encode(ti);\r
527                 },\r
528 \r
529                 alert : function(txt, cb, s) {\r
530                         var t = this, w;\r
531 \r
532                         w = t.open({\r
533                                 title : t,\r
534                                 type : 'alert',\r
535                                 button_func : function(s) {\r
536                                         if (cb)\r
537                                                 cb.call(s || t, s);\r
538 \r
539                                         t.close(null, w.id);\r
540                                 },\r
541                                 content : DOM.encode(t.editor.getLang(txt, txt)),\r
542                                 inline : 1,\r
543                                 width : 400,\r
544                                 height : 130\r
545                         });\r
546                 },\r
547 \r
548                 confirm : function(txt, cb, s) {\r
549                         var t = this, w;\r
550 \r
551                         w = t.open({\r
552                                 title : t,\r
553                                 type : 'confirm',\r
554                                 button_func : function(s) {\r
555                                         if (cb)\r
556                                                 cb.call(s || t, s);\r
557 \r
558                                         t.close(null, w.id);\r
559                                 },\r
560                                 content : DOM.encode(t.editor.getLang(txt, txt)),\r
561                                 inline : 1,\r
562                                 width : 400,\r
563                                 height : 130\r
564                         });\r
565                 },\r
566 \r
567                 // Internal functions\r
568 \r
569                 _findId : function(w) {\r
570                         var t = this;\r
571 \r
572                         if (typeof(w) == 'string')\r
573                                 return w;\r
574 \r
575                         each(t.windows, function(wo) {\r
576                                 var ifr = DOM.get(wo.id + '_ifr');\r
577 \r
578                                 if (ifr && w == ifr.contentWindow) {\r
579                                         w = wo.id;\r
580                                         return false;\r
581                                 }\r
582                         });\r
583 \r
584                         return w;\r
585                 },\r
586 \r
587                 _fixIELayout : function(id, s) {\r
588                         var w, img;\r
589 \r
590                         if (!tinymce.isIE6)\r
591                                 return;\r
592 \r
593                         // Fixes the bug where hover flickers and does odd things in IE6\r
594                         each(['n','s','w','e','nw','ne','sw','se'], function(v) {\r
595                                 var e = DOM.get(id + '_resize_' + v);\r
596 \r
597                                 DOM.setStyles(e, {\r
598                                         width : s ? e.clientWidth : '',\r
599                                         height : s ? e.clientHeight : '',\r
600                                         cursor : DOM.getStyle(e, 'cursor', 1)\r
601                                 });\r
602 \r
603                                 DOM.setStyle(id + "_bottom", 'bottom', '-1px');\r
604 \r
605                                 e = 0;\r
606                         });\r
607 \r
608                         // Fixes graphics glitch\r
609                         if (w = this.windows[id]) {\r
610                                 // Fixes rendering bug after resize\r
611                                 w.element.hide();\r
612                                 w.element.show();\r
613 \r
614                                 // Forced a repaint of the window\r
615                                 //DOM.get(id).style.filter = '';\r
616 \r
617                                 // IE has a bug where images used in CSS won't get loaded\r
618                                 // sometimes when the cache in the browser is disabled\r
619                                 // This fix tries to solve it by loading the images using the image object\r
620                                 each(DOM.select('div,a', id), function(e, i) {\r
621                                         if (e.currentStyle.backgroundImage != 'none') {\r
622                                                 img = new Image();\r
623                                                 img.src = e.currentStyle.backgroundImage.replace(/url\(\"(.+)\"\)/, '$1');\r
624                                         }\r
625                                 });\r
626 \r
627                                 DOM.get(id).style.filter = '';\r
628                         }\r
629                 }\r
630         });\r
631 \r
632         // Register plugin\r
633         tinymce.PluginManager.add('inlinepopups', tinymce.plugins.InlinePopups);\r
634 })();\r
635 \r