0.4.5 • Published 10 months ago

jerrymander v0.4.5

Weekly downloads
-
License
GPLV3
Repository
-
Last release
10 months ago

jerry

Pages on the web are modeled as data in the form of a tree. Nodes have child nodes, such that your average webpage consists of containers of containers of containers of--ultimately--text or media content. In certain contexts, notably from the perspective of a user, webpages are better represented with the flat structure of a more traditional document. Jerry is a framework for translating between webpages-as-tree-structures and -as-linear-text. With jerry, every Node on a webpage is given an Address---which can then be manipulated in various ways.

jerry

install

$ npm install jerrymander

usage

const jerry = new Jerry()
jerry.getSelection().highlight()
localStorage.highlights = JSON.stringify(jerry.serialize())

docs

  • new Jerry(root = document.body)

create a Jerry instance around a given root node.

  • Jerry#getSelection(): Address

get the address of the current user selection.

  • Address#highlight(className = 'highlight)

highlight the content at a given address (takes an optional className to apply).

  • Address#select()

set selected text range to the contents of this address

  • Jerry#serialize(): string[]

serializes all highlights for storage or transmission.

  • Jerry#deserialize(highlights: string[]): Address[]

deserialize a serialization result back into Addresses.

  • Address#getHash(): number

get the hash of the content at an address.

0.4.5

10 months ago

0.4.4

10 months ago

0.3.0

1 year ago

0.2.1

1 year ago

0.4.1

1 year ago

0.2.3

1 year ago

0.4.0

1 year ago

0.2.2

1 year ago

0.4.3

1 year ago

0.4.2

1 year ago

0.2.4

1 year ago

0.2.0

2 years ago

0.1.0

2 years ago