Skip to content

Commit

Permalink
Replaced non-global .match() w/ more performant .exec() ↞ [auto-s…
Browse files Browse the repository at this point in the history
…ync from `adamlui/chatgpt-apps`]
  • Loading branch information
adamlui authored and kudo-sync-bot committed Jul 20, 2024
1 parent b68ee94 commit 9f3fea1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions greasemonkey/duckduckgpt.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-DuckDuckGo (inikwa amandla yi-GPT-4o!)
// @author KudoAI
// @namespace https://kudoai.com
// @version 2024.7.19.8
// @version 2024.7.19.9
// @license MIT
// @icon https://media.ddgpt.com/images/icons/duckduckgpt/icon48.png?af89302
// @icon64 https://media.ddgpt.com/images/icons/duckduckgpt/icon64.png?af89302
Expand Down Expand Up @@ -820,7 +820,7 @@
settingItem.append(settingLabel) ; (settingsLists[isPortrait ? 0 : +(idx >= settingItemCap)]).append(settingItem)

// Create/prepend icons
const settingIcon = icons[setting.icon].create(key.match(/bg|fg/)?.[0] ?? '')
const settingIcon = icons[setting.icon].create(/bg|fg/.exec(key)?.[0] ?? '')
settingIcon.style.cssText = 'position: relative ;' + (
/proxy/i.test(key) ? 'top: 3px ; left: -0.5px ; margin-right: 9px'
: /streaming/i.test(key) ? 'top: 3px ; left: 0.5px ; margin-right: 9px'
Expand Down Expand Up @@ -886,7 +886,7 @@
else if (/autoget/i.test(key)) toggle.autoGet()
else if (key.includes('rq')) toggle.relatedQueries()
else if (manualGetMatch) toggle.manualGet(manualGetMatch[0])
else if (key.includes('Sidebar')) toggle.sidebar(key.match(/(.*?)Sidebar$/)[1])
else if (key.includes('Sidebar')) toggle.sidebar(/(.*?)Sidebar$/.exec(key)[1])
else if (key.includes('anchor')) toggle.anchorMode()
else if (key.includes('bgAnimation')) toggle.animations('bg')
else if (key.includes('fgAnimation')) toggle.animations('fg')
Expand Down

0 comments on commit 9f3fea1

Please sign in to comment.