Goosle/assets/js/goose.js
Arnan de Gans a5740b3dea Version 1.5
- NOTICE: config.default.php has changed, re-create your config.php!!
- [fix] No longer caches empty results
- [fix] No longer make a request if the search query is empty
- [fix] Movie highlight/box office cache now works
- [fix] Language selector for Qwant, Wikipedia and Duckduckgo
- [fix] Season and Episode filter for tv show searches
- [fix] Safe search filter now actually works
- [fix] Magnet Search category exclusion filter now actually works
- [fix] Image size filter works more reliably
- [fix] Handling of doublequotes in search queries
- [fix] Search sources now show result amounts accurately
- [fix] Old cache files are now actually deleted when expired
- [fix] Search tabs not properly centered on smaller screens
- [new] Box Office page with latest/new downloads from a few supported torrent websites
- [new] News page with the latest news from major outlets
- [new] Popup with movie info and download links for YTS Movie Highlights
- [new] CSS colorschemes configurable in config.php
- [new] Easily share magnet links with other Goosle users
- [new] Search results from Quant API
- [new] Search results from Brave
- [new] Image results from Qwant Image API
- [new] News results from Hackernews
- [new] News results from Yahoo! News
- [new] News results from Brave News
- [new] News results from Qwant News API
- [new] Magnet results from Sukebei.nyaa.si
- [new] Special search for IP Lookups via ipify (Search for "ip" or "myip")
- [new] Safe search switch for Yahoo! Images
- [new] Image size switch for Qwant Images
- [new] Merge missing magnet meta data from duplicate results if it doesn't already exist in the matched previous result
- [new] Detect meta data for Magnet Search results such as sound and video quality.
- [tweak] Cache ttl is now in hours (was minutes)
- [tweak] Optimizations in CSS, HTML separators and more
- [tweak] Moved icons into CSS so they can be colored using colorschemes
- [tweak] Better handling of image results
- [tweak] Better handling of empty/incomplete results for all engines
- [tweak] Better handling of empty/missing meta data for all magnet engines
- [tweak] Better category detection for Limetorrent magnets
- [tweak] Raised Magnet search limit to 200 (was 50)
- [tweak] Raised Wikipedia search limit to 20 (was 10)
- [tweak] Hide magnet results with 0 seeders by default
- [tweak] Uniform array formatting for all engines
- [tweak] Consistent use of single-quotes and double-qoutes
- [tweak] File size string conversion and formatting for all image and magnet engines
- [tweak] Update checks are now done weekly(ish) via the Cron job
- [tweak] Updated .htaccess caching rules
- [removed] CSS for 320px viewport
2024-06-19 18:08:00 -06:00

62 lines
No EOL
2.3 KiB
JavaScript

/* ------------------------------------------------------------------------------------
* Goosle - The fast, privacy oriented search tool that just works.
*
* COPYRIGHT NOTICE
* Copyright 2023-2024 Arnan de Gans. All Rights Reserved.
*
* COPYRIGHT NOTICES AND ALL THE COMMENTS SHOULD REMAIN INTACT.
* By using this code you agree to indemnify Arnan de Gans from any
* liability that might arise from its use.
------------------------------------------------------------------------------------ */
/*--------------------------------------
Share magnet results to the clipboard
--------------------------------------*/
function clipboard(id) {
// Get the text field element and set up a response
var share_string = document.getElementById(id);
var success, message;
// Select the text field
share_string.select();
share_string.setSelectionRange(0, share_string.value.length);
// Copy the text inside the text field to the clipboard
success = navigator.clipboard.writeText(share_string.value);
// Visual response
if(success) {
message = "<span class=\"success green\">Link copied to the clipboard.</span><br />Paste the link anywhere you want with ctrl+v (or cmd+v on macOS).<br />Or use the paste function in your app."
} else {
message = "<span class=\"fail red\">Copying is not supported or got blocked.</span><br />Copy the link by pressing ctrl+c (or cmd+c on macOS).<br />Or use the select and copy functions from the context menu."
}
response = document.getElementById(id + '-response');
response.innerHTML = message;
// Set up a timer to remove the visual response after a few seconds
setTimeout(function() {
response.innerHTML = "";
}, 10000);
}
/*--------------------------------------
Handle magnet share, highlight and box office popups
--------------------------------------*/
function openpopup(id) {
document.getElementById(id).classList.add('open');
document.body.classList.add('goosebox-open');
}
function closepopup() {
document.querySelector('.goosebox.open').classList.remove('open');
document.body.classList.remove('goosebox-open');
}
// close modals on background click
window.addEventListener('load', function() {
document.addEventListener('click', event => {
if (event.target.classList.contains('goosebox')) {
closepopup();
}
});
});