Skip to content

Commit

Permalink
Bug Fix!
Browse files Browse the repository at this point in the history
  • Loading branch information
LuanderFarias authored Mar 24, 2023
1 parent 8a90302 commit ea4e2cb
Show file tree
Hide file tree
Showing 12 changed files with 582 additions and 22 deletions.
21 changes: 21 additions & 0 deletions archive/1.2.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.
48 changes: 48 additions & 0 deletions archive/1.2.6/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<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.

# 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.2.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.2.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.2.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.2.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>
219 changes: 219 additions & 0 deletions archive/1.2.6/core/src/sidebar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
// 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");

// 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();
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 (query.endsWith(".com")) {
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) {
tabList.innerHTML = "";
for (let i = 0; i < tabsToRender.length; i++) {
const tab = tabsToRender[i];
const tabItem = document.createElement("li");
tabItem.textContent = tab.title;
tabItem.classList.add("tab-item");
if (tab === activeTab) {
tabItem.classList.add("active");
}
const closeButton = document.createElement("button");
closeButton.innerHTML = "x";
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 ea4e2cb

Please sign in to comment.