<commit_before>/// <reference name="MicrosoftAjax.js" />
/// <reference name="dnn.controls.js" assembly="DotNetNuke.WebControls" />
/// <reference name="dnn.js" assembly="DotNetNuke.WebUtility" />
/// <reference name="dnn.dom.positioning.js" assembly="DotNetNuke.WebUtility" />
/// <reference name="dnn.xmlhttp.js" assembly="DotNetNuke.WebUtility" />

Type.registerNamespace('dnn.controls');

dnn.controls.DNNToolBar = function (ns, behaviorID) {
    this.ctr = document.createElement('div');
    this.ctr.id = ns + '_tb';
    dnn.controls.DNNToolBar.initializeBase(this, [this.ctr]);
    this.initialize(behaviorID);
    //this.ns = ns;

    this.css = null;
    this.cssButton = null;
    this.cssButtonHover = null;
    this.moutDelay = null;

    this.buttons = [];
    this.relatedCtl = null;
    this.ctr.style.position = 'relative';	//allow relative positioning without taking up space
    this.ctl = document.createElement('div');
    this.ctr.appendChild(this.ctl);
    this.ctl.style.display = 'none';
    this.moutDelay = 1000;
    this._hideDelegate = dnn.createDelegate(this, this.hide);
    this.actionHandler = null;
}

