Auto merge of #115669 - GuillaumeGomez:js-anonymous-functions, r=notriddle
rustdoc: Change syntax for anonymous functions set in JS This function is not very useful in itself but it slightly reduces the JS size so it's always that I suppose... No changes in behaviour. r? `@notriddle`
This commit is contained in:
commit
5ede940894
@ -852,14 +852,14 @@ function preLoadCss(cssUrl) {
|
||||
window.CURRENT_TOOLTIP_ELEMENT = wrapper;
|
||||
window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE = e;
|
||||
clearTooltipHoverTimeout(window.CURRENT_TOOLTIP_ELEMENT);
|
||||
wrapper.onpointerenter = function(ev) {
|
||||
wrapper.onpointerenter = ev => {
|
||||
// If this is a synthetic touch event, ignore it. A click event will be along shortly.
|
||||
if (ev.pointerType !== "mouse") {
|
||||
return;
|
||||
}
|
||||
clearTooltipHoverTimeout(e);
|
||||
};
|
||||
wrapper.onpointerleave = function(ev) {
|
||||
wrapper.onpointerleave = ev => {
|
||||
// If this is a synthetic touch event, ignore it. A click event will be along shortly.
|
||||
if (ev.pointerType !== "mouse") {
|
||||
return;
|
||||
@ -963,38 +963,38 @@ function preLoadCss(cssUrl) {
|
||||
}
|
||||
|
||||
onEachLazy(document.getElementsByClassName("tooltip"), e => {
|
||||
e.onclick = function() {
|
||||
this.TOOLTIP_FORCE_VISIBLE = this.TOOLTIP_FORCE_VISIBLE ? false : true;
|
||||
if (window.CURRENT_TOOLTIP_ELEMENT && !this.TOOLTIP_FORCE_VISIBLE) {
|
||||
e.onclick = () => {
|
||||
e.TOOLTIP_FORCE_VISIBLE = e.TOOLTIP_FORCE_VISIBLE ? false : true;
|
||||
if (window.CURRENT_TOOLTIP_ELEMENT && !e.TOOLTIP_FORCE_VISIBLE) {
|
||||
hideTooltip(true);
|
||||
} else {
|
||||
showTooltip(this);
|
||||
showTooltip(e);
|
||||
window.CURRENT_TOOLTIP_ELEMENT.setAttribute("tabindex", "0");
|
||||
window.CURRENT_TOOLTIP_ELEMENT.focus();
|
||||
window.CURRENT_TOOLTIP_ELEMENT.onblur = tooltipBlurHandler;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
e.onpointerenter = function(ev) {
|
||||
e.onpointerenter = ev => {
|
||||
// If this is a synthetic touch event, ignore it. A click event will be along shortly.
|
||||
if (ev.pointerType !== "mouse") {
|
||||
return;
|
||||
}
|
||||
setTooltipHoverTimeout(this, true);
|
||||
setTooltipHoverTimeout(e, true);
|
||||
};
|
||||
e.onpointermove = function(ev) {
|
||||
e.onpointermove = ev => {
|
||||
// If this is a synthetic touch event, ignore it. A click event will be along shortly.
|
||||
if (ev.pointerType !== "mouse") {
|
||||
return;
|
||||
}
|
||||
setTooltipHoverTimeout(this, true);
|
||||
setTooltipHoverTimeout(e, true);
|
||||
};
|
||||
e.onpointerleave = function(ev) {
|
||||
e.onpointerleave = ev => {
|
||||
// If this is a synthetic touch event, ignore it. A click event will be along shortly.
|
||||
if (ev.pointerType !== "mouse") {
|
||||
return;
|
||||
}
|
||||
if (!this.TOOLTIP_FORCE_VISIBLE &&
|
||||
if (!e.TOOLTIP_FORCE_VISIBLE &&
|
||||
!elemIsInParent(ev.relatedTarget, window.CURRENT_TOOLTIP_ELEMENT)) {
|
||||
// Tooltip pointer leave gesture:
|
||||
//
|
||||
@ -1139,7 +1139,7 @@ href="https://doc.rust-lang.org/${channel}/rustdoc/how-to-read-rustdoc.html\
|
||||
*
|
||||
* Pass "true" to reset focus for tooltip popovers.
|
||||
*/
|
||||
window.hideAllModals = function(switchFocus) {
|
||||
window.hideAllModals = switchFocus => {
|
||||
hideSidebar();
|
||||
window.hidePopoverMenus();
|
||||
hideTooltip(switchFocus);
|
||||
@ -1148,7 +1148,7 @@ href="https://doc.rust-lang.org/${channel}/rustdoc/how-to-read-rustdoc.html\
|
||||
/**
|
||||
* Hide all the popover menus.
|
||||
*/
|
||||
window.hidePopoverMenus = function() {
|
||||
window.hidePopoverMenus = () => {
|
||||
onEachLazy(document.querySelectorAll(".search-form .popover"), elem => {
|
||||
elem.style.display = "none";
|
||||
});
|
||||
|
@ -59,8 +59,8 @@
|
||||
if (settingValue !== null) {
|
||||
toggle.checked = settingValue === "true";
|
||||
}
|
||||
toggle.onchange = function() {
|
||||
changeSetting(this.id, this.checked);
|
||||
toggle.onchange = () => {
|
||||
changeSetting(toggle.id, toggle.checked);
|
||||
};
|
||||
});
|
||||
onEachLazy(settingsElement.querySelectorAll("input[type=\"radio\"]"), elem => {
|
||||
@ -224,14 +224,14 @@
|
||||
|
||||
if (isSettingsPage) {
|
||||
// We replace the existing "onclick" callback to do nothing if clicked.
|
||||
getSettingsButton().onclick = function(event) {
|
||||
getSettingsButton().onclick = event => {
|
||||
event.preventDefault();
|
||||
};
|
||||
} else {
|
||||
// We replace the existing "onclick" callback.
|
||||
const settingsButton = getSettingsButton();
|
||||
const settingsMenu = document.getElementById("settings");
|
||||
settingsButton.onclick = function(event) {
|
||||
settingsButton.onclick = event => {
|
||||
if (elemIsInParent(event.target, settingsMenu)) {
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user