HiveBrain v1.2.0
Get Started
← Back to all entries
patternjavascriptMinor

The Handy-Dandy Apocalypse Assistant

Submitted by: @import:stackexchange-codereview··
0
Viewed 0 times
dandythehandyassistantapocalypse

Problem

Code Review is running rampant with an infection. A zombie infection.
Everywhere posts are becoming rapidly mutated into slobbering, green
freaks of nature. But the citizens of Code Review are not running. No;
they are fighting! These CRitters are shooting the zombies left and
right to keep Code Review a safe and healthy community for everyone.

And, here to help you on your mission is The Apocalypse Assistant.
With this utility, you can now keep track of how well you are doing in
keeping the zombies at bay.

Back-story: Call of Duty - We're on a mission

For each UTC day, you get 40 votes to cast on questions and answers of your liking and an unlimited amount of answers. This UserScript keeps track of how much of your ammo (votes) you have used and how many shots (answers) you have fired at zombies.

But first, what is a zombie?

In a (successful) attempt to motivate the community in reducing the
number of unanswered questions, a Call of Duty was made in which every
unanswered question (no upvoted answers) is to be regarded as a
Zombie. Every new question is to be regarded as an incoming Zombie.

This can be found on GitHub:

```
// ==UserScript==
// @name The Apocalypse Assistant
// @namespace https://github.com/SirPython/TheApocalypseAssistant
// @version 0.1
// @description A tool for helping you know how well you are holding back the zombies
// @author SirPython
// @match ://codereview.stackexchange.com/
// @grant GM_registerMenuCommand
// @grant GM_notification
// @grant GM_setValue
// @grant GM_getValue
// ==/UserScript==

var STORAGE_NAME = "TheApocalypseAssistant";
var VOTES_PER_DAY = 40;

var ups = document.getElementsByClassName("vote-up-off");
var downs = document.getElementsByClassName("vote-down-off");
var submitAnswer = document.getElementById("submit-button");

var data = GM_getValue(STORAGE_NAME);

/ If there are upvote buttons, there are downvote buttons and a submitAnswer button /
if(up

Solution

There's a few things you can improve.

UserScripts should follow the *.user.js format, so that TamperMonkey, GreaseMonkey, GoogleChrome and the other installers can pick up on the fact that it's a UserScript, the GitHub file does not.

GM_notification({
        title: title || "Progress report:",
        text: "So far, you've shot " + (data.answers) + " (incoming) zombies today!\n" +
              "You have " + (data.votes) + " ammos left!"
    });


The grammar in the sentence 'You have x ammos left!' is incorrect. Consider 'You have x rounds/bullets left' instead.

On a related note, after using this script for a little bit, I thought it may be less 'annoying' if it reminded you every 10 shots about your ammo, and then finally at 5. Just a thought.

Code Snippets

GM_notification({
        title: title || "Progress report:",
        text: "So far, you've shot " + (data.answers) + " (incoming) zombies today!\n" +
              "You have " + (data.votes) + " ammos left!"
    });

Context

StackExchange Code Review Q#107330, answer score: 7

Revisions (0)

No revisions yet.