PageSourceSearch

https://10prs.com/common/default.js

js 10prs.com collected 2026-09-28 06:39:22 UTC 4,662 bytes, 154 lines download raw bytes

1document.addEventListener('DOMContentLoaded', function () {
2
3// 画面幅360px 未満は JS で viewport を書き換える
4	!(function () {
5		const viewport = document.querySelector('meta[name="viewport"]');
6		function switchViewport() {
7			const value =
8			window.outerWidth > 360
9			? 'width=device-width,initial-scale=1,viewport-fit=cover'
10			: 'width=360';
11			if (viewport.getAttribute('content') !== value) {
12				viewport.setAttribute('content', value);
13			}
14		}
15		addEventListener('resize', switchViewport, false);
16		switchViewport();
17	})();
18
19// Twemoji
20	twemoji.parse(document.body);
21
22// スクロール:上下移動ボタンフェードインアウト・グローバルナビclass付加
23	$(function() {
24		const n = $('.scroll_btn');
25		const g = $('.global_nav');
26		n.hide();
27		$(window).on('scroll', function() {
28			const scrollTop = $(this).scrollTop();
29			if (scrollTop > 300) {
30				n.fadeIn();
31			} else {
32				n.fadeOut();
33			}
34			if (scrollTop > 120) {
35				g.addClass("move");
36			} else {
37				g.removeClass("move");
38			}
39			const docHeight = $(document).innerHeight();
40			const windowHeight = $(window).innerHeight();
41			const pageBottom = docHeight - windowHeight;
42			if (pageBottom <= scrollTop) {
43				n.fadeOut();
44			}
45		});
46	});
47
48// update_list ticker
49	const items = document.querySelectorAll('.update_list li');
50	if (items.length > 0) {
51		let currentIndex = 0;
52		function showNextItem() {
53			// フェードアウトを開始
54			items[currentIndex].classList.add('fade-out');
55			// 次のインデックスを計算
56			const nextIndex = (currentIndex + 1) % items.length;
57			// 次の項目を表示する前にフェードアウトが終わるのを待つ
58			setTimeout(() => {
59				items[currentIndex].classList.remove('active', 'fade-out');
60				items[nextIndex].classList.add('active');
61				currentIndex = nextIndex;
62			}, 1000); // フェードアウトの時間(1秒)に合わせる
63		}
64		// 最初の項目をアクティブに
65		items[currentIndex].classList.add('active');
66		// インターバルを設定
67		setInterval(showNextItem, 5000);
68	}
69
70// .twitter埋め込みあるときだけツイ用スクリプト出力
71	if (document.querySelector('.twitter-tweet')) {
72		const script = document.createElement('script');
73		script.src = "https://platform.twitter.com/widgets.js";
74		script.async = true;
75		// bodyの最後に追加
76		document.body.appendChild(script);
77	}
78
79});
80
81// ページ移動毎にナビメニューのチェックをリセット
82window.addEventListener('pageshow', function() {
83	document.getElementById('for_global_nav').checked = false;
84});
85 
86$(document).ready(function() {
87// ネタバレボタン
88	if($('.hidearea').length){
89		$('.hidearea').hidearea({
90			view: '表示する',
91			color: '#000000',
92			speed: 'normal',
93			close: true
94		});
95	};
96// 削除確認
97	$('a.delete').click(function() {
98		return confirm('本当に削除してもよろしいですか?');
99	});
100	$('form.delete').submit(function() {
101		return confirm('本当に削除してもよろしいですか?');
102	});
103
104// fancybox3
105	var extensions = ['gif', 'GIF', 'jpeg', 'JPEG', 'jpg', 'JPG', 'jpe', 'JPE', 'png', 'PNG', 'webp'];
106	var target = '';
107	$.each(extensions, function() {
108		if (target) {
109			target += ',';
110		}
111		target += 'a[href$=\'.' + this + '\']';
112	});
113	$(target).attr({'data-fancybox': 'images'});
114	$('a.colorbox').attr({
115		'data-fancybox':'',
116		'data-type':'iframe'
117	});
118	if($('script[src*="fancybox"]').length) {
119		$('[data-fancybox]').fancybox({
120			// オプションを下記に記載していきます
121			loop : true, // 複数画像表示時に最初と最後をループさせる
122			toolbar  : false, // ツールバーの非表示
123			protect: true, // 右クリック抑制
124		});
125	}
126
127//Favicon付リンク
128	function faviconSetting(){
129		const item = $('a.link_has_favicon');
130		item.each(function(){
131			const faviconUrl = $(this).attr('href');
132			$(this).prepend('<img src="https://www.google.com/s2/favicons?domain=' + faviconUrl + '"> ')
133		});
134	}
135	faviconSetting();
136
137// 引用元
138	$('blockquote').each(function() {
139		if($(this).attr('cite')) {
140			const cite = $(this).attr('cite');
141			const cite_link = '<p class="cite_link" style=font-size:.8em;text-align:right;"><a href="'+cite+'" target="_blank">'+cite+'</a></p>';
142			$(this).append(cite_link);
143		}
144	});
145
146// copyURL
147	if($('.share-url').length){
148		const clipboard = new ClipboardJS('.share-url');
149		clipboard.on('success', function(e) {
150			$(e.trigger.nextElementSibling).fadeIn().delay(1000).fadeOut();
151		});
152	};
153
154});

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.