• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

cantino/selectorgadget: Go go CSS / DOM inspection.

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

cantino/selectorgadget

开源软件地址:

https://github.com/cantino/selectorgadget

开源编程语言:

HTML 52.4%

开源软件介绍:

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




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
ent/ent: An entity framework for Go发布时间:2022-06-13
下一篇:
mongodb/mongo-go-driver: The Go driver for MongoDB发布时间:2022-06-13
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap