whisper.cat stuff

This commit is contained in:
[Harper Innes]
2023-10-05 23:28:32 +11:00
parent 2a6e28637c
commit f127b4fea8
5224 changed files with 919361 additions and 0 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
var colors=[[44,145,223],[110,233,133],[110,233,225],[255,213,0],[255,0,86],[213,0,255]],step=0,colorIndices=[0,1,2,3],gradientSpeed=.004;function updateGradient(){var a=colors[colorIndices[0]],b=colors[colorIndices[1]],c=colors[colorIndices[2]],d=colors[colorIndices[3]],e=1-step,f=Math.round(e*a[0]+step*b[0]),g=Math.round(e*a[1]+step*b[1]),h=Math.round(e*a[2]+step*b[2]),i="#"+(f<<16|g<<8|h).toString(16),j=Math.round(e*c[0]+step*d[0]),k=Math.round(e*c[1]+step*d[1]),l=Math.round(e*c[2]+step*d[2]),m="#"+(j<<16|k<<8|l).toString(16);document.getElementById("canvasContainer").style.background="linear-gradient("+i+","+m+") no-repeat",step+=gradientSpeed,1<=step&&(step%=1,colorIndices[0]=colorIndices[1],colorIndices[2]=colorIndices[3],colorIndices[1]=(colorIndices[1]+Math.floor(1+Math.random()*(colors.length-1)))%colors.length,colorIndices[3]=(colorIndices[3]+Math.floor(1+Math.random()*(colors.length-1)))%colors.length)}setInterval(updateGradient,10);

View File

@ -0,0 +1,34 @@
function canvasSupport(n) {
return !!n.getContext;
}
function canvasApp() {
if (document.getElementById('myCanvas')) {
var canvasElement = document.getElementById('myCanvas');
canvasElement.parentNode.removeChild(canvasElement);
}
var Game_Interval;
var winwidth = Math.max(window.screen.width, window.innerWidth);
var matrixwidth = winwidth / 10;
var nodecimal = Math.round(matrixwidth);
var n = document.createElement('canvas');
n.id = 'myCanvas';
n.classList = 'background';
document.getElementById('canvasContainer').appendChild(n);
if (canvasSupport(n)) {
var e = n.getContext('2d');
var t = (n.width = window.innerWidth);
var a = (n.height = window.innerHeight);
var i = Array(nodecimal).join(0).split('');
'undefined' != typeof Game_Interval && clearInterval(Game_interval), (Game_Interval = setInterval(o, 42));
}
function o() {
(e.fillStyle = 'rgba(0,0,0,.07)'), e.fillRect(0, 0, t, a), (e.fillStyle = color), (e.font = '10px monospace');
i.map(function(n, t) {
(text = [...Array(1)].map(() => Math.random().toString(36)[2]).join('').toUpperCase()),
(x = (t * 10) + 10),
e.fillText(text, x, n),
n > 100 + 3e4 * Math.random() ? (i[t] = 0) : (i[t] = n + 10);
});
}
}
canvasApp();

1
weboasis/js/canvas/matrix.min.js vendored Normal file
View File

@ -0,0 +1 @@
var f=new FontFace("matrix_code_nfiregular","url(fonts/matrix_code_nfi-webfont.woff)");function canvasSupport(n){return!!n.getContext}function canvasApp(n){if(document.fonts.add(n),document.getElementById("myCanvas")){var t=document.getElementById("myCanvas");t.parentNode.removeChild(t)}var e,a=Math.max(window.screen.width,window.innerWidth)/10,o=Math.round(a),i=document.createElement("canvas");if(i.id="myCanvas",i.classList="background",document.getElementById("canvasContainer").appendChild(i),canvasSupport(i)){var r=i.getContext("2d"),d=i.width=window.innerWidth,c=i.height=window.innerHeight,l=Array(o).join(0).split("");void 0!==e&&clearInterval(Game_interval),e=setInterval((function(){r.fillStyle="rgba(0,0,0,.07)",r.fillRect(0,0,d,c),r.fillStyle=color,r.font="12px matrix_code_nfiregular",l.map((function(n,t){text=[...Array(1)].map((()=>Math.random().toString(36)[2])).join("").toLowerCase(),x=10*t+10,r.fillText(text,x,n),n>100+3e4*Math.random()?l[t]=0:l[t]=n+10}))}),42)}}f.load().then((function(n){canvasApp(n)}));

View File

@ -0,0 +1 @@
function canvasSupport(a){return!!a.getContext}function canvasApp(){function b(){j.fillStyle="rgba(0,0,0,.07)",j.fillRect(0,0,e,k),j.fillStyle=color,j.font="10px monospace",a.map(function(b,c){text=[...[,]].map(()=>Math.random().toString(36)[2]).join("").toLowerCase(),x=10*c+10,j.fillText(text,x,b),a[c]=b>100+3e4*Math.random()?0:b+10})}if(document.getElementById("myCanvas")){var c=document.getElementById("myCanvas");c.parentNode.removeChild(c)}var d,f=Math.max(window.screen.width,window.innerWidth),g=Math.round(f/10),h=document.createElement("canvas");if(h.id="myCanvas",h.classList="background",document.getElementById("canvasContainer").appendChild(h),canvasSupport(h)){var j=h.getContext("2d"),e=h.width=window.innerWidth,k=h.height=window.innerHeight,a=Array(g).join(0).split("");"undefined"!=typeof d&&clearInterval(Game_interval),d=setInterval(b,42)}}canvasApp();

View File

@ -0,0 +1 @@
var f=new FontFace("matrix_code_nfiregular","url(fonts/matrix_code_nfi-webfont.woff)");function canvasSupport(n){return!!n.getContext}function canvasApp(n){if(document.fonts.add(n),document.getElementById("myCanvas")){var t=document.getElementById("myCanvas");t.parentNode.removeChild(t)}var e,a=Math.max(window.screen.width,window.innerWidth)/10,o=Math.round(a),i=document.createElement("canvas");if(i.id="myCanvas",i.classList="background",document.getElementById("canvasContainer").appendChild(i),canvasSupport(i)){var r=i.getContext("2d"),d=i.width=window.innerWidth,c=i.height=window.innerHeight,l=Array(o).join(0).split("");void 0!==e&&clearInterval(Game_interval),e=setInterval((function(){r.fillStyle="rgba(0,0,0,.07)",r.fillRect(0,0,d,c),r.fillStyle=color,r.font="10px matrix_code_nfiregular",l.map((function(n,t){text=[...Array(1)].map((()=>Math.random().toString(36)[2])).join("").toLowerCase(),x=10*t+10,r.fillText(text,x,n),n>100+3e4*Math.random()?l[t]=0:l[t]=n+10}))}),42)}}f.load().then((function(n){canvasApp(n)}));

View File

