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

Commit 03b4427

Browse files
committed
v3_RC1をアップロード
1 parent 58c7b6c commit 03b4427

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+3078
-0
lines changed

404.html

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!DocType HTML>
2+
3+
<HTML>
4+
<Head>
5+
<Meta Charset = "UTF-8" />
6+
<Meta Http-Equiv = "Refresh" Content = "5;URL=/SimpleThread/" />
7+
<Link Rel = "Shortcut Icon" Href = "/SimpleThread/Error/favicon.ico" />
8+
9+
<Title>404 Not Found</Title>
10+
11+
<Link Rel = "StyleSheet" Href = "https://genbuproject.github.io/Programs/StyleSheets/Back.css" />
12+
13+
<Script Src = "/SimpleThread/Error/Main.js"></Script>
14+
<Link Rel = "StyleSheet" Href = "/SimpleThread/Error/Main.css" />
15+
</Head>
16+
17+
<Body>
18+
<Div Class = "Title">
19+
<Img Src = "/SimpleThread/Error/favicon.ico" Width = "64" Height = "64" />404 Not Found
20+
</Div>
21+
22+
<Div Class = "Message">
23+
<P>
24+
お探しのページが見つかりませんでした。
25+
</P>
26+
27+
5秒後に<A Href = "/SimpleThread/" Target = "_parent">メインページ</A>へ移動します…
28+
</Div>
29+
</Body>
30+
</HTML>

Dialog.css

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
Dialog[ID^="Dialogs"] {
2+
Width: 65%;
3+
}
4+
5+
Dialog[ID^="Dialogs"] Div.mdl-textfield {
6+
Width: 100%;
7+
}
8+
9+
*.mdl-switch__child-hide {
10+
Display: None;
11+
}
12+
13+
14+
15+
#Dialogs_Profile_InfoViewer_Content {
16+
Display: Flex;
17+
Flex-Direction: Row;
18+
Align-Items: Flex-Start;
19+
20+
Font-Size: Medium;
21+
}
22+
23+
#Dialogs_Profile_InfoViewer_Content_Photo {
24+
Width: 20%;
25+
26+
Margin-Right: 5%;
27+
Border-Radius: 100%;
28+
}
29+
30+
#Dialogs_Profile_InfoViewer_Content_Photo::Before {
31+
Content: "";
32+
33+
Display: Block;
34+
Padding-Top: 100%;
35+
}
36+
37+
#Dialogs_Profile_InfoViewer_Content_Info {
38+
Flex: 1;
39+
}
40+
41+
#Dialogs_Profile_InfoViewer_Content_Info_Detail {
42+
Padding: 1em 0 4em 0;
43+
44+
White-Space: Pre-Wrap;
45+
}
46+
47+
#Dialogs_Profile_InfoViewer_Content_Info_Links {
48+
Padding: 1em 0 0;
49+
}
50+
51+
Img[Data-Component="Dialogs_Profile_InfoViewer_Content_Info_Links_Link_Icon"] {
52+
Width: 1em;
53+
}
54+
55+
56+
57+
#Dialogs_Thread_InfoViewer_Content_Overview {
58+
Padding: 1em 0 4em 0;
59+
}
60+
61+
#Dialogs_Thread_InfoViewer_Content_Detail {
62+
Padding: 1em 0 0;
63+
64+
White-Space: Pre-Wrap;
65+
}
66+
67+
68+
69+
#Dialogs_Thread_Poster_Content_Text-Input {
70+
Resize: None;
71+
}

Dialog.js

