Skip to content

Commit

Permalink
Archive 1.3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
LuanderFarias authored Apr 22, 2023
1 parent 48b4109 commit 5923742
Show file tree
Hide file tree
Showing 10 changed files with 588 additions and 0 deletions.
21 changes: 21 additions & 0 deletions archive/1.3.6/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 ArcFox

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
61 changes: 61 additions & 0 deletions archive/1.3.6/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<p align="center">
<a href="#">
</a>
<p align="center">
<img width="150" height="150" src="/logo.png" alt="Logo">
</p>
<h1 align="center"><b>ArcFox</b></h1>
<p align="center">
Make firefox flow like arc
<br />
<a href="https://github.com/use-arcfox/arcfox/releases"><strong>Install »</strong></a>
<br />
</p>
</p>

# What is ArcFox?
<img src="screenshot.png"/>

ArcFox is a pack of firefox improvements that brings the appearance and some of the features of arc browser to firefox. Recently, The Browser Company © (the developers of arc browser) announced a windows version, so this project almost lost the reason to exist. But there still a linux version to be made and some people just like firefox and don't want to change.

> NOTE: Arcfox is a side-project under development.
I really recomend you to give a try on arc browser if you can. But we gonna do our best to make firefox nice as arc.

# Installation
To use ArcFox you need to install arcfox-core and arcfox-theme (in this specific order). To proceed with the instalation, use the tutorial below. Using arcfox-core and arcfox-theme together is the best way to use ArcFox!

### ArcFox-core Installation
To install arcfox-theme you need to download it on your firefox, we recommend you to download from the official addon store. To do that please follow this steps:

