forked from hackfoldr/hackfoldr-2.0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Kaohsiung-explode-20140801-backup1100.html
522 lines (470 loc) · 32.7 KB
/
Kaohsiung-explode-20140801-backup1100.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
<html><head>
<meta charset="utf-8">
<!-- libraries-->
<script type="text/javascript" src="/assets/tabletop/tabletop.js"></script>
<script type="text/javascript" src="/assets/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="/assets/jquery-ui/1.11.0.custom/jquery-ui.min.js"></script>
<link rel="stylesheet" type="text/css" href="/assets/semantic-ui/0.19.0/css/semantic.min.css">
<script type="text/javascript" src="/assets/semantic-ui/0.19.0/javascript/semantic.min.js"></script>
<!-- custom files-->
<script type="text/javascript" src="/js/global.js"></script>
<script type="text/javascript" src="/js/csv.js"></script>
<script type="text/javascript" src="/js/handlebars-v1.3.0.js"></script>
<link rel="stylesheet" href="/css/global.css">
<title>救災地圖 | 0801高雄氣爆資訊 | hackfoldr</title>
</head>
<body>
<nav id="sidebar">
<nav id="nav">
<div class="ui borderless menu">
<div class="ui dropdown icon item shortcuts"><i class="icon home"></i>
<div class="menu"><a href="http://g0v.tw" target="iframe" class="link item">g0v 官網<i class="icon globe"></i></a>
<div class="ui accordion">
<div class="title item">各期黑客松<i class="icon dropdown"></i></div>
<div class="content"><a href="/g0v-hackath9n" class="foldr item">還我土地 2014-06-21<i class="icon exchange"></i></a><a href="/g0v-hackath8n" class="foldr item">解除戒嚴 2014-04-19<i class="icon exchange"></i></a><a href="/g0v-hackath7n" class="foldr item">自由時代 2014-02-22<i class="icon exchange"></i></a><a href="/g0v-hackath6n" class="foldr item">勞動基準 2013-12-21<i class="icon exchange"></i></a><a href="/g0v-hackath5n" class="foldr item">美麗島 2013-10-20<i class="icon exchange"></i></a><a href="/g0v-hackath4n" class="foldr item">國民大會 2013-08-10<i class="icon exchange"></i></a><a href="/g0v-hackath3n" class="foldr item">客廳工廠 2013-06-06<i class="icon exchange"></i></a><a href="/g0v-hackath2n" class="foldr item">九大建設 2013-03-23<i class="icon exchange"></i></a><a href="https://hackpad.com/lIoCjaeMWzC" target="iframe" class="link item">公地放領 2013-01-27<i class="icon text file outline"></i></a><a href="https://hackpad.com/ul6fMthof2S" target="iframe" class="link item">動員戡亂 2012-12-01<i class="icon text file outline"></i></a></div>
</div>
</div>
</div>
<div class="ui dropdown icon item history"><i class="icon time"></i>
<div class="menu"><a class="foldr item" href="/1WVWrKC-Tbry3ltgouQPpZH2Cd2HkKeZ8DjLs4PWa1z4">0801高雄氣爆資訊<i class="icon exchange"></i></a><a class="foldr item" href="/Kaohsiung-explode-20140801">0801高雄氣爆資訊<i class="icon exchange"></i></a><a class="foldr item" href="/ks0801">0801高雄氣爆資訊<i class="icon exchange"></i></a></div>
</div>
<div class="ui dropdown icon item about"><i class="icon help"></i>
<div class="menu"><a href="https://g0v.hackpad.com/welcome_to_hackfoldr#Welcome-to-Hackfoldr" target="iframe" class="link item">使用說明<i class="icon text file outline"></i></a><a href="/welcome-to-hackfoldr" class="foldr item">開發與回報<i class="icon exchange"></i></a><a href="https://github.com/hackfoldr/maker.moztw.org" target="_blank" class="link item">程式碼<i class="icon github"></i><i class="icon forward mail"></i></a></div>
</div><a style="display: none;" class="right item expand button collapsed mode hidden"><i class="icon arrow right"></i></a><a class="right item collapse button expanded mode"><i class="icon arrow left"></i></a>
<div class="right icon item zoom ui dropdown"><i class="icon zoom in"></i>
<div class="menu">
<div class="item normal">100%</div>
<div class="item large">130%</div>
<div class="item larger">150%</div>
</div>
</div>
</div>
</nav>
<nav id="topbar">
<div class="ui borderless menu"><a href="/1WVWrKC-Tbry3ltgouQPpZH2Cd2HkKeZ8DjLs4PWa1z4" class="item foldr title">0801高雄氣爆資訊</a><a href="https://docs.google.com/spreadsheets/d/1WVWrKC-Tbry3ltgouQPpZH2Cd2HkKeZ8DjLs4PWa1z4/edit" target="iframe" class="right icon item edit table"><i class="icon pencil"></i></a><a style="display: none;" class="right icon item refresh table hidden"><i class="icon repeat"></i></a><a class="right icon item add to list"><i class="icon add"></i></a></div>
<form style="display: none;" class="ui form segment no margin hidden expanded mode">
<div class="field">
<input placeholder="想顯示在 foldr 中的文件名稱" name="new-pad-name" value="我是可愛的新文件" class="new title" type="text">
</div>
<div class="ui submit button green small">create and add to foldr</div>
</form>
</nav>
<nav id="toc">
<div class="ui vertical menu sortable"><a href="https://mapsengine.google.com/map/embed?mid=z1Pm7zQY-cpo.kYCosnL20JN0" target="iframe" class="link item active">救災地圖<i class="icon map marker"></i></a><a href="http://umap.fluv.io/en/map/kaohsiung-explode-20140801_1984" target="iframe" class="link item">Umap版救災地圖<i class="icon map marker"></i></a><a href="http://apkh.tw/fire/fire.php" target="iframe" class="link item">高市氣爆火警回報系統<i class="icon globe"></i></a><div class="ui accordion"><div class="title header item ">現場最新狀況<i class="icon folder closed"></i><i class="icon folder open hidden" style="display: none;"></i></div><div class="content menu"><a href="https://docs.google.com/document/d/1yx8iv1gyaBBz2jD6WJm0u8iLQ3A2MAwVpkNGDIaFGyY/edit" target="iframe" class="link item">最新公告<i class="icon text file"></i></a><a href="https://docs.google.com/document/d/1SJFqGgPQb_GbBjGuozEstpkACsbyAoh15WStlRapNYI/preview" target="iframe" class="link item">網友回報區<i class="icon text file"></i></a><a href="https://docs.google.com/document/d/1SJFqGgPQb_GbBjGuozEstpkACsbyAoh15WStlRapNYI/edit" target="iframe" class="link item">網友回報區<i class="icon text file"></i></a><a href="https://ethercalc.org/static/proxy/hackpad/S0z70k3PaP4" target="iframe" class="link item">救災資訊<i class="icon globe"></i></a><a href="https://docs.google.com/spreadsheets/d/1OshWUVZ0X0a0Uw7gOsk_OhLkdlvNfeABlqtgRr39kmM/preview" target="iframe" class="link item">醫院病患資訊公告<i class="icon table"></i></a><a href="https://docs.google.com/spreadsheets/d/1cfifzxSOoRDddGr0_j3V8TofXjRqfJfkZD3yaFAar2o/preview" target="iframe" class="link item">傷病死亡名單<i class="icon table"></i></a></div></div><div class="ui accordion"><div class="title header item ">救護區、消防電話統整<i class="icon folder closed"></i><i class="icon folder open hidden" style="display: none;"></i></div><div class="content menu"><a href="http://www.1991.tw/1991_MsgBoard/login.jsp" target="iframe" class="link item">1991報平安留言平台<i class="icon globe"></i></a><a href="http://paste.plurk.com/show/1953230/" target="iframe" class="link item">前鎮各區消防連絡電話及醫護區<i class="icon globe"></i></a></div></div><div class="ui accordion"><div class="title header item ">志工資訊<i class="icon folder closed"></i><i class="icon folder open hidden" style="display: none;"></i></div><div class="content menu"><a href="https://docs.google.com/forms/d/1XDOPT8KmF_7s7VAXR_ArqxLX-NzRjHUV_2cCtQVkwuY/viewform" target="iframe" class="link item">【助人者募集】7/31高雄市瓦斯氣爆<i class="icon unordered list"></i></a><a href="https://docs.google.com/forms/d/1RgRq8DH2kt8YT5yB36ulwp-saQF1vNanXPpaDeFz4WU/viewform" target="iframe" class="link item">各類專長志工募集<i class="icon unordered list"></i></a><a href="https://docs.google.com/spreadsheets/d/1jOTtaR7_-4KADMdnHuswg9sMmd3pQqE3Io20zAcl2wA/preview" target="iframe" class="link item">各類專長志工一覽表<i class="icon table"></i></a><a href="https://docs.google.com/forms/d/1TJriYExcZbeFsVWgBXsb0-aQFpsMvFjBCZCf6Ive2KI/viewform?usp=send_form" target="iframe" class="link item">需要志工請填此<i class="icon unordered list"></i></a><a href="https://docs.google.com/spreadsheets/d/1tuy2sIJKFeW_-4iSQ6pwYzvEwVqWIdBhncrdPi9nlEw/edit?usp=sharing" target="iframe" class="link item">志工需求一覽表<i class="icon table"></i></a><a href="https://www.ptt.cc/bbs/Kaohsiung/M.1406850881.A.28E.html" target="iframe" class="link item">志工參考地圖<i class="icon chat outline"></i></a></div></div><div class="ui accordion"><div class="title header item ">官方機構公佈資訊<i class="icon folder closed"></i><i class="icon folder open hidden" style="display: none;"></i></div><div class="content menu"><a href="http://ensky.tw/hwama/" target="iframe" class="link item">陳菊&高市資訊<i class="icon globe"></i></a><a href="https://www.facebook.com/kikuChen" target="_blank" class="link item">陳菊 (花媽) 市長<i class="icon facebook"></i><i class="icon forward mail"></i></a><a href="https://www.facebook.com/GaoXiongShiZhengFu" target="_blank" class="link item">高雄市政府<i class="icon facebook"></i><i class="icon forward mail"></i></a><a href="http://www.fdkc.gov.tw/fdkc_danger/index.php?page=news&NType=MQ==&danger_history=MTk=" target="iframe" class="link item">高雄市消防局<i class="icon globe"></i></a></div></div><div class="ui accordion"><div class="title header item ">新聞台訊息總表<i class="icon folder closed"></i><i class="icon folder open hidden" style="display: none;"></i></div><div class="content menu"><a href="https://www.youtube.com/playlist?list=PLPh89N96p446cjAf_6J0PpbXBzzTHglQc" target="_blank" class="link item">新聞直播(YouTube列表)<i class="icon youtube"></i><i class="icon forward mail"></i></a><a href="http://bit.ly/penghu-crash_G8VLIVE-01" target="iframe" class="link item">新聞直播(G8V電視牆)/第一版/<i class="icon globe"></i></a><a href="http://www.ustream.tv/embed/18590658" target="iframe" class="link item">東森新聞台 (UStream)<i class="icon facetime video"></i></a><a href="https://www.youtube.com/embed/LZdixA6uTA8" target="iframe" class="link item">中天新聞 (Youtube)<i class="icon youtube play"></i></a><a href="http://www.ustream.tv/embed/18590674" target="iframe" class="link item">中天新聞 (UStream)<i class="icon facetime video"></i></a><a href="https://www.youtube.com/embed/SwrKzkRUlaw" target="iframe" class="link item">udn新聞 (Youtube)
<i class="icon youtube play"></i></a><a href="https://www.youtube.com/embed/s5Vj3VKOZGc" target="iframe" class="link item">民視新聞 (Youtube)
<i class="icon youtube play"></i></a><a href="http://www.ustream.tv/embed/18590692" target="iframe" class="link item">三立新聞 (UStream)<i class="icon facetime video"></i></a><a href="http://www.ustream.tv/embed/18590697" target="iframe" class="link item">TVBS新聞台 (UStream)<i class="icon facetime video"></i></a><a href="http://www.ustream.tv/embed/18294766" target="iframe" class="link item">年代新聞 (UStream)<i class="icon facetime video"></i></a><a href="http://news520.web.fc2.com/ustream.html" target="iframe" class="link item">LiveTV 台灣新聞頻道綜合<i class="icon globe"></i></a></div></div><div class="ui accordion"><div class="title header item ">PTT資訊(read only)<i class="icon folder closed"></i><i class="icon folder open hidden" style="display: none;"></i></div><div class="content menu"><a href="https://www.ptt.cc/bbs/Kaohsiung/M.1406827942.A.BFB.html" target="iframe" class="link item">高雄板-災害回報區<i class="icon chat outline"></i></a><a href="https://www.ptt.cc/bbs/Kaohsiung/M.1406827990.A.5F7.html" target="iframe" class="link item">高雄板-尋人狀況區<i class="icon chat outline"></i></a><a href="https://www.ptt.cc/bbs/Kaohsiung/M.1406828069.A.5A9.html" target="iframe" class="link item">高雄板-回報交流區<i class="icon chat outline"></i></a><a href="http://disp.cc/b/163-7YlM" target="iframe" class="link item">高雄板-災區照片<i class="icon chat outline"></i></a></div></div><div class="ui accordion"><div class="title header item ">社群網站比較有總整理的<i class="icon folder closed"></i><i class="icon folder open hidden" style="display: none;"></i></div><div class="content menu"><a href="http://bit.ly/Kaohsiung-explode" target="iframe" class="link item">FB)標題:高雄氣爆事件訊息統整<i class="icon globe"></i></a></div></div><div class="ui accordion"><div class="title header item ">影片紀錄<i class="icon folder closed"></i><i class="icon folder open hidden" style="display: none;"></i></div><div class="content menu"><a href="https://www.youtube.com/embed/KmEZNKAfh1Y" target="iframe" class="link item">14.07.31 高雄瓦斯氣爆監視錄影帶<i class="icon youtube play"></i></a><a href="https://www.facebook.com/photo.php?v=10203749537633896&fref=nf" target="_blank" class="link item">高雄前鎮區瓦斯爆炸<i class="icon facebook"></i><i class="icon forward mail"></i></a><a href="https://www.youtube.com/embed/5Oqk3KEtMHw" target="iframe" class="link item">1030731高雄氣爆事(行車記錄器)<i class="icon youtube play"></i></a><a href="https://www.facebook.com/photo.php?v=1444247869184193" target="_blank" class="link item">瓦斯氣爆<i class="icon facebook"></i><i class="icon forward mail"></i></a><a href="https://www.youtube.com/embed/2ecyfmNekYs" target="iframe" class="link item">高雄三多路.氣爆滿目瘡痍20140801<i class="icon youtube play"></i></a><a href="https://www.youtube.com/embed/BY85434x4CE" target="iframe" class="link item">瓦斯氣爆瞬間的監視器畫面 #1<i class="icon youtube play"></i></a><a href="https://www.youtube.com/embed/YhElyXb_QB0" target="iframe" class="link item">瓦斯氣爆瞬間的監視器畫面 #2<i class="icon youtube play"></i></a></div></div></div>
</nav>
</nav>
<div id="wrapper">
<div class="frame normal size large">
<iframe src="https://mapsengine.google.com/map/embed?mid=z1Pm7zQY-cpo.kYCosnL20JN0" class="large size" id="iframe" name="iframe"></iframe>
</div>
</div>
<div id="script">
<script>window.jQuery || document.write('<script src="/js/vendor/jquery-1.10.2.min.js"><\/script>')</script>
<script type="text/javascript" src="/js/global.js"></script>
<script>
var paths = location.pathname.split('/') || [];
var ethercalc_name = paths[1] || "welcome-to-hackfoldr";
var current_iframe_url = paths[2] ? unescape(unescape(paths[2])) : null;
var current_foldr_name = "";
var iframe_src;
var history_state={};
var foldr_histories = JSON.parse(localStorage.getItem("hackfoldr")) || [];
var foldr_scale = JSON.parse(localStorage.getItem("hackfoldr-scale")) || "";
var new_pad_row_index = 3;
var csv_api_source = "";
var csv_api_source_type = "";
// check where the csv will come from
if(ethercalc_name.length <= 40){
csv_api_source = 'https://ethercalc.org/_/'+ethercalc_name+'/csv';
csv_api_source_type = "ethercalc";
}else{
csv_api_source = 'docs.google.com/feeds/download/spreadsheets/Export?key='+ethercalc_name+'&exportFormat=csv&gid=0';
csv_api_source_type = "google";
};
var compile_json = function(rows){
var got_title = false
var depth = 0 // if depth == 1, link should in accordion
var link_template_source ='<a href="{{url}}" target="{{target}}" class="{{type}} item">{{subject}}<i class="icon {{icon}}"></i></a>';
var link_template = Handlebars.compile(link_template_source);
var add_link = function(row){
try{
var link_options = JSON.parse(row[2]);
}catch(e){
var link_options = {};
}
// auto link icon
var link_icon = "";
var link_type = "link";
var link_target = "iframe";
var link_url = row[0].trim();
if(link_url.match(/^.*.hackpad.com\//)){
link_icon = "text file outline";
} else if(link_url.match(/^.*.etherpad.mozilla.org\//)) {
link_icon = "file outline";
} else if(link_url.match(/^.*.groups.google.com\//)) {
link_icon = "users";
} else if(link_url.match(/^.*.plus.google.com\//)) {
link_icon = "google plus";
} else if(link_url.match(/^.*.kktix.cc\//)) {
link_icon = "bullhorn";
} else if(link_url.match(/^.*.kktix.com\//)) {
link_icon = "bullhorn";
} else if(link_url.match(/^.*.registrano.com\//)) {
link_icon = "bullhorn";
} else if(link_url.match(/^.*.docs.google.com\/spreadsheet.*/)) {
link_icon = "table";
} else if(link_url.match(/^.*.docs.google.com\/drawings.*/)) {
link_icon = "photo";
} else if(link_url.match(/^.*.docs.google.com\/document.*/)) {
link_icon = "text file";
} else if(link_url.match(/^.*.docs.google.com\/presentation.*/)) {
link_icon = "laptop";
} else if(link_url.match(/^.*.docs.google.com\/form.*/)) {
link_icon = "unordered list";
} else if(link_url.match(/^.*.drive.google.com\//)) {
link_icon = "cloud";
} else if(link_url.match(/^.*.mapsengine.google.com\//)) {
link_icon = "map marker";
} else if(link_url.match(/^.*.www.google.com\/maps\//)) {
link_icon = "map marker";
} else if(link_url.match(/^.*.umap.fluv.io\//)) {
link_icon = "map marker";
} else if(link_url.match(/^.*.github.com\//)) {
link_icon = "github";
} else if(link_url.match(/^.*.moqups.com\//)) {
link_icon = "photo";
} else if(link_url.match(/^.*.facebook.com\//)) {
link_icon = "facebook";
} else if(link_url.match(/^.*.twitter.com\//)) {
link_icon = "twitter";
} else if(link_url.match(/^.*.tumblr.com\//)) {
link_icon = "tumblr";
} else if(link_url.match(/^.*.trello.com\//)) {
link_icon = "trello";
} else if(link_url.match(/^.*.youtube.com\/embed\//)) {
link_icon = "youtube play";
} else if(link_url.match(/^.*.youtube.com\//)) {
link_icon = "youtube";
} else if(link_url.match(/^.*.ustream.tv\//)) {
link_icon = "facetime video";
} else if(link_url.match(/^.*.www.justin.tv\//)) {
link_icon = "facetime video";
} else if(link_url.match(/^.*.www.ptt.cc\/bbs\//)) {
link_icon = "chat outline";
} else if(link_url.match(/^.*.disp.cc\//)) {
link_icon = "chat outline";
} else if(link_url.match(/^.*.hack.g0v.tw\//)) {
link_icon = "exchange";
//link_url = link_url.split("/")[1].toString();
//link_type = "foldr";
//link_target = "";
} else if(link_url.match(/^.*.hack.etblue.tw\//)) {
link_icon = "exchange";
//link_url = link_url.split("/")[1].toString();
//link_type = "foldr";
//link_target = "";
} else if(link_url.match(/^.*.hackfoldr.org\//)) {
link_icon = "exchange";
//link_url = link_url.split("/")[1].toString();
//link_type = "foldr";
//link_target = "";
} else {
link_icon = "globe";
}
var context = {url: link_url, subject: row[1], icon: link_icon, type: link_type, target: link_target};
var $link_element = $(link_template(context));
for(key in link_options){
$link_element.attr(key, link_options[key]);
}
if(depth == 1){
$('#toc .ui.accordion:last').find('.menu').append($link_element)
}else{
$('#toc .ui.vertical.menu').append($link_element)
}
// enable default iframe?
if(current_iframe_url == "edit"){
if(csv_api_source_type=="ethercalc"){
iframe_src = 'https://ethercalc.org/'+ethercalc_name;
}else{
iframe_src = 'https://docs.google.com/spreadsheets/d/'+ethercalc_name+'/edit';
};
$("#topbar .edit.table").hide();
$("#topbar .refresh.table").show();
}else if((new RegExp(context.url+"/?")).test(current_iframe_url)){
iframe_src = current_iframe_url;
}else if(/^https:\/\/.*.hackpad.com\//.test(context.url)){
if( current_iframe_url === context.url.split(/\//).pop()){
iframe_src = context.url;
}
}
if(!iframe_src) {
iframe_src = context.url;
}
}
var accordion_template_source = '<div class="ui accordion"><div class="title header item ">{{title}}<i class="icon folder closed"></i><i class="icon folder open hidden" style="display: none;"></i></div><div class="content menu"></div></div>';
var accordion_template = Handlebars.compile(accordion_template_source);
var add_accordion = function(row){
try{
var options = JSON.parse(row[2]);
}catch(e){
var options = {};
}
var context = {title: row[1] };
var $accordion_el = $(accordion_template(context));
$accordion_el.appendTo('#toc .ui.vertical.menu').accordion({onChange: function(){
$accordion_el.find('.folder').toggle()
}})
if(options.expand){
$accordion_el.accordion('open',0)
}
}
$.each(rows, function(row_index, row){
//console.log(row);
// for gsheet
if(!row[0]){
row[0] = "";
}
if(!row[1]){
row[1] = "";
}
var this_row_url = row[0].trim();
// if 1st and 2nd is empty then this a empty row
if(this_row_url.length === 0 && row[1].trim().length === 0){
return
}
// now we have soming thing, should get title first
if(!got_title){
// TODO: need opt....
$.each(row, function(col_index, col){
col = col.trim()
// get the MAGIC title
if(!got_title && !col.match(/^#/) && col.length > 0) {
$('#topbar .foldr.title').html(col);
current_foldr_name = col;
got_title = true;
// detect title row index
//console.log(new_pad_row_index);
new_pad_row_index = row_index+2;
//console.log(row_index+2);
//console.log(new_pad_row_index.toString());
// add to history menu
var current_foldr_history = {
foldr_name: col,
foldr_id: ethercalc_name
};
// Remove all items in foldr_histories that share the same foldr_id before unshift
foldr_histories = $.grep(foldr_histories, function(value){
return JSON.parse(value).foldr_id !== current_foldr_history.foldr_id;
});
foldr_histories.unshift(JSON.stringify(current_foldr_history));
localStorage.setItem("hackfoldr", JSON.stringify(foldr_histories));
}
})
} else {
if(this_row_url.length == 0){ // folder
depth = 1
add_accordion(row);
}else{ // link
add_link(row);
// set initial page title
if(this_row_url == iframe_src){
$("title").text(row[1]+" | "+current_foldr_name+" | hackfoldr");
}
}
}
});
// set initial iframe src attribute
if(!$("#iframe").attr("src")){
$("#iframe").attr("src",iframe_src);
}
// auto new window, and auto new window icon
var new_window_icon = "<i class='icon forward mail'></i>";
var open_link_in_new_window_or_not = function(){
link_url = $(this).attr("href");
if(link_url.match(/^.*.plus.google.com\//)) {
return true;
} else if(link_url.match(/^.*.kktix.cc\//)) {
return true;
} else if(link_url.match(/^.*.kktix.com\//)) {
return true;
} else if(link_url.match(/^.*.registrano.com\//)) {
return true;
} else if(link_url.match(/^.*.github.com\//)) {
return true;
} else if(link_url.match(/^.*.drive.google.com\//)) {
return true;
} else if(link_url.match(/^.*.facebook.com\//)) {
return true;
} else if(link_url.match(/^.*.trello.com\//)) {
return true;
} else if(link_url.match(/^.*.youtube.com\/playlist.*/)) {
return true;
} else {
return false;
}
};
$("#sidebar a.link.item").filter(open_link_in_new_window_or_not).attr("target","_blank").append(new_window_icon);
$("#sidebar a.link.item[target='_blank']").not(":has(i.icon.forward.mail)").append(new_window_icon);
// auto expand active items
var link_is_current_url_or_not = function(){
link_url = $(this).attr("href");
if(link_url == iframe_src){
return true;
} else {
return false;
}
};
$("#toc a.link.item").filter(link_is_current_url_or_not).addClass("active").parent(".content").addClass("active").prev(".header").addClass("active");
}
var compile_ethercalc = function(){
if(csv_api_source_type=="ethercalc"){
// compile ethercalc csv
$.get(csv_api_source).pipe(CSV.parse).done(compile_json);
//console.log($.get(csv_api_source).pipe(CSV.parse));
}else{
//console.log($.get(csv_api_source).pipe(CSV.parse).done);
// compile gsheet-tabletop json
Tabletop.init({
key: ethercalc_name,
callback: function(data, tabletop){
data = data.map(function (o) {
result = [];
result[0] = o.url || "";
result[1] = o.title || "";
result[2] = o.foldrexpend || "";
result[3] = o["編輯註解"] || "";
result[4] = o.hints || "";
return result;
});
compile_json(data);
},
simpleSheet: true
});
}
};
compile_ethercalc();
// setup history menu
$.each(foldr_histories, function(index, foldr_history){
var item = JSON.parse(foldr_history);
$("#nav .history .menu").append(
$('<a />', { href: '/'+item.foldr_id, 'class': 'foldr item' })
.text(item.foldr_name)
.append($('<i class="icon exchange"></i>'))
);
});
// for semantic ui css specificity
$(".hidden").hide();
// sidebar expansion buttons
$("#nav .collapse.button").on("click tap", function(){
$("#sidebar").css("left","-17rem");
$("#wrapper").css("padding-left","3rem");
$(".expanded.mode").hide();
$(".collapsed.mode").show();
});
$("#nav .expand.button").on("click tap", function(){
$("#sidebar").css("left","0");
$("#wrapper").css("padding-left","20rem");
$(".expanded.mode").css("display","");
$(".collapsed.mode").hide();
});
// firefox fix for iframe initial size
$("#wrapper .frame").addClass("normal size");
// zoom in buttons
$(".frame, #iframe").addClass(foldr_scale + " size");
var set_scale = function(scale){
$(".frame, #iframe").removeClass("normal large larger").addClass(scale+" size");
localStorage.setItem("hackfoldr-scale", JSON.stringify(scale));
};
$("#nav .zoom.dropdown .normal").on("click tap", function(){
set_scale("normal");
});
$("#nav .zoom.dropdown .large").on("click tap", function(){
set_scale("large");
});
$("#nav .zoom.dropdown .larger").on("click tap", function(){
set_scale("larger");
});
// refresh table
// load ethercalc data only instead of loading the whole page
$("#topbar .refresh.table").on("click tap", function(){
$("#toc .menu").html("");
compile_ethercalc();
});
// create new hackpad and add to foldr
$("#topbar .add.to.list").on("click tap", function(){
$("#topbar .form").slideToggle();
// add moretext to defalt input value
//$.getJSONP('')
});
$("#topbar .form .submit").on("click tap", function(){
var new_hackpad_title = $("#topbar .form .new.title").val();
//var new_hackpad_id = encodeURIComponent(new_hackpad_title.slice(0,8));
var new_hackpad_id = Math.random().toString(36);
var new_hackpad_url = "https://g0v.hackpad.com/"+new_hackpad_id;
var new_menu_item = '<a href="'+new_hackpad_url+'" target="iframe" class="link item">'+new_hackpad_title+'<i class="icon text file outline"></i></a>';
// add new hackpad info to foldr
$('#toc .ui.vertical.menu').prepend(new_menu_item);
// post new hackpad info to ethercalc
$.ajax({
//url: "https://ethercalc.org/_/"+ethercalc_name,
url: "https://ethercalc.org/_/"+ethercalc_name+"?row="+new_pad_row_index.toString(),
//url: "https://ethercalc.org/_/"+ethercalc_name+"?row=3",
type: 'POST',
contentType: 'text/csv',
processData: false,
data: new_hackpad_url + ',' + new_hackpad_title
});
});
// link item events
$("#sidebar").on("click tap", "a.link.item", function(event){
// dynamic url
var iframe_path = event.target.href;
if(iframe_path.match(/^https:\/\/.*.hackpad.com\//)){
iframe_path = iframe_path.split(/\//).pop();
}
history.pushState(history_state,'', '/'+ethercalc_name+'/'+encodeURIComponent(encodeURIComponent(iframe_path))) ;
// when leaving ethercalc, show edit icon again
if(event.target.target !== "_blank"){
$("#topbar .edit.table").show();
$("#topbar .refresh.table").hide();
// reset page title
$("title").text($(this).text()+" | "+current_foldr_name+" | hackfoldr");
}
});
// activate link on click
$("#sidebar").on("click tap", "#toc a.link.item", function(){
$("#toc a.link.item").removeClass("active");
$(this).addClass("active");
});
// edit table
if(csv_api_source_type=="ethercalc"){
$("#topbar .edit.table").attr("href",'https://ethercalc.org/'+ethercalc_name);
}else{
$("#topbar .edit.table").attr("href",'https://docs.google.com/spreadsheets/d/'+ethercalc_name+'/edit');
}
$("#sidebar").on("click tap", "#topbar .edit.table", function(){
// switch icon
$("#topbar .edit.table").hide();
$("#topbar .refresh.table").show();
// change url
history.pushState(history_state,'', '/'+ethercalc_name+'/'+"edit") ;
// make foldr items sortable
});
// sort table
//$("#toc .sortable").sortable();
//$("#toc .sortable").on("sortchange", function( event, ui ) {
//$.ajax({
// contentType: 'text/plain',
// data: 'moveinsert '+'A2:F2'+' A5',
// type: 'POST',
// processData: false
//});
//});
// add href attr to foldr title
$("#topbar .foldr.title").attr("href",'/'+ethercalc_name);
// make current link item active
</script>
</div>
</body></html>