1199411994 label.addClass("rtl");
1199511995 }
1199611996 },
11997+ _setAttributes: (element2, attributes) => {
11998+ if (typeof attributes !== "object") return;
11999+ const el = $6(element2);
12000+ $6.each(attributes, (k5, v5) => {
12001+ el.attr(Str.dashedName(k5), v5);
12002+ });
12003+ },
1199712004 getComponent: function() {
1199812005 return this.component;
1199912006 },
1508815095 this._build();
1508915096 },
1509015097 _build: function() {
15098+ const that = this;
1509115099 const element2 = this.element;
15092- const elem = this.elem;
1509315100 const o2 = this.options;
1509415101 const strings = this.strings;
1509515102 const body = $6("body");
@@ -15132,12 +15139,15 @@
1513215139 const customButtons = Metro2.utils.isObject(o2.customButtons);
1513315140 if (Array.isArray(customButtons))
1513415141 $6.each(customButtons, function() {
15135- button = $6("<button>").addClass("button").addClass(this.cls).html(this.text);
15136- if (this.onclick)
15137- button.on(Metro2.events.click, () => {
15138- Metro2.utils.exec(this.onclick, [element2]);
15142+ const btn = $6("<button>").addClass("button").addClass(this.cls).html(this.text || this.html || "");
15143+ that._setAttributes(btn, this.attr);
15144+ if (this.onclick) {
15145+ btn.on(Metro2.events.click, (e2) => {
15146+ if (Metro2.utils.isRightMouse(e2)) return;
15147+ Metro2.utils.exec(this.onclick, [btn[0], element2[0]]);
1513915148 });
15140- button.appendTo(buttons);
15149+ }
15150+ btn.appendTo(buttons);
1514115151 });
1514215152 }
1514315153 if (o2.overlay === true) {
@@ -22639,16 +22649,14 @@
2263922649 if (Array.isArray(customButtons)) {
2264022650 $6.each(customButtons, function() {
2264122651 const btn = $6("<button>");
22642- btn.addClass("button input-custom-button").addClass(o2.clsCustomButton).addClass(this.cls).attr("tabindex", -1).attr("type", "button").html(this.text);
22643- if (this.attr && typeof this.attr === "object") {
22644- $6.each(this.attr, (k5, v5) => {
22645- btn.attr(Str.dashedName(k5), v5);
22646- });
22647- }
22648- if (this.onclick)
22649- btn.on("click", () => {
22652+ btn.addClass("button input-custom-button").addClass(o2.clsCustomButton).addClass(this.cls).attr("tabindex", -1).attr("type", "button").html(this.text || this.html || "");
22653+ that._setAttributes(btn, this.attr);
22654+ if (this.onclick) {
22655+ btn.on("click", (e2) => {
22656+ if (Metro2.utils.isRightMouse(e2)) return;
2265022657 Metro2.utils.exec(this.onclick, [btn[0], element2[0]]);
2265122658 });
22659+ }
2265222660 btn.appendTo(buttons);
2265322661 });
2265422662 }
2978629794 });
2978729795 },
2978829796 _createStructure: function() {
29797+ const that = this;
2978929798 const element2 = this.element;
2979029799 const o2 = this.options;
2979129800 let container;
@@ -29823,15 +29832,12 @@
2982329832 if (Array.isArray(customButtons)) {
2982429833 $6.each(customButtons, function() {
2982529834 const btn = $6("<button>");
29826- btn.addClass("button input-custom-button").addClass(o2.clsCustomButton).addClass(this.cls).attr("tabindex", -1).attr("type", "button").html(this.text);
29827- if (this.attr && typeof this.attr === "object") {
29828- $6.each(this.attr, (k5, v5) => {
29829- btn.attr(Str.dashedName(k5), v5);
29830- });
29831- }
29835+ btn.addClass("button input-custom-button").addClass(o2.clsCustomButton).addClass(this.cls).attr("tabindex", -1).attr("type", "button").html(this.text || this.html || "");
29836+ that._setAttributes(btn, this.attr);
2983229837 if (this.onclick)
29833- btn.on("click", () => {
29834- this.onclick.apply(btn, [element2.valueOf(), element2]);
29838+ btn.on("click", (e2) => {
29839+ if (Metro2.utils.isRightMouse(e2)) return;
29840+ Metro2.utils.exec(this.onclick, [btn[0], element2[0]]);
2983529841 });
2983629842 btn.appendTo(buttons);
2983729843 });
3366533671 return this;
3366633672 },
3366733673 _addCustomButtons: function(buttons) {
33674+ const that = this;
3366833675 const element2 = this.element;
3366933676 const o2 = this.options;
3367033677 const title = element2.closest(".panel").find(".panel-title");
@@ -33687,21 +33694,16 @@
3368733694 buttonsContainer.html("");
3368833695 }
3368933696 $6.each(customButtons, function() {
33690- const customButton = $6("<span>");
33691- customButton.addClass("button btn-custom").addClass(o2.clsCustomButton).addClass(this.cls).attr("tabindex", -1).html(this.html);
33692- if (this.attr && typeof this.attr === "object") {
33693- $6.each(this.attr, (k5, v5) => {
33694- customButton.attr(Str.dashedName(k5), v5);
33697+ const btn = $6("<span>");
33698+ btn.addClass("button btn-custom").addClass(o2.clsCustomButton).addClass(this.cls).attr("tabindex", -1).html(this.text || this.html || "");
33699+ that._setAttributes(btn, this.attr);
33700+ if (this.onclick) {
33701+ btn.on(Metro2.events.click, (e2) => {
33702+ if (Metro2.utils.isRightMouse(e2)) return;
33703+ Metro2.utils.exec(this.onclick, [btn[0], element2[0]]);
3369533704 });
3369633705 }
33697- customButton.data("action", this.onclick);
33698- buttonsContainer.prepend(customButton);
33699- });
33700- title.on(Metro2.events.click, ".btn-custom", function(e2) {
33701- if (Metro2.utils.isRightMouse(e2)) return;
33702- const button = $6(this);
33703- const action = button.data("action");
33704- Metro2.utils.exec(action, [button], this);
33706+ buttonsContainer.prepend(btn);
3370533707 });
3370633708 return this;
3370733709 },
4364943651 }
4365043652 },
4365143653 _window: function(o2) {
43654+ const that = this;
4365243655 let win;
4365343656 let caption;
4365443657 let content;
@@ -43707,24 +43710,19 @@
4370743710 const customButtons = Metro2.utils.isObject(o2.customButtons);
4370843711 if (customButtons) {
4370943712 $6.each(customButtons, function() {
43710- const customButton = $6("<span>");
43711- customButton.addClass("button btn-custom").addClass(o2.clsCustomButton).addClass(this.cls).attr("tabindex", -1).html(this.html);
43712- if (this.attr && typeof this.attr === "object") {
43713- $6.each(this.attr, (k5, v5) => {
43714- customButton.attr(Str.dashedName(k5), v5);
43713+ const btn = $6("<span>");
43714+ btn.addClass("button btn-custom").addClass(o2.clsCustomButton).addClass(this.cls).attr("tabindex", -1).html(this.text || this.html || "");
43715+ that._setAttributes(btn, this.attr);
43716+ if (this.onclick) {
43717+ btn.on(Metro2.events.click, (e2) => {
43718+ if (Metro2.utils.isRightMouse(e2)) return;
43719+ Metro2.utils.exec(this.onclick, [btn[0], win[0]]);
4371543720 });
4371643721 }
43717- customButton.data("action", this.onclick);
43718- buttons.prepend(customButton);
43722+ btn.appendTo(buttons);
4371943723 });
4372043724 }
4372143725 }
43722- caption.on(Metro2.events.click, ".btn-custom", function(e2) {
43723- if (Metro2.utils.isRightMouse(e2)) return;
43724- const button = $6(this);
43725- const action = button.data("action");
43726- Metro2.utils.exec(action, [button], this);
43727- });
4372843726 win.attr("id", o2.id === void 0 ? Hooks.useId(win[0]) : o2.id);
4372943727 win.on(Metro2.events.startAll, ".window-caption", (e2) => {
4373043728 this._fireEvent("caption-click", {
0 commit comments