1(function () { 2 let localStorageData = localStorage.getItem('paywall'); 3 let data = null; 4 let parsedData = null; 5 if (localStorageData) { 6 try { 7 parsedData = JSON.parse(localStorageData) || {}; 8 data = { 9 id: parsedData.id || 999, 10 displayName: parsedData.displayName || "User" 11 }; 12 } catch { } 13 } else { 14 const match = document.cookie.match(/_ytct=([^;]+)/); 15 if (match) { 16 try { 17 const obj = JSON.parse(decodeURIComponent(match[1])); 18 data = { id: obj.id, displayName: obj.dn }; 19 } catch { } 20 } 21 } 22 window.YitPaywall = {} 23 24 if (data !== null) { 25 let user_Type = "registered"; 26 let userId = data.id || ""; 27 let displayName = data.displayName || ""; 28 let user = { props: { userId: userId, "piano_id": userId, user_type: user_Type, displayName: displayName } }; 29 30 window.YitPaywall = { user, data }; 31 } 32 33 34 // Functions to manage paywall data in localStorage 35 const addPaywallDataObj = (key, value) => { 36 window.YitPaywall.addPaywallData(key, value); 37 } 38 39 const getPaywallDataObj = () => { 40 return window.YitPaywall ? window.YitPaywall.data : null 41 } 42 43 const isPaywallDataExistsObj = () => { 44 return !!(window.YitPaywall && window.YitPaywall.data) 45 } 46 47 const removePaywallDataObj = () => { 48 window.YitPaywall.removePaywallData('paywall'); 49 } 50 51 // Attach functions to window object 52 window.YitPaywall.addPaywallDataObj = addPaywallDataObj; 53 window.YitPaywall.getPaywallDataObj = getPaywallDataObj; 54 window.YitPaywall.isPaywallDataExistsObj = isPaywallDataExistsObj; 55 window.YitPaywall.removePaywallDataObj = removePaywallDataObj; 56})() 57 58 59// Functions to manage paywall data in localStorage - OLD 60const addPaywallData = (key, value) => { 61 try { 62 localStorage.setItem(key, JSON.stringify(value)); 63 console.log('Paywall data added successfully'); 64 return true; 65 } catch (error) { 66 console.error('Error adding paywall data:', error); 67 return false; 68 } 69} 70 71const getPaywallData = (key) => { 72 try { 73 const data = localStorage.getItem(key); 74 if (data) { 75 console.log('Paywall data retrieved successfully'); 76 } 77 return data; 78 } catch (error) { 79 console.error('Error getting paywall data:', error); 80 return null; 81 } 82} 83 84const isPaywallDataExists = (key) => { 85 try { 86 const exists = localStorage.getItem(key) !== null; 87 if (exists) { 88 console.log('Paywall data exists'); 89 } 90 return exists; 91 } catch (error) { 92 console.error('Error checking paywall data:', error); 93 return false; 94 } 95} 96 97const removePaywallData = (key) => { 98 try { 99 localStorage.removeItem(key); 100 console.log('Paywall data removed successfully'); 101 return true; 102 } catch (error) { 103 console.error('Error removing paywall data:', error); 104 return false; 105 } 106} 107 108// Attach functions to window object 109window.YitPaywall.addPaywallData = addPaywallData; 110window.YitPaywall.getPaywallData = getPaywallData; 111window.YitPaywall.isPaywallDataExists = isPaywallDataExists; 112window.YitPaywall.removePaywallData = removePaywallData; 113 114
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.