• Stars
    star
    731
  • Rank 61,995 (Top 2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 11 years ago
  • Updated almost 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Voyeur is a tiny (1.2kb) Javascript library that lets you traverse and manipulate the DOM the way it should have been.

Voyeur

http://adriancooney.github.io/voyeur.js

Voyeur is a tiny (1.2kb) Javascript library that lets you traverse and manipulate the DOM the way it should have been. See here for a demo, more information and documentation.

Warning

Voyeur is a great concept but I highly recommend you avoid it in production. There is serious performance issues yet to be worked out. See here.

Example

<body>
	<div>
		<header>
			<h1 id="title"><em><a href="/">Hello world!</a></em></h1>
		</header>
		<section>
			<ul>
				<li class="item"><a href="#">Navigation Item</a></li>
				<li class="item"><a href="#">Navigation Item</a></li>
				<li class="item"><a href="#">Navigation Item</a></li>
				<li class="item"><a href="#">Navigation Item</a></li>
				<li class="item"><a href="#">Navigation Item</a></li>
			</ul>
		</section>
	</div>
</body>
//Lets get the title link
Voyeur.div.header.h1.em.a.href = "http://google.com"
Voyeur.find("#title").em.a.innerText = "New title!";

//Let's get those navigation items
Voyeur.div.section.ul.li.use(function(li, i) {
	li.a.innerText = "Link #" + i;
});

Voyeur.div.section.ul.li.eq(3).classList.add("Highlighted!");

//How about we create some content
var content = Voyeur.create.div
	.section.mult(5).p.em.use(function(em) {
		em.textContext = "Hello world!";
	});

Voyeur.div.appendChild(content);

Usage

Install via bower (courtesy of @pid)

bower install Voyeur

Install via component

component install dunxrion/voyeur.js

Include the script somewhere on the page.

<script type="text/javascript" src="Voyeur.min.js"></script>

Outside

Voyeur has managed to inspire a couple of other spin-off projects.

Todo

  • Make Voyeur handle DOMSubtreeModified DOM changes with MutationObserver.

License

MIT License

More Repositories

1

console.image

The one thing Chrome Dev Tools didn't need.
JavaScript
1,772
star
2

puppeteer-heap-snapshot

API and CLI tool to fetch and query Chome DevTools heap snapshots.
TypeScript
1,346
star
3

Taskfile

Repository for the Taskfile template.
Shell
336
star
4

aristochart

Sophisticated and simplified Javascript 2D line charts.
JavaScript
246
star
5

console.snapshot

An actual useful fork of the console.image. Snapshot the canvas and output it to the console.
JavaScript
164
star
6

node-sfx

Add some sound effects to your node programs.
JavaScript
70
star
7

polytunes

Liberate your music library.
JavaScript
38
star
8

tinyrequire

To the point dependency management.
JavaScript
33
star
9

SKImport

Design and import your SKPhysicsBodys with a fancy editor and loader class.
JavaScript
19
star
10

benchmartian

Run Javascript benchmarks from the CLI.
JavaScript
15
star
11

SKMech

SKMech is a set of handy utilities for SpriteKit.
Objective-C
13
star
12

jQPad

jQPad's official repository
JavaScript
12
star
13

movie-plots

Literal movie plots.
JavaScript
7
star
14

gulp-js1k

Gulp plugin for js1k.
JavaScript
7
star
15

redux-pending

Redux middleware for async actions with pending state.
JavaScript
6
star
16

tw

Teamwork CLI and Node.js API
JavaScript
6
star
17

gulp-cache-money

A gulp caching system that saves to disk.
JavaScript
6
star
18

boh

A simple, smart build tool.
JavaScript
4
star
19

Javascript-Improved

My take on improving some of Javascript's functionality
JavaScript
4
star
20

json.stringify2

A 112% faster implementation of a stripped down native JSON.stringify.
JavaScript
4
star
21

wrestle

A simple REST API testing framework that works in the browser or the command line.
JavaScript
4
star
22

prompt

TypeScript
3
star
23

instate

A application state manager built for React.
JavaScript
3
star
24

bindings

Official bindings for ยตWebSockets
C++
3
star
25

examist

Final Year Project for NUI Galway CS&IT 2016.
HTML
3
star
26

Image-Filters

Learning image filtering with Javascript's canvas
2
star
27

chat-api-client

Javascript API for Teamwork Chat.
JavaScript
2
star
28

prettyearth-wallpapers

A quick script to download wallpapers all the beautiful places on earth from Google Maps.
JavaScript
2
star
29

chromecoms

Making messaging between content and background scripts manageable.
JavaScript
2
star
30

offlog

A standalone static blog generator in your browser.
JavaScript
1
star
31

history-of-ufc-fighters

http://adriancooney.github.io/history-of-ufc-fighters
JavaScript
1
star
32

Canvas.js

(Yet another) canvas drawing library
JavaScript
1
star
33

spook

HTML 5 Game for CT404.
JavaScript
1
star
34

noodlebox

Javascript toolbox.
JavaScript
1
star
35

When.js

Simple user friendly event managing.
JavaScript
1
star
36

gibingo

TypeScript
1
star
37

HandleDeleteButton

A small library to dynamically handle the iOS keyboard delete/backspace button.
Objective-C
1
star
38

prone

CLI tool to await for services to be up.
JavaScript
1
star
39

ct326-programming

Java
1
star
40

chat-bot-poker

Sprint Planning Poker Chat Bot
JavaScript
1
star
41

koamotive

The Koa Express. A Koa-Express hybrid.
JavaScript
1
star
42

chat-bot

Chat Bots
JavaScript
1
star
43

machine-learning-data-mining

Machine Learning & Data Mining
Jupyter Notebook
1
star
44

Playwrite.js

Writing english to do stuff.
JavaScript
1
star
45

massmural

CT231 project code. Please don't try to break it.
JavaScript
1
star
46

hinge

Hinge - A web server framework for Node.js
JavaScript
1
star