23 Matching Annotations
  1. Jan 2023
  2. Dec 2022
  3. Nov 2022
    1. js const { generateFragment } = await import('https://unpkg.com/text-fragments-polyfill/dist/fragment-generation-utils.js'); const result = generateFragment(window.getSelection()); if (result.status === 0) { let url = `${location.origin}${location.pathname}${location.search}`; const fragment = result.fragment; const prefix = fragment.prefix ? `${encodeURIComponent(fragment.prefix)}-,` : ''; const suffix = fragment.suffix ? `,-${encodeURIComponent(fragment.suffix)}` : ''; const textStart = encodeURIComponent(fragment.textStart); const textEnd = fragment.textEnd ? `,${encodeURIComponent(fragment.textEnd)}` : ''; url += `#:~:text=${prefix}${textStart}${textEnd}${suffix}`; console.log(url); }

  4. Aug 2022
  5. May 2022
    1. We use the Web Annotation Protocol to sync bookmarks and last reading position across devices. At a glance it covers all the use cases here, and it's a well-defined protocol with multiple independent implementations. In particular, WAP defines a relation for discovery. Here's how we link to the annotation endpoint for a specific book in an OPDS 1.2 feed. Note the distinctive link relation and media type:
    1. A Canonical Fragment Identifier (CFI) is a similar construct to these, but expresses a location within an EPUB Publication. For example:

      book.epub#epubcfi(/6/4[chap01ref]!/4[body01]/10[para05]/3:10)

  6. Apr 2022
    1. IMAP URL for text fragment

      ``` The URL: <imap://minbari.example.org/gray-council;UIDVALIDITY=385759045/; UID=20/;PARTIAL=0.1024>

      may result in the following client commands and server responses:

      <connect to minbari.example.org, port 143> S: * OK [CAPABILITY IMAP4rev1 STARTTLS AUTH=ANONYMOUS] Welcome C: A001 AUTHENTICATE ANONYMOUS S: + C: c2hlcmlkYW5AYmFieWxvbjUuZXhhbXBsZS5vcmc= S: A001 OK Welcome sheridan@babylon5.example.org C: A002 SELECT gray-council <client verifies the UIDVALIDITY matches> C: A003 UID FETCH 20 BODY.PEEK[]<0.1024> ```

      ABNF: abnf partial-range = number ["." nz-number] ; partial FETCH. The first number is ; the offset of the first byte, ; the second number is the length of ; the fragment.

  7. May 2021
    1. What I am attempting to do is to highlight a div with a certain id, when It has been referred to by an anchor on another page IE: User clicks link href="qw.html#test", when the page is loaded, then the div with the id="test" is highlighted so that the user can see it clearly.
    2. You need to use the :target pseudo-class: :target { background-color: #ffa; }