PageSourceSearch

https://cdpr.com.br/ScriptResource.axd?d=3RRsdkc0kJUq9zfHRpl5SB3jg…T5PJJUT-tDRe6-YBtUBiNkc1&t=ffffffffda74082d

js cdpr.com.br collected 2026-10-10 02:13:55 UTC 51,838 bytes, 1,123 lines download raw bytes

1// Name:        HtmlEditorExtender.HtmlEditorExtenderBehavior.debug.js
2// Assembly:    AjaxControlToolkit
3// Version:     4.5.7.1213
4// FileVersion: 4.5.7.1213
5// (c) 2010 CodePlex Foundation
6/// <reference name='MicrosoftAjax.js' />
7/// <reference path='../ExtenderBase/BaseScripts.js' />
8/// <reference path='../Common/Common.js' />
9/// <reference path="~/Common/Common.pre.js" />
10
11(function () {
12
13    var scriptName = 'HtmlEditorExtenderBehavior';
14
15    function execute() {
16        Type.registerNamespace('Sys.Extended.UI');
17
18        Sys.Extended.UI.HtmlEditorExtenderBehavior = function (element) {
19            /// <summary>
20            /// Html Extender behavior which Extends TextBox
21            /// </summmary>
22            /// <param name='element' type='Sys.UI.DomElement'>The element to attach to</param>
23            Sys.Extended.UI.HtmlEditorExtenderBehavior.initializeBase(this, [element]);
24            this._textbox = Sys.Extended.UI.TextBoxWrapper.get_Wrapper(element);
25
26            var id = this.get_id();
27
28            this._backColor = null;
29            this._foreColor = null;
30            this._commandName = null;
31            this._savedRange = null;
32            this._isInFocus = null;
33            this._oldContents = null;
34            this._newContents = null;
35            this._isDirty = false;
36            this._viewMode = 'content';
37            this._displaySourceTab = false;
38
39            this._ButtonWidth = 23;
40            this._ButtonHeight = 21;
41
42            this._containerTemplate = {
43                nodeName: 'div',
44                properties: {
45                    id: id + '_ExtenderContainer'
46                },
47                cssClasses: ['unselectable', 'ajax__html_editor_extender_container']
48            };
49
50            this._editableTemplate = {
51                nodeName: 'div',
52                properties: {
53                    id: id + '_ExtenderContentEditable',
54                    style: {
55                        overflow: 'auto',
56                        clear: 'both'
57                    },
58                    contentEditable: true
59                },
60                cssClasses: ['ajax__html_editor_extender_texteditor']
61            };
62
63            this._sourceViewTemplate = {
64                nodeName: 'div',
65                properties: {
66                    id: id + '_ExtenderSourceView',
67                    style: {
68                        height: '90%',
69                        overflow: 'auto',
70                        clear: 'both'
71                    },
72                    contentEditable: true
73                },
74                cssClasses: ['ajax__html_editor_extender_texteditor']
75            };
76
77            this._buttonTemplate = {
78                nodeName: 'input',
79                properties: {
80                    type: 'button',
81                    style: {
82                        width: this._ButtonWidth + 'px',
83                        height: this._ButtonHeight + 'px'
84                    }
85                },
86                cssClasses: ['ajax__html_editor_extender_button']
87            };
88
89            this._buttonContentTemplate = {
90                nodeName: 'input',
91                properties: {
92                    type: 'button',
93                    style: {
94                        width: this._ButtonWidth + 'px',
95                        height: this._ButtonHeight + 'px'
96                    }
97                },
98                cssClasses: ['ajax__html_editor_extender_button ajax__html_editor_extender_content']
99            };
100
101            this._buttonSourceTemplate = {
102                nodeName: 'input',
103                properties: {
104                    type: 'button',
105                    style: {
106                        width: this._ButtonWidth + 'px',
107                        height: this._ButtonHeight + 'px'
108                    }
109                },
110                cssClasses: ['ajax__html_editor_extender_button ajax__html_editor_extender_source']
111            };
112
113            this._textboxTemplate = {
114                nodeName: 'input',
115                properties: {
116                    type: 'text'
117                }
118            };
119
120            this._dropDownTemplate = {
121                nodeName: 'select',
122                properties: {
123                    style: {
124                        width: this._ButtonWidth + 'px',
125                        height: this._ButtonHeight + 'px'
126                    }
127                },
128                cssClasses: ['ajax__html_editor_extender_button']
129            };
130
131            this._topButtonContainerTemplate = {
132                nodeName: 'div',
133                properties: {
134                    id: id + '_ExtenderButtonContainer'
135                },
136                cssClasses: ['ajax__html_editor_extender_buttoncontainer']
137            };
138
139            this._topButtonContainerTemplate2 = {
140                nodeName: 'div',
141                properties: {
142                    id: id + '_ExtenderButtonContainer2',
143                    style: {
144                        clear: 'both'
145                    }
146                },
147                cssClasses: ['ajax__html_editor_extender_buttoncontainer2']
148            };
149
150            this._container = null;
151            this._toolbarButtons = null;
152            this._editableDiv = null;
153            this._sourceViewDiv = null;
154            this._topButtonContainer = null;
155            this._topButtonContainer2 = null;
156            this._buttons = [];
157            this._btnClickHandler = null;
158            this._requested_buttons = new Array();
159            this._colorPicker = null;
160            this._txtBoxForColor = null;
161            this._contentViewButton = null;
162            this._sourceViewButton = null;
163            this._popupDiv = null;
164            this._btnDone = null;
165            this._btnCancel = null;
166            this._isFocusInEditableDiv = false;
167            this._textBoxOnBlurDelegate = null;
168            this._editableDivOnBlurDelegate = null;
169            this._editableDivOnFocusDelegate = null;
170            this._btnClickDelegate = null;
171            this._contentViewClickDelegate = null;
172            this._sourceViewClickDelegate = null;
173            this._sourceViewDivOnBlurDelegate = null;
174            this._imageCancelClickDelegate = null;
175
176            if ((typeof (WebForm_OnSubmit) == 'function') && !Sys.Extended.UI.HtmlEditorExtenderBehavior._originalWebForm_OnSubmit) {
177                Sys.Extended.UI.HtmlEditorExtenderBehavior._originalWebForm_OnSubmit = WebForm_OnSubmit;
178                WebForm_OnSubmit = Sys.Extended.UI.HtmlEditorExtenderBehavior.WebForm_OnSubmit;
179            }
180        };
181        Sys.Extended.UI.HtmlEditorExtenderBehavior.prototype = {
182            initialize: function () {
183                Sys.Extended.UI.HtmlEditorExtenderBehavior.callBaseMethod(this, 'initialize');
184                HtmlEditorExtender_editableDivs[HtmlEditorExtender_editableDivs.length] = this;
185
186                this._button_list = new Array();
187                this._createContainer();
188                this._createTopButtonContainer();
189                this._createButton();
190                this._createEditableDiv();
191                if (this.get_displaySourceTab()) {
192                    this._createSourceViewDiv();
193                    this._createTopButtonContainer2();
194                }
195
196                var formElement = this._textbox._element.parentNode;
197                while (formElement != null && formElement.nodeName != 'FORM') {
198                    formElement = formElement.parentNode;
199                }
200
201                if (formElement == null)
202                    throw 'Missing Form tag';
203                var id = this.get_id();
204                this._popupDiv = $get(id + '_popupDiv');
205                if (this._popupDiv == null) {
206                    if (id.indexOf('_') != -1) {
207                        id = id.substring(id.lastIndexOf('_') + 1);
208                    }
209                    else {
210                        id = '';
211                    }
212                    this._popupDiv = $get(id + '_popupDiv');
213                }
214
215                if (this._popupDiv != null) {
216                    this._popupBehavior = $create(Sys.Extended.UI.PopupBehavior, { 'id': id + '_ImagePopupBehavior', 'parentElement': this.get_element(), 'unselectable': 'on' }, null, null, this._popupDiv);
217                    this._btnCancel = $get(id + '_btnCancel');
218                    this._imageCancelClickDelegate = Function.createDelegate(this, this._btnCancel_click);
219                    $addHandler(this._btnCancel, 'click', this._imageCancelClickDelegate, true);
220                    this._elementVisible(this._popupDiv, false);
221                }
222
223                this._textBoxOnBlurDelegate = Function.createDelegate(this, this._textBox_onblur);
224                this._editableDivOnBlurDelegate = Function.createDelegate(this, this._editableDiv_onblur);
225                this._editableDivOnFocusDelegate = Function.createDelegate(this, this._editableDiv_onfocus);
226                this._btnClickDelegate = Function.createDelegate(this, this._executeCommand);
227
228                if (this.get_displaySourceTab()) {
229                    this._contentViewClickDelegate = Function.createDelegate(this, this._contentView_click);
230                    this._sourceViewClickDelegate = Function.createDelegate(this, this._sourceView_click);
231                    this._sourceViewDivOnBlurDelegate = Function.createDelegate(this, this._sourceViewDiv_onblur);
232                }
233
234                $addHandler(this._textbox._element, 'blur', this._textBoxOnBlurDelegate, true);
235                $addHandler(this._editableDiv, 'blur', this._editableDivOnBlurDelegate, true);
236                $addHandler(this._editableDiv, 'focus', this._editableDivOnFocusDelegate, true);
237                $addHandler(this._topButtonContainer, 'click', this._btnClickDelegate, true);
238
239                if (this.get_displaySourceTab()) {
240                    $addHandler(this._contentViewButton, 'click', this._contentViewClickDelegate, true);
241                    $addHandler(this._sourceViewButton, 'click', this._sourceViewClickDelegate, true);
242                    $addHandler(this._sourceViewDiv, 'blur', this._sourceViewDivOnBlurDelegate, true);
243                }
244            },
245
246            _dispose: function () {
247                $removeHandler(this._textbox._element, 'blur', this._textBoxOnBlurDelegate);
248                $removeHandler(this._editableDiv, 'blur', this._editableDivOnBlurDelegate);
249                $removeHandler(this._editableDiv, 'focus', this._editableDivOnFocusDelegate);
250                $removeHandler(this._topButtonContainer, 'click', this._btnClickDelegate);
251                if (this.get_displaySourceTab()) {
252                    $removeHandler(this._contentViewButton, 'click', this._contentViewClickDelegate);
253                    $removeHandler(this._sourceViewButton, 'click', this._sourceViewClickDelegate);
254                    $removeHandler(this._sourceViewDiv, 'blur', this._sourceViewDivOnBlurDelegate);
255                }
256
257                if (this._popupDiv != null) {
258                    $removeHandler(this._btnCancel, 'click', this._imageCancelClickDelegate);
259                }
260
261                Sys.Extended.UI.HtmlEditorExtenderBehavior.callBaseMethod(this, 'dispose');
262            },
263
264            _createContainer: function () {
265                var e = this.get_element();
266                this._container = $common.createElementFromTemplate(this._containerTemplate, e.parentNode);
267
268                this._elementVisible(this._textbox._element, true);
269
270                var bounds = $common.getBounds(this._textbox._element);
271                $common.setSize(this._container, {
272                    width: bounds.width,
273                    height: bounds.height
274                });
275
276                this._elementVisible(this._textbox._element, false);
277
278                $common.wrapElement(this._textbox._element, this._container, this._container);
279            },
280
281            _createTopButtonContainer: function () {
282                this._topButtonContainer = $common.createElementFromTemplate(this._topButtonContainerTemplate, this._container);
283            },
284
285            _createButton: function () {
286                var isIE = Sys.Browser.agent == Sys.Browser.InternetExplorer;
287                for (i = 0; i < this._toolbarButtons.length; i++) {
288                    var _btn;
289                    if (this._toolbarButtons[i].CommandName == 'HorizontalSeparator') {
290                        _btn = $common.createElementFromTemplate({
291                            nodeName: "span",
292                            cssClasses: ['ajax__html_editor_extender_separator']
293                        }, this._topButtonContainer);
294                    }
295                    else if (this._toolbarButtons[i].CommandName == 'FontName') {
296                        _btn = $common.createElementFromTemplate({
297                            nodeName: "nobr",
298                            properties: {
299                                style: {
300                                    float: 'left',
301                                    cssFloat: 'left',
302                                    fontSize: '11px'
303                                }
304                            },
305                            cssClasses: ['fontnameclass'],
306                            children: [{
307                                nodeName: "span",
308                                properties: {
309                                    textContent: "Font ",
310                                    innerText: "Font ",
311                                    style: {
312                                        paddingLeft: '5px',
313                                        fontWeight: 'bold'
314                                    }
315                                }
316                            }]
317                        }, this._topButtonContainer);
318
319                        _select = $common.createElementFromTemplate({
320                            nodeName: "select",
321                            properties: {
322                                style: {
323                                    fontSize: '9px',
324                                    fontFamily: 'Arial',
325                                    height: "20px",
326                                    width: '90px'
327                                }
328                            },
329                            events: {
330                                change: function (e) {
331                                    var value = this.options[this.selectedIndex].value;
332                                    setTimeout(function () {
333                                        document.execCommand("fontname", false, value);
334                                    }, 200);
335                                }
336                            }
337                        }, _btn);
338
339                        var option = [
340                            { Text: "Arial", Value: "arial,helvetica,sans-serif" },
341                            { Text: "Courier New", Value: "courier new,courier,monospace" },
342                            { Text: "Georgia", Value: "georgia,times new roman,times,serif" },
343                            { Text: "Tahoma", Value: "tahoma,arial,helvetica,sans-serif" },
344                            { Text: "Times New Roman", Value: "times new roman,times,serif" },
345                            { Text: "Verdana", Value: "verdana,arial,helvetica,sans-serif" },
346                            { Text: "Impact", Value: "impact" },
347                            { Text: "WingDings", Value: "wingdings" }
348                            ];
349
350                        for (x in option) {
351                            var elOptNew = document.createElement('option');
352                            elOptNew.text = option[x].Text;
353                            elOptNew.value = option[x].Value;
354                            try {
355                                _select.add(elOptNew, null); // standards compliant; doesn't work in IE
356                            }
357                            catch (ex) {
358                                _select.add(elOptNew); // IE only
359                            }
360                        }
361
362                        _select.setAttribute('id', this._id + this._toolbarButtons[i].CommandName);
363                        _select.setAttribute('name', this._toolbarButtons[i].CommandName);
364                        _select.setAttribute('title', this._toolbarButtons[i].Tooltip);
365                        _select.setAttribute('unselectable', 'on');
366                    }
367                    else if (this._toolbarButtons[i].CommandName == 'FontSize') {
368                        _btn = $common.createElementFromTemplate({
369                            nodeName: "nobr",
370                            properties: {
371                                style: {
372                                    float: 'left',
373                                    cssFloat: 'left',
374                                    fontSize: '11px'
375                                }
376                            },
377                            cssClasses: ['fontsizeclass'],
378                            children: [{
379                                nodeName: "span",
380                                properties: {
381                                    textContent: "Size ",
382                                    innerText: "Size ",
383                                    style: {
384                                        paddingLeft: '5px',
385                                        fontWeight: 'bold'
386                                    }
387                                }
388                            }]
389                        }, this._topButtonContainer);
390
391                        _select = $common.createElementFromTemplate({
392                            nodeName: "select",
393                            properties: {
394                                style: {
395                                    fontSize: '11px',
396                                    fontFamily: 'Arial',
397                                    height: "20px",
398                                    width: isIE ? '30px' : '50px'
399                                }
400                            },
401                            events: {
402                                change: function (e) {
403                                    var value = this.options[this.selectedIndex].value;
404                                    setTimeout(function () {
405                                        document.execCommand("fontsize", false, value);
406                                    }, 200);
407                                }
408                            }
409                        }, _btn);
410
411                        var option = [
412                            { Text: "1", Value: "1" },
413                            { Text: "2", Value: "2" },
414                            { Text: "3", Value: "3" },
415                            { Text: "4", Value: "4" },
416                            { Text: "5", Value: "5" },
417                            { Text: "6", Value: "6" },
418                            { Text: "7", Value: "7" }
419                            ];
420
421                        for (x in option) {
422                            var elOptNew = document.createElement('option');
423                            elOptNew.text = option[x].Text;
424                            elOptNew.value = option[x].Value;
425                            try {
426                                _select.add(elOptNew, null); // standards compliant; doesn't work in IE
427                            }
428                            catch (ex) {
429                                _select.add(elOptNew); // IE only
430                            }
431                        }
432
433                        _select.setAttribute('id', this._id + this._toolbarButtons[i].CommandName);
434                        _select.setAttribute('name', this._toolbarButtons[i].CommandName);
435                        _select.setAttribute('title', this._toolbarButtons[i].Tooltip);
436                        _select.setAttribute('unselectable', 'on');
437                    }
438                    else if (this._toolbarButtons[i].CommandName == 'ForeColor') {
439
440                        _btn = $common.createElementFromTemplate({
441                            nodeName: "span",
442                            properties: {
443                                style: {
444                                    backgroundColor: '#ff0000',
445                                    border: 'solid 1px #c2c2c2',
446                                    display: 'block',
447                                    float: 'left',
448                                    cssFloat: 'left'
449                                }
450                            },
451                            cssClasses: ['forecolorclass']
452                        }, this._topButtonContainer);
453                        _btn.setAttribute('unselectable', 'on');
454
455                        this._foreColor = $common.createElementFromTemplate({
456                            nodeName: 'input',
457                            properties: {
458                                type: 'button',
459                                id: this._id + this._toolbarButtons[i].CommandName,
460                                name: this._toolbarButtons[i].CommandName,
461                                title: this._toolbarButtons[i].Tooltip,
462                                style: {
463                                    backgroundColor: 'transparent',
464                                    width: '21px',
465                                    height: '19px',
466                                    color: 'transparent'
467                                }
468                            },
469                            cssClasses: ['ajax__html_editor_extender_button ajax__html_editor_extender_' + this._toolbarButtons[i].CommandName]
470                        }, _btn);
471                        this._foreColor.setAttribute('unselectable', 'on');
472
473                        /*
474                        this._foreColor = $common.createElementFromTemplate(this._buttonTemplate, _btn);
475                        this._foreColor.setAttribute('id', this._id + this._toolbarButtons[i].CommandName);
476                        this._foreColor.setAttribute('name', this._toolbarButtons[i].CommandName);
477                        this._foreColor.setAttribute('title', this._toolbarButtons[i].Tooltip);
478                        this._foreColor.setAttribute('style', "background-color:transparent;width:21px;height:19px");
479                        this._foreColor.setAttribute('unselectable', 'on');
480                        --------------------------------------------------
481                        >>>>>>>> THIS CODE IS CAUSE AN ISSUES ON IE7
482                        --------------------------------------------------
483                        this._foreColor.setAttribute('class', 'ajax__html_editor_extender_button ajax__html_editor_extender_' + this._toolbarButtons[i].CommandName);
484                        */
485                    }
486                    else if (this._toolbarButtons[i].CommandName == 'BackColor') {
487
488                        _btn = $common.createElementFromTemplate({
489                            nodeName: "span",
490                            properties: {
491                                style: {
492                                    backgroundColor: '#ff0000',
493                                    border: 'solid 1px #c2c2c2',
494                                    display: 'block',
495                                    float: 'left',
496                                    cssFloat: 'left'
497                                }
498                            },
499                            cssClasses: ['backcolorclass']
500                        }, this._topButtonContainer);
501                        _btn.setAttribute('unselectable', 'on');
502
503                        this._backColor = $common.createElementFromTemplate({
504                            nodeName: 'input',
505                            properties: {
506                                type: 'button',
507                                id: this._id + this._toolbarButtons[i].CommandName,
508                                name: this._toolbarButtons[i].CommandName,
509                                title: this._toolbarButtons[i].Tooltip,
510                                style: {
511                                    backgroundColor: 'transparent',
512                                    width: '21px',
513                                    height: '19px',
514                                    color: 'transparent'
515                                }
516                            },
517                            cssClasses: ['ajax__html_editor_extender_button ajax__html_editor_extender_' + this._toolbarButtons[i].CommandName]
518                        }, _btn);
519                        this._backColor.setAttribute('unselectable', 'on');
520
521                    }
522                    else {
523                        var map = {
524                            Copy: 1,
525                            Cut: 1,
526                            Paste: 1
527                        };
528                        if (Sys.Browser.agent != Sys.Browser.InternetExplorer && map[this._toolbarButtons[i].CommandName]) {
529                        }
530                        else {
531                            _btn = $common.createElementFromTemplate({
532                                nodeName: 'input',
533                                properties: {
534                                    type: 'button',
535                                    id: this._id + this._toolbarButtons[i].CommandName,
536                                    name: this._toolbarButtons[i].CommandName,
537                                    title: this._toolbarButtons[i].Tooltip,
538                                    style: {
539                                        width: '23px',
540                                        height: '21px'
541                                    }
542                                },
543                                cssClasses: ['ajax__html_editor_extender_button ajax__html_editor_extender_' + this._toolbarButtons[i].CommandName]
544                            }, this._topButtonContainer);
545                            _btn.setAttribute('unselectable', 'on');
546                        }
547                        Array.add(this._buttons, _btn);
548                    }
549                }
550            },
551
552            _createEditableDiv: function () {
553                var id = this.get_id();
554                var height;
555                this._elementVisible(this._container, true);
556                if (this.get_displaySourceTab()) {
557                    height = this._container.clientHeight - (this._topButtonContainer.clientHeight + 25);
558                }
559                else {
560                    height = this._container.clientHeight - this._topButtonContainer.clientHeight;
561                }
562                this._elementVisible(this._container, false);
563
564                this._editableDiv = $common.createElementFromTemplate({
565                    nodeName: 'div',
566                    properties: {
567                        id: id + '_ExtenderContentEditable',
568                        style: {
569                            height: height + 'px',
570                            overflow: 'auto',
571                            clear: 'both'
572                        },
573                        contentEditable: true
574                    },
575                    cssClasses: ['ajax__html_editor_extender_texteditor']
576                }, this._container);
577                                
578                this._textbox._element.value = this._textbox._element.value.replace('&#x26;amp&#x3B;', '&#x26;');                
579                this._editableDiv.innerHTML = this._textbox._element.value;
580                this._oldContents = this._editableDiv.innerHTML;
581                $common.setVisible(this._textbox._element, false);
582            },
583
584            _createTopButtonContainer2: function () {
585                this._topButtonContainer2 = $common.createElementFromTemplate(this._topButtonContainerTemplate2, this._container);
586                this._contentViewButton = $common.createElementFromTemplate(this._buttonContentTemplate, this._topButtonContainer2);
587                this._sourceViewButton = $common.createElementFromTemplate(this._buttonSourceTemplate, this._topButtonContainer2);
588            },
589
590            _createSourceViewDiv: function () {
591                var id = this.get_id();
592                var height = this._container.clientHeight - 25;
593                this._sourceViewDiv = $common.createElementFromTemplate({
594                    nodeName: 'div',
595                    properties: {
596                        id: id + '_ExtenderSourceView',
597                        style: {
598                            height: height + 'px',
599                            overflow: 'auto',
600                            clear: 'both'
601                        },
602                        contentEditable: true
603                    },
604                    cssClasses: ['ajax__html_editor_extender_texteditor']
605                }, this._container);
606                $common.setVisible(this._sourceViewDiv, false);
607            },
608
609            _editableDiv_onblur: function () {
610                this._textbox._element.value = this._encodeHtml();
611                this._isFocusInEditableDiv = false;
612                if (this._oldContents != this._editableDiv.innerHTML) {
613                    this._isDirty = true;
614                    this._oldContents = this._editableDiv.innerHTML;
615                    this._raiseEvent('change');
616                }
617            },
618
619            _editableDiv_onfocus: function () {
620                this._isFocusInEditableDiv = false;
621            },
622
623            _sourceViewDiv_onblur: function () {
624                if (this._oldContents != (this._sourceViewDiv.innerText || this._sourceViewDiv.textContent)) {
625                    this._isDirty = true;
626                    if (this._sourceViewDiv.textContent != undefined) {
627                        this._editableDiv.innerHTML = this._sourceViewDiv.textContent;
628                    }
629                    else {
630                        this._editableDiv.innerHTML = this._sourceViewDiv.innerText;
631                    }
632                    this._oldContents = this._editableDiv.innerHTML;
633                    this._raiseEvent('change');
634                }
635            },
636
637            _textBox_onblur: function () {
638                this._editableDiv.innerHTML = this._textbox._element.value;
639            },
640
641            _contentView_click: function () {
642                if (this._viewMode != 'content') {
643                    $common.setVisible(this._topButtonContainer, true);
644                    $common.setVisible(this._editableDiv, true);
645                    if (this._sourceViewDiv.textContent != undefined) {
646                        this._editableDiv.innerHTML = this._sourceViewDiv.textContent;
647                    }
648                    else {
649                        this._editableDiv.innerHTML = this._sourceViewDiv.innerText;
650                    }
651                    this._oldContents = this._editableDiv.innerHTML;
652                    $common.setVisible(this._sourceViewDiv, false);
653                    this._viewMode = 'content';
654                }
655            },
656
657            _sourceView_click: function () {
658                if (this._viewMode != 'source') {
659                    $common.setVisible(this._sourceViewDiv, true);
660                    if (this._sourceViewDiv.textContent != undefined) {
661                        this._sourceViewDiv.textContent = this._editableDiv.innerHTML;
662                    }
663                    else {
664                        this._sourceViewDiv.innerText = this._editableDiv.innerHTML;
665                    }
666                    this._oldContents = this._editableDiv.innerHTML;
667                    $common.setVisible(this._editableDiv, false);
668                    $common.setVisible(this._topButtonContainer, false);
669                    this._viewMode = 'source';
670                }
671            },
672
673            _btnCancel_click: function () {
674                this._popupBehavior.hide();
675            },
676
677            _attributes: {
678                style: 'st_yle_',
679                size: 'si_ze_',
680                color: 'co_lor_',
681                face: 'fa_ce_',
682                align: 'al_ign_'
683            },
684            _rgbToHex: function (s) {
685                var a = /rgb\s?\(\s?(\d+)\s?,\s?(\d+)\s?,\s?(\d+)\s?\)/.exec(s);
686                return '#' + (parseInt(a[3], 10) | (parseInt(a[2], 10) << 8) | (parseInt(a[1], 10) << 16)).toString(16);
687            },
688            _encodeHtml: function () {
689                var isIE = Sys.Browser.agent == Sys.Browser.InternetExplorer;
690                var elements = this._editableDiv.getElementsByTagName('*');
691                var element;
692                for (var i = 0; element = elements[i]; i++) {
693                    try {
694                        element.className = '';
695                        element.removeAttribute('class');
696                    } catch (ex) { }
697                    try {
698                        element.id = '';
699                        element.removeAttribute('id');
700                    } catch (ex) { }
701                    try {
702                        element.removeAttribute('width');
703                    } catch (ex) { }
704                    if (isIE) {
705                    }
706                }
707                var html = this._editableDiv.innerHTML;
708                if (isIE) {
709                    var allTags = /\<[^\>]+\>/g;
710                    html = html.replace(allTags, function (tag) {
711                        var sQA = '';
712                        var nQA = '';
713                        if (tag.toLowerCase().substring(0, 2) != '<a') {
714                            sQA = /\=\'([^\'])*\'/g; //single quoted attributes
715                            nQA = /\=([^\"][^\s\/\>]*)/g; //non double quoted attributes
716                            return tag.replace(sQA, '="$1"').replace(nQA, '=$1');
717                        }
718                        else {
719                            return tag;
720                        }
721                    });
722                }
723                var fixRGB = this._rgbToHex;
724                var replaceRGB = function () {
725                    html = html.replace(/(\<[^\>]+)(rgb\s?\(\d{1,3}\s?\,\s?\d{1,3}\s?\,\s?\d{1,3}\s?\))([^\>]*\>)/gi, function (text, p1, p2, p3) {
726                        return (p1 || '') + ((p2 && fixRGB(p2)) || '') + (p3 || '');
727                    });
728                };
729                replaceRGB();
730                replaceRGB();
731                html = html.replace(/\sclass\=\"\"/gi, '').replace(/\sid\=\"\"/gi, '');
732                html = html.replace(/\<(\/?)strong\>/gi, '<$1b>').replace(/\<(\/?)em\>/gi, '<$1i>');
733                html = html.replace(/&/ig, '&amp;').replace(/\xA0/ig, '&nbsp;');
734                html = html.replace(/</ig, '&lt;').replace(/>/ig, '&gt;').replace(/\'/ig, '&apos;').replace(/\"/ig, '&quot;');
735                return html;
736            },
737            _editableDiv_submit: function () {
738                var char = 3;
739                var sel = null;
740
741                setTimeout(function () {
742                    if (this._editableDiv != null)
743                        this._editableDiv.focus();
744                }, 0);
745                if (Sys.Browser.agent != Sys.Browser.Firefox) {
746                    if (document.selection) {
747                        sel = document.selection.createRange();
748                        sel.moveStart('character', char);
749                        sel.select();
750                    }
751                    else {
752                        sel = window.getSelection();
753                        sel.collapse(this._editableDiv.firstChild, char);
754                    }
755                }
756
757                this._textbox._element.value = this._encodeHtml();
758            },
759
760            _executeCommand: function (command) {
761                if (command.target.name == undefined)
762                    return;
763
764                var isFireFox = Sys.Browser.agent == Sys.Browser.Firefox;
765                var delcolorPicker_onchange = Function.createDelegate(this, this._colorPicker_onchange);
766
767                if (isFireFox) {
768                    document.execCommand('styleWithCSS', false, false);
769                }
770
771                var map = {
772                    JustifyRight: 1,
773                    JustifyLeft: 1,
774                    JustifyCenter: 1,
775                    JustifyFull: 1,
776                    Indent: 1,
777                    Outdent: 1
778                };
779
780                if (map[command.target.name]) {
781                    try {
782                        document.execCommand(command.target.name, false, null);
783                    }
784                    catch (e) {
785                        if (e && e.result == 2147500037) {
786                            var range = window.getSelection().getRangeAt(0);
787                            var dummy = document.createElement('div');
788
789                            var restoreSelection = false;
790                            dummy.style.height = '1px;';
791
792                            if (range.startContainer.contentEditable == 'true') {
793                                window.getSelection().collapseToEnd();
794                                restoreSelection = true;
795                            }
796
797                            var ceNode = window.getSelection().getRangeAt(0).startContainer;
798
799                            while (ceNode && ceNode.contentEditable != 'true')
800                                ceNode = ceNode.parentNode;
801
802                            if (!ceNode) throw 'Selected node is not editable!';
803
804                            ceNode.insertBefore(dummy, ceNode.childNodes[0]);
805                            document.execCommand(command.target.name, false, null);
806                            dummy.parentNode.removeChild(dummy);
807
808                            if (restoreSelection) {
809                                window.getSelection().addRange(range);
810                            }
811                        }
812                        else if (window.console && window.console.log) {
813                            window.console.log(e);
814                        }
815                    }
816                }
817                else if (command.target.name == "createLink") {
818                    var url = prompt('Please insert  URL', '');
819                    if (url) {
820                        document.execCommand('createLink', false, url);
821                    }
822                }
823                else if (command.target.name == 'ForeColor') {
824                    this._commandName = command.target.name;
825                    this.saveSelection();
826                    if (!this._foreColorPicker) {
827                        this._foreColorPicker = $create(Sys.Extended.UI.ColorPickerBehavior, { 'unselectable': 'on' }, {}, {}, this._foreColor);
828                        this._foreColorPicker.set_sample(this._foreColor.parentNode);
829                        this._foreColorPicker.add_colorSelectionChanged(delcolorPicker_onchange);
830                    }
831                    this._foreColorPicker.show();
832                }
833                else if (command.target.name == 'BackColor') {
834                    this._commandName = command.target.name;
835                    this.saveSelection();
836                    if (!this._backColorPicker) {
837                        this._backColorPicker = $create(Sys.Extended.UI.ColorPickerBehavior, { 'unselectable': 'on' }, {}, {}, this._backColor);
838                        this._backColorPicker.set_sample(this._backColor.parentNode);
839                        this._backColorPicker.add_colorSelectionChanged(delcolorPicker_onchange);
840                    }
841                    this._backColorPicker.show();
842                }
843                else if (command.target.name == 'UnSelect') {
844                    if (isFireFox) {
845                        this._editableDiv.focus();
846                        var sel = window.getSelection();
847                        sel.collapse(this._editableDiv.firstChild, 0);
848                    }
849                    else {
850                        document.execCommand(command.target.name, false, null);
851                    }
852                }
853                else if (command.target.name == 'InsertImage') {
854                    if (!this._isFocusInEditableDiv) {
855                        this._editableDiv.focus();
856                    }
857
858                    this.saveSelection();
859
860                    var components = Sys.Application.getComponents();
861
862                    for (var i = 0; i < components.length; i++) {
863                        var component = components[i];
864                        if (Sys.Extended.UI.HtmlEditorExtenderBehavior.isInstanceOfType(component)) {
865                            if (component._popupBehavior._visible)
866                                return;
867                        }
868                    }
869
870                    this._elementVisible(this._popupDiv, true);
871                    this._popupBehavior.show();
872                    $common.setStyle(this._popupDiv, {
873                        position: 'fixed',
874                        top: '',
875                        left: '',
876                        opacity: '1'
877                    });
878                }
879                else {
880                    document.execCommand(command.target.name, false, null);
881                }
882            },
883
884            _colorPicker_onchange: function (e) {
885                this.restoreSelection();
886                if (/backcolor/i.test(this._commandName)) {
887                    var isFireFox = Sys.Browser.agent == Sys.Browser.Firefox;
888                    if (isFireFox) {
889                        document.execCommand('stylewithcss', false, true);
890                        document.execCommand("hilitecolor", false, "#" + e._selectedColor);
891                        document.execCommand('stylewithcss', false, false);
892                    } else {
893                        document.execCommand("backcolor", false, "#" + e._selectedColor);
894                    }
895                }
896                else
897                    document.execCommand(this._commandName, false, "#" + e._selectedColor);
898            },
899
900            saveSelection: function () {
901                if (window.getSelection)//non IE Browsers
902                {
903                    this._savedRange = window.getSelection().getRangeAt(0);
904                }
905                else if (document.selection)//IE
906                {
907                    this._savedRange = document.selection.createRange();
908                }
909            },
910
911            restoreSelection: function () {
912                this._isInFocus = true;
913                if (this._savedRange != null) {
914                    if (window.getSelection)//non IE and there is already a selection
915                    {
916                        var s = window.getSelection();
917                        if (s.rangeCount > 0)
918                            s.removeAllRanges();
919                        s.addRange(this._savedRange);
920                    }
921                    else {
922                        if (document.createRange)//non IE and no selection
923                        {
924                            window.getSelection().addRange(this._savedRange);
925                        }
926                        else {
927                            if (document.selection)//IE
928                            {
929                                this._savedRange.select();
930                            }
931                        }
932                    }
933                }
934            },
935
936            _elementVisible: function (obj, flag) {
937                if (obj.tagName == 'FORM')
938                    return;
939                if (flag) {
940                    if (obj.style.display == 'none') {
941                        obj.style.display = 'block';
942                        obj.setAttribute('displayChanged', true);
943                    }
944                    if (obj.style.visibility == 'hidden') {
945                        obj.style.visibility = 'visible';
946                        obj.setAttribute('visibleChanged', true);
947                    }
948                    this._elementVisible(obj.parentNode, true);
949                }
950                else {
951                    if (obj.getAttribute('displayChanged')) {
952                        obj.style.display = 'none';
953                        obj.removeAttribute('displayChanged');
954                    }
955                    if (obj.getAttribute('visibleChanged')) {
956                        obj.removeAttribute('visibleChanged');
957                    }
958                    this._elementVisible(obj.parentNode, false);
959                }
960            },
961
962            _raiseEvent: function (eventName, eventArgs) {
963                var handler = this.get_events().getHandler(eventName);
964
965                if (handler) {
966                    if (!eventArgs) {
967                        eventArgs = Sys.EventArgs.Empty;
968                    }
969
970                    handler(this, eventArgs);
971                }
972            },
973
974            get_ButtonWidth: function () {
975                return this._ButtonWidth;
976            },
977
978            set_ButtonWidth: function (value) {
979                if (this._ButtonWidth != value) {
980                    this._ButtonWidth = value;
981                    this.raisePropertyChanged('ButtonWidth');
982                }
983            },
984
985            get_ButtonHeight: function () {
986                return this._ButtonHeight;
987            },
988
989            set_ButtonHeight: function (value) {
990                if (this._ButtonHeight != value) {
991                    this._ButtonHeight = value;
992                    this.raisePropertyChanged('ButtonHeight');
993                }
994            },
995
996            get_ToolbarButtons: function () {
997                return this._toolbarButtons;
998            },
999
1000            set_ToolbarButtons: function (value) {
1001                if (this._toolbarButtons != value) {
1002                    this._toolbarButtons = value;
1003                    this.raisePropertyChanged('ToolbarButtons');
1004                }
1005            },
1006
1007            get_displaySourceTab: function () {
1008                return this._displaySourceTab;
1009            },
1010
1011            set_displaySourceTab: function (value) {
1012                if (this._displaySourceTab != value) {
1013                    this._displaySourceTab = value;
1014                    this.raisePropertyChanged('DisplaySourceTab');
1015                }
1016            },
1017
1018            add_change: function (handler) {
1019                this.get_events().addHandler("change", handler);
1020            },
1021
1022            remove_change: function (handler) {
1023                this.get_events().removeHandler("change", handler);
1024            },
1025
1026            get_isDirty: function () {
1027                return this._isDirty;
1028            }
1029
1030        };
1031
1032        Sys.Extended.UI.HtmlEditorExtenderBehavior.registerClass('Sys.Extended.UI.HtmlEditorExtenderBehavior', Sys.Extended.UI.BehaviorBase);
1033        Sys.registerComponent(Sys.Extended.UI.HtmlEditorExtenderBehavior, { name: 'HtmlEditorExtender', parameters: [{ name: 'ToolbarButtons', type: 'HtmlEditorExtenderButton[]'}] });
1034
1035        var HtmlEditorExtender_editableDivs = new Array();
1036
1037        Sys.Extended.UI.HtmlEditorExtenderBehavior.WebForm_OnSubmit = function () {
1038            /// <summary>
1039            /// Wraps ASP.NET's WebForm_OnSubmit in order to encode tags prior to submission
1040            /// </summary>
1041            /// <returns type='Boolean'>
1042            /// Result of original WebForm_OnSubmit
1043            /// </returns>
1044            var result = Sys.Extended.UI.HtmlEditorExtenderBehavior._originalWebForm_OnSubmit();
1045            if (result) {
1046                var components = Sys.Application.getComponents();
1047                for (var i = 0; i < components.length; i++) {
1048                    var component = components[i];
1049                    if (Sys.Extended.UI.HtmlEditorExtenderBehavior.isInstanceOfType(component)) {
1050                        component._editableDiv_submit();
1051                    }
1052                }
1053            }
1054            return result;
1055        },
1056
1057        Sys.Extended.UI.HtmlEditorExtenderBehavior.IsDirty = function () {
1058            var components = Sys.Application.getComponents();
1059            for (var i = 0; i < components.length; i++) {
1060                var component = components[i];
1061                if (Sys.Extended.UI.HtmlEditorExtenderBehavior.isInstanceOfType(component)) {
1062                    if (component._isDirty)
1063                        return true;
1064                }
1065            }
1066            return false;
1067        },
1068
1069        ajaxClientUploadComplete = function (sender, e) {
1070            var htmlEditorExtender = null;
1071            var components = Sys.Application.getComponents();
1072
1073            for (var i = 0; i < components.length; i++) {
1074                var component = components[i];
1075                if (Sys.Extended.UI.HtmlEditorExtenderBehavior.isInstanceOfType(component)) {
1076                    if (component._popupBehavior._visible) {
1077                        htmlEditorExtender = component;
1078                        i = component.length;
1079                    }
1080                }
1081            }
1082
1083            var postedUrl = e.get_postedUrl().replace('&amp;', '&');
1084            if (htmlEditorExtender != null) {
1085                htmlEditorExtender.restoreSelection();
1086                if (document.selection && document.selection.createRange) {
1087                    try {
1088                        htmlEditorExtender._savedRange.pasteHTML('<img src=\'' + postedUrl + '\' />');
1089                    }
1090                    catch (Error) {
1091                        var node = document.createElement("img");
1092                        node.src = postedUrl;
1093                        htmlEditorExtender._savedRange.insertNode(node);
1094                    }
1095                }
1096                else {
1097                    var node = document.createElement("img");
1098                    node.src = postedUrl;
1099                    htmlEditorExtender._savedRange.insertNode(node);
1100                }
1101
1102                if (sender._filesInQueue.length == sender._currentQueueIndex + 1) {
1103                    while (sender._filesInQueue.length >= 1) {
1104                        sender._filesInQueue[0].removeNodeFrom(sender._queueContainer);
1105                        Array.removeAt(sender._filesInQueue, 0);
1106                    }
1107                    sender._showFilesCount();
1108                    sender._reset();
1109                    htmlEditorExtender._popupBehavior.hide();
1110                }
1111            }
1112        };
1113    } // execute
1114
1115    if (window.Sys && Sys.loader) {
1116        Sys.loader.registerScript(scriptName, ['ExtendedBase', 'ExtendedCommon'], execute);
1117
1118    }
1119    else {
1120        execute();
1121    }
1122
1123})();

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.