mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-20 02:43:45 +00:00
Rollup merge of #96635 - GuillaumeGomez:js-script-mode, r=notriddle
Use "strict" mode in JS scripts Part of #93058. r? `@notriddle`
This commit is contained in:
commit
9520641e2a
@ -7,6 +7,8 @@
|
||||
/* global onEach, onEachLazy, removeClass */
|
||||
/* global switchTheme, useSystemTheme */
|
||||
|
||||
"use strict";
|
||||
|
||||
if (!String.prototype.startsWith) {
|
||||
String.prototype.startsWith = function(searchString, position) {
|
||||
position = position || 0;
|
||||
@ -292,15 +294,12 @@ function loadCss(cssFileName) {
|
||||
}
|
||||
|
||||
(function() {
|
||||
"use strict";
|
||||
|
||||
function loadScript(url) {
|
||||
const script = document.createElement('script');
|
||||
script.src = url;
|
||||
document.head.append(script);
|
||||
}
|
||||
|
||||
|
||||
getSettingsButton().onclick = event => {
|
||||
event.preventDefault();
|
||||
loadScript(window.settingsJS);
|
||||
|
@ -4,6 +4,8 @@
|
||||
/* eslint prefer-arrow-callback: "error" */
|
||||
/* global addClass, hasClass, removeClass, onEachLazy */
|
||||
|
||||
"use strict";
|
||||
|
||||
(function () {
|
||||
// Number of lines shown when code viewer is not expanded
|
||||
const MAX_LINES = 10;
|
||||
|
@ -5,7 +5,9 @@
|
||||
/* global addClass, getNakedUrl, getSettingValue, hasOwnPropertyRustdoc, initSearch, onEach */
|
||||
/* global onEachLazy, removeClass, searchState, browserSupportsHistoryApi */
|
||||
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
(function() {
|
||||
// This mapping table should match the discriminants of
|
||||
// `rustdoc::formats::item_type::ItemType` type in Rust.
|
||||
const itemTypes = [
|
||||
|
@ -7,6 +7,8 @@
|
||||
/* global addClass, removeClass, onEach, onEachLazy, NOT_DISPLAYED_ID */
|
||||
/* global MAIN_ID, getVar, getSettingsButton, switchDisplayedElement, getNotDisplayedElem */
|
||||
|
||||
"use strict";
|
||||
|
||||
(function () {
|
||||
const isSettingsPage = window.location.pathname.endsWith("/settings.html");
|
||||
|
||||
|
@ -9,7 +9,10 @@
|
||||
// Local js definitions:
|
||||
/* global addClass, getCurrentValue, hasClass, onEachLazy, removeClass, browserSupportsHistoryApi */
|
||||
/* global updateLocalStorage */
|
||||
(function () {
|
||||
|
||||
"use strict";
|
||||
|
||||
(function() {
|
||||
|
||||
function getCurrentFilePath() {
|
||||
const parts = window.location.pathname.split("/");
|
||||
|
@ -3,6 +3,8 @@
|
||||
/* eslint prefer-const: "error" */
|
||||
/* eslint prefer-arrow-callback: "error" */
|
||||
|
||||
"use strict";
|
||||
|
||||
const darkThemes = ["dark", "ayu"];
|
||||
window.currentTheme = document.getElementById("themeStyle");
|
||||
window.mainTheme = document.getElementById("mainThemeStyle");
|
||||
|
Loading…
Reference in New Issue
Block a user