Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bf09456

Browse files
committed
Remove semicolons
1 parent cba2bd8 commit bf09456

File tree

3 files changed

+40
-40
lines changed

3 files changed

+40
-40
lines changed

python_docs_theme/static/copybutton.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ const loadCopyButton = () => {
33
/* Add a [>>>] button on the top-right corner of code samples to hide
44
* the >>> and ... prompts and the output and thus make the code
55
* copyable. */
6-
const hide_text = 'Hide the prompts and output';
7-
const show_text = 'Show the prompts and output';
6+
const hide_text = 'Hide the prompts and output'
7+
const show_text = 'Show the prompts and output'
88

99
const button = document.createElement("span")
1010
button.classList.add("copybutton")
@@ -13,19 +13,19 @@ const loadCopyButton = () => {
1313
button.dataset.hidden = false
1414
const buttonClick = event => {
1515
// define the behavior of the button when it's clicked
16-
event.preventDefault();
16+
event.preventDefault()
1717
const buttonEl = event.currentTarget
1818
const codeEl = buttonEl.nextElementSibling
1919
if (buttonEl.dataset.hidden === 'false') {
2020
// hide the code output
2121
codeEl.querySelectorAll('.go, .gp, .gt').forEach(el => el.hidden = true)
2222
codeEl.querySelectorAll('.gt').forEach(el => {
2323
while ((el = el.nextSibling) && el.nodeType !== Node.DOCUMENT_NODE) {
24-
if (el.nodeType === Node.ELEMENT_NODE && el.matches(".gp, .go")) break;
24+
if (el.nodeType === Node.ELEMENT_NODE && el.matches(".gp, .go")) break
2525
if (el.nodeType === Node.TEXT_NODE && el.textContent.trim()) {
26-
const wrapper = document.createElement('span');
27-
el.after(wrapper);
28-
wrapper.appendChild(el);
26+
const wrapper = document.createElement('span')
27+
el.after(wrapper)
28+
wrapper.appendChild(el)
2929
el = wrapper
3030
}
3131
el.hidden = true
@@ -46,7 +46,7 @@ const loadCopyButton = () => {
4646
'.highlight-python3 .highlight,' +
4747
'.highlight-pycon .highlight,' +
4848
'.highlight-pycon3 .highlight,' +
49-
'.highlight-default .highlight');
49+
'.highlight-default .highlight')
5050

5151
// create and add the button to all the code blocks that contain >>>
5252
highlightedElements.forEach(el => {
@@ -55,8 +55,8 @@ const loadCopyButton = () => {
5555
// if we find a console prompt (.gp), prepend the (deeply cloned) button
5656
const clonedButton = button.cloneNode(true)
5757
clonedButton.onclick = buttonClick // onclick isn't cloned :(
58-
if (el.querySelector(".gp") !== null) el.prepend(clonedButton);
59-
});
58+
if (el.querySelector(".gp") !== null) el.prepend(clonedButton)
59+
})
6060
}
6161

6262
if (document.readyState !== "loading") loadCopyButton()

python_docs_theme/static/menu.js

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
11
document.addEventListener('DOMContentLoaded', function () {
22

33
// Make tables responsive by wrapping them in a div and making them scrollable
4-
const tables = document.querySelectorAll('table.docutils');
4+
const tables = document.querySelectorAll('table.docutils')
55
tables.forEach(function(table){
66
table.outerHTML = '<div class="responsive-table__container">' + table.outerHTML + '</div>'
7-
});
7+
})
88

9-
const togglerInput = document.querySelector('.toggler__input');
10-
const togglerLabel = document.querySelector('.toggler__label');
11-
const sideMenu = document.querySelector('.menu-wrapper');
9+
const togglerInput = document.querySelector('.toggler__input')
10+
const togglerLabel = document.querySelector('.toggler__label')
11+
const sideMenu = document.querySelector('.menu-wrapper')
1212
const menuItems = document.querySelectorAll('.menu')
13-
const doc = document.querySelector('.document');
14-
const body = document.querySelector('body');
13+
const doc = document.querySelector('.document')
14+
const body = document.querySelector('body')
1515

1616
function closeMenu() {
17-
togglerInput.checked = false;
18-
sideMenu.setAttribute("aria-expanded", 'false');
19-
sideMenu.setAttribute('aria-hidden', 'true');
20-
togglerLabel.setAttribute('aria-pressed', 'false');
21-
body.style.overflow = 'visible';
17+
togglerInput.checked = false
18+
sideMenu.setAttribute("aria-expanded", 'false')
19+
sideMenu.setAttribute('aria-hidden', 'true')
20+
togglerLabel.setAttribute('aria-pressed', 'false')
21+
body.style.overflow = 'visible'
2222
}
2323
function openMenu() {
24-
togglerInput.checked = true;
25-
sideMenu.setAttribute("aria-expanded", 'true');
26-
sideMenu.setAttribute('aria-hidden', 'false');
27-
togglerLabel.setAttribute('aria-pressed', 'true');
28-
body.style.overflow = 'hidden';
24+
togglerInput.checked = true
25+
sideMenu.setAttribute("aria-expanded", 'true')
26+
sideMenu.setAttribute('aria-hidden', 'false')
27+
togglerLabel.setAttribute('aria-pressed', 'true')
28+
body.style.overflow = 'hidden'
2929
}
3030

3131
// Close menu when link on the sideMenu is clicked
3232
sideMenu.addEventListener('click', function (event) {
33-
let target = event.target;
34-
if (target.tagName.toLowerCase() !== 'a') return;
35-
closeMenu();
33+
let target = event.target
34+
if (target.tagName.toLowerCase() !== 'a') return
35+
closeMenu()
3636
})
3737
// Add accessibility data when sideMenu is opened/closed
3838
togglerInput.addEventListener('change', function (e) {
39-
togglerInput.checked ? openMenu() : closeMenu();
40-
});
39+
togglerInput.checked ? openMenu() : closeMenu()
40+
})
4141
// Make sideMenu links tabbable only when visible
4242
for(let menuItem of menuItems) {
4343
if(togglerInput.checked) {
44-
menuItem.setAttribute('tabindex', '0');
44+
menuItem.setAttribute('tabindex', '0')
4545
} else {
46-
menuItem.setAttribute('tabindex', '-1');
46+
menuItem.setAttribute('tabindex', '-1')
4747
}
4848
}
4949
// Close sideMenu when document body is clicked
5050
doc.addEventListener('click', function () {
5151
if (togglerInput.checked) {
52-
closeMenu();
52+
closeMenu()
5353
}
5454
})
5555
})