@ -0,0 +1 @@
function randomInt(a,b){return Math.floor(Math.random()*(b-a+1)+a)}var canvas=document.createElement("canvas"),ctx=canvas.getContext("2d");document.getElementById("canvasContainer").appendChild(canvas);var width=window.innerWidth,height=window.innerHeight;canvas.width=width,canvas.height=height;function clearCanvas(){ctx.fillStyle="#000",ctx.fillRect(0,0,width,height)}clearCanvas();for(var node,t=0,colors=["#4f91f9","#a7f94f","#f94f4f","#f9f74f","#8930ff","#fc4edf","#ff9c51"],nodeSize=3.5,speed=1.5,nodeAmount=150,nodes=[],lineWidth=1,nodePositionArray=[],drawLineThreshold=170,i=0;i<nodeAmount;i++)node=new Node(randomInt(0,width),randomInt(0,height),i),nodes.push(node);function circle(a,b,c){ctx.beginPath(),ctx.arc(a,b,c,0,2*Math.PI),ctx.closePath()}function line(a,b,c,d){ctx.lineWidth=lineWidth,ctx.beginPath(),ctx.moveTo(a,b),ctx.lineTo(c,d),ctx.stroke()}function distance(a,b,c,d){var e=b-a,f=d-c;return Math.sqrt(e*e+f*f)}function map_range(a,b,c,d,e){return d+(e-d)*(a-b)/(c-b)}function isEven(a){return a==parseFloat(a)?!(a%2):void 0}function hexToRgb(a){var b=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a);return b?{r:parseInt(b[1],16),g:parseInt(b[2],16),b:parseInt(b[3],16)}:null}for(var i=0;i<nodes.length;i++)nodes[i].move(),nodes[i].draw();function loop(){clearCanvas(),drawLines();for(var a=0;a<nodes.length;a++)nodes[a].move(),nodes[a].draw();requestAnimationFrame(loop),t++}loop();function Node(a,b,c){this.x=a,this.y=b,this.id=c,isEven(c)?(this.speedX=randomInt(1,100)/100+speed,this.speedY=randomInt(1,100)/100+speed):(this.speedX=randomInt(1,100)/100-speed,this.speedY=randomInt(1,100)/100-speed),this.size=nodeSize,this.color=colors[Math.floor(Math.random()*colors.length)],this.move=function(){this.y+=this.speedY,this.x+=this.speedX,(1>this.y||this.y>height-2*nodeSize)&&(this.speedY=-this.speedY),(1>this.x||this.x>width-2*nodeSize)&&(this.speedX=-this.speedX),nodePositionArray[this.id]=[this.x,this.y,this.color]},this.draw=function(){ctx.fillStyle=this.color,circle(this.x,this.y,nodeSize),ctx.fill()}}function drawLines(){for(var a=0;a<nodePositionArray.length-1;a++)for(var b=nodePositionArray[a][0],c=nodePositionArray[a][1],d=0;d<nodePositionArray.length-(a+1);d++){var e=nodePositionArray[d+a+1][0],f=nodePositionArray[d+a+1][1],g=distance(b,e,c,f);if(g<drawLineThreshold){var h=map_range(g,0,drawLineThreshold,1,0),k=hexToRgb(nodePositionArray[a][2]),l="rgba("+k.r+","+k.g+","+k.b+","+h+")";ctx.strokeStyle=l,line(b,c,e,f)}}}window.addEventListener("resize",function(){width=window.innerWidth,height=window.innerHeight,canvas.width=width,canvas.height=height,clearCanvas(),nodes=[];for(var a,b=0;b<nodeAmount;b++)a=new Node(randomInt(0,width),randomInt(0,height),b),nodes.push(a);for(var b=0;b<nodes.length;b++)nodes[b].move(),nodes[b].draw()});

View File

@ -0,0 +1 @@
function fn(){function a(a,b){if(2>arguments.length&&(b=a,a=0),a>b){var c=b;b=a,a=c}return Math.floor(Math.random()*(b-a+1))+a}function b(a,b){var c=Math.max(a,b),d=Math.round(Math.sqrt(c*c+c*c));return d/2}function c(){ctx.globalCompositeOperation="source-over",ctx.globalAlpha=.8,ctx.fillStyle="hsla("+hue+", 64%, 6%, 1)",ctx.fillRect(0,0,w,h),ctx.globalCompositeOperation="lighter";for(var a=1,b=stars.length;a<b;a++)stars[a].draw();window.requestAnimationFrame(c)}window.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(a){window.setTimeout(a,1e3/60)}}();var d=document.createElement("canvas");d.classList="background",document.getElementById("canvasContainer").appendChild(d),ctx=d.getContext("2d"),w=d.width=window.innerWidth,h=d.height=window.innerHeight,hue=217,stars=[],count=0,maxStars=1200;var e=document.createElement("canvas"),f=e.getContext("2d");document.getElementById("canvasContainer").appendChild(e),e.width=100,e.height=100;var g=e.width/2,j=f.createRadialGradient(g,g,0,g,g,g);j.addColorStop(.025,"#fff"),j.addColorStop(.1,"hsl("+hue+", 61%, 33%)"),j.addColorStop(.25,"hsl("+hue+", 64%, 6%)"),j.addColorStop(1,"transparent"),f.fillStyle=j,f.beginPath(),f.arc(g,g,g,0,2*Math.PI),f.fill();var k=function(){this.orbitRadius=a(b(w,h)),this.radius=a(60,this.orbitRadius)/12,this.orbitX=w/2,this.orbitY=h/2,this.timePassed=a(0,maxStars),this.speed=a(this.orbitRadius)/9e5,this.alpha=a(2,10)/10,count++,stars[count]=this};k.prototype.draw=function(){var b=Math.sin(this.timePassed)*this.orbitRadius+this.orbitX,c=Math.cos(this.timePassed)*this.orbitRadius+this.orbitY,d=a(10);1===d&&0<this.alpha?this.alpha-=.05:2===d&&1>this.alpha&&(this.alpha+=.05),ctx.globalAlpha=this.alpha,ctx.drawImage(e,b-this.radius/2,c-this.radius/2,this.radius,this.radius),this.timePassed+=this.speed};for(var l=0;l<maxStars;l++)new k;c()}fn();

View File

@ -0,0 +1 @@
window.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(b){window.setTimeout(b,1E3/60)}}(),document.onselectstart=function(){return!1};var c=document.createElement("canvas");c.id="myCanvas",c.className="background",document.getElementById("canvasContainer").appendChild(c);var ctx=c.getContext("2d"),dpr=window.devicePixelRatio,cw=window.innerWidth-500,ch=window.innerHeight-300;c.width=cw*dpr,c.height=ch*dpr,ctx.scale(dpr,dpr);var rand=function(a,b){return~~(Math.random()*(b-a+1)+a)};ctx.lineCap="round";var radius,orbs=[],orbCount=30;function createOrb(a,b){var c=cw/2-a,d=ch/2-b,e=Math.sqrt(c*c+d*d),f=Math.atan2(d,c);orbs.push({x:a,y:b,lastX:a,lastY:b,hue:0,colorAngle:0,angle:f+Math.PI/2,size:rand(1,3)/2,centerX:cw/2,centerY:ch/2,radius:e,speed:rand(1,5)/1e3*(e/750)+.005,alpha:1-Math.abs(e)/cw,draw:function(){ctx.strokeStyle="hsla("+this.colorAngle+",100%,50%,1)",ctx.lineWidth=this.size,ctx.beginPath(),ctx.moveTo(this.lastX,this.lastY),ctx.lineTo(this.x,this.y),ctx.stroke()},update:function(){var a=this.x,b=this.y;this.lastX=this.x,this.lastY=this.y;var c=cw/2,d=ch/2,e=a,f=b,g=-((d-f)/(c-e)),h=Math.atan(g),i=Math.floor(h*(180/Math.PI));e<c&&f<d&&(i+=180),e<c&&f>d&&(i+=180),e>c&&f>d&&(i+=360),f<d&&"-Infinity"==g&&(i=90),f>d&&"Infinity"==g&&(i=270),e<c&&"0"==g&&(i=180),isNaN(i)&&(i=0),this.colorAngle=i,this.x=this.centerX+Math.sin(-1*this.angle)*this.radius,this.y=this.centerY+Math.cos(-1*this.angle)*this.radius,this.angle+=this.speed}})}function orbGo(a){var b=a.pageX-c.offsetLeft,d=a.pageY-c.offsetTop;createOrb(b,d)}function clear(){orbs=[]}for(var count=1e3;count--;)createOrb(cw/2,ch/2+2*count);var loop=function(){window.requestAnimFrame(loop),ctx.fillStyle="rgba(0,0,0,.1)",ctx.fillRect(0,0,cw,ch);for(var a=orbs.length;a--;)for(var b=orbs[a],c=3;c--;)b.update(),b.draw(ctx)};loop();

View File

