├── .github
├── FUNDING.yml
└── ISSUE_TEMPLATE
│ └── ISSUE_TEMPLATE.md
├── LICENSE
├── README.md
├── csdngreener_greasyfork.user.js
└── csdngreener_openuserjs.user.js
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | custom: ['https://doc.stackoverflow.wiki/web/#/21?page_id=138']
2 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: 问题反馈
3 | about: 遇到了问题或有意见?
4 | title: ''
5 | labels: help wanted
6 | assignees: adlered
7 |
8 | ---
9 |
10 | > 加入 QQ 群 1042370453 可直接与作者沟通
11 |
12 | ### 请描述你遇到的问题:
13 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Adlered
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
' + saveButton + configHTML);
1209 |
1210 | /** 配置控制 **/
1211 | // 推荐内容
1212 | $(".blog-content-box").append("
");
1213 | $("#recommendSwitch:last").append('
' +
1214 | '
显示推荐内容
');
1215 | let recommendCookie = config.get("recommend", false);
1216 | if (!recommendCookie) {
1217 | $(".recommend-box").hide();
1218 | }
1219 | if (recommendCookie) {
1220 | $("#toggle-recommend-button").prop("checked", true);
1221 | $("#toggle-button").prop("checked", true);
1222 | } else {
1223 | $("#toggle-recommend-button").prop("checked", false);
1224 | $("#toggle-button").prop("checked", false);
1225 | }
1226 | config.listenButton("#toggle-recommend-button", "recommend",
1227 | function() {$(".recommend-box").slideDown(200);},
1228 | function() {$(".recommend-box").slideUp(200);});
1229 | config.listenButtonAndAction("#toggle-button", "recommend",
1230 | function() {$(".recommend-box").slideDown(200);},
1231 | function() {$(".recommend-box").slideUp(200);});
1232 |
1233 | // 显示小店
1234 | let shopCookie = config.get('shop',false);
1235 | if(!shopCookie){
1236 | $("#csdn-shop-window").hide();
1237 | $("#csdn-shop-window-top").hide();
1238 | }
1239 | if (shopCookie) {
1240 | $("#toggle-shop-button").prop("checked", true);
1241 | } else {
1242 | $("#toggle-shop-button").prop("checked", false);
1243 | }
1244 | config.listenButton("#toggle-shop-button", "shop",
1245 | function() {location.reload();},
1246 | function() {location.reload();});
1247 | // 侧栏小广告
1248 | let adCookie = config.get("ad", true);
1249 | if (adCookie) {
1250 | setTimeout(function() {
1251 | // $("#recommend-right").append('
');
1252 | }, 500);
1253 | }
1254 | if (adCookie) {
1255 | $("#toggle-ad-button").prop("checked", true);
1256 | } else {
1257 | $("#toggle-ad-button").prop("checked", false);
1258 | }
1259 | config.listenButton("#toggle-ad-button", "ad",
1260 | function() {location.reload();},
1261 | function() {location.reload();});
1262 | // 显示作者名片
1263 | let authorCardCookie = config.get("authorCard", true);
1264 | if (authorCardCookie) {
1265 | // 博主信息
1266 | $('#recommend-right').append($('#asideProfile').prop("outerHTML"));
1267 | setTimeout(function() {
1268 | $('#asideProfile').attr("style", "margin-top: 8px; width: 300px;");
1269 | }, 500);
1270 | }
1271 | if (authorCardCookie) {
1272 | $("#toggle-authorcard-button").prop("checked", true);
1273 | } else {
1274 | $("#toggle-authorcard-button").prop("checked", false);
1275 | }
1276 | config.listenButton("#toggle-authorcard-button", "authorCard",
1277 | function() {location.reload();},
1278 | function() {location.reload();});
1279 |
1280 | // 强制白色主题
1281 | let whiteThemeCookie = config.get("whiteTheme", false);
1282 | if (whiteThemeCookie) {
1283 | // 背景删除
1284 | $('.main_father').attr('style', 'background-image: none !important; background-color: #f5f6f7; background: #f5f6f7;');
1285 | $('[href^="https://csdnimg.cn/release/phoenix/template/themes_skin/"]').attr('href', 'https://csdnimg.cn/release/phoenix/template/themes_skin/skin-technology/skin-technology-6336549557.min.css');
1286 | $('#csdn-toolbar').removeClass('csdn-toolbar-skin-black');
1287 | $('.csdn-logo').attr('src', '//csdnimg.cn/cdn/content-toolbar/csdn-logo.png?v=20200416.1');
1288 | $('html').css('background-color', '#f5f6f7');
1289 | }
1290 | if (whiteThemeCookie) {
1291 | $("#toggle-whitetheme-button").prop("checked", true);
1292 | } else {
1293 | $("#toggle-whitetheme-button").prop("checked", false);
1294 | }
1295 | config.listenButton("#toggle-whitetheme-button", "whiteTheme",
1296 | function() {location.reload();},
1297 | function() {location.reload();});
1298 |
1299 | // 背景图
1300 | let backgroundImage = GM_getValue("backgroundImage", "");
1301 | if (backgroundImage !== "") {
1302 | $("#backgroundImgUrl").val(backgroundImage);
1303 | $(".main_father").attr('style', 'background-image:url(' + backgroundImage + ');background-attachment:fixed;background-size:100%;');
1304 | }
1305 | $('#backgroundImgUrl').on('input', function() {
1306 | GM_setValue("backgroundImage", $("#backgroundImgUrl").val());
1307 | });
1308 | $('#backgroundImgUrl').on('change', function() {
1309 | GM_setValue("backgroundImage", $("#backgroundImgUrl").val());
1310 | });
1311 | $("#upload_bg").on('change', function() {
1312 | let file = $("#upload_bg")[0].files[0];
1313 | let reader = new FileReader();
1314 | reader.onloadend = function (e) {
1315 | let base64 = e.target.result;
1316 | $('#backgroundImgUrl').val(base64);
1317 | $('#backgroundImgUrl').change();
1318 | }
1319 | reader.readAsDataURL(file);
1320 | });
1321 |
1322 | // 搜博主文章
1323 | let searchBlogCookie = config.get("searchBlog", false);
1324 | if(searchBlogCookie) {
1325 | $('#recommend-right').append($('#asideSearchArticle').prop("outerHTML"));
1326 | setTimeout(function() {
1327 | $('#asideSearchArticle').attr("style", "margin-top: 8px; width: 300px;");
1328 | var i = $("#search-blog-words")
1329 | , n = $(".btn-search-blog");
1330 | i.keyup(function(t) {
1331 | var n = t.keyCode;
1332 | if (13 == n) {
1333 | var e = encodeURIComponent(i.val());
1334 | if (e) {
1335 | var s = "//so.csdn.net/so/search/s.do?q=" + e + "&t=blog&u=" + username;
1336 | window.open(s)
1337 | }
1338 | }
1339 | });
1340 | n.on("click", function(t) {
1341 | var n = encodeURIComponent(i.val());
1342 | if (n) {
1343 | var e = "//so.csdn.net/so/search/s.do?q=" + n + "&t=blog&u=" + username;
1344 | window.open(e)
1345 | }
1346 | t.preventDefault()
1347 | });
1348 | }, 500);
1349 | }
1350 | if (searchBlogCookie) {
1351 | $("#toggle-searchblog-button").prop("checked", true);
1352 | } else {
1353 | $("#toggle-searchblog-button").prop("checked", false);
1354 | }
1355 | config.listenButton("#toggle-searchblog-button", "searchBlog",
1356 | function() {location.reload();},
1357 | function() {location.reload();});
1358 |
1359 | // 最新文章
1360 | let newArticleCookie = config.get("newArticle", false);
1361 | if (newArticleCookie) {
1362 | $('#recommend-right').append($('#asideNewArticle').prop("outerHTML"));
1363 | setTimeout(function() {
1364 | $('#asideNewArticle').attr("style", "margin-top: 8px; width: 300px;");
1365 | }, 0);
1366 | }
1367 | if (newArticleCookie) {
1368 | $("#toggle-newarticle-button").prop("checked", true);
1369 | } else {
1370 | $("#toggle-newarticle-button").prop("checked", false);
1371 | }
1372 | config.listenButton("#toggle-newarticle-button", "newArticle",
1373 | function() {location.reload();},
1374 | function() {location.reload();});
1375 |
1376 | // 热门文章
1377 | let hotArticleCookie = config.get("hotArticle", false);
1378 | if (hotArticleCookie) {
1379 | $('#recommend-right').append($("#asideHotArticle").prop("outerHTML"));
1380 | setTimeout(function() {
1381 | $('#asideHotArticle').attr("style", "margin-top: 8px; width: 300px;");
1382 | $('#asideHotArticle img').remove();
1383 | }, 0);
1384 | }
1385 | if (hotArticleCookie) {
1386 | $("#toggle-hotarticle-button").prop("checked", true);
1387 | } else {
1388 | $("#toggle-hotarticle-button").prop("checked", false);
1389 | }
1390 | config.listenButton("#toggle-hotarticle-button", "hotArticle",
1391 | function() {location.reload();},
1392 | function() {location.reload();});
1393 |
1394 | // 最新评论
1395 | let newCommentsCookie = config.get("newComments", false);
1396 | if (newCommentsCookie) {
1397 | $('#recommend-right').append($("#asideNewComments").prop("outerHTML"));
1398 | setTimeout(function() {
1399 | $('#asideNewComments').attr("style", "margin-top: 8px; width: 300px;");
1400 | $(".comment.ellipsis").attr("style", "max-height: none;");
1401 | $(".title.text-truncate").attr("style", "padding: 0");
1402 | }, 0);
1403 | }
1404 | if (newCommentsCookie) {
1405 | $("#toggle-newcomments-button").prop("checked", true);
1406 | } else {
1407 | $("#toggle-newcomments-button").prop("checked", false);
1408 | }
1409 | config.listenButton("#toggle-newcomments-button", "newComments",
1410 | function() {location.reload();},
1411 | function() {location.reload();});
1412 |
1413 | // 分类专栏
1414 | let kindPersonCookie = config.get("kindPerson", false);
1415 | if (!kindPersonCookie) {
1416 | setTimeout(function() {
1417 | $('#asideCategory').remove();
1418 | $('.kind_person').remove();
1419 | }, 0);
1420 | } else {
1421 | $('#recommend-right').append($("#asideCategory").prop("outerHTML"));
1422 | if ($("#asideCategory").length > 0) {
1423 | $('.kind_person').remove();
1424 | } else {
1425 | $('.kind_person').attr("style", "margin-top: 8px; width: 300px; height:255px;");
1426 | }
1427 | setTimeout(function() {
1428 | $('#asideCategory').attr("style", "margin-top: 8px; width: 300px; display:block !important;");
1429 | $("a.flexible-btn").click(function() {
1430 | $(this).parents('div.aside-box').removeClass('flexible-box');
1431 | $(this).parents("p.text-center").remove();
1432 | })
1433 | }, 500);
1434 | }
1435 | if (kindPersonCookie) {
1436 | $("#toggle-kindperson-button").prop("checked", true);
1437 | } else {
1438 | $("#toggle-kindperson-button").prop("checked", false);
1439 | }
1440 | config.listenButton("#toggle-kindperson-button", "kindPerson",
1441 | function() {location.reload();},
1442 | function() {location.reload();});
1443 |
1444 | // 目录
1445 | let contentCookie = config.get("content", true);
1446 | if (!contentCookie) {
1447 | setTimeout(function() {
1448 | $('.align-items-stretch.group_item').parent().remove();
1449 | }, 0);
1450 | }
1451 | if (contentCookie) {
1452 | $("#toggle-content-button").prop("checked", true);
1453 | } else {
1454 | $("#toggle-content-button").prop("checked", false);
1455 | }
1456 | config.listenButton("#toggle-content-button", "content",
1457 | function() {location.reload();},
1458 | function() {location.reload();});
1459 |
1460 | // 推荐文章
1461 | let recommendArticleCookie = config.get("recommendArticle", false);
1462 | if (!recommendArticleCookie) {
1463 | setTimeout(function() {
1464 | $('.recommend-list-box').remove();
1465 | }, 0);
1466 | } else {
1467 | setTimeout(function() {
1468 | $('.recommend-list-box').attr("style", "margin-top: 8px; width: 300px; height:255px;");
1469 | }, 0);
1470 | }
1471 | if (recommendArticleCookie) {
1472 | $("#toggle-recommendarticle-button").prop("checked", true);
1473 | } else {
1474 | $("#toggle-recommendarticle-button").prop("checked", false);
1475 | }
1476 | config.listenButton("#toggle-recommendarticle-button", "recommendArticle",
1477 | function() {location.reload();},
1478 | function() {location.reload();});
1479 |
1480 | // 归档
1481 | let archiveCookie = config.get("archive", false);
1482 | if (!archiveCookie) {
1483 | setTimeout(function() {
1484 | $('#asideArchive').remove();
1485 | }, 0);
1486 | } else {
1487 | $('#recommend-right').append($("#asideArchive").prop("outerHTML"));
1488 | setTimeout(function() {
1489 | $('#asideArchive').attr("style", "margin-top: 8px; width: 300px; display:block !important;");
1490 | }, 500);
1491 | }
1492 | if (archiveCookie) {
1493 | $("#toggle-archive-button").prop("checked", true);
1494 | } else {
1495 | $("#toggle-archive-button").prop("checked", false);
1496 | }
1497 | config.listenButton("#toggle-archive-button", "archive",
1498 | function() {location.reload();},
1499 | function() {location.reload();});
1500 |
1501 | // 自动靠左平铺
1502 | let autoSizeCookie = config.get("autoSize", false);
1503 | if (autoSizeCookie) {
1504 | setInterval(function () {
1505 | // 文章宽度自适应
1506 | if (window.innerWidth < 1100) {
1507 | // 删除原有响应式样式
1508 | $(".main_father").removeClass("justify-content-center");
1509 | $("article").width(window.innerWidth - 150);
1510 | GM_addStyle(`
1511 | main{
1512 | width: auto!important;
1513 | float: none!important;
1514 | max-width: 90vw;
1515 | }
1516 | main article img{
1517 | margin: 0 auto;
1518 | max-width: 100%;
1519 | object-fit: cover;
1520 | }
1521 | `);
1522 | did = true;
1523 | } else {
1524 | if (did === true) {
1525 | $("article").removeAttr("style");
1526 | did = false;
1527 | }
1528 | }
1529 | }, 500);
1530 | }
1531 | if (autoSizeCookie) {
1532 | $("#toggle-autosize-button").prop("checked", true);
1533 | } else {
1534 | $("#toggle-autosize-button").prop("checked", false);
1535 | }
1536 | config.listenButton("#toggle-autosize-button", "autoSize",
1537 | function() {location.reload();},
1538 | function() {location.reload();});
1539 |
1540 | // 自动隐藏顶栏
1541 | let autoHideToolbarCookie = config.get("autoHideToolbar", true);
1542 | if (autoHideToolbarCookie) {
1543 | $(window).scroll(function() {
1544 | if (document.documentElement.scrollTop > 100) {
1545 | let scrollS = $(this).scrollTop();
1546 | if (scrollS >= windowTop) {
1547 | $('#csdn-toolbar').slideUp(100);
1548 | windowTop = scrollS;
1549 | } else {
1550 | $('#csdn-toolbar').slideDown(100);
1551 | windowTop = scrollS;
1552 | }
1553 | }
1554 | });
1555 | }
1556 | if (autoHideToolbarCookie) {
1557 | $("#toggle-autohidetoolbar-button").prop("checked", true);
1558 | } else {
1559 | $("#toggle-autohidetoolbar-button").prop("checked", false);
1560 | }
1561 | config.listenButton("#toggle-autohidetoolbar-button", "autoHideToolbar",
1562 | function() {location.reload();},
1563 | function() {location.reload();});
1564 |
1565 | // 自动隐藏底栏
1566 | let autoHideBottomBarCookie = config.get("autoHideBottomBar", true);
1567 | if (autoHideBottomBarCookie) {
1568 | $("#toolBarBox .left-toolbox").css({
1569 | position: "relative",
1570 | left: "0px",
1571 | bottom: "0",
1572 | width: $("#toolBarBox").width() + "px"
1573 | });
1574 | $(window).scroll(function() {
1575 | $("#toolBarBox .left-toolbox").css({
1576 | position: "relative",
1577 | left: "0px",
1578 | bottom: "0",
1579 | width: $("#toolBarBox").width() + "px"
1580 | })
1581 | });
1582 | }
1583 | if (autoHideBottomBarCookie) {
1584 | $("#toggle-autohidebottombar-button").prop("checked", true);
1585 | } else {
1586 | $("#toggle-autohidebottombar-button").prop("checked", false);
1587 | }
1588 | config.listenButton("#toggle-autohidebottombar-button", "autoHideBottomBar",
1589 | function() {location.reload();},
1590 | function() {location.reload();});
1591 |
1592 | // 创作中心按钮
1593 | let writeBlogCookie = config.get("writeBlog", true);
1594 | if (!writeBlogCookie) {
1595 | $(".toolbar-btn-write").remove();
1596 | }
1597 | if (writeBlogCookie) {
1598 | $("#toggle-writeblog-button").prop("checked", true);
1599 | } else {
1600 | $("#toggle-writeblog-button").prop("checked", false);
1601 | }
1602 | config.listenButton("#toggle-writeblog-button", "writeBlog",
1603 | function() {location.reload();},
1604 | function() {location.reload();});
1605 |
1606 | // 右侧滚动条
1607 | /** setTimeout(function () {
1608 | let rightSideHeight = 0;
1609 | let pageHeight = $(window).height();
1610 | rightSideHeight += getHeight($('.align-items-stretch.group_item').parent());
1611 | rightSideHeight += getHeight($("#asideProfile"));
1612 | rightSideHeight += getHeight($("#asideSearchArticle"));
1613 | rightSideHeight += getHeight($("#asideNewArticle"));
1614 | rightSideHeight += getHeight($("#asideHotArticle"));
1615 | rightSideHeight += getHeight($("#asideNewComments"));
1616 | rightSideHeight += getHeight($("#asideCategory"));
1617 | rightSideHeight += getHeight($("#asideArchive"));
1618 | console.debug("Right side total height: " + rightSideHeight);
1619 | console.debug("Page height: " + pageHeight);
1620 | if (rightSideHeight > pageHeight) {
1621 | $('#recommend-right').css("overflow", "scroll");
1622 | }
1623 | }, 1500); */
1624 | } else if (num === 7) {
1625 | $(".me_r")[1].remove();
1626 | } else if (num === 8) {
1627 | /* $(".article-bar-top").append("
");
1628 | $(".article-bar-top").append($(".aside-box-footerClassify").children("dd").html());
1629 | $("dl").each(function (index, element) {
1630 | var key = $(this).children("dt");
1631 | var value = $(this).children("dd").children("span");
1632 | if (key.html().indexOf("原创") != -1) {
1633 | key = $(this).children("dt").children("a")
1634 | value = $(this).children("dd").children("a").children("span");
1635 | addInfo(key, value);
1636 | } else
1637 | if (value.html() != undefined) {
1638 | addInfo(key, value);
1639 | }
1640 | } );
1641 | function addInfo(key, value) {
1642 | var bind = key.html() + " " + value.html() + " ";
1643 | $(".article-bar-top").append(bind + " ");
1644 | } */
1645 | $(".blog_container_aside").remove();
1646 | $(".toolbox-left > .profile-attend").remove();
1647 |
1648 | // 标题消息提醒去除
1649 | let title = document.title.replace(/^\(.*?\)/g, "");
1650 | document.title = title;
1651 | // 评论复制按钮
1652 | $('.comment-box').prepend('');
1653 | $('.new-opt-box.new-opt-box-bg').prepend('
复制评论 ');
1654 | $('.btn-copy').click(function() {
1655 | var clipboard = new ClipboardJS('.comment-hidden-text');
1656 | clipboard.on('success', function(e) {
1657 | console.info('Action:', e.action);
1658 | console.info('Text:', e.text);
1659 | console.info('Trigger:', e.trigger);
1660 | e.clearSelection();
1661 | $('.btn-copy').html('成功');
1662 | setTimeout(function() {
1663 | $('.btn-copy').html('复制评论');
1664 | }, 1000);
1665 | });
1666 | clipboard.on('error', function(e) {
1667 | console.error('Action:', e.action);
1668 | console.error('Trigger:', e.trigger);
1669 | $('.btn-copy').html('失败,请手动复制');
1670 | setTimeout(function() {
1671 | $('.btn-copy').html('复制评论');
1672 | }, 1000);
1673 | });
1674 | $(".comment-hidden-text").click();
1675 | clipboard.destroy();
1676 | });
1677 | } else if (num === 9) {
1678 | // 删除CSDN LOGO悬浮后的二维码
1679 | $(".toolbar-subMenu > img").parent().remove();
1680 | }
1681 | }, 100);
1682 | progressor.incProgress(10);
1683 | }
1684 |
1685 | function showTips() {
1686 | var config = {
1687 | content: "欢迎使用 CSDNGreener,绿化设定按钮在这里!
好的,以后不再提示我 ",
1688 | type: "html",
1689 | alignTo: ["bottom", "right"],
1690 | trigger: "show",
1691 | isclose: false,
1692 | color: ["#B2E281", "#B2E281"]
1693 | };
1694 | $("#greenerSettings").showTips(config);
1695 | }
1696 |
1697 | function getHeight(element) {
1698 | let outerHeight = element.outerHeight();
1699 | if (outerHeight === null) {
1700 | return 0;
1701 | }
1702 | return outerHeight;
1703 | }
1704 |
1705 | function isFirefox() {
1706 | return navigator.userAgent.indexOf("Firefox") > 0;
1707 | }
1708 |
--------------------------------------------------------------------------------
/csdngreener_openuserjs.user.js:
--------------------------------------------------------------------------------
1 | // ==UserScript==
2 | // @author AdlerED
3 | // @copyright 2020, adlered https://stackoverflow.wiki
4 | // @icon https://csdnimg.cn/public/favicon.ico
5 | // @homepageURL https://github.com/adlered/CSDNGreener
6 | // @supportURL https://github.com/adlered/CSDNGreener/issues/new?assignees=adlered&labels=help+wanted&template=ISSUE_TEMPLATE.md&title=
7 | // @contributionURL https://doc.stackoverflow.wiki/web/#/21?page_id=138
8 | // @name 最强的老牌脚本CSDNGreener:CSDN广告完全过滤、人性化脚本优化
9 | // @namespace https://github.com/adlered
10 | // @version 4.2.3
11 | // @description 全新4.0版本!拥有数项独家功能的最强CSDN脚本,不服比一比|无需登录CSDN,获得比会员更佳的体验|背景图自定义,模块化卡片,显示什么你决定|分辨率自适配,分屏不用滚动|超级预优化|独家原创文章免登录展开|独家推荐内容自由开关|独家免登录复制|独家防外链重定向|独家论坛未登录自动展开文章、评论|全面净化|沉浸阅读|净化剪贴板
12 | // @connect www.csdn.net
13 | // @include *://*.csdn.net/*
14 | // @require https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery-cookie/1.4.1/jquery.cookie.min.js
15 | // @require https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/nprogress/0.2.0/nprogress.min.js
16 | // @require https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/clipboard.js/2.0.10/clipboard.min.js
17 | // @updateURL https://github.com/adlered/CSDNGreener/raw/master/csdngreener_openuserjs.user.js
18 | // @grant GM_addStyle
19 | // @grant GM_setValue
20 | // @grant GM_getValue
21 | // @license AGPL-3.0-or-later
22 | // @antifeature ads CSDNGreener 脚本中嵌入了可一键永久关闭的小广告,不会影响您的使用体验:) 请放心安装!
23 | // @note 24-03-28 4.2.3 跟随更新
24 | // @note 23-12-21 4.2.2 修复了一些已知问题
25 | // @note 23-12-16 4.2.1 文章页牛皮癣优化
26 | // @note 23-12-15 4.2.0 优化顶栏显示内容,修复了若干由于CSDN前端变化导致优化失效的问题
27 | // @note 23-05-25 4.1.9 再次修复免登录复制无法使用的问题
28 | // @note 23-05-11 4.1.8 强杀变异型登录框弹出(不影响自己点击登录使用)
29 | // @note 23-05-10 4.1.7 增强免登录复制功能
30 | // @note 23-04-11 4.1.6 去广告更新
31 | // @note 23-04-06 4.1.5 新增: 跳过 CSDN 的 link 页面
32 | // @note 23-04-04 4.1.4 增加ads标识
33 | // @note 23-03-30 4.1.3 移除统计代码,登录问题相关优化(只屏蔽一次)
34 | // @note 23-02-03 4.1.2 修复了无法登录的问题(评论不登录无法加载暂无解决方案,我们在持续努力中)
35 | // @note 22-05-30 4.1.1 功能修复,广告屏蔽
36 | // @note 22-01-18 4.1.0 代码折叠适配
37 | // @note 22-01-05 4.0.9 更新广告
38 | // @note 21-12-12 4.0.8 屏蔽学生认证
39 | // @note 21-10-21 4.0.7 屏蔽红包雨
40 | // @note 21-09-24 4.0.6 修复登录弹窗无法彻底去除的问题
41 | // @note 21-09-20 4.0.5 增加自定义背景功能
42 | // @note 21-09-13 4.0.4 增加一个没有收钱的广告(在设置里,不影响体验)
43 | // @note 21-09-01 4.0.3 增加用户使用情况统计模块
44 | // @note 21-08-25 4.0.2 修复右侧置顶栏按钮消失的问题
45 | // @note 21-08-21 4.0.1 去除右侧悬浮栏,优化脚本
46 | // @note 21-08-20 4.0.0 全新4.0发布!UI美化,代码优化,兼容Firefox,更多排版模式
47 | // @note 21-08-20 3.5.7 修复无法完整复制、保存csdn的网页会跳转首页的问题
48 | // @note 21-08-19 3.5.6 自动隐藏底栏功能改为始终隐藏底栏
49 | // @note 21-08-18 3.5.5 修复无法选择复制的问题
50 | // @note 21-06-17 3.5.4 去除右侧红包悬浮窗
51 | // @note 21-04-18 3.5.3 增加显示小店的设定
52 | // @note 21-03-13 3.5.2 去主页广告,去文章页面推荐内容Title
53 | // @note 21-03-01 3.5.1 修改文案
54 | // @note 21-02-06 3.5.0 修复上传资源界面标签选择消失的问题
55 | // @note 21-01-17 3.4.9 删除文章页和论坛广告,暂时停用右侧栏滚动功能(CSDN限制)
56 | // @note 21-01-15 3.4.8 保存按钮优化,修复显示创作中心按钮功能失效的问题
57 | // @note 21-01-15 3.4.7 改进脚本细节,增加广告屏蔽能力,修复绿化按钮错位的问题
58 | // @note 20-12-25 3.4.6 主页部分嵌入式广告删除
59 | // @note 20-12-18 3.4.5 修复绿化设定按钮排版不正确的问题
60 | // @note 20-12-15 3.4.4 修复了某些子页显示不正常的问题
61 | // @note 20-10-23 3.4.3 适应新版CSDN,去除主页和登录页广告,以及登录提示,并移除底部信息
62 | // @note 20-10-20 3.4.2 删除右侧广告
63 | // @note 20-09-26 3.4.1 修改排版设定,修复登录框弹出的问题
64 | // @note 20-09-24 3.4.0 紧急修复由于CSDN前端样式修改导致设定开关丢失的问题
65 | // @note 20-08-27 3.3.9 紧急修复由于CSDN前端样式修改导致脚本失效的问题
66 | // @note 20-08-26 3.3.8 合法脚本提示
67 | // @note 20-07-20 3.3.7 修复菜单栏在创作中心显示异常的问题
68 | // @note 20-07-18 3.3.6 工具箱按钮优化
69 | // @note 20-07-05 3.3.5 评论复制功能交互优化
70 | // @note 20-07-04 3.3.4 修复右侧栏消失的问题
71 | // @note 20-07-03 3.3.3 新增复制评论功能!删除顶部广告
72 | // @note 20-06-28 3.3.2 提示修改
73 | // @note 20-06-27 3.3.1 弹窗提示逻辑修改为仅提示一次。
74 | // @note 20-06-27 3.3.0 网站标题新消息提醒去除
75 | // @note 20-06-24 3.2.9 控制台文字可以点击了,修改自动版式描述语义
76 | // @note 20-06-24 3.2.8 屏幕尺寸选择,控制台版式修改,若干问题修复
77 | // @note 20-06-23 3.2.7 右侧栏滚动条显示方式优化
78 | // @note 20-06-23 3.2.6 文章居中模式可选
79 | // @note 20-06-22 3.2.5 右侧没有可显示内容时,文章居中
80 | // @note 20-06-22 3.2.4 文章居中
81 | // @note 20-06-22 3.2.3 右侧栏加入滚动条,脚本主页URL修改,下载页和主页广告去除
82 | // @note 20-06-22 3.2.2 Dark Reader兼容模式,自动隐藏顶栏优化,热门文章和最新评论卡片布局调整
83 | // @note 20-06-21 3.2.1 脚本迁移版本迭代
84 | // @note 20-06-21 3.1.9 增加自动隐藏底栏功能
85 | // @note 20-06-21 3.1.8 增加自动隐藏顶栏功能,修复选项窗口被点赞长条挡住的Bug,选项窗口布局修改
86 | // @note 20-06-20 3.1.7 设置窗口大小固定,增加打赏入口
87 | // @note 20-06-19 3.1.6 显示推荐内容按钮回归,新布局紧急修复
88 | // @note 20-06-18 3.1.5 自定义功能更新
89 | // @note 20-06-16 3.1.4 支持大部分功能模块化显示
90 | // @note 20-06-14 3.1.3 绿化设定优化
91 | // @note 20-06-14 3.1.2 ISSUE模板调整Support URL
92 | // @note 20-06-14 3.1.1 增加搜博主文章模块
93 | // @note 20-06-13 3.1.0 修复设置过期的问题
94 | // @note 20-06-12 3.0.9 标题回滚
95 | // @note 20-06-12 3.0.8 主页广告删除,绿化设置仅显示在文章页面,删除页脚,顶部优化,若干细节优化
96 | // @note 20-06-11 3.0.7 增加官方QQ交流群,增加关闭强制白色主题功能
97 | // @note 20-06-11 3.0.6 用户名片功能优化
98 | // @note 20-06-11 3.0.5 优化加载速度
99 | // @note 20-06-10 3.0.4 修复设置界面遮挡的问题,显示博主头像
100 | // @note 20-06-09 3.0.3 默认设定修改
101 | // @note 20-06-09 3.0.2 修复推荐内容按钮刷新不生效的问题,增加工具箱提示框
102 | // @note 20-06-08 3.0.1 设置中心推出!增加浏览效果选项 && Green Book Icon Update
103 | // @note 20-06-08 3.0.0 设置中心推出!增加浏览效果选项
104 | // @note 20-06-07 2.4.2 设置解耦,下个版本搞配置中心
105 | // @note 20-06-06 2.4.1 修复文章内容消失的问题
106 | // @note 20-06-04 2.4.0 修复推荐按钮错位的问题
107 | // @note 20-06-04 2.3.9 窄屏适配优化
108 | // @note 20-06-04 2.3.8 黑夜模式出现问题,紧急回档到 2.3.6
109 | // @note 20-06-03 2.3.7 感谢 @AlexLWT 增加黑暗模式
110 | // @note 20-06-02 2.3.6 AdsByGoogle 删除
111 | // @note 20-05-25 2.3.5 感谢 @RyanIPO 修复 Cannot read property 'replace' of undefined 报错的问题
112 | // @note 20-05-24 2.3.4 修复免登录复制功能
113 | // @note 20-05-22 2.3.3 Logo与背景同步
114 | // @note 20-05-22 2.3.2 深度删除背景
115 | // @note 20-05-20 2.3.1 通过require使用NProgress
116 | // @note 20-05-20 2.3.0 显示推荐内容按钮样式内置,剔除CDN
117 | // @note 20-05-17 2.2.9 进度条样式更新,时间延时优化
118 | // @note 20-05-17 2.2.8 更新脚本描述,展开评论的所有回复,删除创作中心按钮,加载进度条
119 | // @note 20-05-17 2.2.7 更新脚本描述
120 | // @note 20-05-16 2.2.6 修复第一次点击显示推荐内容无反应的问题
121 | // @note 20-05-16 2.2.5 删除抢沙发角标,修改显示推荐内容按钮样式
122 | // @note 20-05-16 2.2.4 感谢来自GitHub的朋友“HeronZhang”的Issue建议,删除所有博客花里胡哨的背景,主页分类中广告清除,CSS样式控制宽度适配代码优化
123 | // @note 20-05-16 2.2.3 感谢来自GitHub的朋友“RetiredWorld”的代码贡献,使用CSS来控制样式,而不是JS,增大灵活性。
124 | // @note 20-05-13 2.2.2 屏蔽您的缩放不是100%的提示
125 | // @note 20-04-29 2.2.1 感谢大家的支持,增加目录显示,自动判断是否存在目录调整页面宽度,屏蔽新增广告,欢迎大家体验并提出意见!
126 | // @note 20-04-15 2.2.0 一些广告被其他插件屏蔽导致的异常无视之
127 | // @note 20-03-30 2.1.9 干掉“记录你的创作历程”,干掉未登录情况下的角标提醒
128 | // @note 20-03-13 2.1.8 窄屏适配加强
129 | // @note 20-03-13 2.1.7 更新简介
130 | // @note 20-03-12 2.1.6 宽度自适应(感谢来自GitHub的朋友LeonG7的建议)!修复剪贴板净化无效的问题。
131 | // @note 20-03-04 2.1.5 适配AdGuard
132 | // @note 20-02-27 2.1.4 优化免登录复制
133 | // @note 20-02-25 2.1.3 免登录复制更新,现已可用
134 | // @note 20-02-24 2.1.2 By Github@JalinWang 更改去除剪贴板劫持的方式,使得原文格式在复制时能够保留
135 | // @note 20-02-22 2.1.1 紧急修复由于 CSDN 修改前端结构导致的文章错位
136 | // @note 20-02-11 2.1.0 若干动画优化,视觉体验更流畅
137 | // @note 20-02-06 2.0.9 武汉加油!修改推荐内容切换开关位置,减少违和感
138 | // @note 20-01-17 2.0.8 去除右侧广告
139 | // @note 20-01-17 2.0.7 感谢来自GitHub的朋友“gleans”的建议,去掉页头广告
140 | // @note 19-12-12 2.0.6 感谢来自GitHub的朋友“yexuesong”的建议,将作者信息在文章顶部展示
141 | // @note 19-10-30 2.0.5 美化隐藏按钮,增加点击动画
142 | // @note 19-10-30 2.0.4 删除CSDN官方在主页推送的文章(大多是广告)
143 | // @note 19-10-30 2.0.3 添加更多屏蔽脚本
144 | // @note 19-10-30 2.0.0 祝自己生日快乐~完全重写CSDNGreener,统一使用JQuery,效率更高
145 | // @note 19-10-27 1.5.2 删除分享海报提示&&感谢GitHub的朋友“CHN-STUDENT”的反馈,去除底部课程推荐
146 | // @note 19-10-27 1.5.1 感谢来自GitHub的朋友“CHN-STUDENT”的细致复现反馈,去除了底部的课程推荐广告
147 | // @note 19-10-04 1.5.0 移除了底部主题信息和打赏
148 | // @note 19-09-10 1.4.9 感谢来自GitHub的朋友“programmerZe”的细致复现反馈,修复了评论区点击查看回复后,已经展开的评论会收起的问题
149 | // @note 19-09-04 1.4.8 感谢来自GitHub的朋友“dwdcth”的细致复现反馈,现在查看原创文章不会无限弹登录窗口了,且加强了自动展开功能
150 | // @note 19-08-20 1.4.7 感谢油叉用户“SupremeSir”的反馈,修复了右侧悬浮栏遮挡文章的问题
151 | // @note 19-08-14 1.4.6 无语。刚更新的免登录复制,又改了。修复!
152 | // @note 19-08-13 1.4.5 更新了独家功能:免登录复制
153 | // @note 19-08-13 1.4.4 感谢来自GitHub的朋友“iamsunxing”的反馈,修复了顶部不贴边的问题
154 | // @note 19-08-01 1.4.3 感谢油叉用户“ddddy”的反馈,去除了更多推广广告
155 | // @note 19-07-30 1.4.2 感谢油叉用户“周义杰”的反馈,增加了防CSDN外链重定向的功能(CSDN臭流氓)
156 | // @note 19-07-20 1.4.1 修复了推荐内容开关跨文章无效问题(忘了配置Cookie作用域)
157 | // @note 19-07-19 1.4.0 1. 构架大更新 2. 感谢来自GitHub的朋友"lukemin"的反馈,加入了下方推荐内容是否隐藏开关(实用)
158 | // @note 19-07-13 1.3.0 感谢来自GitHub的朋友“Holaplace”的反馈,修复了文章无法自动展开的问题(CSDN总改这个,令人头疼)
159 | // @note 19-06-08 1.2.6 感谢油叉用户“DeskyAki”的反馈,修复了文章无法自动展开的问题
160 | // @note 19-06-07 1.2.4 修复了登录后评论无法正常打开的问题
161 | // @note 19-06-07 1.2.3 感谢油叉用户"永远的殿下"的反馈,在一上午的努力攻克下,终于实现了未登录展开评论的语句
162 | // @note 19-06-05 1.2.0 修复了评论无法自动展开的BUG
163 | // @note 19-06-04 1.1.9 修复了无法自动展开的BUG(自闭了)
164 | // @note 19-06-04 1.1.6 CSDN太坏了,把“消息”按钮的Class设置成了“GitChat”,所以修复了“消息”按钮消失的问题
165 | // @note 19-06-04 1.1.5 1. 优化了论坛体验 2.美化、优化代码结构
166 | // @note 19-06-04 1.1.4 感谢来自GitHub的朋友“iamsunxing”的反馈,增加了论坛广告匹配规则
167 | // @note 19-06-03 1.1.3 感谢来自GitHub的朋友“wangwei135”的反馈,去除了评论区上方的广告
168 | // @note 19-05-27 1.1.2 感谢油叉用户“夏伟杰”的反馈,修复了富文本编辑器无法使用的问题
169 | // @note 19-05-25 1.1.0 1. 修复了主页广告的问题 2. 论坛自动展开 3. 论坛广告消除
170 | // @note 19-05-25 1.0.9 感谢油叉用户“渣渣不准说话”的反馈,修复了收藏按钮消失的问题
171 | // @note 19-03-01 1.0.3 添加页面选择性过滤规则
172 | // @note 19-03-01 1.0.2 增加了净化剪贴板功能
173 | // @note 19-03-01 1.0.1 修复了排版问题, 优化了代码结构
174 | // @note 19-02-26 1.0.0 初版发布
175 | // ==/UserScript==
176 | var version = "4.2.3";
177 | var currentURL = window.location.href;
178 | if (currentURL.indexOf("?") !== -1) {
179 | currentURL = currentURL.substring(0, currentURL.indexOf("?"));
180 | }
181 | var list;
182 | var windowTop = 0;
183 | var startTimeMilli = Date.now();
184 | var stopTimeMilli = 0;
185 | // 配置控制类
186 | class Config {
187 | get(key, value) {
188 | var cookie = $.cookie(key);
189 | if (cookie == undefined) {
190 | new Config().set(key, value);
191 | console.debug("Renew key: " + key + " : " + value);
192 | return value;
193 | }
194 | console.debug("Read key: " + key + " : " + cookie);
195 | if (cookie === "true") { return true; }
196 | if (cookie === "false") { return false; }
197 | return cookie;
198 | }
199 |
200 | getS(key, value) {
201 | var cookie = $.cookie(key);
202 | if (cookie == undefined) {
203 | new Config().set(key, value);
204 | console.debug("Renew key: " + key + " : " + value);
205 | return value;
206 | }
207 | console.debug("Read key: " + key + " : " + cookie);
208 | return cookie;
209 | }
210 |
211 | set(setKey, setValue) {
212 | $.cookie(setKey, setValue, {
213 | path: '/',
214 | expires: 365
215 | });
216 | console.debug("Key set: " + setKey + " : " + setValue);
217 | }
218 |
219 | listenButton(element, listenKey, trueAction, falseAction) {
220 | $(element).click(function () {
221 | let status = new Config().get(listenKey, true);
222 | console.debug("Status: " + status);
223 | if (status === "true" || status) {
224 | console.debug("Key set: " + listenKey + " :: " + false);
225 | new Config().set(listenKey, false);
226 | } else {
227 | console.debug("Key set: " + listenKey + " :: " + true);
228 | new Config().set(listenKey, true);
229 | }
230 | });
231 | }
232 |
233 | listenButtonAndAction(element, listenKey, trueAction, falseAction) {
234 | $(element).click(function () {
235 | let status = new Config().get(listenKey, true);
236 | console.debug("Status: " + status);
237 | if (status === "true" || status) {
238 | console.debug("Key set: " + listenKey + " :: " + false);
239 | new Config().set(listenKey, false);
240 | falseAction();
241 | } else {
242 | console.debug("Key set: " + listenKey + " :: " + true);
243 | new Config().set(listenKey, true);
244 | trueAction();
245 | }
246 | });
247 | }
248 | }
249 | var config = new Config();
250 | var progress = 0;
251 | class Progress {
252 | init() {
253 | progress = 0;
254 | NProgress.start();
255 | $("#greenerProgress").text("绿化中...");
256 | $(".toolbar-search").hide();
257 | }
258 |
259 | setProgress(p) {
260 | progress = p;
261 | $("#greenerProgress").text(progress + "%");
262 | NProgress.set(progress / 100);
263 | console.log(progress + "%");
264 | }
265 |
266 | incProgress(p) {
267 | progress = progress + p;
268 | progress = progress > 100 ? 100 : progress;
269 | $("#greenerProgress").text(progress + "%");
270 | NProgress.set(progress / 100);
271 | console.log(progress + "%");
272 | }
273 |
274 | done() {
275 | progress = 100;
276 | NProgress.done();
277 | $("#greenerProgress").html(protect_svg + ' CSDNGreener 正在守护您的浏览体验');
278 | setTimeout(function() {
279 | $("#greenerProgress").fadeOut(500);
280 | setTimeout(function() {
281 | $(".toolbar-search").fadeIn(500);
282 | if (!isFirefox()) {
283 | // 提示
284 | let tipsCookie = config.get("showTip", true);
285 | if (tipsCookie) {
286 | showTips();
287 | }
288 | config.set("showTip", false);
289 | }
290 | }, 500);
291 | }, 1500);
292 | }
293 | }
294 | var progressor = new Progress();
295 |
296 | // 自定义 CSS
297 | // 进度条
298 | $('head').append("");
299 | // 设置窗口
300 | $('head').append("");
301 | // 提示条
302 | $('head').append("");
303 | // 按钮(旧)
304 | $('head').append("");
305 | // 保存按钮
306 | $('head').append("");
307 | // Star 样式
308 | $('head').append("");
309 | // 设置窗口文字效果
310 | if (isFirefox()) {
311 | $('head').append("");
312 | } else {
313 | $('head').append("");
314 | }
315 | // SVG
316 | //var save_svg = '
';
317 | var star_svg_1 = '
';
318 | var star_svg_2 = '
';
319 | var star_svg_3 = '
';
320 | var star_svg_4 = '
';
321 | var star_svg = star_svg_1 + star_svg_2 + star_svg_3 + star_svg_4;
322 | var donate_svg = '
';
323 | var set_svg = '
';
324 | var save_svg = '
';
325 | var settings_svg = '
';
326 | var protect_svg = '
';
327 |
328 | // jquery.showtips.js
329 | (function(jQuery) {
330 | jQuery.fn.showTips = function(options,elem){
331 | var config = {
332 | skin:"trips",
333 | content:$(this).attr("tips")||"弹出类型的气泡提示!", //气泡提示内容里面可以是HTML,默认显示自定义的提示内容
334 | width:"auto", //默认为auto,可以写具体尺寸如:200
335 | alignTo:["right","center"], //箭头方向
336 | color:["rgb(247, 206, 57)","#FFFEF4"], //这里是提示层的风格,第一个参数为提示边框颜色,第二个参数为提示背景颜色
337 | type:"html", //显示内容类型
338 | trigger:"click", //默认为点击显示,show为初始化就显示,hover为经过显示,focus焦点显示,mouse跟随鼠标显示隐藏
339 | spacing:10, //默认为箭头距离对象的尺寸
340 | customid:"", //自定义ID
341 | isclose:false, //是否显示关闭按钮
342 | success : null //成功后的回调函数
343 | };
344 | var opts = jQuery.extend(config, options);
345 | return this.each(function(){
346 | var that = jQuery(this),tipBox,tipId,selfH,selfW,conId,docW, spa = opts.spacing, skin=opts.skin;
347 | var Mathrandom = Math.floor(Math.random() * 9999999);
348 | var pmr = (opts.customid=="") ? Mathrandom :opts.customid.replace(/[#.]/, "");
349 | var pointer=opts.alignTo.length===1 ? ''+opts.alignTo[0]+'' : ''+opts.alignTo[0]+'-'+opts.alignTo[1]+'';
350 |
351 | if(typeof elem == 'string') {
352 | if(elem =="show"){
353 | jQuery('#tip'+pmr).show(); jQuery("#con"+pmr).html(opts.content);
354 | showPosition(pointer,jQuery('#tip'+pmr));
355 | };
356 | if(elem =="hide"){jQuery('#tip'+pmr).hide()};
357 | };
358 | if(typeof elem == '' || typeof elem == undefined){return true};
359 | if(jQuery('#tip'+pmr).length==1){return false;}
360 | tipBox=jQuery('
').appendTo(document.body);
361 | tipId = jQuery("#tip"+pmr);
362 | conId = jQuery("#con"+pmr);
363 |
364 | var edgecolor='border-'+opts.alignTo[0]+'-color', tfi=tipId.find("i"), tfem=tipId.find("em"), tfiem=tipId.find("i,em");
365 | tipId.css({'position':'absolute',border:'1px solid','border-color':opts.color[0],'background-color':opts.color[1]});
366 | if(opts.alignTo[1]=='center'){ var offpos=50,percen="%"; }else{ var offpos=5,percen="px"; };
367 | tfiem.css({width:0,height:0,content:'','position':'absolute'})
368 | tfi.css({border:'8px solid transparent','z-index':5});
369 | tfem.css({border:'7px solid transparent','z-index':10});
370 | switch (pointer) {
371 | case 'top-center':
372 | case 'bottom-center':
373 | case 'top-left':
374 | case 'bottom-left':
375 | var poi="left";
376 | if(pointer=='top-center' || pointer=='bottom-center'){
377 | tfi.css({"margin-left":"-8px"});
378 | tfem.css({"margin-left":"-7px"});
379 | }
380 | break;
381 | case 'left-center':
382 | case 'right-center':
383 | case 'left-top':
384 | case 'right-top':
385 | var poi="top";
386 | if(pointer=='left-center' || pointer=='right-center'){
387 | tfi.css({"margin-top":"-8px"});
388 | tfem.css({"margin-top":"-7px"});
389 | }
390 | break;
391 | default:
392 | var poi="right";
393 | break;
394 | };
395 |
396 | if(pointer=='follow'){
397 | tfi.css({'border-bottom-color':opts.color[0],left:''+offpos+percen+'',bottom:'100%'});
398 | tfem.css({'border-bottom-color':opts.color[1],left:''+(offpos+(opts.alignTo[1]=='center'?0:1))+percen+'',bottom:'100%'});
399 | }else{
400 | tfi.css(edgecolor,opts.color[0]).css(poi,''+offpos+percen+'');
401 | tfem.css(edgecolor,opts.color[1]).css(poi,''+(offpos+(opts.alignTo[1]=='center'?0:1))+percen+'');
402 | tfiem.css(opts.alignTo[0],'100%');
403 | };
404 |
405 | switch (opts.type) {
406 | case 'html':conId.html(opts.content); break;
407 | case 'id' :
408 | var tempid=jQuery(opts.content) ,wrap = document.createElement("div");
409 | if(tempid.css("display") == "none"){ tempid.css({display:"block"}); }
410 | conId.append(tempid);
411 | break;
412 | };
413 | if(opts.isclose){
414 | jQuery('
× ').appendTo(tipId);
415 | tipId.find("#close"+pmr+"").on("click",function(){tipId.hide();});
416 | }
417 |
418 | if(typeof opts.width === 'string'){
419 | docW = parseInt(document.body.clientWidth*(opts.width.replace('%','')/100));
420 | (typeof opts.width == 'auto' || typeof opts.width == '') ? tipBox.css({width:'auto'}) : tipBox.css({width:docW});
421 | tipBox.height();
422 | }else{
423 | tipBox.width(opts.width).height();
424 | }
425 | function showPosition(pointer,cell){
426 | var selfH = that.outerHeight(true), selfW = that.outerWidth(true);
427 | var post=that.offset().top, posl=that.offset().left;
428 | var tipCell=(cell=="" || cell==undefined) ? tipId : cell;
429 | var tipH=tipCell.outerHeight(true), tipW=tipCell.outerWidth(true);
430 |
431 | switch (pointer) {
432 | case 'top-left': tipCell.css({top:post-tipH-spa,left:posl}); break;
433 | case 'top-center': tipCell.css({top:post-tipH-spa,left:posl-(tipW/2)+(selfW/2)}); break;
434 | case 'top-right': tipCell.css({top:post-tipH-spa,left:posl-(tipW-selfW)}); break;
435 | case 'bottom-left': tipCell.css({top:post+selfH+spa,left:posl}); break;
436 | case 'bottom-center': tipCell.css({top:post+selfH+spa,left:posl-(tipW/2)+(selfW/2)}); break;
437 | case 'bottom-right': tipCell.css({top:post+selfH+spa,left:posl-(tipW-selfW)}); break;
438 | case 'left-top': tipCell.css({top:post,left:posl-tipW-spa}); break;
439 | case 'left-center': tipCell.css({top:post-(tipH/2)+(selfH/2),left:posl-tipW-spa}); break;
440 | case 'right-top': tipCell.css({top:post,left:posl+selfW+spa}); break;
441 | case 'right-center': tipCell.css({top:post-(tipH/2)+(selfH/2),left:posl+selfW+spa}); break;
442 | case 'follow': that.mousemove(function(e) { tipCell.css({top:e.pageY + 30,left:e.pageX - 6}); }); break;
443 | };
444 | }
445 | tipBox.hide();
446 | switch (opts.trigger){
447 | case 'show':showPosition(pointer);tipBox.show();break;
448 | case 'click':that.click(function(){showPosition(pointer);tipBox.show();});break;
449 | case 'hover':that.hover(function(){showPosition(pointer);tipBox.show(); tipBox.on("mouseover",function(){jQuery(this).show()}).on("mouseout",function(){jQuery(this).hide()})},function(){tipBox.hide();});break;
450 | case 'focus':that.focus(function(){showPosition(pointer);tipBox.show();}); that.blur(function(){tipBox.hide();});break;
451 | case 'mouse':that.hover(function(){showPosition(pointer);tipBox.show();},function(){tipBox.hide();});break;
452 | };
453 | setTimeout(function(){opts.success && opts.success();}, 1);
454 | });
455 | }
456 | })(jQuery);
457 |
458 | (function () {
459 | 'use strict';
460 |
461 | l("CSDNGreener V" + version);
462 | if (isFirefox()) {
463 | console.log("您正在使用火狐浏览器,将使用兼容模式运行 CSDNGreener。");
464 | }
465 | progressor.init();
466 |
467 | // 绿化设定按钮点击事件
468 | let jss = "";
469 | jss += "";
476 | $("body").append(jss);
477 |
478 | // 保存按钮点击事件
479 | let saveJss = "";
480 | saveJss += "";
484 | $("body").append(saveJss);
485 |
486 | setTimeout(function() {
487 | var blockURL = currentURL.split("/").length;
488 | var main = /(www\.csdn\.net\/)$/;
489 | var mainNav = /nav/;
490 | var article = /article/;
491 | var bbs = /bbs\.csdn\.net/;
492 | var blog = /blog\.csdn\.net/;
493 | var blog2 = /\/article\/list\//;
494 | var download = /download\.csdn\.net/;
495 | var login = /passport\.csdn\.net/;
496 | var zone = /me\.csdn\.net/;
497 | var other = /(www\.csdn\.net\/)/;
498 | var mp = /mp\.csdn\.net/;
499 | var article_month = /article\/month/;
500 | var link = /link\.csdn\.net/;
501 | var blink = /blink\.csdn\.net/;
502 |
503 | // 数组初始化
504 | list = [];
505 | // 头部分
506 | // APP
507 | // put(".app-app");
508 | // VIP
509 | put(".vip-caise");
510 | // 记录你的成长历程(记个毛)
511 | put("#writeGuide");
512 | // 新通知小圆点(未登录才消掉)
513 | if ($(".userinfo a").text() === '登录/注册') {
514 | put("#msg-circle");
515 | }
516 | // 顶部谷歌广告
517 | put(".adsbygoogle");
518 | // 悬浮在顶栏按钮上出现的二维码
519 | put(".appControl");
520 | // 顶部广告
521 | put(".advert-bg");
522 |
523 | if (main.test(currentURL) || mainNav.test(currentURL)) {
524 | l("正在优化主页体验...");
525 | // 常规
526 | // 头部广告
527 | put(".banner-ad-box");
528 | // 嵌入广告
529 | put("#kp_box_211");
530 | // 右侧广告
531 | put(".slide-outer");
532 | // 右侧详情
533 | put(".persion_article");
534 | // 右侧推荐
535 | $(".feed_company").parent().remove();
536 | // 广告轮播
537 | put(".el-carousel__container");
538 | // 顶部横幅
539 | put(".toolbar-advert");
540 | // 顶栏VIP选项
541 | $('.toolbar-subMenu-box').find("[href='https://mall.csdn.net/vip']").parent().remove();
542 | // CSDN工具广告
543 | put("#floor-ad_64");
544 | clean(10);
545 | // common(5, 10);
546 | // 博客及主页优化
547 | common(9, 10);
548 | loop(3);
549 | loop(1);
550 | } else if ((blog.test(currentURL) && blockURL === 4) || blog2.test(currentURL)) {
551 | l("正在优化个人博客主页体验...");
552 | // 常规
553 | // 头部广告
554 | put(".banner-ad-box");
555 | // 右侧广告
556 | put(".slide-outer");
557 | // 右侧详情
558 | put(".persion_article");
559 | // 左侧广告
560 | put(".mb8");
561 | put("#kp_box_503");
562 | put("#kp_box_214");
563 | clean(10);
564 | // common(5, 10);
565 | loop(3);
566 | loop(1);
567 | } else if (article.test(currentURL) && !mp.test(currentURL) && !article_month.test(currentURL)) {
568 | l("正在优化阅读体验...");
569 | // 绿化设定
570 | if (isFirefox()) {
571 | setTimeout(function() {
572 | $(".toolbar-container-middle").prepend("
");
573 | let htmlOf0 = '
';
574 | $(".toolbar-btns").prepend(htmlOf0);
575 | if (isFirefox()) {
576 | // 提示
577 | let tipsCookie = config.get("showTip", true);
578 | if (tipsCookie) {
579 | showTips();
580 | }
581 | config.set("showTip", false);
582 | }
583 | }, 3000);
584 | } else {
585 | $(".toolbar-container-middle").prepend("
");
586 | let htmlOf0 = '
';
587 | $(".toolbar-btns").prepend(htmlOf0);
588 | }
589 | // 常规
590 | // 右侧广告,放到第一个清除
591 | // put(".recommend-right");
592 | put("#addAdBox");
593 | // put(".aside-box.kind_person.d-flex.flex-column");
594 | put(".recommend-top-adbox");
595 | // put(".recommend-list-box.d-flex.flex-column.aside-box");
596 | // 左侧广告
597 | // put("#container");
598 | // 快来写博客吧
599 | put(".blog_tip_box");
600 | // 推荐关注用户
601 | put(".blog-expert-recommend-box");
602 | // 右下角VIP
603 | put(".meau-gotop-box");
604 | // 广告
605 | put(".mediav_ad");
606 | put(".pulllog-box");
607 | put(".recommend-ad-box");
608 | put(".box-shadow");
609 | put(".type_hot_word");
610 | put(".fourth_column");
611 | // 高分辨率时右侧文章推荐
612 | // put(".right-item");
613 | // 广告
614 | put("#asideFooter");
615 | put("#ad-div");
616 | put("#479");
617 | put("#480");
618 | // 打赏
619 | put(".postTime");
620 | // 课程推荐
621 | put(".t0");
622 | // 分享海报
623 | put(".shareSuggest");
624 | // 底部主题
625 | put(".template-box");
626 | // 评论区广告
627 | put("div#dmp_ad_58");
628 | // 打赏
629 | put(".reward-user-box");
630 | // 右侧打赏按钮
631 | put(".to-reward");
632 | // 推荐内容广告
633 | put(".recommend-recommend-box");
634 | // 右侧广告
635 | put(".indexSuperise");
636 | // 抢沙发角标
637 | put(".comment-sofa-flag");
638 | // 页jio
639 | put(".bottom-pub-footer");
640 | // 登录查看未读消息
641 | put(".toolbar-notice-bubble");
642 | // 右侧广告
643 | put(".recommend-top-adbox");
644 | // 右侧四个广告
645 | put(".programmer1Box");
646 | put(".programmer2Box");
647 | put(".programmer3Box");
648 | put(".programmer4Box");
649 | // 点赞气泡
650 | put(".triplet-prompt");
651 | // 顶部横幅
652 | put(".toolbar-advert");
653 | // 底部信息
654 | put(".blog-footer-bottom");
655 | // 右侧栏广告
656 | put("#6527");
657 | put("#recommendAdBox");
658 | // 推荐内容Title
659 | put(".recommend-tit-mod");
660 | // 红包提醒
661 | put(".csdn-redpack-lottery-btn-box");
662 | // 学生认证
663 | put(".csdn-highschool-window");
664 | // 右侧悬浮栏除置顶以外的按钮
665 | put(".option-box[data-type='guide'],.option-box[data-type='cs'],.csdn-common-logo-advert");
666 | // 登录后您可以享受以下权益
667 | put(".passport-login-tip-container");
668 | // 底栏“觉得还不错?立即收藏”你在教我做事?
669 | put(".tool-active-list");
670 | // 文章底部 archive推荐
671 | put("#treeSkill");
672 | // 搜索框fire emoji
673 | put(".icon-fire");
674 | clean(10);
675 | setTimeout(function() {
676 | // 展开评论的所有回复
677 | $('.btn-read-reply').click();
678 | // 右侧toolbar 创作提示
679 | $(".sidetool-writeguide-box").remove();
680 | }, 1500);
681 | // 主动加入右侧栏
682 | if ($(".recommend-right").length === 0) {
683 | $("#mainBox").after('
');
684 | }
685 | // 上栏按钮删除
686 | $(".toolbar-menus > li > a:contains('专栏课程')").parent().remove();
687 | $(".toolbar-menus > li > a:contains('插件')").parent().remove();
688 | $(".toolbar-menus > li > a:contains('认证')").parent().remove();
689 | // 修复无法选择复制
690 | $("code").css("user-select","auto");
691 | $("#content_views").css("user-select","auto");
692 | $("pre").css("user-select","auto");7
693 | // 图片混文字时,无法完整复制,图片不会被复制下来 https://github.com/adlered/CSDNGreener/issues/87
694 | //let el = $("main .blog-content-box")[0];
695 | //let elClone = el.cloneNode(true);
696 | //el.parentNode.replaceChild(elClone, el);
697 | // 保存csdn的网页再次打开会自动跳转到首页 https://github.com/adlered/CSDNGreener/issues/97
698 | $("[onerror]").remove();
699 | // CSDN重定向外链不能在新的窗口跳转 https://github.com/adlered/CSDNGreener/issues/80
700 | $("#article_content a[href]").attr("target", "_blank");
701 | // 搜索框优化
702 | //$("#toolbar-search-input").css("width", "calc(100% - 400px)");
703 | // 取消代码折叠
704 | $(".look-more-preCode").click();
705 | // 询问推荐是否有意义的问卷调查
706 | $("#recommendNps").remove();
707 | // 绿化设置
708 | common(6, 1);
709 | // 屏幕适配
710 | common(4, 1);
711 | // 评论
712 | common(1, 30);
713 | // 其它
714 | common(2, 20);
715 | // 顶部显示作者信息
716 | common(8, 1);
717 | // 博客及主页优化
718 | common(9, 10);
719 | // 循环线程开始
720 | loop(2);
721 | loop(3);
722 | } else if (bbs.test(currentURL)) {
723 | l("正在优化论坛体验...");
724 | // 常规
725 | // 评论嵌入小广告
726 | put(".post_recommend");
727 | // 底部推荐
728 | put("#post_feed_wrap");
729 | // 底部相关文章里面的广告
730 | put(".bbs_feed_ad_box");
731 | put(".recommend-ad-box");
732 | // 底部相关文字里面的热词提示
733 | put(".type_hot_word");
734 | // 底部蓝色flex属性的广告栏+登录注册框
735 | put(".pulllog-box");
736 | // 猜你喜欢
737 | put(".personalized-recommend-box");
738 | // 发帖减半提示
739 | put(".totast-box");
740 | // 顶部广告
741 | put(".recommend-right");
742 | // 顶部广告
743 | put(".ad_top");
744 | // 右侧广告
745 | put(".ad_1");
746 | clean(10);
747 | // 展开
748 | common(3, 50);
749 | // common(5, 10);
750 | loop(3);
751 | } else if (download.test(currentURL)) {
752 | l("正在优化下载页体验...");
753 | // 常规
754 | put(".fixed_dl");
755 | put("indexSuperise");
756 | // 右侧推荐
757 | put(".content_recom");
758 | clean(10);
759 | // common(5, 10);
760 | loop(3);
761 | } else if (login.test(currentURL)) {
762 | l("正在优化登录页体验...");
763 | // 常规
764 | // 登录界面大图广告
765 | put(".main-tu");
766 | clean(10);
767 | // common(5, 10);
768 | loop(3);
769 | } else if (zone.test(currentURL)) {
770 | l("正在优化个人空间体验...");
771 | // 常规
772 | clean(10);
773 | common(7, 10);
774 | // common(5, 10);
775 | loop(3);
776 | } else if (blink.test(currentURL)) {
777 | l("正在优化个人动态体验...");
778 | } else if (link.test(currentURL)) {
779 | // 跳过 CSDN 的 link 页面
780 | var url = new URL(window.location.href)
781 | var target = url.searchParams.get('target')
782 | window.location.href = target
783 | } else {
784 | l("哦豁,好偏门的页面,我来试着优化一下哦...");
785 | // 常规
786 | // 展开全文
787 | $('.readmore_btn').click();
788 | // *** index ***
789 | // 头部广告
790 | put(".banner-ad-box");
791 | // 嵌入广告
792 | put("#kp_box_211");
793 | // 右侧广告
794 | put(".slide-outer");
795 | // 右侧详情
796 | put(".persion_article");
797 | // 右侧推荐
798 | $(".feed_company").parent().remove();
799 | // *** article ***
800 | // 常规
801 | // 右侧广告,放到第一个清除
802 | put("#addAdBox");
803 | put(".recommend-top-adbox");
804 | // 快来写博客吧
805 | put(".blog_tip_box");
806 | // 推荐关注用户
807 | put(".blog-expert-recommend-box");
808 | // 右下角VIP
809 | put(".meau-gotop-box");
810 | // 广告
811 | put(".mediav_ad");
812 | put(".pulllog-box");
813 | put(".recommend-ad-box");
814 | //put(".box-shadow"); 某些页面异常,例如cloud.csdn.net
815 | put(".type_hot_word");
816 | put(".fourth_column");
817 | // cloud.csdn.net 头部广告
818 | put("#kp_box_118");
819 | // 广告
820 | put("#asideFooter");
821 | put("#ad-div");
822 | put("#479");
823 | put("#480");
824 | // 打赏
825 | put(".postTime");
826 | // 课程推荐
827 | put(".t0");
828 | // 分享海报
829 | put(".shareSuggest");
830 | // 底部主题
831 | put(".template-box");
832 | // 评论区广告
833 | put("div#dmp_ad_58");
834 | // 打赏
835 | put(".reward-user-box");
836 | // 右侧打赏按钮
837 | put(".to-reward");
838 | // 推荐内容广告
839 | put(".recommend-recommend-box");
840 | // 右侧广告
841 | put(".indexSuperise");
842 | // 抢沙发角标
843 | put(".comment-sofa-flag");
844 | // 页jio
845 | put(".bottom-pub-footer");
846 | // 登录查看未读消息
847 | put(".toolbar-notice-bubble");
848 | // 右侧广告
849 | put(".recommend-top-adbox");
850 | // 学院弹出广告
851 | $(".fouce_close_btn").click();
852 | // 其它
853 | // 头部广告
854 | put(".banner-ad-box");
855 | // 右侧广告
856 | put(".slide-outer");
857 | // 右侧详情
858 | put(".persion_article");
859 | // 左侧广告
860 | put("#kp_box_503");
861 | put("#kp_box_214");
862 | // *** bbs ***
863 | // 评论嵌入小广告
864 | put(".post_recommend");
865 | // 底部推荐
866 | put("#post_feed_wrap");
867 | // 底部相关文章里面的广告
868 | put(".bbs_feed_ad_box");
869 | put(".recommend-ad-box");
870 | // 底部相关文字里面的热词提示
871 | put(".type_hot_word");
872 | // 底部蓝色flex属性的广告栏+登录注册框
873 | put(".pulllog-box");
874 | // 猜你喜欢
875 | put(".personalized-recommend-box");
876 | // 发帖减半提示
877 | put(".totast-box");
878 | // 顶部广告
879 | put(".recommend-right");
880 | // 顶部广告
881 | put(".ad_top");
882 | // *** download ***
883 | put(".fixed_dl");
884 | put("indexSuperise");
885 | // 右侧推荐
886 | put(".content_recom");
887 | clean(10);
888 | }
889 | setTimeout(function() {
890 | progressor.done();
891 | }, 0);
892 | stopTimeMilli = Date.now();
893 | l("优化完毕! 耗时 " + (stopTimeMilli - startTimeMilli) + "ms");
894 | }, 0);
895 | })();
896 |
897 | function l(log) {
898 | console.log("[CSDNGreener] " + log);
899 | }
900 |
901 | function e(error) {
902 | console.error("[CSDNGreener] " + error);
903 | }
904 |
905 | function clear() {
906 | list = [];
907 | }
908 |
909 | function put(tag) {
910 | list.push(tag);
911 | }
912 |
913 | function clean(times) {
914 | var loop = setInterval(function () {
915 | --times;
916 | if (times <= 0) {
917 | clearInterval(loop);
918 | }
919 | for (var k = 0; k < list.length; k++) {
920 | $(list[k]).remove();
921 | }
922 | }, 100);
923 | progressor.incProgress(10);
924 | }
925 |
926 | var deletedLogin = false;
927 |
928 | function loop(num) {
929 | setInterval(function () {
930 | if (num === 1) {
931 | // 主页中间的广告
932 | $(".J_adv").remove();
933 | // 主页有新的内容横条
934 | $(".feed-fix-box").remove();
935 | // 主页广告 iframe
936 | if (currentURL == "https://www.csdn.net/") {
937 | $("iframe").remove();
938 | }
939 | // 删除 CSDN 官方在主页的文章(大多是广告)
940 | $("li.clearfix").each(function(index, ele) {
941 | var banned = /csdn<\/a>/;
942 | var aMark = $(ele).find(".name").html();
943 | if (banned.test(aMark)) {
944 | $(ele).remove();
945 | }
946 | });
947 | // 主页广告
948 | $("li").each(function(){
949 | let self = $(this);
950 | let dataType = self.attr('data-type');
951 | if (dataType === 'ad') {
952 | self.remove();
953 | }
954 | });
955 | // 主页广告
956 | $("li > div > div > h2 > a[href*='https://edu.csdn.net']").parent().parent().parent().parent().remove();
957 | $("li > div > div > h2 > a[href*='https://marketing.csdn.net']").parent().parent().parent().parent().remove();
958 | // 官方脚本横幅
959 | $(".toolbar-advert").remove();
960 | } else if (num === 2) {
961 | // 评论查看更多展开监听
962 | $("div.comment-list-box").css("max-height", "none");
963 | // 屏蔽您的缩放不是100%的提示
964 | $('.leftPop').remove();
965 | // 官方脚本横幅
966 | $(".toolbar-advert").remove();
967 | } else if (num == 3) {
968 | // 循环删除登录提示框
969 | if ($($(".passport-login-container")[0]).length == 1 && deletedLogin == false) {
970 | let passInterval = setInterval(function() {
971 | $('.passport-login-container').hide();
972 | console.log("hide");
973 | }, 10);
974 | setTimeout(function() {
975 | clearInterval(passInterval);
976 | setTimeout(function() {
977 | $("#passportbox").find("img").click();
978 | }, 500)
979 | }, 5000);
980 | deletedLogin = true;
981 | }
982 | // 红包雨
983 | $("#csdn-redpack").remove();
984 | }
985 | }, 500);
986 | }
987 |
988 | function common(num, times) {
989 | var loop = setInterval(function () {
990 | --times;
991 | if (times <= 0) {
992 | clearInterval(loop);
993 | }
994 | if (num === 1) {
995 | // 查看更多
996 | $(".btn-readmore").removeClass("no-login");
997 | $(".btn-readmore").addClass("fans-read-more");
998 | $(".btn-readmore").removeAttr("href");
999 | $(".btn-readmore").removeAttr("target");
1000 | $(".btn-readmore").removeAttr("rel");
1001 | $(".btn-readmore").click();
1002 | // 已登录用户展开评论
1003 | try {
1004 | document.getElementById("btnMoreComment").click();
1005 | } catch (e) {}
1006 | // 删除查看更多按钮
1007 | $("#btnMoreComment").parent("div.opt-box").remove();
1008 | // 展开内容
1009 | $("div.comment-list-box").css("max-height", "none");
1010 | // 改回背景颜色
1011 | $(".login-mark").remove();
1012 | // 删除登录框
1013 | $(".login-box").remove();
1014 | } else if (num === 2) {
1015 | // 挡住评论的“出头推荐”
1016 | if ($(".recommend-box").length > 1) {
1017 | $(".recommend-box")[0].remove();
1018 | }
1019 | // 去除推广广告
1020 | $("li[data-type='ad']").remove();
1021 | // 免登录复制
1022 | $(".hljs-button").removeClass("signin");
1023 | $(".hljs-button").addClass("{2}");
1024 | $(".hljs-button").attr("data-title", "免登录复制");
1025 | $(".hljs-button").attr("onclick", "hljs.copyCode(event);setTimeout(function(){$('.hljs-button').attr('data-title', '免登录复制');},3500);");
1026 | $("#content_views").unbind("copy");
1027 | // 去除剪贴板劫持
1028 | $("code").attr("onclick", "mdcp.copyCode(event)");
1029 | try {
1030 | // 复制时保留原文格式,参考 https://greasyfork.org/en/scripts/390502-csdnremovecopyright/code
1031 | Object.defineProperty(window, "articleType", {
1032 | value: 0,
1033 | writable: false,
1034 | configurable: false
1035 | });
1036 | } catch (err) {
1037 | }
1038 | csdn.copyright.init("", "", "");
1039 | // 页头广告
1040 | try {
1041 | document.getElementsByClassName("column-advert-box")[0].style.display="none";
1042 | } catch (e) {}
1043 | // 自动检测是否有目录,如果没有则删除右边栏,文章居中
1044 | if ($(".recommend-right_aside").html() && $(".recommend-right_aside").html().replace(/[\r\n]/g, "").replace(/(\s)/g, "") === "") {
1045 | $("#rightAside").remove();
1046 | } else if ($(".recommend-right_aside").html() && $("#recommend-right").html().replace(/[\r\n]/g, "").replace(/(\s)/g, "") === "") {
1047 | $("#rightAside").remove();
1048 | }
1049 | // 登录按钮文字太多,修改
1050 | $("a").each(function() {
1051 | if ($(this).attr('href') === 'https://passport.csdn.net/account/login') {
1052 | $(this).html('登入');
1053 | }
1054 | });
1055 | // 顶栏广告
1056 | $("li").each(function(){
1057 | let self = $(this);
1058 | let dataType = self.attr('data-sub-menu-type');
1059 | if (dataType === 'vip') {
1060 | self.remove();
1061 | }
1062 | let dataTitle = self.attr('title');
1063 | if (dataTitle === '高价值源码课程分享' || dataTitle === '系统学习·问答·比赛' || dataTitle === '简单高效优惠的云服务') {
1064 | self.remove();
1065 | }
1066 | });
1067 | // 顶栏VIP选项
1068 | $('.toolbar-subMenu-box').find("[href='https://mall.csdn.net/vip']").parent().remove();
1069 | } else if (num == 3) {
1070 | //论坛自动展开
1071 | $(".js_show_topic").click();
1072 | } else if (num == 4) {
1073 | /** 配置控制 **/
1074 | let config = new Config();
1075 | let smCookie = config.get("scr-sm", true);
1076 | let mdCookie = config.get("scr-md", false);
1077 | let lgCookie = config.get("scr-lg", false);
1078 | let foCookie = config.get("scr-fo", false)
1079 |
1080 | $("#scr-sm").prop("checked", smCookie);
1081 | $("#scr-md").prop("checked", mdCookie);
1082 | $("#scr-lg").prop("checked", lgCookie);
1083 | $("#scr-fo").prop("checked", foCookie);
1084 |
1085 | if (smCookie) {
1086 | // Small Screen Mode
1087 | $(".main_father").removeClass("justify-content-center");
1088 | GM_addStyle(`
1089 | main{
1090 | width: auto!important;
1091 | float: none!important;
1092 | max-width: 90vw;
1093 | }
1094 | main article img{
1095 | margin: 0 auto;
1096 | max-width: 100%;
1097 | object-fit: cover;
1098 | }
1099 | `);
1100 | $("#mainBox").css("width", "100%");
1101 | } else if (mdCookie) {
1102 | // Middle Screen Mode
1103 | $(".main_father").removeClass("justify-content-center");
1104 | } else if (lgCookie) {
1105 | // Large Screen Mode
1106 | $(".container").css("margin", "0 auto")
1107 | } else if (foCookie) {
1108 | // Focus mode
1109 | $(".recommend-right").remove();
1110 | $(".container").css("width", "100%");
1111 | $(".container > main").css("width", "100%");
1112 | }
1113 |
1114 | // 屏幕尺寸单选监听
1115 | $("#scr-sm").click(function () {
1116 | new Config().set("scr-sm", true);
1117 | new Config().set("scr-md", false);
1118 | new Config().set("scr-lg", false);
1119 | new Config().set("scr-fo", false);
1120 | });
1121 | $("#scr-md").click(function () {
1122 | new Config().set("scr-md", true);
1123 | new Config().set("scr-sm", false);
1124 | new Config().set("scr-lg", false);
1125 | new Config().set("scr-fo", false);
1126 | });
1127 | $("#scr-lg").click(function () {
1128 | new Config().set("scr-lg", true);
1129 | new Config().set("scr-sm", false);
1130 | new Config().set("scr-md", false);
1131 | new Config().set("scr-fo", false);
1132 | });
1133 | $("#scr-fo").click(function () {
1134 | new Config().set("scr-fo", true);
1135 | new Config().set("scr-sm", false);
1136 | new Config().set("scr-md", false);
1137 | new Config().set("scr-lg", false);
1138 | });
1139 | // 判断是否为登录状态
1140 | if ($('.toolbar-btn-loginfun').text() === '登录') {
1141 | // 未登录删除无用按钮
1142 | $("a:contains('消息')").parent().parent()[0].remove();
1143 | $(".toolbar-btn-collect").remove();
1144 | $(".toolbar-btn-write").remove();
1145 | $(".toolbar-btn-mp").remove();
1146 | }
1147 | $("a:contains('会员12.12')").parent().remove();
1148 | $(".toolbar-btn-vip").remove();
1149 | } else if (num == 5) {
1150 | // 改回背景颜色
1151 | $(".login-mark").remove();
1152 | // 删除登录框
1153 | $(".login-box").remove();
1154 | } else if (num == 6) {
1155 | let did = false;
1156 | let configHTML = '';
1157 | configHTML += '
' + saveButton + configHTML);
1217 |
1218 | /** 配置控制 **/
1219 | // 推荐内容
1220 | $(".blog-content-box").append("
");
1221 | $("#recommendSwitch:last").append('
' +
1222 | '
显示推荐内容
');
1223 | let recommendCookie = config.get("recommend", false);
1224 | if (!recommendCookie) {
1225 | $(".recommend-box").hide();
1226 | }
1227 | if (recommendCookie) {
1228 | $("#toggle-recommend-button").prop("checked", true);
1229 | $("#toggle-button").prop("checked", true);
1230 | } else {
1231 | $("#toggle-recommend-button").prop("checked", false);
1232 | $("#toggle-button").prop("checked", false);
1233 | }
1234 | config.listenButton("#toggle-recommend-button", "recommend",
1235 | function() {$(".recommend-box").slideDown(200);},
1236 | function() {$(".recommend-box").slideUp(200);});
1237 | config.listenButtonAndAction("#toggle-button", "recommend",
1238 | function() {$(".recommend-box").slideDown(200);},
1239 | function() {$(".recommend-box").slideUp(200);});
1240 |
1241 | // 显示小店
1242 | let shopCookie = config.get('shop',false);
1243 | if(!shopCookie){
1244 | $("#csdn-shop-window").hide();
1245 | $("#csdn-shop-window-top").hide();
1246 | }
1247 | if (shopCookie) {
1248 | $("#toggle-shop-button").prop("checked", true);
1249 | } else {
1250 | $("#toggle-shop-button").prop("checked", false);
1251 | }
1252 | config.listenButton("#toggle-shop-button", "shop",
1253 | function() {location.reload();},
1254 | function() {location.reload();});
1255 | // 侧栏小广告
1256 | let adCookie = config.get("ad", true);
1257 | if (adCookie) {
1258 | setTimeout(function() {
1259 | // $("#recommend-right").append('
');
1260 | }, 500);
1261 | }
1262 | if (adCookie) {
1263 | $("#toggle-ad-button").prop("checked", true);
1264 | } else {
1265 | $("#toggle-ad-button").prop("checked", false);
1266 | }
1267 | config.listenButton("#toggle-ad-button", "ad",
1268 | function() {location.reload();},
1269 | function() {location.reload();});
1270 | // 显示作者名片
1271 | let authorCardCookie = config.get("authorCard", true);
1272 | if (authorCardCookie) {
1273 | // 博主信息
1274 | $('#recommend-right').append($('#asideProfile').prop("outerHTML"));
1275 | setTimeout(function() {
1276 | $('#asideProfile').attr("style", "margin-top: 8px; width: 300px;");
1277 | }, 500);
1278 | }
1279 | if (authorCardCookie) {
1280 | $("#toggle-authorcard-button").prop("checked", true);
1281 | } else {
1282 | $("#toggle-authorcard-button").prop("checked", false);
1283 | }
1284 | config.listenButton("#toggle-authorcard-button", "authorCard",
1285 | function() {location.reload();},
1286 | function() {location.reload();});
1287 |
1288 | // 强制白色主题
1289 | let whiteThemeCookie = config.get("whiteTheme", false);
1290 | if (whiteThemeCookie) {
1291 | // 背景删除
1292 | $('.main_father').attr('style', 'background-image: none !important; background-color: #f5f6f7; background: #f5f6f7;');
1293 | $('[href^="https://csdnimg.cn/release/phoenix/template/themes_skin/"]').attr('href', 'https://csdnimg.cn/release/phoenix/template/themes_skin/skin-technology/skin-technology-6336549557.min.css');
1294 | $('#csdn-toolbar').removeClass('csdn-toolbar-skin-black');
1295 | $('.csdn-logo').attr('src', '//csdnimg.cn/cdn/content-toolbar/csdn-logo.png?v=20200416.1');
1296 | $('html').css('background-color', '#f5f6f7');
1297 | }
1298 | if (whiteThemeCookie) {
1299 | $("#toggle-whitetheme-button").prop("checked", true);
1300 | } else {
1301 | $("#toggle-whitetheme-button").prop("checked", false);
1302 | }
1303 | config.listenButton("#toggle-whitetheme-button", "whiteTheme",
1304 | function() {location.reload();},
1305 | function() {location.reload();});
1306 |
1307 | // 背景图
1308 | let backgroundImage = GM_getValue("backgroundImage", "");
1309 | if (backgroundImage !== "") {
1310 | $("#backgroundImgUrl").val(backgroundImage);
1311 | $(".main_father").attr('style', 'background-image:url(' + backgroundImage + ');background-attachment:fixed;background-size:100%;');
1312 | }
1313 | $('#backgroundImgUrl').on('input', function() {
1314 | GM_setValue("backgroundImage", $("#backgroundImgUrl").val());
1315 | });
1316 | $('#backgroundImgUrl').on('change', function() {
1317 | GM_setValue("backgroundImage", $("#backgroundImgUrl").val());
1318 | });
1319 | $("#upload_bg").on('change', function() {
1320 | let file = $("#upload_bg")[0].files[0];
1321 | let reader = new FileReader();
1322 | reader.onloadend = function (e) {
1323 | let base64 = e.target.result;
1324 | $('#backgroundImgUrl').val(base64);
1325 | $('#backgroundImgUrl').change();
1326 | }
1327 | reader.readAsDataURL(file);
1328 | });
1329 |
1330 | // 搜博主文章
1331 | let searchBlogCookie = config.get("searchBlog", false);
1332 | if(searchBlogCookie) {
1333 | $('#recommend-right').append($('#asideSearchArticle').prop("outerHTML"));
1334 | setTimeout(function() {
1335 | $('#asideSearchArticle').attr("style", "margin-top: 8px; width: 300px;");
1336 | var i = $("#search-blog-words")
1337 | , n = $(".btn-search-blog");
1338 | i.keyup(function(t) {
1339 | var n = t.keyCode;
1340 | if (13 == n) {
1341 | var e = encodeURIComponent(i.val());
1342 | if (e) {
1343 | var s = "//so.csdn.net/so/search/s.do?q=" + e + "&t=blog&u=" + username;
1344 | window.open(s)
1345 | }
1346 | }
1347 | });
1348 | n.on("click", function(t) {
1349 | var n = encodeURIComponent(i.val());
1350 | if (n) {
1351 | var e = "//so.csdn.net/so/search/s.do?q=" + n + "&t=blog&u=" + username;
1352 | window.open(e)
1353 | }
1354 | t.preventDefault()
1355 | });
1356 | }, 500);
1357 | }
1358 | if (searchBlogCookie) {
1359 | $("#toggle-searchblog-button").prop("checked", true);
1360 | } else {
1361 | $("#toggle-searchblog-button").prop("checked", false);
1362 | }
1363 | config.listenButton("#toggle-searchblog-button", "searchBlog",
1364 | function() {location.reload();},
1365 | function() {location.reload();});
1366 |
1367 | // 最新文章
1368 | let newArticleCookie = config.get("newArticle", false);
1369 | if (newArticleCookie) {
1370 | $('#recommend-right').append($('#asideNewArticle').prop("outerHTML"));
1371 | setTimeout(function() {
1372 | $('#asideNewArticle').attr("style", "margin-top: 8px; width: 300px;");
1373 | }, 0);
1374 | }
1375 | if (newArticleCookie) {
1376 | $("#toggle-newarticle-button").prop("checked", true);
1377 | } else {
1378 | $("#toggle-newarticle-button").prop("checked", false);
1379 | }
1380 | config.listenButton("#toggle-newarticle-button", "newArticle",
1381 | function() {location.reload();},
1382 | function() {location.reload();});
1383 |
1384 | // 热门文章
1385 | let hotArticleCookie = config.get("hotArticle", false);
1386 | if (hotArticleCookie) {
1387 | $('#recommend-right').append($("#asideHotArticle").prop("outerHTML"));
1388 | setTimeout(function() {
1389 | $('#asideHotArticle').attr("style", "margin-top: 8px; width: 300px;");
1390 | $('#asideHotArticle img').remove();
1391 | }, 0);
1392 | }
1393 | if (hotArticleCookie) {
1394 | $("#toggle-hotarticle-button").prop("checked", true);
1395 | } else {
1396 | $("#toggle-hotarticle-button").prop("checked", false);
1397 | }
1398 | config.listenButton("#toggle-hotarticle-button", "hotArticle",
1399 | function() {location.reload();},
1400 | function() {location.reload();});
1401 |
1402 | // 最新评论
1403 | let newCommentsCookie = config.get("newComments", false);
1404 | if (newCommentsCookie) {
1405 | $('#recommend-right').append($("#asideNewComments").prop("outerHTML"));
1406 | setTimeout(function() {
1407 | $('#asideNewComments').attr("style", "margin-top: 8px; width: 300px;");
1408 | $(".comment.ellipsis").attr("style", "max-height: none;");
1409 | $(".title.text-truncate").attr("style", "padding: 0");
1410 | }, 0);
1411 | }
1412 | if (newCommentsCookie) {
1413 | $("#toggle-newcomments-button").prop("checked", true);
1414 | } else {
1415 | $("#toggle-newcomments-button").prop("checked", false);
1416 | }
1417 | config.listenButton("#toggle-newcomments-button", "newComments",
1418 | function() {location.reload();},
1419 | function() {location.reload();});
1420 |
1421 | // 分类专栏
1422 | let kindPersonCookie = config.get("kindPerson", false);
1423 | if (!kindPersonCookie) {
1424 | setTimeout(function() {
1425 | $('#asideCategory').remove();
1426 | $('.kind_person').remove();
1427 | }, 0);
1428 | } else {
1429 | $('#recommend-right').append($("#asideCategory").prop("outerHTML"));
1430 | if ($("#asideCategory").length > 0) {
1431 | $('.kind_person').remove();
1432 | } else {
1433 | $('.kind_person').attr("style", "margin-top: 8px; width: 300px; height:255px;");
1434 | }
1435 | setTimeout(function() {
1436 | $('#asideCategory').attr("style", "margin-top: 8px; width: 300px; display:block !important;");
1437 | $("a.flexible-btn").click(function() {
1438 | $(this).parents('div.aside-box').removeClass('flexible-box');
1439 | $(this).parents("p.text-center").remove();
1440 | })
1441 | }, 500);
1442 | }
1443 | if (kindPersonCookie) {
1444 | $("#toggle-kindperson-button").prop("checked", true);
1445 | } else {
1446 | $("#toggle-kindperson-button").prop("checked", false);
1447 | }
1448 | config.listenButton("#toggle-kindperson-button", "kindPerson",
1449 | function() {location.reload();},
1450 | function() {location.reload();});
1451 |
1452 | // 目录
1453 | let contentCookie = config.get("content", true);
1454 | if (!contentCookie) {
1455 | setTimeout(function() {
1456 | $('.align-items-stretch.group_item').parent().remove();
1457 | }, 0);
1458 | }
1459 | if (contentCookie) {
1460 | $("#toggle-content-button").prop("checked", true);
1461 | } else {
1462 | $("#toggle-content-button").prop("checked", false);
1463 | }
1464 | config.listenButton("#toggle-content-button", "content",
1465 | function() {location.reload();},
1466 | function() {location.reload();});
1467 |
1468 | // 推荐文章
1469 | let recommendArticleCookie = config.get("recommendArticle", false);
1470 | if (!recommendArticleCookie) {
1471 | setTimeout(function() {
1472 | $('.recommend-list-box').remove();
1473 | }, 0);
1474 | } else {
1475 | setTimeout(function() {
1476 | $('.recommend-list-box').attr("style", "margin-top: 8px; width: 300px; height:255px;");
1477 | }, 0);
1478 | }
1479 | if (recommendArticleCookie) {
1480 | $("#toggle-recommendarticle-button").prop("checked", true);
1481 | } else {
1482 | $("#toggle-recommendarticle-button").prop("checked", false);
1483 | }
1484 | config.listenButton("#toggle-recommendarticle-button", "recommendArticle",
1485 | function() {location.reload();},
1486 | function() {location.reload();});
1487 |
1488 | // 归档
1489 | let archiveCookie = config.get("archive", false);
1490 | if (!archiveCookie) {
1491 | setTimeout(function() {
1492 | $('#asideArchive').remove();
1493 | }, 0);
1494 | } else {
1495 | $('#recommend-right').append($("#asideArchive").prop("outerHTML"));
1496 | setTimeout(function() {
1497 | $('#asideArchive').attr("style", "margin-top: 8px; width: 300px; display:block !important;");
1498 | }, 500);
1499 | }
1500 | if (archiveCookie) {
1501 | $("#toggle-archive-button").prop("checked", true);
1502 | } else {
1503 | $("#toggle-archive-button").prop("checked", false);
1504 | }
1505 | config.listenButton("#toggle-archive-button", "archive",
1506 | function() {location.reload();},
1507 | function() {location.reload();});
1508 |
1509 | // 自动靠左平铺
1510 | let autoSizeCookie = config.get("autoSize", false);
1511 | if (autoSizeCookie) {
1512 | setInterval(function () {
1513 | // 文章宽度自适应
1514 | if (window.innerWidth < 1100) {
1515 | // 删除原有响应式样式
1516 | $(".main_father").removeClass("justify-content-center");
1517 | $("article").width(window.innerWidth - 150);
1518 | GM_addStyle(`
1519 | main{
1520 | width: auto!important;
1521 | float: none!important;
1522 | max-width: 90vw;
1523 | }
1524 | main article img{
1525 | margin: 0 auto;
1526 | max-width: 100%;
1527 | object-fit: cover;
1528 | }
1529 | `);
1530 | did = true;
1531 | } else {
1532 | if (did === true) {
1533 | $("article").removeAttr("style");
1534 | did = false;
1535 | }
1536 | }
1537 | }, 500);
1538 | }
1539 | if (autoSizeCookie) {
1540 | $("#toggle-autosize-button").prop("checked", true);
1541 | } else {
1542 | $("#toggle-autosize-button").prop("checked", false);
1543 | }
1544 | config.listenButton("#toggle-autosize-button", "autoSize",
1545 | function() {location.reload();},
1546 | function() {location.reload();});
1547 |
1548 | // 自动隐藏顶栏
1549 | let autoHideToolbarCookie = config.get("autoHideToolbar", true);
1550 | if (autoHideToolbarCookie) {
1551 | $(window).scroll(function() {
1552 | if (document.documentElement.scrollTop > 100) {
1553 | let scrollS = $(this).scrollTop();
1554 | if (scrollS >= windowTop) {
1555 | $('#csdn-toolbar').slideUp(100);
1556 | windowTop = scrollS;
1557 | } else {
1558 | $('#csdn-toolbar').slideDown(100);
1559 | windowTop = scrollS;
1560 | }
1561 | }
1562 | });
1563 | }
1564 | if (autoHideToolbarCookie) {
1565 | $("#toggle-autohidetoolbar-button").prop("checked", true);
1566 | } else {
1567 | $("#toggle-autohidetoolbar-button").prop("checked", false);
1568 | }
1569 | config.listenButton("#toggle-autohidetoolbar-button", "autoHideToolbar",
1570 | function() {location.reload();},
1571 | function() {location.reload();});
1572 |
1573 | // 自动隐藏底栏
1574 | let autoHideBottomBarCookie = config.get("autoHideBottomBar", true);
1575 | if (autoHideBottomBarCookie) {
1576 | $("#toolBarBox .left-toolbox").css({
1577 | position: "relative",
1578 | left: "0px",
1579 | bottom: "0",
1580 | width: $("#toolBarBox").width() + "px"
1581 | });
1582 | $(window).scroll(function() {
1583 | $("#toolBarBox .left-toolbox").css({
1584 | position: "relative",
1585 | left: "0px",
1586 | bottom: "0",
1587 | width: $("#toolBarBox").width() + "px"
1588 | })
1589 | });
1590 | }
1591 | if (autoHideBottomBarCookie) {
1592 | $("#toggle-autohidebottombar-button").prop("checked", true);
1593 | } else {
1594 | $("#toggle-autohidebottombar-button").prop("checked", false);
1595 | }
1596 | config.listenButton("#toggle-autohidebottombar-button", "autoHideBottomBar",
1597 | function() {location.reload();},
1598 | function() {location.reload();});
1599 |
1600 | // 创作中心按钮
1601 | let writeBlogCookie = config.get("writeBlog", true);
1602 | if (!writeBlogCookie) {
1603 | $(".toolbar-btn-write").remove();
1604 | }
1605 | if (writeBlogCookie) {
1606 | $("#toggle-writeblog-button").prop("checked", true);
1607 | } else {
1608 | $("#toggle-writeblog-button").prop("checked", false);
1609 | }
1610 | config.listenButton("#toggle-writeblog-button", "writeBlog",
1611 | function() {location.reload();},
1612 | function() {location.reload();});
1613 |
1614 | // 右侧滚动条
1615 | /** setTimeout(function () {
1616 | let rightSideHeight = 0;
1617 | let pageHeight = $(window).height();
1618 | rightSideHeight += getHeight($('.align-items-stretch.group_item').parent());
1619 | rightSideHeight += getHeight($("#asideProfile"));
1620 | rightSideHeight += getHeight($("#asideSearchArticle"));
1621 | rightSideHeight += getHeight($("#asideNewArticle"));
1622 | rightSideHeight += getHeight($("#asideHotArticle"));
1623 | rightSideHeight += getHeight($("#asideNewComments"));
1624 | rightSideHeight += getHeight($("#asideCategory"));
1625 | rightSideHeight += getHeight($("#asideArchive"));
1626 | console.debug("Right side total height: " + rightSideHeight);
1627 | console.debug("Page height: " + pageHeight);
1628 | if (rightSideHeight > pageHeight) {
1629 | $('#recommend-right').css("overflow", "scroll");
1630 | }
1631 | }, 1500); */
1632 | } else if (num === 7) {
1633 | $(".me_r")[1].remove();
1634 | } else if (num === 8) {
1635 | /* $(".article-bar-top").append("
");
1636 | $(".article-bar-top").append($(".aside-box-footerClassify").children("dd").html());
1637 | $("dl").each(function (index, element) {
1638 | var key = $(this).children("dt");
1639 | var value = $(this).children("dd").children("span");
1640 | if (key.html().indexOf("原创") != -1) {
1641 | key = $(this).children("dt").children("a")
1642 | value = $(this).children("dd").children("a").children("span");
1643 | addInfo(key, value);
1644 | } else
1645 | if (value.html() != undefined) {
1646 | addInfo(key, value);
1647 | }
1648 | } );
1649 | function addInfo(key, value) {
1650 | var bind = key.html() + " " + value.html() + " ";
1651 | $(".article-bar-top").append(bind + " ");
1652 | } */
1653 | $(".blog_container_aside").remove();
1654 | $(".toolbox-left > .profile-attend").remove();
1655 |
1656 | // 标题消息提醒去除
1657 | let title = document.title.replace(/^\(.*?\)/g, "");
1658 | document.title = title;
1659 | // 评论复制按钮
1660 | $('.comment-box').prepend('');
1661 | $('.new-opt-box.new-opt-box-bg').prepend('
复制评论 ');
1662 | $('.btn-copy').click(function() {
1663 | var clipboard = new ClipboardJS('.comment-hidden-text');
1664 | clipboard.on('success', function(e) {
1665 | console.info('Action:', e.action);
1666 | console.info('Text:', e.text);
1667 | console.info('Trigger:', e.trigger);
1668 | e.clearSelection();
1669 | $('.btn-copy').html('成功');
1670 | setTimeout(function() {
1671 | $('.btn-copy').html('复制评论');
1672 | }, 1000);
1673 | });
1674 | clipboard.on('error', function(e) {
1675 | console.error('Action:', e.action);
1676 | console.error('Trigger:', e.trigger);
1677 | $('.btn-copy').html('失败,请手动复制');
1678 | setTimeout(function() {
1679 | $('.btn-copy').html('复制评论');
1680 | }, 1000);
1681 | });
1682 | $(".comment-hidden-text").click();
1683 | clipboard.destroy();
1684 | });
1685 | } else if (num === 9) {
1686 | // 删除CSDN LOGO悬浮后的二维码
1687 | $(".toolbar-subMenu > img").parent().remove();
1688 | }
1689 | }, 100);
1690 | progressor.incProgress(10);
1691 | }
1692 |
1693 | function showTips() {
1694 | var config = {
1695 | content: "欢迎使用 CSDNGreener,绿化设定按钮在这里!
好的,以后不再提示我 ",
1696 | type: "html",
1697 | alignTo: ["bottom", "right"],
1698 | trigger: "show",
1699 | isclose: false,
1700 | color: ["#B2E281", "#B2E281"]
1701 | };
1702 | $("#greenerSettings").showTips(config);
1703 | }
1704 |
1705 | function getHeight(element) {
1706 | let outerHeight = element.outerHeight();
1707 | if (outerHeight === null) {
1708 | return 0;
1709 | }
1710 | return outerHeight;
1711 | }
1712 |
1713 | function isFirefox() {
1714 | return navigator.userAgent.indexOf("Firefox") > 0;
1715 | }
1716 |
--------------------------------------------------------------------------------