Skip to content

Commit

Permalink
plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
l00mi committed Mar 15, 2024
1 parent 1611df6 commit 73e6574
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 0 deletions.
Empty file.
11 changes: 11 additions & 0 deletions kommentator2000-plugin/content.js
@@ -0,0 +1,11 @@
console.log("started");

chrome.runtime.onMessage.addListener(function(message, sender) {

alert("ping");

newUrl = "http://127.0.0.1:5000?consultation_id="+document.getElementsByClassName('srnummer')[0].textContent;
chrome.tabs.create({ url: newURL });


});
22 changes: 22 additions & 0 deletions kommentator2000-plugin/manifest.json
@@ -0,0 +1,22 @@
{
"manifest_version": 3,
"name": "Kommentator 2000",
"version": "1.0",
"permissions": ["activeTab","scripting","nativeMessaging"],
"action": {
"default_popup": "popup.html"
},
"background": {
"service_worker": "background.js"
},
"content_scripts": [
{
"matches": ["https://www.fedlex.admin.ch/eli/*"],
"js": ["content.js"],
"css": ["styles.css"]
}
],
"host_permissions": [
"https://www.fedlex.admin.ch/*"
]
}
12 changes: 12 additions & 0 deletions kommentator2000-plugin/popup.html
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<title>Article Selector</title>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<h1 id="title-h1">Select Articles</h1>
<button id="download-btn">Starte die Vernehmlassung.</button>
<script src="popup.js"></script>
</body>
</html>
11 changes: 11 additions & 0 deletions kommentator2000-plugin/popup.js
@@ -0,0 +1,11 @@

console.log("popup.js loaded");
document.getElementById("title-h1").textContent = "Kommentator 2000";
document.getElementById("download-btn").addEventListener("click", function(e) {
document.getElementById("title-h1").textContent = "Kommentator 2000, it's a go.";



chrome.runtime.sendMessage({'myPopupIsOpen': true});

});
16 changes: 16 additions & 0 deletions kommentator2000-plugin/styles.css
@@ -0,0 +1,16 @@
body {
font-family: Arial, sans-serif;
padding: 20px;
}

#download-btn {
background-color: #4CAF50;
color: white;
padding: 10px 20px;
margin: 10px 0;
border: none;
cursor: pointer;
}
#download-btn:hover {
background-color: #45a049;
}

0 comments on commit 73e6574

Please sign in to comment.