📝 Added entire config directory for backup purposes
|
|
@ -0,0 +1,53 @@
|
|||
{
|
||||
"considerDonating": {
|
||||
"message": "The only thing that keeps the extension running is your donations, please consider supporting the project."
|
||||
},
|
||||
"customColors": {
|
||||
"message": "Custom colors for dislike bar and buttons"
|
||||
},
|
||||
"customNumberFormats": {
|
||||
"message": "Custom number formats"
|
||||
},
|
||||
"extensionDesc": {
|
||||
"message": "Returns ability to see dislikes"
|
||||
},
|
||||
"extensionName": {
|
||||
"message": "Return YouTube Dislike"
|
||||
},
|
||||
"legendSettings": {
|
||||
"message": "Settings"
|
||||
},
|
||||
"linkDonate": {
|
||||
"message": "Donate"
|
||||
},
|
||||
"linkFAQ": {
|
||||
"message": "FAQ"
|
||||
},
|
||||
"linkHelp": {
|
||||
"message": "Help"
|
||||
},
|
||||
"linkWebsite": {
|
||||
"message": "Website"
|
||||
},
|
||||
"shortsSupport": {
|
||||
"message": "YouTube Shorts Support"
|
||||
},
|
||||
"textDeveloper": {
|
||||
"message": "by Dmitry Selivanov & Community"
|
||||
},
|
||||
"textSettings": {
|
||||
"message": "Disable like/dislike submission"
|
||||
},
|
||||
"textSettingsHover": {
|
||||
"message": "Stops counting your likes and dislikes."
|
||||
},
|
||||
"textUpdate": {
|
||||
"message": "update to"
|
||||
},
|
||||
"version30installed": {
|
||||
"message": "Version 3.0.0.0 installed"
|
||||
},
|
||||
"whatsnew": {
|
||||
"message": "What's new"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"extensionDesc": {
|
||||
"message": "Regresa la posibilidad de ver los dislikes"
|
||||
},
|
||||
"extensionName": {
|
||||
"message": "Regresar los Dislikes de YouTube"
|
||||
},
|
||||
"legendSettings": {
|
||||
"message": "Ajustes"
|
||||
},
|
||||
"linkDonate": {
|
||||
"message": "Donar"
|
||||
},
|
||||
"linkFAQ": {
|
||||
"message": "P+F"
|
||||
},
|
||||
"linkHelp": {
|
||||
"message": "Ayuda"
|
||||
},
|
||||
"linkWebsite": {
|
||||
"message": "Página web"
|
||||
},
|
||||
"textDeveloper": {
|
||||
"message": "por Dmitry Selivanov y la Comunidad"
|
||||
},
|
||||
"textSettings": {
|
||||
"message": "Desactivar los dislikes"
|
||||
},
|
||||
"textSettingsHover": {
|
||||
"message": "Dejar de contar los dislikes."
|
||||
},
|
||||
"textUpdate": {
|
||||
"message": "actualizar a"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"extensionDesc": {
|
||||
"message": "Ré-affiche les pouces rouges/dislikes des vidées"
|
||||
},
|
||||
"extensionName": {
|
||||
"message": "Return YouTube Dislike"
|
||||
},
|
||||
"legendSettings": {
|
||||
"message": "Paramètres"
|
||||
},
|
||||
"linkDonate": {
|
||||
"message": "Faire un don"
|
||||
},
|
||||
"linkFAQ": {
|
||||
"message": "Questions fréquentes"
|
||||
},
|
||||
"linkHelp": {
|
||||
"message": "Aide"
|
||||
},
|
||||
"linkWebsite": {
|
||||
"message": "Site web"
|
||||
},
|
||||
"textDeveloper": {
|
||||
"message": "par Dmitry Selivanov & Communauté"
|
||||
},
|
||||
"textSettings": {
|
||||
"message": "Désactiver l'envoi des likes/dislikes"
|
||||
},
|
||||
"textSettingsHover": {
|
||||
"message": "Arrête de compter les likes et les dislikes mis sur les vidéos."
|
||||
},
|
||||
"textUpdate": {
|
||||
"message": "mettre à jour vers"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"extensionDesc": {
|
||||
"message": "A capacidade de ver os retornos de não gostos"
|
||||
},
|
||||
"extensionName": {
|
||||
"message": "Devolver Dislikes do YouTube"
|
||||
},
|
||||
"legendSettings": {
|
||||
"message": "Ajustes"
|
||||
},
|
||||
"linkDonate": {
|
||||
"message": "Doe"
|
||||
},
|
||||
"linkFAQ": {
|
||||
"message": "FAQ"
|
||||
},
|
||||
"linkHelp": {
|
||||
"message": "Ajuda"
|
||||
},
|
||||
"linkWebsite": {
|
||||
"message": "Website"
|
||||
},
|
||||
"textDeveloper": {
|
||||
"message": "por Dmitry Selivanov e a Comunidade"
|
||||
},
|
||||
"textSettings": {
|
||||
"message": "Desaproveitar as aversões"
|
||||
},
|
||||
"textSettingsHover": {
|
||||
"message": "Pare de contar as antipatias."
|
||||
},
|
||||
"textUpdate": {
|
||||
"message": "atualização para"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
{
|
||||
"considerDonating": {
|
||||
"message": "Единственный источник доходов позволяющий расширению продолжать работу - ваши пожертвования. Пожалуйста, поддержите нас и помогите нам развиваться."
|
||||
},
|
||||
"customColors": {
|
||||
"message": "Выбор цветов дизлайк бара и кнопок"
|
||||
},
|
||||
"customNumberFormats": {
|
||||
"message": "Выбор формата чисел"
|
||||
},
|
||||
"extensionDesc": {
|
||||
"message": "Возвращает способность видеть дизлайки"
|
||||
},
|
||||
"extensionName": {
|
||||
"message": "Return YouTube Dislike"
|
||||
},
|
||||
"legendSettings": {
|
||||
"message": "Настройки"
|
||||
},
|
||||
"linkDonate": {
|
||||
"message": "Пожертвовать"
|
||||
},
|
||||
"linkFAQ": {
|
||||
"message": "ЧАВО"
|
||||
},
|
||||
"linkHelp": {
|
||||
"message": "Помощь"
|
||||
},
|
||||
"linkWebsite": {
|
||||
"message": "Сайт"
|
||||
},
|
||||
"shortsSupport": {
|
||||
"message": "Поддержка YouTube Shorts"
|
||||
},
|
||||
"textDeveloper": {
|
||||
"message": "Дмитрий Селиванов и сообщество"
|
||||
},
|
||||
"textSettings": {
|
||||
"message": "Отключить отправку лайков/дизлайков"
|
||||
},
|
||||
"textSettingsHover": {
|
||||
"message": "Отключает отправку ваших отметок нравится/не нравится"
|
||||
},
|
||||
"textUpdate": {
|
||||
"message": "обновление до"
|
||||
},
|
||||
"version30installed": {
|
||||
"message": "Версия 3.0.0.0 установлена"
|
||||
},
|
||||
"whatsnew": {
|
||||
"message": "Что нового"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
[{"description":"treehash per file","signed_content":{"payload":"eyJjb250ZW50X2hhc2hlcyI6W3siYmxvY2tfc2l6ZSI6NDA5NiwiZGlnZXN0Ijoic2hhMjU2IiwiZmlsZXMiOlt7InBhdGgiOiJfbG9jYWxlcy9lbi9tZXNzYWdlcy5qc29uIiwicm9vdF9oYXNoIjoiT2tVVVBINTRrajg2VlZOWkZEeTloN1dSMzRKU2RURUJ1djZ6czg5c21pVSJ9LHsicGF0aCI6Il9sb2NhbGVzL2VzL21lc3NhZ2VzLmpzb24iLCJyb290X2hhc2giOiJrMmpEdC1aYjZlSElwVHdhSWtxZENzRGZKSjlEYkRZdTMxQUJnU1doWkk4In0seyJwYXRoIjoiX2xvY2FsZXMvZnIvbWVzc2FnZXMuanNvbiIsInJvb3RfaGFzaCI6IktDcUt6ZzJDMTJERWFEWlJnNkE0Q2VfNUxPUm0xWmZYTXd6OWUxZjRVSVkifSx7InBhdGgiOiJfbG9jYWxlcy9wdF9CUi9tZXNzYWdlcy5qc29uIiwicm9vdF9oYXNoIjoiS1BwM0NmSUk1b0VwNUhPLVZGUkM3Z3VRZjhfZi05LWhOM2kwYy04Z0dwdyJ9LHsicGF0aCI6Il9sb2NhbGVzL3J1L21lc3NhZ2VzLmpzb24iLCJyb290X2hhc2giOiIyUk9kZ1NaUkdRTGM3bG9iMHlNUHhUXzM1aE5RMjM3b2RNNGxHZUVJNnE4In0seyJwYXRoIjoiY2hhbmdlbG9nLzMvY2hhbmdlbG9nXzMuMC5odG1sIiwicm9vdF9oYXNoIjoiUHRCS18xSF9BeFdPQ0dpUF9wWE9Hd3JXSGVLXzY3Mk9hUDQxVVdpNEVtMCJ9LHsicGF0aCI6ImNoYW5nZWxvZy9jaGFuZ2Vsb2cuY3NzIiwicm9vdF9oYXNoIjoiSWNiR0QtdEFGS2xwNU1QbHBQN0RTdU9yRlJQQmJLcmZ3eUN4SVdqeU9DZyJ9LHsicGF0aCI6ImNoYW5nZWxvZy9jaGFuZ2Vsb2cuanMiLCJyb290X2hhc2giOiJCN3BVU0tBWDBZVi1vUlhrT0NmNkNYWWxhaE1wQzBTMG95LWRaQ1pQazlFIn0seyJwYXRoIjoiY2hhbmdlbG9nL2ltYWdlcy9jb2xvcml6ZS5qcGciLCJyb290X2hhc2giOiJFVVZUUkVySk5aT1duNkNiSFFYSFQtVXI4TmlTajlHRmlpV0NLcGt6OHJVIn0seyJwYXRoIjoiY2hhbmdlbG9nL2ltYWdlcy9jb2xvcml6ZV9leGFtcGxlLmpwZyIsInJvb3RfaGFzaCI6ImRXbE1vVEtoMGFVc1pzTmFXOW5BT213WEJrNU9FZW5DbTRhbmtyR2ZocFUifSx7InBhdGgiOiJjaGFuZ2Vsb2cvaW1hZ2VzL251bWJlcl9mb3JtYXQuanBnIiwicm9vdF9oYXNoIjoibXhLd0Q3UTdJN0JkWFVRamdobHZyUnkwazFuakk2dDMyZEdkbXBBMDMxTSJ9LHsicGF0aCI6ImNvbnRlbnQtc3R5bGUuY3NzIiwicm9vdF9oYXNoIjoidjZaT2w0QndzMmRHX3JMOFFmcVl1TGd0V1ZWTjdNNUNyUTVpeXpMRk1GWSJ9LHsicGF0aCI6Imljb25zL2ljb24xMjgucG5nIiwicm9vdF9oYXNoIjoiUnVjbFlxaUxHTVF2MGZQS2lQTGFxVHMtWGlKVG1HNldMTF91SDRFZFhTayJ9LHsicGF0aCI6Imljb25zL2ljb240OC5wbmciLCJyb290X2hhc2giOiJMMExPRlROZVd4X3Nxem05TWt6c2pDaXYxcl80cG1QNkNSd2dHeWpndlI0In0seyJwYXRoIjoiaWNvbnMvaWNvbl9ob2xkMTI4LnBuZyIsInJvb3RfaGFzaCI6Imc4ZmRvTTZiS2dYZzBzOTZjeGQ5WXctbkpyb0FuZURYT2VVeXRiTVF4cHcifSx7InBhdGgiOiJpY29ucy9zZXJ2ZXIuc3ZnIiwicm9vdF9oYXNoIjoiMUQzdEhCREd6NTRYb2FuV3lqU2Rfb0dnN0NyS0VRdnJxQi1tTndVdnBiTSJ9LHsicGF0aCI6Im1hbmlmZXN0Lmpzb24iLCJyb290X2hhc2giOiIwMzdUTXVMZFJIcXk4aUwzS3d4LXBoa1RZY2RZNU1adm1kUmNNV0Y1NzNRIn0seyJwYXRoIjoicG9wdXAuY3NzIiwicm9vdF9oYXNoIjoiRVQ2blRrWDJPem9lTVhDTkN2ZlFzc1dDZEJpbVd6MWxhWE1ndkNJRmozdyJ9LHsicGF0aCI6InBvcHVwLmh0bWwiLCJyb290X2hhc2giOiJsWWFVVzZQVVV0RnY3b0xxMzJMRlhUQTlXaTFwN19WSmswcWowblRrWTRJIn0seyJwYXRoIjoicG9wdXAuanMiLCJyb290X2hhc2giOiJzVlhkdEI0ZHExQm05ODlUUVBJeTJsb05nRnYwZUJyRjVNWXF2dGVMNlFNIn0seyJwYXRoIjoicnlkLmJhY2tncm91bmQuanMiLCJyb290X2hhc2giOiJUVGhZdGVxc2h3SHJJamNKSXU0YjFHWEs2WFhYSXU0UDRfSjVnYlktcGZrIn0seyJwYXRoIjoicnlkLmNvbnRlbnQtc2NyaXB0LmpzIiwicm9vdF9oYXNoIjoiZW9NWEhGbWlGQVg5N0lyUDZfZktXRWQ4dnBldXdHSloxZlRjTWVNcngzQSJ9XSwiZm9ybWF0IjoidHJlZWhhc2giLCJoYXNoX2Jsb2NrX3NpemUiOjQwOTZ9XSwiaXRlbV9pZCI6ImdlYmJoYWdmb2dpZmdnZ2tsZGdvZGZsaWhnZmVpcHBpIiwiaXRlbV92ZXJzaW9uIjoiMy4wLjAuMCIsInByb3RvY29sX3ZlcnNpb24iOjF9","signatures":[{"header":{"kid":"publisher"},"protected":"eyJhbGciOiJSUzI1NiJ9","signature":"fcnzjmQKI2r-n2tFgZe3IIK3OGt_WRFv-2H7A267nVmznSFasu-YrsdNdQg9OXoswTy0ZKZbrhzy-ftg6AZy7aMzaph1M5psLYdVGD-d20XFKHdSjN2gtfob_6W--8obnM_4OIxDz_IuRxUH3MM0lDDK5HFHui28fyNaTUbad69KMVwrGCO9-Zs4kfCJoCc4I940-JXnRITBE99rpVl2VKYkL6Qe8hdQaE8PhGfXu2HiUqx8YVmBV67MKOzo3fg-nJyc3bPBW103VTJYOrkPd7T0qcFikHGNs7V_Bx4Pdd_Mp7iQYSKMDf-TyCTsGJzMA9RnVxO-J72zrUP7uhkIFQ"},{"header":{"kid":"webstore"},"protected":"eyJhbGciOiJSUzI1NiJ9","signature":"E1vzlWhcfRe-WPuz0qIr2Dam7uNoP-cJcNvcDfl_6I2IiC1E4hqoFuZZ0Pv1viN4PzgPzCzeVIEgWcDDMgl8TCk0Rd-k-S1GBLX1wYx8erXRw-E-M64dzwHxtkf7Re4apbwN3wfZG7mtWyQ8o_IkkQgIumHVfZhp-Q6xLraKQm7n_dpdw8nSS7qvItFh13h6Nxnn-NhiL0QBtoMuuJ0zt19_-yAHACaBPt12C2L6iWU2ttobIC6pEmj0WlVGcidtquge3IXttS6e9hwY4N1lFppbbWdCtc2DJj0vqw1mB2Gy8TZKq67ClgQ93CcYR7ffNXo-LiJLLe_YB2lmM-e5MA"}]}}]
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta content="text/html; charset=utf-8"/>
|
||||
<title title="__MSG_extensionName__">__MSG_extensionName__</title>
|
||||
<link rel="stylesheet" href="/changelog/changelog.css"/>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com"/>
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin/>
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Roboto:wght@100;300;400;500;700;900&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<svg width="48" viewBox="0 0 24 24">
|
||||
<path
|
||||
d="M14.9 3H6c-.9 0-1.6.5-1.9 1.2l-3 7c-.1.3-.1.5-.1.7v2c0 1.1.9 2 2 2h6.3l-.9 4.5c-.1.5 0 1 .4 1.4l1.1 1.1 6.5-6.6c.4-.4.6-.9.6-1.4V5c-.1-1.1-1-2-2.1-2zm7.4 12.8h-2.9c-.4 0-.7-.3-.7-.7V3.9c0-.4.3-.7.7-.7h2.9c.4 0 .7.3.7.7V15c0 .4-.3.8-.7.8z"
|
||||
fill="red"
|
||||
/>
|
||||
<path d="m8 12.5 5.1-2.9L8 6.7v5.8z" fill="#fff"/>
|
||||
</svg>
|
||||
|
||||
<h1 style="margin-bottom: 0" title="__MSG_extensionName__">
|
||||
__MSG_extensionName__
|
||||
</h1>
|
||||
<p style="color: var(--lightGrey); margin-top:0" title="__MSG_textDeveloper__">
|
||||
__MSG_textDeveloper__
|
||||
</p>
|
||||
<h2>__MSG_version30installed__</h2>
|
||||
<h2>__MSG_whatsnew__:</h2>
|
||||
|
||||
|
||||
<div style="margin-bottom: 5rem">
|
||||
<ul style="margin-bottom: 5rem">
|
||||
<li>__MSG_shortsSupport__</li>
|
||||
<li>__MSG_customColors__</li>
|
||||
<img style="display: block; margin-bottom: 2rem" src="/changelog/images/colorize_example.jpg"/>
|
||||
<img src="/changelog/images/colorize.jpg"/>
|
||||
<li>__MSG_customNumberFormats__</li>
|
||||
<img src="/changelog/images/number_format.jpg"/>
|
||||
</ul>
|
||||
|
||||
<p>__MSG_considerDonating__</p>
|
||||
<center>
|
||||
<button id="link_website" title="__MSG_linkWebsite__">
|
||||
__MSG_linkWebsite__
|
||||
</button>
|
||||
<button
|
||||
style="margin-top: 0.3em; background: #ff0000"
|
||||
id="link_donate"
|
||||
title="__MSG_linkDonate__"
|
||||
>
|
||||
__MSG_linkDonate__
|
||||
</button>
|
||||
<button id="link_discord">Discord</button>
|
||||
<br/>
|
||||
<button style="margin-top: 0.3rem" id="link_faq" title="__MSG_linkFAQ__">
|
||||
__MSG_linkFAQ__
|
||||
</button>
|
||||
<button id="link_github">GitHub</button>
|
||||
<button style="margin-top: 0.3em" id="link_help" title="__MSG_linkHelp__">
|
||||
__MSG_linkHelp__
|
||||
</button>
|
||||
</center>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script src="/changelog/changelog.js"></script>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,209 @@
|
|||
/* Variables */
|
||||
:root {
|
||||
--primary: #cc2929;
|
||||
--accent: #581111;
|
||||
|
||||
--background: #111;
|
||||
--secondary: #272727;
|
||||
--tertiary: #424242;
|
||||
--lightGrey: #999;
|
||||
--white: #fff;
|
||||
}
|
||||
|
||||
/* Window Styling */
|
||||
html,
|
||||
body {
|
||||
background-color: var(--background);
|
||||
color: var(--white);
|
||||
min-width: 300px;
|
||||
padding: 0.5em;
|
||||
font-family: "Roboto", Arial, Helvetica, sans-serif;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
|
||||
}
|
||||
|
||||
button {
|
||||
color: var(--white);
|
||||
background: var(--secondary);
|
||||
cursor: pointer;
|
||||
padding: 5px 16px;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
font-weight: 500;
|
||||
/* box-shadow: 0 2px 4px -1px rgb(0 0 0 / 20%), 0 4px 5px 0 rgb(0 0 0 / 14%),
|
||||
0 1px 10px 0 rgb(0 0 0 / 12%); */
|
||||
transition: 0.4s;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background: #444;
|
||||
}
|
||||
|
||||
#ext-version {
|
||||
padding: 0.25rem 0.5rem;
|
||||
}
|
||||
|
||||
#ext-update {
|
||||
cursor: pointer;
|
||||
color: var(--white);
|
||||
text-decoration: none;
|
||||
background: var(--primary);
|
||||
border-radius: 0.25rem;
|
||||
}
|
||||
#ext-update:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#ext {
|
||||
padding: 0.25rem 0;
|
||||
z-index: 69;
|
||||
position: fixed;
|
||||
background: var(--secondary);
|
||||
margin: 0;
|
||||
bottom: 1.15rem;
|
||||
right: 1.15rem;
|
||||
border-radius: 0.25rem;
|
||||
}
|
||||
|
||||
.switch:before {
|
||||
content: attr(data-hover);
|
||||
visibility: hidden;
|
||||
width: 250px;
|
||||
background-color: var(--secondary);
|
||||
border-radius: 0.5rem;
|
||||
padding: 0.5rem;
|
||||
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
left: 0;
|
||||
top: 160%;
|
||||
}
|
||||
|
||||
.switch:hover:before {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
#advancedToggle {
|
||||
position: fixed;
|
||||
background: none;
|
||||
box-shadow: none;
|
||||
color: var(--lightGrey);
|
||||
top: 26px;
|
||||
right: 26px;
|
||||
padding: 2px;
|
||||
z-index: 69;
|
||||
height: 2rem;
|
||||
width: 2rem;
|
||||
}
|
||||
|
||||
#advancedToggle:hover {
|
||||
color: var(--white);
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
|
||||
#advancedToggle:active {
|
||||
transform: scale(1.5);
|
||||
}
|
||||
|
||||
#advancedSettings {
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transition-duration: 0.15s;
|
||||
transition-timing-function: ease-in-out;
|
||||
transform: scale(1.1);
|
||||
position: fixed;
|
||||
background: var(--background);
|
||||
top: 10px;
|
||||
right: 14px;
|
||||
width: calc(100% - 65px);
|
||||
height: calc(100% - 58px);
|
||||
border: 2px solid var(--secondary);
|
||||
border-radius: 0.5rem;
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
#advancedLegend {
|
||||
color: var(--tertiary) !important;
|
||||
/* margin: auto; */ /* Center the label */
|
||||
/* padding: .25rem .5rem; */
|
||||
/* border-radius: .25rem; */
|
||||
/* border: .25rem solid var(--secondary); */
|
||||
}
|
||||
|
||||
/* Switches */
|
||||
.switch {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 30px;
|
||||
height: 17px;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.switch:last-of-type {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.switch input {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.slider {
|
||||
position: absolute;
|
||||
cursor: pointer;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: var(--secondary);
|
||||
transition: 0.4s;
|
||||
border-radius: 34px;
|
||||
}
|
||||
|
||||
.slider:before {
|
||||
position: absolute;
|
||||
content: "";
|
||||
height: 13px;
|
||||
width: 13px;
|
||||
left: 2px;
|
||||
bottom: 2px;
|
||||
background: var(--lightGrey);
|
||||
transition: 0.4s;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
input:checked + .slider {
|
||||
background: var(--accent);
|
||||
}
|
||||
|
||||
input:checked + .slider:before {
|
||||
transform: translateX(13px);
|
||||
background: var(--primary);
|
||||
}
|
||||
|
||||
.switchLabel {
|
||||
margin-left: 0.5rem;
|
||||
width: 250px !important;
|
||||
transform: translateX(35px);
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
#server-status {
|
||||
height: 72px;
|
||||
width: 90px;
|
||||
/* filter: invert(21%) sepia(100%) saturate(3618%) hue-rotate(102deg)
|
||||
brightness(96%) contrast(108%); */
|
||||
}
|
||||
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin: 0.25rem;
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
/* Config */
|
||||
const config = {
|
||||
advanced: false,
|
||||
disableVoteSubmission: false,
|
||||
coloredThumbs: false,
|
||||
coloredBar: false,
|
||||
colorTheme: "classic",
|
||||
numberDisplayFormat: "compactShort",
|
||||
numberDisplayRoundDown: true,
|
||||
showAdvancedMessage:
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"><rect fill="none" height="24" width="24"/><path d="M19.5,12c0-0.23-0.01-0.45-0.03-0.68l1.86-1.41c0.4-0.3,0.51-0.86,0.26-1.3l-1.87-3.23c-0.25-0.44-0.79-0.62-1.25-0.42 l-2.15,0.91c-0.37-0.26-0.76-0.49-1.17-0.68l-0.29-2.31C14.8,2.38,14.37,2,13.87,2h-3.73C9.63,2,9.2,2.38,9.14,2.88L8.85,5.19 c-0.41,0.19-0.8,0.42-1.17,0.68L5.53,4.96c-0.46-0.2-1-0.02-1.25,0.42L2.41,8.62c-0.25,0.44-0.14,0.99,0.26,1.3l1.86,1.41 C4.51,11.55,4.5,11.77,4.5,12s0.01,0.45,0.03,0.68l-1.86,1.41c-0.4,0.3-0.51,0.86-0.26,1.3l1.87,3.23c0.25,0.44,0.79,0.62,1.25,0.42 l2.15-0.91c0.37,0.26,0.76,0.49,1.17,0.68l0.29,2.31C9.2,21.62,9.63,22,10.13,22h3.73c0.5,0,0.93-0.38,0.99-0.88l0.29-2.31 c0.41-0.19,0.8-0.42,1.17-0.68l2.15,0.91c0.46,0.2,1,0.02,1.25-0.42l1.87-3.23c0.25-0.44,0.14-0.99-0.26-1.3l-1.86-1.41 C19.49,12.45,19.5,12.23,19.5,12z M12.04,15.5c-1.93,0-3.5-1.57-3.5-3.5s1.57-3.5,3.5-3.5s3.5,1.57,3.5,3.5S13.97,15.5,12.04,15.5z"/></svg>',
|
||||
hideAdvancedMessage:
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"><path d="M0 0h24v24H0V0z" fill="none" opacity=".87"/><path d="M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm4.3 14.3c-.39.39-1.02.39-1.41 0L12 13.41 9.11 16.3c-.39.39-1.02.39-1.41 0-.39-.39-.39-1.02 0-1.41L10.59 12 7.7 9.11c-.39-.39-.39-1.02 0-1.41.39-.39 1.02-.39 1.41 0L12 10.59l2.89-2.89c.39-.39 1.02-.39 1.41 0 .39.39.39 1.02 0 1.41L13.41 12l2.89 2.89c.38.38.38 1.02 0 1.41z"/></svg>',
|
||||
|
||||
links: {
|
||||
website: "https://returnyoutubedislike.com",
|
||||
github: "https://github.com/Anarios/return-youtube-dislike",
|
||||
discord: "https://discord.gg/mYnESY4Md5",
|
||||
donate: "https://returnyoutubedislike.com/donate",
|
||||
faq: "https://returnyoutubedislike.com/faq",
|
||||
help: "https://returnyoutubedislike.com/help",
|
||||
},
|
||||
};
|
||||
|
||||
/* Change language */
|
||||
function localizeHtmlPage() {
|
||||
//Localize by replacing __MSG_***__ meta tags
|
||||
var objects = document.getElementsByTagName("html");
|
||||
for (var j = 0; j < objects.length; j++) {
|
||||
var obj = objects[j];
|
||||
|
||||
var valStrH = obj.innerHTML.toString();
|
||||
var valNewH = valStrH.replace(/__MSG_(\w+)__/g, function (match, v1) {
|
||||
return v1 ? chrome.i18n.getMessage(v1) : "";
|
||||
});
|
||||
|
||||
if (valNewH != valStrH) {
|
||||
obj.innerHTML = valNewH;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
localizeHtmlPage();
|
||||
|
||||
/* Links */
|
||||
createLink(config.links.website, "link_website");
|
||||
createLink(config.links.github, "link_github");
|
||||
createLink(config.links.discord, "link_discord");
|
||||
createLink(config.links.faq, "link_faq");
|
||||
createLink(config.links.donate, "link_donate");
|
||||
createLink(config.links.help, "link_help");
|
||||
|
||||
function createLink(url, id) {
|
||||
document.getElementById(id).addEventListener("click", () => {
|
||||
chrome.tabs.create({ url: url });
|
||||
});
|
||||
}
|
||||
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 9.6 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
|
@ -0,0 +1,46 @@
|
|||
:root {
|
||||
/* --yt-spec-icon-disabled: #f44 !important;
|
||||
--yt-spec-text-primary: #4f4 !important; */
|
||||
/* --yt-spec-general-background-a: #000 !important;
|
||||
--yt-spec-general-background-b: #000 !important;
|
||||
--yt-spec-general-background-c: #000 !important;
|
||||
--yt-spec-brand-background-solid: #000 !important;
|
||||
--yt-spec-brand-background-primary: #000 !important;
|
||||
--yt-spec-brand-background-secondary: #000 !important; */
|
||||
}
|
||||
|
||||
/* html:not(.style-scope)[dark], :not(.style-scope)[dark] {
|
||||
--yt-spec-general-background-a: #000 !important;
|
||||
--yt-spec-general-background-b: #000 !important;
|
||||
--yt-spec-general-background-c: #000 !important;
|
||||
--yt-spec-brand-background-solid: #000 !important;
|
||||
--yt-spec-brand-background-primary: #000 !important;
|
||||
--yt-spec-brand-background-secondary: #000 !important;
|
||||
} */
|
||||
|
||||
#ryd-bar-container {
|
||||
background: var(--yt-spec-icon-disabled);
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
#ryd-bar {
|
||||
background: var(--yt-spec-text-primary);
|
||||
border-radius: 2px;
|
||||
transition: all 0.15s ease-in-out;
|
||||
}
|
||||
|
||||
.ryd-tooltip {
|
||||
position: relative;
|
||||
display: block;
|
||||
height: 2px;
|
||||
top: 9px;
|
||||
}
|
||||
|
||||
.ryd-tooltip-bar-container {
|
||||
width: 100%;
|
||||
height: 2px;
|
||||
position: absolute;
|
||||
padding-top: 6px;
|
||||
padding-bottom: 28px;
|
||||
top: -6px;
|
||||
}
|
||||
|
After Width: | Height: | Size: 2 KiB |
|
After Width: | Height: | Size: 787 B |
|
After Width: | Height: | Size: 1.9 KiB |
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M480 160H32c-17.673 0-32-14.327-32-32V64c0-17.673 14.327-32 32-32h448c17.673 0 32 14.327 32 32v64c0 17.673-14.327 32-32 32zm-48-88c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm-64 0c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm112 248H32c-17.673 0-32-14.327-32-32v-64c0-17.673 14.327-32 32-32h448c17.673 0 32 14.327 32 32v64c0 17.673-14.327 32-32 32zm-48-88c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm-64 0c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm112 248H32c-17.673 0-32-14.327-32-32v-64c0-17.673 14.327-32 32-32h448c17.673 0 32 14.327 32 32v64c0 17.673-14.327 32-32 32zm-48-88c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24zm-64 0c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24z"/></svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
|
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
"action": {
|
||||
"default_popup": "popup.html"
|
||||
},
|
||||
"background": {
|
||||
"service_worker": "ryd.background.js"
|
||||
},
|
||||
"content_scripts": [ {
|
||||
"css": [ "content-style.css" ],
|
||||
"exclude_matches": [ "*://*.music.youtube.com/*" ],
|
||||
"js": [ "ryd.content-script.js" ],
|
||||
"matches": [ "*://youtube.com/*", "*://www.youtube.com/*", "*://m.youtube.com/*" ]
|
||||
} ],
|
||||
"default_locale": "en",
|
||||
"description": "__MSG_extensionDesc__",
|
||||
"externally_connectable": {
|
||||
"matches": [ "*://*.youtube.com/*" ]
|
||||
},
|
||||
"host_permissions": [ "*://*.youtube.com/*" ],
|
||||
"icons": {
|
||||
"128": "icons/icon128.png",
|
||||
"48": "icons/icon48.png"
|
||||
},
|
||||
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAiHSM4q3Ti5gb2j6lfOwlNvrl0IGtIVOdZZNckjd15gAZh5oo9BfO1QwqJQD39KdiyELCfTduxcDeQM5RLZ6V59iK5Lt04edFS6hF7gYrB5TMQ7pgFLetT4EUgZusu9PgApU11ZWrS+VfL/2XIcIGMdpBQ1rq7X6s7ffWoQzQiQhjZUoNaCMvyI0iCEH7RS4qylV5el80kH6RyUXCDFoo1zr06BiZOj65fALgbUmiz1RstI5/bsCgA44DHXonA7d/dvc5jWvXEuZdNWvuvYdpPPxGebSEktn0+waI+VXV5vggsTfILerIsKNb6rwTlujB6Ke98cKhIF3wGqUuvwdV6wIDAQAB",
|
||||
"manifest_version": 3,
|
||||
"name": "__MSG_extensionName__",
|
||||
"permissions": [ "storage" ],
|
||||
"update_url": "https://clients2.google.com/service/update2/crx",
|
||||
"version": "3.0.0.0",
|
||||
"web_accessible_resources": [ {
|
||||
"matches": [ "*://*.youtube.com/*" ],
|
||||
"resources": [ "ryd.script.js" ]
|
||||
} ]
|
||||
}
|
||||
|
|
@ -0,0 +1,204 @@
|
|||
/* Variables */
|
||||
:root {
|
||||
--primary: #cc2929;
|
||||
--accent: #581111;
|
||||
|
||||
--background: #111;
|
||||
--secondary: #272727;
|
||||
--tertiary: #424242;
|
||||
--lightGrey: #999;
|
||||
--white: #fff;
|
||||
}
|
||||
|
||||
/* Window Styling */
|
||||
html,
|
||||
body {
|
||||
background-color: var(--background);
|
||||
color: var(--white);
|
||||
min-width: 300px;
|
||||
padding: 0.5em;
|
||||
font-family: "Roboto", Arial, Helvetica, sans-serif;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 26px;
|
||||
}
|
||||
|
||||
button {
|
||||
color: var(--white);
|
||||
background: var(--secondary);
|
||||
cursor: pointer;
|
||||
padding: 5px 16px;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
font-weight: 500;
|
||||
/* box-shadow: 0 2px 4px -1px rgb(0 0 0 / 20%), 0 4px 5px 0 rgb(0 0 0 / 14%),
|
||||
0 1px 10px 0 rgb(0 0 0 / 12%); */
|
||||
transition: 0.4s;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background: #444;
|
||||
}
|
||||
|
||||
#ext-version {
|
||||
padding: 0.25rem 0.5rem;
|
||||
}
|
||||
|
||||
#ext-update {
|
||||
cursor: pointer;
|
||||
color: var(--white);
|
||||
text-decoration: none;
|
||||
background: var(--primary);
|
||||
border-radius: 0.25rem;
|
||||
}
|
||||
#ext-update:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#ext {
|
||||
padding: 0.25rem 0;
|
||||
z-index: 69;
|
||||
position: fixed;
|
||||
background: var(--secondary);
|
||||
margin: 0;
|
||||
bottom: 1.15rem;
|
||||
right: 1.15rem;
|
||||
border-radius: 0.25rem;
|
||||
}
|
||||
|
||||
.switch:before {
|
||||
content: attr(data-hover);
|
||||
visibility: hidden;
|
||||
width: 250px;
|
||||
background-color: var(--secondary);
|
||||
border-radius: 0.5rem;
|
||||
padding: 0.5rem;
|
||||
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
left: 0;
|
||||
top: 160%;
|
||||
}
|
||||
|
||||
.switch:hover:before {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
#advancedToggle {
|
||||
position: fixed;
|
||||
background: none;
|
||||
box-shadow: none;
|
||||
color: var(--lightGrey);
|
||||
top: 26px;
|
||||
right: 26px;
|
||||
padding: 2px;
|
||||
z-index: 69;
|
||||
height: 2rem;
|
||||
width: 2rem;
|
||||
}
|
||||
|
||||
#advancedToggle:hover {
|
||||
color: var(--white);
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
|
||||
#advancedToggle:active {
|
||||
transform: scale(1.5);
|
||||
}
|
||||
|
||||
#advancedSettings {
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transition-duration: 0.15s;
|
||||
transition-timing-function: ease-in-out;
|
||||
transform: scale(1.1);
|
||||
position: fixed;
|
||||
background: var(--background);
|
||||
top: 10px;
|
||||
right: 14px;
|
||||
width: calc(100% - 65px);
|
||||
height: calc(100% - 58px);
|
||||
border: 2px solid var(--secondary);
|
||||
border-radius: 0.5rem;
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
#advancedLegend {
|
||||
color: var(--tertiary) !important;
|
||||
/* margin: auto; */ /* Center the label */
|
||||
/* padding: .25rem .5rem; */
|
||||
/* border-radius: .25rem; */
|
||||
/* border: .25rem solid var(--secondary); */
|
||||
}
|
||||
|
||||
/* Switches */
|
||||
.switch {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 30px;
|
||||
height: 17px;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.switch:last-of-type {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.switch input {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.slider {
|
||||
position: absolute;
|
||||
cursor: pointer;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: var(--secondary);
|
||||
transition: 0.4s;
|
||||
border-radius: 34px;
|
||||
}
|
||||
|
||||
.slider:before {
|
||||
position: absolute;
|
||||
content: "";
|
||||
height: 13px;
|
||||
width: 13px;
|
||||
left: 2px;
|
||||
bottom: 2px;
|
||||
background: var(--lightGrey);
|
||||
transition: 0.4s;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
input:checked + .slider {
|
||||
background: var(--accent);
|
||||
}
|
||||
|
||||
input:checked + .slider:before {
|
||||
transform: translateX(13px);
|
||||
background: var(--primary);
|
||||
}
|
||||
|
||||
.switchLabel {
|
||||
margin-left: 0.5rem;
|
||||
width: 250px !important;
|
||||
transform: translateX(35px);
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
#server-status {
|
||||
height: 72px;
|
||||
width: 90px;
|
||||
/* filter: invert(21%) sepia(100%) saturate(3618%) hue-rotate(102deg)
|
||||
brightness(96%) contrast(108%); */
|
||||
}
|
||||
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
|
@ -0,0 +1,166 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta content="text/html; charset=utf-8"/>
|
||||
<title title="__MSG_extensionName__">__MSG_extensionName__</title>
|
||||
<link rel="stylesheet" href="popup.css"/>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com"/>
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin/>
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Roboto:wght@100;300;400;500;700;900&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
</head>
|
||||
<body>
|
||||
<center>
|
||||
<svg width="48" viewBox="0 0 24 24">
|
||||
<path
|
||||
d="M14.9 3H6c-.9 0-1.6.5-1.9 1.2l-3 7c-.1.3-.1.5-.1.7v2c0 1.1.9 2 2 2h6.3l-.9 4.5c-.1.5 0 1 .4 1.4l1.1 1.1 6.5-6.6c.4-.4.6-.9.6-1.4V5c-.1-1.1-1-2-2.1-2zm7.4 12.8h-2.9c-.4 0-.7-.3-.7-.7V3.9c0-.4.3-.7.7-.7h2.9c.4 0 .7.3.7.7V15c0 .4-.3.8-.7.8z"
|
||||
fill="red"
|
||||
/>
|
||||
<path d="m8 12.5 5.1-2.9L8 6.7v5.8z" fill="#fff"/>
|
||||
</svg>
|
||||
<h1 style="margin-bottom: 0.75rem" title="__MSG_extensionName__">
|
||||
__MSG_extensionName__
|
||||
</h1>
|
||||
<p style="color: var(--lightGrey)" title="__MSG_textDeveloper__">
|
||||
__MSG_textDeveloper__
|
||||
</p>
|
||||
|
||||
<button id="link_website" title="__MSG_linkWebsite__">
|
||||
__MSG_linkWebsite__
|
||||
</button>
|
||||
<button
|
||||
style="margin-top: 0.3em; background: #ff0000"
|
||||
id="link_donate"
|
||||
title="__MSG_linkDonate__"
|
||||
>
|
||||
__MSG_linkDonate__
|
||||
</button>
|
||||
<button id="link_discord">Discord</button>
|
||||
<br/>
|
||||
<button style="margin-top: 0.3rem" id="link_faq" title="__MSG_linkFAQ__">
|
||||
__MSG_linkFAQ__
|
||||
</button>
|
||||
<button id="link_github">GitHub</button>
|
||||
<button style="margin-top: 0.3em" id="link_help" title="__MSG_linkHelp__">
|
||||
__MSG_linkHelp__
|
||||
</button>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
<p style="display: none">API Status: <b id="status"></b></p>
|
||||
<img
|
||||
id="server-status"
|
||||
style="display: none; width: 0.75rem; height: 0.75rem"
|
||||
src="./icons/server.svg"
|
||||
alt=""
|
||||
/>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
</center>
|
||||
|
||||
<!-- top-right -->
|
||||
<button id="advancedToggle">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
enable-background="new 0 0 24 24"
|
||||
height="24px"
|
||||
viewBox="0 0 24 24"
|
||||
width="24px"
|
||||
fill="currentColor"
|
||||
>
|
||||
<rect fill="none" height="24" width="24"/>
|
||||
<path
|
||||
d="M19.5,12c0-0.23-0.01-0.45-0.03-0.68l1.86-1.41c0.4-0.3,0.51-0.86,0.26-1.3l-1.87-3.23c-0.25-0.44-0.79-0.62-1.25-0.42 l-2.15,0.91c-0.37-0.26-0.76-0.49-1.17-0.68l-0.29-2.31C14.8,2.38,14.37,2,13.87,2h-3.73C9.63,2,9.2,2.38,9.14,2.88L8.85,5.19 c-0.41,0.19-0.8,0.42-1.17,0.68L5.53,4.96c-0.46-0.2-1-0.02-1.25,0.42L2.41,8.62c-0.25,0.44-0.14,0.99,0.26,1.3l1.86,1.41 C4.51,11.55,4.5,11.77,4.5,12s0.01,0.45,0.03,0.68l-1.86,1.41c-0.4,0.3-0.51,0.86-0.26,1.3l1.87,3.23c0.25,0.44,0.79,0.62,1.25,0.42 l2.15-0.91c0.37,0.26,0.76,0.49,1.17,0.68l0.29,2.31C9.2,21.62,9.63,22,10.13,22h3.73c0.5,0,0.93-0.38,0.99-0.88l0.29-2.31 c0.41-0.19,0.8-0.42,1.17-0.68l2.15,0.91c0.46,0.2,1,0.02,1.25-0.42l1.87-3.23c0.25-0.44,0.14-0.99-0.26-1.3l-1.86-1.41 C19.49,12.45,19.5,12.23,19.5,12z M12.04,15.5c-1.93,0-3.5-1.57-3.5-3.5s1.57-3.5,3.5-3.5s3.5,1.57,3.5,3.5S13.97,15.5,12.04,15.5z"
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
<!-- bottom-right -->
|
||||
<div id="ext">
|
||||
<a
|
||||
href="https://returnyoutubedislike.com/install"
|
||||
target="_blank"
|
||||
id="ext-update"
|
||||
></a>
|
||||
<span id="ext-version"></span>
|
||||
</div>
|
||||
|
||||
<!-- dialog box -->
|
||||
<fieldset id="advancedSettings">
|
||||
<legend id="advancedLegend" title="__MSG_legendSettings__">
|
||||
__MSG_legendSettings__
|
||||
</legend>
|
||||
|
||||
<label class="switch" data-hover="__MSG_textSettingsHover__">
|
||||
<input type="checkbox" id="disable_vote_submission"/>
|
||||
<span class="slider"/>
|
||||
<span class="switchLabel" title="__MSG_textSettings__"
|
||||
>__MSG_textSettings__</span
|
||||
>
|
||||
</label>
|
||||
<br/>
|
||||
<label class="switch" data-hover="Round down numbers (default YouTube behavior)">
|
||||
<input type="checkbox" id="number_round_down"/>
|
||||
<span class="slider"/>
|
||||
<span class="switchLabel">Show rounded down numbers</span>
|
||||
</label>
|
||||
<br/>
|
||||
<div class="custom-select">
|
||||
<label for="number_format">Number format:</label>
|
||||
<select name="number_format" id="number_format">
|
||||
<option value="compactShort" id="number_format_compactShort"></option>
|
||||
<option value="compactLong" id="number_format_compactLong"></option>
|
||||
<option value="standard" id="number_format_standard"></option>
|
||||
</select>
|
||||
</div>
|
||||
<br/>
|
||||
<div class="custom-select">
|
||||
<label class="switch" data-hover="Use custom colors for ratio bar.">
|
||||
<input type="checkbox" id="colored_bar"/>
|
||||
<span class="slider"/>
|
||||
<span class="switchLabel">Colorize ratio bar</span>
|
||||
</label>
|
||||
</div>
|
||||
<label class="switch" data-hover="Use custom colors for thumb icons.">
|
||||
<input type="checkbox" id="colored_thumbs"/>
|
||||
<span class="slider"/>
|
||||
<span class="switchLabel">Colorize thumbs</span>
|
||||
</label>
|
||||
<br/>
|
||||
<div class="custom-select">
|
||||
<label for="color_theme">Color theme:</label>
|
||||
<select name="color_theme" id="color_theme">
|
||||
<option value="classic" id="color_theme_classic">Classic</option>
|
||||
<option value="accessible" id="color_theme_accessible">
|
||||
Accessible
|
||||
</option>
|
||||
<option value="neon" id="color_theme_neon">Neon</option>
|
||||
</select>
|
||||
<span
|
||||
id="color_theme_example_like"
|
||||
style="
|
||||
display: inline-block;
|
||||
vertical-align: text-top;
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
"
|
||||
> </span
|
||||
>
|
||||
<span
|
||||
id="color_theme_example_dislike"
|
||||
style="
|
||||
display: inline-block;
|
||||
vertical-align: text-top;
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
"
|
||||
> </span
|
||||
>
|
||||
</div>
|
||||
</fieldset>
|
||||
</body>
|
||||
<script src="popup.js"></script>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,378 @@
|
|||
/******/ (() => { // webpackBootstrap
|
||||
var __webpack_exports__ = {};
|
||||
/* Config */
|
||||
const config = {
|
||||
advanced: false,
|
||||
disableVoteSubmission: false,
|
||||
coloredThumbs: false,
|
||||
coloredBar: false,
|
||||
colorTheme: "classic",
|
||||
numberDisplayFormat: "compactShort",
|
||||
numberDisplayRoundDown: true,
|
||||
showAdvancedMessage:
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"><rect fill="none" height="24" width="24"/><path d="M19.5,12c0-0.23-0.01-0.45-0.03-0.68l1.86-1.41c0.4-0.3,0.51-0.86,0.26-1.3l-1.87-3.23c-0.25-0.44-0.79-0.62-1.25-0.42 l-2.15,0.91c-0.37-0.26-0.76-0.49-1.17-0.68l-0.29-2.31C14.8,2.38,14.37,2,13.87,2h-3.73C9.63,2,9.2,2.38,9.14,2.88L8.85,5.19 c-0.41,0.19-0.8,0.42-1.17,0.68L5.53,4.96c-0.46-0.2-1-0.02-1.25,0.42L2.41,8.62c-0.25,0.44-0.14,0.99,0.26,1.3l1.86,1.41 C4.51,11.55,4.5,11.77,4.5,12s0.01,0.45,0.03,0.68l-1.86,1.41c-0.4,0.3-0.51,0.86-0.26,1.3l1.87,3.23c0.25,0.44,0.79,0.62,1.25,0.42 l2.15-0.91c0.37,0.26,0.76,0.49,1.17,0.68l0.29,2.31C9.2,21.62,9.63,22,10.13,22h3.73c0.5,0,0.93-0.38,0.99-0.88l0.29-2.31 c0.41-0.19,0.8-0.42,1.17-0.68l2.15,0.91c0.46,0.2,1,0.02,1.25-0.42l1.87-3.23c0.25-0.44,0.14-0.99-0.26-1.3l-1.86-1.41 C19.49,12.45,19.5,12.23,19.5,12z M12.04,15.5c-1.93,0-3.5-1.57-3.5-3.5s1.57-3.5,3.5-3.5s3.5,1.57,3.5,3.5S13.97,15.5,12.04,15.5z"/></svg>',
|
||||
hideAdvancedMessage:
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"><path d="M0 0h24v24H0V0z" fill="none" opacity=".87"/><path d="M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm4.3 14.3c-.39.39-1.02.39-1.41 0L12 13.41 9.11 16.3c-.39.39-1.02.39-1.41 0-.39-.39-.39-1.02 0-1.41L10.59 12 7.7 9.11c-.39-.39-.39-1.02 0-1.41.39-.39 1.02-.39 1.41 0L12 10.59l2.89-2.89c.39-.39 1.02-.39 1.41 0 .39.39.39 1.02 0 1.41L13.41 12l2.89 2.89c.38.38.38 1.02 0 1.41z"/></svg>',
|
||||
|
||||
links: {
|
||||
website: "https://returnyoutubedislike.com",
|
||||
github: "https://github.com/Anarios/return-youtube-dislike",
|
||||
discord: "https://discord.gg/mYnESY4Md5",
|
||||
donate: "https://returnyoutubedislike.com/donate",
|
||||
faq: "https://returnyoutubedislike.com/faq",
|
||||
help: "https://returnyoutubedislike.com/help",
|
||||
},
|
||||
};
|
||||
|
||||
/* Change language */
|
||||
function localizeHtmlPage() {
|
||||
//Localize by replacing __MSG_***__ meta tags
|
||||
var objects = document.getElementsByTagName("html");
|
||||
for (var j = 0; j < objects.length; j++) {
|
||||
var obj = objects[j];
|
||||
|
||||
var valStrH = obj.innerHTML.toString();
|
||||
var valNewH = valStrH.replace(/__MSG_(\w+)__/g, function (match, v1) {
|
||||
return v1 ? chrome.i18n.getMessage(v1) : "";
|
||||
});
|
||||
|
||||
if (valNewH != valStrH) {
|
||||
obj.innerHTML = valNewH;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
localizeHtmlPage();
|
||||
|
||||
/* Links */
|
||||
createLink(config.links.website, "link_website");
|
||||
createLink(config.links.github, "link_github");
|
||||
createLink(config.links.discord, "link_discord");
|
||||
createLink(config.links.faq, "link_faq");
|
||||
createLink(config.links.donate, "link_donate");
|
||||
createLink(config.links.help, "link_help");
|
||||
|
||||
function createLink(url, id) {
|
||||
document.getElementById(id).addEventListener("click", () => {
|
||||
chrome.tabs.create({ url: url });
|
||||
});
|
||||
}
|
||||
|
||||
document
|
||||
.getElementById("disable_vote_submission")
|
||||
.addEventListener("click", (ev) => {
|
||||
chrome.storage.sync.set({ disableVoteSubmission: ev.target.checked });
|
||||
});
|
||||
|
||||
document.getElementById("colored_thumbs").addEventListener("click", (ev) => {
|
||||
chrome.storage.sync.set({ coloredThumbs: ev.target.checked });
|
||||
});
|
||||
|
||||
document.getElementById("colored_bar").addEventListener("click", (ev) => {
|
||||
chrome.storage.sync.set({ coloredBar: ev.target.checked });
|
||||
});
|
||||
|
||||
document.getElementById("color_theme").addEventListener("click", (ev) => {
|
||||
chrome.storage.sync.set({ colorTheme: ev.target.value });
|
||||
});
|
||||
|
||||
document.getElementById("number_round_down").addEventListener("click", (ev) => {
|
||||
chrome.storage.sync.set({ numberDisplayRoundDown: ev.target.checked });
|
||||
updateNumberDisplayFormatContent(ev.target.checked);
|
||||
});
|
||||
|
||||
document.getElementById("number_format").addEventListener("change", (ev) => {
|
||||
chrome.storage.sync.set({ numberDisplayFormat: ev.target.value });
|
||||
});
|
||||
|
||||
/* Advanced Toggle */
|
||||
const advancedToggle = document.getElementById("advancedToggle");
|
||||
advancedToggle.addEventListener("click", () => {
|
||||
const adv = document.getElementById("advancedSettings");
|
||||
if (config.advanced) {
|
||||
adv.style.transform = "scale(1.1)";
|
||||
adv.style.pointerEvents = "none";
|
||||
adv.style.opacity = "0";
|
||||
advancedToggle.innerHTML = config.showAdvancedMessage;
|
||||
config.advanced = false;
|
||||
} else {
|
||||
adv.style.transform = "scale(1)";
|
||||
adv.style.pointerEvents = "auto";
|
||||
adv.style.opacity = "1";
|
||||
advancedToggle.innerHTML = config.hideAdvancedMessage;
|
||||
config.advanced = true;
|
||||
}
|
||||
});
|
||||
|
||||
initConfig();
|
||||
|
||||
function initConfig() {
|
||||
initializeDisableVoteSubmission();
|
||||
initializeVersionNumber();
|
||||
initializeColoredThumbs();
|
||||
initializeColoredBar();
|
||||
initializeColorTheme();
|
||||
initializeNumberDisplayFormat();
|
||||
initializeNumberDisplayRoundDown();
|
||||
}
|
||||
|
||||
function initializeVersionNumber() {
|
||||
const version = chrome.runtime.getManifest().version;
|
||||
document.getElementById("ext-version").innerHTML = "v" + version;
|
||||
|
||||
fetch(
|
||||
"https://raw.githubusercontent.com/Anarios/return-youtube-dislike/main/Extensions/combined/manifest-chrome.json"
|
||||
)
|
||||
.then((response) => response.json())
|
||||
.then((json) => {
|
||||
if (compareVersions(json.version, version)) {
|
||||
document.getElementById("ext-update").innerHTML =
|
||||
chrome.i18n.getMessage("textUpdate") + " v" + json.version;
|
||||
document.getElementById("ext-update").style.padding = ".25rem .5rem";
|
||||
}
|
||||
});
|
||||
// .catch(console.error);
|
||||
}
|
||||
|
||||
// returns whether current < latest
|
||||
function compareVersions(latestStr, currentStr) {
|
||||
let latestarr = latestStr.split(".");
|
||||
let currentarr = currentStr.split(".");
|
||||
let outdated = false;
|
||||
// goes through version numbers from left to right from greatest to least significant
|
||||
for (let i = 0; i < Math.max(latestarr.length, currentarr.length); i++) {
|
||||
let latest = i < latestarr.length ? parseInt(latestarr[i]) : 0;
|
||||
let current = i < currentarr.length ? parseInt(currentarr[i]) : 0;
|
||||
if (latest > current) {
|
||||
outdated = true;
|
||||
break;
|
||||
} else if (latest < current) {
|
||||
outdated = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return outdated;
|
||||
}
|
||||
|
||||
function initializeDisableVoteSubmission() {
|
||||
chrome.storage.sync.get(["disableVoteSubmission"], (res) => {
|
||||
handleDisableVoteSubmissionChangeEvent(res.disableVoteSubmission);
|
||||
});
|
||||
}
|
||||
|
||||
function initializeColoredThumbs() {
|
||||
chrome.storage.sync.get(["coloredThumbs"], (res) => {
|
||||
handleColoredThumbsChangeEvent(res.coloredThumbs);
|
||||
});
|
||||
}
|
||||
|
||||
function initializeColoredBar() {
|
||||
chrome.storage.sync.get(["coloredBar"], (res) => {
|
||||
handleColoredBarChangeEvent(res.coloredBar);
|
||||
});
|
||||
}
|
||||
|
||||
function initializeColorTheme() {
|
||||
chrome.storage.sync.get(["colorTheme"], (res) => {
|
||||
handleColorThemeChangeEvent(res.colorTheme);
|
||||
});
|
||||
}
|
||||
|
||||
function initializeNumberDisplayRoundDown() {
|
||||
chrome.storage.sync.get(["numberDisplayRoundDown"], (res) => {
|
||||
handleNumberDisplayRoundDownChangeEvent(res.numberDisplayRoundDown);
|
||||
});
|
||||
}
|
||||
|
||||
function initializeNumberDisplayFormat() {
|
||||
chrome.storage.sync.get(["numberDisplayFormat"], (res) => {
|
||||
handleNumberDisplayFormatChangeEvent(res.numberDisplayFormat);
|
||||
});
|
||||
updateNumberDisplayFormatContent();
|
||||
}
|
||||
|
||||
function updateNumberDisplayFormatContent(roundDown) {
|
||||
let testValue;
|
||||
if (roundDown) {
|
||||
testValue = 123000;
|
||||
} else {
|
||||
testValue = 123456;
|
||||
}
|
||||
document.getElementById("number_format_compactShort").innerHTML =
|
||||
getNumberFormatter("compactShort").format(testValue);
|
||||
document.getElementById("number_format_compactLong").innerHTML =
|
||||
getNumberFormatter("compactLong").format(testValue);
|
||||
document.getElementById("number_format_standard").innerHTML =
|
||||
getNumberFormatter("standard").format(testValue);
|
||||
}
|
||||
|
||||
chrome.storage.onChanged.addListener(storageChangeHandler);
|
||||
|
||||
function storageChangeHandler(changes, area) {
|
||||
if (changes.disableVoteSubmission !== undefined) {
|
||||
handleDisableVoteSubmissionChangeEvent(
|
||||
changes.disableVoteSubmission.newValue
|
||||
);
|
||||
}
|
||||
if (changes.coloredThumbs !== undefined) {
|
||||
handleColoredThumbsChangeEvent(changes.coloredThumbs.newValue);
|
||||
}
|
||||
if (changes.coloredBar !== undefined) {
|
||||
handleColoredBarChangeEvent(changes.coloredBar.newValue);
|
||||
}
|
||||
if (changes.colorTheme !== undefined) {
|
||||
handleColorThemeChangeEvent(changes.colorTheme.newValue);
|
||||
}
|
||||
if (changes.numberDisplayRoundDown !== undefined) {
|
||||
handleNumberDisplayRoundDownChangeEvent(
|
||||
changes.numberDisplayRoundDown.newValue
|
||||
);
|
||||
}
|
||||
if (changes.numberDisplayFormat !== undefined) {
|
||||
handleNumberDisplayFormatChangeEvent(changes.numberDisplayFormat.newValue);
|
||||
}
|
||||
}
|
||||
|
||||
function handleDisableVoteSubmissionChangeEvent(value) {
|
||||
config.disableVoteSubmission = value;
|
||||
document.getElementById("disable_vote_submission").checked = value;
|
||||
}
|
||||
|
||||
function handleColoredThumbsChangeEvent(value) {
|
||||
config.coloredThumbs = value;
|
||||
document.getElementById("colored_thumbs").checked = value;
|
||||
}
|
||||
|
||||
function handleColoredBarChangeEvent(value) {
|
||||
config.coloredBar = value;
|
||||
document.getElementById("colored_bar").checked = value;
|
||||
}
|
||||
|
||||
function handleColorThemeChangeEvent(value) {
|
||||
if (!value) {
|
||||
value = "classic";
|
||||
}
|
||||
config.colorTheme = value;
|
||||
document
|
||||
.getElementById("color_theme")
|
||||
.querySelector('option[value="' + value + '"]').selected = true;
|
||||
updateColorThemePreviewContent(value);
|
||||
}
|
||||
|
||||
function updateColorThemePreviewContent(themeName) {
|
||||
document.getElementById("color_theme_example_like").style.backgroundColor =
|
||||
getColorFromTheme(themeName, true);
|
||||
document.getElementById("color_theme_example_dislike").style.backgroundColor =
|
||||
getColorFromTheme(themeName, false);
|
||||
}
|
||||
|
||||
function handleNumberDisplayRoundDownChangeEvent(value) {
|
||||
config.numberDisplayRoundDown = value;
|
||||
document.getElementById("number_round_down").checked = value;
|
||||
}
|
||||
|
||||
function handleNumberDisplayFormatChangeEvent(value) {
|
||||
config.numberDisplayFormat = value;
|
||||
document
|
||||
.getElementById("number_format")
|
||||
.querySelector('option[value="' + value + '"]').selected = true;
|
||||
}
|
||||
|
||||
function getNumberFormatter(optionSelect) {
|
||||
let formatterNotation;
|
||||
let formatterCompactDisplay;
|
||||
let userLocales;
|
||||
try {
|
||||
userLocales = new URL(
|
||||
Array.from(document.querySelectorAll("head > link[rel='search']"))
|
||||
?.find((n) => n?.getAttribute("href")?.includes("?locale="))
|
||||
?.getAttribute("href")
|
||||
)?.searchParams?.get("locale");
|
||||
} catch {}
|
||||
|
||||
switch (optionSelect) {
|
||||
case "compactLong":
|
||||
formatterNotation = "compact";
|
||||
formatterCompactDisplay = "long";
|
||||
break;
|
||||
case "standard":
|
||||
formatterNotation = "standard";
|
||||
formatterCompactDisplay = "short";
|
||||
break;
|
||||
case "compactShort":
|
||||
default:
|
||||
formatterNotation = "compact";
|
||||
formatterCompactDisplay = "short";
|
||||
}
|
||||
const formatter = Intl.NumberFormat(
|
||||
document.documentElement.lang || userLocales || navigator.language,
|
||||
{
|
||||
notation: formatterNotation,
|
||||
compactDisplay: formatterCompactDisplay,
|
||||
}
|
||||
);
|
||||
return formatter;
|
||||
}
|
||||
|
||||
(async function getStatus() {
|
||||
let status = document.getElementById("status");
|
||||
let serverStatus = document.getElementById("server-status");
|
||||
let resp = await fetch(
|
||||
"https://returnyoutubedislikeapi.com/votes?videoId=YbJOTdZBX1g"
|
||||
);
|
||||
let result = await resp.status;
|
||||
if (result === 200) {
|
||||
status.innerText = "Online";
|
||||
status.style.color = "green";
|
||||
serverStatus.style.filter =
|
||||
"invert(58%) sepia(81%) saturate(2618%) hue-rotate(81deg) brightness(119%) contrast(129%)";
|
||||
} else {
|
||||
status.innerText = "Offline";
|
||||
status.style.color = "red";
|
||||
serverStatus.style.filter =
|
||||
"invert(11%) sepia(100%) saturate(6449%) hue-rotate(3deg) brightness(116%) contrast(115%)";
|
||||
}
|
||||
})();
|
||||
|
||||
function getColorFromTheme(colorTheme, voteIsLike) {
|
||||
let colorString;
|
||||
switch (colorTheme) {
|
||||
case "accessible":
|
||||
if (voteIsLike === true) {
|
||||
colorString = "dodgerblue";
|
||||
} else {
|
||||
colorString = "gold";
|
||||
}
|
||||
break;
|
||||
case "neon":
|
||||
if (voteIsLike === true) {
|
||||
colorString = "aqua";
|
||||
} else {
|
||||
colorString = "magenta";
|
||||
}
|
||||
break;
|
||||
case "classic":
|
||||
default:
|
||||
if (voteIsLike === true) {
|
||||
colorString = "lime";
|
||||
} else {
|
||||
colorString = "red";
|
||||
}
|
||||
}
|
||||
return colorString;
|
||||
}
|
||||
|
||||
/* popup-script.js
|
||||
document.querySelector('#login')
|
||||
.addEventListener('click', function () {
|
||||
chrome.runtime.sendMessage({ message: 'get_auth_token' });
|
||||
});
|
||||
|
||||
|
||||
document.querySelector("#log_off").addEventListener("click", function () {
|
||||
chrome.runtime.sendMessage({ message: "log_off" });
|
||||
});
|
||||
*/
|
||||
|
||||
/******/ })()
|
||||
;
|
||||
|
|
@ -0,0 +1,368 @@
|
|||
/******/ (() => { // webpackBootstrap
|
||||
var __webpack_exports__ = {};
|
||||
const apiUrl = "https://returnyoutubedislikeapi.com";
|
||||
const voteDisabledIconName = "icon_hold128.png";
|
||||
const defaultIconName = "icon128.png";
|
||||
let api;
|
||||
|
||||
/** stores extension's global config */
|
||||
let extConfig = {
|
||||
disableVoteSubmission: false,
|
||||
coloredThumbs: false,
|
||||
coloredBar: false,
|
||||
colorTheme: "classic", // classic, accessible, neon
|
||||
// coloredThumbs: false,
|
||||
// coloredBar: false,
|
||||
numberDisplayFormat: "compactShort", // compactShort, compactLong, standard
|
||||
numberDisplayRoundDown: true, // locale 'de' shows exact numbers by default
|
||||
};
|
||||
|
||||
if (isChrome()) api = chrome;
|
||||
else if (isFirefox()) api = browser;
|
||||
|
||||
initExtConfig();
|
||||
|
||||
api.runtime.onMessage.addListener((request, sender, sendResponse) => {
|
||||
if (request.message === "get_auth_token") {
|
||||
chrome.identity.getAuthToken({ interactive: true }, function (token) {
|
||||
console.log(token);
|
||||
chrome.identity.getProfileUserInfo(function (userInfo) {
|
||||
console.log(JSON.stringify(userInfo));
|
||||
});
|
||||
});
|
||||
} else if (request.message === "log_off") {
|
||||
// chrome.identity.clearAllCachedAuthTokens(() => console.log("logged off"));
|
||||
} else if (request.message == "set_state") {
|
||||
// chrome.identity.getAuthToken({ interactive: true }, function (token) {
|
||||
let token = "";
|
||||
fetch(
|
||||
`${apiUrl}/votes?videoId=${request.videoId}&likeCount=${
|
||||
request.likeCount || ""
|
||||
}`,
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
},
|
||||
}
|
||||
)
|
||||
.then((response) => response.json())
|
||||
.then((response) => {
|
||||
sendResponse(response);
|
||||
})
|
||||
.catch();
|
||||
return true;
|
||||
} else if (request.message == "register") {
|
||||
register();
|
||||
return true;
|
||||
} else if (request.message == "send_vote") {
|
||||
sendVote(request.videoId, request.vote);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
api.runtime.onInstalled.addListener(() => {
|
||||
api.tabs.create({url: api.runtime.getURL("/changelog/3/changelog_3.0.html")});
|
||||
})
|
||||
|
||||
async function sendVote(videoId, vote) {
|
||||
api.storage.sync.get(null, async (storageResult) => {
|
||||
if (!storageResult.userId || !storageResult.registrationConfirmed) {
|
||||
await register();
|
||||
return;
|
||||
}
|
||||
fetch(`${apiUrl}/interact/vote`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
userId: storageResult.userId,
|
||||
videoId,
|
||||
value: vote,
|
||||
}),
|
||||
})
|
||||
.then(async (response) => {
|
||||
if (response.status == 401) {
|
||||
await register();
|
||||
await sendVote(videoId, vote);
|
||||
return;
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then((response) => {
|
||||
solvePuzzle(response).then((solvedPuzzle) => {
|
||||
fetch(`${apiUrl}/interact/confirmVote`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
...solvedPuzzle,
|
||||
userId: storageResult.userId,
|
||||
videoId,
|
||||
}),
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function register() {
|
||||
let userId = generateUserID();
|
||||
api.storage.sync.set({ userId });
|
||||
return fetch(`${apiUrl}/puzzle/registration?userId=${userId}`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
},
|
||||
})
|
||||
.then((response) => response.json())
|
||||
.then((response) => {
|
||||
return solvePuzzle(response).then((solvedPuzzle) => {
|
||||
return fetch(`${apiUrl}/puzzle/registration?userId=${userId}`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(solvedPuzzle),
|
||||
}).then((response) =>
|
||||
response.json().then((result) => {
|
||||
if (result === true) {
|
||||
return api.storage.sync.set({ registrationConfirmed: true });
|
||||
}
|
||||
})
|
||||
);
|
||||
});
|
||||
})
|
||||
.catch();
|
||||
}
|
||||
|
||||
api.storage.sync.get(null, (res) => {
|
||||
if (!res || !res.userId || !res.registrationConfirmed) {
|
||||
register();
|
||||
}
|
||||
});
|
||||
|
||||
const sentIds = new Set();
|
||||
let toSend = (/* unused pure expression or super */ null && ([]));
|
||||
|
||||
function countLeadingZeroes(uInt8View, limit) {
|
||||
let zeroes = 0;
|
||||
let value = 0;
|
||||
for (let i = 0; i < uInt8View.length; i++) {
|
||||
value = uInt8View[i];
|
||||
if (value === 0) {
|
||||
zeroes += 8;
|
||||
} else {
|
||||
let count = 1;
|
||||
if (value >>> 4 === 0) {
|
||||
count += 4;
|
||||
value <<= 4;
|
||||
}
|
||||
if (value >>> 6 === 0) {
|
||||
count += 2;
|
||||
value <<= 2;
|
||||
}
|
||||
zeroes += count - (value >>> 7);
|
||||
break;
|
||||
}
|
||||
if (zeroes >= limit) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return zeroes;
|
||||
}
|
||||
|
||||
async function solvePuzzle(puzzle) {
|
||||
let challenge = Uint8Array.from(atob(puzzle.challenge), (c) =>
|
||||
c.charCodeAt(0)
|
||||
);
|
||||
let buffer = new ArrayBuffer(20);
|
||||
let uInt8View = new Uint8Array(buffer);
|
||||
let uInt32View = new Uint32Array(buffer);
|
||||
let maxCount = Math.pow(2, puzzle.difficulty) * 5;
|
||||
for (let i = 4; i < 20; i++) {
|
||||
uInt8View[i] = challenge[i - 4];
|
||||
}
|
||||
|
||||
for (let i = 0; i < maxCount; i++) {
|
||||
uInt32View[0] = i;
|
||||
let hash = await crypto.subtle.digest("SHA-512", buffer);
|
||||
let hashUint8 = new Uint8Array(hash);
|
||||
if (countLeadingZeroes(hashUint8) >= puzzle.difficulty) {
|
||||
return {
|
||||
solution: btoa(String.fromCharCode.apply(null, uInt8View.slice(0, 4))),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function generateUserID(length = 36) {
|
||||
const charset =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
let result = "";
|
||||
if (crypto && crypto.getRandomValues) {
|
||||
const values = new Uint32Array(length);
|
||||
crypto.getRandomValues(values);
|
||||
for (let i = 0; i < length; i++) {
|
||||
result += charset[values[i] % charset.length];
|
||||
}
|
||||
return result;
|
||||
} else {
|
||||
for (let i = 0; i < length; i++) {
|
||||
result += charset[Math.floor(Math.random() * charset.length)];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
function storageChangeHandler(changes, area) {
|
||||
if (changes.disableVoteSubmission !== undefined) {
|
||||
handleDisableVoteSubmissionChangeEvent(
|
||||
changes.disableVoteSubmission.newValue
|
||||
);
|
||||
}
|
||||
if (changes.coloredThumbs !== undefined) {
|
||||
handleColoredThumbsChangeEvent(changes.coloredThumbs.newValue);
|
||||
}
|
||||
if (changes.coloredBar !== undefined) {
|
||||
handleColoredBarChangeEvent(changes.coloredBar.newValue);
|
||||
}
|
||||
if (changes.colorTheme !== undefined) {
|
||||
handleColorThemeChangeEvent(changes.colorTheme.newValue);
|
||||
}
|
||||
if (changes.numberDisplayRoundDown !== undefined) {
|
||||
handleNumberDisplayRoundDownChangeEvent(
|
||||
changes.numberDisplayRoundDown.newValue
|
||||
);
|
||||
}
|
||||
if (changes.numberDisplayFormat !== undefined) {
|
||||
handleNumberDisplayFormatChangeEvent(changes.numberDisplayFormat.newValue);
|
||||
}
|
||||
}
|
||||
|
||||
function handleDisableVoteSubmissionChangeEvent(value) {
|
||||
extConfig.disableVoteSubmission = value;
|
||||
if (value === true) {
|
||||
changeIcon(voteDisabledIconName);
|
||||
} else {
|
||||
changeIcon(defaultIconName);
|
||||
}
|
||||
}
|
||||
|
||||
function handleNumberDisplayFormatChangeEvent(value) {
|
||||
extConfig.numberDisplayFormat = value;
|
||||
}
|
||||
|
||||
function handleNumberDisplayRoundDownChangeEvent(value) {
|
||||
extConfig.numberDisplayRoundDown = value;
|
||||
}
|
||||
|
||||
function changeIcon(iconName) {
|
||||
if (api.action !== undefined)
|
||||
api.action.setIcon({ path: "/icons/" + iconName });
|
||||
else if (api.browserAction !== undefined)
|
||||
api.browserAction.setIcon({ path: "/icons/" + iconName });
|
||||
else console.log("changing icon is not supported");
|
||||
}
|
||||
|
||||
function handleColoredThumbsChangeEvent(value) {
|
||||
extConfig.coloredThumbs = value;
|
||||
}
|
||||
|
||||
function handleColoredBarChangeEvent(value) {
|
||||
extConfig.coloredBar = value;
|
||||
}
|
||||
|
||||
function handleColorThemeChangeEvent(value) {
|
||||
if (!value) {
|
||||
value = "classic";
|
||||
}
|
||||
extConfig.colorTheme = value;
|
||||
}
|
||||
|
||||
api.storage.onChanged.addListener(storageChangeHandler);
|
||||
|
||||
function initExtConfig() {
|
||||
initializeDisableVoteSubmission();
|
||||
initializeColoredThumbs();
|
||||
initializeColoredBar();
|
||||
initializeColorTheme();
|
||||
initializeNumberDisplayFormat();
|
||||
initializeNumberDisplayRoundDown();
|
||||
}
|
||||
|
||||
function initializeDisableVoteSubmission() {
|
||||
api.storage.sync.get(["disableVoteSubmission"], (res) => {
|
||||
if (res.disableVoteSubmission === undefined) {
|
||||
api.storage.sync.set({ disableVoteSubmission: false });
|
||||
} else {
|
||||
extConfig.disableVoteSubmission = res.disableVoteSubmission;
|
||||
if (res.disableVoteSubmission) changeIcon(voteDisabledIconName);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function initializeColoredThumbs() {
|
||||
api.storage.sync.get(["coloredThumbs"], (res) => {
|
||||
if (res.coloredThumbs === undefined) {
|
||||
api.storage.sync.set({ coloredThumbs: false });
|
||||
} else {
|
||||
extConfig.coloredThumbs = res.coloredThumbs;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function initializeNumberDisplayRoundDown() {
|
||||
api.storage.sync.get(["numberDisplayRoundDown"], (res) => {
|
||||
if (res.numberDisplayRoundDown === undefined) {
|
||||
api.storage.sync.set({ numberDisplayRoundDown: true });
|
||||
} else {
|
||||
extConfig.numberDisplayRoundDown = res.numberDisplayRoundDown;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function initializeColoredBar() {
|
||||
api.storage.sync.get(["coloredBar"], (res) => {
|
||||
if (res.coloredBar === undefined) {
|
||||
api.storage.sync.set({ coloredBar: false });
|
||||
} else {
|
||||
extConfig.coloredBar = res.coloredBar;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function initializeColorTheme() {
|
||||
api.storage.sync.get(["colorTheme"], (res) => {
|
||||
if (res.colorTheme === undefined) {
|
||||
api.storage.sync.set({ colorTheme: false });
|
||||
} else {
|
||||
extConfig.colorTheme = res.colorTheme;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function initializeNumberDisplayFormat() {
|
||||
api.storage.sync.get(["numberDisplayFormat"], (res) => {
|
||||
if (res.numberDisplayFormat === undefined) {
|
||||
api.storage.sync.set({ numberDisplayFormat: "compactShort" });
|
||||
} else {
|
||||
extConfig.numberDisplayFormat = res.numberDisplayFormat;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function isChrome() {
|
||||
return typeof chrome !== "undefined" && typeof chrome.runtime !== "undefined";
|
||||
}
|
||||
|
||||
function isFirefox() {
|
||||
return (
|
||||
typeof browser !== "undefined" && typeof browser.runtime !== "undefined"
|
||||
);
|
||||
}
|
||||
|
||||
/******/ })()
|
||||
;
|
||||
|
|
@ -0,0 +1,684 @@
|
|||
/******/ (() => { // webpackBootstrap
|
||||
/******/ "use strict";
|
||||
var __webpack_exports__ = {};
|
||||
|
||||
;// CONCATENATED MODULE: ./Extensions/combined/src/utils.js
|
||||
|
||||
|
||||
function roundDown(num) {
|
||||
if (num < 1000) return num;
|
||||
const int = Math.floor(Math.log10(num) - 2);
|
||||
const decimal = int + (int % 3 ? 1 : 0);
|
||||
const value = Math.floor(num / 10 ** decimal);
|
||||
return value * 10 ** decimal;
|
||||
}
|
||||
|
||||
function numberFormat(numberState) {
|
||||
let userLocales;
|
||||
try {
|
||||
userLocales = new URL(
|
||||
Array.from(document.querySelectorAll("head > link[rel='search']"))
|
||||
?.find((n) => n?.getAttribute("href")?.includes("?locale="))
|
||||
?.getAttribute("href")
|
||||
)?.searchParams?.get("locale");
|
||||
} catch {}
|
||||
|
||||
let numberDisplay;
|
||||
if (extConfig.numberDisplayRoundDown === false) {
|
||||
numberDisplay = numberState;
|
||||
} else {
|
||||
numberDisplay = roundDown(numberState);
|
||||
}
|
||||
return getNumberFormatter(extConfig.numberDisplayFormat).format(
|
||||
numberDisplay
|
||||
);
|
||||
}
|
||||
|
||||
function getNumberFormatter(optionSelect) {
|
||||
let formatterNotation;
|
||||
let formatterCompactDisplay;
|
||||
let userLocales;
|
||||
try {
|
||||
userLocales = new URL(
|
||||
Array.from(document.querySelectorAll("head > link[rel='search']"))
|
||||
?.find((n) => n?.getAttribute("href")?.includes("?locale="))
|
||||
?.getAttribute("href")
|
||||
)?.searchParams?.get("locale");
|
||||
} catch {}
|
||||
|
||||
switch (optionSelect) {
|
||||
case "compactLong":
|
||||
formatterNotation = "compact";
|
||||
formatterCompactDisplay = "long";
|
||||
break;
|
||||
case "standard":
|
||||
formatterNotation = "standard";
|
||||
formatterCompactDisplay = "short";
|
||||
break;
|
||||
case "compactShort":
|
||||
default:
|
||||
formatterNotation = "compact";
|
||||
formatterCompactDisplay = "short";
|
||||
}
|
||||
|
||||
const formatter = Intl.NumberFormat(
|
||||
document.documentElement.lang || userLocales || navigator.language,
|
||||
{
|
||||
notation: formatterNotation,
|
||||
compactDisplay: formatterCompactDisplay,
|
||||
}
|
||||
);
|
||||
return formatter;
|
||||
}
|
||||
|
||||
function getBrowser() {
|
||||
if (typeof chrome !== "undefined" && typeof chrome.runtime !== "undefined") {
|
||||
return chrome;
|
||||
} else if (
|
||||
typeof browser !== "undefined" &&
|
||||
typeof browser.runtime !== "undefined"
|
||||
) {
|
||||
return browser;
|
||||
} else {
|
||||
console.log("browser is not supported");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function getVideoId(url) {
|
||||
const urlObject = new URL(url);
|
||||
const pathname = urlObject.pathname;
|
||||
if (pathname.startsWith("/clip")) {
|
||||
return document.querySelector("meta[itemprop='videoId']").content;
|
||||
} else {
|
||||
if (pathname.startsWith("/shorts")) {
|
||||
return pathname.slice(8);
|
||||
}
|
||||
return urlObject.searchParams.get("v");
|
||||
}
|
||||
}
|
||||
|
||||
function isInViewport(element) {
|
||||
const rect = element.getBoundingClientRect();
|
||||
const height = innerHeight || document.documentElement.clientHeight;
|
||||
const width = innerWidth || document.documentElement.clientWidth;
|
||||
return (
|
||||
rect.top >= 0 &&
|
||||
rect.left >= 0 &&
|
||||
rect.bottom <= height &&
|
||||
rect.right <= width
|
||||
);
|
||||
}
|
||||
|
||||
function isVideoLoaded() {
|
||||
const videoId = getVideoId(window.location.href);
|
||||
return (
|
||||
document.querySelector(`ytd-watch-flexy[video-id='${videoId}']`) !== null ||
|
||||
// mobile: no video-id attribute
|
||||
document.querySelector('#player[loading="false"]:not([hidden])') !== null
|
||||
);
|
||||
}
|
||||
|
||||
function cLog(message, writer) {
|
||||
message = `[return youtube dislike]: ${message}`;
|
||||
if (writer) {
|
||||
writer(message);
|
||||
} else {
|
||||
console.log(message);
|
||||
}
|
||||
}
|
||||
|
||||
function getColorFromTheme(voteIsLike) {
|
||||
let colorString;
|
||||
switch (extConfig.colorTheme) {
|
||||
case "accessible":
|
||||
if (voteIsLike === true) {
|
||||
colorString = "dodgerblue";
|
||||
} else {
|
||||
colorString = "gold";
|
||||
}
|
||||
break;
|
||||
case "neon":
|
||||
if (voteIsLike === true) {
|
||||
colorString = "aqua";
|
||||
} else {
|
||||
colorString = "magenta";
|
||||
}
|
||||
break;
|
||||
case "classic":
|
||||
default:
|
||||
if (voteIsLike === true) {
|
||||
colorString = "lime";
|
||||
} else {
|
||||
colorString = "red";
|
||||
}
|
||||
}
|
||||
return colorString;
|
||||
}
|
||||
|
||||
|
||||
|
||||
;// CONCATENATED MODULE: ./Extensions/combined/src/bar.js
|
||||
|
||||
|
||||
|
||||
function createRateBar(likes, dislikes) {
|
||||
if (!likesDisabledState) {
|
||||
let rateBar = document.getElementById("ryd-bar-container");
|
||||
|
||||
const widthPx =
|
||||
buttons_getButtons().children[0].clientWidth +
|
||||
buttons_getButtons().children[1].clientWidth +
|
||||
8;
|
||||
|
||||
const widthPercent =
|
||||
likes + dislikes > 0 ? (likes / (likes + dislikes)) * 100 : 50;
|
||||
|
||||
if (!rateBar && !isMobile()) {
|
||||
let colorLikeStyle = "";
|
||||
let colorDislikeStyle = "";
|
||||
if (extConfig.coloredBar) {
|
||||
colorLikeStyle = "; background-color: " + getColorFromTheme(true);
|
||||
colorDislikeStyle = "; background-color: " + getColorFromTheme(false);
|
||||
}
|
||||
|
||||
(
|
||||
document.getElementById("menu-container") ||
|
||||
document.querySelector("ytm-slim-video-action-bar-renderer")
|
||||
).insertAdjacentHTML(
|
||||
"beforeend",
|
||||
`
|
||||
<div class="ryd-tooltip" style="width: ${widthPx}px">
|
||||
<div class="ryd-tooltip-bar-container">
|
||||
<div
|
||||
id="ryd-bar-container"
|
||||
style="width: 100%; height: 2px;${colorDislikeStyle}"
|
||||
>
|
||||
<div
|
||||
id="ryd-bar"
|
||||
style="width: ${widthPercent}%; height: 100%${colorLikeStyle}"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
<tp-yt-paper-tooltip position="top" id="ryd-dislike-tooltip" class="style-scope ytd-sentiment-bar-renderer" role="tooltip" tabindex="-1">
|
||||
<!--css-build:shady-->${likes.toLocaleString()} / ${dislikes.toLocaleString()}
|
||||
</tp-yt-paper-tooltip>
|
||||
</div>
|
||||
`
|
||||
);
|
||||
} else {
|
||||
document.getElementById("ryd-bar-container").style.width = widthPx + "px";
|
||||
document.getElementById("ryd-bar").style.width = widthPercent + "%";
|
||||
document.querySelector(
|
||||
"#ryd-dislike-tooltip > #tooltip"
|
||||
).innerHTML = `${likes.toLocaleString()} / ${dislikes.toLocaleString()}`;
|
||||
if (extConfig.coloredBar) {
|
||||
document.getElementById("ryd-bar-container").style.backgroundColor =
|
||||
getColorFromTheme(false);
|
||||
document.getElementById("ryd-bar").style.backgroundColor =
|
||||
getColorFromTheme(true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cLog("removing bar");
|
||||
let ratebar = document.getElementById("ryd-bar-container");
|
||||
ratebar.parentNode.removeChild(ratebar);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
;// CONCATENATED MODULE: ./Extensions/combined/src/state.js
|
||||
|
||||
|
||||
|
||||
|
||||
//TODO: Do not duplicate here and in ryd.background.js
|
||||
const apiUrl = "https://returnyoutubedislikeapi.com";
|
||||
const LIKED_STATE = "LIKED_STATE";
|
||||
const DISLIKED_STATE = "DISLIKED_STATE";
|
||||
const NEUTRAL_STATE = "NEUTRAL_STATE";
|
||||
|
||||
const DISLIKES_DISABLED_TEXT = "DISLIKES DISABLED";
|
||||
|
||||
let extConfig = {
|
||||
disableVoteSubmission: false,
|
||||
coloredThumbs: false,
|
||||
coloredBar: false,
|
||||
colorTheme: "classic",
|
||||
numberDisplayFormat: "compactShort",
|
||||
numberDisplayRoundDown: true,
|
||||
};
|
||||
|
||||
let storedData = {
|
||||
likes: 0,
|
||||
dislikes: 0,
|
||||
previousState: NEUTRAL_STATE,
|
||||
};
|
||||
|
||||
let likesDisabledState = true;
|
||||
|
||||
function isMobile() {
|
||||
return location.hostname == "m.youtube.com";
|
||||
}
|
||||
|
||||
function isShorts() {
|
||||
return location.pathname.startsWith("/shorts");
|
||||
}
|
||||
|
||||
function isVideoLiked() {
|
||||
if (isMobile()) {
|
||||
return (
|
||||
getLikeButton().querySelector("button").getAttribute("aria-label") ==
|
||||
"true"
|
||||
);
|
||||
}
|
||||
return getLikeButton().classList.contains("style-default-active");
|
||||
}
|
||||
|
||||
function isVideoDisliked() {
|
||||
if (isMobile()) {
|
||||
return (
|
||||
getDislikeButton().querySelector("button").getAttribute("aria-label") ==
|
||||
"true"
|
||||
);
|
||||
}
|
||||
return getDislikeButton().classList.contains("style-default-active");
|
||||
}
|
||||
|
||||
function getState(storedData) {
|
||||
if (isVideoLiked()) {
|
||||
return { current: LIKED_STATE, previous: storedData.previousState };
|
||||
}
|
||||
if (isVideoDisliked()) {
|
||||
return { current: DISLIKED_STATE, previous: storedData.previousState };
|
||||
}
|
||||
return { current: NEUTRAL_STATE, previous: storedData.previousState };
|
||||
}
|
||||
|
||||
//--- Sets The Likes And Dislikes Values ---//
|
||||
function setLikes(likesCount) {
|
||||
getButtons().children[0].querySelector("#text").innerText = likesCount;
|
||||
}
|
||||
|
||||
function setDislikes(dislikesCount) {
|
||||
if (!likesDisabledState) {
|
||||
if (isMobile()) {
|
||||
buttons_getButtons().children[1].querySelector(
|
||||
".button-renderer-text"
|
||||
).innerText = dislikesCount;
|
||||
return;
|
||||
}
|
||||
buttons_getButtons().children[1].querySelector("#text").innerText = dislikesCount;
|
||||
} else {
|
||||
cLog("likes count disabled by creator");
|
||||
if (isMobile()) {
|
||||
buttons_getButtons().children[1].querySelector(
|
||||
".button-renderer-text"
|
||||
).innerText = DISLIKES_DISABLED_TEXT;
|
||||
return;
|
||||
}
|
||||
buttons_getButtons().children[1].querySelector("#text").innerText =
|
||||
DISLIKES_DISABLED_TEXT;
|
||||
}
|
||||
}
|
||||
|
||||
function getLikeCountFromButton() {
|
||||
if (isShorts()) {
|
||||
//Youtube Shorts don't work with this query. It's not nessecary; we can skip it and still see the results.
|
||||
//It should be possible to fix this function, but it's not critical to showing the dislike count.
|
||||
return 0;
|
||||
}
|
||||
let likesStr = getLikeButton()
|
||||
.querySelector("button")
|
||||
.getAttribute("aria-label")
|
||||
.replace(/\D/g, "");
|
||||
return likesStr.length > 0 ? parseInt(likesStr) : false;
|
||||
}
|
||||
|
||||
function processResponse(response, storedData) {
|
||||
const formattedDislike = numberFormat(response.dislikes);
|
||||
setDislikes(formattedDislike);
|
||||
storedData.dislikes = parseInt(response.dislikes);
|
||||
storedData.likes = getLikeCountFromButton() || parseInt(response.likes);
|
||||
createRateBar(storedData.likes, storedData.dislikes);
|
||||
if (extConfig.coloredThumbs === true) {
|
||||
getLikeButton().style.color = getColorFromTheme(true);
|
||||
getDislikeButton().style.color = getColorFromTheme(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function setState(storedData) {
|
||||
storedData.previousState = isVideoDisliked()
|
||||
? DISLIKED_STATE
|
||||
: isVideoLiked()
|
||||
? LIKED_STATE
|
||||
: NEUTRAL_STATE;
|
||||
let statsSet = false;
|
||||
|
||||
let videoId = getVideoId(window.location.href);
|
||||
let likeCount = getLikeCountFromButton() || null;
|
||||
|
||||
let response = await fetch(
|
||||
`${apiUrl}/votes?videoId=${videoId}&likeCount=${likeCount || ""}`,
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
},
|
||||
}
|
||||
)
|
||||
.then((response) => response.json())
|
||||
.catch();
|
||||
cLog("response from api:");
|
||||
cLog(JSON.stringify(response));
|
||||
likesDisabledState =
|
||||
numberFormat(response.dislikes) == 0 &&
|
||||
numberFormat(response.likes) == 0 &&
|
||||
numberFormat(response.viewCount) == 0;
|
||||
if (response !== undefined && !("traceId" in response) && !statsSet) {
|
||||
processResponse(response, storedData);
|
||||
}
|
||||
}
|
||||
|
||||
function setInitialState() {
|
||||
setState(storedData);
|
||||
}
|
||||
|
||||
function initExtConfig() {
|
||||
initializeDisableVoteSubmission();
|
||||
initializeColoredThumbs();
|
||||
initializeColoredBar();
|
||||
initializeColorTheme();
|
||||
initializeNumberDisplayFormat();
|
||||
initializeNumberDisplayRoundDown();
|
||||
}
|
||||
|
||||
function initializeDisableVoteSubmission() {
|
||||
getBrowser().storage.sync.get(["disableVoteSubmission"], (res) => {
|
||||
if (res.disableVoteSubmission === undefined) {
|
||||
getBrowser().storage.sync.set({ disableVoteSubmission: false });
|
||||
} else {
|
||||
extConfig.disableVoteSubmission = res.disableVoteSubmission;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function initializeColoredThumbs() {
|
||||
getBrowser().storage.sync.get(["coloredThumbs"], (res) => {
|
||||
if (res.coloredThumbs === undefined) {
|
||||
getBrowser().storage.sync.set({ coloredThumbs: false });
|
||||
} else {
|
||||
extConfig.coloredThumbs = res.coloredThumbs;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function initializeColoredBar() {
|
||||
getBrowser().storage.sync.get(["coloredBar"], (res) => {
|
||||
if (res.coloredBar === undefined) {
|
||||
getBrowser().storage.sync.set({ coloredBar: false });
|
||||
} else {
|
||||
extConfig.coloredBar = res.coloredBar;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function initializeNumberDisplayRoundDown() {
|
||||
getBrowser().storage.sync.get(["numberDisplayRoundDown"], (res) => {
|
||||
if (res.numberDisplayRoundDown === undefined) {
|
||||
getBrowser().storage.sync.set({ numberDisplayRoundDown: true });
|
||||
} else {
|
||||
extConfig.numberDisplayRoundDown = res.numberDisplayRoundDown;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function initializeColorTheme() {
|
||||
getBrowser().storage.sync.get(["colorTheme"], (res) => {
|
||||
if (res.colorTheme === undefined) {
|
||||
getBrowser().storage.sync.set({ colorTheme: false });
|
||||
} else {
|
||||
extConfig.colorTheme = res.colorTheme;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function initializeNumberDisplayFormat() {
|
||||
getBrowser().storage.sync.get(["numberDisplayFormat"], (res) => {
|
||||
if (res.numberDisplayFormat === undefined) {
|
||||
getBrowser().storage.sync.set({ numberDisplayFormat: "compactShort" });
|
||||
} else {
|
||||
extConfig.numberDisplayFormat = res.numberDisplayFormat;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
;// CONCATENATED MODULE: ./Extensions/combined/src/buttons.js
|
||||
|
||||
|
||||
|
||||
function buttons_getButtons() {
|
||||
//--- If Watching Youtube Shorts: ---//
|
||||
if (isShorts()) {
|
||||
let elements = document.querySelectorAll(
|
||||
isMobile()
|
||||
? "ytm-like-button-renderer"
|
||||
: "#like-button > ytd-like-button-renderer"
|
||||
);
|
||||
for (let element of elements) {
|
||||
//Youtube Shorts can have multiple like/dislike buttons when scrolling through videos
|
||||
//However, only one of them should be visible (no matter how you zoom)
|
||||
if (isInViewport(element)) {
|
||||
return element;
|
||||
}
|
||||
}
|
||||
}
|
||||
//--- If Watching On Mobile: ---//
|
||||
if (isMobile()) {
|
||||
return document.querySelector(".slim-video-action-bar-actions");
|
||||
}
|
||||
//--- If Menu Element Is Displayed: ---//
|
||||
if (document.getElementById("menu-container")?.offsetParent === null) {
|
||||
return document.querySelector("ytd-menu-renderer.ytd-watch-metadata > div");
|
||||
//--- If Menu Element Isnt Displayed: ---//
|
||||
} else {
|
||||
return document
|
||||
.getElementById("menu-container")
|
||||
?.querySelector("#top-level-buttons-computed");
|
||||
}
|
||||
}
|
||||
|
||||
function getLikeButton() {
|
||||
return buttons_getButtons().children[0];
|
||||
}
|
||||
|
||||
function getDislikeButton() {
|
||||
return buttons_getButtons().children[1];
|
||||
}
|
||||
|
||||
function checkForSignInButton() {
|
||||
if (
|
||||
document.querySelector(
|
||||
"a[href^='https://accounts.google.com/ServiceLogin']"
|
||||
)
|
||||
) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
;// CONCATENATED MODULE: ./Extensions/combined/src/events.js
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function sendVote(vote) {
|
||||
if (extConfig.disableVoteSubmission !== true) {
|
||||
getBrowser().runtime.sendMessage({
|
||||
message: "send_vote",
|
||||
vote: vote,
|
||||
videoId: getVideoId(window.location.href),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function likeClicked() {
|
||||
if (checkForSignInButton() === false) {
|
||||
if (storedData.previousState === DISLIKED_STATE) {
|
||||
sendVote(1);
|
||||
if (storedData.dislikes > 0) storedData.dislikes--;
|
||||
storedData.likes++;
|
||||
createRateBar(storedData.likes, storedData.dislikes);
|
||||
setDislikes(numberFormat(storedData.dislikes));
|
||||
storedData.previousState = LIKED_STATE;
|
||||
} else if (storedData.previousState === NEUTRAL_STATE) {
|
||||
sendVote(1);
|
||||
storedData.likes++;
|
||||
createRateBar(storedData.likes, storedData.dislikes);
|
||||
storedData.previousState = LIKED_STATE;
|
||||
} else if ((storedData.previousState = LIKED_STATE)) {
|
||||
sendVote(0);
|
||||
if (storedData.likes > 0) storedData.likes--;
|
||||
createRateBar(storedData.likes, storedData.dislikes);
|
||||
storedData.previousState = NEUTRAL_STATE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function dislikeClicked() {
|
||||
if (checkForSignInButton() == false) {
|
||||
if (storedData.previousState === NEUTRAL_STATE) {
|
||||
sendVote(-1);
|
||||
storedData.dislikes++;
|
||||
setDislikes(numberFormat(storedData.dislikes));
|
||||
createRateBar(storedData.likes, storedData.dislikes);
|
||||
storedData.previousState = DISLIKED_STATE;
|
||||
} else if (storedData.previousState === DISLIKED_STATE) {
|
||||
sendVote(0);
|
||||
if (storedData.dislikes > 0) storedData.dislikes--;
|
||||
setDislikes(numberFormat(storedData.dislikes));
|
||||
createRateBar(storedData.likes, storedData.dislikes);
|
||||
storedData.previousState = NEUTRAL_STATE;
|
||||
} else if (storedData.previousState === LIKED_STATE) {
|
||||
sendVote(-1);
|
||||
if (storedData.likes > 0) storedData.likes--;
|
||||
storedData.dislikes++;
|
||||
setDislikes(numberFormat(storedData.dislikes));
|
||||
createRateBar(storedData.likes, storedData.dislikes);
|
||||
storedData.previousState = DISLIKED_STATE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function addLikeDislikeEventListener() {
|
||||
const buttons = buttons_getButtons();
|
||||
if (!window.returnDislikeButtonlistenersSet) {
|
||||
buttons.children[0].addEventListener("click", likeClicked);
|
||||
buttons.children[1].addEventListener("click", dislikeClicked);
|
||||
buttons.children[0].addEventListener("touchstart", likeClicked);
|
||||
buttons.children[1].addEventListener("touchstart", dislikeClicked);
|
||||
window.returnDislikeButtonlistenersSet = true;
|
||||
}
|
||||
}
|
||||
|
||||
function storageChangeHandler(changes, area) {
|
||||
if (changes.disableVoteSubmission !== undefined) {
|
||||
handleDisableVoteSubmissionChangeEvent(
|
||||
changes.disableVoteSubmission.newValue
|
||||
);
|
||||
}
|
||||
if (changes.coloredThumbs !== undefined) {
|
||||
handleColoredThumbsChangeEvent(changes.coloredThumbs.newValue);
|
||||
}
|
||||
if (changes.coloredBar !== undefined) {
|
||||
handleColoredBarChangeEvent(changes.coloredBar.newValue);
|
||||
}
|
||||
if (changes.colorTheme !== undefined) {
|
||||
handleColorThemeChangeEvent(changes.colorTheme.newValue);
|
||||
}
|
||||
|
||||
if (changes.numberDisplayRoundDown !== undefined) {
|
||||
handleNumberDisplayRoundDownChangeEvent(
|
||||
changes.numberDisplayRoundDown.newValue
|
||||
);
|
||||
}
|
||||
if (changes.numberDisplayFormat !== undefined) {
|
||||
handleNumberDisplayFormatChangeEvent(changes.numberDisplayFormat.newValue);
|
||||
}
|
||||
}
|
||||
|
||||
function handleDisableVoteSubmissionChangeEvent(value) {
|
||||
extConfig.disableVoteSubmission = value;
|
||||
}
|
||||
|
||||
function handleColoredThumbsChangeEvent(value) {
|
||||
extConfig.coloredThumbs = value;
|
||||
}
|
||||
|
||||
function handleColoredBarChangeEvent(value) {
|
||||
extConfig.coloredBar = value;
|
||||
}
|
||||
|
||||
function handleColorThemeChangeEvent(value) {
|
||||
if (!value) value = "classic";
|
||||
extConfig.colorTheme = value;
|
||||
}
|
||||
|
||||
function handleNumberDisplayFormatChangeEvent(value) {
|
||||
extConfig.numberDisplayFormat = value;
|
||||
}
|
||||
|
||||
function handleNumberDisplayRoundDownChangeEvent(value) {
|
||||
extConfig.numberDisplayRoundDown = value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
;// CONCATENATED MODULE: ./Extensions/combined/ryd.content-script.js
|
||||
//--- Import Button Functions ---//
|
||||
|
||||
|
||||
//--- Import State Functions ---//
|
||||
|
||||
|
||||
//--- Import Video & Browser Functions ---//
|
||||
|
||||
|
||||
|
||||
|
||||
initExtConfig();
|
||||
|
||||
let jsInitChecktimer = null;
|
||||
|
||||
function setEventListeners(evt) {
|
||||
function checkForJS_Finish() {
|
||||
if (isShorts() || (buttons_getButtons()?.offsetParent && isVideoLoaded())) {
|
||||
addLikeDislikeEventListener();
|
||||
setInitialState();
|
||||
getBrowser().storage.onChanged.addListener(storageChangeHandler);
|
||||
clearInterval(jsInitChecktimer);
|
||||
jsInitChecktimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
jsInitChecktimer = setInterval(checkForJS_Finish, 111);
|
||||
}
|
||||
|
||||
setEventListeners();
|
||||
|
||||
document.addEventListener("yt-navigate-finish", function (event) {
|
||||
if (jsInitChecktimer !== null) clearInterval(jsInitChecktimer);
|
||||
window.returnDislikeButtonlistenersSet = false;
|
||||
setEventListeners();
|
||||
});
|
||||
|
||||
|
||||
/******/ })()
|
||||
;
|
||||