@ -0,0 +1,143 @@
async function handleRequest(request) {
const url = new URL(request.url)
let apiUrl = url.searchParams.get('apiurl')
if (apiUrl == null) {
apiUrl = API_URL
}
// Rewrite request to point to API url. This also makes the request mutable
// so we can add the correct Origin header to make the API server think
// that this request isn't cross-site.
request = new Request(apiUrl, request)
request.headers.set('Origin', new URL(apiUrl).origin)
let response = await fetch(request)
// Recreate the response so we can modify the headers
response = new Response(response.body, response)
// Set CORS headers
response.headers.set('Access-Control-Allow-Origin', '*')
// Append to/Add Vary header so browser will cache response correctly
response.headers.append('Vary', 'Origin')
return response
}
function handleOptions(request) {
// Make sure the necessary headers are present
// for this to be a valid pre-flight request
if (
request.headers.get('Origin') !== null &&
request.headers.get('Access-Control-Request-Method') !== null &&
request.headers.get('Access-Control-Request-Headers') !== null
) {
// Handle CORS pre-flight request.
// If you want to check the requested method + headers
// you can do that here.
return new Response(null, {
headers: corsHeaders,
})
} else {
// Handle standard OPTIONS request.
// If you want to allow other HTTP Methods, you can do that here.
return new Response(null, {
headers: {
Allow: 'GET, HEAD, POST, OPTIONS',
},
})
}
}
addEventListener('fetch', event => {
const request = event.request
const url = new URL(request.url)
if (url.pathname.startsWith(PROXY_ENDPOINT)) {
if (request.method === 'OPTIONS') {
// Handle CORS preflight requests
event.respondWith(handleOptions(request))
} else if (
request.method === 'GET' ||
request.method === 'HEAD' ||
request.method === 'POST'
) {
// Handle requests to the API server
event.respondWith(handleRequest(request))
} else {
event.respondWith(
new Response(null, {
status: 405,
statusText: 'Method Not Allowed',
}),
)
}
} else {
// Serve demo page
event.respondWith(rawHtmlResponse(DEMO_PAGE))
}
})
// We support the GET, POST, HEAD, and OPTIONS methods from any origin,
// and accept the Content-Type header on requests. These headers must be
// present on all responses to all CORS requests. In practice, this means
// all responses to OPTIONS requests.
const corsHeaders = {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET, HEAD, POST, OPTIONS',
'Access-Control-Allow-Headers': 'Content-Type',
}
// The URL for the remote third party API you want to fetch from
// but does not implement CORS
const API_URL = 'https://workers-tooling.cf/demos/demoapi'
// The endpoint you want the CORS reverse proxy to be on
const PROXY_ENDPOINT = '/corsproxy/'
// The rest of this snippet for the demo page
async function rawHtmlResponse(html) {
return new Response(html, {
headers: {
'content-type': 'text/html;charset=UTF-8',
},
})
}
const DEMO_PAGE = `
<!DOCTYPE html>
<html>
<body>
<h1>API GET without CORS Proxy</h1>
<a target='_blank' href='https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch#Checking_that_the_fetch_was_successful'>Shows TypeError: Failed to fetch since CORS is misconfigured</a>
<p id='noproxy-status'/>
<code id='noproxy'>Waiting</code>
<h1>API GET with CORS Proxy</h1>
<p id='proxy-status'/>
<code id='proxy'>Waiting</code>
<h1>API POST with CORS Proxy + Preflight</h1>
<p id='proxypreflight-status'/>
<code id='proxypreflight'>Waiting</code>
<script>
let reqs = {};
reqs.noproxy = async () => {
let response = await fetch('${API_URL}')
return await response.json()
}
reqs.proxy = async () => {
let response = await fetch(window.location.origin + '${PROXY_ENDPOINT}?apiurl=${API_URL}')
return await response.json()
}
reqs.proxypreflight = async () => {
const reqBody = {
msg: "Hello world!"
}
let response = await fetch(window.location.origin + '${PROXY_ENDPOINT}?apiurl=${API_URL}', {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(reqBody),
})
return await response.json()
}
(async () => {
for (const [reqName, req] of Object.entries(reqs)) {
try {
let data = await req()
document.getElementById(reqName).innerHTML = JSON.stringify(data)
} catch (e) {
document.getElementById(reqName).innerHTML = e
}
}
})()
</script>
</body>
</html>`

View File

@ -0,0 +1,50 @@
async function handleRequest(a){const b=new URL(a.url);let c=b.searchParams.get("apiurl");null==c&&(c=API_URL),a=new Request(c,a),a.headers.set("Origin",new URL(c).origin);let d=await fetch(a);return d=new Response(d.body,d),d.headers.set("Access-Control-Allow-Origin","*"),d.headers.append("Vary","Origin"),d}function handleOptions(a){return null!==a.headers.get("Origin")&&null!==a.headers.get("Access-Control-Request-Method")&&null!==a.headers.get("Access-Control-Request-Headers")?new Response(null,{headers:corsHeaders}):new Response(null,{headers:{Allow:"GET, HEAD, POST, OPTIONS"}})}addEventListener("fetch",a=>{const b=a.request,c=new URL(b.url);c.pathname.startsWith(PROXY_ENDPOINT)?"OPTIONS"===b.method?a.respondWith(handleOptions(b)):"GET"===b.method||"HEAD"===b.method||"POST"===b.method?a.respondWith(handleRequest(b)):a.respondWith(new Response(null,{status:405,statusText:"Method Not Allowed"})):a.respondWith(rawHtmlResponse(DEMO_PAGE))});const corsHeaders={"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, HEAD, POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type"},API_URL="https://workers-tooling.cf/demos/demoapi",PROXY_ENDPOINT="/corsproxy/";async function rawHtmlResponse(a){return new Response(a,{headers:{"content-type":"text/html;charset=UTF-8"}})}const DEMO_PAGE=`
<!DOCTYPE html>
<html>
<body>
<h1>API GET without CORS Proxy</h1>
<a target='_blank' href='https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch#Checking_that_the_fetch_was_successful'>Shows TypeError: Failed to fetch since CORS is misconfigured</a>
<p id='noproxy-status'/>
<code id='noproxy'>Waiting</code>
<h1>API GET with CORS Proxy</h1>
<p id='proxy-status'/>
<code id='proxy'>Waiting</code>
<h1>API POST with CORS Proxy + Preflight</h1>
<p id='proxypreflight-status'/>
<code id='proxypreflight'>Waiting</code>
<script>
let reqs = {};
reqs.noproxy = async () => {
let response = await fetch('${API_URL}')
return await response.json()
}
reqs.proxy = async () => {
let response = await fetch(window.location.origin + '${PROXY_ENDPOINT}?apiurl=${API_URL}')
return await response.json()
}
reqs.proxypreflight = async () => {
const reqBody = {
msg: "Hello world!"
}
let response = await fetch(window.location.origin + '${PROXY_ENDPOINT}?apiurl=${API_URL}', {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(reqBody),
})
return await response.json()
}
(async () => {
for (const [reqName, req] of Object.entries(reqs)) {
try {
let data = await req()
document.getElementById(reqName).innerHTML = JSON.stringify(data)
} catch (e) {
document.getElementById(reqName).innerHTML = e
}
}
})()
</script>
</body>
</html>`;

View File

@ -0,0 +1,143 @@
function openCustomLinksNav() {
document.getElementById("custom_links_nav").style.width = "250px";
document["CustomLinksNavOpened"] = true;
}
/* Set the width of the side navigation to 0 */
function closeCustomLinksNav() {
document.getElementById("custom_links_nav").style.width = "0";
document["CustomLinksNavOpened"] = false;
}
function getCustomLinkItems() {
return localStorage.getItem("menu-items")
? JSON.parse(localStorage.getItem("menu-items"))
: {};
}
function storeCustomLinkItems(menuItems) {
localStorage.setItem("menu-items", JSON.stringify(menuItems));
}
function getDefaultSystemLinks() {
return window.linkMenu;
}
function buildCustomUserLinksMenu() {
let linkMenu = getCustomLinkItems();
let categories = Object.keys(linkMenu);
let elements = [];
for (let a = 0; a < categories.length; a++) {
if (linkMenu[categories[a]].length < 2) {
continue;
}
let svg = "";
elements.push(`<li class="cat-separator">
${a == 0 ? `` : `<hr/>`}
<a >${svg} <span>${categories[a]}</span></a>
${`<hr/>`}
</li>`);
for (let e = 1; e < linkMenu[categories[a]].length; e++) {
elements.push(`<li>
<span class="remove-custom-link"
data-category="${categories[a]}"
data-index="${e}"
onclick="customLinkRemoveConfirmation(event)" >x</span>
<a target='_blank' class='cat-item' href="${linkMenu[categories[a]][e][1]}">${
linkMenu[categories[a]][e][0]
}</a></li>`);
}
}
document.getElementById("userCustomLinks").innerHTML = elements.join(`\n`);
}
function getCustomLinkItemsCatImage(category) {
let links = getDefaultSystemLinks();
return links[category] ? links[category][0] : [];
}
function addCustomLinkToLinkItems(url, title, category, color) {
let linkItems = getCustomLinkItems();
if (!linkItems[category]) {
linkItems[category] = [];
linkItems[category].push([color]);
}
linkItems[category].push([title, url, ""]);
return linkItems;
}
function addCustomLinkToMenu(url, title, category, color) {
storeCustomLinkItems(addCustomLinkToLinkItems(url, title, category, color));
buildCustomUserLinksMenu();
perfectSrollBars.customLinks.update();
}
function removeCustomLink(category, index) {
let links = getCustomLinkItems();
let newList = [];
for (let i = 0; i < links[category].length; i++) {
if (i != index) {
newList.push(links[category][i]);
}
}
if (newList.length < 2) {
delete links[category];
} else {
links[category] = newList;
}
storeCustomLinkItems(links);
buildCustomUserLinksMenu();
}
function customLinkRemoveConfirmation(ev) {
let category = ev.srcElement.attributes["data-category"].nodeValue;
let index = ev.srcElement.attributes["data-index"].nodeValue;
var label = getCustomLinkItems()[category][index][0];
confirmModal.style.display = "block";
overlay.style.display = "block";
document.getElementById("modal-label").innerHTML = label;
document.getElementById("deleteLink").addEventListener(
"click",
function() {
removeCustomLink(category, index);
confirmModal.style.display = "none";
overlay.style.display = "none";
},
{ once: true }
);
}
const perfectSrollBars = {
customLinks: null
};
function setPerfectScrollbar() {
perfectSrollBars.customLinks = new PerfectScrollbar("#userCustomLinks");
perfectSrollBars.customLinks.update();
document.getElementById("userCustomLinks").scrollTop = 0;
document.querySelector("#userCustomLinks>div.ps__rail-y").style.opacity = 1;
}
(() => {
let checkInterval = setInterval(() => {
if (linkMenu) {
try {
buildCustomUserLinksMenu();
window.addLinkToMenu = (url, name, category) => {
category = document.getElementById("custom-category-name").value;
let color = document.getElementById("custom-category-color").value;
addCustomLinkToMenu(url, name, category, color);
};
setPerfectScrollbar();
} catch (e) {
console.log(e);
}
clearInterval(checkInterval);
}
}, 30);
})();

