Skip to content

Commit

Permalink
Merge pull request #11 from AlterTobi/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
AlterTobi authored Dec 9, 2021
2 parents d77392e + 7745084 commit 61b7ed2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
4 changes: 3 additions & 1 deletion wfes-Base.user.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name WFES - Base
// @namespace https://github.com/AlterTobi/WFES/
// @version 0.7.1
// @version 0.8.0
// @description basic functionality for WFES
// @author AlterTobi
// @match https://wayfarer.nianticlabs.com/*
Expand Down Expand Up @@ -105,6 +105,8 @@
case PREFIX + 'manage':
// nomination list
window.wfes.nominations.list = json.result.nominations;
window.wfes.nominations.canAppeal = json.result.canAppeal;
window.wfes.nominations.wayspots = json.result.wayspots;
window.dispatchEvent(new Event("WFESNominationListLoaded"));
break;
case PREFIX + 'manage/detail':
Expand Down
23 changes: 18 additions & 5 deletions wfes-NominationNotify.user.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name WFES - Nomination Notify
// @namespace https://github.com/AlterTobi/WFES/
// @version 0.4.0
// @version 0.5.0
// @description show nomination status updates
// @author AlterTobi
// @match https://wayfarer.nianticlabs.com/*
Expand All @@ -15,7 +15,7 @@
'use strict';

const lStoreList = 'wfesNomList';
const states = ['ACCEPTED','REJECTED','VOTING','DUPLICATE','WITHDRAWN','NOMINATED'];
const states = ['ACCEPTED','REJECTED','VOTING','DUPLICATE','WITHDRAWN','NOMINATED','APPEALED'];

function localSave(name,content){
let json = JSON.stringify(content);
Expand Down Expand Up @@ -52,6 +52,9 @@
.wfesBgOrange{
background-color: #FC9000D0;
}
.wfesBgBlue{
background-color: #0010DFD0;
}
.wfesNotifyCloseButton{
float: right;
}
Expand All @@ -78,6 +81,9 @@
case 'orange':
notification.setAttribute("class", "wfesNotification wfesBgOrange");
break;
case 'blue':
notification.setAttribute("class", "wfesNotification wfesBgBlue");
break;
default:
notification.setAttribute("class", "wfesNotification wfesBgGreen");
break;
Expand Down Expand Up @@ -123,7 +129,7 @@

function detectChange(){
// make a copy
let nomList = JSON.parse(JSON.stringify(wfes.nominations.list));
let nomList = JSON.parse(JSON.stringify(window.wfes.nominations.list));
let historyDict = JSON.parse(localStorage.getItem(lStoreList)) || [];
const missingDict = detectMissing();

Expand All @@ -147,6 +153,11 @@
historicalData = historyDict[nom.id];
myDates = {};

// detect unknown states
if (!states.includes(nom.status)) {
createNotification(`${nom.title} has unknown state: ${nom.status}`,'blue');
}

if (historicalData === undefined) {
myDates[nom.status] = today; // save current date and
// state
Expand All @@ -170,7 +181,7 @@
// Niantic Review?
if (historicalData.isNianticControlled === false && nom.isNianticControlled === true){
myDates.NIANTICREVIEW = today;
createNotification(`${nom.title} went into Niantic review!`, red);
createNotification(`${nom.title} went into Niantic review!`, 'red');
}

// was missing?
Expand All @@ -188,7 +199,9 @@
}else if(nom.status === "DUPLICATE"){
createNotification(`${nom.title} was marked as a duplicate!`);
}
}
} else if ((historicalData.status !== "APPEALED") && (nom.status === "APPEALED")){
createNotification(`${nom.title} was appealed!`);
}

// save Dates of each state change
for (let j = 0; j < states.length; j++) {
Expand Down

0 comments on commit 61b7ed2

Please sign in to comment.