Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "hlib"

Index

Classes

Type aliases

Variables

Functions

Object literals

Type aliases

annotation

annotation: object

Type declaration

  • document: object
  • exact: string
  • group: string
  • id: string
  • isPagenote: boolean
  • isReply: boolean
  • prefix: string
  • refs: string[]
  • suffix: string
  • tags: string[]
  • target: object
  • text: string
  • title: string
  • updated: string
  • url: string
  • user: string

gatheredResult

gatheredResult: object

Type declaration

gatheredResults

gatheredResults: object

Type declaration

httpOpts

httpOpts: object

Type declaration

  • headers: any
  • method: string
  • params: any
  • url: string

httpResponse

httpResponse: object

Type declaration

  • response: any
  • status: number

inputFormArgs

inputFormArgs: object

Type declaration

  • element: HTMLElement
  • id: string
  • Optional msg?: undefined | string
  • name: string
  • onchange: EventHandlerNonNull
  • Optional type?: undefined | string
  • value: string

settings

settings: object

Type declaration

  • addQuoteContext: string
  • any: string
  • exactTagSearch: string
  • expanded: string
  • group: string
  • max: string
  • service: string
  • tag: string
  • url: string
  • user: string
  • wildcard_uri: string

textPositionSelector

textPositionSelector: object

Type declaration

  • end: number
  • start: number
  • type: string

textQuoteSelector

textQuoteSelector: object

Type declaration

  • exact: string
  • Optional prefix?: undefined | string
  • Optional suffix?: undefined | string
  • type: string

toggler

toggler: object

Type declaration

  • togglerTitle: string
  • togglerUnicodeChar: string

Variables

Const clearInputEvent

clearInputEvent: Event = new Event('clearInput')

Const defaultControlledTags

defaultControlledTags: "tag1, tag2, tag3" = "tag1, tag2, tag3"

Const formUrlStorageSyncEvent

formUrlStorageSyncEvent: Event = new Event('formUrlStorageSync')

Const settings

settings: object = settingsFromLocalStorage()

Type declaration

  • addQuoteContext: string
  • any: string
  • exactTagSearch: string
  • expanded: string
  • group: string
  • max: string
  • service: string
  • tag: string
  • url: string
  • user: string
  • wildcard_uri: string

Const svgIcons

