| 24 | |
| 25 | // 修改为新标签页打开 |
| 26 | function targetBlank() { |
| 27 | document.head.appendChild(document.createElement('base')).target = '_blank'; // 让所有链接默认以新标签页打开 |
| 28 | Array.from(document.links).forEach(function (_this) { // 排除特殊链接 |
| 29 | if (_this.onclick || _this.href.slice(0,4) != 'http' || _this.getAttribute('href').slice(0,1) === '#') { |
| 30 | _this.target = '_self' |
| 31 | } |
| 32 | }) |
| 33 | document.querySelectorAll('form').forEach(function (_this) { // 排除 form 标签 |
| 34 | if (!_this.target) {_this.target = '_self'} |
| 35 | }); |
| 36 | } |
| 37 | |
| 38 | |
| 39 | // 针对 Discuz! 论坛的帖子 |