• Stars
    star
    174
  • Rank 219,104 (Top 5 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 7 years ago
  • Updated over 2 years ago

Reviews

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

Repository Details

Dom inspect like chrome dev tools.

DomInspector

Dom inspector like chrome dev tools.

Usage

Install dom-inspector

npm install dom-inspector --save
<script type="text/javascript" src="./dist/dom-inspector.min.js"></script>
const DomInspector = require('dom-inspector');
import DomInspector from 'dom-inspector';

New instance

const inspector = new DomInspector();

Instance options

const inspector = new DomInspector({
	root: 'body',
	exclude: ['#exclude>div', document.querySelector('.exclude')],
  theme: 'you-custom-theme-class',
  maxZIndex: '', // max z index, if blank, will auto get document.all max z index
});
  • root

    Dom inspector root element. String or Dom, default body.

  • exclude

    Not inspect some elements. String or Dom Array.

  • theme

    Inspector overlay style. You can custom overlay background color as follow.

     .you-custom-theme-class .margin {
     	background-color: blue;
     }
    
     .you-custom-theme-class .border {
     	background-color: red;
     }
    
     .you-custom-theme-class .padding {
     	background-color: green;
     }
    
     .you-custom-theme-class .content {
     	background-color: gray;
     }

    Don`t forget background color opacity. ^_^

Attribute list

  • inspector.target

    Inspecting element.

API list

  • inspector.enable()

    Display overlay block and addEventListener mousemove.

  • inspector.pause()

    RemoveEventListener mousemove, pause inspector.

  • inspector.disable()

    RemoveEventListener mousemove, display overlay none.

  • inspector.destroy()

    disable() and remove overlay.

  • inspector.getXPath([ele])

    Return ele XPath.

  • inspector.getSelector([ele])

    Return ele selector.

    html>body>div:nth-of-type(9)

  • inspector.getElementInfo([ele])

     return {
     	top: '',
     	left: '',
     	width: '',
     	height: '',
     	'padding-top': '',
     	'padding-right': '',
     	'padding-bottom': '',
     	'padding-left': '',
     	'border-top-width': '',
     	'border-right-width': '',
     	'border-bottom-width': '',
     	'border-left-width': '',
     	'margin-top': '',
     	'margin-right': '',
     	'margin-bottom': '',
     	'margin-left': ''
     };

More Repositories

1

goh5

visual h5 edit
JavaScript
687
star
2

aliyun-ddns

借助阿里云解析的API实现DDNS
JavaScript
33
star
3

so

nodejs 代理实现的 谷歌搜索 镜像站点
HTML
21
star
4

countdown

js countdown
JavaScript
12
star
5

raspi-mirror

HTML
7
star
6

magicss

magicss
JavaScript
6
star
7

lottery

sina 2016 lottery for Annual General Meeting
JavaScript
6
star
8

vue-pagination

vue pagination
JavaScript
6
star
9

vue-spa-template

SPA template for vue
JavaScript
5
star
10

gulp-lithe

gulp plugin for lithe
JavaScript
4
star
11

audio-decode

amrnb.js example
HTML
4
star
12

AMP

Cool api manage platform!
JavaScript
4
star
13

ffmpeg-bilibili

bilibili 自动推流直播
JavaScript
4
star
14

cssLivePreview

css 实时预览
CSS
3
star
15

device-fingerprint

Browser device fingerprint
HTML
3
star
16

photolord

Photo management application based on web tech. Analyze the photos located on your local server, and provide various convenient ways to maintain the photos. Such as object recognition, face recognition, location mark, artificial label, then, you can use any keyword to search photo.
TypeScript
3
star
17

sublimeTextConfig

My Sublime Text 3 config
Python
2
star
18

awesome-pt

Awesome list for BitTorrent Private Tracker.
2
star
19

worker-cache

Control web cache use service worker
JavaScript
1
star
20

gugu-weather

print weather for my fairy.
JavaScript
1
star
21

pagination

angular pagination
JavaScript
1
star
22

IDEALIST

record idea, just do it
1
star
23

luoye-fe.github.io

Github Pages
HTML
1
star
24

decorator-redux

use react-redux more easy by decorator
TypeScript
1
star
25

cmd2app

Convert you command line client to electron app.
JavaScript
1
star
26

event

event on/emit/off/once
JavaScript
1
star
27

myhosts

自动更新hosts文件的小脚本
JavaScript
1
star
28

download-ebook

Download douban ebook, and generate it to .epub.
JavaScript
1
star
29

tinypng_img

tinypng API 压缩图片
JavaScript
1
star