1// Name: HTMLEditor.Popups.Popup.debug.js 2// Assembly: AjaxControlToolkit 3// Version: 3.5.7.1213 4// FileVersion: 3.5.7.1213 5Type.registerNamespace("Sys.Extended.UI.HTMLEditor.Popups"); 6 7Sys.Extended.UI.HTMLEditor.Popups.Popup = function(element) { 8 Sys.Extended.UI.HTMLEditor.Popups.Popup.initializeBase(this, [element]); 9 10 this._iframe = null; 11 this._top = 0; 12 this._left = 0; 13 this._doc = null; 14 this._initialContent = ""; 15 this._cssPath = ""; 16 this._autoDimensions = true; 17 this._registeredFields = []; 18 this._registeredHandlers = []; 19 this._app_onload$delegate = Function.createDelegate(this, this._app_onload); 20 this.isOpened = false; 21 this.isLoaded = false; 22 this.isLoading = false; 23} 24 25Sys.Extended.UI.HTMLEditor.Popups.Popup.prototype = { 26 27 getDocument: function() { 28 return this._doc; 29 }, 30 31 getPopupMediator: function() { 32 if (this._iframe.contentWindow && this._iframe.contentWindow.popupMediator) { 33 return this._iframe.contentWindow.popupMediator; 34 } else { 35 return null; 36 } 37 }, 38 39 get_registeredFields: function() { 40 return this._registeredFields; 41 }, 42 set_registeredFields: function(value) { 43 this._registeredFields = eval(value); 44 }, 45 46 get_registeredHandlers: function() { 47 return this._registeredHandlers; 48 }, 49 set_registeredHandlers: function(value) { 50 this._registeredHandlers = eval(value); 51 }, 52 53 get_initialContent: function() { 54 return this._initialContent; 55 }, 56 set_initialContent: function(value) { 57 this._initialContent = value; 58 }, 59 60 get_cssPath: function() { 61 return this._cssPath; 62 }, 63 set_cssPath: function(value) { 64 this._cssPath = value; 65 }, 66 67 get_autoDimensions: function() { 68 return this._autoDimensions; 69 }, 70 set_autoDimensions: function(value) { 71 this._autoDimensions = value; 72 }, 73 74 get_iframe: function() { 75 return this._iframe; 76 }, 77 set_iframe: function(value) { 78 this._iframe = value; 79 }, 80 81 checkCorrectLoaded: function(func) { 82 var popup = this; 83 if (popup.isLoaded && (popup._iframe.style.height == "0px" || popup._iframe.style.width == "0px")) { 84 this.isLoaded = false; 85 } 86 if (!this.isLoaded) { 87 if (!this.isLoading) { 88 this.reload(); 89 } 90 if (typeof func != "undefined") { 91 setTimeout(func, 10); 92 } 93 return false; 94 } 95 return true; 96 }, 97 98 _baseOpen: function(callback, top, left) { 99 var popup = this; 100 101 if(!this.checkCorrectLoaded(function() { popup._baseOpen(callback, top, left); })) { 102 return; 103 } 104 105 var element = this.get_element(); 106 if (typeof left != "undefined") this._left = parseInt(left); 107 if (typeof top != "undefined") this._top = parseInt(top); 108 109 element.style.top = this._top + "px"; 110 element.style.left = this._left + "px"; 111 112 setTimeout(function() { 113 if (typeof callback == "function") { 114 popup._onDocumentLoaded(callback); 115 } 116 popup.isOpened = true; 117 }, 0); 118 }, 119 120 open: function(callback, top, left) { 121 this._baseOpen(callback, top, left); 122 }, 123 124 close: function(callback) { 125 var element = this.get_element(); 126 this.isOpened = false; 127 128 element.style.top = "-2000px"; 129 element.style.left = "-2000px"; 130 131 if (typeof callback == "function") { 132 callback(); 133 } 134 }, 135 136 reload: function() { 137 this.isLoading = true; 138 var element = this.get_element(); 139 var _parentNode_ = element.parentNode; 140 document.body.appendChild(element); 141 _parentNode_.appendChild(this.get_element()); 142 this._doc = this._iframe.contentWindow.document; 143 this._doc.open(); 144 var html = new Sys.StringBuilder(); 145 146 html.append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\"><html><head>"); 147 if (this._cssPath.length > 0) { 148 html.append("<link rel=\"stylesheet\" href=\"" + this._cssPath + "\" media=\"all\" />"); 149 } 150 html.append("<script>var __loaded__ = false;</script></head><body style='margin:0px; padding:0px; border-width:0px;' onload='__loaded__ = true;'>"); 151 if (this._autoDimensions) { 152 html.append("<table cellspacing='0' cellpadding='0' border='0'><tr><td>"); 153 } 154 html.append(this._initialContent); 155 if (this._autoDimensions) { 156 html.append("</td></tr></table>"); 157 } 158 html.append("</body></html>"); 159 160 this._doc.write(html.toString()); 161 this._doc.close(); 162 163 this.isLoaded = false; 164 this._afterReload(); 165 }, 166 167 _afterReload: function() { 168 var contentWindow = this._iframe.contentWindow; 169 var popup = this; 170 this.isLoaded = contentWindow.__loaded__; 171 172 if (!(popup._doc.body && popup._doc.body.innerHTML)) { 173 this.isLoaded = false; 174 } 175 176 if (!this.isLoaded) { 177 setTimeout(function() { popup._afterReload() }, 10); // waiting for loading 178 return; 179 } 180 181 this.isLoaded = false; 182 contentWindow.popupMediator = {}; 183 contentWindow.popupMediator.registeredFields = this._registeredFields; 184 contentWindow.popupMediator.registeredHandlers = this._registeredHandlers; 185 186 contentWindow.popupMediator.get_callMethodByName = function(name) { 187 var handlers = contentWindow.popupMediator.registeredHandlers; 188 for (var i = 0; i < handlers.length; i++) { 189 var handler = handlers[i]; 190 if (handler.name == name) { 191 return handler.callMethod; 192 } 193 } 194 return null; 195 }; 196 197 contentWindow.popupMediator.set_callMethodByName = function(name, value) { 198 var handlers = contentWindow.popupMediator.registeredHandlers; 199 for (var i = 0; i < handlers.length; i++) { 200 var handler = handlers[i]; 201 if (handler.name == name) { 202 handler.callMethod = value; 203 } 204 } 205 }; 206 207 contentWindow.popupMediator.getField = function(name) { 208 var registeredFields = contentWindow.popupMediator.registeredFields; 209 for (var i = 0; i < registeredFields.length; i++) { 210 var registeredField = registeredFields[i]; 211 if (registeredField.name == name) { 212 return contentWindow.document.getElementById(registeredField.clientID); 213 } 214 } 215 return null; 216 }; 217 218 contentWindow.Sys = Sys; 219 220 for (var i = 0; i < this._registeredHandlers.length; i++) { 221 $find(this._registeredHandlers[i].clientID).activate(contentWindow.document.getElementById(this._registeredHandlers[i].clientID)); 222 } 223 224 225 if (Sys.Extended.UI.HTMLEditor.isIE) { 226 popup._doc.onselectstart = function() { 227 var event = popup._iframe.contentWindow.event; 228 var tagName = event.srcElement.tagName.toUpperCase(); 229 if (tagName == "INPUT" || tagName == "TEXTAREA") return true; 230 return false; 231 }; 232 } else { 233 popup._doc.onmousedown = function disableselect(e) { 234 var tagName = e.target.tagName.toUpperCase(); 235 if (tagName == "INPUT" || tagName == "TEXTAREA" || tagName == "SELECT") return true; 236 if (Sys.Extended.UI.HTMLEditor.isSafari) 237 if (tagName == "TABLE" || tagName == "TR" || tagName == "TD" || tagName == "DIV") return true; 238 return false; 239 }; 240 241 var aInp = popup._doc.getElementsByTagName('input'); 242 for (var i = 0; i < aInp.length; i++) { 243 aInp[i].setAttribute('autocomplete', 'off') 244 } 245 } 246 247 if (this._autoDimensions) { 248 popup._iframe.style.height = "1000px"; 249 popup._iframe.style.width = "1000px"; 250 setTimeout(function() { 251 popup._iframe.style.height = popup._doc.body.firstChild.offsetHeight + "px"; 252 popup._iframe.style.width = popup._doc.body.firstChild.offsetWidth + "px"; 253 popup.isLoaded = true; 254 popup.isLoading = false; 255 }, 0); 256 } else { 257 popup.isLoaded = true; 258 popup.isLoading = false; 259 } 260 }, 261 262 _onDocumentLoaded: function(callback) { 263 var popup = this; 264 if (!this.isLoaded) { 265 setTimeout(function() { popup._onDocumentLoaded(callback) }, 10); // waiting for loading 266 return; 267 } 268 this.isLoaded = true; 269 callback(this._iframe.contentWindow); 270 }, 271 272 initialize: function() { 273 this.__appLoaded__ = false; 274 Sys.Extended.UI.HTMLEditor.Popups.Popup.callBaseMethod(this, "initialize"); 275 Sys.Application.add_load(this._app_onload$delegate); 276 }, 277 278 dispose: function() { 279 Sys.Application.remove_load(this._app_onload$delegate); 280 if (this.isOpened) { 281 this.close(); 282 } 283 Sys.Extended.UI.HTMLEditor.Popups.Popup.callBaseMethod(this, "dispose"); 284 }, 285 286 _app_onload: function(sender, e) { 287 if (this.__appLoaded__) return; 288 this.__appLoaded__ = true;
289 var element = this.get_element(); 290 if (Sys.Extended.UI.HTMLEditor.isReallyVisible(element)) { 291 this._parentNode_ = element.parentNode; 292 this.reload(); 293 } 294 } 295} 296 297Sys.Extended.UI.HTMLEditor.Popups.Popup.registerClass("Sys.Extended.UI.HTMLEditor.Popups.Popup", Sys.UI.Control);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.