Skip to content

Commit 95c341c

Browse files
committed
added proxy server setting
1 parent 6961f95 commit 95c341c

File tree

3 files changed

+83
-11
lines changed

3 files changed

+83
-11
lines changed

checker.js

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
let proxyServer = "https://api.allorigins.win/get?url=";
2+
3+
function formatResponseTime(milliseconds) {
4+
if (milliseconds < 1000) {
5+
return `${milliseconds.toFixed(2)} ms`;
6+
} else if (milliseconds < 60000) {
7+
const seconds = milliseconds / 1000;
8+
return `${seconds.toFixed(2)} sec`;
9+
} else {
10+
const minutes = milliseconds / 60000;
11+
return `${minutes.toFixed(2)} min`;
12+
}
13+
}
114

215
async function checkSEO() {
316
const url = document.getElementById('url-input').value;
@@ -14,12 +27,12 @@ async function checkSEO() {
1427

1528
try {
1629
// Use a proxy server to bypass CORS restrictions (AllOrigins or your custom proxy)
17-
document.getElementById("loadingStatus").innerHTML = "Setting proxy server (api.allorigins.win) ...";
18-
const proxyUrl = 'https://api.allorigins.win/get?url=';
30+
document.getElementById("loadingStatus").innerHTML = `Setting proxy server (${proxyServer}) ...`;
31+
const proxyUrl = proxyServer;
1932
const targetUrl = encodeURIComponent(url);
2033

2134
document.getElementById("loadingStatus").innerHTML = "Bypassing CORS restrictions (AllOrigins or your custom proxy) ...";
22-
35+
const startTime = performance.now();
2336
// Fetch the HTML content of the given URL through the proxy
2437
const response = await fetch(proxyUrl + targetUrl);
2538
if (!response.ok) {
@@ -28,6 +41,11 @@ async function checkSEO() {
2841

2942
document.getElementById("loadingStatus").innerHTML = "Getting response from the website ...";
3043
const data = await response.json();
44+
45+
// End timing
46+
const endTime = performance.now();
47+
const responseTime = endTime - startTime;
48+
//document.getElementById("responseTime").innerHTML = responseTime.toFixed(2);
3149
document.getElementById("loadingStatus").innerHTML = "Got response 200 and start analyzing html...";
3250
const html = data.contents; // HTML content of the fetched URL
3351
const parser = new DOMParser();
@@ -111,7 +129,7 @@ async function checkSEO() {
111129

112130
// Display the overall status
113131
if (jsonResults.length > 0) {
114-
document.getElementById('result').innerHTML = `<span class="badge bg-success rounded-pill">${jsonResults.length}</span> meta tags found.`;
132+
document.getElementById('result').innerHTML = `<span class="badge bg-success rounded-pill">${jsonResults.length}</span> meta tags found in ${ formatResponseTime(responseTime)}`;
115133
} else {
116134
document.getElementById('status').textContent = 'No meta tags found.';
117135
}
@@ -125,13 +143,29 @@ async function checkSEO() {
125143
document.getElementById('tag-list').innerHTML = `
126144
<div class="card">
127145
<div class="card-body">
128-
<p class="text-center mt-3">No tags found. Please try entering a URL and searching again. </p>
146+
<p class="text-center mt-3">No tags found. Please try entering a URL and search. </p>
129147
</div>
130148
</div>`;
131149

132150
document.getElementById('checkBtn').addEventListener('click', async () => {
133-
document.getElementById('loading').innerHTML = ` <div class="spinner-border mt-5" role="status"><span class="visually-hidden">Loading...</span></div> </br> Searching meta tags , it may take while </br>`;
151+
document.getElementById('loading').innerHTML = ` <div class="spinner-border mt-5" role="status"><span class="visually-hidden">Loading...</span></div> </br> Searching meta tags , it may take while, we have to wait for response </br>`;
134152
await checkSEO();
135153
document.getElementById('loading').innerHTML = '';
136154
document.getElementById("loadingStatus").innerHTML = "";
137-
});
155+
});
156+
157+
$(document).ready(function() {
158+
159+
let options = {
160+
html: true,
161+
title: "Optional: HELLO(Will overide the default-the inline title)",
162+
//html element
163+
//content: $("#popover-content")
164+
content: $('[data-name="popover-content"]')
165+
//Doing below won't work. Shows title only
166+
//content: $("#popover-content").html()
167+
168+
}
169+
let exampleEl = document.getElementById('setProxy')
170+
new bootstrap.Popover(exampleEl, options)
171+
})

index.html

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,22 @@
44
<head>
55
<meta charset="UTF-8">
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7-
<title>Meta scope - Tool for analyzing website meta tags</title>
7+
<meta charset="UTF-8">
8+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
9+
<title>MetaScope - Analyze and Optimize Meta Tags</title>
10+
<meta name="description" content="MetaScope is an intuitive tool for analyzing website meta tags, including SEO, social media, and verification tags. It highlights missing or mismatched tags and presents results in a user-friendly format.">
11+
<meta name="keywords" content="MetaScope, meta tags analyzer, SEO tags, social media tags, website optimization, SEO tools, tag checker">
12+
<meta name="author" content="MetaScope Team">
13+
<meta property="og:title" content="MetaScope - Analyze and Optimize Meta Tags">
14+
<meta property="og:description" content="MetaScope helps analyze website meta tags for SEO, social media, and verification, making it easy to optimize your site for search engines and sharing.">
15+
<meta property="og:type" content="website">
16+
<meta name="twitter:card" content="summary_large_image">
17+
<meta name="twitter:title" content="MetaScope - Analyze and Optimize Meta Tags">
18+
<meta name="twitter:description" content="MetaScope helps analyze website meta tags for SEO, social media, and verification, making it easy to optimize your site for search engines and sharing.">
19+
<meta name="google-site-verification" content="example-google-site-verification-code">
20+
<meta name="robots" content="index, follow">
21+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
22+
<link rel="icon" type="image/png" href="./meta.svg">
823
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
924
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
1025
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.min.css">
@@ -35,12 +50,31 @@
3550
class="form-control form-control-lg fs-5 w-100 w-md-80 text-center"
3651
placeholder="Enter your url eg: https://example.com" id="url-input">
3752
<small id="loadingStatus" style="height: 25px; font-size: 12px;"></small>
38-
<button id="checkBtn" style="border-radius: 10px;" class="btn btn-success mb-3 btn-lg">Start analyzing the
39-
website</button>
53+
<div class="col-12 d-flex justify-content-center">
54+
<button id="checkBtn" style="border-radius: 10px; display: inline;" class="btn btn-success mb-3 btn-lg">Start analyzing the
55+
website</button>
56+
57+
<div hidden >
58+
<div data-name="popover-content">
59+
<div class="input-group">
60+
<input type="text" class="form-control form-control-sm" value="https://api.allorigins.win/get?url=" placeholder="Enter proxy server url" name="proxyName" value="">
61+
<div class="input-group-btn">
62+
<button class="btn btn-primary" type="submit">
63+
<i class="bi bi-check2-circle"></i>
64+
</button>
65+
</div>
66+
</div>
67+
</div>
68+
</div>
69+
<a id="setProxy" tabindex="0" style="height: 47px; margin-left: 5px; border-radius: 5px;" class="btn btn-lg btn-secondary" role="button" data-bs-toggle="popover" title="Change proxy server" ><i class="bi bi-gear-wide-connected"></i></a>
70+
71+
</div>
72+
4073
</div>
4174
<div class="col-12 justify-content-center align-items-center">
4275
<div class="col-12" id="result"></div>
4376
<p class="text-center text-danger" id="status"></p>
77+
4478
</div>
4579
<div class="row">
4680
<div class="col-8">
@@ -85,7 +119,8 @@
85119
</div>
86120

87121
</div>
88-
122+
<script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js'></script>
123+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
89124
<script src="./checker.js"></script>
90125
</body>
91126

meta.svg

Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)