- Download arcfox-core from this [link](https://addons.mozilla.org/en-US/firefox/addon/arcfox/)
- It should start to work just fine :D

### ArcFox-Theme Installation
To install arcfox-theme you need to open your firefox configurations and turn style modification on. To do that please follow this steps:

- Open <a href="about:config">"about:config"</a> on firefox.
- On the search bar, search for "toolkit.legacyUserProfileCustomizations.stylesheets" and set the value to "true".
- Open <a href="about:support">"about:support"</a> and click on the “Open Folder” button on the right of "Profile Folder" to open it.
- When the folder opens, search for a folder called "chrome", if you don't find it create one.
- Inside the "chrome" folder, drop the "userChrome.css" that you find on the <a href="https://github.com/use-arcfox/arcfox/releases">releases.</a>
- Restart firefox.

## Known Problems
Thanks to the beautiful beta-testers, arcfox is improving everyday! this is some of the things we are aware of and working hard to solve! Some of they are urgent and are main things to use it and we know that. You can know how the project is going on our discord! (link coming soon)

### The sidebar tabs names are not updating.
- I'm trying to solve it (https://github.com/use-arcfox/ar...)
### When sidebar close it never open again
- I'm developing a shortcut for open it! (https://github.com/use-arcfox/ar...)
### It crashes using linux on low-end computers
- I don't know why it's happening, and at the moment i can't analyze it. So this problem gonna persist for some time, sorry :(

## Help Wanted!!
I'm having a lot of problems on updating the tab names without making the active tab lossing it's css. If you are better with js than me or know how to solve it, please be free to do a pull-request! I'm gonna be so gratefull. Also, if you have any ideas that can improve arcfox pls open a issue with your idea :)

# Support
If you have any problems you can open a issue on this repository or contact the developer [here](https://discord.gg/VRBVsjJ7NQ)

# License
Arcfox is distributed under [MIT License](/LICENSE).
Binary file added archive/1.3.6/core/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions archive/1.3.6/core/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"manifest_version": 2,
"name": "ArcFox",
"version": "1.3.6",
"description": "Make firefox flow like arc.",
"icons": {
"16": "icon.png",
"48": "icon.png",
"98": "icon.png"
},
"permissions": [
"activeTab",
"tabs"
],
"background": {
"scripts": ["src/sidebar.js"]
},
"browser_action": {
"default_icon": {
"48": "icon.png"
}
},
"sidebar_action": {
"default_panel": "src/sidebar.html",
"default_icon": {
"48": "icon.png"
}
}
}
31 changes: 31 additions & 0 deletions archive/1.3.6/core/src/sidebar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>arcfox-core</title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css">
</head>
<body>
<div id="sidebar">
<div id="sidebar-header">
<div id="page-control">
<div id="action-buttons">
<button id="close"><i class="fa-solid fa-circle-xmark"></i></button>
<button id="size"><i class="fa-solid fa-circle-stop"></i></button>
<button id="hide"><i class="fa-solid fa-circle-minus"></i></button>
</div>
<button id="back"><i class="fa-solid fa-arrow-left"></i></button>
<button id="front"><i class="fa-solid fa-arrow-right"></i></button>
<button id="refresh"><i class="fa-solid fa-rotate-right"></i></button>
</div>
<input id="search-input" type="text" placeholder="Search...">
</div>
<div id="sidebar-content">
<button id="new-tab-button">+ New Tab</button>
<ul id="tab-list"></ul>
</div>
</div>
<script src="sidebar.js"></script>
</body>
</html>
246 changes: 246 additions & 0 deletions archive/1.3.6/core/src/sidebar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,246 @@
// Define variables
let tabs = [];
let activeTab = null;
const searchInput = document.getElementById("search-input");
const tabList = document.getElementById("tab-list");
const newTabButton = document.getElementById("new-tab-button");
const settingsButton = document.getElementById("settings");

// Find the list of TLDs from IANA database
let tlds = [];
fetch("https://data.iana.org/TLD/tlds-alpha-by-domain.txt")
.then((response) => response.text())
.then((text) => {
let rawTlds = text.split('\n');
rawTlds.forEach((tld) => {
if (tld.startsWith('#') || tld === '') {
return;
}

tlds.push('.' + tld.toLowerCase());
});
});

// Add event listeners
searchInput.addEventListener("keydown", function(event) {
if (event.keyCode === 13) { // Enter key
searchBar();
}
});

newTabButton.addEventListener("click", function() {
browser.tabs.create({});
});

// Browser-control
function handleBrowserControl(id) {
browser.tabs.query({active: true, currentWindow: true}).then((tabs) => {
let activeTab = tabs[0];
if (id == 'back') {
browser.tabs.goBack(activeTab.id);
} else if (id == 'front') {
browser.tabs.goForward(activeTab.id);
} else if (id == 'refresh') {
browser.tabs.reload(activeTab.id);
}
});

browser.windows.getCurrent({populate: true}).then((window) => {
if (id == 'close') {
browser.windows.remove(window.id);
} else if (id == 'size') {
if (window.state === 'maximized') {
browser.windows.update(window.id, { state: 'normal' });
} else {
browser.windows.update(window.id, { state: 'maximized' });
}
} else if (id == 'hide') {
browser.windows.update(window.id, {state: "minimized"});
}
});
}

document.getElementById("back").addEventListener("click", function() {
handleBrowserControl("back");
});

document.getElementById("front").addEventListener("click", function() {
handleBrowserControl("front");
});

document.getElementById("refresh").addEventListener("click", function() {
handleBrowserControl("refresh");
});

document.getElementById("close").addEventListener("click", function() {
handleBrowserControl("close");
});

document.getElementById("size").addEventListener("click", function() {
handleBrowserControl("size");
});

document.getElementById("hide").addEventListener("click", function() {
handleBrowserControl("hide");
});

document.getElementById("back").addEventListener("click", function() {
handleBrowserControl("back");
});

document.getElementById("front").addEventListener("click", function() {
handleBrowserControl("front");
});

document.getElementById("refresh").addEventListener("click", function() {
handleBrowserControl("refresh");
});

document.addEventListener("click", (event) => {
if (event.target.classList.contains("browser-control-button")) {
handleButtonClick(event);
}
});

// Search
browser.tabs.onActivated.addListener(async () => {
const tab = await browser.tabs.query({ active: true, currentWindow: true });
const currentUrl = tab[0].url;
searchInput.placeholder = currentUrl;
});

function updateSearchBar() {
browser.tabs.query({active: true, currentWindow: true}).then((tabs) => {
const currentUrl = tabs[0].url;
searchInput.placeholder = currentUrl;
});
}

setInterval(updateSearchBar, 50);

browser.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
if (changeInfo.url) {
const newTitle = performSearch(changeInfo.url)
browser.tabs.executeScript(tabId, { code: `document.title = '${newTitle}';` });
renderTabs(tabs)
}
});

