CARVIEW |
Select Language
HTTP/2 302
date: Mon, 28 Jul 2025 03:03:51 GMT
content-type: text/html; charset=utf-8
content-length: 0
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
access-control-allow-origin:
location: https://raw.githubusercontent.com/Endle/fireSeqSearch/master/fireSeqSearch_addon/monkeyscript.user.js
cache-control: no-cache
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
x-github-request-id: 8CFC:187A42:1167CF:1B2D90:6886E897
HTTP/2 200
cache-control: max-age=300
content-security-policy: default-src 'none'; style-src 'unsafe-inline'; sandbox
content-type: text/plain; charset=utf-8
etag: W/"57d2cbff71fdf72f73ae422cfa279276dd3303122e5da0cab944f8402494d644"
strict-transport-security: max-age=31536000
x-content-type-options: nosniff
x-frame-options: deny
x-xss-protection: 1; mode=block
x-github-request-id: 9355:2302BE:9E643:1E1F22:6886E895
content-encoding: gzip
accept-ranges: bytes
date: Mon, 28 Jul 2025 03:03:51 GMT
via: 1.1 varnish
x-served-by: cache-bom-vanm7210091-BOM
x-cache: MISS
x-cache-hits: 0
x-timer: S1753671831.399177,VS0,VE295
vary: Authorization,Accept-Encoding
access-control-allow-origin: *
cross-origin-resource-policy: cross-origin
x-fastly-request-id: 7cdcbae8116fdd63a0ea568a98fdf83d70813fc2
expires: Mon, 28 Jul 2025 03:08:51 GMT
source-age: 0
content-length: 3608
// ==UserScript==
// @name fireSeqSearchScript
// @namespace https://github.com/Endle/fireSeqSearch
// @version 0.0.18
// @description Everytime you use the search engine, FireSeqSearch searches your personal logseq notes.
// @author Zhenbo Li
// @match https://www.google.com/search*
// @match https://duckduckgo.com/?q=*
// @icon https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
// @grant GM_xmlhttpRequest
// ==/UserScript==
// MIT License
// Copyright (c) 2021-2022 Zhenbo Li
/*global GM*/
const fireSeqSearchDomId = "fireSeqSearchDom";
const fireSeqSearchScriptCSS = `
#fireSeqSearchDom {
margin: 1em 1em 1em 1em;
color: var(--theme-col-txt-snippet); /* duckduck color*/
}
#fireSeqSearchDom.experimentalLayout {
position: fixed;
top: 140px;
right: 12px;
width: 200px;
background-color: hsla(200, 40%, 96%, .8);
font-size: 12px;
border-radius: 6px;
z-index: 99999;
}
.fireSeqSearchTitleBar {
margin: 0.5em 0;
}
.hideSummary {
margin: 0 1em;
}
#fireSeqSearchDom ul {
margin: 0;
padding: 0.6em;
border: 1px dotted gray;
list-style: none;
line-height: 1.5em;
}
#fireSeqSearchDom ul li {
font-size: 15px;
}
#fireSeqSearchDom ul li + li {
margin-top: 0.4em;
}
#fireSeqSearchDom ul li a {
text-decoration: underline;
text-decoration-style: dotted;
text-decoration-thickness: 1px;
text-underline-offset: 2px;
}
#fireSeqSearchDom ul li::before {
content: ' ';
display: inline-block;
margin-right: 0.4em;
line-height: 1em;
width: 1em;
height: 1em;
transform: translateY(3px);
border-radius: 3px;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAe1BMVEUAKzaFyMiKz88AJjIAKjaHy8sAHiuM0tIAGSgAGykAIC0AESIAFyYAIzAAHCoAFCQAEiBvq6wtVlw0XmQIMDtooqRAbnNdk5VPgYU4Y2lyr7B4trdHc3Z/wcEAHSctUFVimZoaP0hShIcoRksTLjQADBkAABNdjo8AAAzWDdSWAAABBklEQVQ4jc1S7XKDIBCEQ0DEL2oJVqOmiUl8/yfs6XTaePgA2T8w7N5xu3OMvSOESI5ejSnWM1Hqo/lUEa8a708WLyYAgG4zWv+lpQRXsdIDR2hLBGkn8RnazK4nB2+IIO9XQvZ5dsYf4FlHI4StcqiYGqeppvU4u+CogIvaXB56n53WrmBJYSprq5S6wB71ONZM5Cc/AAyuFXEUGF/aDLANg55b6hRRnjX/A6ZCExfTC4+KkBJB6uSrgOtv0iKHHc/hSr3ovUCGcs9bSQS0g7mQGSaSaTLvBNJFSRQ3+JfIfow3L5s7XJyVBR3uR5uZPG7PnsPQXedoJX4hzGNZlnt5VP7G+AHcFwwZX2F8QwAAAABJRU5ErkJggg==);
background-repeat: no-repeat;
background-size: 16px;
}
.fireSeqSearchHitSummary {
font-size: 0.9em
}
.fireSeqSearchHitSummary::before {
content: "\\00A0::\\00A0";
}
.fireSeqSearchHighlight {
padding: 0 4px;
color: black !important;
background-color: gold;
border-radius: 3px;
}
`;
function consoleLogForDebug(message) {
console.log(message); //skipcq: JS-0002
// Comment it in master branch, to make deepSource happy
}
function addGlobalStyle(css) {
const head = document.getElementsByTagName("head")[0];
if (!head) { return; }
const style = document.createElement("style");
style.id = "fireSeqSearchScriptCSS";
// style.type = "text/css";
style.innerHTML = css;
head.appendChild(style);
}
function createElementWithText(type, text) {
const element = document.createElement(type);
element.textContent = text;
return element;
}
function createHrefToLogseq(record, serverInfo) {
const name = serverInfo.notebook_name;
const title = record.title;
const prettyTitle = title.replaceAll("%2F", "/");
const target = `logseq://graph/${name}?page=${title}`;
const logseqPageLink = document.createElement('a');
const text = document.createTextNode(prettyTitle);
logseqPageLink.appendChild(text);
logseqPageLink.title = prettyTitle;
logseqPageLink.href = target;
consoleLogForDebug(logseqPageLink);
return logseqPageLink;
}
function checkUserOptions() {
const options = {
debugStr: "tampermonkey",
ExperimentalLayout: false,
ShowHighlight: true,
ShowScore: false
}
consoleLogForDebug(options);
return options;
}
async function appendResultToSearchResult(fetchResultArray, container) {
const serverInfo = fetchResultArray[0];
const rawSearchResult = fetchResultArray[1];
const firefoxExtensionUserOption = await checkUserOptions();
consoleLogForDebug(firefoxExtensionUserOption);
function createTitleBarDom(count) {
const titleBar = createElementWithText("div");
titleBar.classList.add('fireSeqSearchTitleBar');
const hitCount = `We found ${count.toString()} results in your logseq notebook`;
titleBar.insertAdjacentHTML("afterbegin",hitCount);
const btn = document.createElement("button");
btn.classList.add("hideSummary");
const text = document.createTextNode("Hide Summary (Tmp)");
btn.appendChild(text);
btn.onclick = function () {
// alert("Button is clicked");
for (const el of document.querySelectorAll('.fireSeqSearchHitSummary')) {
// el.style.visibility = 'hidden';
el.remove();
}
};
titleBar.appendChild(btn);
return titleBar;
}
function createFireSeqDom() {
const div = document.createElement("div");
// div.appendChild(createElementWithText("p", "fireSeqSearch launched!"));
div.setAttribute("id", fireSeqSearchDomId);
return div;
}
const dom = createFireSeqDom();
dom.appendChild(createTitleBarDom(rawSearchResult.length));
consoleLogForDebug(dom);
const hitList = document.createElement("ul");
consoleLogForDebug(rawSearchResult);
for (const rawRecord of rawSearchResult) {
// const e = document.createTextNode(record);
consoleLogForDebug(rawRecord);
const record = JSON.parse(rawRecord);
consoleLogForDebug(typeof record);
const li = createElementWithText("li", "");
if (firefoxExtensionUserOption.ShowScore) {
const score = createElementWithText("span", String(record.score));
li.appendChild(score);
}
const href = createHrefToLogseq(record, serverInfo);
li.appendChild(href);
li.append(' ')
if (firefoxExtensionUserOption.ShowHighlight) {
const summary = createElementWithText("span", "");
summary.innerHTML = record.summary;
summary.classList.add('fireSeqSearchHitSummary');
li.appendChild(summary);
}
// let e = wrapRawRecordIntoElement(record, serverInfo);
// e.style.
hitList.appendChild(li);
// consoleLogForDebug("Added an element to the list");
}
dom.appendChild(hitList);
if (firefoxExtensionUserOption.ExperimentalLayout) {
// Inspired by https://twitter.com/rockucn
// https://greasyfork.org/en/scripts/446492-%E6%90%9C%E7%B4%A2%E5%BC%95%E6%93%8E%E5%88%87%E6%8D%A2%E5%99%A8-search-engine-switcher/code
dom.classList.add("experimentalLayout");
}
let contextId = "rcnt";
if (window.location.href.includes("duckduckgo.com")) {
contextId = "web_content_wrapper";
}
document.getElementById(contextId).insertAdjacentElement("beforebegin", dom);
}
function getSearchParameterFromCurrentPage() {
let searchParam = "";
function getSearchParameterOfSearx() {
const inputBox = document.getElementById("q");
return inputBox.value;
}
if (window.location.toString().includes("searx")) {
searchParam = getSearchParameterOfSearx();
} else {
// https://stackoverflow.com/a/901144/1166518
const urlParams = new URLSearchParams(window.location.search);
// consoleLogForDebug(urlParams);
searchParam = urlParams.get('q');
}
consoleLogForDebug(`Got search param: ${searchParam}`);
return searchParam;
}
(function() {
const searchParameter = getSearchParameterFromCurrentPage();
consoleLogForDebug(searchParameter);
addGlobalStyle(fireSeqSearchScriptCSS);
GM.xmlHttpRequest({
method: "GET",
url: "https://127.0.0.1:3030/server_info",
onload(infoResponse) {
const server_info = JSON.parse(infoResponse.responseText);
consoleLogForDebug(server_info);
GM.xmlHttpRequest({
method: "GET",
url: `https://127.0.0.1:3030/query/${searchParameter}`,
onload(queryResponse) {
const hit = JSON.parse(queryResponse.responseText);
// consoleLogForDebug(hit);
consoleLogForDebug(typeof hit);
appendResultToSearchResult([server_info, hit])
.then((_e) => {
const highlightedItems = document.querySelectorAll('.fireSeqSearchHighlight');
consoleLogForDebug(highlightedItems);
})
.catch(error => {
consoleLogForDebug(error);
});
}
});
}
});
/*
//https://gomakethings.com/waiting-for-multiple-all-api-responses-to-complete-with-the-vanilla-js-promise.all-method/
Promise.all([
fetch("https://127.0.0.1:3030/server_info"),
fetch(`https://127.0.0.1:3030/query/${searchParameter}`)
]).then(function (responses) {
return Promise.all(responses.map(function (response) {return response.json();}));
}).then(function (data) {
consoleLogForDebug(data);
return appendResultToSearchResult(data);
}).then((_e) => {
const highlightedItems = document.querySelectorAll('.fireSeqSearchHighlight');
consoleLogForDebug(highlightedItems);
highlightedItems.forEach((element) => {
element.style.color = 'red';
});
}).catch(function (error) {
consoleLogForDebug(error);
});
*/
})();