• This repository has been archived on 24/Jan/2018
  • Stars
    star
    155
  • Rank 232,407 (Top 5 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 12 years ago
  • Updated over 10 years ago

Reviews

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

Repository Details

See what your jQuery code does inside like a boss.

jQuery-inlog (v 1.0.0)

See what your jQuery code does inside like a boss. jQuery-inlog is a passive plugin, which injects (js ftw!) console.log calls inside your jQuery core. It makes debugging of selectors and chains a breeze. No more alert($obj.length) and stuff...

I call it black-box magic. Or short: black magic. Or even shorter: js

The original idea was taken from https://github.com/fmsf/jQueryLog

Works in any Browser with a decent console (Opera for example doesn't know about "%o" format string). I personally think the output reads best on Firebug.

If you use jQuery-inlog I'd be very interested to hear from you! https://twitter.com/Prinzhorn

Example

Imagine the following markup

<body>
	<div class="bar">
		<div class="bar">
			<div id="foo"></div>
		</div>
	</div>
	<div id="bacon"></div>
</body>

and the following jQuery calls

$l(true);
$("#foo").parents(".bar").next().prev().parent().fadeOut();
$l(false);

will result in the following output with default settings

$("#foo") β†· [div#foo]
parents(".bar") β†· [div.bar, div.bar]
next() β†· [div#bacon]
prev() β†· [div.bar]
parent() β†· [body]
fadeOut() β†· [body]

or if you want to know what's really happening, set maxDepth: -1 (last branch expanded exemplarily)

+ $("#foo") β†· [div#foo]
+ parents(".bar") β†· [div.bar, div.bar]
+ next() β†· [div#bacon]
+ prev() β†· [div.bar]
+ parent() β†· [body]
- fadeOut() β†· [body]
	- animate(Object { opacity="hide"}) β†· [body]
		- queue("fx", g()) β†· [body]
			- each(function()) β†· [body]
				- is(":hidden") β†· false
				- matchesSelector(<body style="opacity: 0.920047;">, ":hidden") β†· false
					  isXML(<body style="opacity: 0.920047;">) β†· false
					  isXML(Document index.html) β†· false
					- filter(":hidden", [body]) β†· []
						isXML(<body style="opacity: 0.920047;">) β†· false

or even verbose with thisValue: true

+ (Window index.html).$("#foo") β†· [div#foo]
+ ([div#foo]).parents(".bar") β†· [div.bar, div.bar]
+ ([div.bar, div.bar]).next() β†· [div#bacon]
+ ([div#bacon]).prev() β†· [div.bar]
+ ([div.bar]).parent() β†· [body]
- ([body]).fadeOut() β†· [body]
	- ([body]).animate(Object { opacity="hide"}) β†· [body]
		- ([body]).queue("fx", g()) β†· [body]
			- ([body]).each(function()) β†· [body]
				- ([body]).is(":hidden") β†· false
				- (function()).matchesSelector(<body style="opacity: 0.920047;">, ":hidden") β†· false
					  (function()).isXML(<body style="opacity: 0.920047;">) β†· false
					  (function()).isXML(Document index.html) β†· false
					- (function()).filter(":hidden", [body]) β†· []
						(function()).isXML(<body style="opacity: 0.920047;">) β†· false

or if you're hardcore, you can set rawOutput: true to get the raw stackt race object created by the plugin

arguments
	[".bar"]

function
	"parents"

this
	[div#foo]

sub
	[Object { function="matches", arguments=[2], sub=[2], more...}, Object { function="pushStack", this=[1], arguments=[3], more...}]

return
	[div.bar, div.bar]

Documentation / Reference

Include jquery.inlog.js after jQuery core and enable it by calling $l(true) or $l(options).

Note: $l is an alias for jQuery.inlog. If for any reason window.$l is already defined, it won't be overwritten.

Options:

var defaults = {
	enabled: false,//Enable logging
	thisValue: false,//Output this-value
	returnValue: true,//Output return-value
	indent: true,//Indent nested calls (makes sense for maxDepth !== 0)
	maxDepth: 0,//Max depth of nested calls
	rawOutput: false//If true, the raw stack trace objects will be printed (thisValue, returnValue and indent are all included for free)
};

More Repositories

1

skrollr

Stand-alone parallax scrolling library for mobile (Android + iOS) and desktop. No jQuery. Just plain JavaScript (and some love).
HTML
18,543
star
2

skrollr-menu

skrollr plugin for hash navigation
HTML
283
star
3

skrollr-stylesheets

Allows separation of skrollr keyframes and the document
JavaScript
231
star
4

skrollr-ie

skrollr plugin that adds some missing features to IE < 9
JavaScript
65
star
5

scrollmeister

Open-source JavaScript framework to declaratively build scrolling experiences
JavaScript
37
star
6

youtube-iframe

Wrapper for dynamically loading the YouTube iframe api script
HTML
24
star
7

delayed-css-drop-down

CSS ONLY drop down menu which closes after short delay
20
star
8

better-svelte-virtual-list

Proper opinionated implementation of a virtual scrolling list for equal-height items in Svelte.
Svelte
16
star
9

cloud-metadata-services

List of metadata service endpoints for different cloud providers for your pentesting needs.
14
star
10

jquery-mobile-less-themes

Create jQuery Mobile themes using less.js (INACTIVE)
14
star
11

0

lightbox (as in light beer) script in almost 0 (981) bytes
JavaScript
13
star
12

twitter-widgets

Wrapper for dynamically loading the Twitter widgets script (follow button, embedded tweets etc.)
HTML
9
star
13

lazy-fingers

Client side text search for lazy people. Similar to Sublime Text's fuzzy search.
JavaScript
9
star
14

zipsprite

Reduce HTTP requests by packing binary assets into a zip and accessing them via Blob URLs directly from memory
JavaScript
7
star
15

skrollr-path

Just an empty repo. Check back soon. Or don't.
JavaScript
7
star
16

mongoose-encrypt

Transparent encryption for Mongoose fields with built-in password migration
JavaScript
6
star
17

js1k-love-entry

My love themed js1k entry
JavaScript
3
star
18

trawler

Express middleware to troll bots. A combination of "trolling" and "crawler", also a boat for catching a lot of fish. Gotta catch 'em all.
JavaScript
3
star
19

nicenshtein

Efficiently index and search a dictionary by Levenshtein distance
Go
2
star
20

minimal-csp

A minimal Content-Security-Policy to get started with
2
star
21

create-object-url

Normalize URL.createObjectURL, webkitURL.createObjectURL and don't crash older browsers
JavaScript
2
star
22

crog

Dead simple image cropping UI
JavaScript
1
star
23

nicenshtein-server

HTTP server for Nicenshtein
Go
1
star
24

moment-objectid

Format a moment instance as ObjectId-string for use in MongoDB queries
JavaScript
1
star
25

node-solr-synonyms

Parse Solr/ElasticSearch synonyms files into JavaScript objects
JavaScript
1
star