Skip to content
This repository was archived by the owner on May 13, 2018. It is now read-only.

Commit c61ed20

Browse files
committed
多数の機能追加・不具合修正
1 parent 002db04 commit c61ed20

11 files changed

Lines changed: 192 additions & 193 deletions

File tree

Profile/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
<Script Src = "/SimpleThread/Core.js"></Script>
1919
<Link Rel = "StyleSheet" Href = "/SimpleThread/Core.css" />
20+
<Script Src = "/SimpleThread/includes/Components.js"></Script>
2021

2122
<Script Src = "Profile.js"></Script>
2223
<Link Rel = "StyleSheet" Href = "Profile.css" />

Thread/Thread.css

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
#Thread_Search_Searcher_Container {
1+
#Threadlist_Tab_Reload {
2+
Display: Inline-Flex;
3+
Align-Items: Center;
4+
}
5+
6+
#Threadlist_Search_Searcher_Container {
27
Width: 100%;
38
}
49

5-
#Thread > Div[Disabled] {
10+
#Threadlist > Div[Disabled] {
611
Display: None;
712
}
813

9-
#Thread A {
14+
#Threadlist A {
1015
Text-Decoration: None;
1116
Cursor: Pointer;
1217
}
1318

14-
#Thread A[Disabled] {
19+
#Threadlist A[Disabled] {
1520
Display: None;
16-
}
17-
18-
#Thread_Tab_Reload {
19-
Display: Inline-Flex;
20-
Align-Items: Center;
2121
}

Thread/Thread.js

Lines changed: 19 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -9,63 +9,40 @@ class Util {
99
});
1010

1111
for (let i = 0; i < res.length; i++) {
12-
let thread = DOM("A", {
13-
classes: ["mdl-list__item"],
12+
let thread = new Components.Threadlist.Thread(res[i].tid, res[i].title);
1413

15-
attributes: {
16-
Href: "Viewer/?tid=" + res[i].tid
17-
},
18-
19-
children: [
20-
DOM("Span", {
21-
classes: ["mdl-list__item-primary-content"],
22-
23-
children: [
24-
DOM("I", {
25-
classes: ["mdl-list__item-avatar", "material-icons"],
26-
text: "person"
27-
}),
28-
29-
DOM("Span", {
30-
text: res[i].title
31-
})
32-
]
33-
})
34-
]
35-
});
36-
37-
DOM("#Thread_Search").appendChild(thread);
38-
if (base.user) if (res[i].jobs.Owner.hasOwnProperty(base.user.uid)) DOM("#Thread_Admin").appendChild(thread);
14+
DOM("#Threadlist_Search").appendChild(thread);
15+
if (base.user) if (res[i].jobs.Owner.hasOwnProperty(base.user.uid)) DOM("#Threadlist_Admin").appendChild(thread);
3916
}
4017
});
4118
}
4219
}
4320

