/******************************************************************************* * スケジュールUIクラス - Schedulex * 20081020 T.Fujita * * method: * public void makeScheduleBox(void) - イベントスケジュールBOX作成 * public void getSchedule(String areaSeq) - イベントスケジュールBOX更新 * * 予約id属性: * scheduleBox : スケジュールBOX * ******************************************************************************/ var jSchedule = Class.create(); jSchedule.prototype = { _jSchedule : null, // thisの静的エイリアス _eventLogos : { '00' : '/images/index/tenki_logo_hokkaido.gif', '01' : '/images/index/tenki_logo_tohoku.gif', '02' : '/images/index/tenki_logo_hokuriku.gif', '03' : '/images/index/tenki_logo_kantou.gif', '04' : '/images/index/tenki_logo_tokyo.gif', '05' : '/images/index/tenki_logo_nagoya.gif', '06' : '/images/index/tenki_logo_kansai.gif', '07' : '/images/index/tenki_logo_cyugoku.gif', '08' : '/images/index/tenki_logo_sikoku.gif', '09' : '' }, _bbsCount : { '-1' : { crowd : 0, friend : 0 }, '00' : { crowd : 0, friend : 0 }, '01' : { crowd : 0, friend : 0 }, '02' : { crowd : 0, friend : 0 }, '03' : { crowd : 0, friend : 0 }, '04' : { crowd : 0, friend : 0 }, '05' : { crowd : 1, friend : 3 }, '06' : { crowd : 0, friend : 0 }, '07' : { crowd : 0, friend : 0 }, '08' : { crowd : 0, friend : 0 }, '09' : { crowd : 0, friend : 0 } }, /** * コンストラクタ */ initialize : function(){ _jSchedule = this; this.makeScheduleBox(); }, /** * public void makeScheduleBox(void) * スケジュールBOX作成 */ makeScheduleBox : function() { // スケジュールBOX書き込み var element = document.createElement('div'); element.id = 'scheduleBox'; element.name = 'scheduleBox'; $('cos_ev').appendChild(element); element = document.createElement('div'); element.id = 'floatScheduleStage'; element.name = 'floatScheduleStage'; // $('map').appendChild(element); element = document.createElement('div'); element.id = 'floatScheduleBox'; element.name = 'floatScheduleBox'; // $('map').appendChild(element); // スケジュールデータ書き込み _jSchedule.getSchedule(-1); }, /** * public void updateScheduleBox(String areaSeq) * スケジュールBOX作成 */ updateScheduleBox : function(areaSeq) { // スケジュールデータ書き込み _jSchedule.getSchedule(areaSeq); }, /** * public void scheduleHandler(Array) * スケジュール読み込みハンドラ */ scheduleHandler : function(res) { // HTML作成 var htmlBuff = ''; var fhtmlBuff = ''; var i = 0; do { htmlBuff += ''; fhtmlBuff += ''; } while (res[++i] != null); // 結果表示 $('scheduleBox').innerHTML = htmlBuff; // $('floatScheduleContext').innerHTML = fhtmlBuff; }, /** * public void getSchedult(String areaSeq = -1); * スケジュールデータ書き込み */ getSchedule : function(areaSeq) { // innerHTML初期化 $('scheduleBox').innerHTML = ''; // $('floatScheduleBox').innerHTML = '
' + '
' + '
合わせ募集/ ' + _jSchedule._bbsCount[areaSeq].crowd + '件 友達募集/ ' + _jSchedule._bbsCount[areaSeq].friend + '件
'; // URI作成 - http://www.youyou.co.jp/(areaSeq/)?jschedule.inc var uri = 'http://www.youyou.co.jp/sche/cosday/' + (areaSeq == -1 ? '' : areaSeq + '/') + 'jschedule.php?callback=_jSchedule.scheduleHandler'; // JSONP取得 var script = document.createElement('script'); script.setAttribute('type', 'text/javascript'); script.setAttribute('charset', 'utf-8'); script.setAttribute('src', uri); document.getElementsByTagName('head')[0].appendChild(script); // 取得失敗 if ($('scheduleBox').innerHTML == '') { $('scheduleBox').innerHTML = '現在開催予定のイベントは御座いません。'; } // フロート表示 if (_jSchedule._eventLogos[areaSeq] != '' && areaSeq != '-1') { // $('floatScheduleStage').style.display = 'block'; // $('floatScheduleBox').style.display = 'block'; } } } /******************************************************************************* * スケジュールUIクラス - Schedulex * 20081022 T.Fujita * * method: * public void makeEventScheduleBox(void) - イベントスケジュールBOX作成 * public void getEventSchedule(String areaSeq) - イベントスケジュールBOX更新 * * 予約id属性: * eventScheduleBox : スケジュールBOX * ******************************************************************************/ var jEventSchedule = Class.create(); jEventSchedule.prototype = { _jEventSchedule : null, // thisの静的エイリアス _areas : { '00' : 'hokaido', '01' : 'tohoku', '02' : 'hokuriku', '03' : 'kantou', '04' : 'kantou/tokyo', '05' : 'tokai', '06' : 'kinki', '07' : 'chugoku', '08' : 'shikoku', '09' : 'kyushu,okinawa' }, /** * コンストラクタ */ initialize : function(){ _jEventSchedule = this; this.makeScheduleBox(); }, /** * public void makeScheduleBox(void) * スケジュールBOX作成 */ makeScheduleBox : function() { // スケジュールBOX書き込み var element = document.createElement('div'); element.id = 'eventScheduleBox'; element.name = 'eventScheduleBox'; $('you_ev').appendChild(element); // スケジュールデータ書き込み _jEventSchedule.getSchedule(-1); }, /** * public void updateScheduleBox(String areaSeq) * スケジュールBOX作成 */ updateScheduleBox : function(areaSeq) { // スケジュールデータ書き込み _jEventSchedule.getSchedule(areaSeq); }, /** * public void scheduleHandler(Array) * スケジュール読み込みハンドラ */ scheduleHandler : function(res) { // HTML作成 var htmlBuff = ''; var i = 0; var month = -1; var currentDate = new Date(); do { var date = new Date(res[i].date); var limitDate = new Date(res[i].limitDate); // 日付生成 var yy = (date.getYear() < 2000 ? date.getYear() + 1900 : date.getYear()); var mm = date.getMonth(); var dd = date.getDate(); if (month != mm) { month = mm; if (htmlBuff != '') { htmlBuff += '

'; } htmlBuff += '

' + yy + '年' + (mm + 1) + '月開催イベント
'; } if ((yy -= 2000) < 10) { yy = '0' + yy; } if ((mm += 1) < 10) { mm = '0' + mm; } if (dd < 10) { dd = '0' + dd; } htmlBuff += '

' + yy + '年' + mm + '月' + dd + '日(' + res[i].day + ') ' + res[i].title; if (res[i].genre) { htmlBuff += '(' + res[i].genre + ')'; } htmlBuff += ''; } while (res[++i] != null); // 結果表示 $('eventScheduleBox').innerHTML = htmlBuff; }, /** * public void getSchedult(String areaSeq = -1); * スケジュールデータ書き込み */ getSchedule : function(areaSeq) { // innerHTML初期化 $('eventScheduleBox').innerHTML = ''; // URI作成 - http://www.youyou.co.jp/(areaSeq/)?jschedule.inc var uri = 'http://www.youyou.co.jp/sche/new.php?callback=_jEventSchedule.scheduleHandler&area=' + (areaSeq == -1 ? '' : _jEventSchedule._areas[areaSeq]); // JSONP取得 var script = document.createElement('script'); script.setAttribute('type', 'text/javascript'); script.setAttribute('charset', 'utf-8'); script.setAttribute('src', uri); document.getElementsByTagName('head')[0].appendChild(script); // 取得失敗 if ($('eventScheduleBox').innerHTML == '') { $('eventScheduleBox').innerHTML = '現在開催予定のイベントは御座いません。'; } } }