1function formatNumber(n) { 2 if (n < 1) return n.toString() 3 if (n < 1e3) return n.toString() 4 if (n >= 1e3 && n < 1e6) return +(n / 1e3).toFixed(1) + 'K' 5 if (n >= 1e6 && n < 1e9) return +(n / 1e6).toFixed(1) + 'M' 6 if (n >= 1e9 && n < 1e12) return +(n / 1e9).toFixed(1) + 'B' 7 if (n >= 1e12) return +(n / 1e12).toFixed(1) + 'T' 8 return n.toString() 9} 10function truncateString(str = '', num) { 11 if (str?.length <= num) { 12 return str 13 } 14 return str?.slice(0, num) + '...' 15} 16function truncateReviewerName({haveVerifiedBadge = false, showCountryFlg = false, str = ''}) { 17 let showStrChar 18 if(haveVerifiedBadge && showCountryFlg){ 19 showStrChar = 10 20 } else if(haveVerifiedBadge && !showCountryFlg){ 21 showStrChar = 10 22 } else if(!haveVerifiedBadge && showCountryFlg){ 23 showStrChar = 7 24 }else { 25 showStrChar = 17 26 } 27 return truncateString(str, showStrChar) 28} 29function censorReviewerName({isCensor = false, str, firstChars = 1, lastChars = 1}) { 30 if(isCensor){ 31 if (str.length <= firstChars + lastChars) return str; // If name is too short, return it as is 32 const firstPart = str.slice(0, firstChars); 33 const lastPart = str.slice(-lastChars); 34 const middle = '*'.repeat(str.length - firstChars - lastChars); 35 36 return `${firstPart}${middle}${lastPart}`; 37 } 38 return str 39} 40function showDisplayReviewerName({haveVerifiedBadge = false, showCountryFlg = false, str = '', isCensor = false}) { 41 let value = '' 42 if(isCensor){ 43 value = censorReviewerName({isCensor, str}) 44 }else { 45 value = str 46 } 47 return truncateReviewerName({ haveVerifiedBadge, showCountryFlg, str: value }); 48} 49 50 51function roundToNearestHalf(reviewAverage) { 52 const decimal = reviewAverage % 1; 53 if (decimal < 0.25) { 54 return Math.floor(reviewAverage); 55 } else if (decimal >= 0.25 && decimal < 0.75) { 56 return Math.floor(reviewAverage) + 0.5; 57 } else { 58 return Math.ceil(reviewAverage); 59 } 60} 61function isFullStar(star, reviewAverage) { 62 // return star <= Math.floor(reviewAverage); 63 const roundedAverage = this.roundToNearestHalf(reviewAverage); 64 return star <= Math.floor(roundedAverage); 65} 66function isHalfStar(star, reviewAverage) { 67 // return star === Math.floor(reviewAverage) + 1 && (reviewAverage % 1 === 0.5); 68 const roundedAverage = this.roundToNearestHalf(reviewAverage); 69 return star === Math.ceil(roundedAverage) && roundedAverage % 1 === 0.5; 70} 71function isFullEmptyStar(star, reviewAverage) { 72 // return star > Math.floor(reviewAverage) + (reviewAverage % 1 === 0.5 ? 1 : 0); 73 const roundedAverage = this.roundToNearestHalf(reviewAverage); 74 return star > Math.ceil(roundedAverage); 75} 76 77function isHaveMultipleAttachment(attachmentLength, maxAttachment) { 78 return attachmentLength > maxAttachment 79} 80 81function getFileExtension(url) { 82 try { 83 const parsedUrl = new URL(url); 84 const pathname = parsedUrl.pathname; 85 const extension = pathname.substring(pathname.lastIndexOf('.') + 1); 86 return extension ? extension : ''; 87 } catch (error) { 88 console.error('Invalid URL:', error); 89 return ''; 90 } 91} 92 93function getFileType(url) { 94 // Define sets of video, audio, and image extensions 95 const videoExtensions = new Set(['mp4', 'mov', 'avi', 'mkv', 'webm']); 96 const audioExtensions = new Set(['mp3', 'wav', 'aac', 'flac', 'ogg']); 97 const imageExtensions = new Set(['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg']); 98 99 // Get the file extension 100 const extension = getFileExtension(url).toLowerCase(); 101 102 // Return an object indicating the type of file 103 return { 104 isVideo: videoExtensions.has(extension), 105 isAudio: audioExtensions.has(extension), 106 isImage: imageExtensions.has(extension) 107 }; 108} 109 110 111function __rvxTooltipComponent__() { 112 return { 113 tooltipVisible: false, 114 tooltipArrow: true, 115 tooltipPosition: 'bottom', 116 117 initial(){ 118 this.$nextTick(() => { 119 const content = this.$refs.content; 120 121 // Ensure the event listeners are attached after the DOM is ready 122 content.addEventListener('mouseenter', () => { 123 this.tooltipVisible = true; 124 }); 125 126 content.addEventListener('mouseleave', () => { 127 this.tooltipVisible = false;
128 }); 129 }); 130 // this.$refs.content.addEventListener('mouseenter', () => { 131 // console.log('mouseenter =====') 132 // this.tooltipVisible = true; 133 // }); 134 // 135 // this.$refs.content.addEventListener('mouseleave', () => { 136 // console.log('mouseleave ====',) 137 // this.tooltipVisible = false; 138 // }); 139 } 140 } 141}
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.