Repository navigation
Expand file tree
/
Copy pathready.js
More file actions
63 lines (61 loc) · 2.21 KB
/
Copy pathready.js
File metadata and controls
63 lines (61 loc) · 2.21 KB
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
import * as ManualRestart from "./manual-restart-tracker";
import Config, * as UpdateConfig from "./config";
import * as Misc from "./misc";
import * as VerificationController from "./verification-controller";
import * as Settings from "./settings";
import * as RouteController from "./route-controller";
import * as UI from "./ui";
import * as SignOutButton from "./sign-out-button";
import * as MonkeyPower from "./monkey-power";
ManualRestart.set();
Misc.migrateFromCookies();
UpdateConfig.loadFromLocalStorage();
Misc.getReleasesFromGitHub();
RouteController.handleInitialPageClasses(window.location.pathname);
$(document).ready(() => {
if (window.location.pathname === "/") {
// $("#top .config").removeClass("hidden");
}
$("body").css("transition", "all .25s, transform .05s");
if (Config.quickTab) {
$("#restartTestButton").addClass("hidden");
}
if (!window.localStorage.getItem("merchbannerclosed")) {
$(".merchBanner").removeClass("hidden");
} else {
$(".merchBanner").remove();
}
$("#centerContent")
.css("opacity", "0")
.removeClass("hidden")
.stop(true, true)
.animate({ opacity: 1 }, 250, () => {
if (window.location.pathname === "/account") {
SignOutButton.show();
}
if (window.location.pathname === "/verify") {
const fragment = new URLSearchParams(window.location.hash.slice(1));
if (fragment.has("access_token")) {
const accessToken = fragment.get("access_token");
const tokenType = fragment.get("token_type");
VerificationController.set({
accessToken: accessToken,
tokenType: tokenType,
});
history.replaceState("/", null, "/");
}
let page = window.location.pathname.replace("/", "");
UI.changePage(page);
} else if (window.location.pathname === "/account") {
// history.replaceState("/", null, "/");
} else if (/challenge_.+/g.test(window.location.pathname)) {
//do nothing
// }
} else if (window.location.pathname !== "/") {
let page = window.location.pathname.replace("/", "");
UI.changePage(page);
}
});
Settings.settingsFillPromise.then(Settings.update);
MonkeyPower.init();
});