()
| 1508 | } |
| 1509 | |
| 1510 | function process(){ |
| 1511 | var downloadBtn; |
| 1512 | if(isHttps && (downloadBtn=document.querySelector("div#post-toolbar-download-count-container"))){ |
| 1513 | var t=function(){ |
| 1514 | if(downloadBtn.innerHTML=="<!-- react-empty: 1 -->"){ |
| 1515 | var downloadContent=document.createElement("a"); |
| 1516 | downloadContent.href=window.location.protocol+"//"+window.location.host+"/download?id="+window.location.pathname.split("/").pop(); |
| 1517 | downloadContent.innerHTML+='<div class="tx"><span><i class="fa fa-cloud-download"></i></span>\u4e0b\u8f7d</div>'; |
| 1518 | downloadBtn.appendChild(downloadContent); |
| 1519 | }else if(downloadBtn.innerHTML===""){ |
| 1520 | setTimeout(t,100); |
| 1521 | } |
| 1522 | }; |
| 1523 | setTimeout(t,100); |
| 1524 | } |
| 1525 | var content=document.querySelector(contentArea); |
| 1526 | if(content){ |
| 1527 | processObj(content); |
| 1528 | } |
| 1529 | var link, imgs, i, k; |
| 1530 | setTimeout(function(){ |
| 1531 | if (document.querySelectorAll) { |
| 1532 | link = document.querySelectorAll('a'); |
| 1533 | imgs = document.querySelectorAll('img'); |
| 1534 | } else { |
| 1535 | link = document.getElementsByTagName('a'); |
| 1536 | imgs = document.getElementsByTagName('img'); |
| 1537 | } |
| 1538 | for (i = 0, k = link.length; i < k; i++) { |
| 1539 | let target=link[i]; |
| 1540 | target.addEventListener("mousedown", function(){ |
| 1541 | if(/baidu.com/i.test(target.href)&&!/(?:eyun|tieba)\.baidu\.com/i.test(target.href)&&!/#/i.test(target.href)){ |
| 1542 | if(/\/storage-download/.test(location.href)){ |
| 1543 | var pass=target.parentNode.parentNode.querySelector('input.pwd'); |
| 1544 | if(pass&&pass.id.indexOf("download-pwd")!=-1)target.href=target.href.split("#")[0]+'#'+pass.value; |
| 1545 | } else if(curSite.downloadUrl && curSite.downloadUrl.test(location.href) && curSite.getDownPass){ |
| 1546 | curSite.getDownPass(target); |
| 1547 | } else if(codeRule.test(target.textContent)){ |
| 1548 | target.href+='#'+extCode(target); |
| 1549 | } else if(/^\s*[a-z\d]{4}\s*$/i.test(target.textContent)){ |
| 1550 | target.href+='#'+target.textContent.trim(); |
| 1551 | } else if(target.nextSibling&&codeRule.test(target.nextSibling.textContent)){ |
| 1552 | target.href+=/#/i.test(target.href)?extCode(target.nextSibling):('#'+extCode(target.nextSibling)); |
| 1553 | } else if(target.nextSibling&&/^\s*[a-z\d]{4}\s*$/.test(target.nextSibling.textContent)){ |
| 1554 | target.href+='#'+target.nextSibling.textContent.trim(); |
| 1555 | } else if(codeRule.test(target.parentNode.textContent)){ |
| 1556 | if(!/#\S+/i.test(target.href)) target.href+=/#/i.test(target.href)?extCode(target.parentNode):('#'+extCode(target.parentNode)); |
| 1557 | } else { |
| 1558 | var j = 0, |
| 1559 | maxParent = 5, |
| 1560 | parent = target; |
| 1561 | while(j<maxParent) { |
| 1562 | j++; |
| 1563 | parent = parent.parentNode; |
| 1564 | if(parent.tagName=="TR") { |
| 1565 | if(codeRule.test(parent.nextElementSibling.textContent)) { |
| 1566 | parent=parent.nextElementSibling; |
| 1567 | target.href+='#'+extCode(parent); |
no test coverage detected