Skip to content

Instantly share code, notes, and snippets.

@ailinykh
Last active December 6, 2017 08:42
Show Gist options
  • Save ailinykh/6125126a337f7b911ee5498da18cacb4 to your computer and use it in GitHub Desktop.
Save ailinykh/6125126a337f7b911ee5498da18cacb4 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Recon Helper
// @namespace http://tampermonkey.net/
// @version 0.1.2
// @description Simplify portal approving!
// @author Anthony Ilinykh
// @match https://opr.ingress.com/recon
// @grant none
// @updateURL https://gist.github.com/ailinykh/6125126a337f7b911ee5498da18cacb4/raw/recon_helper.user.js
// ==/UserScript==
(function() {
'use strict';
var unwatchCb;
var element = angular.element(document.getElementById('AnswersController'));
var getRandomVal = (min, max) => {
return Math.floor(Math.random() * (++max - min)) + min;
};
element.ready(() => {
if (!unwatchCb) {
unwatchCb = element.scope().$watch('answerCtrl.formData.quality', (newVal, oldVal) => {
if (element.scope().answerCtrl.formData.quality > 1) {
element.scope().answerCtrl.formData.description = "" + getRandomVal(3, 5);
element.scope().answerCtrl.formData.cultural = "" + getRandomVal(1, element.scope().answerCtrl.formData.quality);
element.scope().answerCtrl.formData.uniqueness = "" + getRandomVal(1, element.scope().answerCtrl.formData.quality);
element.scope().answerCtrl.formData.location = "" + getRandomVal(4, 5);
element.scope().answerCtrl.formData.safety = "" + getRandomVal(4, 5);
// element.scope().answerCtrl.reviewComplete = true;
console.log("Data changed!");
console.log(element.scope().answerCtrl.formData);
element.scope().answerCtrl.submitForm();
} else if(element.scope().answerCtrl.formData.quality == 1) {
element.scope().answerCtrl.confirmLowQuality();
}
});
console.log("Watching enabled!");
}
if (document.onkeyup === null) {
document.onkeyup = (evt) => {
if (evt.keyCode == 13) {
location.reload(true);
}
};
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment