Skip to content

Add files via upload #216

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions submissions/ToggledDevPortal/DevPortal-main/auth.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const user = await getUserInfo()
40 changes: 40 additions & 0 deletions submissions/ToggledDevPortal/DevPortal-main/background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// background.js

// Listen for messages from the content script (content.js)
chrome.runtime.onMessage.addListener(async function (message, sender, sendResponse) {
if (message.redirect) {
// Redirect the user to your extension's page
chrome.tabs.create({ url: 'integrations.html?ghun=' + message.redirect }, function (tab) {
// Send a response back to the content script to indicate successful redirection
sendResponse({ success: true });
});
}

if (message.replit) {

// Redirect the user to your extension's page
chrome.tabs.create({ url: 'integrations.html?repl=' + message.replit }, function (tab) {
// Send a response back to the content script to indicate successful redirection
sendResponse({ success: true });
});
}

if (message.openai) {
// Redirect the user to your extension's page
chrome.tabs.create({ url: 'productivity.html?openai=' + message.openai }, function (tab) {
// Send a response back to the content script to indicate successful redirection
sendResponse({ success: true });
});
}

if (message.sub1) {
// Redirect the user to your extension's page
chrome.tabs.create({ url: 'purchased.html?purchased=' + message.sub1 }, function (tab) {
// Send a response back to the content script to indicate successful redirection
sendResponse({ success: true });
});
}
// To ensure sendResponse is called asynchronously
return true;
});

65 changes: 65 additions & 0 deletions submissions/ToggledDevPortal/DevPortal-main/browser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// Function to fetch the title and favicon of a website
async function fetchTitleAndFavicon(url) {
try {
const response = await fetch('http://zymono.com/gettitleandfavicon', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ url }),
});

const data = await response.json();
return data;
} catch (error) {
console.error('Error fetching data:', error);
return null;
}
}

document.getElementById('google').addEventListener('click', function() {
set('https://www.google.com/search?q=')
})
document.getElementById('ddg').addEventListener('click', function() {
set('https://duckduckgo.com/&q=')
})
document.getElementById('bing').addEventListener('click', function() {
set('https://www.bing.com/search?q=')
})

document.getElementById('ai').addEventListener('click', function() {
set('https://www.perplexity.ai/search?q=')
})
document.getElementById('custom').addEventListener('click', function() {
const prompt = window.prompt('Enter a search engine url. (Include /search?q=)')

if (prompt) {
set(prompt)
window.location = 'browsers.html'
}
})

function set(url) {
chrome.storage.sync.set({ searchEngine: url }, () => {
// Update the search form on the homepage
// const searchForm = chrome.extension.getViews({ type: "tab" })[0]?.document.getElementById('searchForm');
// if (searchForm) {
// searchForm.action = searchEngineURL;
// }
alert('Settings saved successfully!');
});
}

chrome.storage.sync.get(['searchEngine'], result => {
const targetURL = result.searchEngine;
fetchTitleAndFavicon(targetURL)
.then(data => {
if (data) {
if (!['google', 'duck', 'bing'].some(substring => targetURL.includes(substring))) {
document.getElementById('ct').innerText = data.title;
}
} else {
console.log('Failed to fetch data.');
}
});
});
Loading