@@ -13,6 +13,7 @@ import { defaultStatistics } from "@util/constant/option"
1313import { defineComponent , h , reactive , unref } from "vue"
1414import { t } from "@app/locale"
1515import { renderOptionItem , tagText , tooltip } from "../common"
16+ import { IS_SAFARI } from "@util/constant/environment"
1617
1718function updateOptionVal ( key : keyof timer . option . StatisticsOption , newVal : boolean , option : UnwrapRef < timer . option . StatisticsOption > ) {
1819 option [ key ] = newVal
@@ -40,6 +41,35 @@ function copy(target: timer.option.StatisticsOption, source: timer.option.Statis
4041 target . countLocalFiles = source . countLocalFiles
4142}
4243
44+ function renderOptionItems ( option : timer . option . StatisticsOption ) {
45+ const result = [ ]
46+ if ( ! IS_SAFARI ) {
47+ // chrome.idle does not work in Safari, so not to display this option
48+ result . push (
49+ renderOptionItem ( {
50+ input : countWhenIdle ( option ) ,
51+ idleTime : tagText ( msg => msg . option . statistics . idleTime ) ,
52+ info : tooltip ( msg => msg . option . statistics . idleTimeInfo )
53+ } , msg => msg . statistics . countWhenIdle , t ( msg => msg . option . no ) ) ,
54+ h ( ElDivider )
55+ )
56+ }
57+ result . push (
58+ renderOptionItem ( {
59+ input : countLocalFiles ( option ) ,
60+ localFileTime : tagText ( msg => msg . option . statistics . localFileTime ) ,
61+ info : tooltip ( msg => msg . option . statistics . localFilesInfo )
62+ } , msg => msg . statistics . countLocalFiles , t ( msg => msg . option . no ) ) ,
63+ h ( ElDivider ) ,
64+ renderOptionItem ( {
65+ input : collectSiteName ( option ) ,
66+ siteName : tagText ( msg => msg . option . statistics . siteName ) ,
67+ siteNameUsage : tooltip ( msg => msg . option . statistics . siteNameUsage )
68+ } , msg => msg . statistics . collectSiteName , t ( msg => msg . option . yes ) )
69+ )
70+ return result
71+ }
72+
4373const _default = defineComponent ( {
4474 name : "StatisticsOptionContainer" ,
4575 setup ( _props , ctx ) {
@@ -51,25 +81,7 @@ const _default = defineComponent({
5181 await optionService . setStatisticsOption ( unref ( option ) )
5282 }
5383 } )
54- return ( ) => h ( 'div' , [
55- renderOptionItem ( {
56- input : countWhenIdle ( option ) ,
57- idleTime : tagText ( msg => msg . option . statistics . idleTime ) ,
58- info : tooltip ( msg => msg . option . statistics . idleTimeInfo )
59- } , msg => msg . statistics . countWhenIdle , t ( msg => msg . option . no ) ) ,
60- h ( ElDivider ) ,
61- renderOptionItem ( {
62- input : countLocalFiles ( option ) ,
63- localFileTime : tagText ( msg => msg . option . statistics . localFileTime ) ,
64- info : tooltip ( msg => msg . option . statistics . localFilesInfo )
65- } , msg => msg . statistics . countLocalFiles , t ( msg => msg . option . no ) ) ,
66- h ( ElDivider ) ,
67- renderOptionItem ( {
68- input : collectSiteName ( option ) ,
69- siteName : tagText ( msg => msg . option . statistics . siteName ) ,
70- siteNameUsage : tooltip ( msg => msg . option . statistics . siteNameUsage )
71- } , msg => msg . statistics . collectSiteName , t ( msg => msg . option . yes ) )
72- ] )
84+ return ( ) => h ( 'div' , renderOptionItems ( option ) )
7385 }
7486} )
7587
0 commit comments