dnn.controls.DNNToolBar.prototype =
{

    loadDefinition: function (toolbarID, nsPrefix, relatedCtl, parent, insertBeforeCtl, actionHandler) {
        var def = dnn.controls.toolbars[nsPrefix + ':' + toolbarID];
        if (def == null)	//try and load with xhtmlconformance off
            def = dnn.controls.toolbars[nsPrefix + '$' + toolbarID];
        if (def == null)	//try and load global toolbar
            def = dnn.controls.toolbars[toolbarID];

        if (def) {
            this.relatedCtl = relatedCtl;
            this.css = def.css;
            this.cssButton = def.cssb;
            this.cssButtonHover = def.cssbh;
            this.actionHandler = actionHandler;
            for (var i = 0; i < def.btns.length; i++) {
                var btn = def.btns[i];
                this.addButton(btn.key, btn.ca, btn.css, btn.cssh, btn.img, btn.txt, btn.alt, btn.js, btn.url, true);
            }

            if (def.mod)
                this.moutDelay = def.mod;

            if (insertBeforeCtl) {
                //mini-hack to work around issue with &nbsp; just before ctl which causes "bumping"
                var sibling = dnn.dom.getSibling(insertBeforeCtl, -1);
                if (sibling != null && sibling.nodeType == 3)
                    insertBeforeCtl = sibling;
                parent.insertBefore(this.ctr, insertBeforeCtl);
            }
            else
                parent.appendChild(this.ctr);
        }

    },

    addButton: function (key, clickAct, css, hoverCss, img, text, toolTip, js, url, visible) {
        if (key == null)
            key = this.buttons.length;
        if (this.cssButton)
            css = this.cssButton + ' ' + css;
        if (this.cssButtonHover)
            hoverCss = this.cssButtonHover + ' ' + hoverCss;

        this.buttons[key] = new dnn.controls.DNNToolBarButton(key, clickAct, css, hoverCss, img, text, toolTip, js, url, visible, this);
    },

    refresh: function () {
        this.ctl.className = this.css;
        for (var key in this.buttons) {
            var btn = this.buttons[key];
            if (typeof btn == 'function')	//safeguard against other js frameworks
                continue;

            if (btn.ctl == null) {
                btn.render();
                this.ctl.appendChild(btn.ctl);
            }
            btn.ctl.style.display = (btn.visible ? '' : 'none');
        }
    },

    show: function (hide) {
        dnn.cancelDelay(this.ns + 'mout');
        if (this.ctl.style.display != '') {
            this.refresh();
            this.ctl.style.display = '';
            this.ctr.className = this.ctr.className + " visible";
        }
        if (hide)
            this.beginHide();
    },

    beginHide: function () {
        if (this.moutDelay > 0)
            dnn.doDelay(this.ns + 'mout', this.moutDelay, this._hideDelegate);

    },

    hide: function () {
        this.ctl.style.display = 'none';
        this.ctr.className = this.ctr.className.replace(" visible", "");
    },

    buttonClick: function (e) {
        var tb = this.tb;
        var arg = new dnn.controls.DNNToolBarEventArgs(this);
        tb.invoke_handler('click', arg);
        if (arg.get_cancel())
            return;
        this.click();

        if (e && e.preventDefault) {
            //alert("FF");
            e.stopPropagation(); // DOM style (return false doesn't always work in FF)
            e.preventDefault();
        }
        else {
            window.event.cancelBubble = true;//IE stopPropagation
        }
        return false;
    },

    buttonMouseOver: function (evt) {
        this.tb.show(false);
        this.hover();
    },

    buttonMouseOut: function (evt) {
        this.tb.beginHide();
        this.unhover();
    },

    dispose: function () {
        this._hideDelegate = null;
        this.actionHandler = null;
        dnn.controls.DNNToolBar.callBaseMethod(this, 'dispose');
    }<commit_msg>DNN-8314 - Removed unneeded alert comment.<commit_after>/// <reference name="MicrosoftAjax.js" />
/// <reference name="dnn.controls.js" assembly="DotNetNuke.WebControls" />
/// <reference name="dnn.js" assembly="DotNetNuke.WebUtility" />
/// <reference name="dnn.dom.positioning.js" assembly="DotNetNuke.WebUtility" />
/// <reference name="dnn.xmlhttp.js" assembly="DotNetNuke.WebUtility" />

Type.registerNamespace('dnn.controls');

dnn.controls.DNNToolBar = function (ns, behaviorID) {
    this.ctr = document.createElement('div');
    this.ctr.id = ns + '_tb';
    dnn.controls.DNNToolBar.initializeBase(this, [this.ctr]);
    this.initialize(behaviorID);
    //this.ns = ns;

    this.css = null;
    this.cssButton = null;
    this.cssButtonHover = null;
    this.moutDelay = null;

    this.buttons = [];
    this.relatedCtl = null;
    this.ctr.style.position = 'relative';	//allow relative positioning without taking up space
    this.ctl = document.createElement('div');
    this.ctr.appendChild(this.ctl);
    this.ctl.style.display = 'none';
    this.moutDelay = 1000;
    this._hideDelegate = dnn.createDelegate(this, this.hide);
    this.actionHandler = null;
}

dnn.controls.DNNToolBar.prototype =
{

    loadDefinition: function (toolbarID, nsPrefix, relatedCtl, parent, insertBeforeCtl, actionHandler) {
        var def = dnn.controls.toolbars[nsPrefix + ':' + toolbarID];
        if (def == null)	//try and load with xhtmlconformance off
            def = dnn.controls.toolbars[nsPrefix + '$' + toolbarID];
        if (def == null)	//try and load global toolbar
            def = dnn.controls.toolbars[toolbarID];

        if (def) {
            this.relatedCtl = relatedCtl;
            this.css = def.css;
            this.cssButton = def.cssb;
            this.cssButtonHover = def.cssbh;
            this.actionHandler = actionHandler;
            for (var i = 0; i < def.btns.length; i++) {
                var btn = def.btns[i];
                this.addButton(btn.key, btn.ca, btn.css, btn.cssh, btn.img, btn.txt, btn.alt, btn.js, btn.url, true);
            }

            if (def.mod)
                this.moutDelay = def.mod;

            if (insertBeforeCtl) {
                //mini-hack to work around issue with &nbsp; just before ctl which causes "bumping"
                var sibling = dnn.dom.getSibling(insertBeforeCtl, -1);
                if (sibling != null && sibling.nodeType == 3)
                    insertBeforeCtl = sibling;
                parent.insertBefore(this.ctr, insertBeforeCtl);
            }
            else
                parent.appendChild(this.ctr);
        }

    },

    addButton: function (key, clickAct, css, hoverCss, img, text, toolTip, js, url, visible) {
        if (key == null)
            key = this.buttons.length;
        if (this.cssButton)
            css = this.cssButton + ' ' + css;
        if (this.cssButtonHover)
            hoverCss = this.cssButtonHover + ' ' + hoverCss;

        this.buttons[key] = new dnn.controls.DNNToolBarButton(key, clickAct, css, hoverCss, img, text, toolTip, js, url, visible, this);
    },

    refresh: function () {
        this.ctl.className = this.css;
        for (var key in this.buttons) {
            var btn = this.buttons[key];
            if (typeof btn == 'function')	//safeguard against other js frameworks
                continue;

            if (btn.ctl == null) {
                btn.render();
                this.ctl.appendChild(btn.ctl);
            }
            btn.ctl.style.display = (btn.visible ? '' : 'none');
        }
    },

    show: function (hide) {
        dnn.cancelDelay(this.ns + 'mout');
        if (this.ctl.style.display != '') {
            this.refresh();
            this.ctl.style.display = '';
            this.ctr.className = this.ctr.className + " visible";
        }
        if (hide)
            this.beginHide();
    },

    beginHide: function () {
        if (this.moutDelay > 0)
            dnn.doDelay(this.ns + 'mout', this.moutDelay, this._hideDelegate);

    },

    hide: function () {
        this.ctl.style.display = 'none';
        this.ctr.className = this.ctr.className.replace(" visible", "");
    },

    buttonClick: function (e) {
        var tb = this.tb;
        var arg = new dnn.controls.DNNToolBarEventArgs(this);
        tb.invoke_handler('click', arg);
        if (arg.get_cancel())
            return;
        this.click();

        if (e && e.preventDefault) {
            e.stopPropagation(); // DOM style (return false doesn't always work in FF)
            e.preventDefault();
        }
        else {
            window.event.cancelBubble = true;//IE stopPropagation
        }
        return false;
    },

    buttonMouseOver: function (evt) {
        this.tb.show(false);
        this.hover();
    },

    buttonMouseOut: function (evt) {
        this.tb.beginHide();
        this.unhover();
    },

    dispose: function () {
        this._hideDelegate = null;
        this.actionHandler = null;
        dnn.controls.DNNToolBar.callBaseMethod(this, 'dispose');
    }
{'fraction_non_alphanumeric': 0.13639059102589446, 'fraction_numerical': 0.0019766752322593396, 'mean_word_length': 2.004453681710214, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2390619', 'n_tokens_mistral': 3150, 'n_tokens_neox': 3075, 'n_words': 641}