返回

record test code for svn sources

 

 

var abc = function() {
    var fbtg = document.getElementsByClassName('ft-bg');
    if (fbtg.length > 0) {
        for (var i=0;i<fbtg.length;i++) {
          fbtg[i].parentNode.removeChild(fbtg[i]);
        }
    }
    var newEle = document.createElement('div');
    newEle.setAttribute('style', 'background:gray;width:100%;height:10000px;position:absolute;top:0px;left:0px;');
    newEle.setAttribute('class', 'ft-bg');
    var c = '';
    var a = document.getElementsByTagName('a');
    for (var i=0; i < a.length; i++) {
      var temp = a[i].innerHTML;
      var houzhui = ['.png','.jpg','.jpeg'];
      var hasHouzhui = false;
      for (var j=0; j < houzhui.length; j++) {
        if (temp.indexOf(houzhui[j]) != -1) {
           hasHouzhui = true;
         }
      }
      if (hasHouzhui) {
        c += '<a href="'+a[i].innerHTML+'"><img style="width:40px;" src="'+a[i].innerHTML+'"/></a>';
      }
    }
    newEle.innerHTML = c;
    var body = document.getElementsByTagName('body');
    //console.info(newEle, body[0]);
    body[0].appendChild(newEle);
    return 'run success';
};
abc();

 

posted @ 2019-03-13 11:06  feige_hunter  阅读(122)  评论(0编辑  收藏  举报