8
weboasis/js/custom-items-menu.min.js vendored Normal file
View File

@ -0,0 +1,8 @@
function openCustomLinksNav(){document.getElementById("custom_links_nav").style.width="250px";document.CustomLinksNavOpened=!0}function closeCustomLinksNav(){document.getElementById("custom_links_nav").style.width="0";document.CustomLinksNavOpened=!1}function getCustomLinkItems(){return localStorage.getItem("menu-items")?JSON.parse(localStorage.getItem("menu-items")):{}}function storeCustomLinkItems(a){localStorage.setItem("menu-items",JSON.stringify(a))}
function getDefaultSystemLinks(){return window.linkMenu}
function buildCustomUserLinksMenu(){for(var a=getCustomLinkItems(),b=Object.keys(a),c=[],d=0;d<b.length;d++)if(!(2>a[b[d]].length)){c.push('<li class="cat-separator">\n\t\t'+(0==d?"":"<hr/>")+"\n\t\t<a > <span>"+b[d]+"</span></a>\n\t\t<hr/>\n\t\t</li>");for(var e=1;e<a[b[d]].length;e++)c.push('<li>\n\t\t\t<span class="remove-custom-link"\n\t\t\tdata-category="'+b[d]+'"\n\t\t\tdata-index="'+e+"\"\n\t\t\tonclick=\"customLinkRemoveConfirmation(event)\" >x</span>\n\t\t\t<a target='_blank' class='cat-item' href=\""+a[b[d]][e][1]+
'">'+a[b[d]][e][0]+"</a></li>")}document.getElementById("userCustomLinks").innerHTML=c.join("\n")}function getCustomLinkItemsCatImage(a){var b=getDefaultSystemLinks();return b[a]?b[a][0]:[]}function addCustomLinkToLinkItems(a,b,c,d){var e=getCustomLinkItems();e[c]||(e[c]=[],e[c].push([d]));e[c].push([b,a,""]);return e}function addCustomLinkToMenu(a,b,c,d){storeCustomLinkItems(addCustomLinkToLinkItems(a,b,c,d));buildCustomUserLinksMenu();perfectSrollBars.customLinks.update()}
function removeCustomLink(a,b){for(var c=getCustomLinkItems(),d=[],e=0;e<c[a].length;e++)e!=b&&d.push(c[a][e]);2>d.length?delete c[a]:c[a]=d;storeCustomLinkItems(c);buildCustomUserLinksMenu()}
function customLinkRemoveConfirmation(a){var b=a.srcElement.attributes["data-category"].nodeValue,c=a.srcElement.attributes["data-index"].nodeValue;a=getCustomLinkItems()[b][c][0];confirmModal.style.display="block";overlay.style.display="block";document.getElementById("modal-label").innerHTML=a;document.getElementById("deleteLink").addEventListener("click",function(){removeCustomLink(b,c);confirmModal.style.display="none";overlay.style.display="none"},{once:!0})}var perfectSrollBars={customLinks:null};
function setPerfectScrollbar(){perfectSrollBars.customLinks=new PerfectScrollbar("#userCustomLinks");perfectSrollBars.customLinks.update();document.getElementById("userCustomLinks").scrollTop=0;document.querySelector("#userCustomLinks>div.ps__rail-y").style.opacity=1}
(function(){var a=setInterval(function(){if(linkMenu){try{buildCustomUserLinksMenu(),window.addLinkToMenu=function(a,c,d){d=document.getElementById("custom-category-name").value;var b=document.getElementById("custom-category-color").value;addCustomLinkToMenu(a,c,d,b)},setPerfectScrollbar()}catch(b){console.log(b)}clearInterval(a)}},30)})();

126
weboasis/js/custom.js Normal file
View File

@ -0,0 +1,126 @@
document.addEventListener("DOMContentLoaded", function () {
var resetButton = document.getElementById("resetBackgroundBtn");
function n(t) {
url_str = "url(media/bg/bg" + t + ".jpg)";
console.log(url_str);
void 0 === t | !t ?
(document.getElementById("canvasContainer").style.display = "block", document.getElementById("body").style.display.backgroundImage = "none", document.getElementById("resetBackgroundBtn").style.display = "none") :
(document.getElementById("canvasContainer").style.display = "none", document.getElementById("body").style.backgroundImage = url_str)
}
function useCustomFile() {
var imageData = localStorage.getItem("background_image_file");
document.getElementById("canvasContainer").style.display = "none", document.getElementById("body").style.backgroundImage = "url(" + imageData + ")";
if (document.getElementById("resetBackgroundBtn").style.display === "none") {
document.getElementById("resetBackgroundBtn").style.display = "inline-block"
}
}
var e = localStorage.getItem("background_id");
if (localStorage.getItem("use_own_background_image") == "yes") {
resetButton.style.display = "inline-block"
useCustomFile();
} else {
n(e);
}
console.log("Filling options");
for (var i = 0, imax = linkMenuOrder.length; i < imax; i++) {
var option = document.createElement("option");
option.innerHTML = linkMenuOrder[i];
document.getElementById("menu-select").appendChild(option);
};
document.getElementById("add").addEventListener("click", function () {
if (document.getElementById("url").value === "https://" || document.getElementById("url").value === "" || document.getElementById("title").value === "") {
alert("You haven't entered new link URL or title!");
return;
}
addLinkToMenu(document.getElementById("url").value, document.getElementById("title").value, document.getElementById("menu-select").value);
document.getElementById("url").value = "https://";
document.getElementById("title").value = "";
})
var linkForm = document.getElementById("add-link-form");
document.getElementById("add-link-btn").addEventListener('click', function (event) {
linkForm.classList.toggle("active");
});
bg_container = document.getElementById("customBackgrounds");
bg_list = document.getElementById("customBackgroundsList");
bg_thumb = document.getElementById("thumbTemplate");
bg_count = 6;
for (var c = 0; c <= 5; c++) {
var l = "media/bg-thumbs/bg" + c + ".jpg";
// console.log(l);
var i = bg_thumb.cloneNode(true);
i.classList.remove("template");
i.style.backgroundImage = "url(" + l + ")";
i.setAttribute("data-id", c);
bg_list.appendChild(i)
}
var resetBackground = function () {
e = "", localStorage.setItem("background_id", e), document.getElementById("thumbTemplate").classList.remove("active"), n(e);
if (localStorage.getItem("use_own_background_image") === "yes") {
localStorage.setItem("use_own_background_image", "no"), localStorage.setItem("background_image_file", "");
}
}
document.getElementById("customBgBtnToggle").addEventListener("click", function () {
document.getElementById("customBackgrounds").classList.toggle("active");
})
var thumbsList = document.querySelectorAll(".thumb");
Array.from(thumbsList).forEach(function (thumb) {
thumb.addEventListener("mouseover", function () {
bg_container.classList.contains("active") && n(this.getAttribute(("data-id")))
});
thumb.addEventListener("mouseleave", function () {
bg_container.classList.contains("active") && (localStorage.getItem("use_own_background_image") === "yes" ? useCustomFile() : n(e))
});
thumb.addEventListener("click", function () {
if (bg_container.classList.contains("active")) {
e = this.getAttribute("data-id");
localStorage.setItem("background_id", e);
for (let sibling of this.parentNode.children) {
sibling.classList.remove("active");
}
this.classList.add("active");
resetButton.style.display = "inline-block";
}
localStorage.setItem("use_own_background_image", "no"), localStorage.setItem("background_image_file", "")
});
})
resetButton.addEventListener("click", function () { resetBackground() });
globalResetBackground = resetBackground; // for access from script.js
document.getElementById("customBackgroundFile").addEventListener("change", function () {
var file = this.files[0];
if (file.type.indexOf('image') < 0) {
alert("Sorry, that is an invalid file type");
return;
}
var fReader = new FileReader();
fReader.onload = function () {
var imageData = fReader.result;
try {
localStorage.setItem("background_image_file", imageData);
localStorage.setItem("use_own_background_image", "yes");
document.getElementById("canvasContainer").style.display = "none";
document.getElementById("body").style.backgroundImage = "url(" + imageData + ")";
resetButton.style.display = "inline-block";
document.getElementById("customBackgrounds").classList.toggle("active");
lockSidebar = false;
closeNav();
} catch (domException) {
if (domException.name === 'QuotaExceededError' || domException.name === 'NS_ERROR_DOM_QUOTA_REACHED') {
alert("Sorry, that image is too large for this browser.");
}
}
};
fReader.readAsDataURL(file);
});
});

