var post = DB.table('post'); //文章的資料表 var comment = DB.table('comment'); //留言的資料表 var userName = USER_NAME; var postId; $('.js-show-form-page').click(showFormPage); //「發文」按鈕點擊時,切換表單頁面 $('.js-show-post-list').click(showHomePage); $('.reload').click(reloadRefreshR);//「取消」按鈕點擊時,切換文章列表頁面 $('#home-page').on('click', '.post-item', showPostPage); //「取消」按鈕點擊時,切換文章列表頁面 function reloadRefresh() { post.read({}, updatePostList); showHomePage(); } function reloadRefreshR() { $(".overlay-message").text("正在加載"); $("#enderOverlay").fadeIn(); setTimeout(function(){ $(".overlay-message").text("即將完成"); }, 2000); setTimeout(function(){ $("#enderOverlay").fadeOut(); }, 4000); let timeoutVal = 4000; //ms setTimeout(reloadRefresh, timeoutVal); } setTimeout(function () { $("#enderOverlay").fadeIn(); setTimeout(function(){ $(".overlay-message").text("即將完成"); }, 2000); setTimeout(function(){ $("#enderOverlay").fadeOut(); }, 4000); $(".overlay-message").text("正在加載"); let timeoutVal = 4000; //ms setTimeout(reloadRefresh, timeoutVal); }, 50); // 切換「文章檢視」頁面 function showPostPage () { $('#home-page').hide(); $('#post-page').show(); $('#form-page').hide(); postId = $(this).data('id'); post.read({ id: postId }, updatePost); comment.find({ postId: postId }, updateComment); } // 切換「文章新增」頁面 function showFormPage () { $('#home-page').hide(); $('#post-page').hide(); $('#form-page').show(); } // 切換「文章列表」頁面 function showHomePage () { $('#home-page').show(); $('#post-page').hide(); $('#form-page').hide(); } $('.js-create-post').click(createPost); //「送出」按鈕點擊 $('.js-filter').click(filter); //「分類」按鈕點擊 $('.js-create-comment').click(createComment); // 新增留言 // 綁定刪除按鈕事件 $('.js-delete-post').click(deletePost); $('#post-list').on('click', '.js-delete-post', function() { var id = $(this).data('id'); $(".overlay-message").text("連線中"); $("#enderOverlay").fadeIn(); setTimeout(function(){ $(".overlay-message").text("正在處理"); }, 2000); setTimeout(function(){ $("#enderOverlay").fadeOut(); }, 4000); post.delete({ id: postId }); let timeoutVal = 4000; //ms setTimeout(reloadRefresh, timeoutVal); post.read({}, updatePostList); }); // 刪除文章函式 function deletePost() { if (!postId) return; var id = $(this).data('id'); $(".overlay-message").text("連線中"); $("#enderOverlay").fadeIn(); setTimeout(function(){ $(".overlay-message").text("正在處理"); }, 2000); setTimeout(function(){ $("#enderOverlay").fadeOut(); }, 4000); post.delete({ id: postId }); let timeoutVal = 4000; //ms setTimeout(reloadRefresh, timeoutVal); post.read({}, updatePostList); } // 新增文章到資料表 function createPost() { var typeVal = $('#form-type').val(); var titleVal = $('#form-title').val(); var contentVal = $('#form-content').val(); // 驗證:類型與標題必填,且內容需超過 20 字 if (typeVal !== '' && titleVal !== '' && contentVal.length > 20) { $('#form-type').val(''); // 清空輸入框 $('#form-title').val(''); $('#form-content').val(''); // 呼叫 API 建立文章 post.create({ type: typeVal, title: titleVal, content: contentVal, author: "Anonymous", date: new Date().toISOString(), // 建議轉為字串格式 }, function(response) { console.log('文章建立成功:', response); // 建議在成功回呼後再讀取,確保資料已寫入 post.read({}, updatePostList); }); showHomePage(); } else { alert('請確認文章類型、標題皆有填寫,且文章內容不得低於 20 字!'); } } // 更新首頁的文章列表 function updatePostList(data) { $('#post-list').empty(); data.forEach(function(d) { var color = typeToClass(d.type); // 使用反引號 (Template Literals) 渲染 HTML var html = ` <div class="post-item card" data-id="${d.id}"> <h3><span class="tag ${color}">${d.type}</span>${d.title}</h3> <p>${d.content.slice(0, 90)}...</p> <span class="gray">${d.date.slice(0, 10)}</span> </div> `; $('#post-list').append(html); }); if (data.length > 0) { $('#bottom-text').text('這是最後一頁了...'); } else { $('#bottom-text').text('無相關文章'); } } // 顯示特定類型的文章 function filter() { var typeVal = $(this).data('type'); if (typeVal == '全部') { post.read({}, updatePostList); } else { post.read({ type: typeVal }, updatePostList); } } // 顯示指定文章詳細內容 function updatePost(data) { if (data && data.length > 0) { var item = data[0]; $('#post-type').text(item.type); $('#post-title').text(item.title); $('#post-author').text(item.author); $('#post-content').text(item.content); $('#post-date').text(item.date.slice(0, 10)); // 更新標籤樣式 $('#post-type').removeClass().addClass('tag ' + typeToClass(item.type)); } } // 新增留言 function createComment() { var contentVal = $('#comment-input').val(); if (contentVal.trim() === '') return; // 避免空留言 $('#comment-input').val(''); comment.create({ content: contentVal, author: userName, date: new Date().toISOString(), postId: postId }, function(response) { console.log('留言成功:', response); // 留言成功後重新獲取該文章的所有留言 comment.find({ postId: postId }, updateComment); }); } // 更新留言列表 UI function updateComment(data) { $('#comment-list').empty(); data.forEach(function(d) { var html = ` <div class="comment-item card"> <strong>${d.author}</strong> <span>${d.content}</span> <span class="float-right gray">${d.date.slice(0, 10)}</span> </div> `; $('#comment-list').append(html); }); $('#comments-length').text(data.length + ' 則留言'); } // 根據文章類型對應顏色的標籤 function typeToClass(type) { var mapping = { '新聞': 'bg-blue', '愛情': 'bg-red', '八卦': 'bg-purple', '購物': 'bg-orange', '笑話': 'bg-yellow', '閒聊': 'bg-cyan' }; return mapping[type] || 'bg-gray'; }
const seeds = [ { "type": "笑話", "title": "很大的鴨子", "content": "大可大,非常大。", "author": "misomochi", "date": "2020-01-01T00:00:00.000Z", "comments": [ { "author": "XXXXHAY:", "content": "下去", "date": "2001-08-24T04:19:00.000Z" }, { "author": "nighthunt:", "content": "我覺得很可以欸", "date": "2001-08-24T04:28:00.000Z" }, { "author": "nighthunt:", "content": "有爆的潛力", "date": "2001-08-23T16:00:00.000Z" }, { "author": "a2396494:", "content": "道啦幹", "date": "2001-08-24T04:43:00.000Z" }, { "author": "XXXXHAY:", "content": "樓上", "date": "2001-08-23T16:00:00.000Z" }, { "author": "nighthunt:", "content": "沒人覺得好笑嗎QQ", "date": "2001-08-24T04:47:00.000Z" }, { "author": "benden:", "content": "其實蠻幽默的", "date": "2001-08-24T05:07:00.000Z" }, { "author": "w36501:", "content": "還可以", "date": "2001-08-24T05:28:00.000Z" }, { "author": "mono5566:", "content": "登登登登", "date": "2001-08-24T06:50:00.000Z" }, { "author": "bobwoodybuzz:", "content": "好笑", "date": "2001-08-24T06:50:00.000Z" }, { "author": "polobolo:", "content": "我覺得很好笑", "date": "2001-08-24T06:52:00.000Z" }, { "author": "Geniusla:", "content": "給你過", "date": "2001-08-24T07:19:00.000Z" }, { "author": "lo950425:", "content": "good", "date": "2001-08-24T07:24:00.000Z" }, { "author": "eric19980722:", "content": "嘴角失守", "date": "2001-08-24T07:26:00.000Z" }, { "author": "g895723100:", "content": "我覺得可以", "date": "2001-08-24T07:26:00.000Z" }, { "author": "mathedu:", "content": "道德經對吧", "date": "2001-08-24T07:28:00.000Z" }, { "author": "a78905589:", "content": "可以", "date": "2001-08-24T07:36:00.000Z" }, { "author": "imce:", "content": "我笑了給推", "date": "2001-08-24T07:45:00.000Z" }, { "author": "dino008:", "content": "過", "date": "2001-08-24T07:47:00.000Z" }, { "author": "c22748872:", "content": "很靠北阿wwwwww", "date": "2001-08-24T07:49:00.000Z" }, { "author": "TanB:", "content": "好吧", "date": "2001-08-24T07:49:00.000Z" }, { "author": "iamfreeze:", "content": "有啊", "date": "2001-08-24T07:55:00.000Z" }, { "author": "tp6al4:", "content": "有笑", "date": "2001-08-23T16:00:00.000Z" }, { "author": "Blue24581:", "content": "大可", "date": "2001-08-24T08:07:00.000Z" }, { "author": "brian1219:", "content": "哈哈", "date": "2001-08-23T16:00:00.000Z" }, { "author": "leonaacee:", "content": "微。好笑", "date": "2001-08-24T08:10:00.000Z" }, { "author": "kuan50118:", "content": "可以", "date": "2001-08-24T08:27:00.000Z" }, { "author": "bob3847:", "content": "有笑", "date": "2001-08-24T08:28:00.000Z" }, { "author": "alan15161718:", "content": "可以", "date": "2001-08-24T08:32:00.000Z" } ] }, { "type": "新聞", "title": "鮑威爾左手掌骨折 將無限期休兵", "content": `鮑威爾左手掌骨折 將無限期休兵 2020-02-02 10:34聯合報 / 記者毛琬婷/即時報導 本季打出亮眼表現的暴龍隊得分後衛鮑威爾(Norman Powell)又傳出傷情,他在昨天與活塞隊的比賽中不慎弄傷左手掌,造成左手第四掌骨骨折,將無限期休戰。 鮑威爾本季才因肩傷缺席了11場比賽,他從去年12月19日後就未再上場,直到1月13日對戰馬刺隊的比賽才順利歸隊,而他本季也一掃前4季場均只有個位數的低迷表現,本季出賽 38場繳出場均15.3分、3.9籃板、1.7助攻的成績,成為暴龍重要得分來源之一。 不過今天傳出鮑威爾左手掌骨折的消息,球隊也將他放進傷兵名單,且歸期未定,而他不是本季暴龍遭遇傷病的其中一員,羅瑞(Kyle Lowry)、席亞康(Pascal Siakam)、小 加索(Marc Gasol)、伊巴卡(Serge Ibaka)、范弗利特(Fred VanVleet)等人也都曾因傷缺陣達雙位數。 在傷兵頻頻的情況下,暴龍仍展現團隊陣容深度,目前以35勝14負的戰績暫居東區第2,近期更打出一股10連勝氣勢,距離追平隊史最長11連勝只差一步。`, "author": "phoenix286", "date": "Sun Feb 2 14:07:34 2020", "comments": [ { "author": "SilenceWFL", "content": "今年是不是衝到姓Powell的", "date": "02/02 14:08" }, { "author": "tgmrvmle", "content": "真的,獨行俠的Powell也受大傷", "date": "02/02 14:14" }, { "author": "a11011788", "content": "好慘", "date": "02/02 14:14" }, { "author": "a3221715", "content": "還以為是Ball==", "date": "02/02 14:18" }, { "author": "a3221715", "content": "真的==", "date": "02/02 14:22" }, { "author": "DPP48", "content": "諾曼砲停機檢修中", "date": "02/02 14:32" }, { "author": "taiwanalien", "content": "也太巧...", "date": "02/02 14:34" }, { "author": "frank8979", "content": "嚇死想說我球怎麼了", "date": "02/02 14:37" }, { "author": "o0991758566", "content": "還以為是球哥", "date": "02/02 14:40" }, { "author": "MichaelRedd", "content": "以為是球哥,嚇一跳", "date": "02/02 14:47" }, { "author": "jk8177919", "content": "蠻多場都是靠他救的", "date": "02/02 14:48" }, { "author": "OmtRtugh", "content": "砲哥QQ", "date": "02/02 14:54" }, { "author": "Rayshief", "content": "諾門砲qq", "date": "02/02 14:58" }, { "author": "EriCartman", "content": "我也以為是球", "date": "02/02 15:09" }, { "author": "TexasFlood", "content": "叫柏瑋的沒一個遜咖", "date": "02/02 15:13" }, { "author": "eric050692", "content": "10連勝的重要功臣....QQ", "date": "02/02 15:23" }, { "author": "windowdoor", "content": "以為是球哥", "date": "02/02 15:39" }, { "author": "dajyunlin", "content": "早日康復", "date": "02/02 16:09" }, { "author": "dannyshan", "content": "球哥+1", "date": "02/02 16:39" }, { "author": "tim8333", "content": "諾曼砲", "date": "02/02 16:57" } ] }, { "type": "笑話", "title": "小明練武功", "content": "\n 小明是個習武之人,有一天一位大師要傳授畢生絕學給小明 ,小明便開始苦練基礎 ,\n 每天到筋疲力盡為止。\n 在傳授那天 ,大師對著小明說:「你這呆徒!\n 不留一點體力,我要怎麼把功夫傳給你?」\n 小明:「可是師父,留體力學,好難。」", "author": "bbo214", "date": "2020-01-01T00:00:00.000Z", "comments": [ { "author": "accin:", "content": "幹我被當3次", "date": "2001-12-16T16:00:00.000Z" }, { "author": "Agdanpanda:", "content": "有笑給推", "date": "2001-12-17T04:38:00.000Z" }, { "author": "automaton:", "content": "被當的都給我推起來!!", "date": "2001-12-17T04:45:00.000Z" }, { "author": "henry8168:", "content": "XD", "date": "2001-12-17T04:46:00.000Z" }, { "author": "VerilogMai:", "content": "推", "date": "2001-12-17T05:03:00.000Z" }, { "author": "iamnotme:", "content": "XD", "date": "2001-12-17T05:06:00.000Z" }, { "author": "bravo223999:", "content": "可以", "date": "2001-12-17T05:14:00.000Z" }, { "author": "ggsm1598:", "content": "沒學過給推", "date": "2001-12-17T05:31:00.000Z" }, { "author": "juston01:", "content": "好難QQ", "date": "2001-12-17T05:37:00.000Z" }, { "author": "st9240208:", "content": "QQ被當過", "date": "2001-12-17T05:45:00.000Z" }, { "author": "AppleApe:", "content": "真的有夠難", "date": "2001-12-17T05:47:00.000Z" }, { "author": "regen1999:", "content": "推", "date": "2001-12-17T05:55:00.000Z" }, { "author": "cclon543:", "content": "微笑帶過", "date": "2001-12-17T05:55:00.000Z" }, { "author": "s11479324:", "content": "被當過嗚嗚", "date": "2001-12-17T06:07:00.000Z" }, { "author": "lovekangin:", "content": "還好我不用學", "date": "2001-12-16T16:00:00.000Z" }, { "author": "teleportcat:", "content": "Ez", "date": "2001-12-17T06:11:00.000Z" }, { "author": "W96U:", "content": "不錯", "date": "2001-12-17T06:13:00.000Z" }, { "author": "calvin0319:", "content": "可以", "date": "2001-12-17T06:25:00.000Z" }, { "author": "jack011900:", "content": "不錯", "date": "2001-12-17T06:27:00.000Z" }, { "author": "MyKal1001:", "content": "笑死", "date": "2001-12-17T06:31:00.000Z" }, { "author": "caligeeinin:", "content": "物理系念到大四終於被確定是學武之人", "date": "2001-12-17T06:32:00.000Z" }, { "author": "rpg666123:", "content": "沒學過推個", "date": "2001-12-17T06:33:00.000Z" }, { "author": "kkes0001:", "content": "可以", "date": "2001-12-17T06:41:00.000Z" }, { "author": "ganhua:", "content": "先推再說xD", "date": "2001-12-17T06:41:00.000Z" }, { "author": "warren8877:", "content": "推", "date": "2001-12-17T06:42:00.000Z" }, { "author": "LAD22:", "content": "幹", "date": "2001-12-16T16:00:00.000Z" }, { "author": "LAD22:", "content": "固體", "date": "2001-12-17T06:43:00.000Z" }, { "author": "LAD22:", "content": "中興大學土木系", "date": "2001-12-16T16:00:00.000Z" }, { "author": "chiang1058:", "content": "哈哈哈哈嗚嗚嗚嗚QAQ", "date": "2001-12-17T06:46:00.000Z" }, { "author": "hate56:", "content": "真的好難QQ", "date": "2001-12-17T06:48:00.000Z" }, { "author": "ryuri:", "content": "可以wwwww", "date": "2001-12-17T06:48:00.000Z" } ] }, { "type": "笑話", "title": "什麼飲料最好玩?", "content": "喝剩的飲料", "author": "xuan9612", "date": "2020-01-01T00:00:00.000Z", "comments": [ { "author": "nighthunt:", "content": "還行啦", "date": "2001-05-23T17:52:00.000Z" }, { "author": "wasgavin0410:", "content": "我覺得很好笑啊靠北", "date": "2001-05-23T17:54:00.000Z" }, { "author": "ben7431495:", "content": "哇尬意DNF", "date": "2001-05-23T17:59:00.000Z" }, { "author": "cobrangelk:", "content": "我居然笑了", "date": "2001-05-23T18:16:00.000Z" }, { "author": "bomb1000:", "content": "清新", "date": "2001-05-23T18:23:00.000Z" }, { "author": "axion6012:", "content": "不錯", "date": "2001-05-23T18:24:00.000Z" }, { "author": "puremanly:", "content": "就喝剩的飲料", "date": "2001-05-23T18:32:00.000Z" }, { "author": "jeeplong:", "content": "行", "date": "2001-05-23T18:37:00.000Z" }, { "author": "luckydodo520:", "content": "超好笑", "date": "2001-05-23T18:46:00.000Z" }, { "author": "siensien:", "content": "不錯", "date": "2001-05-23T18:50:00.000Z" }, { "author": "uohZemllac:", "content": "有笑有推", "date": "2001-05-23T18:56:00.000Z" }, { "author": "jeffmao5566:", "content": "還行啊", "date": "2001-05-23T19:21:00.000Z" }, { "author": "nvalue:", "content": "XDDDD", "date": "2001-05-23T19:29:00.000Z" }, { "author": "ZhiShan:", "content": "求解釋", "date": "2001-05-23T20:15:00.000Z" }, { "author": "ryuri:", "content": "靠北我他媽笑了", "date": "2001-05-23T20:25:00.000Z" }, { "author": "twin1949tw:", "content": "樓上,好玩的台語就叫喝剩", "date": "2001-05-23T20:28:00.000Z" }, { "author": "loveinmars:", "content": "自動出現黃立成的聲音", "date": "2001-05-23T20:47:00.000Z" }, { "author": "Cottonz:", "content": "XDDDD", "date": "2001-05-23T21:08:00.000Z" }, { "author": "aqrt66558:", "content": "XDDDD", "date": "2001-05-23T21:18:00.000Z" }, { "author": "MrPenguinn:", "content": "超老", "date": "2001-05-23T21:23:00.000Z" }, { "author": "saikong:", "content": "靠北", "date": "2001-05-23T16:00:00.000Z" } ] }, { "type": "購物", "title": "1/25~2/8 PCHOMEx街口優惠8%", "content": `提醒ㄧ下 第二週今天開始了 街口帳戶或是銀行帳戶扣款儲值PChome $2500 會有200現金回饋+50的街口幣 之後可用來搭配Line導購5%以上來購買商品 用儲值進去導購是可以得到回饋的:)`, "author": "polarbeer", "date": "Sat Feb 1 00:41:32 2020", "comments": [ { "author": "line70107", "content": "補圖", "date": "2001-01-24T16:00:00.000Z" }, { "author": "nentendo", "content": "試了一下無法使用街口結帳…", "date": "2001-01-31T16:00:00.000Z" }, { "author": "sieda", "content": "line導購只有1%啊", "date": "2001-01-24T17:34:00.000Z" }, { "author": "jamesmile", "content": "哪裡有2500啊怎麼沒看到@@", "date": "2001-01-24T17:35:00.000Z" }, { "author": "davidaustin", "content": "500+2000", "date": "2001-01-24T17:35:00.000Z" }, { "author": "nentendo", "content": "導購的可以用街口結帳嗎?", "date": "2001-01-24T17:36:00.000Z" }, { "author": "adrianex77", "content": "是先用街口結帳,未來買商品才用導購然後購物金付款", "date": "2001-01-24T17:37:00.000Z" }, { "author": "adrianex77", "content": ",買購物金導購不回饋", "date": "2001-01-24T17:37:00.000Z" }, { "author": "sieda", "content": "1000+1500", "date": "2001-01-24T17:38:00.000Z" }, { "author": "jamesmile", "content": "阿擬嘎", "date": "2001-01-24T16:00:00.000Z" }, { "author": "nentendo", "content": "啊!忘了儲值不能用導購,不過我用APP也無法用街口", "date": "2001-01-24T17:43:00.000Z" }, { "author": "nentendo", "content": "結帳,只好改網頁版了", "date": "2001-01-24T17:43:00.000Z" }, { "author": "sieda", "content": "https://i.imgur.com/LqrDJmk.jpg", "date": "2001-01-24T17:43:00.000Z" }, { "author": "cip604", "content": "感謝 已儲值2500", "date": "2001-01-24T17:44:00.000Z" }, { "author": "sieda", "content": "我用app結帳可以用街口啊", "date": "2001-01-24T17:44:00.000Z" }, { "author": "erik8866", "content": "請問下周還有一次嗎??", "date": "2001-01-24T16:00:00.000Z" }, { "author": "nentendo", "content": "我也記得之前可以,但現在不知為何沒選項可選", "date": "2001-01-24T17:53:00.000Z" }, { "author": "nentendo", "content": "https://i.imgur.com/eEWWOMd.jpg", "date": "2001-01-24T17:53:00.000Z" }, { "author": "adrianex77", "content": "1/25-1/31一次上限200", "date": "2001-01-31T16:00:00.000Z" }, { "author": "willko", "content": "活動期間本來就不能用街口幣折抵啊", "date": "2001-01-24T16:00:00.000Z" } ] }, { "type": "愛情", "title": "該送禮物嗎", "content": `我男30 對方女26 有打算在情人節告白 不知道要不要送情人節禮物呢? 如果告白死就QQ了 目前有牽手親吻 但就是沒有確立關係 所以對方FB還是寫單身 認識時間只有三個月 但我想要確立關係 會不會太急呢? 如果要送禮物 我該告白時一起送 還是得到答覆後再拿出呢? 另外假設進展順利 一開始就送手錶合適嗎? 其實對方已經有手表了 但手錶代表的意義蠻深的 所以有想送 但怕隔年不好提升禮物等級(?) 或是首飾類(手鐲 項鍊)比較好? 對方喜歡耳環 但之前有送過了 請各位幫忙給點意見 謝謝大家`, "author": "risD", "date": "Sun Feb 2 17:10:00 2020", "comments": [ { "author": "jidou:", "content": "三個月差不多要進展了,親吻還不說交往,我會以為想要玩喔", "date": "2001-02-02T09:12:00.000Z" }, { "author": "Firenzea:", "content": "送手表的意義是啥?一只很貴?", "date": "2001-02-02T09:12:00.000Z" }, { "author": "Firenzea:", "content": "錶", "date": "2001-02-02T09:12:00.000Z" }, { "author": "jidou:", "content": "可是她是不是只想玩,想不想要交往,文章裡面沒有資訊", "date": "2001-02-02T09:12:00.000Z" }, { "author": "jason032323:", "content": "先告白成功後再送", "date": "2001-01-31T16:00:00.000Z" }, { "author": "jason032323:", "content": "物不是重點", "date": "2001-02-01T16:00:00.000Z" }, { "author": "Firenzea:", "content": "我是認為", "date": "2001-01-31T16:00:00.000Z" }, { "author": "Firenzea:", "content": "主權」的感覺", "date": "2001-02-01T16:00:00.000Z" }, { "author": "davery:", "content": "親吻了還不算喔...趕快告白比較實在", "date": "2001-02-02T09:14:00.000Z" }, { "author": "tellthe:", "content": "答應後再送啦,不然會有拿人手短的感覺XDDD也不要一起,", "date": "2001-02-02T09:17:00.000Z" }, { "author": "tellthe:", "content": "又不是交換禮物", "date": "2001-02-02T09:17:00.000Z" }, { "author": "wea567:", "content": "感覺牽手親吻已經是確立關係了啦。只是欠缺告白的儀式之類", "date": "2001-02-02T09:20:00.000Z" }, { "author": "wea567:", "content": "的", "date": "2001-02-02T09:20:00.000Z" }, { "author": "risD:", "content": "對...缺了儀式", "date": "2001-02-01T16:00:00.000Z" }, { "author": "risD:", "content": "手錶我查是有表白跟分分秒秒一起走的意思", "date": "2001-02-02T09:39:00.000Z" }, { "author": "RaiGend0519:", "content": "別送", "date": "2001-02-02T09:40:00.000Z" }, { "author": "RaiGend0519:", "content": "情人節約出去直接定生死", "date": "2001-02-02T09:41:00.000Z" }, { "author": "risD:", "content": "謝謝tell", "date": "2001-01-31T16:00:00.000Z" }, { "author": "Firenzea:", "content": "那要表白(?)跟分分秒秒一起走的話不是現在嗎?", "date": "2001-02-02T09:41:00.000Z" }, { "author": "risD:", "content": "不送是怕有些女生認為這點心意都不願給之類的?", "date": "2001-02-02T09:42:00.000Z" }, { "author": "Firenzea:", "content": "總不會在一起後才要送手錶表白吧", "date": "2001-02-01T16:00:00.000Z" }, { "author": "Firenzea:", "content": "一起走了?", "date": "2001-02-02T09:42:00.000Z" }, { "author": "RaiGend0519:", "content": "啊如果她不想進一步,你送她接受就變渣女,她不接受", "date": "2001-02-02T09:42:00.000Z" }, { "author": "RaiGend0519:", "content": "你又尷尬,兩條都4死路R", "date": "2001-02-02T09:42:00.000Z" }, { "author": "RaiGend0519:", "content": "都已經做到這份上了,先定生死再說", "date": "2001-02-02T09:43:00.000Z" }, { "author": "risD:", "content": "啊啊啊", "date": "2001-01-31T16:00:00.000Z" }, { "author": "meishan31:", "content": "不要", "date": "2001-02-02T09:52:00.000Z" }, { "author": "gjiiiiii:", "content": "第一次看到手錶等於分分秒秒一起走XDD", "date": "2001-02-02T09:55:00.000Z" }, { "author": "NSRC:", "content": "早就有男友了", "date": "2001-02-02T09:55:00.000Z" }, { "author": "risD:", "content": "gji我google的啦", "date": "2001-02-02T09:57:00.000Z" } ] }, { "type": "購物", "title": "買麥當勞或肯德基送漢堡王", "content": `★ 活動辦法|憑「當日」購買麥當勞或肯德基的「套餐」發票明細,即可免費兌換漢堡王 全新限時主打星「義式青醬烤時蔬雞腿堡」或者「義式青醬烤時蔬里肌堡」一個! ★ 兌換數量|限量一萬份,數量有限,換完為止 ★ 活動日期|即日起至12/10 ★ 活動門市|全台漢堡王門市 (P.S.機場店&兒童樂園店不適用) ★ 注意事項| 1.每日上午10:30後供應。 2.活動商品數量限一萬份,換完為止。 3.每人僅可兌換一次,每次限兌換一個漢堡。 4.兌換時需出示發票明細紙本,若破損不全或填載模糊不清,恕不提供兌換。 5.未附明細之紙本發票、電子載具恕不適用。 6.活動限臨櫃兌換,外送恕不適用。 7.若發生問題或不可抗力因素導致活動無法進行,漢堡王有保留變更或終止本活動時間、 內容之權利。`, "author": "greenruler", "date": "Thu Dec 5 11:12:42 2019", "comments": [ { "author": "b10485762000:", "content": "12/05", "date": "2001-01-31T16:00:00.000Z" }, { "author": "macrose", "content": "首先,你要找的到漢堡王", "date": "2001-12-05T03:13:00.000Z" }, { "author": "sdhpipt", "content": "好奇妙的活動", "date": "2001-12-04T16:00:00.000Z" }, { "author": "wenzao6040", "content": "哈這麼狂", "date": "2001-12-05T03:16:00.000Z" }, { "author": "xufuu", "content": "高雄還沒開幕", "date": "2001-12-04T16:00:00.000Z" }, { "author": "xufuu", "content": "點點卡點便宜的解任務", "date": "2001-12-05T03:18:00.000Z" }, { "author": "Deltak", "content": "https://i.imgur.com/IiE7oMH.png", "date": "2001-12-05T03:25:00.000Z" }, { "author": "kingoftenor", "content": "http://bit.ly/2rjb9Un", "date": "2001-12-05T03:26:00.000Z" }, { "author": "kingoftenor", "content": "官方fb", "date": "2001-12-05T03:26:00.000Z" }, { "author": "a10141013", "content": "這什麼?", "date": "2001-12-05T03:26:00.000Z" }, { "author": "chris0123", "content": "肯德基報優惠碼,有可能不被認可為套餐?", "date": "2001-12-05T03:27:00.000Z" }, { "author": "RainbowHeart:", "content": "12/05", "date": "2001-01-31T16:00:00.000Z" }, { "author": "oba5566", "content": "用一萬份免費漢堡來增加對手業績???", "date": "2001-12-05T03:28:00.000Z" }, { "author": "tantai99", "content": "\"當日\"發票", "date": "2001-12-05T03:28:00.000Z" }, { "author": "peanutboy", "content": "記得近半年一年有新開蠻多家漢堡王的", "date": "2001-12-05T03:29:00.000Z" }, { "author": "annheilong", "content": "這活動也太神祕", "date": "2001-12-04T16:00:00.000Z" }, { "author": "peanutboy", "content": "這策略很像某人說支持什麼之類的…", "date": "2001-12-04T16:00:00.000Z" }, { "author": "RainbowHeart:", "content": "12/05", "date": "2001-01-31T16:00:00.000Z" }, { "author": "e04bank", "content": "好狂", "date": "2001-12-05T03:37:00.000Z" }, { "author": "gogotalk", "content": "這招看不懂", "date": "2001-12-05T03:40:00.000Z" }, { "author": "hydra7", "content": "狂", "date": "2001-12-05T03:42:00.000Z" }, { "author": "willion003", "content": "交大剛好有一間", "date": "2001-12-05T03:46:00.000Z" } ] }, { "type": "新聞", "title": "英國正式脫歐 結束47年歐盟成員身分", "content": `經過三年半,英國決定在台灣時間2月1號早上7點,正式脫歐。英國首相強生強調,脫歐 對英國來講,是新的開始而非結束。 英國當地時間1月31號晚間11點,倫敦大笨鐘的影像投影在倫敦唐寧街10號首相官邸,預 錄的鐘聲響徹雲霄,也代表英國正式脫離歐盟,結束了長達47年的歐盟成員身份,成為史 上第一個脫歐的國家。同一時間,英國脫歐黨號召大批民眾聚集在國會大廈外的廣場,慶 祝這歷史性的時刻。 現場民眾表示,「太棒了,這一刻等太久了,為了脫歐付出了很大代價。」也有民眾指出 ,「我非常興奮,太棒了,這也是我們想要的,這是一場辛苦的奮戰,波瑞斯(強生)加油 。」 `, "author": "S7617921", "date": "Sat Feb 1 21:24:54 2020", "comments": [ { "author": "charco:", "content": "脫歐被肺炎蓋過了", "date": "2001-01-31T16:00:00.000Z" }, { "author": "GhostFather:", "content": "我豪男過", "date": "2001-01-31T16:00:00.000Z" }, { "author": "chocoball:", "content": "然後明年又要申請加入?", "date": "2001-01-31T16:00:00.000Z" }, { "author": "avgirl:", "content": "歐盟就是一個笑話阿...........", "date": "2001-01-31T16:00:00.000Z" }, { "author": "kaodio:", "content": "不會再辦個入歐公投喔", "date": "2001-01-31T16:00:00.000Z" }, { "author": "xianfen:", "content": "沒空", "date": "2001-01-31T16:00:00.000Z" }, { "author": "Brad255:", "content": "歐盟還能撐幾年?", "date": "2001-01-31T16:00:00.000Z" }, { "author": "luckysummer:", "content": "偷偷來", "date": "2001-01-31T16:00:00.000Z" }, { "author": "ewjfd:", "content": "881", "date": "2001-01-31T16:00:00.000Z" }, { "author": "oscarwu3041:", "content": "蘇格蘭:幹", "date": "2001-01-31T16:00:00.000Z" }, { "author": "koushimei:", "content": "一堆左膠國家的組合", "date": "2001-01-31T16:00:00.000Z" }, { "author": "judoyang:", "content": "軟脫歐??", "date": "2001-01-31T16:00:00.000Z" }, { "author": "cloudcuckoo:", "content": "推特英國鄉民還在崩潰,可憐哪", "date": "2001-01-31T16:00:00.000Z" }, { "author": "lusifa2007:", "content": "這樣是恢復各國關稅?", "date": "2001-01-31T16:00:00.000Z" }, { "author": "ECZEMA:", "content": "歷史大事啊!", "date": "2001-01-31T16:00:00.000Z" }, { "author": "tomchow76:", "content": "英國脫歐是一種歷史的必然", "date": "2001-01-31T16:00:00.000Z" }, { "author": "panny2010:", "content": "脫歐完還要嘲笑一下歐盟XD", "date": "2001-01-31T16:00:00.000Z" }, { "author": "tomchow76:", "content": "都在跟歐陸國家對槓", "date": "2001-01-31T16:00:00.000Z" }, { "author": "vincent0911x:", "content": "短期也沒啥影響", "date": "2001-01-31T16:00:00.000Z" }, { "author": "kinomon:", "content": "神串留名", "date": "2001-01-31T16:00:00.000Z" }, { "author": "SuperBMW:", "content": "英格蘭", "date": "2001-01-31T16:00:00.000Z" }, { "author": "alasa15:", "content": "歐盟有這麼久了!?", "date": "2001-01-31T16:00:00.000Z" }, { "author": "Horie:", "content": "脱", "date": "2001-01-31T16:00:00.000Z" }, { "author": "audi0909:", "content": "媽我在這裡,我是歐派", "date": "2001-01-31T16:00:00.000Z" }, { "author": "ZXKUQYB:", "content": "想起剛投出脫歐結果時國內政客的狼狽樣XD", "date": "2001-01-31T16:00:00.000Z" } ] }, ] var post = DB.table('post'); //文章的資料表 var comment = DB.table('comment'); //留言的資料表 function initDB () { post.delete({}) comment.delete({}) comment_arr = [] seeds.forEach(function (p, idx) { p.date = new Date(p.date) var comments = p.comments delete p['comments'] post.create(p, obj => { comments = comments.map(function (c) { c.postId = obj.id c.date = new Date(c.date) return c }); comment_arr = comment_arr.concat(comments) comment.create(comment_arr, console.log) }) }); }
Document
全部
新聞
愛情
八卦
購物
笑話
閒聊
發文
重新加載
正在載入中...
請選擇文章類型
新聞
愛情
八卦
購物
笑話
閒聊
取消
送出
返回文章列表
刪除文章
類型
標題
(
作者
)
文章內容文章內容文章內容....
2020-01-01
留言已停用
留言
正在加載