PageSourceSearch

https://postech.ac.kr/_res/postech/kor/js/top-banner.content.js?34100

js postech.ac.kr collected 2026-09-24 08:32:43 UTC 2,254 bytes, 95 lines download raw bytes

1/* ======================
2   POSITION
3====================== */
4
5// ⭐ 배너 정확히 하나만 잡기
6const $banner = $('.aside-banner.banner-top');
7
8// 언어 버튼 위치
9function updateBtnLangPosition() {
10  if ($banner.hasClass('on') && !$banner.hasClass('none')) {
11    $('.btn_lang').addClass('is-top');
12  } else {
13    $('.btn_lang').removeClass('is-top');
14  }
15}
16
17// ⭐ 레이아웃 밀기 (핵심)
18function updateLayout(){
19  const isMobile = window.innerWidth <= 1024;
20
21  if ($banner.hasClass('none') || isMobile) {
22    $('.wrap').css('padding-top','0');
23  } else {
24    $('.wrap').css('padding-top','80px');
25  }
26}
27
28// 실행
29$(document).ready(function(){
30  updateBtnLangPosition();
31  updateLayout();
32});
33
34$(window).on('resize', function(){
35  updateBtnLangPosition();
36  updateLayout();
37});
38
39
40// ⭐ 불필요 / 위험 코드 → 제거 추천
41/*
42const firstBanner = document.querySelector('aside.aside-banner');
43if (firstBanner && !firstBanner.querySelector('aside.aside-banner')) {
44    firstBanner.style.display = 'none';
45}
46*/
47
48
49// 배너 닫기
50function closeTopPopup(siteId) {
51
52    var checkbox = document.getElementById('todayCloseCheck');
53    var isChecked = checkbox && checkbox.checked;
54
55    if (isChecked) {
56        var now = new Date();
57        var tomorrow = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1, 0, 0, 0);
58        var expires = "expires=" + tomorrow.toUTCString();
59
60        document.cookie = "top-banner-" + siteId + "=true; " + expires + "; path=/";
61    }
62
63    // ⭐ 배너 숨김
64    $banner.addClass('none');
65
66    // ⭐ 같이 업데이트
67    updateBtnLangPosition();
68    updateLayout();
69}
70
71/* ======================
72   INTRO 사라지면 배너 숨김 (모바일)
73====================== */
74
75const intro = document.querySelector('.intro'); // 필요하면 클래스명 수정
76
77if (intro) {
78  const introObserver = new IntersectionObserver((entries) => {
79    const isMobile = window.innerWidth <= 1024;
80
81    entries.forEach(entry => {
82      if (isMobile && !entry.isIntersecting) {
83        // ⭐ intro 사라짐 → 배너 숨김
84        $banner.addClass('none');
85
86        updateBtnLangPosition();
87        updateLayout();
88      }
89    });
90  }, {
91    threshold: 0
92  });
93
94  introObserver.observe(intro);
95}

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.