diff --git a/.github/workflows/prettify.yml b/.github/workflows/prettify.yml new file mode 100644 index 0000000..cb3fe34 --- /dev/null +++ b/.github/workflows/prettify.yml @@ -0,0 +1,26 @@ +name: Prettier Action + +on: + push + +jobs: + prettier: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: ${{ github.head_ref }} + # Make sure the value of GITHUB_TOKEN will not be persisted in repo's config + persist-credentials: false + + - name: Commit URL + run: git remote set-url origin https://github-actions:${{github.token}}@github.com/rbjks/rbjks.github.io.git + + - name: Prettify code + uses: creyD/prettier_action@v4.3 + with: + dry: False + github_token: ${{ secrets.PERSONAL_GITHUB_TOKEN }} diff --git a/activities.html b/activities.html index ab97a5b..a7e7c74 100644 --- a/activities.html +++ b/activities.html @@ -1,5 +1,5 @@ - + @@ -81,4 +81,4 @@

Activities

- \ No newline at end of file + diff --git a/script/main.js b/script/main.js index 5f290e0..f577a89 100644 --- a/script/main.js +++ b/script/main.js @@ -1,45 +1,45 @@ -var prefLanguage = 'en'; +var prefLanguage = "en"; //https://stackoverflow.com/questions/16206322/how-to-get-js-variable-to-retain-value-after-page-refresh -var translateElements = document.querySelectorAll('.translate') -var htmlParent = document.querySelector('html') -var navbarlist = document.querySelector('#navbar ul.mobileNav') +var translateElements = document.querySelectorAll(".translate"); +var htmlParent = document.querySelector("html"); +var navbarlist = document.querySelector("#navbar ul.mobileNav"); //var englishElements = document.querySelectorAll('.translate') //var hindiElements = document.querySelectorAll('[lang = hi]') window.onload = () => { - console.log(prefLanguage); - if (prefLanguage != 'en') - changelanguage(); -} + console.log(prefLanguage); + if (prefLanguage != "en") changelanguage(); +}; function changelanguage() { - prefLanguage = prefLanguage == 'en' ? 'hi' : 'en'; - htmlParent.lang = prefLanguage; - translateElements.forEach(el => swap(el)); - /* - prefLanguage = lang; - if(prefLanguage == 'en'){ - makeEnglish(); - } - else{ - makeHindi(); - } - console.log('current pref ',lang) - */ + prefLanguage = prefLanguage == "en" ? "hi" : "en"; + htmlParent.lang = prefLanguage; + translateElements.forEach((el) => swap(el)); + /* + prefLanguage = lang; + if(prefLanguage == 'en'){ + makeEnglish(); + } + else{ + makeHindi(); + } + console.log('current pref ',lang) + */ + } function makeEnglish() { - //hindiElements.forEach(el => el.style.display = "none"); - //englishElements.forEach(el => el.style.display = "unset"); + //hindiElements.forEach(el => el.style.display = "none"); + //englishElements.forEach(el => el.style.display = "unset"); } function makeHindi() { - //hindiElements.forEach(el => el.style.display = "unset"); - //console.log(englishElements); - //englishElements.forEach(el => el.style.display = "none"); - //englishElements.forEach(el => swap(el)); + //hindiElements.forEach(el => el.style.display = "unset"); + //console.log(englishElements); + //englishElements.forEach(el => el.style.display = "none"); + //englishElements.forEach(el => swap(el)); } function swap(el) { @@ -88,4 +88,4 @@ document.addEventListener("DOMContentLoaded", function () { .catch(error => { console.error("Error fetching data:", error); }); -}); \ No newline at end of file +});