All Projects → kartikprabhu → marginalia

kartikprabhu / marginalia

Licence: MIT license
javascript implementation of annotations using fragmention

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to marginalia

Compass
Compass is a GPS tracking server that stores data in flat files.
Stars: ✭ 105 (+262.07%)
Mutual labels:  indieweb
SMMT
Social Media Mining Toolkit (SMMT) main repository
Stars: ✭ 116 (+300%)
Mutual labels:  annotation
TransPi
TransPi – a comprehensive TRanscriptome ANalysiS PIpeline for de novo transcriptome assembly
Stars: ✭ 18 (-37.93%)
Mutual labels:  annotation
KCommando
Annotation-based multifunctional command handler framework for JDA & Javacord.
Stars: ✭ 26 (-10.34%)
Mutual labels:  annotation
evidenceontology
Evidence & Conclusion Ontology development site: Use ISSUES to request terms. See WIKI for how to request terms. See README for how to cite ECO. Visit our website for more project info.
Stars: ✭ 35 (+20.69%)
Mutual labels:  annotation
labelCloud
A lightweight tool for labeling 3D bounding boxes in point clouds.
Stars: ✭ 264 (+810.34%)
Mutual labels:  annotation
greek scansion
Python library for automatic analysis of Ancient Greek hexameter. The algorithm uses linguistic rules and finite-state technology.
Stars: ✭ 16 (-44.83%)
Mutual labels:  annotation
app-old
A Micropub client in pre-production for the IndieWeb.
Stars: ✭ 32 (+10.34%)
Mutual labels:  indieweb
data-mediator
a data mediator framework bind callbacks for any property
Stars: ✭ 66 (+127.59%)
Mutual labels:  annotation
EveReader
Epub Reader, focused on annotation.
Stars: ✭ 68 (+134.48%)
Mutual labels:  annotation
iw26
IW26 is an Indieweb Fork of WordPress Twenty Sixteen Theme
Stars: ✭ 25 (-13.79%)
Mutual labels:  indieweb
Sweet.apex
Next Generation of Apex Development
Stars: ✭ 43 (+48.28%)
Mutual labels:  annotation
shade
Automatic code generation for the SharedPreferences operation.
Stars: ✭ 26 (-10.34%)
Mutual labels:  annotation
neofeed-theme
A personal feed for Neocities, GitHub Pages, or anywhere else, built with Hugo. #IndieWeb friendly and all yours. It's better than Twitter.
Stars: ✭ 62 (+113.79%)
Mutual labels:  indieweb
indieweb-components
VanillaJS-based Web Components for the IndieWeb
Stars: ✭ 13 (-55.17%)
Mutual labels:  indieweb
XRay
X-Ray returns structured data from any URL
Stars: ✭ 80 (+175.86%)
Mutual labels:  indieweb
image-sorter2
One-click image sorting/labelling script
Stars: ✭ 65 (+124.14%)
Mutual labels:  annotation
immutables-vavr
Immutables encodings for Vavr
Stars: ✭ 32 (+10.34%)
Mutual labels:  annotation
asap
A scalable bacterial genome assembly, annotation and analysis pipeline
Stars: ✭ 47 (+62.07%)
Mutual labels:  annotation
indieweb-post-kinds
adds support for responding to and interacting with other sites using the standards developed by the Indieweb Community
Stars: ✭ 39 (+34.48%)
Mutual labels:  indieweb

Marginalia

Marginalia (or annotations) are comments addressed to a particular part of a webpage (or blog post) instead of the entire page. This is a javascript to implement an indieweb-style marginalia system using fragmention. See example post using this code: Marginalia

Customisation

The script has a few variables in the beginning that you can set to customise some of the HTML added by marginalia.js. These are:

CONTAINER_EXTRA_CLASS is a space-separated string of classes you want to add to the container of the marginalia. defaults to "" empty string.

BTN_EXTRA_CLASS is a space-separated string of classes you want to add to the button toggling the marginlaia. defaults to "" empty string.

BTN_HTML_SHOW is the HTML inside the button element when marginalia is hidden. defaults to "<span>Show</span>".

BTN_HTML_HIDE is the HTML inside the button element when marginalia is visible. defaults to "<span>Hide</span>".

Usage Example

The marginalia script uses certain mark-up in the HTML to identify marginalia. The container for all comments should have an id=response-list while each marginalia-comment element should have a data attribute containing the fragmention. The next example uses the custom variables CONTAINER_EXTRA_CLASS = "my-container" and BTN_EXTRA_CLASS = "my-button":

<article>
	<p>One morning, when Gregor Samsa woke from troubled dreams, he found
himself transformed in his bed into a horrible vermin.  He lay on
his armour-like back, and if he lifted his head a little he could
see his brown belly, slightly domed and divided by arches into stiff
sections.  The bedding was hardly able to cover it and seemed ready
to slide off any moment.  His many legs, pitifully thin compared
with the size of the rest of him, waved about helplessly as he
looked.</p>

	<p>"What's happened to me?" he thought.  It wasn't a dream.  His room,
a proper human room although a little too small, lay peacefully
between its four familiar walls.  A collection of textile samples
lay spread out on the table - Samsa was a travelling salesman - and
above it there hung a picture that he had recently cut out of an
illustrated magazine and housed in a nice, gilded frame.  It showed
a lady fitted out with a fur hat and fur boa who sat upright,
raising a heavy fur muff that covered the whole of her lower arm
towards the viewer.</p>

	<ol id="response-list">
		<li>This is a normal comment.</li>
		<li data-fragmention="##Samsa+woke+from+troubled+dreams">This is a marginalia-comment.</li>
	</ol>
</article>

On execution, the marginalia.js moves the marginalia-comments right after the appropriate element inside a container of the same tag name (in this case ol) with class="marginalia-list"

<ol class="marginalia-list my-container">
	<li data-fragmention="##Samsa+woke+from+troubled+dreams">This is a marginalia-comment.</li>
</ol>

It also adds a button to toggle marginalia visibility inside the referenced element. The button is marked up as:

<button class="marginalia-button my-button"><span>Show</span></button>

when the marginalia is hidden and with text "Hide" when marginalia are visible. So the relevant paragraph looks like this:

	<p>One morning, when Gregor Samsa woke from troubled dreams, he found
himself transformed in his bed into a horrible vermin.  He lay on
his armour-like back, and if he lifted his head a little he could
see his brown belly, slightly domed and divided by arches into stiff
sections.  The bedding was hardly able to cover it and seemed ready
to slide off any moment.  His many legs, pitifully thin compared
with the size of the rest of him, waved about helplessly as he
looked.<button class="marginalia-button my-button"><span>Show</span></button></p>
<ol class="marginalia-list my-container">
	<li data-fragmention="##Samsa+woke+from+troubled+dreams">This is a marginalia-comment.</li>
</ol>

On click the button adds an attribute data-marginalia-active to the parent element like so <p data-marginalia-active="">One morning, when Gregor Samsa...</p>

All styling can be done using these classes as CSS hooks.

Go forth

Now use this yourself and give feedback.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].