4 Commits

Author SHA1 Message Date
joel 9f277a45f3 Update manifest to V3 2023-01-16 21:49:09 +01:00
joel fb1ed4145e changed xpath and observer to work with two-column table 2021-10-31 14:06:19 +01:00
joel 20e08895d1 Update to be compatible with JWConfV3 2021-08-30 19:40:06 +02:00
joel 244b5971ab add readme 2021-04-14 16:43:28 +00:00
3 changed files with 83 additions and 33 deletions
+11
View File
@@ -0,0 +1,11 @@
# JWConfZoomHand
JWConfZoomHand ist eine Chrome-Extension, die es möglich macht bei Meldungen in der JWConf automatisch in Zoom die Hand zu heben und zu senken.
## Installation und Benutzung
Folge den Hinweisen in [Installation_und_Hinweise.pdf](/joel/jwconfzoomhand/src/branch/master/Installation_und_Hinweise.pdf)
## License
[MIT](https://choosealicense.com/licenses/mit/)
+42 -13
View File
@@ -1,8 +1,8 @@
/*
JWConfZoomHand
2020.08.04
Based on JWConf Signal 2018.04.29
2021.08.28
(c) 2021 - JB
Some Parts from JWConf Signal 2018.04.29
(c) 2018 - Simon Lorenz - werbung@lorenzweb.net
*/
@@ -24,21 +24,50 @@ JWConfZoomHand
var JWConfRaisings = 0;
// loop through table of attendees and call for observer subscription
function subscribeNewAttendees() {
/* function subscribeNewAttendees() {
if (signalEnabled === false) {
return;
}
var tableAttendees = document.getElementById("confroom");
var tableAttendees = document.getElementById("content").getElementsByTagName("table")[0];
if (typeof(tableAttendees) !== "undefined" && tableAttendees !== null) {
for (var i = 0, row; row = tableAttendees.rows[i]; i++) {
if (row.parentNode.localName !== "thead")
addObserver(row);
}
}
} */
function subscribeNewAttendees() {
if (signalEnabled === false) {
return;
}
var tablesAttendees = document.evaluate('//table[starts-with(@class,"listener-table")]', document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null );
var tableAttendees = null;
for ( var i=0; i < tablesAttendees.snapshotLength; i++ )
{
tableAttendees = tablesAttendees.snapshotItem(i)
for (var i = 0, row; row = tableAttendees.rows[i]; i++) {
if (row.parentNode.localName !== "thead") {
addObserver(row);
}
}
}
}
/*
wegen unten XPathResult.ORDERED_NODE_ITERATOR_TYPE durch XPathResult.ORDERED_NODE_SNAPSHOT_TYPE ersetzt (
siehe https://developer.mozilla.org/en-US/docs/Web/API/Document/evaluate
Results of NODE_SNAPSHOT types are snapshots, which are essentially lists of matched nodes. You can make changes to the document by altering snapshot nodes. Modifying the document doesn't invalidate the snapshot; however, if the document is changed, the snapshot may not correspond to the current state of the document, since nodes may have moved, been changed, added, or removed.
führt leider manchmal zu
jwconfsignal.js:46 Uncaught DOMException: Failed to execute 'iterateNext' on 'XPathResult': The document has mutated since the result was returned.
at subscribeNewAttendees (chrome-extension://hhcadpapjmemfpokloljohmahipbjhmb/jwconfsignal.js:46:42)
at chrome-extension://hhcadpapjmemfpokloljohmahipbjhmb/jwconfsignal.js:250:4 */
function updateJWConfRaisings() {
JWConfRaisings = document.evaluate('count(//table[@class="monitorTbl"]//tr[@class="detected meldung-blue" or @class="detected meldungActive"])', document, null, XPathResult.ANY_TYPE, null ).numberValue;
//JWConfRaisings = document.evaluate('count(//table[starts-with(@class,"listener-table")]//tr[@class="speechrequest detected"])', document, null, XPathResult.ANY_TYPE, null ).numberValue;
JWConfRaisings = document.evaluate('count(//table[starts-with(@class,"listener-table")]//tr[@class="detected speechrequest" or @class="speechrequest detected" or @style="background-color: rgb(23, 121, 186); color: rgb(254, 254, 254);" or @style="background-color: rgb(161, 184, 105); color: rgb(254, 254, 254);"])', document, null, XPathResult.ANY_TYPE, null ).numberValue;
}
function subscribeAttList() {
@@ -49,7 +78,7 @@ JWConfZoomHand
}
});
x.observe(document.getElementById('confroom'), { childList: true, subtree: true});
x.observe(document.getElementById("content"), { childList: true, subtree: true});
}
// add observer for any new attendee
@@ -65,7 +94,7 @@ JWConfZoomHand
var attributeValue = $(mutation.target).prop(mutation.attributeName);
console.log("Class attribute", addToElement.children[0].innerText, "changed to:", attributeValue);
if (attributeValue === "detected meldung-blue") {
if (attributeValue === "detected speechrequest") {
decideZoomHand(true);
} else if (attributeValue === "detected") {
@@ -113,14 +142,14 @@ JWConfZoomHand
// add on/off selector to "Live Monitor" headline
function addSelectorToMonitorHeadline() {
var headlineToFind = getMessage("headlineToAttach");
var headlineToFind = " Zuhörer";
var h4Elements = document.getElementsByTagName("h4");
if (typeof(h4Elements) !== "undefined" && h4Elements !== null) {
for (var i=0, h4Element; h4Element = h4Elements[i]; i++) {
if (typeof(h4Element.childNodes) !== "undefined" && h4Element.childNodes !== null) {
for (var ii=0, childNode; childNode = h4Element.childNodes[ii]; ii++) {
if (typeof(childNode.nodeValue) !== "undefined" && childNode.nodeValue !== null) {
if (childNode.nodeValue.startsWith(headlineToFind) || childNode.nodeValue.startsWith("Live") || childNode.nodeValue.startsWith("Interface Live")) {
if (childNode.nodeValue.startsWith(headlineToFind)) {
// add selector
var selectorElem = document.createElement("div");
selectorElem.style = "display: inline-block; margin-left: 10px;height: 22px;background-color: #c60f13;width: 49px;";
@@ -243,7 +272,7 @@ JWConfZoomHand
if (typeof(h4Element.childNodes) !== "undefined" && h4Element.childNodes !== null) {
for (var ii=0, childNode; childNode = h4Element.childNodes[ii]; ii++) {
if (typeof(childNode.nodeValue) !== "undefined" && childNode.nodeValue !== null) {
if (childNode.nodeValue.startsWith(getMessage("headlineToAttach")) || childNode.nodeValue.startsWith("Live") || childNode.nodeValue.startsWith("Interface Live")) {
if (childNode.nodeValue.startsWith(" Zuhörer")) {
return true
}
}
@@ -263,8 +292,8 @@ JWConfZoomHand
addSelectorToMonitorHeadline();
startNewAttendeesDetection();
subscribeAttList();
//folgende Zeile auskommentieren, wenn die Konferenz nicht automatisch verbunden werden solls
//document.evaluate('//*[@id="hall"]/div[2]/div[2]/div/div/div[1]/div/a', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null ).singleNodeValue.click()
//die beiden // in der folgenden Zeile entfernen, wenn sich die Konferenz automatisch verbinden soll bzw. // davor setzen wenn sie manuell verbunden werden soll
//setTimeout(function(){ document.evaluate('//*[@id="left-column"]/div/div[2]/div[2]/button', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null ).singleNodeValue.click(); }, 1000);
}
}
+30 -20
View File
@@ -1,36 +1,46 @@
{
// Extension ID: hhcadpapjmemfpokloljohmahipbjhmb
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtXRV6Vq2HTR6M1ryxP+8c4EvfCNo1K7SY8rkpBAdvZfDuxPB89Tkkm282/pkyl0ppmTyCpYO3bIXPKuDSg5TZfAItfXF2VgoMVUjXwiWy6qSiAkdaoHyNLuQqCcexqNvvqnKgfvkiZBK3HPNJzZFpx9BMFvSoG4RQz7GjYGjqzu95LW6tmI0HAMDKzHihdZ6d6oCgov/yJXIYyUBUSz+uVYpLM2xHRaOxU76AS896RzUNZEV5CUvioclqrmqQDp4gB7NJ2tDODil11T2yE4cVuIz9z/X3eZ7Y1mBmfHK1WnnFb+N5PMu/n1fA6re0bqAg6rT8gZNdeXlcAlytts4nwIDAQAB",
"name":"jwconfzoomhand",
"short_name":"JWConfZoomHand",
"version":"2021.01.10",
"manifest_version":2,
"name": "jwconfzoomhand",
"short_name": "JWConfZoomHand",
"version": "2023.01.14",
"manifest_version": 3,
"default_locale": "de",
"description":"-",
"web_accessible_resources" : ["/jscolor.js", "/checkMark.png"],
"description": "-",
"web_accessible_resources": [
{
"resources": [
"/jscolor.js",
"/checkMark.png"
],
"matches": [
"https://jwconf.org/*"
]
}
],
"icons": {
"128": "icon_128px.png",
"48": "icon_48px.png"
"48": "icon_48px.png"
},
"background": {
"scripts": ["background.js"],
"persistent": true
},
"browser_action": {
"default_icon": "icon_48px.png"
"background": {
"service_worker": "background.js"
},
"content_scripts": [
{
"matches": ["*://jwconf.org/*"],
"js": ["/jquery.min.js", "content.js", "/jwconfsignal.js"],
"matches": [
"*://jwconf.org/*"
],
"js": [
"/jquery.min.js",
"content.js",
"/jwconfsignal.js"
],
"run_at": "document_end"
}
],
"permissions":[
"permissions": [
"activeTab",
"nativeMessaging"
],
"homepage_url": "http://test.local"
}
"homepage_url": "http://jwconfzoomhand.local"
}