Skip to content

Commit

Permalink
Merge branch 'main' into prajwal_branch
Browse files Browse the repository at this point in the history
  • Loading branch information
seths10 authored Oct 31, 2022
2 parents 7489887 + c6ef9ec commit 9d3ca7d
Show file tree
Hide file tree
Showing 13 changed files with 8,880 additions and 125 deletions.
15 changes: 15 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"env": {
"browser": true,
"commonjs": true,
"es2021": true
},
"extends": "airbnb",
"overrides": [
],
"parserOptions": {
"ecmaVersion": "latest"
},
"rules": {
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no-install commitlint --edit "$1"
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run lint:fix
4 changes: 4 additions & 0 deletions .husky/prepare-commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

exec < /dev/tty && npx git-cz --hook || true
13 changes: 3 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
## Quotes-Generator

This is a website for generating random quotes which can be tweeted.
This is a website for generating random quotes which can be tweeted. It uses basic HTML, CSS, and JS with a few helpful packages.

This is a website for generating random quotes which can be tweeted.
Using basic HTML,CSS,JS with a few helpful packages
The `generate button` picks text and authors out of a list of quotes from quote.js. The `tweet this` button redirects you to tweet text box url with the quote you generated. The `copy qoute` action basically copies the current quote.

The generate button picks text and author out of a list of quotes from quote.js

The tweet this. redirect you to tweet text box url with the quote you generated

copy qoute basically copies the current quote

the download button uses the package [npm-text-image](https://www.npmjs.com/package/text-image) to capture and format the quote to image/png and saves it to your local storage.
The download button uses the package [npm-text-image](https://www.npmjs.com/package/text-image) to capture and format the quote to image/png and saves it to your local storage.

Please give this project a star 🌟 and don't forget to follow me 😊.

Expand Down
1 change: 1 addition & 0 deletions icons/clipboard.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/cogs.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
215 changes: 109 additions & 106 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,113 +1,116 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Quotes Generator</title>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.10.2/css/all.min.css"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="icons/favicon-32x32.png"
/>
<link rel="stylesheet" href="styles/style.css" />
<link rel="stylesheet" href="styles/popup.css" />
<script src="https://cdn.jsdelivr.net/npm/text-image/dist/text-image.js"></script>
</head>
<body>
<div id="mode">
<i class="far fa-lightbulb" id="modeIcon"></i>
<p id="modeText">Light Mode</p>
</div>
<div class="container">
<div class="header">
<h2>Quote Generator</h2>
</div>
<head>
<meta charset="UTF-8" />
<title>Quotes Generator</title>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.10.2/css/all.min.css"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="icons/favicon-32x32.png"
/>
<link rel="stylesheet" href="styles/style.css" />
<link rel="stylesheet" href="styles/popup.css" />
<script src="https://cdn.jsdelivr.net/npm/text-image/dist/text-image.js"></script>
</head>
<body>
<div id="mode">
<i class="far fa-lightbulb" id="modeIcon"></i>
<p id="modeText">Light Mode</p>
</div>
<div class="container">
<div class="header">
<h2>Quote Generator</h2>
</div>

<div class="main-content">
<div class="text-area">
<span class="quote"
>"Life is what happens when you're busy making other plans"</span
>
</div>
<div class="main-content">
<div class="text-area">
<span class="quote"
>"Life is what happens when you're busy making other plans"</span
>
</div>

<div class="writer">-John Lennon</div>
<div class="writer">-John Lennon</div>

<div class="button-area">
<div>
<button id="Qbtn" class="allBtn">Generate</button>
<button id="Tbtn" class="allBtn" title="Tweet This!">
<i class="fab fa-twitter"></i>
Tweet This
</button>
<button id="Cbtn" class="allBtn" title="Copy This!">
<i class="fas fa-clipboard"></i>
Copy to Clipboard
</button>
</div>
<div>
<button
id="Cbtn"
class="allBtn"
title="Download This!"
onclick="downloadImage()"
>
<i class="fas fa-clipboard"></i>
Download Image
</button>
</div>
</div>
</div>
</div>
<div class="container-bot">
<div id="snackbar">Copied to clipboard</div>
</div>
<div class="button-area">
<div class="button-container">
<button id="Qbtn" class="allBtn">
<i class="fas fa-cogs"></i>
Generate
</button>
<button id="Tbtn" class="allBtn" title="Tweet This!">
<i class="fab fa-twitter"></i>
Tweet This
</button>
<button id="Cbtn" class="allBtn" title="Copy This!">
<i class="fas fa-clipboard"></i>
Copy to Clipboard
</button>
</div>
<div>
<button
id="Cbtn"
class="allBtn"
title="Download This!"
onclick="downloadImage()"
>
<i class="fas fa-clipboard"></i>
Download Image
</button>
</div>
</div>
</div>
</div>
<div class="container-bot">
<div id="snackbar">Copied to clipboard</div>
</div>

<script src="js/quotes.js"></script>
<script src="js/script.js"></script>
<script>
const downloadImage = () => {
let text = document.querySelector('.quote').innerText;
let writer = String(document.querySelector('.writer').innerText);
// Add a line break after 10 words
let words = text.split(' ');
if (words.length > 10) {
let newWords = [];
let line = '';
for (let i = 0; i < words.length; i++) {
if (i % 10 === 0 && i !== 0) {
newWords.push(line);
line = '';
}
line += words[i] + ' ';
}
newWords.push(line);
text = newWords.join('\n');
}
var style = {
font: "'Helvetica Neue'",
align: 'center',
color: 'rgba(0, 0, 0, 1)',
size: 16,
background: 'rgba(255, 255, 255, 1)',
stroke: 0,
strokeColor: 'rgba(0, 0, 255, 1)',
lineHeight: '1.6em',
bold: false,
italic: false,
};
var textImage = TextImage(style);
var data = textImage.toDataURL(text + '\n' + writer, 'image/png', 0.8);
var link = document.createElement('a');
link.download = `${writer
.substring(1, writer.length)
.toLowerCase()}-quote.png`;
link.href = data;
link.click();
};
</script>
</body>
<script src="js/quotes.js"></script>
<script src="js/script.js"></script>
<script>
const downloadImage = () => {
let text = document.querySelector(".quote").innerText;
let writer = String(document.querySelector(".writer").innerText);
// Add a line break after 10 words
let words = text.split(" ");
if (words.length > 10) {
let newWords = [];
let line = "";
for (let i = 0; i < words.length; i++) {
if (i % 10 === 0 && i !== 0) {
newWords.push(line);
line = "";
}
line += words[i] + " ";
}
newWords.push(line);
text = newWords.join("\n");
}
var style = {
font: "'Helvetica Neue'",
align: "center",
color: "rgba(0, 0, 0, 1)",
size: 16,
background: "rgba(255, 255, 255, 1)",
stroke: 0,
strokeColor: "rgba(0, 0, 255, 1)",
lineHeight: "1.6em",
bold: false,
italic: false,
};
var textImage = TextImage(style);
var data = textImage.toDataURL(text + "\n" + writer, "image/png", 0.8);
var link = document.createElement("a");
link.download = `${writer
.substring(1, writer.length)
.toLowerCase()}-quote.png`;
link.href = data;
link.click();
};
</script>
</body>
</html>
Loading

0 comments on commit 9d3ca7d

Please sign in to comment.