Skip to content

Commit

Permalink
Revert "loader.js"
Browse files Browse the repository at this point in the history
  • Loading branch information
Updates committed Nov 26, 2024
1 parent 0b6e488 commit 194e62e
Showing 1 changed file with 24 additions and 27 deletions.
51 changes: 24 additions & 27 deletions static/assets/js/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,33 +69,30 @@ function createDomainRegex(domains) {
}

searchBar.addEventListener("keydown", function(event) {
if (event.key === 'Enter') {
var inputUrl = searchBar.value.trim();
searchBar.blur();
fetchDomains().then(domains => {
const domainRegex = createDomainRegex(domains);
const searchValue = searchBar.value.trim();
if (vercelCheck !== 'true') {
if (domainRegex.test(searchValue)) {
scope = '/assignments/';
} else {
scope = '/service/';
}
} else {
scope = '/assignments/';
// serverless = no websocket support
}

if (/^(https?|ftp):\/\/[^\s/$.?#].[^\s]*$/.test(inputUrl)) {
// inputUrl = inputUrl.replace(/^https:\/\//, 'http://');
} else {
document.getElementById('siteurl').src = scope + Ultraviolet.codec.xor.encode(inputUrl.includes('.') ? 'http://' + inputUrl : 'http://www.google.com/search?q=' + encodeURIComponent(inputUrl));
}
});
}
if (event.key === 'Enter') {
var inputUrl = searchBar.value.trim();
searchBar.blur();
fetchDomains().then(domains => {
const domainRegex = createDomainRegex(domains);
const searchValue = searchBar.value.trim();
if (vercelCheck !== 'true') {
if (domainRegex.test(searchValue)) {
scope = '/assignments/';
} else {
scope = '/service/';
}
} else {
scope = '/assignments/';
// serverless = no websocket support
}
if (/^(https?|ftp):\/\/[^\s/$.?#].[^\s]*$/.test(inputUrl)) {
document.getElementById('siteurl').src = scope + Ultraviolet.codec.xor.encode(inputUrl);
} else {
document.getElementById('siteurl').src = scope + Ultraviolet.codec.xor.encode(inputUrl.includes('.') ? 'https://' + inputUrl : 'https://www.google.com/search?q=' + encodeURIComponent(inputUrl));
}
});
}
});


setTimeout(function() {
var searchBarValue = document.getElementById('searchBar').value;
if (searchBarValue.startsWith('https://')) {
Expand Down Expand Up @@ -325,4 +322,4 @@ frame.addEventListener('load', interceptFrame);
document.addEventListener('DOMContentLoaded', function() {
onFrameClick();
setInterval(onFrameClick, 1000);
});
});

0 comments on commit 194e62e

Please sign in to comment.