Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix AB Title & Favicon #85

Merged
merged 1 commit into from
Feb 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 38 additions & 37 deletions public/resources/nebulamain.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,31 @@ document.addEventListener("visibilitychange", handleTabLeave)
}
});


let tryAbFavi = localStorage.getItem("ABfaviconURL");
let ABFavicon = "";
if (tryAbFavi === null) {
console.warn("ABfaviconURL is null, Defaulting");
ABFavicon = "";
} else if (tryAbFavi == "") {
console.warn("ABfaviconURL is empty, Defaulting");
ABFavicon = "";
} else {
ABFavicon = tryAbFavi;
}

let tryAbTitle = localStorage.getItem("ABtitle");
let ABTitle = "";
if (tryAbTitle === null) {
console.warn("ABtitle is null, Defaulting");
ABTitle = "";
} else if (tryAbTitle == "") {
console.warn("ABtitle is empty, Defaulting");
ABTitle = "";
} else {
ABTitle = tryAbTitle;
}

// Stealth engine, a dependency for everything above.
function stealthEngine(encodedURL) {
// Remember that the EncodedURL argument must be pre-encoded, or encoded before the function is called.
Expand Down Expand Up @@ -281,9 +306,8 @@ document.addEventListener("visibilitychange", handleTabLeave)
doc.head.appendChild(arcSrc);
const link = location.href;
img.rel = "icon";
img.href =
"https://ssl.gstatic.com/images/branding/product/1x/drive_2020q4_32dp.png";
doc.title = getRandomName();
img.href = ABFavicon || "https://ssl.gstatic.com/images/branding/product/1x/drive_2020q4_32dp.png";
doc.title = ABTitle || "Nebula";

var currentLink = link.slice(0, link.length - 1);

Expand All @@ -295,6 +319,7 @@ document.addEventListener("visibilitychange", handleTabLeave)
style.width = style.height = "100%";

doc.body.appendChild(iframe);
doc.head.appendChild(img);
}
}
}, 1500);
Expand Down Expand Up @@ -672,30 +697,6 @@ function handleTabLeave() {
// Create and Add the event listener
document.addEventListener("visibilitychange", handleTabLeave);

let tryAbFavi = localStorage.getItem('ABfaviconURL');
let ABFavicon = "";
if (tryAbFavi === null) {
console.warn("ABfaviconURL is null, Defaulting");
ABFavicon = "";
} else if (tryAbFavi == "") {
console.warn("ABfaviconURL is empty, Defaulting");
ABFavicon = "";
} else {
ABFavicon = tryAbFavi;
}

let tryAbTitle = localStorage.getItem('ABtitle');
let ABTitle = "";
if (tryAbTitle === null) {
console.warn("ABtitle is null, Defaulting");
ABTitle = "";
} else if (tryAbTitle == "") {
console.warn("ABtitle is empty, Defaulting");
ABTitle = "";
} else {
ABTitle = tryAbTitle;
}

const stealthStored = localStorage.getItem('nogg')
function link (_link) {
if (stealthStored == 'on') {
Expand All @@ -711,15 +712,16 @@ function link (_link) {
if (!popup || popup.closed) {
alert("Popups are disabled!");
} else {
const doc = popup.document
const iframe = doc.createElement('iframe')
const style = iframe.style
const img = doc.createElement('link')
const link = location.href
img.rel = 'icon'
img.href = ABFavicon
doc.title = ABTitle
var currentLink = _link.slice(0, _link.length - 1)
const doc = popup.document;
const iframe = doc.createElement("iframe");
const style = iframe.style;
const img = doc.createElement("link");
const link = location.href;
img.rel = "icon";
img.href =
"https://ssl.gstatic.com/images/branding/product/1x/drive_2020q4_32dp.png";
doc.title = getRandomName();
var currentLink = _link.slice(0, _link.length - 1);
iframe.src =
location.origin +
"/service/go/" +
Expand All @@ -729,7 +731,6 @@ function link (_link) {
style.border = style.outline = 'none'
style.width = style.height = '100%'
doc.body.appendChild(iframe)
doc.head.appendChild(img)
}
}
}, 0200);
Expand Down