Skip to content

Commit a020c58

Browse files
authored
Merge pull request #96 from rajSaheel/patch-1
Pista Track (Chrome Extension) Project
2 parents 9a24ff3 + a734e78 commit a020c58

File tree

6 files changed

+187
-0
lines changed

6 files changed

+187
-0
lines changed

medium/Pista Track/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Pista-Track
2+
A chrome extension for saving leads and URLs
3+
4+
## Installation
5+
6+
Follow the following steps to install this chrome extension.
7+
1. Download the zip file of this repository.
8+
2. Extract the files.
9+
3. Open Chrome Browser and go to manage extensions.
10+
4. Click on Load Unpacked button in the top left corner.
11+
5. Now select the extracted folder and then you are good to go.
12+
13+
## Direction
14+
This extension can save the current tab URLs for future leads. You can manually save URLs in the input box. All the URLs will be saved in a list. You can also delete saved URLs by clicking Delete Button twice.

medium/Pista Track/app.js

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
let myLeads=[]
2+
const inputEl = document.getElementById("input-el")
3+
const inputBtn = document.getElementById("input-btn")
4+
const tabBtn = document.getElementById("tab-btn")
5+
const deleteBtn = document.getElementById("delete-btn")
6+
const ulEl = document.getElementById("ul-el")
7+
8+
let leadsFromLocal = JSON.parse(localStorage.getItem("myLeads"))
9+
10+
inputBtn.addEventListener("click", pushingLeads)
11+
inputEl.addEventListener("keydown", function(e){
12+
if(e.code==="Enter"){
13+
pushingLeads()
14+
}
15+
})
16+
17+
tabBtn.addEventListener("click",function() {
18+
chrome.tabs.query({active:true, currentWindow:true}, function(tabs){
19+
myLeads.push(tabs[0].url)
20+
pushingLeads()
21+
})
22+
})
23+
24+
deleteBtn.addEventListener("dblclick", deleteLeads)
25+
26+
function deleteLeads() {
27+
localStorage.clear("myLeads")
28+
myLeads = []
29+
renderLeads()
30+
}
31+
32+
if(leadsFromLocal){
33+
myLeads = leadsFromLocal
34+
renderLeads()
35+
}
36+
37+
function pushingLeads(){
38+
myLeads.push(inputEl.value)
39+
localStorage.setItem("myLeads", JSON.stringify(myLeads))
40+
inputEl.value=""
41+
renderLeads()
42+
}
43+
44+
function renderLeads(){
45+
let listItems = ""
46+
for(let i=0; i<myLeads.length; i++){
47+
listItems +=`
48+
<li>
49+
<a target='_blank' href='${myLeads[i]}'>
50+
${myLeads[i]}
51+
</a>
52+
</li>
53+
`
54+
}
55+
ulEl.innerHTML = listItems
56+
}

medium/Pista Track/icons.png

1.22 KB
Loading

medium/Pista Track/index.html

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<link rel="stylesheet" a href="styles.css">
8+
<title>Pista Track</title>
9+
</head>
10+
<body>
11+
<div class="input-container">
12+
<input type="text" id="input-el">
13+
</div>
14+
<div class="buttons-wrapper">
15+
<button id="input-btn">Save Input</button>
16+
<button id="tab-btn">Save Tab</button>
17+
<button id="delete-btn">Delete All</button>
18+
19+
</div>
20+
<p class="note"><i>"Delete All" button only works on double click</i></p>
21+
<div class="list-wrapper">
22+
<ul id="ul-el"></ul>
23+
</div>
24+
<script src="app.js"></script>
25+
</body>
26+
</html>
27+
28+
29+
30+
<!-- chrome-extension://lhonkbdmkkijjlegmmbdkchnmoegnnka/anything.com -->

medium/Pista Track/manifest.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"manifest_version": 3,
3+
"version": "1.1",
4+
"name": "Pista Track",
5+
"action": {
6+
"default_popup": "index.html",
7+
"default_icon": "icons.png"
8+
},
9+
"permissions": [
10+
"tabs"
11+
]
12+
}

medium/Pista Track/styles.css

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
*{
2+
min-width: 100px;
3+
padding: 0;
4+
margin: 0;
5+
box-sizing: border-box;
6+
font-family:Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;
7+
}
8+
9+
body{
10+
min-width: 354px;
11+
}
12+
13+
.input-container{
14+
margin: 10px;
15+
margin-bottom: 3px;
16+
}
17+
18+
input{
19+
min-width: 300px;
20+
width: 100%;
21+
padding: 6px 10px;
22+
border: 1px solid #cc790c;
23+
border-radius: 2px;
24+
font-size: 15px;
25+
}
26+
27+
input:focus{
28+
outline: none;
29+
border-color: #9e5e09;
30+
}
31+
32+
.buttons-wrapper{
33+
/* display: flex; */
34+
margin: 5px 10px;
35+
}
36+
37+
button{
38+
outline: none;
39+
letter-spacing: 1px;
40+
padding: 8px 16px;
41+
color: aliceblue;
42+
background-color: #cc790c;
43+
border: 1px solid;
44+
border-radius: 2px;
45+
font-size: 15px;
46+
font-weight: 800;
47+
}
48+
49+
#delete-btn{
50+
color: #cc790c;
51+
background-color: aliceblue;
52+
border: 1px solid #9e5e09;
53+
}
54+
55+
p {
56+
margin-left: 10px;
57+
font-size: 10px;
58+
}
59+
60+
.list-wrapper{
61+
margin: 20px 10px;
62+
}
63+
64+
ul{
65+
list-style: none;
66+
}
67+
68+
li{
69+
margin-top: 5px;
70+
font-size: 14px;
71+
}
72+
73+
li a {
74+
color: #9e5e09;
75+
}

0 commit comments

Comments
 (0)