Skip to content

Instantly share code, notes, and snippets.

@retorquere
Created February 28, 2024 07:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save retorquere/00bd7739de3c0e057d46d42182273e17 to your computer and use it in GitHub Desktop.
Save retorquere/00bd7739de3c0e057d46d42182273e17 to your computer and use it in GitHub Desktop.
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('-', '')
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