npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

page-diff

v1.0.0

Published

a new kernel of page-monitor https://github.com/fouber/page-monitor

Downloads

14

Readme

a new kernel of page-monitor

Usage

var pdiff = require('page-diff');

API

pdiff.walk(options)

generate dom tree snapshot, run at webpage.

var pdiff = require('page-diff');
var options = { /* see below */ };
var page = require('webpage').create();
page.open(url, function(){
    var tree = page.evaluate(pdiff.walk, options);
    console.log(tree);
});

options:

  • root

    • desc: selector of root element
    • type: String
    • default: body
  • invisibleElements

    • desc: invisible elements tag name

    • type: Array

    • default:

      [
          "applet", "area", "audio", "base", "basefont",
          "bdi", "bdo", "big", "br", "center", "colgroup",
          "datalist", "form", "frameset", "head", "link",
          "map", "meta", "noframes", "noscript", "optgroup",
          "option", "param", "rp", "rt", "ruby", "script",
          "source", "style", "title", "track", "xmp"
      ]
  • ignoreChildrenElements

    • desc: ignore childnodes elements tag name

    • type: Array

    • default:

      [
          "img", "canvas", "input", "textarea", "audio",
          "video", "hr", "embed", "object", "progress",
          "select", "table"
      ]
  • styleFilters

    • desc: the style properties which are invisible

    • type: Array

    • default:

      [
          "margin-left", "margin-top", "margin-right", "margin-bottom",
          "border-left-color", "border-left-style", "border-left-width",
          "border-top-color", "border-top-style", "border-top-width",
          "border-right-color", "border-right-style", "border-right-width",
          "border-bottom-color", "border-bottom-style", "border-bottom-width",
          "border-top-left-radius", "border-top-right-radius",
          "border-bottom-left-radius", "border-bottom-right-radius",
          "padding-left", "padding-top", "padding-right", "padding-bottom",
          "background-color", "background-image", "background-repeat",
          "background-size", "background-position",
          "list-style-image", "list-style-position", "list-style-type",
          "outline-color", "outline-style", "outline-width",
          "font-size", "font-family", "font-weight", "font-style", "line-height",
          "box-shadow", "clear", "color", "display", "float", "opacity", "text-align",
          "text-decoration", "text-indent", "text-shadow", "vertical-align", "visibility",
          "position"
      ]
  • attributeFilters

    • desc: the attributes of element which make an unique identification

    • type: Array

    • default:

      [ 'id', 'class' ]
  • excludeSelectors

    • desc: the selectors of exclude elements
    • type: Array|String
    • default: []
  • ignoreTextSelectors

    • desc: the selectors of elements whose text changes be ignored
    • type: Array|String
    • default: []
  • ignoreStyleSelectors

    • desc: the selectors of elements whose style changes be ignored
    • type: Array|String
    • default: []

pdiff.diff(left, right, opt)

calc the difference between two versions of walk results

var pdiff = require('page-diff');
var options = { /* see below */ };
var page = require('webpage').create();
page.open(url1, function(){
    var left = page.evaluate(pdiff.walk, walkOpt);
    page.open(url2, function(){
        var right = page.evaluate(pdiff.walk, walkOpt);
        var ret = pdiff.diff(left, right, diffOpt);
        console.log(ret);
    });
});

options:

  • priority
    • desc: the logic of LCS,head or tail
    • type: String
    • default: head