svgIcons: "<svg style="position: absolute; width: 0; height: 0; overflow: hidden" version="1.1" xmlns="http://www.w3.org/2000/svg"xmlns:xlink="http://www.w3.org/1999/xlink"><defs><symbol id="icon-floppy" viewBox="0 0 353.073 353.073"><path d="M340.969,0H12.105C5.423,0,0,5.423,0,12.105v328.863c0,6.68,5.423,12.105,12.105,12.105h328.864c6.679,0,12.104-5.426,12.104-12.105V12.105C353.073,5.423,347.647,0,340.969,0z M67.589,18.164h217.895v101.884H67.589V18.164zM296.082,327.35H57.003V176.537h239.079V327.35z M223.953,33.295h30.269v72.638h-30.269V33.295z M274.135,213.863H78.938v-12.105h195.197V213.863z M274.135,256.231H78.938v-12.105h195.197V256.231z M274.135,297.087H78.938v-12.105h195.197V297.087z"/><title>save</title></symbol><symbol id="icon-pencil" viewBox="0 0 512 512"><title>edit</title><path d="M311.18,78.008L32.23,356.958L0.613,485.716c-1.771,7.209,0.355,14.818,5.604,20.067c5.266,5.266,12.88,7.368,20.067,5.604l128.759-31.617l278.95-278.95L311.18,78.008z M40.877,471.123l10.871-44.271l33.4,33.4L40.877,471.123z"/><path d="M502.598,86.818L425.182,9.402c-12.536-12.536-32.86-12.536-45.396,0l-30.825,30.825l122.812,122.812l30.825-30.825C515.134,119.679,515.134,99.354,502.598,86.818z"/></symbol><symbol id="icon-delete" viewBox="0 0 348.333 348.334"><title>delete</title><path d="M336.559,68.611L231.016,174.165l105.543,105.549c15.699,15.705,15.699,41.145,0,56.85c-7.844,7.844-18.128,11.769-28.407,11.769c-10.296,0-20.581-3.919-28.419-11.769L174.167,231.003L68.609,336.563c-7.843,7.844-18.128,11.769-28.416,11.769c-10.285,0-20.563-3.919-28.413-11.769c-15.699-15.698-15.699-41.139,0-56.85l105.54-105.549L11.774,68.611c-15.699-15.699-15.699-41.145,0-56.844c15.696-15.687,41.127-15.687,56.829,0l105.563,105.554L279.721,11.767c15.705-15.687,41.139-15.687,56.832,0C352.258,27.466,352.258,52.912,336.559,68.611z"/></symbol><title>view/edit/reply</title><symbol id="icon-external-link" viewBox="0 0 26 26"><path d="M18,17.759v3.366C18,22.159,17.159,23,16.125,23H4.875C3.841,23,3,22.159,3,21.125V9.875C3,8.841,3.841,8,4.875,8h3.429l3.001-3h-6.43C2.182,5,0,7.182,0,9.875v11.25C0,23.818,2.182,26,4.875,26h11.25C18.818,26,21,23.818,21,21.125v-6.367L18,17.759z"/><path d="M22.581,0H12.322c-1.886,0.002-1.755,0.51-0.76,1.504l3.22,3.22l-5.52,5.519c-1.145,1.144-1.144,2.998,0,4.141l2.41,2.411c1.144,1.141,2.996,1.142,4.14-0.001l5.52-5.52l3.16,3.16c1.101,1.1,1.507,1.129,1.507-0.757L26,3.419C25.999-0.018,26.024-0.001,22.581,0z"/></symbol></defs></svg>" = `<svg style="position: absolute; width: 0; height: 0; overflow: hidden" version="1.1" xmlns="http://www.w3.org/2000/svg"xmlns:xlink="http://www.w3.org/1999/xlink"><defs><symbol id="icon-floppy" viewBox="0 0 353.073 353.073"><path d="M340.969,0H12.105C5.423,0,0,5.423,0,12.105v328.863c0,6.68,5.423,12.105,12.105,12.105h328.864c6.679,0,12.104-5.426,12.104-12.105V12.105C353.073,5.423,347.647,0,340.969,0z M67.589,18.164h217.895v101.884H67.589V18.164zM296.082,327.35H57.003V176.537h239.079V327.35z M223.953,33.295h30.269v72.638h-30.269V33.295z M274.135,213.863H78.938v-12.105h195.197V213.863z M274.135,256.231H78.938v-12.105h195.197V256.231z M274.135,297.087H78.938v-12.105h195.197V297.087z"/><title>save</title></symbol><symbol id="icon-pencil" viewBox="0 0 512 512"><title>edit</title><path d="M311.18,78.008L32.23,356.958L0.613,485.716c-1.771,7.209,0.355,14.818,5.604,20.067c5.266,5.266,12.88,7.368,20.067,5.604l128.759-31.617l278.95-278.95L311.18,78.008z M40.877,471.123l10.871-44.271l33.4,33.4L40.877,471.123z"/><path d="M502.598,86.818L425.182,9.402c-12.536-12.536-32.86-12.536-45.396,0l-30.825,30.825l122.812,122.812l30.825-30.825C515.134,119.679,515.134,99.354,502.598,86.818z"/></symbol><symbol id="icon-delete" viewBox="0 0 348.333 348.334"><title>delete</title><path d="M336.559,68.611L231.016,174.165l105.543,105.549c15.699,15.705,15.699,41.145,0,56.85c-7.844,7.844-18.128,11.769-28.407,11.769c-10.296,0-20.581-3.919-28.419-11.769L174.167,231.003L68.609,336.563c-7.843,7.844-18.128,11.769-28.416,11.769c-10.285,0-20.563-3.919-28.413-11.769c-15.699-15.698-15.699-41.139,0-56.85l105.54-105.549L11.774,68.611c-15.699-15.699-15.699-41.145,0-56.844c15.696-15.687,41.127-15.687,56.829,0l105.563,105.554L279.721,11.767c15.705-15.687,41.139-15.687,56.832,0C352.258,27.466,352.258,52.912,336.559,68.611z"/></symbol><title>view/edit/reply</title><symbol id="icon-external-link" viewBox="0 0 26 26"><path d="M18,17.759v3.366C18,22.159,17.159,23,16.125,23H4.875C3.841,23,3,22.159,3,21.125V9.875C3,8.841,3.841,8,4.875,8h3.429l3.001-3h-6.43C2.182,5,0,7.182,0,9.875v11.25C0,23.818,2.182,26,4.875,26h11.25C18.818,26,21,23.818,21,21.125v-6.367L18,17.759z"/><path d="M22.581,0H12.322c-1.886,0.002-1.755,0.51-0.76,1.504l3.22,3.22l-5.52,5.519c-1.145,1.144-1.144,2.998,0,4.141l2.41,2.411c1.144,1.141,2.996,1.142,4.14-0.001l5.52-5.52l3.16,3.16c1.101,1.1,1.507,1.129,1.507-0.757L26,3.419C25.999-0.018,26.024-0.001,22.581,0z"/></symbol></defs></svg>`

