mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 10:20:58 -06:00
DEV: Fix ember/jquery-ember-run
lint (#29113)
See: https://github.com/ember-cli/eslint-plugin-ember/blob/master/docs/rules/jquery-ember-run.md
This commit is contained in:
parent
520f71b8f8
commit
60e2b72b7f
@ -1,3 +1,4 @@
|
||||
import { bind } from "@ember/runloop";
|
||||
import $ from "jquery";
|
||||
|
||||
const CLICK_ATTRIBUTE_NAME = "_discourse_click_widget";
|
||||
@ -206,104 +207,143 @@ WidgetClickHook.setupDocumentCallback = function () {
|
||||
return;
|
||||
}
|
||||
|
||||
$(document).on("mouseover.discourse-widget", (e) => {
|
||||
nodeCallback(e.target, MOUSE_OVER_ATTRIBUTE_NAME, (w) => w.mouseOver(e), {
|
||||
rerender: false,
|
||||
});
|
||||
});
|
||||
$(document).on(
|
||||
"mouseover.discourse-widget",
|
||||
bind(this, (e) => {
|
||||
nodeCallback(e.target, MOUSE_OVER_ATTRIBUTE_NAME, (w) => w.mouseOver(e), {
|
||||
rerender: false,
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
$(document).on("mouseout.discourse-widget", (e) => {
|
||||
nodeCallback(e.target, MOUSE_OUT_ATTRIBUTE_NAME, (w) => w.mouseOut(e), {
|
||||
rerender: false,
|
||||
});
|
||||
});
|
||||
$(document).on(
|
||||
"mouseout.discourse-widget",
|
||||
bind(this, (e) => {
|
||||
nodeCallback(e.target, MOUSE_OUT_ATTRIBUTE_NAME, (w) => w.mouseOut(e), {
|
||||
rerender: false,
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
$(document).on("dblclick.discourse-widget", (e) => {
|
||||
nodeCallback(e.target, DOUBLE_CLICK_ATTRIBUTE_NAME, (w) =>
|
||||
w.doubleClick(e)
|
||||
);
|
||||
});
|
||||
$(document).on(
|
||||
"dblclick.discourse-widget",
|
||||
bind(this, (e) => {
|
||||
nodeCallback(e.target, DOUBLE_CLICK_ATTRIBUTE_NAME, (w) =>
|
||||
w.doubleClick(e)
|
||||
);
|
||||
})
|
||||
);
|
||||
|
||||
$(document).on("click.discourse-widget", (e) => {
|
||||
nodeCallback(e.target, CLICK_ATTRIBUTE_NAME, (w) => w.click(e));
|
||||
$(document).on(
|
||||
"click.discourse-widget",
|
||||
bind(this, (e) => {
|
||||
nodeCallback(e.target, CLICK_ATTRIBUTE_NAME, (w) => w.click(e));
|
||||
|
||||
let node = e.target;
|
||||
const $outside = $("[data-click-outside]");
|
||||
$outside.each((i, outNode) => {
|
||||
if (
|
||||
outNode.contains(node) ||
|
||||
(outNode === node && outNode.style.position === "absolute")
|
||||
) {
|
||||
return;
|
||||
}
|
||||
let node = e.target;
|
||||
const $outside = $("[data-click-outside]");
|
||||
$outside.each((i, outNode) => {
|
||||
if (
|
||||
outNode.contains(node) ||
|
||||
(outNode === node && outNode.style.position === "absolute")
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
const widget2 = outNode[CLICK_OUTSIDE_ATTRIBUTE_NAME];
|
||||
if (widget2) {
|
||||
widget2.clickOutside(e);
|
||||
}
|
||||
});
|
||||
});
|
||||
const widget2 = outNode[CLICK_OUTSIDE_ATTRIBUTE_NAME];
|
||||
if (widget2) {
|
||||
widget2.clickOutside(e);
|
||||
}
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
$(document).on("mousedown.discourse-widget", (e) => {
|
||||
let node = e.target;
|
||||
const $outside = $("[data-mouse-down-outside]");
|
||||
$outside.each((i, outNode) => {
|
||||
if (outNode.contains(node)) {
|
||||
return;
|
||||
}
|
||||
const widget2 = outNode[MOUSE_DOWN_OUTSIDE_ATTRIBUTE_NAME];
|
||||
if (widget2) {
|
||||
widget2.mouseDownOutside(e);
|
||||
}
|
||||
});
|
||||
});
|
||||
$(document).on(
|
||||
"mousedown.discourse-widget",
|
||||
bind(this, (e) => {
|
||||
let node = e.target;
|
||||
const $outside = $("[data-mouse-down-outside]");
|
||||
$outside.each((i, outNode) => {
|
||||
if (outNode.contains(node)) {
|
||||
return;
|
||||
}
|
||||
const widget2 = outNode[MOUSE_DOWN_OUTSIDE_ATTRIBUTE_NAME];
|
||||
if (widget2) {
|
||||
widget2.mouseDownOutside(e);
|
||||
}
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
$(document).on("keyup.discourse-widget", (e) => {
|
||||
nodeCallback(e.target, KEY_UP_ATTRIBUTE_NAME, (w) => w.keyUp(e));
|
||||
});
|
||||
$(document).on(
|
||||
"keyup.discourse-widget",
|
||||
bind(this, (e) => {
|
||||
nodeCallback(e.target, KEY_UP_ATTRIBUTE_NAME, (w) => w.keyUp(e));
|
||||
})
|
||||
);
|
||||
|
||||
$(document).on("keydown.discourse-widget", (e) => {
|
||||
nodeCallback(e.target, KEY_DOWN_ATTRIBUTE_NAME, (w) => w.keyDown(e));
|
||||
});
|
||||
$(document).on(
|
||||
"keydown.discourse-widget",
|
||||
bind(this, (e) => {
|
||||
nodeCallback(e.target, KEY_DOWN_ATTRIBUTE_NAME, (w) => w.keyDown(e));
|
||||
})
|
||||
);
|
||||
|
||||
$(document).on("input.discourse-widget", (e) => {
|
||||
nodeCallback(e.target, INPUT_ATTRIBUTE_NAME, (w) => w.input(e), {
|
||||
rerender: false,
|
||||
});
|
||||
});
|
||||
$(document).on(
|
||||
"input.discourse-widget",
|
||||
bind(this, (e) => {
|
||||
nodeCallback(e.target, INPUT_ATTRIBUTE_NAME, (w) => w.input(e), {
|
||||
rerender: false,
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
$(document).on("change.discourse-widget", (e) => {
|
||||
nodeCallback(e.target, CHANGE_ATTRIBUTE_NAME, (w) => w.change(e), {
|
||||
rerender: false,
|
||||
});
|
||||
});
|
||||
$(document).on(
|
||||
"change.discourse-widget",
|
||||
bind(this, (e) => {
|
||||
nodeCallback(e.target, CHANGE_ATTRIBUTE_NAME, (w) => w.change(e), {
|
||||
rerender: false,
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
$(document).on("touchend.discourse-widget", (e) => {
|
||||
nodeCallback(e.target, TOUCH_END_ATTRIBUTE_NAME, (w) => w.touchEnd(e), {
|
||||
rerender: false,
|
||||
});
|
||||
});
|
||||
$(document).on(
|
||||
"touchend.discourse-widget",
|
||||
bind(this, (e) => {
|
||||
nodeCallback(e.target, TOUCH_END_ATTRIBUTE_NAME, (w) => w.touchEnd(e), {
|
||||
rerender: false,
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
$(document).on("mousedown.discourse-widget", (e) => {
|
||||
nodeCallback(
|
||||
e.target,
|
||||
MOUSE_DOWN_ATTRIBUTE_NAME,
|
||||
(w) => {
|
||||
w.mouseDown(e);
|
||||
},
|
||||
{ rerender: false }
|
||||
);
|
||||
});
|
||||
$(document).on(
|
||||
"mousedown.discourse-widget",
|
||||
bind(this, (e) => {
|
||||
nodeCallback(
|
||||
e.target,
|
||||
MOUSE_DOWN_ATTRIBUTE_NAME,
|
||||
(w) => {
|
||||
w.mouseDown(e);
|
||||
},
|
||||
{ rerender: false }
|
||||
);
|
||||
})
|
||||
);
|
||||
|
||||
$(document).on("mouseup.discourse-widget", (e) => {
|
||||
nodeCallback(e.target, MOUSE_UP_ATTRIBUTE_NAME, (w) => w.mouseUp(e), {
|
||||
rerender: false,
|
||||
});
|
||||
});
|
||||
$(document).on(
|
||||
"mouseup.discourse-widget",
|
||||
bind(this, (e) => {
|
||||
nodeCallback(e.target, MOUSE_UP_ATTRIBUTE_NAME, (w) => w.mouseUp(e), {
|
||||
rerender: false,
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
$(document).on("mousemove.discourse-widget", (e) => {
|
||||
nodeCallback(e.target, MOUSE_MOVE_ATTRIBUTE_NAME, (w) => w.mouseMove(e));
|
||||
});
|
||||
$(document).on(
|
||||
"mousemove.discourse-widget",
|
||||
bind(this, (e) => {
|
||||
nodeCallback(e.target, MOUSE_MOVE_ATTRIBUTE_NAME, (w) => w.mouseMove(e));
|
||||
})
|
||||
);
|
||||
|
||||
_watchingDocument = true;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user