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

Commit 93ecc36

Browse files
committed
予想より進まなかった…
1 parent 9f78cd2 commit 93ecc36

7 files changed

Lines changed: 134 additions & 32 deletions

File tree

Dialog.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,26 @@ Dialog[ID^="Dialogs"] Div.mdl-textfield {
2020
Width: 20%;
2121

2222
Margin-Right: 5%;
23+
24+
Background: Transparent Center / Cover;
25+
Border-Radius: 100%;
26+
}
27+
28+
#Dialogs_Profile_InfoViewer_Content_Photo::Before {
29+
Content: "";
30+
31+
Display: Block;
32+
Padding-Top: 100%;
33+
}
34+
35+
#Dialogs_Profile_InfoViewer_Content_Info {
36+
Flex: 1;
2337
}
2438

2539
#Dialogs_Profile_InfoViewer_Content_Info_Detail {
2640
Padding: 1em 0 4em 0;
41+
42+
White-Space: Pre-Wrap;
2743
}
2844

2945
#Dialogs_Profile_InfoViewer_Content_Info_Link {

Dialog.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
window.addEventListener("DOMContentLoaded", () => {
2+
let watchers = [];
3+
24
DOM('@Dialog').forEach((dialog) => {
35
dialogPolyfill.registerDialog(dialog);
6+
7+
if (dialog.querySelector('Button[Data-Action="Dialog_Submit"]')) {
8+
dialog.addEventListener("keydown", (event) => {
9+
console.log(event);
10+
});
11+
}
412
});
513

614
DOM('@Dialog Button[Data-Action="Dialog_Close"]').forEach((btn) => {
@@ -21,6 +29,38 @@ window.addEventListener("DOMContentLoaded", () => {
2129

2230

2331

32+
watchers.push({
33+
valueObj: { value: "" },
34+
watcher: null
35+
}); watchers[watchers.length - 1].watcher = new DOM.Watcher({
36+
target: watchers[watchers.length - 1].valueObj,
37+
onGet: () => { watchers[watchers.length - 1].valueObj.value = DOM("#Dialogs_Profile_InfoViewer_Content_UID").value },
38+
39+
onChange: (watcher) => {
40+
base.Database.get(base.Database.ONCE, `users/${watcher.newValue}`, (res) => {
41+
DOM("#Dialogs_Profile_InfoViewer_Content_Photo").dataset.uid = watcher.newValue,
42+
DOM("#Dialogs_Profile_InfoViewer_Content_Info_Name").textContent = res.userName,
43+
DOM("#Dialogs_Profile_InfoViewer_Content_Info_Detail").textContent = res.detail;
44+
});
45+
}
46+
});
47+
48+
watchers.forEach((watcherObj) => {
49+
DOM.Watcher.addWatcher(watcherObj.watcher);
50+
});
51+
52+
53+
54+
[DOM("#Dialogs_Thread_InfoInputer_Content_Name_Input"), DOM("#Dialogs_Thread_InfoInputer_Content_Overview_Input"), DOM("#Dialogs_Thread_InfoInputer_Content_Detail_Input")].forEach((textarea) => {
55+
textarea.addEventListener("input", (event) => {
56+
if (event.target.value.replace(/\s/g, "").length == 0) {
57+
DOM("#Dialogs_Thread_InfoInputer_Btns_OK").classList.add("mdl-button--disabled");
58+
} else {
59+
DOM("#Dialogs_Thread_InfoInputer_Btns_OK").classList.remove("mdl-button--disabled");
60+
}
61+
});
62+
});
63+
2464
DOM("#Dialogs_Thread_InfoInputer_Btns_OK").addEventListener("click", () => {
2565
base.Database.transaction("threads", (res) => {
2666
let now = new Date().getTime();

Main.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,31 @@ window.addEventListener("DOMContentLoaded", () => {
3636
});
3737
}
3838

39+
base.Database.get(base.Database.ONCE, "users", (res) => {
40+
let photoStyles = [];
41+
42+
for (let uid in res) {
43+
res[uid].gplusPhoto || (res[uid].gplusPhoto = "");
44+
45+
let photoStyle = (() => {
46+
let style = new Style((() => {
47+
let prop = {};
48+
prop[`#Dialogs_Profile_InfoViewer_Content_Photo[Data-UID="${uid}"]`] = {
49+
"Background-Image": `URL(${res[uid].gplusPhoto})`
50+
};
51+
52+
return prop;
53+
})());
54+
55+
return style.textContent;
56+
})();
57+
58+
photoStyles.push(photoStyle);
59+
}
60+
61+
DOM('$Style[UUID="Dialogs_Profile_InfoViewer_Content_Photo--Manager"]').textContent = photoStyles.join("\r\n");
62+
});
63+
3964

4065

4166
let querys = location.querySort();

Multi Replacer.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[Config]
22
Value1=https://genbuproject.github.io/
3-
Value2=http://localhost:8000/
3+
Value2=http://localhost:8002/
44
Extensions=*.html;*.js;*.css
55
Recent=1

Thread/Viewer/Viewer.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,8 @@ Span[UUID="Thread_Post_Actions_Plus_Count"] {
6464
Bottom: 0;
6565

6666
Padding: 5vh 4vw;
67+
}
68+
69+
#FlowPanel_Btns > *[Disabled] {
70+
Display: None;
6771
}

Thread/Viewer/Viewer.js

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
window.addEventListener("DOMContentLoaded", () => {
2+
if (!base.user) {
3+
DOM("#FlowPanel_Btns_CreatePost").setAttribute("Disabled", "");
4+
}
5+
26
let querys = location.querySort();
37

48
if (!querys.TID) {
59
location.href = "/SimpleThread/Error/406/";
610
}
11+
12+
let doc = parent.document;
13+
doc.querySelector("#Dialogs_Thread_Poster_Content_TID").value = querys.TID;
714

8-
base.Database.get(base.Database.INTERVAL, "users", (res) => {
15+
base.Database.get(base.Database.ONCE, "users", (res) => {
916
let photoStyles = [];
1017

1118
for (let uid in res) {
@@ -46,9 +53,11 @@ window.addEventListener("DOMContentLoaded", () => {
4653
classes: ["mdl-card", "mdl-shadow--2dp"],
4754

4855
attributes: {
49-
"UUID": "Thread_Post",
50-
"Data-UID": res[i].uid,
51-
"Data-PID": res[i].pid
56+
"UUID": "Thread_Post"
57+
},
58+
59+
dataset: {
60+
"pid": res[i].pid
5261
},
5362

5463
children: [
@@ -64,8 +73,18 @@ window.addEventListener("DOMContentLoaded", () => {
6473
classes: ["mdl-button", "mdl-js-button", "mdl-button--icon", "mdl-js-ripple-effect"],
6574

6675
attributes: {
67-
"UUID": "Thread_Post_Header_ActorPhoto",
68-
"Data-UID": res[i].uid
76+
"UUID": "Thread_Post_Header_ActorPhoto"
77+
},
78+
79+
dataset: {
80+
"uid": res[i].uid
81+
},
82+
83+
events: {
84+
"click": (event) => {
85+
doc.querySelector("#Dialogs_Profile_InfoViewer_Content_UID").value = res[i].uid;
86+
doc.querySelector("#Dialogs_Profile_InfoViewer").showModal();
87+
}
6988
}
7089
}),
7190

@@ -124,6 +143,12 @@ window.addEventListener("DOMContentLoaded", () => {
124143
attributes: {
125144
"UUID": "Thread_Post_Actions_Plus_Input",
126145
"Type": "Checkbox"
146+
},
147+
148+
events: {
149+
"click": (event) => {
150+
151+
}
127152
}
128153
}),
129154

@@ -139,7 +164,7 @@ window.addEventListener("DOMContentLoaded", () => {
139164

140165
DOM("Span", {
141166
id: `Thread_Post_Actions_Plus_${rnd}_Count`,
142-
text: "0",
167+
text: 0,
143168

144169
attributes: {
145170
"UUID": "Thread_Post_Actions_Plus_Count"
@@ -166,15 +191,6 @@ window.addEventListener("DOMContentLoaded", () => {
166191

167192

168193

169-
let doc = parent.document;
170-
doc.querySelector("#Dialogs_Thread_Poster_Content_TID").value = querys.TID;
171-
172-
DOM('@A[UUID="Thread_Post_Header_ActorPhoto"]').forEach((btn) => {
173-
btn.addEventListener("click", () => {
174-
doc.querySelector("#Dialogs_Profile_InfoViewer").showModal();
175-
});
176-
});
177-
178194
DOM("#FlowPanel_Btns_CreatePost").addEventListener("click", () => {
179195
doc.querySelector("#Dialogs_Thread_Poster").showModal();
180196

index.html

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
<Script Src = "Dialog.js"></Script>
2727
<Link Rel = "StyleSheet" Href = "Dialog.css" />
2828

29+
<Style UUID = "Dialogs_Profile_InfoViewer_Content_Photo--Manager"></Style>
30+
2931
<Script>
3032
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
3133
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -89,7 +91,7 @@
8991
</Div>
9092

9193
<Div ID = "Dialogs_Account_CreateNotify_Btns" Class = "mdl-dialog__actions">
92-
<Button ID = "Dialogs_Account_CreateNotify_Btns_OK" Class = "mdl-button mdl-js-button mdl-js-ripple-effect" Data-Action = "Dialog_Close" Type = "Button">閉じる</Button>
94+
<Button ID = "Dialogs_Account_CreateNotify_Btns_OK" Class = "mdl-button mdl-js-button mdl-js-ripple-effect" Type = "Button" Data-Action = "Dialog_Close">閉じる</Button>
9395
</Div>
9496
</Dialog>
9597

@@ -99,7 +101,7 @@
99101
</Div>
100102

101103
<Div ID = "Dialogs_Account_DeleteNotify_Btns" Class = "mdl-dialog__actions">
102-
<Button ID = "Dialogs_Account_DeleteNotify_Btns_OK" Class = "mdl-button mdl-js-button mdl-js-ripple-effect" Data-Action = "Dialog_Close" Type = "Button">閉じる</Button>
104+
<Button ID = "Dialogs_Account_DeleteNotify_Btns_OK" Class = "mdl-button mdl-js-button mdl-js-ripple-effect" Type = "Button" Data-Action = "Dialog_Close">閉じる</Button>
103105
</Div>
104106
</Dialog>
105107
</Div>
@@ -111,7 +113,7 @@
111113
</Div>
112114

113115
<Div ID = "Dialogs_Profile_ChangeNotify_Btns" Class = "mdl-dialog__actions">
114-
<Button ID = "Dialogs_Profile_ChangeNotify_Btns_OK" Class = "mdl-button mdl-js-button mdl-js-ripple-effect" Data-Action = "Dialog_Close" Type = "Button">閉じる</Button>
116+
<Button ID = "Dialogs_Profile_ChangeNotify_Btns_OK" Class = "mdl-button mdl-js-button mdl-js-ripple-effect" Type = "Button" Data-Action = "Dialog_Close">閉じる</Button>
115117
</Div>
116118
</Dialog>
117119

@@ -131,21 +133,18 @@
131133

132134
<Div ID = "Dialogs_Profile_DeleteConfirmer_Btns" Class = "mdl-dialog__actions">
133135
<Button ID = "Dialogs_Profile_DeleteConfirmer_Btns_Yes" Class = "mdl-button mdl-js-button mdl-js-ripple-effect" Type = "Button">はい</Button>
134-
<Button ID = "Dialogs_Profile_DeleteConfirmer_Btns_No" Class = "mdl-button mdl-js-button mdl-js-ripple-effect" Data-Action = "Dialog_Close" Type = "Button">いいえ</Button>
136+
<Button ID = "Dialogs_Profile_DeleteConfirmer_Btns_No" Class = "mdl-button mdl-js-button mdl-js-ripple-effect" Type = "Button" Data-Action = "Dialog_Close">いいえ</Button>
135137
</Div>
136138
</Dialog>
137139

138140
<Dialog ID = "Dialogs_Profile_InfoViewer" Class = "mdl-dialog">
139141
<Div ID = "Dialogs_Profile_InfoViewer_Content" Class = "mdl-dialog__content">
140-
<Div ID = "Dialogs_Profile_InfoViewer_Content_Photo" Data-TagID = "ProfilePhoto"></Div>
142+
<Div ID = "Dialogs_Profile_InfoViewer_Content_Photo" Data-UID = ""></Div>
141143

142144
<Div ID = "Dialogs_Profile_InfoViewer_Content_Info">
143-
<Span ID = "Dialogs_Profile_InfoViewer_Content_Info_Name" Class = "mdl-layout__title">プログラなーいGenboo</Span>
145+
<Span ID = "Dialogs_Profile_InfoViewer_Content_Info_Name" Class = "mdl-layout__title"></Span>
144146

145-
<Div ID = "Dialogs_Profile_InfoViewer_Content_Info_Detail">
146-
Google+で色々やってる暇人です。<Br />
147-
一応Simple Threadのオーナーやってます✌('ω')スッ
148-
</Div>
147+
<Div ID = "Dialogs_Profile_InfoViewer_Content_Info_Detail"></Div>
149148

150149
<Span Class = "mdl-layout__title">リンク</Span>
151150

@@ -161,10 +160,12 @@
161160
</Div>
162161
</Div>
163162
</Div>
163+
164+
<Input ID = "Dialogs_Profile_InfoViewer_Content_UID" Type = "Hidden" Value = "" />
164165
</Div>
165166

166167
<Div ID = "Dialogs_Profile_InfoViewer_Btns" Class = "mdl-dialog__actions">
167-
<Button ID = "Dialogs_Profile_InfoViewer_Btns_OK" Class = "mdl-button mdl-js-button mdl-js-ripple-effect" Data-Action = "Dialog_Close" Type = "Button">閉じる</Button>
168+
<Button ID = "Dialogs_Profile_InfoViewer_Btns_OK" Class = "mdl-button mdl-js-button mdl-js-ripple-effect" Type = "Button" Data-Action = "Dialog_Close">閉じる</Button>
168169
</Div>
169170
</Dialog>
170171
</Div>
@@ -189,8 +190,8 @@
189190
</Div>
190191

191192
<Div ID = "Dialogs_Thread_InfoInputer_Btns" Class = "mdl-dialog__actions">
192-
<Button ID = "Dialogs_Thread_InfoInputer_Btns_OK" Class = "mdl-button mdl-js-button mdl-js-ripple-effect" Type = "Button">作成</Button>
193-
<Button ID = "Dialogs_Thread_InfoInputer_Btns_Cancel" Class = "mdl-button mdl-js-button mdl-js-ripple-effect" Data-Action = "Dialog_Close" Type = "Button">キャンセル</Button>
193+
<Button ID = "Dialogs_Thread_InfoInputer_Btns_OK" Class = "mdl-button mdl-js-button mdl-js-ripple-effect" Type = "Button" Data-Action = "Dialog_Submit">作成</Button>
194+
<Button ID = "Dialogs_Thread_InfoInputer_Btns_Cancel" Class = "mdl-button mdl-js-button mdl-js-ripple-effect" Type = "Button" Data-Action = "Dialog_Close">キャンセル</Button>
194195
</Div>
195196
</Dialog>
196197

@@ -205,8 +206,8 @@
205206
</Div>
206207

207208
<Div ID = "Dialogs_Thread_Poster_Btns" Class = "mdl-dialog__actions">
208-
<Button ID = "Dialogs_Thread_Poster_Btns_OK" Class = "mdl-button mdl-js-button mdl-button--disabled mdl-js-ripple-effect" Type = "Button">投稿</Button>
209-
<Button ID = "Dialogs_Thread_Poster_Btns_Cancel" Class = "mdl-button mdl-js-button mdl-js-ripple-effect" Data-Action = "Dialog_Close" Type = "Button">キャンセル</Button>
209+
<Button ID = "Dialogs_Thread_Poster_Btns_OK" Class = "mdl-button mdl-js-button mdl-button--disabled mdl-js-ripple-effect" Type = "Button" Data-Action = "Dialog_Submit">投稿</Button>
210+
<Button ID = "Dialogs_Thread_Poster_Btns_Cancel" Class = "mdl-button mdl-js-button mdl-js-ripple-effect" Type = "Button" Data-Action = "Dialog_Close">キャンセル</Button>
210211
</Div>
211212
</Dialog>
212213
</Div>

0 commit comments

Comments
 (0)