4421
window.addEventListener("DOMContentLoaded", () => {
4522
if (!base.user) {
46-
DOM("$#Thread_Tab_Admin").setAttribute("Disabled", ""),
47-
DOM("$#Thread_Admin").setAttribute("Disabled", "");
23+
DOM("$#Threadlist_Tab_Admin").setAttribute("Disabled", ""),
24+
DOM("$#Threadlist_Admin").setAttribute("Disabled", "");
4825
}
4926

5027
Util.refreshThreadList();
5128

5229

5330

54-
DOM("@Div.Thread_Searcher").forEach((searcher) => {
31+
DOM("@Div.Threadlist_Searcher").forEach((searcher) => {
5532
let rnd = new DOM.Randomizer(DOM.Randomizer.TYPE.LEVEL3).generate(16);
5633

57-
searcher.id = "Thread_Searcher_" + rnd,
58-
searcher.querySelector("Label.Thread_Searcher_Label").id = "Thread_Searcher_Label_" + rnd,
59-
searcher.querySelector("Div.Thread_Searcher_Container").id = "Thread_Searcher_Container_" + rnd,
60-
searcher.querySelector("Input.Thread_Searcher_Container_Input").id = "Thread_Searcher_Container_Input_" + rnd,
61-
searcher.querySelector("Label.Thread_Searcher_Container_Label").id = "Thread_Searcher_Container_Label_" + rnd;
34+
searcher.id = "Threadlist_Searcher_" + rnd,
35+
searcher.querySelector("Label.Threadlist_Searcher_Label").id = "Threadlist_Searcher_Label_" + rnd,
36+
searcher.querySelector("Div.Threadlist_Searcher_Container").id = "Threadlist_Searcher_Container_" + rnd,
37+
searcher.querySelector("Input.Threadlist_Searcher_Container_Input").id = "Threadlist_Searcher_Container_Input_" + rnd,
38+
searcher.querySelector("Label.Threadlist_Searcher_Container_Label").id = "Threadlist_Searcher_Container_Label_" + rnd;
6239

63-
searcher.querySelector("Label.Thread_Searcher_Label").htmlFor = searcher.querySelector("Input.Thread_Searcher_Container_Input").id,
64-
searcher.querySelector("Label.Thread_Searcher_Container_Label").htmlFor = searcher.querySelector("Input.Thread_Searcher_Container_Input").id;
40+
searcher.querySelector("Label.Threadlist_Searcher_Label").htmlFor = searcher.querySelector("Input.Threadlist_Searcher_Container_Input").id,
41+
searcher.querySelector("Label.Threadlist_Searcher_Container_Label").htmlFor = searcher.querySelector("Input.Threadlist_Searcher_Container_Input").id;
6542
});
6643

67-
DOM("#Thread_Search_Searcher_Container_Input").addEventListener("input", (event) => {
68-
let list = Array.from(DOM("#Thread_Search").children).splice(1);
44+
DOM("#Threadlist_Search_Searcher_Container_Input").addEventListener("input", (event) => {
45+
let list = Array.from(DOM("#Threadlist_Search").children).splice(1);
6946
list.forEach((thread) => {
7047
if (thread.querySelector("Span:Not(.mdl-list__item-primary-content)").textContent.toLowerCase().indexOf(event.target.value.toLowerCase()) == -1) {
7148
thread.setAttribute("Disabled", "");
@@ -75,9 +52,9 @@ window.addEventListener("DOMContentLoaded", () => {
7552
});
7653
});
7754

78-
DOM("#Thread_Tab_Reload").addEventListener("click", (event) => {
79-
while (DOM("#Thread_Search").children.length > 1) DOM("#Thread_Search").children[1].remove();
80-
while (DOM("#Thread_Admin").children.length > 1) DOM("#Thread_Admin").children[1].remove();
55+
DOM("#Threadlist_Tab_Reload").addEventListener("click", (event) => {
56+
while (DOM("#Threadlist_Search").children.length > 1) DOM("#Threadlist_Search").children[1].remove();
57+
while (DOM("#Threadlist_Admin").children.length > 1) DOM("#Threadlist_Admin").children[1].remove();
8158

8259
Util.refreshThreadList();
8360
});
@@ -86,7 +63,7 @@ window.addEventListener("DOMContentLoaded", () => {
8663

8764
let doc = parent.document;
8865

89-
DOM("#Thread_Admin_Create").addEventListener("click", () => {
66+
DOM("#Threadlist_Admin_Create").addEventListener("click", () => {
9067
doc.querySelector("#Dialogs_Thread_InfoInputer").showModal();
9168
});
9269
});

Thread/Viewer/Viewer.js

Lines changed: 5 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -53,134 +53,12 @@ window.addEventListener("DOMContentLoaded", () => {
5353
for (let i = DOM("#Thread").children.length; i < res.length; i++) {
5454
let rnd = new DOM.Randomizer(DOM.Randomizer.TYPE.LEVEL3).generate(16);
5555

56-
let post = DOM("Div", {
57-
classes: ["mdl-card", "mdl-shadow--2dp"],
58-
59-
attributes: {
60-
"UUID": "Thread_Post"
61-
},
62-
63-
dataset: {
64-
"pid": res[i].pid
65-
},
66-
67-
children: [
68-
DOM("Div", {
69-
classes: ["mdl-card__title", "mdl-card--border"],
70-
71-
attributes: {
72-
"UUID": "Thread_Post_Header"
73-
},
74-
75-
children: [
76-
DOM("A", {
77-
classes: ["mdl-button", "mdl-js-button", "mdl-button--icon", "mdl-js-ripple-effect"],
78-
79-
attributes: {
80-
"UUID": "Thread_Post_Header_ActorPhoto"
81-
},
82-
83-
dataset: {
84-
"uid": res[i].uid
85-
},
86-
87-
events: {
88-
"click": (event) => {
89-
doc.querySelector("#Dialogs_Profile_InfoViewer_Content_UID").value = res[i].uid;
90-
doc.querySelector("#Dialogs_Profile_InfoViewer").showModal();
91-
}
92-
}
93-
}),
94-
95-
DOM("Span", {
96-
classes: ["mdl-card__title-text"],
97-
98-
attributes: {
99-
"UUID": "Thread_Post_Header_Actor"
100-
}
101-
}),
102-
103-
DOM("Div", {
104-
classes: ["mdl-layout-spacer"]
105-
}),
106-
107-
DOM("Span", {
108-
text: new Date(res[i].createdAt).toLocaleString(),
109-
110-
attributes: {
111-
"UUID": "Thread_Post_Header_CreatedAt"
112-
}
113-
}),
114-
]
115-
}),
116-
117-
DOM("Div", {
118-
classes: ["mdl-card__supporting-text"],
119-
text: res[i].content,
120-
121-
attributes: {
122-
"UUID": "Thread_Post_Content"
123-
}
124-
}),
125-
126-
DOM("Div", {
127-
classes: ["mdl-card__actions"],
128-
129-
attributes: {
130-
"UUID": "Thread_Post_Actions"
131-
},
132-
133-
children: [
134-
DOM("Label", {
135-
id: "Thread_Post_Actions_Plus_" + rnd,
136-
classes: ["mdl-icon-toggle", "mdl-js-icon-toggle", "mdl-js-ripple-effect"],
137-
138-
attributes: {
139-
"For": `Thread_Post_Actions_Plus_${rnd}_Input`
140-
},
141-
142-
children: [
143-
DOM("Input", {
144-
id: `Thread_Post_Actions_Plus_${rnd}_Input`,
145-
classes: ["mdl-icon-toggle__input"],
56+
let post = new Components.Thread.Post(res[i].pid, res[i].uid, "", res[i].content, new Date(res[i].createdAt).toLocaleString(), rnd);
57+
post.querySelector('A[UUID="Thread_Post_Header_ActorPhoto"]').addEventListener("click", () => {
58+
doc.querySelector("#Dialogs_Profile_InfoViewer_Content_UID").value = res[i].uid;
59+
doc.querySelector("#Dialogs_Profile_InfoViewer").showModal();
60+
});
14661

147-
attributes: {
148-
"UUID": "Thread_Post_Actions_Plus_Input",
149-
"Type": "Checkbox"
150-
},
151-
152-
events: {
153-
"click": (event) => {
154-
155-
}
156-
}
157-
}),
158-
159-
DOM("Button", {
160-
id: `Thread_Post_Actions_Plus_${rnd}_Btn`,
161-
classes: ["mdl-button", "mdl-js-button", "mdl-icon-toggle__label"],
162-
text: "+1",
163-
164-
attributes: {
165-
"UUID": "Thread_Post_Actions_Plus_Btn"
166-
}
167-
}),
168-
169-
DOM("Span", {
170-
id: `Thread_Post_Actions_Plus_${rnd}_Count`,
171-
text: 0,
172-
173-
attributes: {
174-
"UUID": "Thread_Post_Actions_Plus_Count"
175-
}
176-
})
177-
]
178-
})
179-
]
180-
})
181-
]
182-
});
183-
18462
base.Database.get(base.Database.ONCE, "users/" + res[i].uid, (userRes) => {
18563
componentHandler.upgradeElement(post.querySelector(`Label#Thread_Post_Actions_Plus_${rnd}`));
18664
post.querySelector('Span[UUID="Thread_Post_Header_Actor"]').textContent = userRes.userName;

Thread/Viewer/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
<Script Src = "/SimpleThread/Core.js"></Script>
1919
<Link Rel = "StyleSheet" Href = "/SimpleThread/Core.css" />
20+
<Script Src = "/SimpleThread/includes/Components.js"></Script>
2021

2122
<Script Src = "Viewer.js"></Script>
2223
<Link Rel = "StyleSheet" Href = "Viewer.css" />

Thread/index.html

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717

1818
<Script Src = "/SimpleThread/Core.js"></Script>
1919
<Link Rel = "StyleSheet" Href = "/SimpleThread/Core.css" />
20-
20+
<Script Src = "/SimpleThread/includes/Components.js"></Script>
21+
2122
<Script Src = "Thread.js"></Script>
2223
<Link Rel = "StyleSheet" Href = "Thread.css" />
2324

@@ -35,35 +36,35 @@
3536

3637
<Body>
3738
<Div Class = "mdl-grid">
38-
<Div ID = "Thread" Class = "mdl-cell mdl-cell--2-offset mdl-cell--8-col mdl-shadow--4dp mdl-color--white mdl-color-text--grey-800 mdl-tabs mdl-js-tabs mdl-js-ripple-effect">
39-
<Div ID = "Thread_Tab" Class = "mdl-tabs__tab-bar">
40-
<A ID = "Thread_Tab_Search" Class = "mdl-tabs__tab is-active" Href = "#Thread_Search">スレッド検索</A>
41-
<A ID = "Thread_Tab_Admin" Class = "mdl-tabs__tab" Href = "#Thread_Admin">管理中のスレッド</A>
39+
<Div ID = "Threadlist" Class = "mdl-cell mdl-cell--2-offset mdl-cell--8-col mdl-shadow--4dp mdl-color--white mdl-color-text--grey-800 mdl-tabs mdl-js-tabs mdl-js-ripple-effect">
40+
<Div ID = "Threadlist_Tab" Class = "mdl-tabs__tab-bar">
41+
<A ID = "Threadlist_Tab_Search" Class = "mdl-tabs__tab is-active" Href = "#Threadlist_Search">スレッド検索</A>
42+
<A ID = "Threadlist_Tab_Admin" Class = "mdl-tabs__tab" Href = "#Threadlist_Admin">管理中のスレッド</A>
4243

43-
<A ID = "Thread_Tab_Reload" Class = "mdl-tabs__tab">
44+
<A ID = "Threadlist_Tab_Reload" Class = "mdl-tabs__tab">
4445
<I Class = "material-icons">refresh</I>
4546
</A>
4647

47-
<Div Class = "mdl-tooltip" For = "Thread_Tab_Reload">Refresh thread list</Div>
48+
<Div Class = "mdl-tooltip" For = "Threadlist_Tab_Reload">Refresh thread list</Div>
4849
</Div>
4950

5051

5152

52-
<Div ID = "Thread_Search" Class = "mdl-list mdl-tabs__panel is-active">
53-
<Div ID = "Thread_Search_Searcher" Class = "mdl-list__item">
54-
<Label ID = "Thread_Search_Searcher" Class = "Thread_Searcher_Label mdl-button mdl-js-button mdl-button--icon" For = "Thread_Search_Searcher_Container_Input">
53+
<Div ID = "Threadlist_Search" Class = "mdl-list mdl-tabs__panel is-active">
54+
<Div ID = "Threadlist_Search_Searcher" Class = "mdl-list__item">
55+
<Label ID = "Threadlist_Search_Searcher" Class = "Threadlist_Searcher_Label mdl-button mdl-js-button mdl-button--icon" For = "Threadlist_Search_Searcher_Container_Input">
5556
<I Class = "material-icons">search</I>
5657
</Label>
5758

58-
<Div ID = "Thread_Search_Searcher_Container" Class = "mdl-textfield mdl-js-textfield">
59-
<Input ID = "Thread_Search_Searcher_Container_Input" Class = "mdl-textfield__input" Type = "Search" />
60-
<Label ID = "Thread_Search_Searcher_Container_Label" Class = "mdl-textfield__label" For = "Thread_Search_Searcher_Container_Input">Search...</Label>
59+
<Div ID = "Threadlist_Search_Searcher_Container" Class = "mdl-textfield mdl-js-textfield">
60+
<Input ID = "Threadlist_Search_Searcher_Container_Input" Class = "mdl-textfield__input" Type = "Search" />
61+
<Label ID = "Threadlist_Search_Searcher_Container_Label" Class = "mdl-textfield__label" For = "Threadlist_Search_Searcher_Container_Input">Search...</Label>
6162
</Div>
6263
</Div>
6364
</Div>
6465

65-
<Div ID = "Thread_Admin" Class = "mdl-list mdl-tabs__panel">
66-
<A ID = "Thread_Admin_Create" Class = "mdl-list__item">
66+
<Div ID = "Threadlist_Admin" Class = "mdl-list mdl-tabs__panel">
67+
<A ID = "Threadlist_Admin_Create" Class = "mdl-list__item">
6768
<Span Class = "mdl-list__item-primary-content">
6869
<I Class = "mdl-list__item-avatar material-icons">add</I>
6970
<Span>スレッドを作成</Span>

Top/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
<Script Src = "/SimpleThread/Core.js"></Script>
1919
<Link Rel = "StyleSheet" Href = "/SimpleThread/Core.css" />
20+
<Script Src = "/SimpleThread/includes/Components.js"></Script>
2021

2122
<Script Src = "Top.js"></Script>
2223
<Link Rel = "StyleSheet" Href = "Top.css" />

debug/index.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DocType HTML>
2+
3+
<HTML>
4+
<Head>
5+
<Meta Charset = "UTF-8" />
6+
<Title>Simple Thread == Debug Page</Title>
7+
8+
<Script Src = "https://genbuproject.github.io/Programs/DOM Extender/DOM Extender v3.0.js"></Script>
9+
<Script Src = "/SimpleThread/includes/Components.js"></Script>
10+
</Head>
11+
12+
<Body>
13+
</Body>
14+
</HTML>

0 commit comments

Comments
 (0)