PageSourceSearch

https://www.toli.co.jp/product/script/page.js

js toli.co.jp collected 2026-09-24 20:47:36 UTC 1,813 bytes, 50 lines download raw bytes

1
2// お気に入りアイコンでのリンクを無効化
3document.querySelectorAll('.p_relative span').forEach(function(span) {
4	span.addEventListener('click', function(event) {
5		event.preventDefault(); // <a>タグなどのデフォルト動作も抑止
6		return false; // 厳密には不要だが、明示的にfalseを返したい場合
7	});
8});
9
10// お気に入りの登録/解除する
11async function favorite_icon(element, user, id, category) {
12	const isFavorite = element.textContent.trim() === 'favorite';
13
14	// お気に入りしている⇒解除
15	const favorite_url = isFavorite
16		? `${base_url}favorite_delete_catalog?user_id=${user}&data_id=${id}&category=${category}`
17		: null; // 登録時はURLを渡さない(sendFavoriteApi側で生成)
18
19	const data = await sendFavoriteApi(user, id, category, isFavorite)
20
21	if (!data[0]) {
22		// 何かしらの制限に引っかかる
23		alert(data ? data[1] : 'エラーが発生しました');
24		return;
25	}
26	// 表示の切り替え
27	if (isFavorite) {
28		element.textContent = 'favorite_border';
29		element.style.color = '#000';
30	} else {
31		element.textContent = 'favorite';
32		element.style.color = 'red';
33	}
34}
35
36window.sendFavoriteApi = async function sendFavoriteApi(user, id, category , isFavorite){
37	//お気に入り登録済なら解除、未登録なら新規登録
38	const favorite_url = isFavorite
39		? `${base_url}favorite_delete_catalog?user_id=${user}&data_id=${id}&category=${category}`
40		: `${base_url}favorite_regist_catalog?user_id=${user}&data_id=${id}&category=${category}`;
41
42	try {
43		const response = await fetch(favorite_url, { method: 'POST' });
44		const text = await response.text();
45		return JSON.parse(text);
46	} catch (error) {
47		console.error('Fetch error:', error);
48		return null;
49	}
50}

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.