var _, appendText, removeHmm, getGeneral, stdInteract, commands; _ = require("prelude-ls"); appendText = function(text){ console.log(text); return d3.selectAll("body").text(text); }; removeHmm = function(string){ var s, i$, ref$, len$, i, rgx; s = string; for (i$ = 0, len$ = (ref$ = ["的", "了", "給我", " "]).length; i$ < len$; ++i$) { i = ref$[i$]; rgx = new RegExp(i, "g"); s = s.replace(rgx, ""); } return s; }; getGeneral = function(url){ var build; build = function(name){ console.log(name); userSay(name); return window.open( url + removeHmm( name)); }; return build; }; stdInteract = function(it, dialog, func){ userSay(dialog); lilySay("關於「" + dialog + "」的查詢結果"); return func( removeHmm( it)); }; if (annyang) { console.log( "hi annyang"); commands = { "公司:name": function(it){ return stdInteract(it, "公司" + it, buildCompanyTable); }, "幫助我": function(){ return stdInteract("", "幫助我", what2Ask); }, ":name (的) 農藥殘留 (標準)": function(it){ return stdInteract(it, it + "農藥殘留", buildInsecticide); }, "優良餐飲:name": function(it){ return stdInteract(it, "優良餐飲" + it, buildGoodRestaurant); }, "違規標示:name": function(it){ return stdInteract(it, "違規標示" + it, buildBadSign); }, "資訊不符:name": function(it){ return stdInteract(it, "資訊不符" + it, buildNoMatch); }, "視覺化:name": function(it){ return stdInteract(it, "視覺化" + it, buildDraw); }, "地標地圖": function(){ return stdInteract("", "地標地圖", buildMap); }, "不同種類(的) :name": function(it){ if (it === "蕃茄") { it = "番茄"; } return stdInteract(it, "不同種類" + it + "價格", function(it){ return loadColorBar(veggieCHTbl[it]["filename"], "分種類"); }); }, "不同市場(的) :name": function(it){ if (it === "蕃茄") { it = "番茄"; } return stdInteract(it, "不同市場" + it + "價格", function(it){ return loadColorBar(veggieCHTbl[it]["filename"], "分市場"); }); }, "不同颱風(的) :name": function(it){ if (it === "蕃茄") { it = "番茄"; } return stdInteract(it, "不同颱風" + it + "價格", function(it){ return loadColorBar(veggieCHTbl[it]["filename"], "分颱風"); }); }, "價格:name": function(it){ d3.selectAll(".interaction").append("h3").attr({ "class": "text-left lily lastprice" }); return stdInteract(it, it + "價格", function(it){ return loadChart( veggieCHTbl[it]["filename"]); }); }, '*text': function(it){ userSay(it); return lilySay("對不起,我目前對於「" + it + "」不知所措"); } }; annyang.addCommands(commands); annyang.setLanguage("zh-TW"); annyang.debug; annyang.start(); }