1 2// íì´ì´ë² ì´ì¤ ì¬ì© ê°ë¥ ì¬ë¶ íì¸ (1:ê°ë¥, 0:ë¶ê°ë¥) 3function fn_checkFirebase() { 4 const agent = navigator.userAgent.toLowerCase(); 5 const inapp = agent.indexOf("inapp"); 6 const safari = agent.indexOf("safari"); 7 const chrome = agent.indexOf("chrome"); 8 9 if(inapp > -1 || (safari > -1 && chrome == -1)) { 10 return 0; 11 } else { 12 return 1; 13 } 14} 15 16var firebaseConfig = { 17 apiKey: "AIzaSyApWnilxwPiu4cp5_yvOqtKUeKP7BXSXZk", 18 authDomain: "korea-kr.firebaseapp.com", 19 projectId: "korea-kr", 20 storageBucket: "korea-kr.appspot.com", 21 messagingSenderId: "6477873872", 22 appId: "1:6477873872:web:2322cff2fbf2ac53bad4d5", 23 measurementId: "G-KDC8NHJF70" 24}; 25 26var messaging; 27var permission = 'denied'; 28 29if(fn_checkFirebase()) { 30 // Initialize Firebase 31 firebase.initializeApp(firebaseConfig); 32 messaging = firebase.messaging(); 33 permission = Notification.permission; 34} 35 36// ì¢ ëª¨ì 컨í¸ë¡¤ 37function fn_controllNoti(type) { 38 if(type == "ON") { 39 $('#notify_button_id').removeClass("off"); 40 $('#notify_button_id').html('<span class="sr-only">ì림<span>ON</span></span>'); 41 } else { 42 if(!$('#notify_button_id').hasClass('off')){ 43 $('#notify_button_id').addClass('off'); 44 $('#notify_button_id').html('<span class="sr-only">ì림ì¤ì <span>OFF</span></span>'); 45 } 46 } 47} 48 49const getToken = () => { 50 messaging.getToken() 51 .then((currentToken) => { 52 if (currentToken && !checkLocalStorageItem('token', currentToken)) { 53 var param = { token: currentToken }; 54 var jshr = $.getJSON('/etc/fcmTokenInit.do', param, function(data) { 55 console.log('í í° DB ë±ë¡ ìë£'); 56 }); 57 jshr.complete(function() { 58 setLocalStorageItem('token', currentToken); 59 console.log('í í° LocalStorage ë±ë¡ ìë£'); 60 }); 61 } 62 }) 63 .catch((err) => { 64 console.log('í í° ê°ì ¸ì¤ê¸° ì¤í¨', err); 65 }); 66}; 67 68const requestPermission = () => { 69 Notification.requestPermission() 70 .then((permission) => { 71 if (permission === 'granted') { 72 console.log('í¸ì íì©'); 73 getToken(); 74 75 } else if (permission === 'denied') { 76 console.log('í¸ì ì°¨ë¨'); 77 const currentToken = getLocalStorageItem('token'); 78 if (currentToken !== 'D') { 79 setLocalStorageItem('token', 'D'); 80 } 81 } else { 82 console.log('í¸ì 기본ê°'); 83 } 84 }); 85}; 86 87// ì¬ì©ì ì ë³´ ì¡°í í ì¢ ëª¨ì ì¤ì 88const controllNotiBtn = () => { 89 if (permission === 'granted') { 90 var param = { token: getLocalStorageItem('token') }; 91 var jshr = $.getJSON('/etc/checkUserSetting.do', param, function(data) { 92 console.log("íì¬ ì¬ì©ì ì림 ì¤ì ê° ê°¯ì : "+data.result); 93 if(data.result > 0 || data.result == -1) { 94 fn_controllNoti("ON"); 95 } else { 96 fn_controllNoti("OFF"); 97 } 98 }); 99 } else if (permission === 'denied') { 100 fn_controllNoti("OFF"); 101 } 102} 103 104requestPermission(); 105 106const getLocalStorageItem = (k) => localStorage.getItem(k); 107const setLocalStorageItem = (k, v) => localStorage.setItem(k, v); 108const checkLocalStorageItem = (k, v) => localStorage.getItem(k) === v;
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.