Skip to content

Instantly share code, notes, and snippets.

@ETBlue
Created July 31, 2014 21:12
Show Gist options
  • Save ETBlue/b3432cf0a277da859f4e to your computer and use it in GitHub Desktop.
Save ETBlue/b3432cf0a277da859f4e to your computer and use it in GitHub Desktop.
a html snapshot for Kaohsiung-explode-20140801 (hack.etblue.tw version)
<html><head>
<meta charset="utf-8">
<!-- libraries-->
<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> | hackfoldr
</title>
<link type="text/css" rel="stylesheet" href="chrome-extension://cpngackimfmofbokmjmljamhdncknpmg/style.css"><script type="text/javascript" charset="utf-8" src="chrome-extension://cpngackimfmofbokmjmljamhdncknpmg/js/page_context.js"></script><style>[touch-action="none"]{ -ms-touch-action: none; touch-action: none; }[touch-action="pan-x"]{ -ms-touch-action: pan-x; touch-action: pan-x; }[touch-action="pan-y"]{ -ms-touch-action: pan-y; touch-action: pan-y; }[touch-action="scroll"],[touch-action="pan-x pan-y"],[touch-action="pan-y pan-x"]{ -ms-touch-action: pan-x pan-y; touch-action: pan-x pan-y; }</style><style id="style-1-cropbar-clipper">/* Copyright 2014 Evernote Corporation. All rights reserved. */
.en-markup-crop-options {
top: 18px !important;
left: 50% !important;
margin-left: -90px !important;
width: 180px !important;
border: 2px rgba(255,255,255,.38) solid !important;
border-radius: 4px !important;
}
.en-markup-crop-options div div:first-of-type {
margin-left: 0px !important;
}
</style><script>window["_GOOG_TRANS_EXT_VER"] = "1";</script><script>window["_GOOG_TRANS_EXT_VER"] = "1";</script><script>window["_GOOG_TRANS_EXT_VER"] = "1";</script><script>window["_GOOG_TRANS_EXT_VER"] = "1";</script><script>window["_GOOG_TRANS_EXT_VER"] = "1";</script><script>window["_GOOG_TRANS_EXT_VER"] = "1";</script><script>window["_GOOG_TRANS_EXT_VER"] = "1";</script><script>window["_GOOG_TRANS_EXT_VER"] = "1";</script><script>window["_GOOG_TRANS_EXT_VER"] = "1";</script><script>window["_GOOG_TRANS_EXT_VER"] = "1";</script><script>window["_GOOG_TRANS_EXT_VER"] = "1";</script><script>window["_GOOG_TRANS_EXT_VER"] = "1";</script><script>window["_GOOG_TRANS_EXT_VER"] = "1";</script><script>window["_GOOG_TRANS_EXT_VER"] = "1";</script><script>window["_GOOG_TRANS_EXT_VER"] = "1";</script><script>window["_GOOG_TRANS_EXT_VER"] = "1";</script><script>window["_GOOG_TRANS_EXT_VER"] = "1";</script><script>window["_GOOG_TRANS_EXT_VER"] = "1";</script><script>window["_GOOG_TRANS_EXT_VER"] = "1";</script><script>window["_GOOG_TRANS_EXT_VER"] = "1";</script><script>window["_GOOG_TRANS_EXT_VER"] = "1";</script><script>window["_GOOG_TRANS_EXT_VER"] = "1";</script><script>window["_GOOG_TRANS_EXT_VER"] = "1";</script><script>window["_GOOG_TRANS_EXT_VER"] = "1";</script><script>window["_GOOG_TRANS_EXT_VER"] = "1";</script></head>
<body screen_capture_injected="true">
<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 href="/Kaohsiung-explode-20140801" class="foldr item">高雄氣爆訊息統整<i class="icon exchange"></i></a><a href="/ks0801" class="foldr item">0801高雄氣爆資訊<i class="icon exchange"></i></a><a href="/Kaohsiung-explode-20140801" class="foldr item">Hints:<i class="icon exchange"></i></a><a href="/g0v-summit2014" class="foldr item">g0v summit 2014工作區<i class="icon exchange"></i></a><a href="/welcome-to-hackfoldr" class="foldr item">歡迎光臨 hackfoldr<i class="icon exchange"></i></a><a href="/g0v-hackath9n" class="foldr item">6/21還我土地黑客松共筆區<i class="icon exchange"></i></a><a href="/welcome-to-hackfoldr" class="foldr item">https://g0v.hackpad.com/0.h39sce9x17hhyqfr<i class="icon exchange"></i></a><a href="/welcome-to-hackfoldr" class="foldr item">https://g0v.hackpad.com/0.g2ouozzcarp<i class="icon exchange"></i></a><a href="/moztw" class="foldr item">Mozilla 台灣社群<i class="icon exchange"></i></a><a href="/meta" class="foldr item">零時基礎建設<i class="icon exchange"></i></a><a href="/3du" class="foldr item">3du.tw<i class="icon exchange"></i></a><a href="/coscup2014" class="foldr item">COSCUP 2014 開源人年會<i class="icon exchange"></i></a><a href="/g0v-hackath8n" class="foldr item">解除戒嚴黑客松共筆區<i class="icon exchange"></i></a><a href="/g0v-hackath6n" class="foldr item">勞動基準黑客松<i class="icon exchange"></i></a><a href="/g0v-hackath2n" class="foldr item">xxxxx<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><i class="icon forward mail"></i></a></div>
</div><a class="right item expand button collapsed mode hidden" style="display: none;"><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 class="item foldr title" href="/Kaohsiung-explode-20140801">高雄氣爆訊息統整</a><a target="iframe" class="right icon item edit table" href="https://ethercalc.org/Kaohsiung-explode-20140801" style="display: none;"><i class="icon pencil"></i></a><a class="right icon item refresh table hidden" style="display: block;"><i class="icon repeat"></i></a><a class="right icon item add to list"><i class="icon add"></i></a></div>
<form class="ui form segment no margin hidden expanded mode" style="display: none;">
<div class="field">
<input placeholder="想顯示在 foldr 中的文件名稱" type="text" name="new-pad-name" value="我是可愛的新文件" class="new title">
</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">救災地圖<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></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><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></div></div><div class="ui accordion"><div class="title header item active">官方機構公佈資訊<i class="icon folder closed" style="display: none;"></i><i class="icon folder open hidden" style=""></i></div><div class="content menu active"><a href="http://ensky.tw/hwama/" target="iframe" class="link item" expand="false" style="opacity: 1;">官方機構公佈資訊3355555tt<i class="icon globe"></i></a><a href="https://www.facebook.com/kikuChen" target="_blank" class="link item" style="opacity: 1;">陳菊 (花媽) 市長<i class="icon facebook"></i><i class="icon forward mail"></i></a><a href="https://www.facebook.com/GaoXiongShiZhengFu" target="_blank" class="link item" style="opacity: 1;">高雄市政府<i class="icon facebook"></i><i class="icon forward mail"></i></a><a href="yyyu" target="iframe" class="link item" style="opacity: 1;"><i class="icon globe"></i></a></div></div><div class="ui accordion"><div class="title header item active">新聞台訊息總表<i class="icon folder closed" style="display: none;"></i><i class="icon folder open hidden" style=""></i></div><div class="content menu active"><a href="https://www.youtube.com/playlist?list=PLPh89N96p446cjAf_6J0PpbXBzzTHglQc" target="_blank" class="link item" style="opacity: 1;">新聞直播(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" style="opacity: 1;">新聞直播(G8V電視牆)/第一版/<i class="icon globe"></i></a><a href="http://www.ustream.tv/embed/13908237" target="iframe" class="link item" style="opacity: 1;">東森新聞<i class="icon facetime video"></i></a><a href="https://www.youtube.com/embed/LZdixA6uTA8" target="iframe" class="link item" style="opacity: 1;">中天新聞<i class="icon youtube play"></i></a><a href="http://www.justin.tv/swflibs/JustinPlayer.swf?channel=puwu3" target="iframe" class="link item" style="opacity: 1;">民視新聞(justin)<i class="icon facetime video"></i></a><a href="https://www.youtube.com/embed/s5Vj3VKOZGc" target="iframe" class="link item" style="opacity: 1;">民視新聞(youtube)<i class="icon youtube play"></i></a><a href="http://www.ustream.tv/embed/18590692" target="iframe" class="link item" style="opacity: 1;">三立新聞<i class="icon facetime video"></i></a></div></div><div class="ui accordion"><div class="title header item active">PTT資訊(read only)<i class="icon folder closed" style="display: none;"></i><i class="icon folder open hidden" style=""></i></div><div class="content menu active"><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">目前高雄災區照片 (DISP)<i class="icon chat outline"></i></a></div></div><div class="ui accordion"><div class="title header item active">紀錄影片<i class="icon folder closed" style="display: none;"></i><i class="icon folder open hidden" style=""></i></div><div class="content menu active"><a href="https://www.youtube.com/embed/KmEZNKAfh1Y" target="iframe" class="link item" style="opacity: 1;">14.07.31 高雄瓦斯氣爆監視錄影帶<i class="icon youtube play"></i></a><a href="https://www.facebook.com/photo.php?v=10203749537633896&amp;fref=nf" target="_blank" class="link item" style="opacity: 1;">高雄前鎮區瓦斯爆炸<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" style="opacity: 1;">1030731高雄氣爆事(行車記錄器)<i class="icon youtube play"></i></a><a href="https://www.facebook.com/photo.php?v=1444247869184193" target="_blank" class="link item" style="opacity: 1;">瓦斯氣爆<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" style="opacity: 1;">高雄三多路.氣爆滿目瘡痍20140801<i class="icon youtube play"></i></a><a href="https://www.youtube.com/watch?v=BY85434x4CE" target="iframe" class="link item" style="opacity: 1;">瓦斯氣爆瞬間的監視器畫面 #1<i class="icon youtube"></i></a><a href="https://www.youtube.com/watch?v=YhElyXb_QB0" target="iframe" class="link item" style="opacity: 1;">瓦斯氣爆瞬間的監視器畫面 #2<i class="icon youtube"></i></a></div></div><div class="ui accordion"><div class="title header item active">其他<i class="icon folder closed" style="display: none;"></i><i class="icon folder open hidden" style=""></i></div><div class="content menu active"><a href="http://hackfoldr.org/about" target="iframe" class="link item active" style="opacity: 1;">hackfoldr使用方法<i class="icon exchange"></i></a></div></div><div class="ui accordion"><div class="title header item active">目前死亡十五人<i class="icon folder closed" style="display: none;"></i><i class="icon folder open hidden" style=""></i></div><div class="content menu active"></div></div></div>
</nav>
</nav>
<div id="wrapper">
<div class="frame normal size large">
<iframe id="iframe" name="iframe" class="large size" src="https://ethercalc.org/Kaohsiung-explode-20140801"></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 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 compile_ethercalc = function(){
$.get('https://ethercalc.org/_/'+ethercalc_name+'/csv').pipe(CSV.parse).done(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"){
iframe_src = 'https://ethercalc.org/'+ethercalc_name;
$("#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){
// if 1st and 2nd is empty then this a empty row
if(row[0].trim().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);
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 value !== JSON.stringify(current_foldr_history);
});
foldr_histories.unshift(JSON.stringify(current_foldr_history));
localStorage.setItem("hackfoldr", JSON.stringify(foldr_histories));
}
})
} else {
if(row[0].length == 0){ // folder
depth = 1
add_accordion(row)
}else{ // link
add_link(row)
}
}
});
// 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 == current_iframe_url){
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");
});
};
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();
}
});
// activate link on click
$("#sidebar").on("click tap", "#toc a.link.item", function(){
$("#toc a.link.item").removeClass("active");
$(this).addClass("active");
});
// edit table
$("#topbar .edit.table").attr("href",'https://ethercalc.org/'+ethercalc_name);
$("#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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment