Skip to content

Commit

Permalink
Merge pull request #4 from Daily-Quotes/dev
Browse files Browse the repository at this point in the history
v1.1
  • Loading branch information
JoseNaime committed Aug 19, 2021
2 parents 96c6de9 + 022864a commit 279086b
Show file tree
Hide file tree
Showing 21 changed files with 931 additions and 79 deletions.
2 changes: 2 additions & 0 deletions .idea/Quotes_Web_Extension.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/jsLibraryMappings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Quotes-Extension.zip
Binary file not shown.
Empty file.
9 changes: 9 additions & 0 deletions browser-extension/Icons/Quotes_logo.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
97 changes: 97 additions & 0 deletions browser-extension/Popup/popup-style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
h1, h5 {
margin : 0;
}

a {
text-decoration : underline;
}

body {
border-radius : 15px;
width : 270px;
margin : 45px;
}

p {
margin : 0;
font-size : 1.2em;
}

h1 {
font-size : 2.7em;
}

h3 {
font-size : 1.6em;
margin-bottom : 10px;
}

h5 {
margin : auto;
font-size : 1.05em;
text-align : center;
}

.inline-flex {
display : inline-flex;
}

.horizontal-flex {
display : flex;
flex-direction : column;
}

.space-around {
display : flex;
justify-content : space-around;
}

#configuration-sections > div{
margin: 3em 0;
}

#colors-list {
padding : 0;
margin : 0.5em auto;
width : 100%;
justify-content : space-between;
list-style : none;
display : inline-flex;
}

#colors-list li button {
box-shadow : inset 0 2px 1px rgba(255, 255, 255, 0.2);
height : 20px;
width : 20px;
border : none;
border-radius : 15px;
transition : all 0.5s;
}
#colors-list li button:hover {
transform : scale(1.2);
}

#colors-list li button.active {
transform : scale(1.3);
}

#buy-me-a-coffee img {
position : relative;
left : 50%;
transform : translateX(-50%);
height : 40px;
}

#font-selector {
display : inline
}

#current-font-container {
width : 70%;
}

#current-font{
font-size: 1.4em;
text-align: center;
}

65 changes: 60 additions & 5 deletions browser-extension/Popup/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,66 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="popup-style.css" >
<title>Title</title>
<title>Quotes Popup</title>

<link href="./../styles/colors.css" rel="stylesheet">
<link href="./../styles/fonts.css" rel="stylesheet">
<link href="popup-style.css" rel="stylesheet">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script crossorigin="anonymous" src="https://kit.fontawesome.com/356ff97aca.js"></script>
</head>
<body>
<h1>Popup</h1>
<script src="popup.js"></script>
<body class="f-source-code-pro dark-background-color white-color dynamic-font">
<h1>Configuration</h1>
<p class="gray-color">All changes will apply to <b class="dynamic-color">new tabs</b></p>

<div id="configuration-sections">
<div>
<div id="highlight-colors">
<h3>Highlight Color</h3>
<ul id="colors-list">
<li>
<button class="red-background-color" id="set-red-button" value="red"></button>
</li>
<li>
<button class="orange-background-color" id="set-orange-button" value="orange"></button>
</li>
<li>
<button class="yellow-background-color" id="set-yellow-button" value="yellow"></button>
</li>
<li>
<button class="green-background-color" id="set-green-button" value="green"></button>
</li>
<li>
<button class="blue-background-color" id="set-blue-button" value="blue"></button>
</li>
<li>
<button class="purple-background-color" id="set-purple-button" value="purple"></button>
</li>
</ul>
</div>
</div>
<div>
<div id="font-selector">
<h3>Font</h3>
<div class="inline-flex horizontal-align space-around">
<i id="prev-font" class="fas fa-chevron-left fa-2x"></i>
<div id="current-font-container">
<p id="current-font" class="dynamic-font">Font</p>
</div>
<i id="next-font" class="fas fa-chevron-right fa-2x"></i>
</div>
</div>
</div>
</div>

<a id="buy-me-a-coffee" href="https://www.buymeacoffee.com/JoseNaime" target="_blank">
<img src="https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=&slug=JoseNaime&button_colour=FFDD00&font_colour=000000&font_family=Lato&outline_colour=000000&coffee_colour=ffffff"
alt="Buy me a coffee Jose Naime">
</a>
<h5 class="light-gray-color">Developed by: <a class="dynamic-color">Jose Naime</a></h5>

<script src="../storage.js" type="text/javascript"></script>
<script src="popup.js" type="text/javascript"></script>
</body>
</html>
84 changes: 84 additions & 0 deletions browser-extension/Popup/popup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
//
//------- Color Buttons --------
//

getStoredHighlightColorPopup()

const handleColorClick = (e) => {
const selectedColor = e.target.value;

// Restore all buttons
colorButtons.map(colorButton => {
if (colorButton.hasClass("active")) {
colorButton.removeClass("active")
}
})

// Check if selectedColor isn't the current color
if ($(`#set-${selectedColor}-button`).hasClass("active") !== true) {
// If not, set as current color
$(`#set-${selectedColor}-button`).addClass("active");

// Set selected color to elements with class "dynamic-color"
$(".dynamic-color").css("color", `var(--${selectedColor})`);

// Save new color to storage
chrome.storage.sync.set({highlightColor: selectedColor}, function () {
console.log('highlightColor is set to ' + selectedColor);
});
}
}

colorButtons.map(colorButton => {
colorButton.click(handleColorClick);
})

//
//------- Font Change --------
//
getStoredFontIndex();

$(function handleNextFontClick () {
$('#next-font').on('click', () => {
// Check if savedFontIndex is not the last element if so, reset to 0
if (savedFontIndex < fontsNames.length - 1){
savedFontIndex++;
}else{
savedFontIndex = 0
}

// Save savedFontIndex into chrome
chrome.storage.sync.set({fontIndex: savedFontIndex}, function () {
console.log('fontIndex is set to ' + savedFontIndex);
});

$(".dynamic-font").css("font-family", `${fontsNames[savedFontIndex]}`);

const currentFontElement = $("#current-font")
currentFontElement.css("font-family", `${fontsNames[savedFontIndex]}`);
currentFontElement.text(fontsNames[savedFontIndex])
})
})

$(function handlePrevFontClick () {
$('#prev-font').on('click', () => {
// Check if savedFontIndex is not the last element if so, reset to 0
if (savedFontIndex > 0){
savedFontIndex--;
}else{
savedFontIndex = fontsNames.length - 1;
}

// Save savedFontIndex into chrome
chrome.storage.sync.set({fontIndex: savedFontIndex}, function () {
console.log('fontIndex is set to ' + savedFontIndex);
});

$(".dynamic-font").css("font-family", `${fontsNames[savedFontIndex]}`);

const currentFontElement = $("#current-font")
currentFontElement.css("font-family", `${fontsNames[savedFontIndex]}`);
currentFontElement.text(fontsNames[savedFontIndex])
})
})

Binary file added browser-extension/Quotes128.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added browser-extension/Quotes16.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added browser-extension/Quotes48.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 0 additions & 42 deletions browser-extension/colors.css

This file was deleted.

0 comments on commit 279086b

Please sign in to comment.