<commit_before>Parse.initialize("eXa6XCYsez7lkZpf2ytbtRinq0STc1w9NvJkkf4p", "H4gpX9rYLfaYccdgjxP6OH48bPfK2jHeM8e1dr8Z");

var from = "";
var to = "";
// 出發地點預設值

var now = new Date();
var y = now.getFullYear();
var m = now.getMonth() + 1;
var d = now.getDate();
set_date(y, m, d);
// 時間預設值（當天）

var time_choose = 0;
var type_choose = 0;
var time = "00:00";
time = cal_time(time);
// 客人選擇預設為『出發時間』、『全部類型』

var buy;
var train_date = [];
var train_info = [];
var station = [];
var tr_type = ["太魯閣號", "新自強", "自強", "莒光", "復興", "區間快", "區間車", "電車", "兩鐵", "單機迴送", "客迴", "普快車", "普通貨車", "普通車", "柴客", "柴快車", "柴油車" ,"柴迴", "特種", "臨時客迴", "行包專車", "試轉運", "調車列車"];
var tr_diration = ["去程", "返程", "順行", "逆行" ,"南下", "北上"];
var tr_line = ["不經山海線", "山線", "海線"];
var show_data = [];
var from_id;
var to_id;
get_cost(from,to);
document.getElementById("date").value = date;



var station_api = "http://210.59.250.227:80/MOTC/v1/Rail/TRA/Station?%24format=json";
get_info(station_api, 0);
var train_info_api = "http://172.16.17.32:80/MOTC/v1/Rail/TRA/TrainInfo/" + date + "?%24format=json";
var train_date_api = "http://172.16.17.327:80/MOTC/v1/Rail/TRA/DailyTimetable/" + date + "?%24format=json";
                  
var cost_1;
var cost_2;
var cost_3;

function set_date(y, m, d){
     year = y;
     month = m;
     day = d;
     date = (y + "-" + m + "-" + d);
     data2= (y + "/" + m + "/" + d);
           document.getElementById("date").value = date;

     
} // 取得理想格式的時間

function get_info(url,index){
     var httpRequest;
     if (window.XMLHttpRequest) { // Mozilla, Safari, ...
          httpRequest = new XMLHttpRequest();
     } else if (window.ActiveXObject) { // IE
          httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
     }
     httpRequest.open('GET', url, true);
     httpRequest.send(null);
     httpRequest.onreadystatechange = function() {
          Contents(httpRequest);
     };
     function Contents (httpRequest) {
          if (httpRequest.readyState == 4) {
               if (httpRequest.status == 200) {
                    switch(index){
                         case 0:
                              station = JSON.parse(httpRequest.responseText);
                              get_info(train_date_api, 1);
                              break;
                         case 1:
                              train_date[day] = JSON.parse(httpRequest.responseText);
                              show_data.length = 0;
                              from_id = changeID(from);
                              to_id = changeID(to);
                              
                              
                              get_info(train_info_api, 2);
                              // console.log("from : " + from);
                              // console.log("To : " + to);
                              // console.log("date : " + date);
                              break;
                         case 2:
                              train_info[day] = JSON.parse(httpRequest.responseText);
                              find_train_time(from_id, to_id, train_date[day], train_info[day], type_choose, time_choose);
                              show_data.sort(function(a,b){
                                   return a.order > b.order ? 1 : -1;;
                              });
                              var test3="";
                              var title="<table id=\"t3\"><tr><th></th><th>" + from +" -> " + to +"</th><th>By</th><th>Spend</th><th>Cost</th></tr>";
                              var tail="</table>";
                              for(var n=0;n<show_data.length;n++){
			      buy_ticket(n);
                              test3 = test3 + "<tr><td><input type= checkbox value= Travel " + "id = train_" + n + " name=interest onclick=trainCheck(this) ></td><td>" + show_data[n].Arrival_t +" -> "+show_data[n].departure_t + "</td><td>" + show_data[n].Type + show_data[n].ID + "</td><td>" + show_data[n].during_t +"</td><td>" + show_data[n].cost +"<a href="+buy+">buy</a>"+"</td></tr>";
                              }
                              test3 = title + test3 + tail;
                              
							  if(show_data!="")
							  {	
                              setTimeout(function(){$("#S1").html(test3);},1000);
                              }
                              
                              // console.log(show_data);
                              break;         
                         default:
                              alert ("伺服器處理錯誤");
                              break;
                    }
          }
          }
     }
} // 連API去取得資訊回來