1
weboasis/js/custom.min.js vendored Normal file
View File

@ -0,0 +1 @@
document.addEventListener("DOMContentLoaded",function(){function a(a){url_str="url(media/bg/bg"+a+".jpg)",console.log(url_str),void 0===a|!a?(document.getElementById("canvasContainer").style.display="block",document.getElementById("body").style.display.backgroundImage="none",document.getElementById("resetBackgroundBtn").style.display="none"):(document.getElementById("canvasContainer").style.display="none",document.getElementById("body").style.backgroundImage=url_str)}function b(){var a=localStorage.getItem("background_image_file");document.getElementById("canvasContainer").style.display="none",document.getElementById("body").style.backgroundImage="url("+a+")","none"===document.getElementById("resetBackgroundBtn").style.display&&(document.getElementById("resetBackgroundBtn").style.display="inline-block")}var d=document.getElementById("resetBackgroundBtn"),f=localStorage.getItem("background_id");"yes"==localStorage.getItem("use_own_background_image")?(d.style.display="inline-block",b()):a(f),console.log("Filling options");for(var g,h=0,j=linkMenuOrder.length;h<j;h++)g=document.createElement("option"),g.innerHTML=linkMenuOrder[h],document.getElementById("menu-select").appendChild(g);document.getElementById("add").addEventListener("click",function(){return"https://"===document.getElementById("url").value||""===document.getElementById("url").value||""===document.getElementById("title").value?void alert("You haven't entered new link URL or title!"):void(addLinkToMenu(document.getElementById("url").value,document.getElementById("title").value,document.getElementById("menu-select").value),document.getElementById("url").value="https://",document.getElementById("title").value="")});var k=document.getElementById("add-link-form");document.getElementById("add-link-btn").addEventListener("click",function(){k.classList.toggle("active")}),bg_container=document.getElementById("customBackgrounds"),bg_list=document.getElementById("customBackgroundsList"),bg_thumb=document.getElementById("thumbTemplate"),bg_count=6;for(var m=0;5>=m;m++){var n="media/bg-thumbs/bg"+m+".jpg",h=bg_thumb.cloneNode(!0);h.classList.remove("template"),h.style.backgroundImage="url("+n+")",h.setAttribute("data-id",m),bg_list.appendChild(h)}var l=function(){f="",localStorage.setItem("background_id",f),document.getElementById("thumbTemplate").classList.remove("active"),a(f),"yes"===localStorage.getItem("use_own_background_image")&&(localStorage.setItem("use_own_background_image","no"),localStorage.setItem("background_image_file",""))};document.getElementById("customBgBtnToggle").addEventListener("click",function(){document.getElementById("customBackgrounds").classList.toggle("active")});var o=document.querySelectorAll(".thumb");Array.from(o).forEach(function(c){c.addEventListener("mouseover",function(){bg_container.classList.contains("active")&&a(this.getAttribute("data-id"))}),c.addEventListener("mouseleave",function(){bg_container.classList.contains("active")&&("yes"===localStorage.getItem("use_own_background_image")?b():a(f))}),c.addEventListener("click",function(){if(bg_container.classList.contains("active")){f=this.getAttribute("data-id"),localStorage.setItem("background_id",f);for(let a of this.parentNode.children)a.classList.remove("active");this.classList.add("active"),d.style.display="inline-block"}localStorage.setItem("use_own_background_image","no"),localStorage.setItem("background_image_file","")})}),d.addEventListener("click",function(){l()}),globalResetBackground=l,document.getElementById("customBackgroundFile").addEventListener("change",function(){var a=this.files[0];if(0>a.type.indexOf("image"))return void alert("Sorry, that is an invalid file type");var b=new FileReader;b.onload=function(){var a=b.result;try{localStorage.setItem("background_image_file",a),localStorage.setItem("use_own_background_image","yes"),document.getElementById("canvasContainer").style.display="none",document.getElementById("body").style.backgroundImage="url("+a+")",d.style.display="inline-block",document.getElementById("customBackgrounds").classList.toggle("active"),lockSidebar=!1,closeNav()}catch(a){("QuotaExceededError"===a.name||"NS_ERROR_DOM_QUOTA_REACHED"===a.name)&&alert("Sorry, that image is too large for this browser.")}},b.readAsDataURL(a)})});

View File

@ -0,0 +1,99 @@
const DEF_SETTINGS_RELOADER = {};
DEF_SETTINGS_RELOADER._settings = {
_timeOffset: (86400000)*90 //90 days since last update, in milliseconds
,_lastCheckedAtID: "last-updated-at" //ID for the localStorage key
}
/**
* @description Gets the last time it was checked
* @returns Will return the timestamp if it has been set; else, it will return 0.
*/
DEF_SETTINGS_RELOADER._getLastCheckedAt = function(){
let localSValue = localStorage.getItem(DEF_SETTINGS_RELOADER._settings._lastCheckedAtID);
return (localSValue) ? parseInt(localSValue) : 0;
}
/**
* @description Gets the last time since the last settings set-up
* @returns Milliseconds since the last call
*/
DEF_SETTINGS_RELOADER._getTimeSinceLastCheck = function(){
return (new Date().getTime() - DEF_SETTINGS_RELOADER._getLastCheckedAt());
}
/**
* @description Wether it has passed enough time for the set-up
* @returns true if more time than the one set in _timeOffset has passed; false otherwise.
*/
DEF_SETTINGS_RELOADER._hasTimePassed = function(){
let lastTimeChecked = DEF_SETTINGS_RELOADER._getTimeSinceLastCheck();
let offset = DEF_SETTINGS_RELOADER._settings._timeOffset;
if(DEF_SETTINGS_RELOADER._getLastCheckedAt() == 0){
//Hasn't been set. Set as of now, so we start counting from now on.
DEF_SETTINGS_RELOADER._setLastUpdatedAt();
return false;
}
return (lastTimeChecked > offset);
}
/**
* @description Sets the last updated-at time for the user into localStorage
*/
DEF_SETTINGS_RELOADER._setLastUpdatedAt = function(){
localStorage.setItem(DEF_SETTINGS_RELOADER._settings._lastCheckedAtID, new Date().getTime()+"");
}
/**
* @description Sets the required settings back to default.
*/
DEF_SETTINGS_RELOADER._setDefaultSettings = function(){
//+Handling the menu settings
localStorage.setItem("menu-items", JSON.stringify(defaultLinkMenu));
DEF_SETTINGS_RELOADER._setLastUpdatedAt();
buildMenu();
//-Handling the menu settings
}
/**
* @description Sets the settings module and attaches to the required methods
* - Will update when a menu link is removed
* - Will update when a menu link is added
*/
DEF_SETTINGS_RELOADER._init = ()=>{
let definedWindowFunctions = [
'addLinkToMenu','removeLinkFromMenu'
];
let checkInterval = setInterval(()=>{ //Interval that checks for each link to execute
let hasUndefinedFunction = definedWindowFunctions.find((funcName)=>{ //Defined window function
if(typeof window[funcName] !== "function"){
return true;
}
});
if(!hasUndefinedFunction){ //If all elements are defined functions
//When a link is added
let _origin_addLinkToMenu = window.addLinkToMenu;
window.addLinkToMenu = (...args)=>{
DEF_SETTINGS_RELOADER._setLastUpdatedAt();
return _origin_addLinkToMenu(...args);
}
//When a link is removed
let _origin_removeLinkFromMenu = window.removeLinkFromMenu;
window.removeLinkFromMenu = (...args)=>{
DEF_SETTINGS_RELOADER._setLastUpdatedAt();
return _origin_removeLinkFromMenu(...args);
}
if(DEF_SETTINGS_RELOADER._hasTimePassed()){
DEF_SETTINGS_RELOADER._setDefaultSettings();
}
clearInterval(checkInterval);
}
},50);
}
DEF_SETTINGS_RELOADER._init();

