spmbt / cssob

A JavaScript Inject that reads all your linked CSS files and tuns them into a readable, mutable object.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cssob

A JavaScript Inject that reads all your linked and inline stylesheets and turns them into a readable, mutable object.

installation

Insert script after your CSS links. Script will compose a global object constucted of all your defined rules.

Use:

Retrive information

console.log(cssob[cssSelector].height); 
    //logs hight set by provided asosiated CSS selector rule.

Set information

cssob[cssSelector].backgroundColor = 'yellow';  
      //Sets elements that match the selector's background to yellow.  

Additional API

listProps()

Returns an array with all the available css properties and methods from the queried cssob object.
cssob['string cssSelector'].listProps();

Example


<style> .clear{clear: both; height: 0; display: block} </style> <sciprt> var clearClassProperties = cssob['.clear'].listProps(); console.log(clearClassProperties); //logs ["clear", "height", "display"] amung other available operations (some browser specific) </script>

About

A JavaScript Inject that reads all your linked CSS files and tuns them into a readable, mutable object.