Functions

appendBody

  • appendBody(element: HTMLElement): void
  • Parameters

    • element: HTMLElement

    Returns void

clearInput

  • clearInput(e: MouseEvent): void
  • Parameters

    • e: MouseEvent

    Returns void

collapseAll

  • collapseAll(): void
  • Collapse all annotation cards.

    Returns void

createAddQuoteContextCheckbox

  • createAddQuoteContextCheckbox(element: HTMLElement): void
  • Parameters

    • element: HTMLElement

    Returns void

createAnnotationPayload

  • createAnnotationPayload(params: any): string
  • Form the JSON payload that creates an annotation.

    Expects an object with these keys:

    uri: Target to which annotation will post
    exact, prefix, suffix: Info for TextQuoteSelector, only exact is required
    start, stop: Info for TextPositionSelector, optional
    username: Hypothesis username
    group: Hypothesis group (use `__world__` for Public, ignored if you are posting a reply)
    text: Body of annotation (could be markdown or html)
    tags: Hypothesis tags
    references: Array of ids. To post a reply: [ '{threadRootId}' ]
    extra: Extra data, invisible to user but available through H API

    Parameters

    • params: any

    Returns string

createAnyInputForm

  • createAnyInputForm(element: HTMLElement, msg?: undefined | string): void
  • Parameters

    • element: HTMLElement
    • Optional msg: undefined | string

    Returns void

createApiTokenInputForm

  • createApiTokenInputForm(element: HTMLElement): void
  • Input form for an API token, remembered in local storage.

    Parameters

    • element: HTMLElement

    Returns void

createExactTagSearchCheckbox

  • createExactTagSearchCheckbox(element: HTMLElement): void
  • Parameters

    • element: HTMLElement

    Returns void

createExpandedCheckbox

  • createExpandedCheckbox(element: HTMLElement): void
  • Parameters

    • element: HTMLElement

    Returns void

createFacetInputForm

  • createFacetInputForm(e: HTMLElement, facet: string, msg?: undefined | string, value?: undefined | string): HTMLElement
  • Create a simple input field.

    Parameters

    • e: HTMLElement
    • facet: string
    • Optional msg: undefined | string
    • Optional value: undefined | string

    Returns HTMLElement

createGroupInputForm

  • createGroupInputForm(e: HTMLElement, selectId?: undefined | string): Promise<unknown>
  • Create a Hypothesis group picker.

    Parameters

    • e: HTMLElement
    • Optional selectId: undefined | string

    Returns Promise<unknown>

createInputForm

  • createInputForm(name: string, handler: EventHandlerNonNull, element: HTMLElement, type?: undefined | string, msg?: undefined | string): void
  • Parameters

    • name: string
    • handler: EventHandlerNonNull
    • element: HTMLElement
    • Optional type: undefined | string
    • Optional msg: undefined | string

    Returns void

createMaxInputForm

  • createMaxInputForm(element: HTMLElement, msg?: undefined | string): void
  • Parameters

    • element: HTMLElement
    • Optional msg: undefined | string

    Returns void

createNamedInputForm

  • Create an input field with a handler to save the changed value, optionally with a default value, optionally with a type (e.g. password). Should be renamed to createUrlAndStorageSyncedInputForm

    Parameters

    Returns HTMLElement

createPermissions

  • createPermissions(username: string, group: string): object
  • Helper for createAnnotationPayload.

    Parameters

    • username: string
    • group: string

    Returns object

    • delete: string[]
    • read: string[]
    • update: string[]

createTagInputForm

  • createTagInputForm(element: HTMLElement, msg?: undefined | string): void
  • Parameters

    • element: HTMLElement
    • Optional msg: undefined | string

    Returns void

createTextPositionSelector

createTextQuoteSelector

  • createTextQuoteSelector(exact: string, prefix: string, suffix: string): textQuoteSelector
  • Helper for createAnnotationPayload

    Parameters

    • exact: string
    • prefix: string
    • suffix: string

    Returns textQuoteSelector

createUrlInputForm

  • createUrlInputForm(element: HTMLElement): void
  • Parameters

    • element: HTMLElement

    Returns void

createUserInputForm

  • createUserInputForm(element: HTMLElement, msg?: undefined | string): void
  • Parameters

    • element: HTMLElement
    • Optional msg: undefined | string

    Returns void

