/******************************************************************************* * スケジュール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 : 0, friend : 0 }, '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 += '

合わせ募集/ '
+ _jSchedule._bbsCount[areaSeq].crowd
+ '件
友達募集/ '
+ _jSchedule._bbsCount[areaSeq].friend
+ '件' + 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 = '現在開催予定のイベントは御座いません。'; } } }