cssobj-helper-showcss
Show css text from style tag, style id, chrome dev tools, or cssobj result.
Install
- include in html
// showcss function is now available
- bookmarklet
In Chrome, press Ctrl+D, popup the favorite dialog, click Modify, paste in URL as below:
javascript:{"use strict";{return {if"string"==typeof t&&t=document"object"==typeof t&&t&&tcssdom&&t=tcssdomt=t||$0&&"STYLE"==ttagNamevar s=tsheet||tstyleSheet;ifscssTextreturn scssText;forvar n=""r=scssRules||srulesc=0o=rlength;c<o;c++n+=rccssText+"\n";return e?:console}}return e};
Usage
Then can show CSS in any <style>
tag:
// console.log the last selected style$0 // totally same as above'tagID' // alert style of tagID// write the css into htmldom// show css from cssobj, with each UPDATE
API
showcss (callback: (string)->any ) (source: dom|string|result|any) -> any
Display css text from source, and call callback with the text.
callback can be
-
empty: will use
console.log
as callback, means output css text into console. -
function: will call the function with
callback(str)
, and return the result
source can be
-
empty: last selected style tag from DevTools
-
string: style tag ID
-
dom: style tag dom
-
result: cssobj result object