From 9868c6c7a5e8e12e111472d332184fc701bc9b74 Mon Sep 17 00:00:00 2001
From: ngn ';
-
+
// make changes to DOM
popup_body.style.display = "block";
popup_bg.style.display = "block";
popup_status.style.display = "table";
-
+
// store for rotation functions & changeimage()
popup_image = document.getElementById("popup-image");
-
+
scalepopup(collection[collection_index], scale);
centerpopup();
}else{
-
+
// click inside the image viewer
// resize image
if(is_click_within(click.target, "popup", true)){
-
+
if(mouse_move === false){
scale = 80;
scalepopup(collection[collection_index], scale);
centerpopup();
}
}else{
-
+
if(is_click_within(click.target, "popup-status", true) === false){
-
+
// click outside the popup while its open
// close it
if(is_popup_shown){
-
+
hidepopup();
}
}
}
}
});
-
+
/*
Scale image viewer
*/
popup_body.addEventListener("wheel", function(scroll){
-
+
event.preventDefault();
-
+
if(
scroll.altKey ||
scroll.ctrlKey ||
scroll.shiftKey
){
-
+
var increment = 7;
}else{
-
+
var increment = 14;
}
-
+
if(scroll.wheelDelta > 0){
-
+
// scrolling up
scale = scale + increment;
}else{
-
+
// scrolling down
if(scale - increment > 7){
scale = scale - increment;
}
}
-
+
// calculate relative size before scroll
var pos = popup_body.getBoundingClientRect();
var x = (scroll.x - pos.x) / pos.width;
var y = (scroll.y - pos.y) / pos.height;
-
+
scalepopup(collection[collection_index], scale);
-
+
// move popup to % we found
pos = popup_body.getBoundingClientRect();
-
+
movepopup(
popup_body,
scroll.clientX - (x * pos.width),
scroll.clientY - (y * pos.height)
);
});
-
+
/*
Keyboard controls
*/
-
+
document.addEventListener("keydown", function(key){
-
+
// close popup
if(
is_popup_shown &&
key.keyCode === 27
){
-
+
hidepopup();
return;
}
-
+
if(is_popup_shown === false){
-
+
return;
}
-
+
if(
key.altKey ||
key.ctrlKey ||
key.shiftKey
){
-
+
// mirror image
switch(key.keyCode){
-
+
case 37:
// left
key.preventDefault();
mirror_x = true;
break;
-
+
case 38:
// up
key.preventDefault();
mirror_y = false;
break;
-
+
case 39:
// right
key.preventDefault();
mirror_x = false;
break;
-
+
case 40:
// down
key.preventDefault();
@@ -569,28 +569,28 @@ if(image_class !== null){
break;
}
}else{
-
+
// rotate image
switch(key.keyCode){
-
+
case 37:
// left
key.preventDefault();
rotation = -90;
break;
-
+
case 38:
// up
key.preventDefault();
rotation = 0;
break;
-
+
case 39:
// right
key.preventDefault();
rotation = 90;
break;
-
+
case 40:
// down
key.preventDefault();
@@ -598,7 +598,7 @@ if(image_class !== null){
break;
}
}
-
+
popup_image.style.transform =
"scale(" +
(mirror_x ? "-1" : "1") +
@@ -612,18 +612,18 @@ if(image_class !== null){
}
function getproxylink(url){
-
+
if(url.startsWith("data:")){
-
+
return htmlspecialchars(url);
}else{
-
+
return '/proxy?i=' + encodeURIComponent(url);
}
}
function hidepopup(){
-
+
is_popup_shown = false;
popup_status.style.display = "none";
popup_body.style.display = "none";
@@ -631,24 +631,24 @@ function hidepopup(){
}
function scalepopup(size, scale){
-
+
var ratio =
Math.min(
(window.innerWidth * (scale / 100)) / collection[collection_index].width, (window.innerHeight * (scale / 100)) / collection[collection_index].height
);
-
+
popup_body.style.width = size.width * ratio + "px";
popup_body.style.height = size.height * ratio + "px";
}
function centerpopup(){
-
+
var size = popup_body.getBoundingClientRect();
var size = {
"width": parseInt(size.width),
"height": parseInt(size.height)
};
-
+
movepopup(
popup_body,
(window.innerWidth / 2) - (size.width / 2),
@@ -657,29 +657,29 @@ function centerpopup(){
}
function movepopup(popup_body, x, y){
-
+
popup_body.style.left = x + "px";
popup_body.style.top = y + "px";
}
function changeimage(event){
-
+
// reset rotation params
mirror_x = false;
mirror_y = false;
rotation = 0;
-
+
scale = 60;
-
+
collection_index = parseInt(event.target.value);
-
+
// we set innerHTML otherwise old image lingers a little
popup_body.innerHTML =
'
';
-
+
// store for rotation functions & changeimage()
popup_image = document.getElementById("popup-image");
-
+
scalepopup(collection[collection_index], scale);
centerpopup();
}
@@ -687,299 +687,37 @@ function changeimage(event){
var searchbox_wrapper = document.getElementsByClassName("searchbox");
if(searchbox_wrapper.length !== 0){
-
+
searchbox_wrapper = searchbox_wrapper[0];
var searchbox = searchbox_wrapper.getElementsByTagName("input")[1];
-
+
/*
Textarea shortcuts
*/
document.addEventListener("keydown", function(key){
-
+
switch(key.keyCode){
-
+
case 191:
// 191 = /
if(document.activeElement.tagName == "INPUT"){
-
+
// already focused, ignore
break;
}
-
+
if(
typeof is_popup_shown != "undefined" &&
is_popup_shown
){
-
+
hidepopup();
}
-
+
window.scrollTo(0, 0);
searchbox.focus();
key.preventDefault();
break;
}
});
-
- /*
- Autocompleter
- */
- if( // make sure the user wants it
- document.cookie.includes("scraper_ac=") &&
- document.cookie.includes("scraper_ac=disabled") === false
- ){
-
- var autocomplete_cache = [];
- var focuspos = -1;
- var list = [];
- var autocomplete_div = document.getElementsByClassName("autocomplete")[0];
-
- if(
- document.cookie.includes("scraper_ac=auto") &&
- typeof scraper_dropdown != "undefined"
- ){
-
- var ac_req_appendix = "&scraper=" + scraper_dropdown.value;
- }else{
-
- var ac_req_appendix = "";
- }
-
- function getsearchboxtext(){
-
- var value =
- searchbox.value
- .trim()
- .replace(
- / +/g,
- " "
- )
- .toLowerCase();
-
- return value;
- }
-
- searchbox.addEventListener("input", async function(){
-
- // ratelimit on input only
- // dont ratelimit if we already have res
- if(typeof autocomplete_cache[getsearchboxtext()] != "undefined"){
-
- await getac();
- }else{
-
- await getac_ratelimit();
- }
- });
-
- async function getac(){
-
- var curvalue = getsearchboxtext();
-
- if(curvalue == ""){
-
- // hide autocompleter
- autocomplete_div.style.display = "none";
- return;
- }
-
- if(typeof autocomplete_cache[curvalue] == "undefined"){
-
- /*
- Fetch autocomplete
- */
- // make sure we dont fetch same thing twice
- autocomplete_cache[curvalue] = [];
-
- var res = await fetch("/api/v1/ac?s=" + (encodeURIComponent(curvalue).replaceAll("%20", "+")) + ac_req_appendix);
- if(!res.ok){
-
- return;
- }
-
- var json = await res.json();
-
- autocomplete_cache[curvalue] = json[1];
-
- if(curvalue == getsearchboxtext()){
-
- render_ac(curvalue, autocomplete_cache[curvalue]);
- }
- return;
- }
-
- render_ac(curvalue, autocomplete_cache[curvalue]);
- }
-
- var ac_func = null;
- function getac_ratelimit(){
-
- return new Promise(async function(resolve, reject){
-
- if(ac_func !== null){
-
- clearTimeout(ac_func);
- }//else{
-
- // no ratelimits
- //getac();
- //}
-
- ac_func =
- setTimeout(function(){
-
- ac_func = null;
- getac(); // get results after 100ms of no keystroke
- resolve();
- }, 200);
- });
- }
-
- function render_ac(query, list){
-
- if(list.length === 0){
-
- autocomplete_div.style.display = "none";
- return;
- }
-
- html = "";
-
- // prepare regex
- var highlight = query.split(" ");
- var regex = [];
-
- for(var k=0; k
Set as default search engine
-On Firefox and other Gecko based browsers
-To set this as your default search engine on Firefox, right click the URL bar and select On Chromium and Blink based browsers
-Click the 3 superpositioned dots at the top right of the screen and click on
-
-Once you're there, click the pencil on the last entry under "Search engines" (it's probably DuckDuckGo). Once you do that, a popup will appear. Populate it with the following information:
-
-
-
-
-Once that's done, click
-
- Field
- Value
-
-
- Search engine
- {%server_name%}
-
-
- Shortcut
- {%server_name%}
-
-
-URL with %s in place of query
- https://4get.ca/web?s=%s
- Frequently asked questions
-What is this?
-This is a metasearch engine that gets results from other engines, and strips away all of the tracking parameters and Microsoft/globohomo bullshit they add. Most of the other alternatives to Google jack themselves off about being ""privacy respecting"" or whatever the fuck but it always turns out to be a total lie, and I just got fed up with their shit honestly. Alternatives like Searx or YaCy all fucking sucks so I made my own thing.
-
-My goal
-Provide users with a privacy oriented, extremely lightweight, ad free, free as in freedom (and free beer!) way to search for documents around the internet, with minimal, optional javascript code. My long term goal would be to build my own index (that doesn't suck) and provide users with an unbiased search engine, with no political inclinations.
-
-Do you keep logs?
-I store data temporarly to get the next page of results. This might include search queries, filters and tokens. These parameters are encrypted using
-
-I don't log IP addresses, user agents, or anything else. The Do you share information with third parties?
-Your search queries and supplied filters are shared with the scraper you chose (so I can get the search results, duh). I don't share anything else (that means I don't share your IP address, location, or anything of this kind). There is no way that site can know you're the one searching for something, unless you send out a search query that de-anonymises you. For example, a search query like "hello my full legal name is jonathan gallindo and i want pictures of cloacas" would definitively blow your cover. 4get doesn't contain ads or any third party javascript applets or trackers. I don't profile you, and quite frankly, I don't give a shit about what you search on there.
-
-TL;DR assume those websites can see what you search for, but can't see who you are (unless you're really dumb).
-
-Where is this website hosted?
-Please head over to the 4get instances page, select an instance and click on "IP lookup".
-
-Keyboard shortcuts?
-Use
-
-When the image viewer is open, you can use the following keybinds:
-
-
-How can I trust you?
-You just sort of have to take my word for it right now. If you'd rather trust yourself instead of me (I believe in you!!), all of the code on this website is available trough my git page for you to host on your own machines. Just a reminder: if you're the sole user of your instance, it doesn't take immense brain power for Microshit to figure out you basically just switched IP addresses. Invite your friends to use your instance!
-
-Support the project
-Donate to me trough ko-fi: ko-fi.com/lolcat
-Please donate I sent myself a donation for testing if it works and it looks fucking dumb. Reasons to donate are listed on there. Thank you!
-
-I want to report abuse or have erotic roleplay trough email
-I don't know about that second part but if you want to talk to me, just drop me an email...
-
-Message to all DMCA enforcers: I don't host any of the content. Everything you see here is proxied trough my shitbox with no moderation. Please reach out to the people hosting the infringing content instead.
-
-Click here to contact me!
-
-
-
-
diff --git a/src/template/donate.html b/src/template/donate.html
deleted file mode 100644
index f6f45bf..0000000
--- a/src/template/donate.html
+++ /dev/null
@@ -1,20 +0,0 @@
-< Go back
-
-
Donate to the project
-This project takes up most of my free time and costs money to run. If you feel like this project is worthy of a donation, please do so using the resources on this page!
-
-To run smoothly, 4get requires 20$/month for the server fees and 15-25$ for residential proxies. I also have plans to build my own index to provide better search results; funds raised here will go directly towards better hardware for these purposes. According to the number of captchas solved, 4get.ca serves between 800-1400 users every day, or around 7000-10000 searches!
-
-Ko-fi
-This is the most convenient way to donate. Supports PayPal.
-
-
-
-Monero
-Due to popular demand, I have added an XMR addy. I'm planning to reward users who donate to me once paid tiers are introduced to 4get, so please let me know through email that you donated to me (don't forget your transaction ID)!
-
-
-Thank you all for your generous support!!
diff --git a/src/template/home.html b/src/template/home.html
index 41fe626..73ebea6 100644
--- a/src/template/home.html
+++ b/src/template/home.html
@@ -29,20 +29,12 @@
Settings
- •
+ |
News
- •
+ |
Source
- •
+ |
Modified Source
-
diff --git a/src/template/instances.html b/src/template/instances.html deleted file mode 100644 index 06752c0..0000000 --- a/src/template/instances.html +++ /dev/null @@ -1,37 +0,0 @@ - - -
- -
- - - {%style%} - - - - - -
-