Skip to content

Commit

Permalink
Merge pull request #77 from TheCoderAdi/main
Browse files Browse the repository at this point in the history
Fixed the pipeline issue
  • Loading branch information
DhanushNehru authored Oct 10, 2024
2 parents 4695095 + 32e8766 commit 5e003f1
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 16 deletions.
25 changes: 19 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
name: Lint

on: [push, pull_request]
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '16'

- name: Install dependencies
run: npm install
- name: Run ESLint
run: npx eslint .
- name: Run Stylelint
run: npx stylelint "**/*.css"

- name: Run lint
run: npm run lint
26 changes: 26 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix"
},
"devDependencies": {
"eslint": "^8.50.0",
"stylelint": "^15.10.0",
"stylelint-config-standard": "^30.0.0"
},
"eslintConfig": {
"env": {
"browser": true,
"es2021": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
},
"rules": {}
},
"stylelint": {
"extends": "stylelint-config-standard"
}
}
26 changes: 16 additions & 10 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ buttonDownload.addEventListener("click", function () {
});

const shareBtnPress = document.getElementById("shareBtn");
shareBtnPress.addEventListener("click", (elem) => {
shareBtnPress.addEventListener("click", () => {
const currElemStatus = document.getElementById("allOptions").style.display;
if (currElemStatus == "flex") {
document.getElementById("allOptions").style.display = "none";
Expand All @@ -27,6 +27,7 @@ shareBtnPress.addEventListener("click", (elem) => {
}
});

// eslint-disable-next-line no-unused-vars
function copyClipFun() {
navigator.clipboard.writeText("https://board-dhanushnehru.netlify.app/");
}
Expand Down Expand Up @@ -201,10 +202,10 @@ function blackBoard() {
let lastY = 0;

//functions
function startPosition(e) {
painting = true;
draw(e);
}
// function startPosition(e) {
// painting = true;
// draw(e);
// }

function endPosition() {
painting = false;
Expand Down Expand Up @@ -266,7 +267,7 @@ function blackBoard() {
canvas.addEventListener("touchmove", draw);
}

function pushCanvas() {
function pushCanvas(canvas) {
drawStep++;
if (drawStep === drawArray.length) {
const tempArray = drawArray.slice(0, drawArray.length);
Expand All @@ -277,18 +278,19 @@ function pushCanvas() {
}
}
// Save the canvas data URL to localStorage
function saveCanvas(email) {
function saveCanvas(email, canvas) {
localStorage.setItem(`myCanvas_${email}`, canvas.toDataURL());
}

// eslint-disable-next-line no-unused-vars
function onClear() {
const canvas = document.getElementById("black-board");
const context = canvas.getContext("2d");

context.clearRect(0, 0, canvas.width, canvas.height);
localStorage.setItem(`myCanvas_${email}`, null);
pushCanvas();
saveCanvas(email);
pushCanvas(canvas);
saveCanvas(email, canvas);
}

function loadCanvas(email) {
Expand All @@ -307,6 +309,7 @@ function loadCanvas(email) {
}
}

// eslint-disable-next-line no-unused-vars
function onUndo() {
//function to undo the drawing
if (drawStep >= 0) {
Expand Down Expand Up @@ -348,6 +351,7 @@ window.addEventListener("beforeunload", function () {
});

// Function to handle sign-in response
// eslint-disable-next-line no-unused-vars
function handleCredentialResponse(response) {
if (response.credential) {
const result = parseJwt(response.credential);
Expand All @@ -373,11 +377,13 @@ function handleCredentialResponse(response) {
const signOutButton = document.getElementById("g_id_signout");
signOutButton.style.display = "block";
} else {
// eslint-disable-next-line no-undef
google.accounts.id.prompt();
}
}

// Function to handle sign-out
// eslint-disable-next-line no-unused-vars
function signOut() {
// Clear the username
const userNameElement = document.getElementById("g_id_user");
Expand Down Expand Up @@ -452,7 +458,7 @@ function loadConfig() {
var client_id = config.client_id;
var element = document.getElementById("g_id_onload");
console.log(element);
element.setAttribute("data-client_id",client_id)
element.setAttribute("data-client_id", client_id)
})
.catch((error) => console.error("Error loading configuration:", error));
}
Expand Down

0 comments on commit 5e003f1

Please sign in to comment.