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

css-browser

v0.0.4

Published

CSS Browser Selector is a very small javascript which empowers CSS selectors. <br />You can now write code for: browser, browser version, platform, platform version, device, device version. <br />Best part: no more hacks; all compliant code. <br />More

Downloads

25

Readme

CSS Browser

A complete library for identifying browsers by css selectors

Add hosted js file to your web site application:

<script src="https://raw.githubusercontent.com/ceelsoin/css-browser/master/publish/lib/browser-selector-min.js"></script>

or add in your application with npm:

npm i css-browser

...or download complete libary:

https://github.com/ceelsoin/css-browser/archive/master.zip

Example

It's easy!

You are in:

mozilla/5.0 (windows nt 6.1; win64; x64) applewebkit/537.36 (khtml, like gecko) chrome/71.0.3578.98 safari/537.36

...and made it with this:

<style type="text/css"> .ie .example {  background-color: yellow } .ie7 .example {  background-color: orange } .gecko .example {  background-color: gray } .win.gecko .example {  background-color: red } .linux.gecko .example {  background-color: pink } .opera .example {  background-color: green } .konqueror .example {  background-color: blue } .safari .example {  background-color: black } .chrome .example {  background-color: cyan } .no_js { display: block } .has_js { display: none } .js .no_js { display: none }. js .has_js { display: block }</style>

Basically defining it should set according to:

  • Internet Explorer: Yellow
  • Internet Explorer 7: Orange
  • Gecko Engine on Windows (Firefox, Mozilla, Camino): Red
  • Gecko Engine on Linux (Firefox, Mozilla, Camino): Pink
  • Gecko Engine on Other OS (Firefox, Mozilla, Camino): Gray
  • Opera: Green
  • Konqueror: Blue
  • Safari: Black
  • Chrome: Cyan

Using

It's easy!

Set CSS attributes with the code of each browser/os you want to hack

  • html.gecko div#header { margin: 1em; }
  • .opera #header { margin: 1.2em; }
  • .ie .mylink { font-weight: bold; }
  • .mac.ie .mylink { font-weight: bold; }
.[os].[browser] .mylink { font-weight: bold; } /*without space between .[os] and .[browser]*/

Avaliable OS Codes [os]:

  • .win - Microsoft Windows (all versions)
  • .vista - Microsoft Windows Vista new
  • .linux - Linux (x11 and linux)
  • .mac - Mac OS
  • .freebsd - FreeBSD
  • .ipod - iPod Touch
  • .iphone - iPhone
  • .ipad - iPad new
  • .webtv - WebTV
  • .j2me - J2ME Devices (ex: Opera mini) changed from mobile to j2me
  • .blackberry - BlackBerry new
  • .android - Google Android new
  • .mobile - All mobile devices new

Avaliable Browser Codes [browser]

  • .ie - Internet Explorer (All versions)
  • .ie8 - Internet Explorer 8.x
  • .ie7 - Internet Explorer 7.x
  • .ie6 - Internet Explorer 6.x
  • .ie5 - Internet Explorer 5.x
  • .gecko - Mozilla, Firefox (all versions), Camino
  • .ff2 - Firefox 2
  • .ff3 - Firefox 3
  • .ff3_5 - Firefox 3.5
  • .ff3_6 - Firefox 3.6 new
  • .opera - Opera (All versions)
  • .opera8 - Opera 8.x
  • .opera9 - Opera 9.x
  • .opera10 - Opera 10.x
  • .konqueror - Konqueror
  • .webkit or safari - Safari, NetNewsWire, OmniWeb, Shiira, Google Chrome
  • .safari3 - Safari 3.x
  • .chrome - Google Chrome
  • .iron - SRWare Iron

Extra codes:

  • .js - Will be available when js is enable, so you can show/hide some stuffs
Happy Hacking!

Made with <3 in Vila Isabel - RJ