8888 Activity and time for these domains will not be tracked
8989 </p >
9090 <ul readonly class =" url-list" >
91- <li v-for =" (url, i) of whiteList" :key =" i" >{{ url }}</li >
91+ <li v-for =" (url, i) of whiteList" :key =" i" >
92+ <div >
93+ <img
94+ src =" ../assets/icons/delete.png"
95+ height =" 16"
96+ @click =" deleteFromWhiteList(url)"
97+ />
98+ {{ url }}
99+ </div >
100+ </li >
92101 </ul >
93102 <div class =" mt-20" >
94103 <input
102111 class =" d-inline-block small-btn ml-10"
103112 value =" Add Website"
104113 :disabled =" newWebsiteForWhiteList == null || newWebsiteForWhiteList == ''"
105- @click =" addWebsite ()"
114+ @click =" addToWhiteList ()"
106115 />
107116 </div >
108117 </div >
@@ -204,14 +213,14 @@ onMounted(async () => {
204213 StorageParams .BLOCK_DEFERRAL ,
205214 BLOCK_DEFERRAL_DEFAULT ,
206215 );
207- whiteList .value = await settingsStorage .getValue (StorageParams .BLACK_LIST , []);
216+ whiteList .value = Object . values ( await settingsStorage .getValue (StorageParams .BLACK_LIST , []) );
208217});
209218
210219async function save(storageParam : StorageParams , value : any ) {
211220 if (value != undefined ) await settingsStorage .saveValue (storageParam , value );
212221}
213222
214- async function addWebsite () {
223+ function addToWhiteList () {
215224 const existingItem = whiteList .value ?.find (x =>
216225 isDomainEquals (extractHostname (x ), extractHostname (newWebsiteForWhiteList .value ! )),
217226 );
@@ -221,12 +230,18 @@ async function addWebsite() {
221230 type: ' error' ,
222231 });
223232 } else {
224- whiteList .value ?.push (newWebsiteForWhiteList .value ! );
233+ const newWebsite = extractHostname (newWebsiteForWhiteList .value ! );
234+ whiteList .value ?.push (newWebsite );
225235 onChange (StorageParams .BLACK_LIST , whiteList .value );
226236 newWebsiteForWhiteList .value = ' ' ;
227237 }
228238}
229239
240+ function deleteFromWhiteList(url : string ) {
241+ whiteList .value = whiteList .value ! .filter (x => x != url );
242+ onChange (StorageParams .BLACK_LIST , whiteList .value );
243+ }
244+
230245function onChange(storageParam : StorageParams , value : any ) {
231246 save (storageParam , value );
232247}
@@ -241,4 +256,10 @@ function onChange(storageParam: StorageParams, value: any) {
241256 margin-bottom : 30px ;
242257 display : block ;
243258}
259+
260+ .url-list img {
261+ vertical-align : middle ;
262+ margin-right : 10px ;
263+ cursor : pointer ;
264+ }
244265 </style >
0 commit comments