diff --git a/client/submitter/submit.user.js b/client/submitter/submit.user.js
index 1601a7b..30848e9 100644
--- a/client/submitter/submit.user.js
+++ b/client/submitter/submit.user.js
@@ -21,22 +21,74 @@
(function () {
var lambda;
var key;
+ var automate = localStorage.getItem('automate');
+ var notUsd = localStorage.getItem('notUsd');
+ const DELAY = 3000;
+
+ if(localStorage.getItem('automate') === null) localStorage.setItem('automate', 'false');
+
+ if(localStorage.getItem('notUsd') === null) notUsd = localStorage.setItem('notUsd', 'false');
+
+ console.log("automate: "+automate);
+ console.log("notUsd: "+notUsd);
function error(info) {
- if (info === undefined) info = "Cream experienced an internal error.";
+ var autoMsgTime;
+ var autoMsgBtn;
+
+ if(automate == 'true') {
+ autoMsgTime = "Retrying in "+DELAY+"ms.";
+ autoMsgBtn = "Stop retrying";
+ }
+ else autoMsgTime = "";
+
+ if (info === undefined) info = "Cream experienced an internal error.
"+autoMsgTime;
- ShowConfirmDialog("Cream Error", info, "Close", "Reconfigure").fail(function () {
- GM_deleteValue("lambda");
- GM_deleteValue("apikey");
- history.go(0);
+
+ var dialog = ShowConfirmDialog("Cream Error", info, "Reconfigure", "Close", autoMsgBtn).done(function (choice) {
+ if(choice == 'SECONDARY'){
+ automate = localStorage.setItem('automate', 'false');
+ location.reload();
+ } else {
+ GM_deleteValue("lambda");
+ GM_deleteValue("apikey");
+ localStorage.setItem('automate', 'false');
+ history.go(0);
+ }
});
+
+ if(automate == 'true') {
+ setTimeout(function(){
+ dialog.Dismiss();
+ scrape();
+ },DELAY);
+ }
+ }
+
+
+
+ function next() {
+ if((notUsd == 'true') && (window.location.search.indexOf('&cc=us&l=english') == -1)) window.location.search += '&cc=us&l=english';
+ else scrape();
}
+ function pressbtn(){ //next page
+ var classes = document.getElementsByClassName('pagebtn');
+ var rightbtn;
+ if(window.location.search.indexOf('page') == -1) rightbtn = classes[0];
+ else rightbtn = classes[1];
+ rightbtn.click();
+ //SearchLinkClick(rightbtn); also works
+ next();
+ }
+
function scrape() {
try {
var dialog = ShowBlockingWaitDialog("Cream", "