8,037 Matching Annotations
  1. Aug 2022
    1. Annotator Requirements Annotation client should be able to: handle targets for both canonical document URLs and versioned document URLs associate annotation with their specific versioned document URL establish whether the document server supports the Memento protocol, or whether there is an appropriate third-party Memento server (such as the Wayback Machine) which does store previous versions of the document negotiate datetimes with the Memento server for retrieving the correct version of the document in the case of a third-party Memento server, request that the service make a snapshot of the document at the time of annotation
    1. ```js // Fetch and return the promise with the abort controller as controller property function fetchWithController(input, init) { // create the controller let controller = new AbortController() // use the signal to hookup the controller to the fetch request let signal = controller.signal // extend arguments init = Object.assign({signal}, init) // call the fetch request let promise = fetch(input, init) // attach the controller promise.controller = controller return promise }

      // and then replace a normal fetch with

      let promise = fetchWithController('/') promise.controller.abort() ```

    1. ```html

      <figure> black dog smiling in the sun <figcaption>Maggie loves being outside off-leash.</figcaption> </figure>

      css figure:has(figcaption) { background: white; padding: 0.6rem; } ```

    1. Sanitizing iframes

      ```html

      <iframe id="webpage"></iframe>

      <br/> <button onclick="sanitize()">Sanitize</button>

      <script> function sanitize() { // Create a sanitizer object with the default config const sanitizer = new Sanitizer(); // Find the iframe node const iframe = document.getElementById('webpage'); // Sanitize the iframe's document node const sanitizedFrameNodes = sanitizer.sanitize(iframe.contentWindow.document); iframe.replaceChildren(sanitizeFrameNodes); } </script>

      ```

    1. In line with the much-requested (and long-longed-for) feature of highlights in different colors (an exhaustive list given in #198), I would like to suggest allowing (automatic) coloring of highlights based on tags with designated patterns (like code:critiques, code:non-ergodicity in psychology, etc.), or alternatively, all tags (i.e., without specific patterns).
    1. handled5 what the receiver does with the content is (wisely) out of scope suggestions for two patterns: reply: specify atom thr:in-reply- to mention: include rel="mentioned"

      ```xml

      <entry xmlns='http://www.w3.org/2005/Atom'> <id>tag:example.com,2009:cmt-0.44775718</id> <author> <name>test@example.com</name <uri>bob@example.com</uri> </author> <thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' ref='tag:blogger.com,1999:blog-893591374313312737.post-3861663258538857954'> tag:blogger.com,1999:blog-893591374313312737.post-3861663258538857954</thr:in-reply-to> <content>Salmon swim upstream!</content> <title>Salmon swim upstream!</title> <updated>2009-12-18T20:04:03Z</updated> </entry> ```

    1. And in our case, we want it to keep track of our storage object. So let's also create a usePeristentContext hook.

      ```js import { useMutation, useQuery, useQueryClient } from 'react-query';

      export default function usePersistentContext(key) { const queryClient = useQueryClient();

      const { data } = useQuery(key, () => localStorage.getItem(key));

      const { mutateAsync: setValue } = useMutation( (value) => localStorage.setItem(key, value), { onMutate: (mutatedData) => { const current = data; queryClient.setQueryData(key, mutatedData); return current; }, onError: (_, __, rollback) => { queryClient.setQueryData(key, rollback); }, } );

      return [data, setValue]; } ```

      js function SetContext() { const [value, setValue] = usePersistentContext('item_context'); return ( <button onClick={() => setValue(value === 'on' ? 'off' : 'on')}> Click me {value} </button> ); }

    1. PWAs as URL Handlers was part of the capabilities project and support for the experimental url_handlers manifest member, documented below, is being phased out. The url_handlers manifest member is being replaced by the new handle_links manifest member, which is currently being standardized and implemented.
    1. The setHTML() method of the Element interface is used to parse and sanitize a string of HTML and then insert it into the DOM as a subtree of the element. It should be used instead of Element.innerHTML for inserting untrusted strings of HTML into an element.

      ```js const unsanitized_string = "abc <script>alert(1)<" + "/script> def"; // Unsanitized string of HTML const sanitizer1 = new Sanitizer(); // Default sanitizer;

      // Get the Element with id "target" and set it with the sanitized string. document.getElementById("target").setHTML(unsanitized_string, {sanitizer: sanitizer1});

      // Result (as a string): "abc def" ```

    1. Example BIMI records

      This is an example BIMI record that includes a VMC. This record includes 2 example URLs :

      This is an example BIMI record that doesn’t use a VMC. Make sure to replace the example URL with the URL for your own SVG file location.

      v=BIMI1;l=https://images.solarmora.com/brand/bimi-logo.svg