Skip to content

Commit

Permalink
Moved factory function defs up to support early calls ↞ [auto-sync fr…
Browse files Browse the repository at this point in the history
…om `adamlui/chatgpt-apps`]
  • Loading branch information
adamlui authored and kudo-sync-bot committed Sep 12, 2024
1 parent c1ce151 commit fb0ad25
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions greasemonkey/bravegpt.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
// @description:zu Yengeza izimpendulo ze-AI ku-Brave Search (inikwa amandla yi-GPT-4o!)
// @author KudoAI
// @namespace https://kudoai.com
// @version 2024.9.12
// @version 2024.9.12.1
// @license MIT
// @icon https://media.bravegpt.com/images/icons/bravegpt/icon48.png?0a9e287
// @icon64 https://media.bravegpt.com/images/icons/bravegpt/icon64.png?0a9e287
Expand Down Expand Up @@ -589,6 +589,32 @@
modals.about.show()
}})}

// Define FACTORY functions

const create = {

anchor(linkHref, displayContent, attrs = {}) {
const anchor = document.createElement('a'),
defaultAttrs = { href: linkHref, target: '_blank', rel: 'noopener' },
finalAttrs = { ...defaultAttrs, ...attrs }
Object.entries(finalAttrs).forEach(([attr, value]) => anchor.setAttribute(attr, value))
if (displayContent) anchor.append(displayContent)
return anchor
},

style(content) {
const style = document.createElement('style')
if (content) style.innerText = content
return style
},

svgElem(type, attrs) {
const elem = document.createElementNS('http://www.w3.org/2000/svg', type)
for (const attr in attrs) elem.setAttributeNS(null, attr, attrs[attr])
return elem
}
}

// Define FEEDBACK functions

function notify(msg, position = '', notifDuration = '', shadow = 'shadow') {
Expand Down Expand Up @@ -2466,32 +2492,6 @@
}
}

// Define FACTORY functions

const create = {

anchor(linkHref, displayContent, attrs = {}) {
const anchor = document.createElement('a'),
defaultAttrs = { href: linkHref, target: '_blank', rel: 'noopener' },
finalAttrs = { ...defaultAttrs, ...attrs }
Object.entries(finalAttrs).forEach(([attr, value]) => anchor.setAttribute(attr, value))
if (displayContent) anchor.append(displayContent)
return anchor
},

style(content) {
const style = document.createElement('style')
if (content) style.innerText = content
return style
},

svgElem(type, attrs) {
const elem = document.createElementNS('http://www.w3.org/2000/svg', type)
for (const attr in attrs) elem.setAttributeNS(null, attr, attrs[attr])
return elem
}
}

// Define TOGGLE functions

const toggle = {
Expand Down

0 comments on commit fb0ad25

Please sign in to comment.