PageSourceSearch

https://yunfeiluo.github.io/static/js/front.js

js yunfeiluo.github.io collected 2026-10-03 10:13:43 UTC 3,907 bytes, 152 lines download raw bytes

1
2var pos = 0;
3//Prevent view source
4window.onload =function(){
5    //scroll to top button visibility
6    pos = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop;
7    // if (pos != 0){
8    //     $("#scroll_top").show();
9    // }
10    // else {
11    //     ("#scroll_top").hide();
12    // }
13    // //right click
14    // document.oncontextmenu = function(){
15    //     return false;
16    // };
17    // block some shortcut keys
18    // document.onkeydown = function (){
19    //     var e = window.event || arguments[0];
20    //     // //F12
21    //     // if(e.keyCode == 123){
22    //     //     return false;
23    //     // }
24    //     //Ctrl+Shift+I
25    //     if((e.ctrlKey) && (e.shiftKey) && (e.keyCode == 73)){
26    //         return false;
27    //     }
28    //     //Shift+F10
29    //     else if((e.shiftKey) && (e.keyCode == 121)){
30    //         return false;
31    //     }
32    //     //Ctrl+U
33    //     else if((e.ctrlKey) && (e.keyCode == 85)){
34    //         return false;
35    //     }
36    //     else if((e.ctrlKey) && (e.keyCode == 83)){
37    //         return false;
38    //     }
39    // };
40};
41
42//scroll lisener (mainly for scroll-top)
43window.onscroll=function(){
44    pos = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop;
45    // if (pos != 0){
46    //     $("#scroll_top").show();
47    // }
48    // else {
49    //     $("#scroll_top").hide();
50    // }
51};
52
53//global variables
54var imgs = [
55"url(update/photos/slide0.jpg)", 
56"url(update/photos/slide1.jpg)", 
57"url(update/photos/slide2.jpg)",
58"url(update/photos/slide3.jpg)"
59];
60var index = 0;
61
62//function for slides
63function prev(){
64    var hbg = document.getElementById('headerBGI');
65    index -= 1;
66    if (index < 0){
67        index = imgs.length - 1;
68    }
69    hbg.style.backgroundImage = imgs[index];
70}
71
72function next(){
73    var hbg = document.getElementById('headerBGI');
74    index += 1;
75    if (index > (imgs.length - 1)){
76        index = 0;
77    }
78    hbg.style.backgroundImage = imgs[index];
79    //hbg[0].style.animationName = fade;
80}
81
82//function for smooth scrolling
83function scroll_down(str){
84    var header_height = document.getElementsByTagName("header")[0].offsetHeight;
85    var secs = document.getElementsByTagName("section");
86    if (str == 'about'){
87        window.scrollTo(0, header_height
88            + secs[0].offsetHeight);
89    }
90    else if (str == 'profile'){
91        window.scrollTo(0, header_height 
92            + secs[0].offsetHeight
93            + secs[1].offsetHeight);
94    }
95    // else if (str == 'news'){
96    //     window.scrollTo(0, header_height 
97    //         + secs[0].offsetHeight
98    //         + secs[1].offsetHeight
99    //         + secs[2].offsetHeight);
100    // }
101    else if (str == 'archives'){
102        window.scrollTo(0, header_height 
103            + secs[0].offsetHeight
104            + secs[1].offsetHeight
105            + secs[2].offsetHeight);
106            // + secs[3].offsetHeight);
107    }
108    else if (str == 'contact'){
109        window.scrollTo(0, header_height 
110            + secs[0].offsetHeight
111            + secs[1].offsetHeight
112            + secs[2].offsetHeight
113            + secs[3].offsetHeight);
114            // + secs[4].offsetHeight);
115    }
116}
117
118//scroll to the top
119function scroll_top(){
120    window.scrollTo({ 
121        top: 0
122    });
123}
124
125//opacity action
126var button;
127function opa_up(b0){
128    if (b0 == 'p'){
129        button = document.getElementsByTagName("button");
130        button[0].style.opacity = 1;
131    }
132    else if (b0 == 'n'){
133        button = document.getElementsByTagName("button");
134        button[1].style.opacity = 1;
135    }
136    else{
137        button = document.getElementById(b0);
138        button.style.opacity = 1;
139    }
140}
141
142function opa_down(b1){
143    if (b1 == 'p'){
144        button[0].style.opacity = 0.4;
145    }
146    else if (b1 == 'n'){
147        button[1].style.opacity = 0.4;
148    }
149    else{
150        button.style.opacity = 0.4;
151    }
152}

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.