Skip to content

Commit

Permalink
Prettier workflow merging (#62)
Browse files Browse the repository at this point in the history
* Create main.yml

* Sample commit

* Update and rename main.yml to .github/workflows/main.yml

* Update and rename main.yml to prettify.yml

* Update prettify.yml

* Update the git command

* Prettified Code!

---------

Co-authored-by: adityaraute <[email protected]>
  • Loading branch information
adityaraute and adityaraute authored Dec 28, 2023
1 parent 6c3d953 commit b40482e
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 30 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/prettify.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
with:
dry: False
github_token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions activities.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang = "en">

<head>
<meta charset="UTF-8">
Expand Down Expand Up @@ -81,4 +81,4 @@ <h3>Activities</h3>
</body>
<script src="script/main.js"></script>

</html>
</html>
56 changes: 28 additions & 28 deletions script/main.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down Expand Up @@ -88,4 +88,4 @@ document.addEventListener("DOMContentLoaded", function () {
.catch(error => {
console.error("Error fetching data:", error);
});
});
});

0 comments on commit b40482e

Please sign in to comment.