forked from platinum-browser/Platinum-Legacy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BIG commit! Added a lot of OpenUX's functionality! If anything's brok…
…en, submit an issue.
- Loading branch information
1 parent
03272fc
commit 8c7f869
Showing
20 changed files
with
217 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
var loadPlugins = "true" | ||
|
||
const plugins = [ | ||
export const plugins = [ | ||
"example" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.