createWildcardUriInputForm

  • createWildcardUriInputForm(element: HTMLElement): void
  • Parameters

    • element: HTMLElement

    Returns void

csvRow

  • csvRow(level: number, anno: any): string
  • Format an annotation as a row of a CSV export.

    Parameters

    • level: number
    • anno: any

    Returns string

delaySeconds

  • delaySeconds(seconds: number): Promise<unknown>
  • Parameters

    • seconds: number

    Returns Promise<unknown>

deleteAnnotation

  • deleteAnnotation(id: string, token: string): Promise<object>
  • Parameters

    • id: string
    • token: string

    Returns Promise<object>

displayKeysAndHiddenValues

  • displayKeysAndHiddenValues(dictionary: Map<string, string>): string
  • Parameters

    • dictionary: Map<string, string>

    Returns string

download

  • download(text: string, type: string): void
  • Save exported annotations to a file.

    Parameters

    • text: string
    • type: string

    Returns void

expandAll

  • expandAll(): void
  • Expand all annotation cards.

    Returns void

findArrows

  • findArrows(toggler: HTMLElement): NodeListOf<HTMLElement>
  • Parameters

    • toggler: HTMLElement

    Returns NodeListOf<HTMLElement>

formatTags

  • formatTags(tags: string[], urlPrefix?: undefined | string): string
  • Render a list of tags. By default, the links work as in ${settings.service}judell/facet. Use the optional urlPrefix with ${settings.service}/search?q=tag: to override with links to the Hypothesis viewer.

    Parameters

    • tags: string[]
    • Optional urlPrefix: undefined | string

    Returns string

gatherAnnotationsByUrl

  • Organize a set of annotations, from ${settings.service}/api/search, by url

    Parameters

    • rows: any[]

    Returns gatheredResults

getAnnotation

  • getAnnotation(id: string, token: string): Promise<object>
  • Parameters

    • id: string
    • token: string

    Returns Promise<object>

getById

  • getById(id: string): HTMLElement
  • Parameters

    • id: string

    Returns HTMLElement

getControlledTagsFromLocalStorage

  • getControlledTagsFromLocalStorage(): string

getDefaultSettings

  • getDefaultSettings(): object
  • Returns object

    • addQuoteContext: string
    • any: string
    • exactTagSearch: string
    • expanded: string
    • group: string
    • max: string
    • service: string
    • tag: string
    • url: string
    • user: string
    • wildcard_uri: string

getDomainFromUrl

  • getDomainFromUrl(url: string): string
  • Parameters

    • url: string

    Returns string

getGroup

  • getGroup(): string
  • Acquire a Hypothesis group id

    Returns string

getSelectedGroup

  • getSelectedGroup(selectId?: undefined | string): string
  • Parameters

    • Optional selectId: undefined | string

    Returns string

getSelectedGroupInfo

  • getSelectedGroupInfo(selectId?: undefined | string): object
  • Parameters

    • Optional selectId: undefined | string

    Returns object

    • selectedGroup: string
    • selectedGroupName: string

getSelectedGroupName

  • getSelectedGroupName(selectId?: undefined | string): string
  • Parameters

    • Optional selectId: undefined | string

    Returns string

getSettings

  • getSettings(): object
  • Returns object

    • addQuoteContext: string
    • any: string
    • exactTagSearch: string
    • expanded: string
    • group: string
    • max: string
    • service: string
    • tag: string
    • url: string
    • user: string
    • wildcard_uri: string

getSubjectUserTokensFromLocalStorage

  • getSubjectUserTokensFromLocalStorage(): Map<string, string>

getToken

  • getToken(): string
  • Acquire a Hypothesis API token

    Returns string

getTokenFromLocalStorage

  • getTokenFromLocalStorage(): string

getUserFromLocalStorage

  • getUserFromLocalStorage(): string

gup

  • gup(name: string, str?: undefined | string): string
  • Get url parameters

    Parameters

    • name: string
    • Optional str: undefined | string

    Returns string

hideCards

  • hideCards(cards: NodeListOf<HTMLElement>): void
  • Hide a set of annotation cards.

    Parameters

    • cards: NodeListOf<HTMLElement>

    Returns void

httpRequest

insertNodeAfter

  • insertNodeAfter(newNode: HTMLElement, referenceNode: HTMLElement): void
  • Parameters

    • newNode: HTMLElement
    • referenceNode: HTMLElement

    Returns void

manageTokenDisplayAndReset

  • manageTokenDisplayAndReset(): void

maybeTruncateAndAddEllipsis

  • maybeTruncateAndAddEllipsis(str: string, count: number): string
  • Parameters

    • str: string
    • count: number

    Returns string

