PageSourceSearch

https://news.infoseek.co.jp/firebase-messaging-sw.js

js infoseek.co.jp collected 2026-09-24 08:30:25 UTC 2,607 bytes, 72 lines download raw bytes

1const ISNEWS_DATABASE_NAME = 'isnews';
2// If the database version needs to be changed, make sure updating '/pc/js/notification.js', '/sp/js/notification.js' as well
3const ISNEWS_DATABASE_VERSION = 1;
4const NOTIFICATION_STORE_NAME = 'notification';
5const NOTIFICATION_STORE_SUBSCRIBED_NOTIFICATION_TYPES = 'subscribed_notification_types';
6
7const databasePromise = new Promise((resolve, reject) => {
8    // Load the database, and get the subscribed notification types
9    const openRequest = indexedDB.open(ISNEWS_DATABASE_NAME, ISNEWS_DATABASE_VERSION);
10
11    openRequest.onupgradeneeded = function (event) {
12        const database = event.target.result;
13        if (!database.objectStoreNames.contains(NOTIFICATION_STORE_NAME)) {
14            database.createObjectStore(NOTIFICATION_STORE_NAME);
15        }
16    };
17
18    openRequest.onsuccess = function (event) {
19        const database = event.target.result;
20        resolve(database);
21    };
22
23    openRequest.onerror = function (event) {
24        console.error('IndexedDB error:', event.target.error);
25        reject(event.target.error);
26    };
27});
28
29const getDatabase = () => databasePromise;
30
31let lastMessage;
32
33self.addEventListener('push', async function (event) {
34    let payload = event.data.json();
35
36    const database = await getDatabase();
37
38    const transaction = database.transaction(NOTIFICATION_STORE_NAME, 'readonly');
39    const objectStore = transaction.objectStore(NOTIFICATION_STORE_NAME);
40    const subscribedNotificationTypesRequest = objectStore.get(NOTIFICATION_STORE_SUBSCRIBED_NOTIFICATION_TYPES);
41
42    subscribedNotificationTypesRequest.onsuccess = function (event) {
43        const subscribedNotificationTypes = event.target.result;
44        const notification = payload.notification;
45        const title = notification.title;
46
47        const topic = payload.data.topic;
48
49        let options = {
50            data: {
51                url: payload.data.url,
52            },
53            icon: '/common/img/isnews_app_icon-1.0.png',
54            body: notification.body,
55        };
56
57        if (payload && subscribedNotificationTypes !== undefined && subscribedNotificationTypes.includes(topic) && lastMessage !== title) {
58            lastMessage = title;
59            self.registration.showNotification(title, options);
60        }
61    };
62});
63
64self.addEventListener('notificationclick', function (event) {
65    let data = event.notification.data;
66    event.notification.close();
67
68    if (data.url) {
69        // Open a new tab of corresponding URL
70        event.waitUntil(clients.openWindow(data.url + '?scid=notification_highlightedNews'));
71    }
72});

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.