Lines changed: 276 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,276 @@
1+
window.addEventListener("DOMContentLoaded", () => {
2+
let watchers = {};
3+
4+
new DOM('@Dialog').forEach((dialog) => {
5+
dialogPolyfill.registerDialog(dialog);
6+
7+
if (dialog.querySelector('Button[Data-Action="Dialog_Submit"]')) {
8+
dialog.addEventListener("keydown", (event) => {
9+
if (event.ctrlKey && event.keyCode == 13) dialog.querySelector('Button[Data-Action="Dialog_Submit"]').click();
10+
});
11+
}
12+
13+
dialog.querySelectorAll('Dialog *[Required]').forEach((input) => {
14+
input.addEventListener("input", () => {
15+
let result = true;
16+
17+
dialog.querySelectorAll('Dialog *[Required]').forEach(requiredField => {
18+
if (requiredField.value.replace(/\s/g, "").length == 0) {
19+
result = false;
20+
return;
21+
}
22+
});
23+
24+
if (result) {
25+
dialog.querySelector('Button[Data-Action="Dialog_Submit"]').classList.remove("mdl-button--disabled");
26+
} else {
27+
dialog.querySelector('Button[Data-Action="Dialog_Submit"]').classList.add("mdl-button--disabled");
28+
}
29+
});
30+
});
31+
32+
dialog.querySelectorAll('Dialog Button[Data-Action="Dialog_Close"]').forEach((btn) => {
33+
btn.addEventListener("click", () => {
34+
btn.offsetParent.close();
35+
});
36+
});
37+
});
38+
39+
40+
41+
new DOM("#Dialogs_Profile_DeleteConfirmer_Content_Email-Input").addEventListener("input", () => {
42+
if (new DOM("#Dialogs_Profile_DeleteConfirmer_Content_Email-Input").value == base.user.email) {
43+
new DOM("#Dialogs_Profile_DeleteConfirmer_Btns_Yes").classList.remove("mdl-button--disabled");
44+
} else {
45+
new DOM("#Dialogs_Profile_DeleteConfirmer_Btns_Yes").classList.add("mdl-button--disabled");
46+
}
47+
});
48+
49+
new DOM("#Dialogs_Profile_DeleteConfirmer_Btns_Yes").addEventListener("click", (event) => {
50+
if (!event.currentTarget.classList.contains("mdl-button--disabled")) {
51+
if (new DOM("#Dialogs_Profile_DeleteConfirmer_Content_Email-Input").value == base.user.email) {
52+
base.delete();
53+
} else {
54+
new DOM("#Dialogs_Profile_DeleteConfirmer_Content_Email").classList.add("is-invalid");
55+
}
56+
}
57+
});
58+
59+
60+
61+
watchers["Dialogs_Profile_InfoViewer_UID"] = {
62+
valueObj: { value: "" },
63+
watcher: null
64+
}; watchers["Dialogs_Profile_InfoViewer_UID"].watcher = new DOM.Watcher({
65+
target: watchers["Dialogs_Profile_InfoViewer_UID"].valueObj,
66+
onGet: () => { watchers["Dialogs_Profile_InfoViewer_UID"].valueObj.value = new DOM("#Dialogs_Profile_InfoViewer_UID").value },
67+
68+
onChange: (watcher) => {
69+
base.Database.get(base.Database.ONCE, `users/${watcher.newValue}`, (res) => {
70+
new DOM("#Dialogs_Profile_InfoViewer_Content_Photo").dataset.uid = watcher.newValue,
71+
new DOM("#Dialogs_Profile_InfoViewer_Content_Info_Name").textContent = res.userName,
72+
new DOM("#Dialogs_Profile_InfoViewer_Content_Info_Detail").textContent = res.detail;
73+
74+
while (new DOM("#Dialogs_Profile_InfoViewer_Content_Info_Links").childNodes.length > 0) new DOM("#Dialogs_Profile_InfoViewer_Content_Info_Links").childNodes[0].remove();
75+
76+
if (res.links) {
77+
for (let i = 0; i < res.links.length; i++) {
78+
let link = new Component.Dialogs.Profile.InfoViewer.Links.Link(res.links[i].name, res.links[i].url);
79+
80+
new DOM("#Dialogs_Profile_InfoViewer_Content_Info_Links").appendChild(link);
81+
}
82+
}
83+
});
84+
}
85+
});
86+
87+
88+
89+
new DOM("@#Dialogs_Thread_InfoInputer *[Required]").forEach((input) => {
90+
input.addEventListener("input", () => {
91+
let result = true;
92+
93+
let list = [
94+
new DOM("#Dialogs_Thread_InfoInputer_Content_Name-Input"),
95+
new DOM("#Dialogs_Thread_InfoInputer_Content_Overview-Input")
96+
];
97+
98+
if (new DOM("#Dialogs_Thread_InfoInputer_Content_Secured-Input").checked) list.push(new DOM("#Dialogs_Thread_InfoInputer_Content_Password-Input"));
99+
100+
list.forEach(requiredField => {
101+
if (requiredField.value.replace(/\s/g, "").length == 0) {
102+
result = false;
103+
return;
104+
}
105+
});
106+
107+
if (result) {
108+
new DOM("#Dialogs_Thread_InfoInputer").querySelector('Button[Data-Action="Dialog_Submit"]').classList.remove("mdl-button--disabled");
109+
} else {
110+
new DOM("#Dialogs_Thread_InfoInputer").querySelector('Button[Data-Action="Dialog_Submit"]').classList.add("mdl-button--disabled");
111+
}
112+
});
113+
});
114+
115+
new DOM("#Dialogs_Thread_InfoInputer_Content_Secured-Input").addEventListener("change", (event) => {
116+
let result = true;
117+
118+
switch (event.target.checked) {
119+
case true:
120+
new DOM("#Dialogs_Thread_InfoInputer_Content_Password").classList.remove("mdl-switch__child-hide");
121+
122+
[new DOM("#Dialogs_Thread_InfoInputer_Content_Name-Input"), new DOM("#Dialogs_Thread_InfoInputer_Content_Overview-Input"), new DOM("#Dialogs_Thread_InfoInputer_Content_Password-Input")].forEach(requiredField => {
123+
if (requiredField.value.replace(/\s/g, "").length == 0) {
124+
result = false;
125+
return;
126+
}
127+
});
128+
129+
if (result) {
130+
new DOM("#Dialogs_Thread_InfoInputer").querySelector('Button[Data-Action="Dialog_Submit"]').classList.remove("mdl-button--disabled");
131+
} else {
132+
new DOM("#Dialogs_Thread_InfoInputer").querySelector('Button[Data-Action="Dialog_Submit"]').classList.add("mdl-button--disabled");
133+
}
134+
135+
break;
136+
137+
case false:
138+
new DOM("#Dialogs_Thread_InfoInputer_Content_Password").classList.add("mdl-switch__child-hide");
139+
140+
[new DOM("#Dialogs_Thread_InfoInputer_Content_Name-Input"), new DOM("#Dialogs_Thread_InfoInputer_Content_Overview-Input")].forEach(requiredField => {
141+
if (requiredField.value.replace(/\s/g, "").length == 0) {
142+
result = false;
143+
return;
144+
}
145+
});
146+
147+
if (result) {
148+
new DOM("#Dialogs_Thread_InfoInputer").querySelector('Button[Data-Action="Dialog_Submit"]').classList.remove("mdl-button--disabled");
149+
} else {
150+
new DOM("#Dialogs_Thread_InfoInputer").querySelector('Button[Data-Action="Dialog_Submit"]').classList.add("mdl-button--disabled");
151+
}
152+
153+
break;
154+
}
155+
});
156+
157+
new DOM("#Dialogs_Thread_InfoInputer_Btns_OK").addEventListener("click", (event) => {
158+
if (!event.currentTarget.classList.contains("mdl-button--disabled")) {
159+
base.Database.transaction("threads", (res) => {
160+
let now = new Date().getTime();
161+
162+
base.Database.set("threads/" + res.length, {
163+
title: new DOM("#Dialogs_Thread_InfoInputer_Content_Name-Input").value,
164+
overview: new DOM("#Dialogs_Thread_InfoInputer_Content_Overview-Input").value,
165+
detail: new DOM("#Dialogs_Thread_InfoInputer_Content_Detail-Input").value,
166+
167+
jobs: {
168+
Owner: (() => {
169+
let owner = {}; owner[base.user.uid] = "";
170+
return owner;
171+
})(),
172+
173+
Admin: {
174+
175+
}
176+
},
177+
178+
createdAt: now,
179+
180+
data: [
181+
{
182+
uid: "!SYSTEM",
183+
content: new DOM("#Dialogs_Thread_InfoInputer_Content_Name-Input").value,
184+
createdAt: now
185+
}
186+
],
187+
188+
password: new DOM("#Dialogs_Thread_InfoInputer_Content_Secured-Input").checked ? Encrypter.encrypt(new DOM("#Dialogs_Thread_InfoInputer_Content_Password-Input").value) : ""
189+
});
190+
191+
new DOM("#Dialogs_Thread_InfoInputer").close();
192+
parent.document.querySelector("IFrame.mdl-layout__content").src = "Thread/Viewer/?tid=" + res.length;
193+
});
194+
}
195+
});
196+
197+
198+
199+
new DOM("#Dialogs_Thread_PasswordConfirmer_Btns_OK").addEventListener("click", (event) => {
200+
if (!event.currentTarget.classList.contains("mdl-button--disabled")) {
201+
if (Encrypter.encrypt(new DOM("#Dialogs_Thread_PasswordConfirmer_Content_Password-Input").value) == new DOM("#Dialogs_Thread_PasswordConfirmer_Password").value) {
202+
sessionStorage.setItem("com.GenbuProject.SimpleThread.currentPassword", new DOM("#Dialogs_Thread_PasswordConfirmer_Content_Password-Input").value);
203+
new DOM("$IFrame.mdl-layout__content").src = new DOM("#Dialogs_Thread_PasswordConfirmer_Link").value;
204+
205+
new DOM("#Dialogs_Thread_PasswordConfirmer_Link").value = "",
206+
new DOM("#Dialogs_Thread_PasswordConfirmer_Password").value = "";
207+
} else {
208+
new DOM("#Dialogs_Thread_PasswordConfirmer_Content_Password").classList.add("is-invalid");
209+
}
210+
}
211+
});
212+
213+
new DOM("#Dialogs_Thread_PasswordConfirmer_Btns_Cancel").addEventListener("click", (event) => {
214+
new DOM("$IFrame.mdl-layout__content").src = "/SimpleThread/Thread/";
215+
});
216+
217+
218+
219+
watchers["Dialogs_Thread_InfoViewer_TID"] = {
220+
valueObj: { value: "0" },
221+
watcher: null
222+
}; watchers["Dialogs_Thread_InfoViewer_TID"].watcher = new DOM.Watcher({
223+
target: watchers["Dialogs_Thread_InfoViewer_TID"].valueObj,
224+
onGet: () => { watchers["Dialogs_Thread_InfoViewer_TID"].valueObj.value = new DOM("#Dialogs_Thread_InfoViewer_TID").value },
225+
226+
onChange: (watcher) => {
227+
base.Database.get(base.Database.ONCE, `threads/${watcher.newValue}`, (res) => {
228+
new DOM("#Dialogs_Thread_InfoViewer_Content_Name").textContent = res.title,
229+
new DOM("#Dialogs_Thread_InfoViewer_Content_Overview").textContent = res.overview,
230+
new DOM("#Dialogs_Thread_InfoViewer_Content_Detail").textContent = res.detail;
231+
232+
URL.filter(new DOM("#Dialogs_Thread_InfoViewer_Content_Overview").textContent).forEach((urlString) => {
233+
new DOM("#Dialogs_Thread_InfoViewer_Content_Overview").innerHTML = new DOM("#Dialogs_Thread_InfoViewer_Content_Overview").innerHTML.replace(urlString, `<A Href = "${urlString}" Target = "_blank">${urlString}</A>`);
234+
});
235+
236+
URL.filter(new DOM("#Dialogs_Thread_InfoViewer_Content_Detail").textContent).forEach((urlString) => {
237+
new DOM("#Dialogs_Thread_InfoViewer_Content_Detail").innerHTML = new DOM("#Dialogs_Thread_InfoViewer_Content_Detail").innerHTML.replace(urlString, `<A Href = "${urlString}" Target = "_blank">${urlString}</A>`);
238+
});
239+
});
240+
}
241+
});
242+
243+
244+
245+
new DOM("#Dialogs_Thread_Poster_Btns_OK").addEventListener("click", (event) => {
246+
if (!event.currentTarget.classList.contains("mdl-button--disabled")) {
247+
base.Database.transaction("threads/" + new DOM("#Dialogs_Thread_Poster_TID").value + "/data", (res) => {
248+
base.Database.set("threads/" + new DOM("#Dialogs_Thread_Poster_TID").value + "/data/" + res.length, {
249+
uid: base.user.uid,
250+
content: new DOM("#Dialogs_Thread_Poster_Content_Text-Input").value,
251+
createdAt: new Date().getTime()
252+
});
253+
254+
new DOM("#Dialogs_Thread_Poster_Btns_OK").classList.add("mdl-button--disabled"),
255+
new DOM("#Dialogs_Thread_Poster_Content_Text").classList.remove("is-dirty"),
256+
new DOM("#Dialogs_Thread_Poster_Content_Text-Input").value = "";
257+
258+
new DOM("#Page").contentDocument.querySelector("#FlowPanel_Btns_CreatePost").removeAttribute("Disabled");
259+
260+
new DOM("#Dialogs_Thread_Poster").close();
261+
});
262+
}
263+
});
264+
265+
new DOM("#Dialogs_Thread_Poster_Btns_Cancel").addEventListener("click", () => {
266+
new DOM("#Dialogs_Thread_Poster_Btns_OK").classList.add("mdl-button--disabled"),
267+
new DOM("#Dialogs_Thread_Poster_Content_Text").classList.remove("is-dirty"),
268+
new DOM("#Dialogs_Thread_Poster_Content_Text-Input").value = "";
269+
270+
new DOM("#Page").contentDocument.querySelector("#FlowPanel_Btns_CreatePost").removeAttribute("Disabled");
271+
});
272+
273+
274+
275+
for (let watcherName in watchers) DOM.Watcher.addWatcher(watchers[watcherName].watcher);
276+
});

0 commit comments

Comments
 (0)