• Stars
    star
    991
  • Rank 46,212 (Top 1.0 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 16 years ago
  • Updated almost 2 years ago

Reviews

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

Repository Details

Go go CSS / DOM inspection.

SelectorGadget

SelectorGadget is an open source bookmarklet that makes CSS selector generation and discovery on complicated sites a breeze.

Please visit http://www.selectorgadget.com to try it out.

Technologies

Features

Remote interface

SelectorGadget can be extended for use in custom workflows with a remote interface that replaces the standard display and controls.

To define a remote interface, create a JavaScript file with any functionality you need, and append any relevant controls to SelectorGadget's UI container. Here's a simple example:

// sg_interface.js

var SG = window.selector_gadget

// Add field to display current selection (note the use of jQuerySG, 
// SelectorGadget's jQuery alias).
var path = jQuerySG('<input>', { id: 'sg-status', class: 'selectorgadget_ignore' })
SG.sg_div.append(path)
SG.path_output_field = path.get(0)

// Add button to dismiss SelectorGadget
var btnOk = jQuerySG('<button>', { id: 'sg-ok', class: 'selectorgadget_ignore' }).text('OK')
SG.sg_div.append(btnOk)
jQuerySG(btnOk).bind('click', function(event) {
  jQuerySG(SG).unbind()
  jQuerySG(SG.sg_div).unbind()
  SG.unbindAndRemoveInterface()
  SG = null
})

// Watch the input field for changes
var val = saved = path.val()
var tid = setInterval(function() {
  val = path.val()
  if(saved != val) {
    console.log('New path', val, 'matching', (jQuerySG(val).length), 'element(s)')
    saved = val
  }
}, 50)

Set the path to the remote interface in SelectorGadget's sg_options object prior to instantiation, like this:

window.sg_options = {
  remote_interface: '/path/to/sg_interface.js'
}

window.selector_gadget = new SelectorGadget()
// ...

Local Development

Compiling

Start by installing development dependencies with

bundle

and then run

guard

to watch and regenerate SelectorGadget's .coffee and .scss files.

Testing

SelectorGadget is tested with jasmine. With guard running, open spec/SpecRunner.html in your browser to run the tests. (On a Mac, just do open spec/SpecRunner.html)

To manually test during local development, open spec/test_sites/bookmarklet_local.html and use that local bookmarklet on the contents of spec/test_sites.

Bitdeli Badge

More Repositories

1

mcfly

Fly through your shell history. Great Scott!
Rust
5,564
star
2

ruby-readability

Port of arc90's readability project to Ruby
Ruby
902
star
3

reckon

Flexibly import bank account CSV files into Ledger for command-line accounting
Ruby
411
star
4

my_obfuscate

Standalone Ruby code for the selective re-writing of SQL dumps in order to protect user privacy.
Ruby
88
star
5

browser-friend

GPT in your browser
TypeScript
84
star
6

walker_method

A Ruby implementation of Walker's Alias Method for quickly sampling from an array with a given probability distribution
Ruby
71
star
7

twitter_to_csv

Dump the Twitter stream to JSON and CSV, then apply filters, reject non-English content, do sentiment analysis, and more.
Ruby
64
star
8

post_location

An iOS application that POSTs your location to a webhook of your choosing.
Ruby
53
star
9

jsoneditor

JavaScript widget for inline JSON editing
JavaScript
46
star
10

expando

A jQuery plugin for text that grows on you
HTML
44
star
11

chrome_pipe

A Chrome extension experiment with JavaScript UNIXy pipes
JavaScript
30
star
12

ruby_on_ruby

An unholy amalgam of therubyracer's V8 engine and emscripted-ruby to allow a truly sandboxed Ruby-on-Ruby environment.
Ruby
25
star
13

heroku-selectable-procfile

A Heroku Buildpack that allows Procfile selection by environmental variable. Chain it using https://github.com/ddollar/heroku-buildpack-multi
Shell
17
star
14

airtable-ml

Neural network-based Airtable Block for automatic prediction & classification
TypeScript
16
star
15

guess_html_encoding

A small gem that attempts to guess and then force encoding of HTML documents for Ruby 1.9
Ruby
10
star
16

rquad

Ruby Quadtree Library
Ruby
9
star
17

ideamachine

IdeaMachine - A generative grammar for fun and profit
Ruby
5
star
18

threeve

Bringing Ruby's math into the 21st century
Ruby
3
star
19

huginn_xero_agent

Huginn Agent for Xero invoice creation
Ruby
3
star
20

confabulator

Ruby generative grammer for conversational text
Ruby
2
star
21

andrewcantino.com

My personal website
HTML
2
star
22

feature_set

Ruby
2
star
23

active_record_record

Record ActiveRecord's Record Allocation
Ruby
1
star
24

blog.andrewcantino.com

The source of my Jekyll-powered blog
HTML
1
star