View File

@ -0,0 +1,6 @@
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}};$jscomp.arrayIterator=function(a){return{next:$jscomp.arrayIteratorImpl(a)}};$jscomp.makeIterator=function(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return b?b.call(a):$jscomp.arrayIterator(a)};$jscomp.arrayFromIterator=function(a){for(var b,d=[];!(b=a.next()).done;)d.push(b.value);return d};
$jscomp.arrayFromIterable=function(a){return a instanceof Array?a:$jscomp.arrayFromIterator($jscomp.makeIterator(a))};
var DEF_SETTINGS_RELOADER={_settings:{_timeOffset:7776E6,_lastCheckedAtID:"last-updated-at"},_getLastCheckedAt:function(){var a=localStorage.getItem(DEF_SETTINGS_RELOADER._settings._lastCheckedAtID);return a?parseInt(a):0},_getTimeSinceLastCheck:function(){return(new Date).getTime()-DEF_SETTINGS_RELOADER._getLastCheckedAt()},_hasTimePassed:function(){var a=DEF_SETTINGS_RELOADER._getTimeSinceLastCheck(),b=DEF_SETTINGS_RELOADER._settings._timeOffset;return 0==DEF_SETTINGS_RELOADER._getLastCheckedAt()?
(DEF_SETTINGS_RELOADER._setLastUpdatedAt(),!1):a>b},_setLastUpdatedAt:function(){localStorage.setItem(DEF_SETTINGS_RELOADER._settings._lastCheckedAtID,(new Date).getTime()+"")},_setDefaultSettings:function(){localStorage.setItem("menu-items",JSON.stringify(defaultLinkMenu));DEF_SETTINGS_RELOADER._setLastUpdatedAt();buildMenu()},_init:function(){var a=["addLinkToMenu","removeLinkFromMenu"],b=setInterval(function(){if(!a.find(function(a){if("function"!==typeof window[a])return!0})){var d=window.addLinkToMenu;
window.addLinkToMenu=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c-0]=arguments[c];DEF_SETTINGS_RELOADER._setLastUpdatedAt();return d.apply(null,$jscomp.arrayFromIterable(b))};var e=window.removeLinkFromMenu;window.removeLinkFromMenu=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c-0]=arguments[c];DEF_SETTINGS_RELOADER._setLastUpdatedAt();return e.apply(null,$jscomp.arrayFromIterable(b))};DEF_SETTINGS_RELOADER._hasTimePassed()&&DEF_SETTINGS_RELOADER._setDefaultSettings();clearInterval(b)}},
50)}};DEF_SETTINGS_RELOADER._init();

1
weboasis/js/fast.min.js vendored Normal file
View File

@ -0,0 +1 @@
let urlToPreload,mouseoverTimer,lastTouchTimestamp;const prefetcher=document.createElement("link"),isSupported=prefetcher.relList&&prefetcher.relList.supports&&prefetcher.relList.supports("prefetch"),isDataSaverEnabled=navigator.connection&&navigator.connection.saveData,allowQueryString="instantAllowQueryString"in document.body.dataset,allowExternalLinks="instantAllowExternalLinks"in document.body.dataset;if(isSupported&&!isDataSaverEnabled){prefetcher.rel="prefetch",document.head.appendChild(prefetcher);const a={capture:!0,passive:!0};document.addEventListener("touchstart",touchstartListener,a),document.addEventListener("mouseover",mouseoverListener,a)}function touchstartListener(a){lastTouchTimestamp=performance.now();const b=a.target.closest("a");isPreloadable(b)&&(b.addEventListener("touchcancel",touchendAndTouchcancelListener,{passive:!0}),b.addEventListener("touchend",touchendAndTouchcancelListener,{passive:!0}),urlToPreload=b.href,preload(b.href))}function touchendAndTouchcancelListener(){urlToPreload=void 0,stopPreloading()}function mouseoverListener(a){if(1100>performance.now()-lastTouchTimestamp)return;const b=a.target.closest("a");isPreloadable(b)&&(b.addEventListener("mouseout",mouseoutListener,{passive:!0}),urlToPreload=b.href,mouseoverTimer=setTimeout(()=>{preload(b.href),mouseoverTimer=void 0},65))}function mouseoutListener(a){a.relatedTarget&&a.target.closest("a")==a.relatedTarget.closest("a")||(mouseoverTimer?(clearTimeout(mouseoverTimer),mouseoverTimer=void 0):(urlToPreload=void 0,stopPreloading()))}function isPreloadable(a){if(a&&a.href&&urlToPreload!=a.href){const b=new URL(a.href);return allowExternalLinks||b.origin==location.origin||"instant"in a.dataset?["http:","https:"].includes(b.protocol)?"http:"==b.protocol&&"https:"==location.protocol?void 0:allowQueryString||!b.search||"instant"in a.dataset?b.hash&&b.pathname+b.search==location.pathname+location.search?void 0:!("noInstant"in a.dataset)||void 0:void 0:void 0:void 0}}function preload(a){prefetcher.href=a}function stopPreloading(){prefetcher.removeAttribute("href")}

0
weboasis/js/index.html Normal file
View File

View File