function changeID (id) {
     for (var i = 0; i < station.length; i++)
     {
          if (id == station[i].StationName.Zh_tw)
          {
               return station[i].StationID;
          }<commit_msg>buy ticket v2<commit_after>Parse.initialize("eXa6XCYsez7lkZpf2ytbtRinq0STc1w9NvJkkf4p", "<KEY>");

var from = "";
var to = "";
// 出發地點預設值

var now = new Date();
var y = now.getFullYear();
var m = now.getMonth() + 1;
var d = now.getDate();
set_date(y, m, d);
// 時間預設值（當天）

var time_choose = 0;
var type_choose = 0;
var time = "00:00";
time = cal_time(time);
// 客人選擇預設為『出發時間』、『全部類型』

var buy;
var train_date = [];
var train_info = [];
var station = [];
var tr_type = ["太魯閣號", "新自強", "自強", "莒光", "復興", "區間快", "區間車", "電車", "兩鐵", "單機迴送", "客迴", "普快車", "普通貨車", "普通車", "柴客", "柴快車", "柴油車" ,"柴迴", "特種", "臨時客迴", "行包專車", "試轉運", "調車列車"];
var tr_diration = ["去程", "返程", "順行", "逆行" ,"南下", "北上"];
var tr_line = ["不經山海線", "山線", "海線"];
var show_data = [];
var from_id;
var to_id;
get_cost(from,to);
document.getElementById("date").value = date;



var station_api = "http://172.16.17.32:80/MOTC/v1/Rail/TRA/Station?%24format=json";
get_info(station_api, 0);
var train_info_api = "http://172.16.17.32:80/MOTC/v1/Rail/TRA/TrainInfo/" + date + "?%24format=json";
var train_date_api = "http://172.16.17.32:80/MOTC/v1/Rail/TRA/DailyTimetable/" + date + "?%24format=json";
                  
var cost_1;
var cost_2;
var cost_3;

function set_date(y, m, d){
     year = y;
     month = m;
     day = d;
     date = (y + "-" + m + "-" + d);
     data2= (y + "/" + m + "/" + d);
           document.getElementById("date").value = date;

     
} // 取得理想格式的時間

function get_info(url,index){
     var httpRequest;
     if (window.XMLHttpRequest) { // Mozilla, Safari, ...
          httpRequest = new XMLHttpRequest();
     } else if (window.ActiveXObject) { // IE
          httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
     }
     httpRequest.open('GET', url, true);
     httpRequest.send(null);
     httpRequest.onreadystatechange = function() {
          Contents(httpRequest);
     };
     function Contents (httpRequest) {
          if (httpRequest.readyState == 4) {
               if (httpRequest.status == 200) {
                    switch(index){
                         case 0:
                              station = JSON.parse(httpRequest.responseText);
                              get_info(train_date_api, 1);
                              break;
                         case 1:
                              train_date[day] = JSON.parse(httpRequest.responseText);
                              show_data.length = 0;
                              from_id = changeID(from);
                              to_id = changeID(to);
                              
                              
                              get_info(train_info_api, 2);
                              // console.log("from : " + from);
                              // console.log("To : " + to);
                              // console.log("date : " + date);
                              break;
                         case 2:
                              train_info[day] = JSON.parse(httpRequest.responseText);
                              find_train_time(from_id, to_id, train_date[day], train_info[day], type_choose, time_choose);
                              show_data.sort(function(a,b){
                                   return a.order > b.order ? 1 : -1;;
                              });
                              var test3="";
                              var title="<table id=\"t3\"><tr><th></th><th>" + from +" -> " + to +"</th><th>By</th><th>Spend</th><th>Cost</th></tr>";
                              var tail="</table>";
                              for(var n=0;n<show_data.length;n++){
			      buy_ticket(n);
                              test3 = test3 + "<tr><td><input type= checkbox value= Travel " + "id = train_" + n + " name=interest onclick=trainCheck(this) ></td><td>" + show_data[n].Arrival_t +" -> "+show_data[n].departure_t + "</td><td>" + show_data[n].Type + show_data[n].ID + "</td><td>" + show_data[n].during_t +"</td><td>" + show_data[n].cost +"<a target="+"_blank"+" href="+buy+">buy</a>"+"</td></tr>";
                              }
                              test3 = title + test3 + tail;
                              
							  if(show_data!="")
							  {	
                              setTimeout(function(){$("#S1").html(test3);},1000);
                              }
                              
                              // console.log(show_data);
                              break;         
                         default:
                              alert ("伺服器處理錯誤");
                              break;
                    }
          }
          }
     }
} // 連API去取得資訊回來

function changeID (id) {
     for (var i = 0; i < station.length; i++)
     {
          if (id == station[i].StationName.Zh_tw)
          {
               return station[i].StationID;
          }
{'fraction_non_alphanumeric': 0.1605514096185738, 'fraction_numerical': 0.019382255389718075, 'mean_word_length': 1.421937751004016, 'pattern_counts': {'":': 0, '<': 66, '<?xml version=': 0, '>': 68, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 6, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '444708', 'n_tokens_mistral': 3396, 'n_tokens_neox': 3305, 'n_words': 555}