jQuery(function(){
var ParentId = 'ChirashiplusFlyersListDivH';
jQuery('#'+ParentId).append('
ホームセンター
');
var ThumbSize = jQuery('#'+ParentId).innerWidth() - 4;
var Flyers = [
{
id: 26361666,
code: '6dd397feaf8d923871dc4ee4e8baf902',
expose: '202442429',
title: '【24/4/24~5/6】春の大感謝祭',
client: 'shimachu',
from: '20240424',
now: '20240427',
fromto: '2024年4月24日 ~ 2024年5月6日',
sale: '売出期間:4/24~5/6',
linkurl: '',
thumburl: 'https://cips.chirashiplus.tv/2526/26361666/0/framein-150-210.jpg'
},
{
id: 26271381,
code: 'a285353df346859f69665ba58199ca8c',
expose: '202441329',
title: '【24/4/13~5/13】補助金でお得にリフォーム',
client: 'shimachu',
from: '20240413',
now: '20240427',
fromto: '2024年4月13日 ~ 2024年5月13日',
sale: '売出期間:4/13~5/13',
linkurl: '',
thumburl: 'https://cips.chirashiplus.tv/2526/26271381/0/framein-150-210.jpg'
},
{
id: 26032851,
code: '1550927f6596b529812110b967348067',
expose: '20244101',
title: '【24/4/1~5/6】春のサイクルフェア',
client: 'shimachu',
from: '20240401',
now: '20240427',
fromto: '2024年4月1日 ~ 2024年5月6日',
sale: '売出期間:4/1~5/6',
linkurl: '',
thumburl: 'https://cips.chirashiplus.tv/2526/26032851/0/framein-150-210.jpg'
},
{
id: 26032855,
code: '71ab4bdb1e5cc4231e6460d15149b829',
expose: '20244102_02',
title: '【24/4/1~5/6】春園芸を楽しもう!',
client: 'shimachu',
from: '20240401',
now: '20240427',
fromto: '2024年4月1日 ~ 2024年5月6日',
sale: '売出期間:4/1~5/6',
linkurl: '',
thumburl: 'https://cips.chirashiplus.tv/2526/26032855/0/framein-150-210.jpg'
},
];
//リンククリック時
jQuery(document).on('click', '#' + ParentId + ' a', function(){
var linkurl = jQuery(this).parents('.shopflyer-list-item').attr('linkurl');
var fid = jQuery(this).parents('.shopflyer-list-item').attr('fid');
var code = jQuery(this).parents('.shopflyer-list-item').attr('code');
var client = jQuery(this).parents('.shopflyer-list-item').attr('client');
var clientId = 2526;
var storeId = 86042;
var storeExtId = 'bab5f681ed696c3467b4300e34d27363';
var cmsFqdn = 'cms.mechao.tv';
var flyerUrl = 'https://' + cmsFqdn + '/' + client + '/flyer_redirect?s=' + storeExtId + '&' + 'eid=' + code;
if ( linkurl ) {
window.open(linkurl, '_blank');
} else {
window.open(flyerUrl, '_blank');
}
return false;
});
//サムネイル画像 縦横サイズ設定
function calcThumbParam( img, directive, areasize )
{
var matches = /\{thumb-(all|r|l)\}/.exec( directive );
var expose = 'all';
if ( matches ) {
expose = matches[1];
}
var clip = { w: (expose=='all' ? img.width : img.width/2), h: img.height };
var ratio = (Math.floor(clip.h / clip.w)==0 ? areasize / clip.w : areasize / clip.h);
var ret = {
imgWidth: img.width * (expose=='all' ? 1 : 0.5),
imgHeight: img.height,
marginLeft: (expose=='r' ? img.width*(-0.5) : 0)
};
return ret;
}
if (Flyers.length != 0) {
//ULタグを追加する
jQuery('#'+ParentId).append('');
//公開中のチラシ数分 繰り返す
jQuery.each(Flyers, function(){
var flyer = this;
var thumb = jQuery('');
var divId = 'Flyer' + flyer.id;
// セールス期間 or 表示期間
if (flyer.sale != "") {
var flyersale = flyer.sale;
} else {
var flyersale = flyer.fromto;
}
// NEWマーク
if (flyer.from == flyer.now) {
var newmark = '';
} else {
var newmark = "";
}
//チラシブロックを表示する
jQuery('#'+ParentId+" ul.shopflyer-list").append(
jQuery('')
);
//チラシ情報を表示する
thumb.on('load', function(){
var img = thumb.get(0);
var imgView = jQuery('');
var thumbParam = calcThumbParam( img, flyer.expose, imgView.innerWidth() );
jQuery('#'+divId).append( jQuery(imgView)
.append( jQuery(img).css('margin-left',thumbParam.marginLeft) )
//.css( { width: thumbParam.imgWidth, height: thumbParam.imgHeight } )
);
jQuery('#'+divId).append( jQuery('')
.append( jQuery('').append(flyer.title) )
.append( jQuery('')
.append( jQuery(newmark) ).append( flyersale )
)
.append( jQuery('') )
);
})
.attr('src', flyer.thumburl);
});
} else {
jQuery('#'+ParentId).append( jQuery('現在、配信しているチラシはございません。
') );
}
});