Files
ct-dtv-hx0100-002kwos/procentric/application/lib/hoteltv.ui_utils.js
Joel,Kim 8b0160bfda issue #1
Fix weather icon issue
- using openweather's one

1. Support unread message notification on widjet
2022-04-26 16:43:11 +09:00

187 lines
6.4 KiB
JavaScript
Executable File

/**
* Copyright (c) 2020
*
* CENTIRM HotelTV UI-UTILS module javascript.
*
* @summary short description for the file
* @author Joel <joel.kim@centirm.com>
*
* Created at : 2020-11-26 02:21:56
* Last modified : 2020-11-26 15:31:40
*/
HotelTV.namespace('HotelTV.ui_utils');
HotelTV.ui_utils = (function() {
//// 의존 관계 선언
//// 비공개 프로퍼티
let g_uiTbl_imgPath_Brochure_buttons = {
'ko-KR': "./images/brochure/bt_brochure_ko.png",
'en-US': "./images/brochure/bt_brochure_en.png",
'zh-CN': "./images/brochure/bt_brochure_ch01.png",
'zh-TW': "./images/brochure/bt_brochure_ch02.png",
'ja-JP': "./images/brochure/bt_brochure_jp.png"
};
let g_uiTbl_imgPath_InRoomDining_buttons = {
'ko-KR': "./images/IRD/bt_inroom_ko.png",
'en-US': "./images/IRD/bt_inroom_en.png",
'zh-CN': "./images/IRD/bt_inroom_ch01.png",
'zh-TW': "./images/IRD/bt_inroom_ch02.png",
'ja-JP': "./images/IRD/bt_inroom_jp.png"
};
let g_uiTbl_String = {
// //Words & Sentance for Menu & Contents
// 'guide_flightschedule': {
// 'kr': '화살표를 사용하여 제주국제공항 출발, 도착하는 항공 스케줄을 확인하세요.',
// 'en': 'Use the arrows to check flight schedules arriving and leaving from Jeju International Airport.',
// 'ch': '请用箭头查看济州国际机场出发、到达航班的时刻表。',
// 'tw': '請用箭頭查看濟州國際機場出發、到達航班的時刻表。',
// 'jp': '矢印を使って済州国際空港出発便、到着便の航空スケジュールをご確認ください。'
// },
// //EPG
// 'epg_none': {
// 'kr': "프로그램 정보가 없습니다",
// 'en': "No program information",
// 'ch': "没有节目信息",
// 'tw': "沒有節目信息",
// 'jp': "プログラム情報はありません"
// },
};
var g_uiVar_Clock = {
time: '',
date: ''
};
/// 초기화 루틴
//// 비공개 매써드
/**
* HotelTV UI Wrapper Function::> Show(Build) Busy(loading) animation
* @param {boolean} enable enable/disable
*/
function __uiFxn_MiscZeroPadding(num, digit) {
var zero = '';
for (var i = 0; i < digit; i++) {
zero += '0';
}
return (zero + num).slice(-digit);
}
/**
* HotelTV UI Wrapper Function::> Show(Build) Busy(loading) animation
* @param {boolean} enable enable/disable
*/
function __uifxn_BusyAnimation(enable) {
if (enable) {
//$('#busy_animation').css("background-image", "url('./images/icons/icon_loading_256x256')");
$('.busy-frame').fadeIn(200, function() {
$('.busy-frame #busy_animation').show();
});
} else {
$('.busy-frame #busy_animation').fadeOut(300, function() {
$('.busy-frame').fadeOut(500);
});
}
}
//// 공개 API
return {
SetBusy: function(show) {
__uifxn_BusyAnimation(show);
},
ShowErrMsg: function(_show, _title, _msg) {
if (_show) {
$('.error').css("background-color", "rgb(255,0,0)");
$('.error').fadeIn(500);
} else {
$('.error').fadeOut(500, function() {
$(this).css("background-image", "None");
});
}
},
GetCur_DateTime: function() {
let week = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'];
let cd = new Date();
g_uiVar_Clock.time = __uiFxn_MiscZeroPadding(cd.getHours(), 2) + ':' + __uiFxn_MiscZeroPadding(cd.getMinutes(), 2) + ':' + __uiFxn_MiscZeroPadding(cd.getSeconds(), 2);
g_uiVar_Clock.date = __uiFxn_MiscZeroPadding(cd.getFullYear(), 4) + '-' + __uiFxn_MiscZeroPadding(cd.getMonth() + 1, 2) + '-' + __uiFxn_MiscZeroPadding(cd.getDate(), 2) + ' ' + week[cd.getDay()];
return g_uiVar_Clock;
},
Get_String: function(_key, _lang) {
return g_uiTbl_String[_key][_lang];
},
Brochure_GetBtn: function(_lang) {
return g_uiTbl_imgPath_Brochure_buttons[_lang];
},
IRD_GetBtn: function(_lang) {
return g_uiTbl_imgPath_InRoomDining_buttons[_lang];
},
Get_Airline: function(_obj, _airline, _lang) {
if (_obj) {
if (_obj[_airline]) {
return _obj[_airline][_lang] || _airline;
}
}
return _airline;
},
Get_Airport: function(_obj, _airport, _lang) {
if (_obj) {
if (_obj[_airport]) {
return _obj[_airport][_lang] || _airport;
}
}
return _airport;
},
Get_FlightStatus: function(_obj, _status, _lang) {
if (_obj && _obj.hasOwnProperty(_status) == true) {
if (_status && _status != "") {
return _obj[_status][_lang] || _status;
}
}
return _status;
},
Weather_GetWindReport: function(_str, _speed, _direction, _lang) {
let _cvt_speed = parseFloat((_speed * 1000 / 3600)).toFixed(2);
let _szDir = null;
if (_direction >= 345 && _direction < 22) {
_szDir = _str[4][_lang];
} else if (_direction >= 23 && _direction < 68) {
_szDir = _str[14][_lang];
} else if (_direction >= 69 && _direction < 114) {
_szDir = _str[1][_lang];
} else if (_direction >= 115 && _direction < 160) {
_szDir = _str[13][_lang];
} else if (_direction >= 161 && _direction < 206) {
_szDir = _str[3][_lang];
} else if (_direction >= 207 && _direction < 252) {
_szDir = _str[12][_lang];
} else if (_direction >= 253 && _direction < 298) {
_szDir = _str[2][_lang];
} else {
_szDir = _str[15][_lang];
}
return _cvt_speed.toString() + " " + _szDir;
},
}
})();