Skip to content

Commit

Permalink
BIG commit! Added a lot of OpenUX's functionality! If anything's brok…
Browse files Browse the repository at this point in the history
…en, submit an issue.
  • Loading branch information
redstone-dev authored Nov 5, 2022
1 parent 03272fc commit 8c7f869
Show file tree
Hide file tree
Showing 20 changed files with 217 additions and 59 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ body:
id: environment
attributes:
label: Your environment (if applicable)
description: Run `npx envinfo --system --duplicates --npmPackages` in the Catalyst repo (only if it relates to internal files or OS)
description: Run `npx envinfo --system --duplicates --npmPackages` in the Platinum repo (only if it relates to internal files or OS)
validations:
required: false
- type: input
id: version
attributes:
label: Version
description: What version of Catalyst are you running?
description: What version of Platinum are you running?
validations:
required: true
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# taken from https://dev.to/abulka/comment/1dh3k thanks!
name: Release Catalyst
name: Release Platinum
on:
push:
tags:
Expand Down
2 changes: 1 addition & 1 deletion .pnpm-debug.log
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"2 error pnpm": {
"code": "ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL",
"prefix": "/home/jmwills/Desktop/Catalyst",
"prefix": "/home/jmwills/Desktop/Platinum",
"err": {
"name": "pnpm",
"message": "not found: isntall",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![image](https://img.shields.io/github/issues/redstone-scratch/Platinum?color=%230f172a&style=for-the-badge) ![image](https://img.shields.io/github/forks/redstone-scratch/Platinum?color=%230f172a&style=for-the-badge) ![image](https://img.shields.io/github/stars/redstone-scratch/Platinum?color=%230f172a&style=for-the-badge) ![image](https://img.shields.io/github/license/redstone-scratch/Platinum?color=%230f172a&style=for-the-badge)
# Platinum
An amazing and elegant ElectronJS web browser. A fork of the [Catalyst](https://github.com/JaydenDev/Catalyst) browser.
An amazing and elegant ElectronJS web browser. A fork of the [Platinum](https://github.com/JaydenDev/Platinum) browser.

![image](https://user-images.githubusercontent.com/92550746/194955977-c37b21f6-5ec3-4d1a-939f-c27b23cd9a9a.png)

Expand Down
Binary file modified assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icon1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion contributing.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Contributing
While contributing with PRs and Commits, please make sure to follow the following Catalyst Project contribution guidelines
While contributing with PRs and Commits, please make sure to follow the following Platinum Project contribution guidelines
## Rules
1. Don't make fights in PRs.
2. Make sure to be ready to actively answer questions about your PRs.
Expand Down
10 changes: 10 additions & 0 deletions lib/browser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class Platinum {
static addBookmark(name, url) {

}
}

let browser = {};

export default browser;
export default Platinum;
14 changes: 0 additions & 14 deletions lib/dynamicUX/api/hooks.js

This file was deleted.

8 changes: 4 additions & 4 deletions src/functions.js → lib/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,19 @@ const getPackageJSON = async() => {
};

function openFeedback() {
createTab('https://github.com/JaydenDev/Catalyst/issues/new')
createTab('https://github.com/redstone-scratch/Platinum/issues/new')
}

function openGithub() {
createTab('https://github.com/JaydenDev/Catalyst')
createTab('https://github.com/redstone-scratch/Platinum')
}

function openDocs() {
createTab('https://getcatalyst.eu.org/docs')
alert('Not implemented')
}

function clearData() {
if (!confirm("Are you sure you want to delete all preferences and bookmarks from Catalyst? \n You will stay logged into all the websites you use!")) return;
if (!confirm("Are you sure you want to delete all preferences and bookmarks from Platinum? \n You will stay logged into all the websites you use!")) return;
window.localStorage.clear();
localStorage.setItem('ctlyststrppg', './home.html')
window.close();
Expand Down
6 changes: 4 additions & 2 deletions src/lsSaveHandler.js → lib/lsSaveHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ function lsSaveBookmarks() {
let bookmarksLink = document.createElement("a");
bookmarksLink.href = bookmarksURL;
bookmarksLink.download = "bookmarks.json";
bookmarksLink.click();
//bookmarksLink.click();
URL.revokeObjectURL(bookmarksURL);
}

function loadBookmarksJSON(pathToFile) {
// if pathToFile ends with json continue, if not stop function
if (!pathToFile.endsWith(".json")) {
console.log("This functionality is incomplete")
//let json = JSON.parse()
import {Platinum} from 'lib/openux/api/browser'
Platinum.addBookmark()
} else {
return;
}
Expand Down
77 changes: 77 additions & 0 deletions lib/openux/api/declarative-ui.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
class InstancesManager {
static instances = [];

static removeInstance(index) {
InstancesManager.instances.splice()
}

}


class DUIElement {

constructor(...attributes) {
this.elementType = 'dui-root';
this.attributes = attributes || [];
this._isLocked = false;
this._updateData()

//this.reference =
}

_updateData() {
if (!this._isLocked) {
if (!InstancesManager.instances.includes(this)) {
InstancesManager.instances.push(this)
this._emInstancesIndex = InstancesManager.instances.indexOf(this)
} else {
InstancesManager.instances[this._emInstancesIndex] = this
}
} else {
throw TypeError('Element is locked')
}
}

_createReference() {
if (this.elementType === 'dui-root') {
return document.createElement('div')
}
}

lock() {
if (!this._isLocked) this._isLocked = true
}

_transformAttributes() {
if (this.attributes === []) {
// easier and less computationally expensive
return ``
} else {
let str;
for (let attr in this.attributes) {
str.concat(`${attr.name}=${attr.value}`)
}
}
}

append(where) {
let el = document.createElement(this.elementType)
_applyAttributes(el, this._transformAttributes())
where.appendChild(el)
}

}

class DUIAttribute {

constructor(name, value) {
this.name = name
this.value = value
this._isLocked = false
}

lock() {
this._isLocked = true
}

}
70 changes: 70 additions & 0 deletions lib/openux/api/hooks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// ripped out all the old dynamicux code and replaced it with better code

// For reference (🤮):
// function createHook(elemID, hookName) {
// hookName = [
// hookData = document.querySelector('#' + elemID)
// ]
// }

// function getHookData(hookName) {
// try {
// var currentHookData = hookName.hookData;
// }
// catch(err) {
// console.log("ERR: " + err.message)
// }
// }

export default class Hook {

static instances = [];

constructor(hookName) {
this.elemID = null; // Expected to use .attach() to set & update it
this.name = hookName;
this.reference = null;
this.uuid = require()
Hook.instances.push(this);
this._instanceIndex = Hook.instances.indexOf(this);
this._updateInstances();
}

attach(el) {
const el = document.querySelector(el)
this.reference = el
this._updateInstance()
}



_updateInstance() {
Hook.instances[this._instanceIndex] = this;
this._instanceIndex = Hook.instances.indexOf(this);
}

get getData() {
return this.data
}

destroy() {
Hook.instances.splice(this._instanceIndex, 1);
}

}

export function createHook(elemID, hookName) { // for backwards compatibility for now. will be removed in the future
console.warn(`Please use the new OpenUX APIs instead of the DynamicUX APIs.
They're more stable, more secure, and more powerful.`)
const _hook = new Hook()
_hook.attach(`#${elemID}[dux-attach]`)
return _hook
}

export function getHookData(hookName) {
// todo
}

function hookExample() {
const demoP = new Hook()
}
8 changes: 4 additions & 4 deletions main/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function createWindow() {
webviewTag: true,
devTools: true,
},
title: "Catalyst",
title: "Platinum",
icon: path.join(__dirname, "../assets/icon.png"),
});
mainWindow.loadFile("./src/index.html");
Expand Down Expand Up @@ -52,7 +52,7 @@ try {
async function checkForUpdate(windowToDialog) {
try {
const githubFetch = await fetch(
"https://api.github.com/repos/JaydenDev/Catalyst/releases"
"https://api.github.com/repos/JaydenDev/Platinum/releases"
);
if (!githubFetch.ok) {
alert("There was an error checking for a new update, check your WiFi connection and try again from the menubar.");
Expand All @@ -71,8 +71,8 @@ async function checkForUpdate(windowToDialog) {
Number(replaced.startsWith("v") ? replaced.slice(1) : replaced)
) {
dialog.showMessageBox(windowToDialog, {
message: "An update is available for Catalyst.",
detail: `Go to github.com/JaydenDev/Catalyst/releases to install Catalyst ${release["tag_name"]}`,
message: "An update is available for Platinum.",
detail: `Go to github.com/JaydenDev/Platinum/releases to install Platinum ${release["tag_name"]}`,
type: "info",
});
return;
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "catalyst",
"version": "3.3.0-preview",
"name": "platinum",
"version": "0.1.0-preview",
"description": "A minimal Electron Web Browser",
"main": "main/main.js",
"private": true,
Expand All @@ -13,7 +13,7 @@
"publish": "electron-forge publish",
"make": "electron-forge make"
},
"repository": "https://github.com/JaydenDev/Catalyst",
"repository": "https://github.com/JaydenDev/Platinum",
"keywords": [
"Electron",
"Browser",
Expand Down Expand Up @@ -50,7 +50,7 @@
"config": {
"repository": {
"owner": "JaydenDev",
"name": "Catalyst"
"name": "Platinum"
},
"draft": true
}
Expand All @@ -60,7 +60,7 @@
{
"name": "@electron-forge/maker-squirrel",
"config": {
"name": "Catalyst3"
"name": "Platinum3"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion plugins/plugins.conf.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var loadPlugins = "true"

const plugins = [
export const plugins = [
"example"
]
2 changes: 1 addition & 1 deletion src/getChangeLogs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ fetch("../package.json")
.then(data =>
function() {
version = data.version;
url = `https://api.github.com/repos/jaydendev/catalyst/releases/tags/${data.version}`;
url = `https://api.github.com/repos/jaydendev/Platinum/releases/tags/${data.version}`;
fetch(url)
.then(res => res.json())
.then(res => {
Expand Down
13 changes: 8 additions & 5 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>

<head>
<title>Catalyst</title>
<title>Platinum</title>
<script src="./tabs.js" defer></script>
<script src="./search.js" defer></script>
<script src="./preferences.js" defer></script>
Expand Down Expand Up @@ -90,7 +90,7 @@ <h1 class="font-bold text-xl">Preferences</h1>
<label for="pref-strt">Startup Page</label>
<input class="text-black p-1.5 rounded-sm" id="pref-strt" class=""/>
<p class="text-sm">Sets a custom startup page.</p>
<b>(You must restart Catalyst every time this is changed)</b>
<b>(You must restart Platinum every time this is changed)</b>
<br />
<br />
<label for="pref-dm"><b class="text-emerald-500">Experimental</b> Force Dark Mode</label>
Expand All @@ -108,15 +108,18 @@ <h1 class="font-bold text-xl">Preferences</h1>
<div class="sliding-ttb bg-gray-200 dark:bg-gray-800 suggestions-box" id="autocomplete-suggestions">
<!-- suggestions made with js -->
</div>
<!-- Welcome to Catalyst page -->
<!-- Welcome to Platinum page -->
<div id="welcomepage" class="hidden h-fit shadow-xl border-2 dark:border-0 bg-gray-200 dark:bg-gray-900 dark:text-white p-1.5 -l w-full rounded-b-sm">
<h1 class="dark:text-white font-bold text-xl">Welcome to Catalyst!</h1>&nbsp;
<h1 class="dark:text-white font-bold text-xl">Welcome to Platinum!</h1>&nbsp;
<button class="rounded-sm p-1 bg-white text-black w-fit" onClick="closeWelcome()">Close</button>&nbsp;
<button class="rounded-sm p-1 bg-white text-black w-fit" onClick="togglePreferences()">Customize Your Browser!</button>&nbsp;
</div>
<!-- Webviews generated with JS -->
<div id="webviews"></div>
<script src="./functions.js"></script>
<script src="../lib/functions.js"></script>
<script src="../lib/browser.js"></script>
<script src="../lib/openux/api/declarative-ui.js"></script>
<script src="../lib/openux/api/hooks.js"></script>
<script src="./startup.js"></script>
<script src="./bookmarks.js"></script>
<script src="./listeners.js"></script>
Expand Down
Loading

0 comments on commit 8c7f869

Please sign in to comment.