python_docs_theme/static/sidebar.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ const initialiseSidebar = () => {
3333
const sidebarButton = document.getElementById("sidebarbutton")
3434
const sidebarArrow = sidebarButton.querySelector('span')
3535

36-
// for some reason, the document has no sidebar; do not run into errors
37-
if (typeof sidebar === "undefined") return;
36+
// for some reason, the document has no sidebar do not run into errors
37+
if (typeof sidebar === "undefined") return
3838

3939
const flipArrow = element => element.innerText = (element.innerText === "»") ? "«" : "»"
4040

4141
const collapse_sidebar = () => {
42-
bodyWrapper.style.marginLeft = ".8em";
42+
bodyWrapper.style.marginLeft = ".8em"
4343
sidebar.style.width = ".8em"
4444
sidebarWrapper.style.display = "none"
4545
flipArrow(sidebarArrow)
@@ -62,8 +62,8 @@ const initialiseSidebar = () => {
6262

6363
if (!window.localStorage.getItem("sidebar")) return
6464
const value = window.localStorage.getItem("sidebar")
65-
if (value === "collapsed") collapse_sidebar();
66-
else if (value === "expanded") expand_sidebar();
65+
if (value === "collapsed") collapse_sidebar()
66+
else if (value === "expanded") expand_sidebar()
6767
}
6868

6969
if (document.readyState !== "loading") initialiseSidebar()

0 commit comments

Comments
 (0)