GitXplorerGitXplorer
h

jquery-annotate

public
0 stars
0 forks
0 issues

Commits

List of commits on branch master.
Verified
b9331f34458a017715451df5b4d26bc320e8d0f6

actually write a readme

hhiebj committed 6 years ago
Verified
0ee7d4f7f794ad866b1a39bc47252053d50f1674

fix bug that has been here for 3 years

hhiebj committed 6 years ago
Verified
213bbd54fa6a1685ddcde5ef7f60b3d3d3b993a6

fix bug that has been here for 3 years

hhiebj committed 6 years ago
Verified
a6adbdaa4da82040b340b4d7bf46feefdf577a4b

fix bug that has been here for 3 years

hhiebj committed 6 years ago
Verified
0d472f16be4a7ec4cfba28cdb2c983d34e5993af

add details screenshot

hhiebj committed 6 years ago
Verified
cb0b17c67e41cc6d1ce250fa2fff33658bd72726

add screenshot

hhiebj committed 6 years ago

README

The README file for this repository.

jquery-annotate

Quick jQuery plugin that will highlight and describe selected elements on a page. This is useful mostly for taking screenshots of existing pages.

Can be injected into the inspector as a "one-liner" by copy-pasting the contents of oneline.js into the console.

Subsequently, you can select and annotate various elements by selecting the targets with jQuery and running the plugin, passing options if necessary. The default annotation styles create a border and floating pills identifying the tag types of the annotated elements. When hovered, the floating pills will show additional details about the element. When clicked, the floating pills will "toggle" the details for that element, keeping it rendered on mouseout:

details screenshot

Example

When the following is input into the console (after oneline.js has been injected), various sections of this github repository will be visually annotated, resulting in the screenshot below:

$('.repohead-details-container, .overall-summary, .file-wrap, .markdown-body').annotate({ pseudoEls: true })

annotated screenshot

API

The plugin adds two functions to the jQuery object.

$.fn.annotate
Applies annotation styles to the selected elements. Accepts a config object with the following options:

{
  /**
   * changes the text that is rendered into the pill for the given `this` element.
   * defaults to `${tagName}#${id}`
   */
  annotationRenderer: (this: jQuery) => string
  /**
   * changes the text that is rendered into the hovering "details" pane on mouseover.
   * defaults to several layout properties from getComputedStyle().
   * an easy alternative would be `JSON.stringify(window.getComputedStyle(this), null, 2)`.
   * note that because I didn't use portals, the details pane renders as a logical child of the annotated element, so you'll have to scroll. sorry.
   */
  detailsRenderer: (this: jQuery) => string
  /**
   * indicates whether to highlight pseudo-elements or not.
   * defaults to false
   */
  pseudoEls: boolean
}

**`$.fn.clearAnnotations`**
Clears all annotation styles from the selected elements. Takes no parameters.