Initial Commit

main
Gabriel 1 year ago
parent ef3ab75020
commit 20171ac7cf

1
.gitignore vendored

@ -0,0 +1 @@
web-ext-artifacts

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 KiB

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="512mm"
height="512mm"
viewBox="0 0 512 512"
version="1.1"
id="svg5"
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
sodipodi:docname="icon.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0"
inkscape:showpageshadow="2"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="mm"
showgrid="false"
inkscape:zoom="0.2201416"
inkscape:cx="-433.81169"
inkscape:cy="1217.3982"
inkscape:window-width="1920"
inkscape:window-height="989"
inkscape:window-x="1920"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="layer1" />
<defs
id="defs2">
<linearGradient
inkscape:collect="always"
id="linearGradient3573">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop3569" />
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop3571" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3573"
id="linearGradient3575"
x1="77.55381"
y1="240.78974"
x2="420.41064"
y2="240.78974"
gradientUnits="userSpaceOnUse" />
</defs>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<path
style="opacity:0.99;fill:#000000;fill-opacity:0.992157;stroke:#ffffff;stroke-width:6.35493;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
d="m 435.94344,339.35464 c 0,0 154.15096,-303.209427 -177.68032,-310.614153 C -92.150239,20.921107 49.682178,352.00291 67.439931,364.26553 94.694519,383.08619 487.8506,483.39587 487.8506,483.39587 Z"
id="path3855"
sodipodi:nodetypes="csscc" />
<text
xml:space="preserve"
style="font-size:275.452px;font-family:FreeSerif;-inkscape-font-specification:FreeSerif;text-align:center;text-anchor:middle;opacity:0.99;fill:#13ea1b;fill-opacity:0.992157;stroke:#40da15;stroke-width:9.5288;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
x="252.04008"
y="309.6485"
id="text2242"
transform="scale(1.0217089,0.97875237)"><tspan
sodipodi:role="line"
id="tspan2240"
style="font-style:italic;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:275.452px;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans Bold';fill:#3dd912;fill-opacity:0.992157;stroke:#40da15;stroke-width:9.5288;stroke-dasharray:none;stroke-opacity:1"
x="252.04008"
y="309.6485">D</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.1 KiB

@ -0,0 +1,32 @@
{
"manifest_version": 2,
"name": "dissent",
"version": "0.1.0",
"content_scripts":[
{
"matches":["https://*/*"],
"js": ["content_script.js"]
}
],
"options_ui":{
"page":"options.html"
},
"browser_action": {
"browser_style": true,
"default_icon": "/icon.svg",
"default_title": "Misskey Dissenter",
"default_popup": "popup.html"
},
"browser_specific_settings":{
"gecko":{
"id":"notsure@ifneeded.com"
}
},
"permissions":[
"<all_urls>",
"webRequest",
"storage",
"tabs"
]
}

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head> <meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="/style.css">
</head>
<body>
<div>
<img style='max-width:15rem;' src="/icon.svg">
<h2>Dissent</h2>
</div>
<form>
<label>Choose your instance: </label><br>
<input id="instance" placeholder="Choose an instance"><button id="save">Save</button>
</form>
<script src="options.js"></script>
</body>
</html>

@ -0,0 +1,14 @@
var instance = document.getElementById('instance')
instance.addEventListener('onchange',function (event){
browser.storage.sync.set({'value':event.target.value});
});
document.getElementById('save').addEventListener('click',function(event){
browser.storage.sync.set({'value':instance.value});
});
document.addEventListener('DOMContentLoaded',function(){
browser.storage.sync.get('value').then(
result => instance.value = result.value,
err => instance.value="Error.")
});

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="/style.css">
</head>
<body>
<p id="err"></p>
<h2>Posts:</h2>
<div id="notes">
</div>
<a href="/options.html">Settings</a>
<script src="popup.js"></script>
</body>
</html>

@ -0,0 +1,56 @@
var misskey_host = ""
err = document.getElementById('err');
browser.storage.sync.get('value').then(
result => misskey_host = result.value,
err => misskey_host = default_host);
browser.storage.sync.get('instance').then(result => misskey_host = instance)
browser.tabs
.query({ currentWindow: true, active: true })
.then(tabs => update_data(tabs[0].url), err => document.getElementById('err').innerHTML=err);
function display_notes(data){
n = document.getElementById('notes');
n.innerHTML = "";
update = "";
if (data.length == 0){
update="<p>No data</p>"
}
for (var i = 0; i < data.length; i++){
note = data[i];
if (note['user']['host'] == null){
note['user']['host'] = misskey_host;
}
update += "<div class='note'>";
update +="<div class='poster'><img src='"+note['user']['avatarUrl'];
update+="'><strong>";
update+= note['user']['username']+"@"+note['user']['host']+"</strong></div>";
if (!note['url']){
note['url'] = note['uri'];
}
update +="<p>"+note['text']+"<br><a href='"+note['url']+"'>link</a> "
if (note['renoteCount'] || note['repliesCount']){
update +=note['renoteCount']+" renotes "+note['repliesCount']+" replies"
}
update += "</p></div><hr>"
}
n.innerHTML = update;
document.getElementById('err').style.display="none";
}
async function update_data(url){
document.getElementById('err').innerHTML = "Getting notes for:" + url +"<br>From: "+misskey_host;
data = JSON.stringify({
"query":url,
"limit":100,
});
await fetch(misskey_host +"/api/notes/search",{
method:'POST',
body:data,
headers:{"Content-Type":"application/json"}
}).then(resp => resp.json()).then(data => display_notes(data));
}

@ -0,0 +1,72 @@
body {
margin: 0;
padding: 0;
--theme-color-primary: rgba(255, 255, 255, 1);
--theme-color-secondary: black;
--theme-accent: #09448c;
background-color: var(--theme-color-primary);
color: var(--theme-color-secondary);
font-size: 1.5rem;
display:flex;
flex-direction: column;
align-items: center;
padding:2rem;
height:100%;
}
@media screen and (prefers-color-scheme:dark) {
body {
--theme-color-primary: rgba(0, 0, 0, 1);
--theme-color-secondary: white;
--theme-accent: #2db1f3;
}
}
a{
text-decoration: none;
color:var(--theme-accent);
}
hr{
width:100%;
color:transparent;
}
#url{
width:100%;
padding:0.5rem;
border-radius:0.5rem;
}
#notes{
display:flex;
flex-direction: column;
max-width:1200px;
}
.note{
color: var(--theme-color-secondary);
width:100%;
display:flex;
align-items: flex-start;
justify-content: flex-start;
flex-direction: row;
padding-bottom: 1rem;
}
.poster{
display:flex;
flex-direction: column-reverse;
align-items: center;
justify-content: flex-start;
width:20rem;
max-width:20rem;
margin:0;
margin-right:1rem;
word-wrap: break-word;
}
.poster * {
margin:0;
}
.poster img {
width:15rem;
}
.note>*{
margin:1rem;
}
Loading…
Cancel
Save