j$(document).ready(function(){ //Ex. /news/gatop_news.php?lang=xx&cc=YY xml_uri = news; j$('.sec-top__info').hide(); if(infmntflg == 1){ j$.ajax({ url:xml_uri, type:'GET', dataType:'script', timeout:20000, success:parse_xml, error:parse_error }); } else { j$('.sec-top__info').hide(); } var xmlcount =0; var xmlsum; function parse_xml(xml,status){ if(window.ActiveXObject){ xml3 = new ActiveXObject('Microsoft.XMLDOM'); xml3.async = 'false'; xml3.loadXML(xml2); }else{ parser = new DOMParser(); xml3 = parser.parseFromString(xml2, 'text/xml'); } // if(status!='success') { // return; // } else { if (j$(xml3).find('news')) { j$(xml3).find('news').each(urlListUp); } // } } function parse_error(XMLHttpRequest, textStatus, errorThrown){ } function urlListUp() { xmlsum = j$(xml3).find('news').size(); if(xmlsum < 1){ j$('.sec-top__info').hide(); } if (xmlcount < 1) { j$('.sec-top__info').show(); } var lang =j$('html').attr('lang'); var body = j$(this).find('title').text(); /** if(lang=='ja'||lang=='zh'||lang=='ko'){ if (body.length > 45) { body = body.substr(0, 45) + '...'; } }else{ if (body.length > 90) { body = body.substr(0, 90) + '...'; } } **/ var linkurl = String(j$(this).find('url').text()); var link = j$(''); link.attr('href', linkurl); link.text(body); var span_body = j$(''); span_body.append(link); var date = j$(this).find('date').text(); var span_date = j$(''); span_date.append(date); if(j$('.sec-top__info').find('.sec-top__info__date').get(0)) { j$('.sec-top__info').append(j$('
')); } j$('.sec-top__info').append(span_date); j$('.sec-top__info').append(span_body); xmlcount++; } }); /** var timer = false; j$(window).resize(function() { if (timer !== false) { clearTimeout(timer); } timer = setTimeout(function() { // 画面サイズ判定&文字サイズ変更 var w = j$(window).width(); var min = 700; var max_ja = 1257; if (w <= min) { // 文字サイズ変更なし return; } if (w < max_ja) { // 文字サイズ変更 return; } }, 200); }); **/