@@ -14,81 +14,122 @@ class Components {
1414
1515 static get componentIds ( ) {
1616 return {
17+ Dialogs : {
18+ Profile : {
19+ InfoViewer : {
20+ ROOT : '#Dialogs_Profile_InfoViewer' ,
21+ PHOTO : '#Dialogs_Profile_InfoViewer_Content_Photo' ,
22+ NAME : '#Dialogs_Profile_InfoViewer_Content_Info_Name' ,
23+ DETAIL : '#Dialogs_Profile_InfoViewer_Content_Info_Detail' ,
24+
25+ LINKS : {
26+ ROOT : '#Dialogs_Profile_InfoViewer_Content_Info_Links' ,
27+ LINK : '[UUID="Dialogs_Profile_InfoViewer_Content_Info_Links_Link"]'
28+ }
29+ }
30+ }
31+ } ,
32+
1733 Threadlist : {
18- ROOT : " Threadlist" ,
19- THREAD : "Threadlist_Thread"
34+ ROOT : '# Threadlist' ,
35+ THREAD : '[UUID= "Threadlist_Thread"]'
2036 } ,
2137
2238 Thread : {
23- ROOT : " Thread" ,
24- POST : "Thread_Post"
39+ ROOT : '# Thread' ,
40+ POST : '[UUID= "Thread_Post"]'
2541 }
2642 }
2743 }
2844
2945
3046
31- static get Threadlist ( ) {
32- return Object . create ( null , {
33- Thread : {
34- value : ( ( ) => {
35- function Thread ( tid , title ) {
36- if ( ! this . constructor ) throw new TypeError ( "Please use the 'new' operator, the component can't be called as a function." ) ;
47+ static get Dialogs ( ) {
48+ return {
49+ Profile : {
50+ InfoViewer : {
51+ Links : {
52+ Link : ( ( ) => {
53+ function Link ( urlTitle , url ) {
54+ if ( ! this . constructor ) throw new TypeError ( "Please use the 'new' operator, the component can't be called as a function." ) ;
55+
56+ let component = document . importNode ( Components . componentsDoc . querySelector ( `*${ Components . componentIds . Dialogs . Profile . InfoViewer . LINKS . LINK } ` ) , true ) ;
57+
58+ let componentWrapper = DOM ( "ComponentWrapper" ) ;
59+ componentWrapper . appendChild ( component ) ;
60+
61+ componentWrapper . firstElementChild . outerHTML = componentWrapper . firstElementChild . outerHTML . replaces ( [
62+ [ / \$ { urlTitle} / g, urlTitle || url || "Untitled" ] ,
63+ [ / \$ { url} / g, url || "" ] ,
64+ [ / \$ { urlOrigin} / g, new URL ( url ) . origin || locaion . origin ]
65+ ] ) ;
66+
67+ return componentWrapper . firstElementChild ;
68+ } ; Link . prototype = Object . create ( null , {
69+ constructor : { value : Link }
70+ } ) ;
71+
72+ return Link ;
73+ } ) ( )
74+ }
75+ }
76+ }
77+ }
78+ }
3779
38- let component = document . importNode ( Components . componentsDoc . querySelector ( `*[UUID="${ Components . componentIds . Threadlist . THREAD } "]` ) , true ) ;
80+ static get Threadlist ( ) {
81+ return {
82+ Thread : ( ( ) => {
83+ function Thread ( tid , title ) {
84+ if ( ! this . constructor ) throw new TypeError ( "Please use the 'new' operator, the component can't be called as a function." ) ;
3985
40- let componentWrapper = DOM ( "ComponentWrapper" ) ;
41- componentWrapper . appendChild ( component ) ;
86+ let component = document . importNode ( Components . componentsDoc . querySelector ( `*${ Components . componentIds . Threadlist . THREAD } ` ) , true ) ;
4287
43- componentWrapper . firstElementChild . outerHTML = componentWrapper . firstElementChild . outerHTML . replaces ( [
44- [ / \$ { tid} / g, tid || "" ] ,
45- [ / \$ { title} / g, title || "" ]
46- ] ) ;
88+ let componentWrapper = DOM ( "ComponentWrapper" ) ;
89+ componentWrapper . appendChild ( component ) ;
4790
48- return componentWrapper . firstElementChild ;
49- } ; Thread . prototype = Object . create ( null , {
50- constructor : { value : Thread }
51- } ) ;
91+ componentWrapper . firstElementChild . outerHTML = componentWrapper . firstElementChild . outerHTML . replaces ( [
92+ [ / \$ { tid } / g , tid || "" ] ,
93+ [ / \$ { title } / g , title || "" ]
94+ ] ) ;
5295
53- return Thread ;
54- } ) ( ) ,
96+ return componentWrapper . firstElementChild ;
97+ } ; Thread . prototype = Object . create ( null , {
98+ constructor : { value : Thread }
99+ } ) ;
55100
56- enumerable : true
57- }
58- } )
101+ return Thread ;
102+ } ) ( )
103+ }
59104 }
60105
61106 static get Thread ( ) {
62- return Object . create ( null , {
63- Post : {
64- value : ( ( ) => {
65- function Post ( pid , uid , userName , content , createdAt , rnd ) {
66- if ( ! this . constructor ) throw new TypeError ( "Please use the 'new' operator, the component can't be called as a function." ) ;
67-
68- let component = document . importNode ( Components . componentsDoc . querySelector ( `*[UUID="${ Components . componentIds . Thread . POST } "]` ) , true ) ;
69-
70- let componentWrapper = DOM ( "ComponentWrapper" ) ;
71- componentWrapper . appendChild ( component ) ;
72-
73- componentWrapper . firstElementChild . outerHTML = componentWrapper . firstElementChild . outerHTML . replaces ( [
74- [ / \$ { pid} / g, pid || "" ] ,
75- [ / \$ { uid} / g, uid || "" ] ,
76- [ / \$ { userName} / g, userName || "" ] ,
77- [ / \$ { content} / g, content || "" ] ,
78- [ / \$ { createdAt} / g, createdAt || "" ] ,
79- [ / \$ { rnd} / g, rnd || "" ]
80- ] ) ;
81-
82- return componentWrapper . firstElementChild ;
83- } ; Post . prototype = Object . create ( null , {
84- constructor : { value : Post }
85- } ) ;
86-
87- return Post ;
88- } ) ( ) ,
89-
90- enumerable : true
91- }
92- } )
107+ return {
108+ Post : ( ( ) => {
109+ function Post ( pid , uid , userName , content , createdAt , rnd ) {
110+ if ( ! this . constructor ) throw new TypeError ( "Please use the 'new' operator, the component can't be called as a function." ) ;
111+
112+ let component = document . importNode ( Components . componentsDoc . querySelector ( `*${ Components . componentIds . Thread . POST } ` ) , true ) ;
113+
114+ let componentWrapper = DOM ( "ComponentWrapper" ) ;
115+ componentWrapper . appendChild ( component ) ;
116+
117+ componentWrapper . firstElementChild . outerHTML = componentWrapper . firstElementChild . outerHTML . replaces ( [
118+ [ / \$ { pid} / g, pid || "" ] ,
119+ [ / \$ { uid} / g, uid || "" ] ,
120+ [ / \$ { userName} / g, userName || "" ] ,
121+ [ / \$ { content} / g, content || "" ] ,
122+ [ / \$ { createdAt} / g, createdAt || "" ] ,
123+ [ / \$ { rnd} / g, rnd || "" ]
124+ ] ) ;
125+
126+ return componentWrapper . firstElementChild ;
127+ } ; Post . prototype = Object . create ( null , {
128+ constructor : { value : Post }
129+ } ) ;
130+
131+ return Post ;
132+ } ) ( )
133+ }
93134 }
94135}
0 commit comments