Last active
December 6, 2017 08:42
-
-
Save ailinykh/6125126a337f7b911ee5498da18cacb4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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