2019-09-20 22:32:52 +02:00
//META{"name":"CompleteTimestamps","website":"https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/CompleteTimestamps","source":"https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/CompleteTimestamps/CompleteTimestamps.plugin.js"}*//
2018-10-11 10:21:26 +02:00
class CompleteTimestamps {
2019-01-17 23:48:29 +01:00
getName ( ) { return "CompleteTimestamps" ; }
2019-11-14 14:42:54 +01:00
getVersion ( ) { return "1.3.7" ; }
2019-01-17 23:48:29 +01:00
getAuthor ( ) { return "DevilBro" ; }
getDescription ( ) { return "Replace all timestamps with complete timestamps." ; }
2019-01-26 22:45:19 +01:00
2019-09-04 12:34:02 +02:00
constructor ( ) {
2019-02-03 18:03:02 +01:00
this . changelog = {
2019-11-14 14:42:54 +01:00
"fixed" : [ [ "Arabic Usernames" , "Fixed issue where arabic usernames would break timestamps that contain a space" ] ] ,
2019-11-02 01:35:16 +01:00
"improved" : [ [ "New Library Structure & React" , "Restructured my Library and switched to React rendering instead of DOM manipulation" ] ]
2019-02-03 18:03:02 +01:00
} ;
2019-09-04 12:34:02 +02:00
2019-11-14 17:56:26 +01:00
this . patchedModules = {
after : {
Message : "render" ,
MessageContent : "render" ,
Embed : "render"
}
2019-01-17 23:48:29 +01:00
} ;
2019-09-04 12:34:02 +02:00
}
2019-01-26 22:45:19 +01:00
2019-09-04 12:34:02 +02:00
initConstructor ( ) {
2019-09-11 12:14:43 +02:00
this . languages = { } ;
2018-10-11 10:21:26 +02:00
this . defaults = {
settings : {
showInChat : { value : true , description : "Replace Chat Timestamp with Complete Timestamp:" } ,
2019-04-07 21:33:13 +02:00
showInEmbed : { value : true , description : "Replace Embed Timestamp with Complete Timestamp:" } ,
2018-10-11 10:21:26 +02:00
showOnHover : { value : false , description : "Also show Timestamp when you hover over a message:" } ,
changeForEdit : { value : false , description : "Change the Time for the Edited Time Tooltips:" } ,
displayTime : { value : true , description : "Display the Time in the Timestamp:" } ,
displayDate : { value : true , description : "Display the Date in the Timestamp:" } ,
cutSeconds : { value : false , description : "Cut off Seconds of the Time:" } ,
forceZeros : { value : false , description : "Force leading Zeros:" } ,
otherOrder : { value : false , description : "Show the Time before the Date:" }
} ,
choices : {
creationDateLang : { value : "$discord" , description : "Timestamp Format:" }
} ,
formats : {
ownFormat : { value : "$hour:$minute:$second, $day.$month.$year" , description : "Own Format:" }
}
} ;
}
2019-01-26 22:45:19 +01:00
2018-10-11 10:21:26 +02:00
getSettingsPanel ( ) {
2019-01-22 11:28:32 +01:00
if ( ! global . BDFDB || typeof BDFDB != "object" || ! BDFDB . loaded || ! this . started ) return ;
2019-10-22 19:49:57 +02:00
let settings = BDFDB . DataUtils . get ( this , "settings" ) ;
let choices = BDFDB . DataUtils . get ( this , "choices" ) ;
let formats = BDFDB . DataUtils . get ( this , "formats" ) ;
2019-11-14 14:42:54 +01:00
let settingsitems = [ ] ;
2019-11-02 01:35:16 +01:00
for ( let key in settings ) settingsitems . push ( BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . SettingsSaveItem , {
className : BDFDB . disCN . marginbottom8 ,
type : "Switch" ,
plugin : this ,
keys : [ "settings" , key ] ,
label : this . defaults . settings [ key ] . description ,
value : settings [ key ] ,
onChange : ( e , instance ) => {
2019-11-02 10:06:49 +01:00
BDFDB . ReactUtils . forceUpdate ( BDFDB . ReactUtils . findOwner ( BDFDB . ReactUtils . findOwner ( instance , { name : "BDFDB_SettingsPanel" , up : true } ) , { name : "BDFDB_Select" , all : true , noCopies : true } ) ) ;
2019-11-02 01:35:16 +01:00
}
} ) ) ;
settingsitems . push ( BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . FormComponents . FormDivider , {
className : BDFDB . disCN . marginbottom8
} ) ) ;
for ( let key in choices ) settingsitems . push ( BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . SettingsSaveItem , {
className : BDFDB . disCN . marginbottom8 ,
type : "Select" ,
plugin : this ,
keys : [ "choices" , key ] ,
label : this . defaults . choices [ key ] . description ,
basis : "70%" ,
value : choices [ key ] ,
options : BDFDB . ObjectUtils . toArray ( BDFDB . ObjectUtils . map ( this . languages , ( lang , id ) => { return { value : id , label : lang . name } } ) ) ,
searchable : true ,
optionRenderer : lang => {
return BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Flex , {
align : BDFDB . LibraryComponents . Flex . Align . CENTER ,
children : [
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Flex . Child , {
grow : 0 ,
shrink : 0 ,
basis : "40%" ,
children : lang . label
} ) ,
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Flex . Child , {
grow : 0 ,
shrink : 0 ,
basis : "60%" ,
children : this . getTimestamp ( this . languages [ lang . value ] . id )
} )
]
} ) ;
} ,
valueRenderer : lang => {
return BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Flex , {
align : BDFDB . LibraryComponents . Flex . Align . CENTER ,
children : [
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Flex . Child , {
grow : 0 ,
shrink : 0 ,
children : lang . label
} ) ,
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Flex . Child , {
grow : 1 ,
shrink : 0 ,
basis : "70%" ,
children : this . getTimestamp ( this . languages [ lang . value ] . id )
} )
]
} ) ;
}
} ) ) ;
settingsitems . push ( BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . FormComponents . FormDivider , {
className : BDFDB . disCN . marginbottom8
} ) ) ;
for ( let key in formats ) settingsitems . push ( BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . SettingsSaveItem , {
className : BDFDB . disCN . marginbottom8 ,
type : "TextInput" ,
plugin : this ,
keys : [ "formats" , key ] ,
label : this . defaults . formats [ key ] . description ,
basis : "70%" ,
value : formats [ key ] ,
onChange : ( e , instance ) => {
2019-11-02 10:06:49 +01:00
BDFDB . ReactUtils . forceUpdate ( BDFDB . ReactUtils . findOwner ( BDFDB . ReactUtils . findOwner ( instance , { name : "BDFDB_SettingsPanel" , up : true } ) , { name : "BDFDB_Select" , all : true , noCopies : true } ) ) ;
2019-11-02 01:35:16 +01:00
}
} ) ) ;
settingsitems . push ( BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . CollapseContainer , {
title : "Placeholder Guide" ,
dividertop : true ,
collapsed : BDFDB . DataUtils . load ( this , "hideInfo" , "hideInfo" ) ,
children : [ "$hour will be replaced with the current hour" , "$minute will be replaced with the current minutes" , "$second will be replaced with the current seconds" , "$msecond will be replaced with the current milliseconds" , "$timemode will change $hour to a 12h format and will be replaced with AM/PM" , "$year will be replaced with the current year" , "$month will be replaced with the current month" , "$day will be replaced with the current day" , "$monthnameL will be replaced with the monthname in long format based on the Discord Language" , "$monthnameS will be replaced with the monthname in short format based on the Discord Language" , "$weekdayL will be replaced with the weekday in long format based on the Discord Language" , "$weekdayS will be replaced with the weekday in short format based on the Discord Language" ] . map ( string => {
return BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . FormComponents . FormText , {
type : BDFDB . LibraryComponents . FormComponents . FormTextTypes . DESCRIPTION ,
children : string
} ) ;
} ) ,
onClick : collapsed => {
BDFDB . DataUtils . save ( collapsed , this , "hideInfo" , "hideInfo" ) ;
}
} ) ) ;
return BDFDB . PluginUtils . createSettingsPanel ( this , settingsitems ) ;
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
2018-10-11 10:21:26 +02:00
//legacy
load ( ) { }
2019-01-26 22:45:19 +01:00
2018-10-11 10:21:26 +02:00
start ( ) {
2019-02-04 09:13:15 +01:00
if ( ! global . BDFDB ) global . BDFDB = { myPlugins : { } } ;
if ( global . BDFDB && global . BDFDB . myPlugins && typeof global . BDFDB . myPlugins == "object" ) global . BDFDB . myPlugins [ this . getName ( ) ] = this ;
2019-05-26 13:55:26 +02:00
var libraryScript = document . querySelector ( 'head script#BDFDBLibraryScript' ) ;
if ( ! libraryScript || ( performance . now ( ) - libraryScript . getAttribute ( "date" ) ) > 600000 ) {
2018-10-11 10:21:26 +02:00
if ( libraryScript ) libraryScript . remove ( ) ;
libraryScript = document . createElement ( "script" ) ;
2019-05-26 13:55:26 +02:00
libraryScript . setAttribute ( "id" , "BDFDBLibraryScript" ) ;
2018-10-11 10:21:26 +02:00
libraryScript . setAttribute ( "type" , "text/javascript" ) ;
2019-10-18 10:56:41 +02:00
libraryScript . setAttribute ( "src" , "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.min.js" ) ;
2019-01-17 23:48:29 +01:00
libraryScript . setAttribute ( "date" , performance . now ( ) ) ;
2019-05-26 13:55:26 +02:00
libraryScript . addEventListener ( "load" , ( ) => { this . initialize ( ) ; } ) ;
2018-10-11 10:21:26 +02:00
document . head . appendChild ( libraryScript ) ;
2019-05-26 13:55:26 +02:00
}
else if ( global . BDFDB && typeof BDFDB === "object" && BDFDB . loaded ) this . initialize ( ) ;
2019-11-01 10:27:07 +01:00
this . startTimeout = setTimeout ( ( ) => {
try { return this . initialize ( ) ; }
catch ( err ) { console . error ( ` %c[ ${ this . getName ( ) } ]%c ` , "color: #3a71c1; font-weight: 700;" , "" , "Fatal Error: Could not initiate plugin! " + err ) ; }
} , 30000 ) ;
2018-10-11 10:21:26 +02:00
}
initialize ( ) {
2019-01-17 23:48:29 +01:00
if ( global . BDFDB && typeof BDFDB === "object" && BDFDB . loaded ) {
2019-01-22 11:05:54 +01:00
if ( this . started ) return ;
2019-10-22 18:55:25 +02:00
BDFDB . PluginUtils . init ( this ) ;
2019-01-26 22:45:19 +01:00
2019-10-22 18:55:25 +02:00
this . languages = Object . assign ( { "own" : { name : "Own" , id : "own" , integrated : false , dic : false } } , BDFDB . LanguageUtils . languages ) ;
2019-01-26 22:45:19 +01:00
2019-10-22 18:55:25 +02:00
BDFDB . ModuleUtils . forceAllUpdates ( this ) ;
2018-10-11 10:21:26 +02:00
}
2019-11-01 10:14:50 +01:00
else console . error ( ` %c[ ${ this . getName ( ) } ]%c ` , "color: #3a71c1; font-weight: 700;" , "" , "Fatal Error: Could not load BD functions!" ) ;
2018-10-11 10:21:26 +02:00
}
stop ( ) {
2019-01-17 23:48:29 +01:00
if ( global . BDFDB && typeof BDFDB === "object" && BDFDB . loaded ) {
2019-10-22 11:37:23 +02:00
this . stopping = true ;
2019-11-02 01:35:16 +01:00
2019-10-23 11:10:01 +02:00
BDFDB . DOMUtils . removeLocalStyle ( this . name + "CompactCorrection" ) ;
2019-01-26 22:45:19 +01:00
2019-11-02 01:35:16 +01:00
BDFDB . ModuleUtils . forceAllUpdates ( this ) ;
2019-10-22 18:55:25 +02:00
BDFDB . PluginUtils . clear ( this ) ;
2018-10-11 10:21:26 +02:00
}
}
2019-01-26 22:45:19 +01:00
2018-10-11 10:21:26 +02:00
// begin of own functions
2019-11-05 20:35:35 +01:00
onSettingsClosed ( ) {
2019-11-02 01:35:16 +01:00
if ( this . SettingsUpdated ) {
delete this . SettingsUpdated ;
BDFDB . ModuleUtils . forceAllUpdates ( this ) ;
2018-10-11 10:21:26 +02:00
}
}
2019-11-02 01:35:16 +01:00
processMessage ( e ) {
2019-11-05 09:15:23 +01:00
if ( ! e . instance . props . isCompact ) {
2019-11-02 01:35:16 +01:00
let settings = BDFDB . DataUtils . get ( this , "settings" ) ;
if ( settings . showInChat ) this . injectTimestamp ( e . returnvalue , e . instance . props ) ;
if ( settings . showOnHover ) {
let [ children , index ] = BDFDB . ReactUtils . findChildren ( e . returnvalue , { props : [ [ "className" , BDFDB . disCN . messagecontent ] ] } ) ;
if ( index > - 1 ) {
let content = children [ index ] ;
children [ index ] = BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . TooltipContainer , {
text : this . getTimestamp ( this . languages [ BDFDB . DataUtils . get ( this , "choices" , "creationDateLang" ) ] . id , e . instance . props . message . timestamp . _i ) ,
tooltipConfig : {
type : "left"
} ,
children : content
} ) ;
}
}
2018-10-11 10:21:26 +02:00
}
}
2019-01-17 23:48:29 +01:00
2019-11-02 01:35:16 +01:00
processMessageContent ( e ) {
2019-11-05 09:15:23 +01:00
if ( typeof e . returnvalue . props . children == "function" ) {
2019-11-02 01:35:16 +01:00
let settings = BDFDB . DataUtils . get ( this , "settings" ) ;
let renderChildren = e . returnvalue . props . children ;
2019-11-17 12:34:38 +01:00
e . returnvalue . props . children = ( ... args ) => {
let renderedChildren = renderChildren ( ... args ) ;
2019-11-02 01:35:16 +01:00
if ( e . instance . props . isCompact && settings . showInChat ) this . injectTimestamp ( renderedChildren , e . instance . props ) ;
if ( settings . changeForEdit ) this . injectEditStamp ( renderedChildren , e . instance . props ) ;
return renderedChildren ;
} ;
BDFDB . TimeUtils . timeout ( this . setMaxWidth . bind ( this ) ) ;
2018-10-11 10:21:26 +02:00
}
2019-04-27 18:45:01 +02:00
}
2019-09-04 12:34:02 +02:00
2019-11-02 01:35:16 +01:00
processEmbed ( e ) {
if ( e . instance . props . embed . timestamp && BDFDB . DataUtils . get ( this , "settings" , "showInEmbed" ) ) {
let [ children , index ] = BDFDB . ReactUtils . findChildren ( e . returnvalue , { props : [ [ "className" , BDFDB . disCN . embedfootertext ] ] } ) ;
if ( index > - 1 && BDFDB . ArrayUtils . is ( children [ index ] . props . children ) ) children [ index ] . props . children . splice ( children [ index ] . props . children . length - 1 , 1 , this . getTimestamp ( this . languages [ BDFDB . DataUtils . get ( this , "choices" , "creationDateLang" ) ] . id , e . instance . props . embed . timestamp . _i ) ) ;
}
2019-01-17 23:48:29 +01:00
}
2019-11-02 01:35:16 +01:00
injectTimestamp ( parent , props ) {
let [ children , index ] = BDFDB . ReactUtils . findChildren ( parent , { name : "MessageTimestamp" } ) ;
2019-11-14 14:42:54 +01:00
if ( index > - 1 ) {
if ( ! props . isCompact ) children . splice ( index ++ , 0 , BDFDB . ReactUtils . createElement ( "span" , {
children : "ARABIC-FIX" ,
style : {
fontSize : 0 ,
visibility : "hidden"
}
} ) ) ;
children . splice ( index , 1 , BDFDB . ReactUtils . createElement ( "time" , {
className : BDFDB . DOMUtils . formatClassName ( props . backgroundOpacity ? BDFDB . disCN [ "message" + props . backgroundOpacity + "backgroundopacity" ] : null , ! ( props . isEditing || props . isHeader ) ? BDFDB . disCN . messagetimestampvisibleonhover : null , props . isCompact ? ( props . isMentioned ? BDFDB . disCN . messagetimestampcompactismentioned : BDFDB . disCN . messagetimestampcompact ) : BDFDB . disCN . messagetimestampcozy ) ,
dateTime : props . message . timestamp ,
children : [
BDFDB . ReactUtils . createElement ( "i" , {
className : BDFDB . disCN . messagetimestampseparatorleft ,
children : props . isCompact ? "[" : " ["
} ) ,
this . getTimestamp ( this . languages [ BDFDB . DataUtils . get ( this , "choices" , "creationDateLang" ) ] . id , props . message . timestamp . _i ) ,
BDFDB . ReactUtils . createElement ( "i" , {
className : BDFDB . disCN . messagetimestampseparatorright ,
children : props . isCompact ? "] " : "]"
} )
]
} ) ) ;
}
2019-01-17 23:48:29 +01:00
}
2019-11-02 01:35:16 +01:00
injectEditStamp ( parent , props ) {
let [ children , index ] = BDFDB . ReactUtils . findChildren ( parent , { name : "SuffixEdited" } ) ;
if ( index > - 1 ) children . splice ( index , 1 , BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . TooltipContainer , {
text : this . getTimestamp ( this . languages [ BDFDB . DataUtils . get ( this , "choices" , "creationDateLang" ) ] . id , props . message . editedTimestamp . _i ) ,
children : BDFDB . ReactUtils . createElement ( "time" , {
className : BDFDB . disCN . messageedited ,
dateTime : props . message . editedTimestamp ,
children : ` ( ${ BDFDB . LanguageStrings . MESSAGE _EDITED . toLowerCase ( ) } ) `
} )
} ) ) ;
2019-04-07 21:33:13 +02:00
}
2018-10-11 10:21:26 +02:00
getTimestamp ( languageid , time ) {
let timeobj = time ? time : new Date ( ) ;
if ( typeof time == "string" ) timeobj = new Date ( time ) ;
if ( timeobj . toString ( ) == "Invalid Date" ) timeobj = new Date ( parseInt ( time ) ) ;
if ( timeobj . toString ( ) == "Invalid Date" ) return ;
2019-10-22 19:49:57 +02:00
let settings = BDFDB . DataUtils . get ( this , "settings" ) , timestring = "" ;
2018-10-11 10:21:26 +02:00
if ( languageid != "own" ) {
2019-01-17 23:48:29 +01:00
let timestamp = [ ] ;
2018-10-11 10:21:26 +02:00
if ( settings . displayDate ) timestamp . push ( timeobj . toLocaleDateString ( languageid ) ) ;
if ( settings . displayTime ) timestamp . push ( settings . cutSeconds ? this . cutOffSeconds ( timeobj . toLocaleTimeString ( languageid ) ) : timeobj . toLocaleTimeString ( languageid ) ) ;
if ( settings . otherOrder ) timestamp . reverse ( ) ;
timestring = timestamp . length > 1 ? timestamp . join ( ", " ) : ( timestamp . length > 0 ? timestamp [ 0 ] : "" ) ;
if ( timestring && settings . forceZeros ) timestring = this . addLeadingZeros ( timestring ) ;
}
else {
2019-10-22 20:16:05 +02:00
let ownformat = BDFDB . DataUtils . get ( this , "formats" , "ownFormat" ) ;
2019-10-24 11:47:57 +02:00
languageid = BDFDB . LanguageUtils . getLanguage ( ) . id ;
2019-01-17 23:48:29 +01:00
let hour = timeobj . getHours ( ) , minute = timeobj . getMinutes ( ) , second = timeobj . getSeconds ( ) , msecond = timeobj . getMilliseconds ( ) , day = timeobj . getDate ( ) , month = timeobj . getMonth ( ) + 1 , timemode = "" ;
2018-10-11 10:21:26 +02:00
if ( ownformat . indexOf ( "$timemode" ) > - 1 ) {
timemode = hour >= 12 ? "PM" : "AM" ;
hour = hour % 12 ;
hour = hour ? hour : 12 ;
}
timestring = ownformat
. replace ( "$hour" , settings . forceZeros && hour < 10 ? "0" + hour : hour )
. replace ( "$minute" , minute < 10 ? "0" + minute : minute )
. replace ( "$second" , second < 10 ? "0" + second : second )
2019-09-24 09:48:01 +02:00
. replace ( "$msecond" , settings . forceZeros ? ( msecond < 10 ? "00" + msecond : ( msecond < 100 ? "0" + msecond : msecond ) ) : msecond )
2018-10-11 10:21:26 +02:00
. replace ( "$timemode" , timemode )
. replace ( "$weekdayL" , timeobj . toLocaleDateString ( languageid , { weekday : "long" } ) )
. replace ( "$weekdayS" , timeobj . toLocaleDateString ( languageid , { weekday : "short" } ) )
. replace ( "$monthnameL" , timeobj . toLocaleDateString ( languageid , { month : "long" } ) )
. replace ( "$monthnameS" , timeobj . toLocaleDateString ( languageid , { month : "short" } ) )
. replace ( "$day" , settings . forceZeros && day < 10 ? "0" + day : day )
. replace ( "$month" , settings . forceZeros && month < 10 ? "0" + month : month )
. replace ( "$year" , timeobj . getFullYear ( ) ) ;
}
return timestring ;
}
2019-01-26 22:45:19 +01:00
2018-10-11 10:21:26 +02:00
cutOffSeconds ( timestring ) {
2019-11-02 01:35:16 +01:00
return timestring . replace ( /(.{1,2}:.{1,2}):.{1,2}(.*)/ , "$1$2" ) . replace ( /(.{1,2}\..{1,2})\..{1,2}(.*)/ , "$1$2" ) . replace ( /(.{1,2} h .{1,2} min) .{1,2} s(.*)/ , "$1$2" ) ;
2018-10-11 10:21:26 +02:00
}
2019-01-26 22:45:19 +01:00
2018-10-11 10:21:26 +02:00
addLeadingZeros ( timestring ) {
2019-01-17 23:48:29 +01:00
let chararray = timestring . split ( "" ) ;
let numreg = /[0-9]/ ;
for ( let i = 0 ; i < chararray . length ; i ++ ) {
2018-10-11 10:21:26 +02:00
if ( ! numreg . test ( chararray [ i - 1 ] ) && numreg . test ( chararray [ i ] ) && ! numreg . test ( chararray [ i + 1 ] ) ) chararray [ i ] = "0" + chararray [ i ] ;
}
2019-01-26 22:45:19 +01:00
2018-10-11 10:21:26 +02:00
return chararray . join ( "" ) ;
}
2019-01-26 22:45:19 +01:00
2018-10-11 10:21:26 +02:00
setMaxWidth ( ) {
2019-10-22 18:55:25 +02:00
if ( this . currentMode != BDFDB . DiscordUtils . getMode ( ) ) {
this . currentMode = BDFDB . DiscordUtils . getMode ( ) ;
2019-01-17 23:48:29 +01:00
let timestamp = document . querySelector ( BDFDB . dotCN . messagetimestampcompact ) ;
2018-12-14 12:08:12 +01:00
if ( timestamp ) {
2019-10-22 20:16:05 +02:00
let choice = BDFDB . DataUtils . get ( this , "choices" , "creationDateLang" ) ;
2019-10-23 11:10:01 +02:00
let testtimestamp = BDFDB . DOMUtils . create ( ` <time class=" ${ timestamp . className } " style="width: auto !important;"> ${ this . getTimestamp ( this . languages [ choice ] . id , new Date ( 253402124399995 ) ) } </time> ` ) ;
2019-01-17 23:48:29 +01:00
document . body . appendChild ( testtimestamp ) ;
2019-10-23 11:10:01 +02:00
let width = BDFDB . DOMUtils . getRects ( testtimestamp ) . width + 5 ;
2018-12-14 12:08:12 +01:00
testtimestamp . remove ( ) ;
2019-10-23 11:10:01 +02:00
BDFDB . DOMUtils . appendLocalStyle ( this . name + "CompactCorrection" , `
2018-12-14 12:08:12 +01:00
$ { BDFDB . dotCN . messagetimestampcompact } {
width : $ { width } px ! important ;
}
$ { BDFDB . dotCN . messagetimestampcompactismentioned } {
width : $ { width + 2 } px ! important ;
}
$ { BDFDB . dotCN . messagemarkupiscompact } {
2019-11-02 01:35:16 +01:00
margin - left : calc ( $ { width } px + 4 ch ) ! important ;
text - indent : calc ( - $ { width } px - 4 ch ) ! important ;
}
$ { BDFDB . dotCN . messagemarkupiscompact } > label {
margin - left : calc ( $ { width } px + 4 ch ) ! important ;
2018-12-14 12:08:12 +01:00
}
$ { BDFDB . dotCN . messageaccessorycompact } {
padding - left : $ { width } px ! important ;
}
` );
}
2019-10-23 11:10:01 +02:00
else BDFDB . DOMUtils . removeLocalStyle ( this . name + "CompactCorrection" ) ;
2018-10-11 10:21:26 +02:00
}
}
}