// Function to perform the search and return a new tab title
function performSearch(url) {
// Perform your search logic here...
// For example, you could extract keywords from the URL and use them to generate a new title
const keywords = extractKeywords(url);
const newTitle = `Search results for ${keywords}`;

return newTitle;
}

// Function to extract keywords from a URL
function extractKeywords(url) {
// Perform your keyword extraction logic here...
// For example, you could extract the query parameter from a search engine URL
const queryParam = new URLSearchParams(new URL(url).search).get('q');

return queryParam;
}

function searchBar() {
const query = searchInput.value.trim().toLowerCase();
if (query === "") {
return;
}
browser.tabs.query({active: true, currentWindow: true}).then((tabs) => {
const currentTab = tabs[0];
let url;
if (query.startsWith("http://") || query.startsWith("https://")) {
url = query;
} else if (tlds.some((tld) => query.endsWith(tld))) {
url = "https://" + query;
} else {
url = "https://www.google.com/search?q=" + encodeURIComponent(query);
}
browser.tabs.update(currentTab.id, {url: url});
// Clear the search input
searchInput.value = "";
// Update the search bar with the current URL
updateSearchBar();
});
// When clicked, clear the search input
searchInput.onclick = function() {
searchInput.placeholder = "";
}
}

// Render the tabs on sidebar
function renderTabs(tabsToRender) {
// Get the current tabs in the window
browser.tabs.query({ currentWindow: true })
.then((tabs) => {
// Build a map of tab ID -> tab title for fast lookup
const tabTitleMap = {};
for (const tab of tabs) {
tabTitleMap[tab.id] = tab.title;
}

// Render the sidebar tabs
tabList.innerHTML = "";
for (let i = 0; i < tabsToRender.length; i++) {
const tab = tabsToRender[i];
const tabItem = document.createElement("li");
tabItem.textContent = tabTitleMap[tab.id];
tabItem.classList.add("tab-item");
if (tab === activeTab) {
tabItem.classList.add("active");
}
const closeButton = document.createElement("button");
closeButton.textContent = "x";
closeButton.classList.add("close-tab-button");
closeButton.addEventListener("click", function(event) {
event.stopPropagation();
closeTab(tab);
});
tabItem.appendChild(closeButton);
tabItem.addEventListener("click", function() {
activateTab(tab);
});
tabList.appendChild(tabItem);
}
});
}

function activateTab(tab) {
activeTab = tab;
browser.tabs.update(tab.id, {active: true});
renderTabs(tabs);
}

function closeTab(tab) {
browser.tabs.remove(tab.id);
tabs = tabs.filter(function(t) { return t.id !== tab.id; });
renderTabs(tabs);
}

// Get tabs on extension startup
browser.tabs.query({}, function(results) {
tabs = results;
renderTabs(tabs);
});

// Listen for tab changes
browser.tabs.onCreated.addListener(function(tab) {
tabs.push(tab);
renderTabs(tabs);
});
browser.tabs.onRemoved.addListener(function(tabId) {
tabs = tabs.filter(function(tab) {
return tab.id !== tabId;
});
renderTabs(tabs);
});
browser.tabs.onActivated.addListener(function(activeInfo) {
activeTab = tabs.find(function(tab) {
return tab.id === activeInfo.tabId;
});
renderTabs(tabs);
});
Loading

0 comments on commit 5923742

Please sign in to comment.