forked from inulute/perplexity-ai-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
initial.html
105 lines (88 loc) · 4.32 KB
/
initial.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href='https://fonts.googleapis.com/css?family=Varela Round' rel='stylesheet'>
<link rel="stylesheet" href="./external.css">
</head>
<body>
<div id="content">
<div id="logo"></div>
<h2>Choose an AI to Navigate</h2>
<div class="button-container">
<a href="https://perplexity.ai/search" class="button">Perplexity AI Search</a>
<a href="https://labs.perplexity.ai" class="button" id="chatButton">Perplexity AI Chat</a>
</div>
<a href="#" id="shortcutInfoLink" class="shortcut-info">Shortcut Info</a>
<p id="versionDisplay">Current Version: Checking...</p>
</div>
<footer>
Made with ❤️ by <a href="https://github.com/inulute" class="footerinu">inulute</a>
</footer>
<!-- Modal for shortcut info -->
<div id="shortcutInfoModal" class="modal">
<div class="modal-content">
<span class="close">×</span>
<h2>Shortcut Information</h2>
<ul>
<li><strong>CmdOrCtrl+M</strong>: Minimize or restore all windows</li>
<li><strong>CmdOrCtrl+6</strong>: Open or restore Perplexity AI</li>
<li><strong>CmdOrCtrl+7</strong>: Open or restore Perplexity Labs</li>
</ul>
</div>
</div>
<!-- Version info at the bottom right -->
<div id="bottomVersionInfo" class="version-info">Version Info</div>
<script>
function compareVersions(v1, v2) {
const parts1 = v1.split('.').map(Number);
const parts2 = v2.split('.').map(Number);
for (let i = 0; i < Math.max(parts1.length, parts2.length); i++) {
const part1 = parts1[i] || 0;
const part2 = parts2[i] || 0;
if (part1 > part2) return 1;
if (part1 < part2) return -1;
}
return 0;
}
async function checkForUpdates() {
try {
const currentVersion = await fetch('crrtver.inu').then(response => response.text());
const response = await fetch('https://raw.githubusercontent.com/inulute/perplexity-ai-app/main/package.json');
const { version: latestVersion } = await response.json();
const versionDisplay = document.getElementById("versionDisplay");
const bottomVersionInfo = document.getElementById("bottomVersionInfo");
if (compareVersions(latestVersion, currentVersion) === 1) {
versionDisplay.innerHTML = `<a href="https://github.com/inulute/perplexity-ai-app/releases/latest" target="_blank" class="update-available">Update Available! Click here to download the latest version (${latestVersion}).</a>`;
} else {
versionDisplay.innerHTML = `<a href="https://donate.inulute.vercel.app" target="_blank" class="update-not-available">Please support us by donating.</a>`;
}
bottomVersionInfo.innerText = `Version: ${currentVersion}`;
} catch (error) {
console.error("Error fetching version file:", error);
document.getElementById("versionDisplay").innerText = "Error checking for updates.";
document.getElementById("bottomVersionInfo").innerText = "Version Info";
}
}
document.getElementById("chatButton").addEventListener("click", checkForUpdates);
document.getElementById("shortcutInfoLink").addEventListener("click", (event) => {
event.preventDefault();
document.getElementById("shortcutInfoModal").style.display = "block";
});
const modal = document.getElementById("shortcutInfoModal");
const span = document.getElementsByClassName("close")[0];
span.onclick = function() {
modal.style.display = "none";
}
window.onclick = function(event) {
if (event.target === modal) {
modal.style.display = "none";
}
}
document.addEventListener("DOMContentLoaded", function () {
checkForUpdates(); // Check for updates on page load
});
</script>
</body>
</html>