(function(){
var tags = document.getElementsByTagName('style');
var out = document.getElementById("css");
var outObj = {};
var outCollection = [];
for (var i=0; i < tags.length; i++) {
if(tags[i].getAttribute('type') == "text/shikiri"){
var token = tags[i].innerHTML.split(/[\{}]+/);
//console.log(token);
for (var n=0; n < token.length; n++) {
var token_ = trim(token[n]);
if(token_.length == 0){
//new grouping of css
out.innerHTML += "";
}else{
//nested css
//if a colon is found then it is a property
if(token_.trim().indexOf(';') > 0){
var inner = token_.trim().split(";");
for (var x=0; x < inner.length; x++) {
if(inner[x].indexOf(':') >0){
var props = inner[x].split(':');
var name = props[0];
var value = props[1].trim();
outObj[name] = value;
}else{
console.log('inner selector', inner[x]);
}
}
out.innerHTML += "inner prop: " + token_.trim() + "<br>";
}else {
outObj = {'selector':token_.trim()};
outCollection.push(outObj);
//otherwise it is a selector token
out.innerHTML += "new selector:" + token_.trim() + "<br>";
}
}
}
};
}
console.log(outCollection);
// remove multiple, leading or trailing spaces
function trim(s) {
s = s.replace(/(^\s*)|(\s*$)/gi,"");
s = s.replace(/[ ]{2,}/gi," ");
s =...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.