parseAnnotation

parseResponseHeaders

  • parseResponseHeaders(headerStr: string): object

parseSelectors

  • parseSelectors(target: any): object
  • Parse the target of a row returned from /api/search

    Parameters

    • target: any

    Returns object

postAnnotation

  • postAnnotation(payload: string, token: string): Promise<httpResponse>
  • Create an annotation

    Parameters

    • payload: string
    • token: string

    Returns Promise<httpResponse>

postAnnotationAndRedirect

  • postAnnotationAndRedirect(payload: string, token: string, queryFragment?: undefined | string): Promise<void>
  • Create an annotation and redirect to the annotated page, optionally with a client-side query.

    Parameters

    • payload: string
    • token: string
    • Optional queryFragment: undefined | string

    Returns Promise<void>

saveControlledTagsToLocalStorage

  • saveControlledTagsToLocalStorage(value: string): void
  • Parameters

    • value: string

    Returns void

saveSubjectUserTokensToLocalStorage

  • saveSubjectUserTokensToLocalStorage(value: string): boolean
  • Parameters

    • value: string

    Returns boolean

search

  • search(params: any, progressId?: undefined | string): Promise<any>
  • Wrapper for /api/search

    Parameters

    • params: any
    • Optional progressId: undefined | string

    Returns Promise<any>

setApiTokenHeaders

  • Add a token authorization header to the options that govern an httpRequest. If the token isn't passed as a param, try getting it from local storage.

    Parameters

    • opts: httpOpts
    • Optional token: undefined | string

    Returns httpOpts

setLocalStorageFromForm

  • setLocalStorageFromForm(formId: string, storageKey: string): void
  • Save value of a form field.

    Parameters

    • formId: string
    • storageKey: string

    Returns void

setSelectedGroup

  • setSelectedGroup(selectId: string): void
  • Parameters

    • selectId: string

    Returns void

setToggleControlCollapse

  • setToggleControlCollapse(toggler: HTMLElement): void
  • Set expand/collapse toggle to collapsed.

    Parameters

    • toggler: HTMLElement

    Returns void

setToggleControlExpand

  • setToggleControlExpand(toggler: HTMLElement): void
  • Set expand/collapse toggle to expanded.

    Parameters

    • toggler: HTMLElement

    Returns void

setToken

  • setToken(): void
  • Save a Hypothesis API token.

    Returns void

settingsFromLocalStorage

settingsToLocalStorage

  • settingsToLocalStorage(settings: settings): void

settingsToUrl

  • settingsToUrl(settings: settings): void

showAnnotation

  • showAnnotation(anno: annotation, level: number, params: any): string
  • Render an annotation card.

    Parameters

    Returns string

showCards

  • showCards(cards: NodeListOf<HTMLElement>): void
  • Show a setof annotation cards.

    Parameters

    • cards: NodeListOf<HTMLElement>

    Returns void

syncContainer

  • syncContainer(name: string): (Anonymous function)
  • Parameters

    • name: string

    Returns (Anonymous function)

syncUrlAndLocalStorageFromForm

  • syncUrlAndLocalStorageFromForm(formId: string): void
  • Parameters

    • formId: string

    Returns void

syntaxColorParams

  • syntaxColorParams(params: settings, excluded: string[]): string
  • Display the params a bit less plainly

    Parameters

    Returns string

toggle

  • toggle(id: string): void
  • Switch the expand/collapse state of an annotation card.

    Parameters

    • id: string

    Returns void

updateAnnotation

  • updateAnnotation(id: string, token: string, payload: string): Promise<object>
  • Parameters

    • id: string
    • token: string
    • payload: string

    Returns Promise<object>

updateSetting

  • updateSetting(name: string, value: string): void
  • Parameters

    • name: string
    • value: string

    Returns void

Object literals

Const collapseToggler

collapseToggler: object

togglerTitle

togglerTitle: string = "expand"

togglerUnicodeChar

togglerUnicodeChar: string = "▶"

Const defaultSettings

defaultSettings: object

addQuoteContext

addQuoteContext: string = "false"

any

any: string = ""

exactTagSearch

exactTagSearch: string = "false"

expanded

expanded: string = "false"

group

group: string = "all"

max

max: string = "50"

service

service: string = "https://hypothes.is"

tag

tag: string = ""

url

url: string = ""

user

user: string = ""

wildcard_uri

wildcard_uri: string = ""

Const expandToggler

expandToggler: object

togglerTitle

togglerTitle: string = "collapse"

togglerUnicodeChar

togglerUnicodeChar: string = "▼"

Generated using TypeDoc