导航栏: 首页 评论列表

页面上有用到的所有CSS

默认分类 2017/11/02 23:57

代码如下:

var result = [];
[].forEach.call(document.styleSheets, function(item1) {
  if (item1.cssRules) {
    [].forEach.call(item1.cssRules, function(item2) {
      var sign = false
      if (!item2.selectorText) sign = false
      else if (document.querySelector(item2.selectorText)) sign = true
      else {
        var str = String(item2.selectorText).replace(/\:+[^:\,]*/ig, '')
        try { if (document.querySelector(str)) sign = true } catch (e) {console.log(e)}
        var list = str.split(',')
        list.forEach(function (item3) {
          try { if (document.querySelector(item3)) sign = true } catch (e) {console.log(e)}
        })
      }
      if (sign) result.push(item2.cssText)
    })
  } else {
    console.log('[crossorigin="anonymous"]: ' + item1.href)
  }
});
result;
var out = document.getElementById('out')
if (!out) {
  document.body.insertAdjacentHTML('afterEnd', '<div id="out">123</b>')
  out = document.getElementById('out')
}
out.innerHTML = result.join('')

http://www.runoob.com/bootstrap/bootstrap-modal-plugin.html

https://ant.design/components/modal-cn/


>> 留言评论