var guidc10dd8fdc61747b8b705f77cfdde5df0 = { "LoadData": [{ "KeyTime": "2020/04/24 11:55:48", "ImgUrl": "https://s.yimg.jp/images/ymstore/bnr/shp/simonly/300_300.png", "PromotionName": "5のつく日がお得 PayPayボーナスライトプレゼント! ワイモバイル SIMご契約特典", "PromotionLink": "https://ymobile-store.yahoo.co.jp/special/simonly/?argument=nDEAcNmW&dmai=756", "PromotionTime": [{ "StartTime": "常時開催", "EndTime": "" }], "PromotionObject": "5のつく日がお得 PayPayボーナスライトプレゼント! ワイモバイル SIMご契約特典", "PromotionPoints": "0", "IsShow": true, "PromotionMaxPoints": "0", "IsAutoCover": true }, { "KeyTime": "2020/04/24 11:55:48", "ImgUrl": "https://s.yimg.jp/images/yjcard/campaign/bnr/20150801/store_300_300.png", "PromotionName": "Yahoo! JAPANカード利用特典【支払い方法限定】", "PromotionLink": "https://card.yahoo.co.jp/service/redirect/shp/pointMod/", "PromotionTime": [{ "StartTime": "2020/04/01 00:00:00", "EndTime": "2020/04/30 23:59:59" }], "PromotionObject": "Yahoo!ショッピングで毎日お得にお買い物できます。", "PromotionPoints": "0", "IsShow": true, "PromotionMaxPoints": "0", "IsAutoCover": true }, { "KeyTime": "2020/04/24 11:55:48", "ImgUrl": "https://s.yimg.jp/images/smartphone/softbank/v1/common/bnr/190911/300x300.png", "PromotionName": "10,000円相当のPayPayボーナスライトプレゼント!", "PromotionLink": "https://yahoo.jp/3N-LLZl", "PromotionTime": [{ "StartTime": "常時開催", "EndTime": "" }], "PromotionObject": "ソフトバンクスマホ契約で10,000円相当のPayPayボーナスライトプレゼント!", "PromotionPoints": "0", "IsShow": true, "PromotionMaxPoints": "0", "IsAutoCover": true }, { "KeyTime": "2020/04/24 11:55:48", "ImgUrl": "https://s.yimg.jp/images/shp_edit/cms/promotion/tieup/cocacola/irohas_labelless/bnr/300_300.jpg", "PromotionName": "コカ・コーラのいろはす購入で10%相当のPayPayボーナスライト付与", "PromotionLink": "https://topics.shopping.yahoo.co.jp/promotion/tieup/cocacola/", "PromotionTime": [{ "StartTime": "常時開催", "EndTime": "" }], "PromotionObject": "コカ・コーラ社のいろはす購入で10%相当のPayPayボーナスライトを付与します。", "PromotionPoints": "0", "IsShow": true, "PromotionMaxPoints": "0", "IsAutoCover": true }, { "KeyTime": "2020/04/24 11:55:48", "ImgUrl": "https://s.yimg.jp/images/shp_edit/cms/campaign/cashless/bnr/001_300_300.gif", "PromotionName": "【参画事業】キャッシュレス・消費者還元事業【指定支払方法での決済額対象】", "PromotionLink": "https://topics.shopping.yahoo.co.jp/promotion/cashless/", "PromotionTime": [{ "StartTime": "2020/04/01 00:00:00", "EndTime": "2020/04/30 23:59:59" }], "PromotionObject": "【参画事業】キャッシュレス・消費者還元事業【指定支払方法での決済額対象】", "PromotionPoints": "5", "IsShow": true, "PromotionMaxPoints": "0", "IsAutoCover": true }, { "KeyTime": "2020/04/24 11:55:48", "ImgUrl": "https://s.yimg.jp/images/shp_edit/points/ym/PayPay/300_300.png", "PromotionName": "Enjoyパック PayPayボーナスライト(+5%)", "PromotionLink": "https://enjoy.yahoo.co.jp/", "PromotionTime": [{ "StartTime": "常時開催", "EndTime": "" }], "PromotionObject": "Enjoyパック PayPayボーナスライト(+5%)", "PromotionPoints": "0", "IsShow": true, "PromotionMaxPoints": "0", "IsAutoCover": true }, { "KeyTime": "2020/04/24 11:55:48", "ImgUrl": "https://s.yimg.jp/images/shp_edit/points/imatokux10/20200330krs/pt04_300_300.gif", "PromotionName": "いまトク!ストアキャンペーン+10%【掲載ストア限定】", "PromotionLink": "https://topics.shopping.yahoo.co.jp/promo/premium_imatoku_store/p_20200423.html", "PromotionTime": [{ "StartTime": "常時開催", "EndTime": "" }], "PromotionObject": "PayPay連携済みのYIDでログインしたうえで、エントリーして購入されたお客様へ10%相当のPayPayボーナスライトを付与。キャンペーンに掲載されたストア限定のキャンペーン。", "PromotionPoints": "11", "IsShow": true, "PromotionMaxPoints": "0", "IsAutoCover": true }, { "KeyTime": "2020/04/24 11:55:48", "ImgUrl": "https://s.yimg.jp/images/shp_edit/points/premium/20190801kea/pt04_300_300.gif", "PromotionName": "Yahoo!プレミアム会員ならいつでも+4%相当戻ってくる!", "PromotionLink": "https://topics.shopping.yahoo.co.jp/campaign/points/premium/", "PromotionTime": [{ "StartTime": "常時開催", "EndTime": "" }], "PromotionObject": "Yahoo!プレミアム会員ならいつでも+4%相当戻ってくる!", "PromotionPoints": "5", "IsShow": true, "PromotionMaxPoints": "0", "IsAutoCover": true }], "UploadDate": [{ "LoadTime": "2020-04-24 11:55:50" }] }; function picObj(keyTime, imgUrl, promotionName, promotionLink, promotionStartTime, promotionEndTime, promotionObject, promotionPoints, isShow, promotionMaxPoints) { this.KeyTime = keyTime; this.ImgUrl = imgUrl; this.PromotionName = promotionName; this.PromotionLink = promotionLink; this.PromotionStartTime = promotionStartTime; this.PromotionEndTime = promotionEndTime; this.PromotionObject = promotionObject; this.PromotionPoints = promotionPoints; this.IsShow = isShow; this.PromotionMaxPoints = promotionMaxPoints; } var a = []; var o = guidc10dd8fdc61747b8b705f77cfdde5df0; o = o.LoadData; for (var i = 0; i < o.length; i++) { var timespans = JSON.parse(JSON.stringify(o[i].PromotionTime)); for (var j = 0; j < timespans.length; j++) { var case1 = new Date(timespans[j].StartTime) == 'Invalid Date'; var case2 = false; if (!case1) { case2 = new Date() > new Date(timespans[j].StartTime) && new Date() < new Date(timespans[j].EndTime); } if ((case1 || case2) && o[i].IsShow) { a.push(new picObj(o[i].KeyTime, o[i].ImgUrl, o[i].PromotionName, o[i].PromotionLink, timespans[j].StartTime, timespans[j].EndTime, o[i].PromotionObject, o[i].PromotionPoints, o[i].IsShow, o[i].PromotionMaxPoints)); break; } } } $("[data-id='c10dd8fd-c617-47b8-b705-f77cfdde5df0'][isbind!=1]").each(function () { var oldTitle = $(this).find('.carousel-indicators li'); if (oldTitle.length > 0) { //bootstrap carousel var _title = oldTitle.clone().removeClass('active'); var oldTemplate = $(this).find('.carousel-inner .item'); var _template = oldTemplate.clone().removeClass('active'); var count = -1; if ($(this).attr('data-count') != undefined) { try { count = parseInt($(this).attr('data-count')); } catch (e) { } } for (var i = 0; i < a.length; i++) { if (!isNaN(count) && count != -1 && i > count - 1) { return; } if (i > 0) { var title = _title.clone(); $(this).find('.carousel-indicators').append(title.attr('data-slide-to', i)); } if (i == 0) { oldTemplate.find('img').attr('src', a[i].ImgUrl); oldTemplate.find('a').attr('href', a[i].PromotionLink).text(a[i].PromotionName); } else { var template = _template.clone(); template.find('img').attr('src', a[i].ImgUrl); template.find('a').attr('href', a[i].PromotionLink).text(a[i].PromotionName); $(this).find('.carousel-inner').append(template); } } $(this).carousel(); } else { //global var cTag = $(this); var ct = cTag.html(); cTag.empty(); var result = ''; var temStr = ''; var key; var count = -1; if ($(this).attr('data-count') != undefined) { try { count = parseInt($(this).attr('data-count')); } catch (e) { } } $.each(a, function (idx, item) { if (!isNaN(count) && count != -1 && idx > count - 1) { return; } temStr = ct; for (key in item) { temStr = temStr.replace(new RegExp('[$]' + key.toString() + '[$]', 'gi'), item[key]); } temStr = temStr.replace(new RegExp('[$]Index[$]', 'gi'), idx + 1); cTag.append(temStr); }); } //over $(this).attr('isbind', 1); })