PageSourceSearch

https://xy.changyou.com/js/subpage.js

js changyou.com collected 2026-10-02 02:39:53 UTC 4,150 bytes, 146 lines download raw bytes

1//回到顶部
2$("#news .go-top").on('click', function () {
3    $('body, html').animate({
4        scrollTop: 0
5    }, 800);
6    $("#news.detail .article-content").animate({
7        scrollTop: 0
8    }, 800);
9});
10
11$("#news .content .tab-title .item").on('click', function () {
12    $(this).addClass('active').siblings().removeClass('active');
13});
14
15// $("#news .content .tab-content .list .item").on('click', function () {
16//     window.location.href = "/news-detail.shtml";
17// });
18
19/**
20 * 获取滚动高度
21 */
22function getScrollTop() {
23    let scrollTop = 0, bodyScrollTop = 0, documentScrollTop = 0;
24    if (document.body) {
25        bodyScrollTop = document.body.scrollTop;
26    }
27    if (document.documentElement) {
28        documentScrollTop = document.documentElement.scrollTop;
29    }
30    scrollTop = (bodyScrollTop - documentScrollTop > 0) ? bodyScrollTop : documentScrollTop;
31    return scrollTop;
32}
33
34/*
35获取文档的总高度
36 */
37function getScrollHeight() {
38    let scrollHeight = 0, bodyScrollHeight = 0, documentScrollHeight = 0;
39    if (document.body) {
40        bodyScrollHeight = document.body.scrollHeight;
41    }
42    if (document.documentElement) {
43        documentScrollHeight = document.documentElement.scrollHeight;
44    }
45    scrollHeight = (bodyScrollHeight - documentScrollHeight > 0) ? bodyScrollHeight : documentScrollHeight;
46    return scrollHeight;
47}
48
49//浏览器视口的高度
50function getWindowHeight() {
51    let windowHeight = 0;
52    if (document.compatMode === "CSS1Compat") {
53        windowHeight = document.documentElement.clientHeight;
54    } else {
55        windowHeight = document.body.clientHeight;
56    }
57    return windowHeight;
58}
59
60/**
61 * 是否到了页面底部
62 * @returns {boolean}
63 */
64function windowIsBottom() {
65    return getScrollTop() + getWindowHeight() === getScrollHeight();
66}
67
68/**
69 * 新闻滚动页处理
70 */
71function newsDetailScroll() {
72    $(function () {
73        $(document.documentElement)[0].addEventListener('mousewheel', newsDetailScrollHandle)
74        $("#news .content")[0].addEventListener('mousewheel', newsDetailScrollHandle);
75    });
76}
77
78function newsDetailScrollHandle(e) {
79    e.stopPropagation();
80    if (e.wheelDeltaY < 0) {
81        if (this.tagName !== 'HTML') {
82            e.preventDefault();
83        }
84        //向下滚动
85        if (!windowIsBottom()) {
86            //还没到底部 不允许滚动
87            $("#news .article-content").scrollTop(0);
88            //外层滚动
89            $(document.documentElement).stop().animate({
90                scrollTop: $(document.documentElement).scrollTop() + 160
91            }, 80, 'linear');
92        } else {
93            //到达底部了 允许滚动
94            $("#news .article-content").stop().animate({scrollTop: $("#news .article-content").scrollTop() + 160}, 80, 'linear');
95        }
96    } else {
97
98    }
99}
100
101newsDetailScroll();
102
103/*
104计算新闻详情页高度
105 */
106function computedNewsDetailHeight() {
107    let initWidth = 1920;
108    let initHeight = 2200;
109    let screenWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
110    let rate = screenWidth / initWidth;
111    let finalHeight = initHeight * rate;
112    $("#news").height(finalHeight);
113}
114
115computedNewsDetailHeight();
116
117
118// 下面的页数效果
119
120$(".pages a").mouseover(function () {
121    $(this).css("color", "red");
122    var mouse = $(this).attr("disabled");
123    if (mouse) {
124        $(this).css("cursor", "not-allowed");
125    } else {
126        $(this).css("cursor", "pointer");
127    }
128})
129$(".pages a").mouseout(function () {
130    $(this).css("color", "#d4aa77");
131})
132$('#news .front img').attr({
133    'src':'https://i0.cy.com/xy/pic/2024/0422/detail_bottom_bg_03.jpg'
134})
135$('#news .back img').attr({
136    'src':'https://i0.cy.com/xy/pic/2023/0815/pc/details/back_03.png'
137})
138
139var qrcode = new QRCode("qrcoden3", {
140  text: location.origin + '/download/xy-down/index.shtml',
141  width: 100,
142  height: 100,
143  colorDark: "#000000",
144  colorLight: "#ffffff",
145  correctLevel: QRCode.CorrectLevel.H
146});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.