Reduced scope of some variables and made others const.

This commit is contained in:
tastytea 2019-06-06 02:16:00 +02:00
parent 10eadad621
commit bf9f303204
Signed by untrusted user: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 4 additions and 4 deletions

View File

@ -26,7 +26,7 @@ function toggle()
{ {
continue; continue;
} }
var style = status.getAttribute("style"); const style = status.getAttribute("style");
if (style.search("none") > -1) if (style.search("none") > -1)
{ {
style = style.replace("none", "block"); style = style.replace("none", "block");
@ -43,7 +43,7 @@ function toggle()
function add_button() function add_button()
{ {
// If there is no element named “column-1”, use the footer. // If there is no element named “column-1”, use the footer.
var root = document.getElementsByClassName("column-1")[0]; let root = document.getElementsByClassName("column-1")[0];
if (root === undefined) if (root === undefined)
{ {
root = document.getElementsByClassName("footer")[0]; root = document.getElementsByClassName("footer")[0];
@ -55,13 +55,13 @@ function add_button()
} }
// Create a div, necessary to get the correct styling for the button. // Create a div, necessary to get the correct styling for the button.
var div = document.createElement("div"); const div = document.createElement("div");
div.setAttribute("id", "global-cw-toggle"); div.setAttribute("id", "global-cw-toggle");
div.setAttribute("class", "status__content"); div.setAttribute("class", "status__content");
div.setAttribute("style", "margin-bottom: 0.5em;"); div.setAttribute("style", "margin-bottom: 0.5em;");
// Create the button. // Create the button.
var button = document.createElement("a"); const button = document.createElement("a");
button.setAttribute("class", "status__content__spoiler-link"); button.setAttribute("class", "status__content__spoiler-link");
button.appendChild(document.createTextNode("Toggle all CWs")); button.appendChild(document.createTextNode("Toggle all CWs"));