PageSourceSearch

https://www.odakyu-card.jp/js/floatingbnr.js

js odakyu-card.jp collected 2026-10-02 03:35:42 UTC 2,210 bytes, 77 lines download raw bytes

1$(function(){
2	var $flbnr = $('.floatingbnr');
3	var $btn = $('.floatingbnr-btn', $flbnr);
4	var newURL = $btn.data('flbnr_new_url'); // 新規向けリンク
5	var exisURL = $btn.data('flbnr_exis_url'); // 既存向けリンク
6	var bnrID = $btn.data('flbnr_id'); // バナー固有ID
7	var bnrExpir = $btn.data('flbnr_expir'); // 非表示期間(日数)
8	var $closeBtn = $('.floatingbnr-close a', $flbnr);
9	var isNew = localStorage.tabNumber==2 ? false : true; // 新規/既存のlocalStrageを読んで判定
10	var isClosed = document.cookie.indexOf('flbnr=' + bnrID) !== -1 ? true : false; // 閉じたかどうか
11	//var isClosed = localStorage.flbnrStatus.getItem('');
12	var observer_tabNew = new MutationObserver(function(rec,obs){ // タブ切り替え監視
13		$(rec[0].target).hasClass('act') ? isNew = true : isNew = false;
14		bannerReplace();
15	});
16	var $pagetop = $('.totop'); //ページトップにもどるボタン
17	var observer_totop = new MutationObserver(function(rec,obs){
18		pagetopBtnPos($(rec[0].target));
19	});
20	
21	function bannerReplace(){
22		if(isNew){
23			$btn.attr('href', newURL);
24			$btn.addClass('floatingbnr-btn-new');
25			$btn.removeClass('floatingbnr-btn-exis');
26		} else {
27			$btn.attr('href', exisURL);
28			$btn.removeClass('floatingbnr-btn-new');
29			$btn.addClass('floatingbnr-btn-exis');
30		}
31	}
32	
33	function displayBanner(){
34		if(isClosed){
35			$flbnr.fadeOut(400);
36		} else {
37			$flbnr.fadeIn(400);
38		}
39	}
40	
41	function bannerClose(){
42		var now = new Date();
43		var maxAge = bnrExpir * 60 * 60 * 24;
44		now.setDate(now.getDate() + bnrExpir);
45		document.cookie = 'flbnr=' + bnrID + '; max-age=' + maxAge + '; expires=' + now.toUTCString();
46		isClosed = true;
47		displayBanner();
48	}
49	
50	function pagetopBtnPos($tgt){
51		if( $tgt.hasClass('fixed') ){
52			$pagetop.css({ bottom: $btn.innerHeight() + 35 });
53		} else {
54			$pagetop.css({ bottom: 'auto' });
55		}
56	}
57	
58	bannerReplace();
59	displayBanner();
60	pagetopBtnPos($pagetop);
61	
62	observer_tabNew.observe( $('.tab-underreview')[0], {
63		attributes: true,
64	});
65	
66	observer_totop.observe( $pagetop[0], {
67		attributes: true,
68		attributeFilter: ["class"],
69	});
70	
71	$closeBtn.on('click', function(ev){
72		ev.preventDefault();
73		bannerClose();
74	})
75	
76	
77});

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.