PageSourceSearch

https://www.dinomarket.com/firebase/notificationjs.cfm?v1

js dinomarket.com collected 2026-10-01 12:15:48 UTC 4,935 bytes, 228 lines download raw bytes

1
2
3
4
5function strToHex(str) {
6  let result = '';
7  for (let i = 0; i < str.length; i++) {
8	const hex = str.charCodeAt(i).toString(16);
9	result += (hex.length === 2 ? hex : '0' + hex);
10  }
11  return result.toUpperCase();
12}
13
14
15var config = {
16	apiKey: "AIzaSyDEUsP2FPL0e3MAxQ4RrF_l-3kvnTdncPg",
17	authDomain: "dinomarketcom-6d8dd.firebaseapp.com",
18	databaseURL: "https://dinomarketcom-6d8dd.firebaseio.com",
19	projectId: "dinomarketcom-6d8dd",
20	storageBucket: "dinomarketcom-6d8dd.appspot.com",
21	messagingSenderId: "976910262120"
22};
23
24firebase.initializeApp(config);
25
26const messaging = firebase.messaging();
27
28
29messaging.usePublicVapidKey('BPnxMfGIS9B1dvFXQ7gyZ8qQ_eWeZ-d5mE-l5oH-ZzNDSoF14gJPE2qqOuUwjLs3MjSaJE7IZWViShK5cmUtLrs');
30
31
32function setTokenSent(val) {
33	window.localStorage.setItem('isTokenSent', val ? 1 : 0);
34}
35
36function isTokenSent() {
37    if (window.localStorage.getItem('isTokenSent') == 1) {
38          return true;
39    }
40    return false;
41}
42
43function setStoredToken(val) {
44	window.localStorage.setItem('dmtoken', val);
45}
46
47function getStoredToken() {
48    return window.localStorage.getItem('dmtoken');
49}
50
51function setLastRequestPermission() {
52	window.localStorage.setItem('lastRequest', new Date().getTime());
53}
54
55function getLastRequestPermissionHour() {
56	return Math.floor((new Date().getTime() -  window.localStorage.getItem('lastRequest')) / (1000*60*60));
57}
58
59function getStoredToken() {
60    return window.localStorage.getItem('dmtoken');
61}
62
63function sendToken(token) {
64	
65    if (!isTokenSent()) {
66		var xhr = new XMLHttpRequest();
67		
68		xhr.open('POST', 'https://www.dinomarket.com/firebase/token.cfm?add', true);
69		
70		xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
71		xhr.onload = function () {
72			
73		};
74		xhr.send('token='+strToHex(token));		
75		
76		
77      setTokenSent(true);
78	  setStoredToken(token);
79    } else {
80      
81    }
82
83}
84
85function requestPermission() {
86	if (( getLastRequestPermissionHour() > 36 ) || isNaN( getLastRequestPermissionHour() )) {
87		
88		messaging.requestPermission()
89		.then(function() {
90		  requestToken();
91		  
92		})
93		.catch(function(err) {
94		  
95		});
96		setLastRequestPermission();
97	};
98}
99
100
101messaging.onTokenRefresh(function() {
102    messaging.getToken()
103    .then(function(refreshedToken) {
104      setTokenSent(false);
105      sendToken(refreshedToken);
106    })
107    .catch(function(err) {
108      
109    });
110});
111
112function requestToken() {
113    messaging.getToken()
114    .then(function(currentToken) {
115	  
116      if (currentToken !== getStoredToken() ) {
117        setTokenSent(false);
118        sendToken(currentToken);
119		
120      }
121    })
122    .catch(function(err) {
123      
124      setTokenSent(false);
125    });
126}
127
128messaging.onMessage(function(payload) {
129
130	const notification = payload.notification;
131    const notificationTitle = notification.title;
132    const notificationOptions = {
133        body: notification.body,
134        icon: notification.icon,
135		notification: notification,
136		data: {
137			url: notification.click_action,
138
139			user_token :  getStoredToken()
140		}
141
142    };
143	
144	
145	if (   
146			
147			(notification.click_action.indexOf("BEAT") == 0)
148	   ) {
149		try { refreshChat() } catch (e) { }
150		return;	
151	}
152	
153	
154	var the_url = "https://www.dinomarket.com/firebase/token.cfm?receive&msgid="+ notification.m_id + '&token=' + strToHex(getStoredToken());
155	
156	var xhr = new XMLHttpRequest();
157	xhr.open('GET',the_url);
158	xhr.onload = function() {
159		if (xhr.status === 200) {
160			
161		}
162		else {
163			
164		}
165	};
166	xhr.send();
167	
168	
169
170    if (!("Notification" in window)) {
171        
172    }
173    else if (Notification.permission === "granted") {
174        var thisNotification = new Notification(notificationTitle,notificationOptions);
175        thisNotification.onclick = function(event) {
176            event.preventDefault();
177			
178			var the_url = "https://www.dinomarket.com/firebase/token.cfm?open&msgid="+ notification.m_id + '&token=' + strToHex(getStoredToken());
179			
180			var xhr = new XMLHttpRequest();
181			xhr.open('GET',the_url);
182			xhr.onload = function() {
183				if (xhr.status === 200) {
184					
185				}
186				else {
187					
188				}
189			};
190			xhr.send();
191			
192			
193            window.open(notification.click_action , '_blank');
194            thisNotification.close();
195        }
196    }
197});
198
199function deleteToken() {
200    messaging.getToken()
201    .then(function(currentToken) {
202      messaging.deleteToken(currentToken)
203      .then(function() {
204        
205        setTokenSent(false);
206      })
207      .catch(function(err) {
208        
209      });
210    })
211    .catch(function(err) {
212      
213    });
214}
215
216function resendToken(){
217    messaging.getToken()
218    .then(function(currentToken) {
219        sendToken(currentToken);
220		setTokenSent(true);
221    })
222	.catch(function(err) {
223      
224    });
225}
226
227resendToken();
228requestPermission();

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.