(function($){
$(document).ready(function(){
var
funcNumberFormat = function(number){
return number.toString().replace(/([0-9]+?)(?=(?:[0-9]{3})+$)/g , '$1,');
},
//config
cfg = {
api:{
url:'https://alamode1.xsrv.jp',
shopId:18,
displayKeywords:'【スタッフコーデ】', //表示キーワード
displayKeywordsFlag:1, //キーワードフラグ※0 => 'OR検索', 1 => 'AND検索'
sortItem:'id', //並び順対象項目
sortRows:'1', //昇降順
seasonCodeReflect:'0', //季節コード※0 => '反映しない', 1 => '反映する'
stockFlg:'1', //在庫切れ商品※0 => '表示しない', 1 => '表示する'
limit:30 //上限数
},
staffCoordinateCarousel:{
items:6,
itemsDesktop:[1199, 6],
itemsDesktopSmall:[979, 6],
itemsTablet:[768, 6],
itemsMobile:[479, 6],
autoPlay:3000,
singleItem:false,
navigation:true,
navigationText:[
'',
'
'
],
slideSpeed:500,
paginationSpeed:700
},
detail:{
detailOpacitySpeed:400,
cssMarginDetailArea:30
}
},
//constructor
cst = new function(){
this.getItemCode = location.href.match(/\/fs\/alamode\/([a-z0-9_\-]+)/);
this.itemCode = this.getItemCode !== null?this.getItemCode[1]:'';
this.staffList = new Array();
this.flagGetDetail = true;
},
funcGetStaffCoordinateCarousel = function(){
var
eleStaffCoordinateCarousel = $('#staff_coordinate_carousel'),
eleStaffCoordinateCarouselParent = $('#staff_coordinate_carousel_parent');
$.ajax({
url:cfg.api.url + '/shop/set_item/search/index.php?request=get_list' +
'&shop_id=' + cfg.api.shopId +
'&season_code_reflect=' + cfg.api.seasonCodeReflect +
'&display_keywords=' + encodeURIComponent(cfg.api.displayKeywords) +
'&display_keywords_flag=' + cfg.api.displayKeywordsFlag +
'&item_code=' + encodeURIComponent(cst.itemCode) +
'&sort_item=' + cfg.api.sortItem +
'&sort_rows=' + cfg.api.sortRows +
'&limit=' + cfg.api.limit,
dataType:'jsonp',
error:function(jqXHR, textStatus, errorThrown){
console.log(textStatus);
},
success:function(response, textStatus, jqXHR){
if(response.total === '0')
return false;
for(var i = 0, l = response.set_item.length;i < l;i++){
var
d = response.set_item[i],
id = d.comment.match(/【id:(.+?)】/),
keyId = id === null?'-1':id[1],
comment = d.comment.replace(/\r?\n/g, "").match(/【comment:(.+?)】/),
staffInfo = typeof cst.staffList[keyId] !== 'undefined'?
cst.staffList[keyId]:{
name:'',
size:''
},
dataComment = comment === null?'':comment[1];
eleStaffCoordinateCarousel
.append('\
\ ' + comment + '\
\\ \合わせたアイテムはコレ/\
\