Skip to content

Commit 383e4cd

Browse files
committed
Condensed download routines ↞ [auto-sync from https://github.com/adamlui/ai-web-extensions/tree/main/googlegpt]
1 parent 9695b0c commit 383e4cd

1 file changed

Lines changed: 11 additions & 17 deletions

File tree

chatgpt/googlegpt/googlegpt.user.js

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
// @description:zu Yengeza izimpendulo ze-AI ku-Google Search (inikwa amandla yi-Google Gemma + GPT-4o!)
150150
// @author KudoAI
151151
// @namespace https://kudoai.com
152-
// @version 2025.12.16
152+
// @version 2026.1.3
153153
// @license MIT
154154
// @icon data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%22170.667%22%20height=%22170.667%22%3E%3Cstyle%3E:root%7B--fill:%23000%7D@media%20(prefers-color-scheme:dark)%7B:root%7B--fill:%23fff%7D%7D%3C/style%3E%3Cpath%20fill=%22var(--fill)%22%20d=%22M82.346%20159.79c-18.113-1.815-31.78-9.013-45.921-24.184C23.197%20121.416%2017.333%20106.18%2017.333%2086c0-21.982%205.984-36.245%2021.87-52.131C55.33%2017.74%2069.27%2011.867%2091.416%2011.867c17.574%200%2029.679%203.924%2044.309%2014.363l8.57%206.116-8.705%208.705-8.704%208.704-4.288-3.608c-13.91-11.704-35.932-14.167-53.085-5.939-3.4%201.631-9.833%206.601-14.297%2011.045C44.669%2061.753%2040.95%2070.811%2040.95%2086c0%2014.342%203.594%2023.555%2013.26%2033.995%2019.088%2020.618%2048.46%2022.539%2070.457%204.608l5.333-4.348%2011.333%203.844c6.234%202.114%2011.54%203.857%2011.791%203.873.252.015-2.037%203.008-5.087%206.65-6.343%207.577-20.148%2017.217-30.493%2021.295-8.764%203.454-23.358%205.06-35.198%203.873zM92%2086.333V74.667h60.648l-11.41%2011.41-11.411%2011.41-18.914.257L92%2098z%22/%3E%3C/svg%3E
155155
// @icon64 data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%22170.667%22%20height=%22170.667%22%3E%3Cstyle%3E:root%7B--fill:%23000%7D@media%20(prefers-color-scheme:dark)%7B:root%7B--fill:%23fff%7D%7D%3C/style%3E%3Cpath%20fill=%22var(--fill)%22%20d=%22M82.346%20159.79c-18.113-1.815-31.78-9.013-45.921-24.184C23.197%20121.416%2017.333%20106.18%2017.333%2086c0-21.982%205.984-36.245%2021.87-52.131C55.33%2017.74%2069.27%2011.867%2091.416%2011.867c17.574%200%2029.679%203.924%2044.309%2014.363l8.57%206.116-8.705%208.705-8.704%208.704-4.288-3.608c-13.91-11.704-35.932-14.167-53.085-5.939-3.4%201.631-9.833%206.601-14.297%2011.045C44.669%2061.753%2040.95%2070.811%2040.95%2086c0%2014.342%203.594%2023.555%2013.26%2033.995%2019.088%2020.618%2048.46%2022.539%2070.457%204.608l5.333-4.348%2011.333%203.844c6.234%202.114%2011.54%203.857%2011.791%203.873.252.015-2.037%203.008-5.087%206.65-6.343%207.577-20.148%2017.217-30.493%2021.295-8.764%203.454-23.358%205.06-35.198%203.873zM92%2086.333V74.667h60.648l-11.41%2011.41-11.411%2011.41-18.914.257L92%2098z%22/%3E%3C/svg%3E
@@ -1616,17 +1616,12 @@
16161616

16171617
// Download code
16181618
const code = codeBlock.textContent.replace(/^>> /, '').trim() + '\n'
1619-
const dlLink = dom.create.anchor(URL.createObjectURL(new Blob([code], { type: 'text/plain' })))
1620-
const now = new Date(), formattedDate = [ // YYYY-MM-DD
1621-
now.getFullYear(),
1622-
String(now.getMonth() +1).padStart(2, '0'),
1623-
String(now.getDate()).padStart(2, '0')
1624-
].join('-')
1625-
dlLink.download /* filename */ = `${app.slug}_${blockLang.name.toLowerCase() || 'code'}_${
1626-
formattedDate}_${Date.now().toString(36)}${
1627-
blockLang.fileExtension ? '.' + blockLang.fileExtension : '' }`
1628-
document.body.append(dlLink) ; dlLink.click() ; dlLink.remove() // download code
1629-
URL.revokeObjectURL(dlLink.href) // prevent memory leaks
1619+
const date = new Date().toISOString().split('T')[0] // YYYY-MM-DD
1620+
const download = `${app.slug}_${blockLang.name.toLowerCase() || 'code'}_${
1621+
date}_${Date.now().toString(36)}${blockLang.fileExtension ? '.' + blockLang.fileExtension : ''}`
1622+
const href = URL.createObjectURL(new Blob([code], { type: 'text/plain' }))
1623+
const a = dom.create.anchor(href, '', { download, style: 'display: none' })
1624+
document.body.append(a) ; a.click() ; a.remove() ; URL.revokeObjectURL(href)
16301625
}
16311626
downloadBtn.onmouseenter = downloadBtn.onmouseleave = tooltip.toggle
16321627

@@ -2721,15 +2716,14 @@
27212716
xhr({
27222717
method: 'GET', url: shareURL,
27232718
onload: ({ responseText }) => {
2724-
const dlLink = dom.create.anchor(
2725-
URL.createObjectURL(new Blob([responseText], { type: 'text/html' })))
2726-
dlLink.download /* filename */ = responseText.match(/<title>([^<]+)<\/title>/i)[1]
2719+
const download = responseText.match(/<title>([^<]+)<\/title>/i)[1]
27272720
.replace(/\s*[|/]+\s*/g, ' ') // convert symbols to space for hyphen-casing
27282721
.replace(/\.{2,}/g, '') // strip ellipsis
27292722
.toLowerCase().trim().replace(/\s+/g, '-') // hyphen-case
27302723
+ '.html'
2731-
document.body.append(dlLink) ; dlLink.click() ; dlLink.remove() // download HTML
2732-
URL.revokeObjectURL(dlLink.href) // prevent memory leaks
2724+
const href = URL.createObjectURL(new Blob([responseText], { type: 'text/html' }))
2725+
const a = dom.create.anchor(href, '', { download, style: 'display: none' })
2726+
document.body.append(a) ; a.click() ; a.remove() ; URL.revokeObjectURL(href)
27332727
},
27342728
onerror: err => log.error('Failed to download chat:', err)
27352729
})

0 commit comments

Comments
 (0)