forked from jqqqqqqqqqq/MakeOPRGreatAgain
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path5StarOneKeyForAndroid.user.js
147 lines (131 loc) · 6.25 KB
/
5StarOneKeyForAndroid.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
// ==UserScript==
// @id 5 Star One Key for Android
// @name 5 Star One Key for Android
// @version 0.30-modify-0.34.1
// @description Give five star with single click
// @updateURL https://github.com/Totoro625/MakeOPRGreatAgain/raw/master/5StarOneKeyForAndroid.user.js
// @downloadURL https://github.com/Totoro625/MakeOPRGreatAgain/raw/master/5StarOneKeyForAndroid.user.js
// @author jqqqqqqqqqq | modify by totoro625
// @match https://opr.ingress.com/recon
// @require https://code.jquery.com/jquery-3.2.1.min.js
// @supportURL https://totoro.ink
// @grant unsafeWindow
// ==/UserScript==
var auto_select = true;
var buttons = [
{button:"5.0", total:5, name:5, history:5, unique:5, location:5, safety:5},
{button:"4.8", total:4, name:5, history:5, unique:5, location:5, safety:5},
{button:"4.5", total:4, name:5, history:5, unique:5, location:4, safety:4},
{button:"4.3", total:4, name:5, history:5, unique:4, location:4, safety:4},
{button:"4.2", total:4, name:4, history:5, unique:4, location:4, safety:4},
{button:"4.0", total:4, name:4, history:4, unique:4, location:4, safety:4},
{button:"3.8", total:4, name:4, history:4, unique:4, location:3, safety:4},
{button:"3.7", total:4, name:4, history:4, unique:4, location:3, safety:3},
{button:"3.5", total:3, name:4, history:4, unique:4, location:3, safety:3},
{button:"4.3PosAccu", total:4, name:4, history:4, unique:4, location:5, safety:5},
{button:"4.0PosAccu", total:4, name:4, history:3, unique:3, location:5, safety:5},
{button:"3.7PosAccu", total:3, name:3, history:3, unique:3, location:5, safety:5},
{button:"3.7NameBad", total:4, name:2, history:4, unique:4, location:4, safety:4},
{button:"3.5PosOffs", total:4, name:4, history:4, unique:4, location:2, safety:3},
{button:"3.0", total:3, name:3, history:3, unique:3, location:3, safety:3},
{button:"1.2", total:2, name:1, history:1, unique:1, location:1, safety:1},
{button:"Guna", total:1, name:0, history:0, unique:0, location:0, safety:0},
];
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////EDIT THIS LINE BELOW!
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
const w = typeof unsafeWindow == "undefined" ? window : unsafeWindow;
var first = true;
function enable_auto_select(){
$(".button-star").each(function(){ // use mouse hover to select stars
if(first) {
console.warn("first ignored");
first = false;
}
else {
$(this).hover(function(){$(this).click();});
}
});
}
var button_list = {
'total': [],
'name': [],
'history': [],
'unique': [],
'location': [],
'safety': []
};
function update_button_list(){
$(".button-star").each(function(){ // use mouse hover to select stars
switch($(this).attr("ng-model")) {
case "answerCtrl.formData.quality":
button_list['total'].push($(this));
$(this).css({'margin-bottom': '10px'});
$(this).children('span').css({'font-size': '24px'});
$(this).css({'margin-left': '5px'});
$(this).css({'margin-right': '5px'});
break;
case "answerCtrl.formData.description":
button_list['name'].push($(this));
$(this).css({'margin-bottom': '10px'});
$(this).css({'margin-left': '5px'});
$(this).css({'margin-right': '5px'});
break;
case "answerCtrl.formData.cultural":
button_list['history'].push($(this));
$(this).css({'margin-bottom': '10px'});
$(this).css({'margin-left': '5px'});
$(this).css({'margin-right': '5px'});
break;
case "answerCtrl.formData.uniqueness":
button_list['unique'].push($(this));
$(this).css({'margin-left': '5px'});
$(this).css({'margin-right': '5px'});
break;
case "answerCtrl.formData.location":
button_list['location'].push($(this));
$(this).css({'margin-left': '5px'});
$(this).css({'margin-right': '5px'});
break;
case "answerCtrl.formData.safety":
button_list['safety'].push($(this));
$(this).css({'margin-left': '5px'});
$(this).css({'margin-right': '5px'});
break;
}
});
}
function rate_portal(total, name, history, unique, location, safety) {
button_list['total'][total - 1].click();
button_list['name'][name - 1].click();
button_list['history'][history - 1].click();
button_list['unique'][unique - 1].click();
button_list['location'][location - 1].click();
button_list['safety'][safety - 1].click();
}
function add_button() {
var button_region = document.getElementById("descriptionDiv");
buttons.forEach(function(button_data) {
var button = document.createElement("button");
var textnode = document.createTextNode(button_data["button"]);
button.className = "button submit-button";
button.appendChild(textnode);
button_region.appendChild(button);
button.onclick = function(){rate_portal(button_data["total"], button_data["name"], button_data["history"], button_data["unique"], button_data["location"], button_data["safety"]);};
});
w.$scope = element => w.angular.element(element).scope();
var submitAndNext = document.createElement("button");
submitAndNext.className = "button submit-button";
submitAndNext.innerHTML = `<span class="glyphicon glyphicon-floppy-disk"></span> <span class="glyphicon glyphicon-forward"></span>`;
submitAndNext.title = "Submit and go to next review";
submitAndNext.addEventListener("click", function() {angular.element(document.getElementById('AnswersController')).scope().answerCtrl.submitForm();setTimeout(function(){ window.location.assign("/recon");}, 1000);});
button_region.insertBefore(submitAndNext, null);
}
(function() {
if(auto_select) {
enable_auto_select();
}
add_button();
update_button_list();
move_portal_rate();
})();