Created
February 28, 2024 07:14
-
-
Save retorquere/00bd7739de3c0e057d46d42182273e17 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
declare const Zotero: any | |
declare const location: any | |
export const is7 = (typeof location !== 'undefined' && location.search) ? ((new URLSearchParams(location.search)).get('is7') === 'true') : Zotero.platformMajorVersion >= 102 | |
function clientname(): string { | |
if (typeof location !== 'undefined' && location.search) return (new URLSearchParams(location.search)).get('clientName') | |
// if (process.versions.node) return 'Zotero' // testing | |
if (Zotero.clientName) return Zotero.clientName as string | |
if (Zotero.BetterBibTeX?.clientName) return Zotero.BetterBibTeX.clientName as string | |
throw new Error('Unable to detect clientName') | |
} | |
export const clientName = clientname() | |
export const client = clientName.toLowerCase().replace('-', '') |
This file contains hidden or 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
global.Zotero = { | |
platformMajorVersion: 0, | |
clientName: 'zotero', | |
} | |
import { clientName } from './lib' | |
console.log(clientName) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment