Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
robertfrosty authored Sep 26, 2021
1 parent 4101091 commit ee15b73
Show file tree
Hide file tree
Showing 7 changed files with 167 additions and 0 deletions.
43 changes: 43 additions & 0 deletions ui/content.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
function extRun() {
chrome.storage.sync.get('mK', function(obj) {
if(obj['mK'] > 0) {
if(window.location.host == 'www.youtube.com'){
hideWatched();
document.getElementById('contents').setAttribute('async-inject-listener', 'true');
}else {
console.log('Not Youtube');
}
} else {
let toremove = document.getElementsByClassName('shift-yt-deleteme');
for(let i=toremove.length-1;i>=0;i--){toremove[i].style.display="initial";toremove[i].style.opacity="1";toremove[i].classList.remove('shift-yt-deleteme')};
let toremoven = document.getElementsByClassName('shift-yt-used');
for(let ii=toremoven.length-1;ii>=0;ii--){toremoven[ii].classList.remove('shift-yt-used')};
document.getElementById('contents').setAttribute('async-inject-listener', 'false');
}
});
}

chrome.storage.sync.get('mK', function(obj) {
if (obj['mK'] > 0) {
document.getElementById('hide_watched').checked = 'true';
}
});

document.getElementById('hide_watched').addEventListener('change', async() => {
let [tab] = await chrome.tabs.query({active:true,currentWindow:true});

chrome.storage.sync.get('mK', function(obj) {
if (typeof obj['mK'] == 'undefined' ) {
chrome.storage.sync.set({'mK':1});
}else if (obj['mK'] > 0) {
chrome.storage.sync.set({'mK':0});
}else if (obj['mK'] == 0){
chrome.storage.sync.set({'mK':1});
}
});

chrome.scripting.executeScript({
target:{tabId:tab.id},
function: extRun,
});
});
Binary file added ui/icons/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ui/icons/icon128px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ui/icons/icon2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ui/icons/icon3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions ui/options.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="theme.css">
</head>
<body>
<div class="ext_title"><img class="ext_logo" src="icons/icon128px.png"><span>Shift</span></div>
<div class="ext_labels">
<label class="ext_switch">
<input type="checkbox" id="hide_watched">
<span class="ext_slider"></span>
</label>
<span>Hide Watched Videos</span>
<script src="content.js"></script>
</div>
</body>
</html>
107 changes: 107 additions & 0 deletions ui/theme.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

html, body {
margin: 0;
font-family: 'VT323', monospace;
}

body {
width: 300px;
}

.ext_title {
padding: 2vw;
width: 100%;
background: #333333;
color: #FFFFFF;
font-size: 20vw;
font-weight: bold;
}

.ext_title img {
display: block;
margin: 0 auto;
height: 20vh;
width: auto;
background: #FFF;
border-radius: 50%;
padding: 10vh;
}

.ext_title span {
display: block;
color: #FFF;
text-align: center;
/* Gradient Text Setup
background: -webkit-linear-gradient(#2196F3, #72ADDB);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
*/
}

.ext_labels {
display: flex;
justify-content: center;
align-items: center;
padding: 5vw 0;
}

.ext_labels span {
font-size: 5vw;
padding: 0 5vw;
}

.ext_switch {
position: relative;
display: inline-block;
width: 60px;
height: 34px;
}

.ext_switch input {
opacity: 0;
width: 0;
height: 0;
}

/* Slider Track */
.ext_slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #CCCCCC;
border-radius: 34px;
-webkit-transition: .4s;
transition: .4s;
}

/* Slider Ball */
.ext_slider:before {
position: absolute;
content:"";
height: 26px;
width: 26px;
left: 4px;
bottom: 4px;
background: #FFFFFF;
border-radius: 50%;
-webkit-transition: .4s;
transition: .4s;
}

input:checked + .ext_slider {
background: #222;
}

input:focus + .ext_slider {
box-shadow: 0 0 1px #2196F3;
}

input:checked + .ext_slider:before {
-webkit-transform: translateX(26px);
-ms-transform: translateX(26px);
transform: translateX(26px);
}

0 comments on commit ee15b73

Please sign in to comment.