Skip to content

Commit 851d9e7

Browse files
fix: Add support for new google groups UI (#38)
1 parent 54d8477 commit 851d9e7

File tree

3 files changed

+33
-33
lines changed

3 files changed

+33
-33
lines changed

.eslintrc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ module.exports = {
44
"webextensions": true
55
},
66
"extends": "eslint:recommended",
7+
'parserOptions': {
8+
'parser': 'babel-eslint',
9+
'ecmaVersion': 2018
10+
},
711
"rules": {
812
"indent": [
913
"error",

src/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
},
1717
"content_scripts": [
1818
{
19-
"matches": ["*://groups.google.com/forum/*"],
19+
"matches": ["*://groups.google.com/forum/*", "*://groups.google.com/g/*"],
2020
"js": ["scripts/jquery-3.2.1.min.js","scripts/scrumHelper.js"]
2121
}
2222
],

src/scripts/scrumHelper.js

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ function allIncluded(){
169169
<br>"+nextWeekUl+"<br><br>\
170170
<b>3. What is stopping me from doing my work?</b>\
171171
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+userReason+"</p>";
172+
scrumBody.dispatchEvent(new Event("paste", { bubbles: true }));
172173
});
173174
}
174175

@@ -202,7 +203,8 @@ function allIncluded(){
202203
date="0"+date;
203204
var dateCode=year.toString()+month.toString()+date.toString();
204205
scrumSubject.value = "[Scrum] "+name+" - "+project+" - "+dateCode+" - False";
205-
},2000);
206+
scrumSubject.dispatchEvent(new Event("input", { bubbles: true }));
207+
});
206208
}
207209

208210
// write PRs Reviewed
@@ -320,44 +322,34 @@ function allIncluded(){
320322
}
321323
//check for scrum body loaded
322324
var intervalBody = setInterval(function(){
323-
var scrumBody0=document.getElementById("p-b-0");
324-
var scrumBody1=document.getElementById("p-b-1");
325-
var scrumBody2=document.getElementById("p-b-2");
326-
if(scrumBody0){
327-
clearInterval(intervalBody);
328-
scrumBody=document.getElementById("p-b-0");
329-
writeScrumBody();
330-
}
331-
if(scrumBody1){
325+
var bodies = [
326+
document.getElementById("p-b-0"),
327+
document.getElementById("p-b-1"),
328+
document.getElementById("p-b-2"),
329+
document.querySelector("c-wiz [aria-label='Compose a message'][role=textbox]")];
330+
for (var body of bodies) {
331+
if (!body)
332+
continue;
332333
clearInterval(intervalBody);
333-
scrumBody=document.getElementById("p-b-1");
334-
writeScrumBody();
335-
}
336-
if(scrumBody2){
337-
clearInterval(intervalBody);
338-
scrumBody=document.getElementById("p-b-2");
334+
scrumBody=body;
339335
writeScrumBody();
340336
}
341337
},500);
342338

343339
//check for subject loaded
344340
var intervalSubject = setInterval(function(){
345-
var scrumSubject0=document.getElementById("p-s-0");
346-
var scrumSubject1=document.getElementById("p-s-1");
347-
var scrumSubject2=document.getElementById("p-s-2");
348-
if(scrumSubject0 && githubUserData){
349-
clearInterval(intervalSubject);
350-
scrumSubject=document.getElementById("p-s-0");
351-
scrumSubjectLoaded();
352-
}
353-
else if(scrumSubject1 && githubUserData){
354-
clearInterval(intervalSubject);
355-
scrumSubject=document.getElementById("p-s-1");
356-
scrumSubjectLoaded();
357-
}
358-
else if(scrumSubject2 && githubUserData){
341+
if (!githubUserData)
342+
return;
343+
var subjects = [
344+
document.getElementById("p-s-0"),
345+
document.getElementById("p-s-1"),
346+
document.getElementById("p-s-2"),
347+
document.querySelector("c-wiz input[aria-label=Subject]")];
348+
for (var subject of subjects) {
349+
if (!subject)
350+
continue;
359351
clearInterval(intervalSubject);
360-
scrumSubject=document.getElementById("p-s-2");
352+
scrumSubject=subject;
361353
scrumSubjectLoaded();
362354
}
363355
},500);
@@ -399,4 +391,8 @@ function allIncluded(){
399391
allIncluded();
400392
}
401393
}
402-
allIncluded();
394+
allIncluded();
395+
396+
$("button>span:contains(New conversation)").parent("button").click(function() {
397+
allIncluded();
398+
});

0 commit comments

Comments
 (0)