PageSourceSearch

https://qzss.go.jp/common/js/dark.js

js qzss.go.jp collected 2026-10-01 10:24:18 UTC 1,612 bytes, 60 lines download raw bytes

1// ƒ`ƒFƒbƒNƒ{ƒbƒNƒX‚̎擾
2const btn = document.querySelector("#view-mode");
3 
4// ƒ`ƒFƒbƒN‚µ‚½Žž‚Ì‹““®
5btn.addEventListener("change", () => {
6  if (btn.checked == true) {
7    // ƒ_[ƒNƒ‚[ƒh
8    document.body.classList.remove("darkmode");
9    document.body.classList.add("dark");
10  } else {
11    // ƒ‰ƒCƒgƒ‚[ƒh
12    document.body.classList.remove("dark");
13    document.body.classList.add("darkmode");
14  }
15});
16
17
18// cookie•Û‘¶
19$(function(){
20    
21    // ˆ—‚ðŠÖ”‚ɂ܂Ƃ߂é
22    function dark(){
23        $('body').addClass('dark').css('transition','0.3s');
24        $('body').removeClass('darkmode').css('transition','0.3s');
25        $('input[name="view-mode"]').prop('checked', true);
26        $.cookie('dark', 'on', { expires: 365, path:'/'});
27    }
28    
29    function darkmode(){
30        $('body').addClass('darkmode').css('transition','0.3s');
31        $('body').removeClass('dark').css('transition','0.3s');
32        $('input[name="view-mode"]').prop('checked', false);
33        $.cookie('dark', 'off', { expires: 365, path:'/'});
34    }
35    
36    // ƒƒfƒBƒA“Á«‚É‚æ‚镪Šò‚ƁACookie‚Ì“à—e‚É‚æ‚镪Šòˆ—
37    if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
38        if($.cookie('dark') === 'off'){
39            darkmode();
40        }else{
41            dark();
42        }
43    }else{
44        if($.cookie('dark') === 'on'){
45            dark();
46        }else{
47            darkmode();
48        }
49    }
50    
51    // ƒXƒCƒbƒ`‚𑀍삵‚½Û‚̏ˆ—
52    $('input[name="view-mode"]').change(function(){
53        if($(this).is(':checked')) {
54            dark();
55        } else {
56            darkmode();
57        }
58    }); 
59
60});

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.