File tree Expand file tree Collapse file tree 8 files changed +18
-19
lines changed
Expand file tree Collapse file tree 8 files changed +18
-19
lines changed Original file line number Diff line number Diff line change 11import { TimeInterval } from "../entity/time-interval" ;
22import { injecStorage } from "../storage/inject-storage" ;
33import { StorageDeserializeParam , StorageParams } from "../storage/storage-params" ;
4- import { todayLocalDate } from "../utils/common " ;
4+ import { todayLocalDate } from "../utils/today " ;
55
66export async function closeInterval ( domain :string | null ) : Promise < void > {
77 if ( domain == null ) return ;
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { Restriction } from "../entity/restriction";
22import { Tab } from "../entity/tab" ;
33import { injecStorage } from "../storage/inject-storage" ;
44import { StorageParams } from "../storage/storage-params" ;
5- import { todayLocalDate } from "../utils/common " ;
5+ import { todayLocalDate } from "../utils/today " ;
66
77export async function isLimitExceeded ( url : string , tab : Tab ) : Promise < boolean > {
88 const storage = injecStorage ( ) ;
Original file line number Diff line number Diff line change 1- import { convertStringTimeToSummaryTime } from "../common/utility " ;
1+ import { convertStringTimeToSummaryTime } from "../utils/converter " ;
22
33export class Restriction {
44 domain : string ;
55 time : number ;
66
7- constructor ( domain : string , time : string ) {
7+ constructor ( domain : string , time : string ) {
88 this . domain = domain ;
99 this . time = convertStringTimeToSummaryTime ( time ) ;
1010 }
Original file line number Diff line number Diff line change 1- import { todayLocalDate } from "../utils/common " ;
1+ import { todayLocalDate } from "../utils/today " ;
22import { logger } from "../compositions/logger" ;
33
44export class Tab implements ISerializable < Tab > {
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import { ActiveTab } from "./compositions/activeTab";
1212import { isLimitExceeded } from "./compositions/limit-list" ;
1313import { Tab } from "./entity/tab" ;
1414import { useBlockPage } from "./compositions/block-page" ;
15- import { convertSummaryTimeToBadgeString } from "./common/utility " ;
15+ import { convertSummaryTimeToBadgeString } from "./utils/converter " ;
1616
1717const activeTabInstance = ActiveTab . getInstance ( ) ;
1818const storage = injecStorage ( ) ;
Original file line number Diff line number Diff line change 1- export function todayLocalDate ( ) {
2- return new Date ( ) . toLocaleDateString ( 'en-US' ) ;
1+ export function isEmpty ( obj : any ) : boolean {
2+ for ( const prop in obj ) {
3+ if ( obj . hasOwnProperty ( prop ) )
4+ return false ;
5+ }
6+
7+ return JSON . stringify ( obj ) === JSON . stringify ( { } ) ;
38}
Original file line number Diff line number Diff line change 1- export function isEmpty ( obj :any ) : boolean {
2- for ( const prop in obj ) {
3- if ( obj . hasOwnProperty ( prop ) )
4- return false ;
5- }
6-
7- return JSON . stringify ( obj ) === JSON . stringify ( { } ) ;
8- }
9-
10- export function convertStringTimeToSummaryTime ( time :string ) {
1+ export function convertStringTimeToSummaryTime ( time : string ) {
112 const timeValue = time . split ( ':' ) ;
123 const hour = Number ( timeValue [ 0 ] ) ;
134 const min = Number ( timeValue [ 1 ] ) ;
@@ -19,7 +10,7 @@ export function convertStringTimeToSummaryTime(time:string) {
1910 return resultTimeValue ;
2011}
2112
22- export function convertSummaryTimeToBadgeString ( summaryTime :number ) :string {
13+ export function convertSummaryTimeToBadgeString ( summaryTime : number ) : string {
2314 const sec = summaryTime ;
2415 const min = Number ( ( summaryTime / 60 ) . toFixed ( 0 ) ) ;
2516 const hours = Number ( ( summaryTime / ( 60 * 60 ) ) . toFixed ( 1 ) ) ;
Original file line number Diff line number Diff line change 1+ export function todayLocalDate ( ) {
2+ return new Date ( ) . toLocaleDateString ( 'en-US' ) ;
3+ }
You can’t perform that action at this time.
0 commit comments