diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000000..15f48196d6 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,18 @@ +{ + "env": { + "browser": true, + "es2021": true, + "node": true + }, + "extends": "eslint:recommended", + "parserOptions": { + "ecmaVersion": "latest", + "sourceType": "module" + }, + "rules": { + "no-mixed-spaces-and-tabs": "off", + "no-unused-vars": "off", + "no-extra-semi": "off", + "no-prototype-builtins": "off" + } +} diff --git a/.github/workflows/lint-js.yml b/.github/workflows/lint-js.yml new file mode 100644 index 0000000000..7bfdf9f54a --- /dev/null +++ b/.github/workflows/lint-js.yml @@ -0,0 +1,33 @@ +name: Lint JS + + +on: + pull_request: + # branches: [gh-pages] + push: + # branches: [gh-pages] + +jobs: + build: + name: Lint JS + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v3 + with: + # Full git history is needed to get a proper list of changed files within `super-linter` + fetch-depth: 0 + + # Run Linter against code base # + - name: Lint JS + uses: github/super-linter@v5.0.0 + env: + VALIDATE_ALL_CODEBASE: false + DEFAULT_BRANCH: gh-pages + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + + LINTER_RULES_PATH: / + JAVASCRIPT_ES_CONFIG_FILE: .eslintrc.json + VALIDATE_JAVASCRIPT_ES: true diff --git a/assets/js/hamburger-nav.js b/assets/js/hamburger-nav.js index 57689b428a..b0680527c6 100644 --- a/assets/js/hamburger-nav.js +++ b/assets/js/hamburger-nav.js @@ -1,10 +1,14 @@ ---- -title: hamburger nav file ---- +// --- +// title: hamburger nav file +// --- //Retrieve svg string from _includes - const burgerImage = `{% include svg/icon-hamburger-nav.svg %}` ; - const burgerImageX = `{% include svg/icon-hamburger-nav-x.svg %}` ; +// const burgerImage = `{% include svg/icon-hamburger-nav.svg %}` ; +// const burgerImageX = `{% include svg/icon-hamburger-nav-x.svg %}` ; + +var parser = new DOMParser(); +var burgerImage = parser.parseFromString(window.burgerImage, "image/svg+xml").documentElement; +var burgerImageX = parser.parseFromString(window.burgerImageX, "image/svg+xml").documentElement; document.querySelector('#burgerImage').addEventListener('click',toggleNavDisplay); @@ -14,7 +18,7 @@ function toggleNavDisplay(){ swapIcons(this.firstElementChild.id); document.querySelector('#headerNav').style.display == 'flex' ? document.querySelector('#headerNav').style.display = 'none': document.querySelector('#headerNav').style.display = 'flex'; - + } @@ -30,7 +34,7 @@ function swapIcons(icon_id){ //insert opposite icon document.querySelector(`#burgerImage`).insertAdjacentHTML('afterbegin',hamburger[icon_id].opposite); - + } diff --git a/assets/js/hamburger-nav.liquid b/assets/js/hamburger-nav.liquid new file mode 100644 index 0000000000..f932335a66 --- /dev/null +++ b/assets/js/hamburger-nav.liquid @@ -0,0 +1,14 @@ +--- +title: hamburger nav file +--- + +{% assign burgerImage = include svg/icon-hamburger-nav.svg %} +{% assign burgerImageX = include svg/icon-hamburger-nav-x.svg %} + + + + diff --git a/assets/js/wins.js b/assets/js/wins.js index 994ae5e5a2..c0d2a57cbb 100644 --- a/assets/js/wins.js +++ b/assets/js/wins.js @@ -1,6 +1,6 @@ ---- +// --- ---- +// --- //assigning the google form questions to variables for readability //these variables correspond with a question on the google form //these variables can be used as a key to access the data @@ -39,9 +39,10 @@ } function main() { - {% assign localData = site.data.external._wins-data %} + // {% assign localData = site.data.external._wins-data %} // Escapes JSON for injections. See: #2134. If this is no longer the case, perform necessary edits, and remove this comment - const cardData = JSON.parse(decodeURIComponent("{{ localData | jsonify | uri_escape }}")); + // const cardData = JSON.parse(decodeURIComponent("{{ localData | jsonify | uri_escape }}")); + const cardData = window.localData; window.localStorage.setItem('data', JSON.stringify(cardData)); makeCards(cardData); ifPageEmpty(); @@ -280,10 +281,10 @@ } function makeCards(data) { - {% assign githubData = site.data.external.github-data %} + // {% assign githubData = site.data.external.github-data %} // Escapes JSON for injections. See: #2134. If this is no longer the case, perform necessary edits, and remove this comment. - let githubData = JSON.parse(decodeURIComponent("{{ githubData | jsonify | uri_escape }}")); - + // let githubData = JSON.parse(decodeURIComponent("{{ githubData | jsonify | uri_escape }}")); + const githubData = window.githubData; const cards = data.reverse(); const cardTemplate = document.getElementById("wins-card-template"); const QUOTE_ICON_PATH = '/assets/images/wins-page/quote-icon.svg' @@ -311,7 +312,7 @@ AVATAR_DEFAULT_PATH; cloneCardTemplate.querySelector('.wins-card-profile-img').src = profileImgSrc; - cloneCardTemplate.querySelector('.wins-card-profile-img').id = `ghImg-${index}`; + cloneCardTemplate.querySelector('.wins-card-profile-img').id = `ghImg-${index}`; cloneCardTemplate.querySelector('.wins-card-profile-img').alt = `photograph of ${card[name]}`; cloneCardTemplate.querySelector('.wins-card-big-quote').src = QUOTE_ICON_PATH; @@ -321,10 +322,10 @@ if (card[linkedin_url].length > 0) { cloneCardTemplate.querySelector('.wins-card-linkedin-icon').href = card[linkedin_url]; cloneCardTemplate.querySelector('.linkedin-icon').src = LINKEDIN_ICON ; - cloneCardTemplate.querySelector('.linkedin-icon').alt = `LinkedIn profile for ${card[name]}`; + cloneCardTemplate.querySelector('.linkedin-icon').alt = `LinkedIn profile for ${card[name]}`; } else { cloneCardTemplate.querySelector('.wins-card-linkedin-icon').setAttribute('hidden', 'true') - }; + } if (card[github_url].length > 0){ cloneCardTemplate.querySelector('.wins-card-github-icon').href = card[github_url]; @@ -528,4 +529,3 @@ function changeSeeMoreBtn(x) { main(); changeSeeMoreBtn(x); - diff --git a/assets/js/wins.liquid b/assets/js/wins.liquid new file mode 100644 index 0000000000..97bb48e338 --- /dev/null +++ b/assets/js/wins.liquid @@ -0,0 +1,11 @@ +--- +--- + + + + +