@ -0,0 +1,77 @@
function is_touch_device() {
var prefixes = ' -webkit- -moz- -o- -ms- '.split(' ');
var mq = function (query) {
return window.matchMedia(query).matches;
}
if (('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) {
return true;
}
var query = ['(', prefixes.join('touch-enabled),('), 'heartz', ')'].join('');
return mq(query);
}
(() => {
let show = is_touch_device() || true;
if (show) {
document.getElementById("searchContainer").classList.add("touchscreen");
document.getElementById("searchButton").addEventListener('click', function () {
/*--- BASED ON THE SEARCH METHOD ---*/
let query = document.getElementById("searchBar").value;
let qList = query.split(" ");
if (qList[0].charAt(0) === cmdPrefix) {
var keyword = "";
for (var i = 0; i < searchSources.length; i++) {
keyword = cmdPrefix + searchSources[i][0];
if (keyword === qList[0]) {
ssi = i;
break;
}
}
if (qList.length > 1) {
url = searchSources[ssi][1].replace("{Q}", encodeURIComponent(query.replace(keyword, ""))).trim();
if (GetCookie('new-tab') === 'true') {
window.open(url, '_blank');
} else {
window.location = url;
}
} else {
event.preventDefault();
searchInput.placeholder = searchSources[ssi][2];
searchInput.value = "";
}
} else {
url = searchSources[ssi][1].replace("{Q}", encodeURIComponent(query));
if (GetCookie('new-tab') === 'true') {
window.open(url, '_blank');
} else {
window.location = url;
}
}
});
function setFontSize() {
try {
var computedFontSize = window.getComputedStyle(document.getElementById("searchBar")).fontSize;
document.getElementById("searchButton").style.fontSize = computedFontSize;
} catch (e) {}
}
document.getElementById("searchBar")
.addEventListener("focus", function () {
if (!document.getElementById("searchButton").classList.contains("searchbar-focused")) {
document.getElementById("searchButton").classList.add("searchbar-focused");
}
});
document.getElementById("searchBar")
.addEventListener("blur", function () {
if (document.getElementById("searchButton").classList.contains("searchbar-focused")) {
document.getElementById("searchButton").classList.remove("searchbar-focused");
}
});
document.getElementById("searchButton").style.height = document.getElementById("searchBar").offsetHeight + "px";
setFontSize();
}
})();

View File

@ -0,0 +1 @@
function is_touch_device(){if("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)return!0;var a=["(",["","-webkit-","-moz-","-o-","-ms-",""].join("touch-enabled),("),"heartz",")"].join("");return function(a){return window.matchMedia(a).matches}(a)}(()=>{let a=is_touch_device()||!0;if(a){document.getElementById("searchContainer").classList.add("touchscreen"),document.getElementById("searchButton").addEventListener("click",function(){let a=document.getElementById("searchBar").value,b=a.split(" ");if(b[0].charAt(0)===cmdPrefix){for(var c="",d=0;d<searchSources.length;d++)if(c=cmdPrefix+searchSources[d][0],c===b[0]){ssi=d;break}1<b.length?(url=searchSources[ssi][1].replace("{Q}",encodeURIComponent(a.replace(c,""))).trim(),"true"===GetCookie("new-tab")?window.open(url,"_blank"):window.location=url):(event.preventDefault(),searchInput.placeholder=searchSources[ssi][2],searchInput.value="")}else url=searchSources[ssi][1].replace("{Q}",encodeURIComponent(a)),"true"===GetCookie("new-tab")?window.open(url,"_blank"):window.location=url}),document.getElementById("searchBar").addEventListener("focus",function(){document.getElementById("searchButton").classList.contains("searchbar-focused")||document.getElementById("searchButton").classList.add("searchbar-focused")}),document.getElementById("searchBar").addEventListener("blur",function(){document.getElementById("searchButton").classList.contains("searchbar-focused")&&document.getElementById("searchButton").classList.remove("searchbar-focused")}),document.getElementById("searchButton").style.height=document.getElementById("searchBar").offsetHeight+"px",function(){try{var a=window.getComputedStyle(document.getElementById("searchBar")).fontSize;document.getElementById("searchButton").style.fontSize=a}catch(a){}}()}})();

View File

@ -0,0 +1,59 @@
let selectedIndex = -1
let searchInputText = ""
const linkSearch = document.getElementById("searchLinks");
const defaultSearch = document.getElementById("searchBar");
//Handles searching weboasis links and generates new search result based on entered search value
function handleSearchQuery(e) {
let defaultLinkSources = [];
for (const property in defaultLinkMenu) {
for (j = 0; j < defaultLinkMenu[property].length; j++) {
if (defaultLinkMenu[property][j][2] != "-HEAD-") {
defaultLinkSources.push(defaultLinkMenu[property][j]);
}
}
}
for (j = 0; j < hiddenLinksOne.length; j++) {
hiddenLinksOne[j][2] = "";
defaultLinkSources.push(hiddenLinksOne[j]);
}
for (j = 0; j < hiddenLinksTwo.length; j++) {
hiddenLinksTwo[j][2] = "";
defaultLinkSources.push(hiddenLinksTwo[j]);
}
let newLinks = defaultLinkSources.filter((x) => {
return (
x[0]
.toLowerCase()
.trim()
.includes(searchLinksInput.value.toLowerCase().trim()) ||
x[1]
.toLowerCase()
.trim()
.includes(searchLinksInput.value.toLowerCase().trim()) ||
x[2]
.toLowerCase()
.trim()
.includes(searchLinksInput.value.toLowerCase().trim())
);
});
initSearchLinks(newLinks);
buildHelp2();
if (searchLinksInput.value.toLowerCase().trim() != searchInputText) {
selectedIndex = -1
searchInputText = searchLinksInput.value.toLowerCase().trim()
}
}
function handleSearchReset(e) {
let event = new Event("keyup");
searchLinksInput.dispatchEvent(event)
}

1
weboasis/js/index_search_links.min.js vendored Normal file
View File

@ -0,0 +1 @@
let selectedIndex=-1,searchInputText="";const linkSearch=document.getElementById("searchLinks"),defaultSearch=document.getElementById("searchBar");function handleSearchQuery(){let a=[];for(const b in defaultLinkMenu)for(j=0;j<defaultLinkMenu[b].length;j++)"-HEAD-"!=defaultLinkMenu[b][j][2]&&a.push(defaultLinkMenu[b][j]);for(j=0;j<hiddenLinksOne.length;j++)hiddenLinksOne[j][2]="",a.push(hiddenLinksOne[j]);for(j=0;j<hiddenLinksTwo.length;j++)hiddenLinksTwo[j][2]="",a.push(hiddenLinksTwo[j]);let b=a.filter(a=>a[0].toLowerCase().trim().includes(searchLinksInput.value.toLowerCase().trim())||a[1].toLowerCase().trim().includes(searchLinksInput.value.toLowerCase().trim())||a[2].toLowerCase().trim().includes(searchLinksInput.value.toLowerCase().trim()));initSearchLinks(b),buildHelp2(),searchLinksInput.value.toLowerCase().trim()!=searchInputText&&(selectedIndex=-1,searchInputText=searchLinksInput.value.toLowerCase().trim())}function handleSearchReset(){let a=new Event("keyup");searchLinksInput.dispatchEvent(a)}

2
weboasis/js/jquery-3.3.1.min.js vendored Normal file

File diff suppressed because one or more lines are too long

2
weboasis/js/jquery-3.5.1.min.js vendored Normal file

File diff suppressed because one or more lines are too long

2
weboasis/js/jquery-3.6.0.min.js vendored Normal file

File diff suppressed because one or more lines are too long

1
weboasis/js/jscolor.min.js vendored Normal file

File diff suppressed because one or more lines are too long

155
weboasis/js/keyscroll.js Normal file
View File

@ -0,0 +1,155 @@
// Adds Scrolling function with keyboard to search links list and autocomplete suggestions list
document.onkeydown = selectKey;
document.onkeyup = selectKey2;
function selectKey2(e) {
if (defaultSearch.style.display == "none") {
let allSearchedLinks = document.querySelectorAll(
"#mainContainer2 .searchSources"
);
if (!(selectedIndex < 0 || selectedIndex > allSearchedLinks.length - 1)) {
var selected = allSearchedLinks[selectedIndex];
}
if (selectedIndex >= 0) {
selected.classList.add("selectedResult");
}
}
if (defaultSearch.style.display !== "none") {
let allSearchedLinks = document.querySelectorAll(
"#generatedList .searchSources"
);
var selected = allSearchedLinks[selectedIndex];
if (selectedIndex >= 0) {
selected.classList.add("selectedResult");
}
}
}
function selectKey(e) {
if (e.keyCode == 38 && defaultSearch.style.display == "none") {
// up Search Links
selectedIndex -= 1;
var selectedBeforeIndex = selectedIndex + 1;
let allSearchedLinks = document.querySelectorAll(
"#mainContainer2 .searchSources"
);
if (selectedIndex == -1) {
selectedIndex = allSearchedLinks.length - 1;
}
var selected = allSearchedLinks[selectedIndex];
var selectedBefore = allSearchedLinks[selectedBeforeIndex];
if (selectedBefore) {
selectedBefore.classList.remove("selectedResult");
}
if (selectedIndex >= 0) {
selected.classList.add("selectedResult");
}
} else if (
e.keyCode == 38 &&
defaultSearch.style.display !== "none" &&
localStorage.getItem("search-suggestions") === "yes" &&
searchInput.value.length !== 0
) {
// up AutoComplete
selectedIndex -= 1;
var selectedBeforeIndex = selectedIndex + 1;
let allSearchedLinks = document.querySelectorAll(
"#generatedList .searchSources"
);
if (selectedIndex == -1) {
selectedIndex = allSearchedLinks.length - 1;
}
var selected = allSearchedLinks[selectedIndex];
var selectedBefore = allSearchedLinks[selectedBeforeIndex];
if (selectedBefore) {
selectedBefore.classList.remove("selectedResult");
}
if (selectedIndex >= 0) {
selected.classList.add("selectedResult");
}
} else if (e.keyCode == 40 && defaultSearch.style.display == "none") {
// down SearchLinks
selectedIndex += 1;
var selectedBeforeIndex = selectedIndex - 1;
let allSearchedLinks = document.querySelectorAll(
"#mainContainer2 .searchSources"
);
if (selectedIndex == allSearchedLinks.length) {
selectedIndex = 0;
}
var selected = allSearchedLinks[selectedIndex];
var selectedBefore = allSearchedLinks[selectedBeforeIndex];
if (selectedBefore) {
selectedBefore.classList.remove("selectedResult");
}
if (selectedIndex >= 0) {
selected.classList.add("selectedResult");
}
} else if (
e.keyCode == 40 &&
defaultSearch.style.display !== "none" &&
localStorage.getItem("search-suggestions") === "yes" &&
searchInput.value.length !== 0
) {
// down AutoComplete
selectedIndex += 1;
var selectedBeforeIndex = selectedIndex - 1;
let allSearchedLinks = document.querySelectorAll(
"#generatedList .searchSources"
);
if (selectedIndex == allSearchedLinks.length) {
selectedIndex = 0;
}
var selected = allSearchedLinks[selectedIndex];
var selectedBefore = allSearchedLinks[selectedBeforeIndex];
if (selectedBefore) {
selectedBefore.classList.remove("selectedResult");
}
if (selectedIndex >= 0) {
selected.classList.add("selectedResult");
}
} else if (e.keyCode == 13 && defaultSearch.style.display == "none") {
// Enter SearchLinks
let allSearchedLinks = document.querySelectorAll(
"#mainContainer2 .searchSources"
);
var selected = allSearchedLinks[selectedIndex];
if (selectedIndex >= 0) {
selected.classList.add("selectedResult");
}
var url = selected.querySelector("a").href;
window.open(url, "_blank");
} else if (
e.keyCode == 39 &&
defaultSearch.style.display !== "none" &&
localStorage.getItem("search-suggestions") === "yes" &&
searchInput.value.length !== 0
) {
// Enter AutoComplete, Right Side
let allSearchedLinks = document.querySelectorAll(
"#generatedList .searchSources"
);
var selected = allSearchedLinks[selectedIndex];
if (selectedIndex >= 0) {
selected.classList.add("selectedResult");
}
searchInput.value = selected.innerText;
} else if (
e.keyCode == 38 ||
(e.keyCode == 40 && localStorage.getItem("search-suggestions") === "no")
) {
selectedIndex = -1;
}
}

1
weboasis/js/keyscroll.min.js vendored Normal file
View File

@ -0,0 +1 @@
function selectKey2(e){if("none"==defaultSearch.style.display){let e=document.querySelectorAll("#mainContainer2 .searchSources");if(!(selectedIndex<0||selectedIndex>e.length-1))var s=e[selectedIndex];selectedIndex>=0&&s.classList.add("selectedResult")}if("none"!==defaultSearch.style.display){s=document.querySelectorAll("#generatedList .searchSources")[selectedIndex];selectedIndex>=0&&s.classList.add("selectedResult")}}function selectKey(e){if(38==e.keyCode&&"none"==defaultSearch.style.display){selectedIndex-=1;var s=selectedIndex+1;let e=document.querySelectorAll("#mainContainer2 .searchSources");-1==selectedIndex&&(selectedIndex=e.length-1);var t=e[selectedIndex];(l=e[s])&&l.classList.remove("selectedResult"),selectedIndex>=0&&t.classList.add("selectedResult")}else if(38==e.keyCode&&"none"!==defaultSearch.style.display&&"yes"===localStorage.getItem("search-suggestions")&&0!==searchInput.value.length){selectedIndex-=1;s=selectedIndex+1;let e=document.querySelectorAll("#generatedList .searchSources");-1==selectedIndex&&(selectedIndex=e.length-1);t=e[selectedIndex];(l=e[s])&&l.classList.remove("selectedResult"),selectedIndex>=0&&t.classList.add("selectedResult")}else if(40==e.keyCode&&"none"==defaultSearch.style.display){selectedIndex+=1;s=selectedIndex-1;let e=document.querySelectorAll("#mainContainer2 .searchSources");selectedIndex==e.length&&(selectedIndex=0);t=e[selectedIndex];(l=e[s])&&l.classList.remove("selectedResult"),selectedIndex>=0&&t.classList.add("selectedResult")}else if(40==e.keyCode&&"none"!==defaultSearch.style.display&&"yes"===localStorage.getItem("search-suggestions")&&0!==searchInput.value.length){selectedIndex+=1;s=selectedIndex-1;let e=document.querySelectorAll("#generatedList .searchSources");selectedIndex==e.length&&(selectedIndex=0);var l;t=e[selectedIndex];(l=e[s])&&l.classList.remove("selectedResult"),selectedIndex>=0&&t.classList.add("selectedResult")}else if(13==e.keyCode&&"none"==defaultSearch.style.display){t=document.querySelectorAll("#mainContainer2 .searchSources")[selectedIndex];selectedIndex>=0&&t.classList.add("selectedResult");var d=t.querySelector("a").href;window.open(d,"_blank")}else if(39==e.keyCode&&"none"!==defaultSearch.style.display&&"yes"===localStorage.getItem("search-suggestions")&&0!==searchInput.value.length){t=document.querySelectorAll("#generatedList .searchSources")[selectedIndex];selectedIndex>=0&&t.classList.add("selectedResult"),searchInput.value=t.innerText}else(38==e.keyCode||40==e.keyCode&&"no"===localStorage.getItem("search-suggestions"))&&(selectedIndex=-1)}document.onkeydown=selectKey,document.onkeyup=selectKey2;

File diff suppressed because it is too large Load Diff

1
weboasis/js/perfect-scrollbar.min.js vendored Normal file

File diff suppressed because one or more lines are too long

1260
weboasis/js/platform.js Normal file

File diff suppressed because it is too large Load Diff

1
weboasis/js/platform.min.js vendored Normal file

File diff suppressed because one or more lines are too long

2409
weboasis/js/script.js Normal file

File diff suppressed because it is too large Load Diff

2
weboasis/js/script.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,17 @@
//Generates all weboasis links to be searched in an array for the first Time
let allLinkSources = [];
for (const property in defaultLinkMenu) {
for (j = 0; j < defaultLinkMenu[property].length; j++) {
if (defaultLinkMenu[property][j][2] != "-HEAD-")
allLinkSources.push(defaultLinkMenu[property][j]);
}
}
for (j = 0; j < hiddenLinksOne.length; j++) {
hiddenLinksOne[j][2] = "";
allLinkSources.push(hiddenLinksOne[j]);
}
for (j = 0; j < hiddenLinksTwo.length; j++) {
hiddenLinksTwo[j][2] = "";
allLinkSources.push(hiddenLinksTwo[j]);
}

1
weboasis/js/searchlinks.min.js vendored Normal file
View File

@ -0,0 +1 @@
let allLinkSources=[];for(const a in defaultLinkMenu)for(j=0;j<defaultLinkMenu[a].length;j++)"-HEAD-"!=defaultLinkMenu[a][j][2]&&allLinkSources.push(defaultLinkMenu[a][j]);for(j=0;j<hiddenLinksOne.length;j++)hiddenLinksOne[j][2]="",allLinkSources.push(hiddenLinksOne[j]);for(j=0;j<hiddenLinksTwo.length;j++)hiddenLinksTwo[j][2]="",allLinkSources.push(hiddenLinksTwo[j]);

1
weboasis/js/sortable.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,26 @@
//To build Suggestions List from duckduckgo autocomplete API
const corsUrl = 'https://cors.weboasis.workers.dev/corsproxy/?apiurl=';
const selectedUrl = 'https://duckduckgo.com/ac/?q=';
const searchTerm = searchInput.placeholder;
let AutoComp = [];
async function fetchAutoComp(searchTerm) {
AutoComp = [];
let res = await fetch(corsUrl + selectedUrl + searchTerm);
data = await res.json();
await data.map((item) => {
AutoComp.push(item.phrase);
});
selectedIndex = -1; //Resetting index for every fetching of new suggestions list
buildHelp();
}
function handleSearchReset2(e) {
//On clicking X to clear the search bar this resets to set engine view
buildHelp();
}
//Refer to handleQuery() and buildHelp() for further details on building and searching the autocomplete list

1
weboasis/js/suggestions.min.js vendored Normal file
View File

@ -0,0 +1 @@
const corsUrl="https://cors.weboasis.workers.dev/corsproxy/?apiurl=",selectedUrl="https://duckduckgo.com/ac/?q=",searchTerm=searchInput.placeholder;let AutoComp=[];async function fetchAutoComp(a){AutoComp=[];let b=await fetch(corsUrl+selectedUrl+a);data=await b.json(),await data.map(a=>{AutoComp.push(a.phrase)}),selectedIndex=-1,buildHelp()}function handleSearchReset2(){buildHelp()}