(function($){ $(document).ready(function($){ //constructor var cst = new function(){ this.itemCode = location.href.match(/\/fs\/alamode\/([a-z0-9_\-]+)/); if(this.itemCode !== null) this.itemCode = this.itemCode[1]; }; //---------------- event_period_comment ---------------- if(cst.itemCode !== null){ $.ajax({ type:'GET', url:'/item/sale_period_comment/configs/list.json?rand=' + Math.random(), dataType:'json', error:function(jqXHR, textStatus, errorThrown){ console.log(jqXHR, textStatus, errorThrown); }, success:function(response, textStatus, jqXHR){ var nowTimestamp = parseInt(new Date() / 1000); for(var i = 0, l = response.length;i < l;i++){ var eventStartTimestamp = Date.parse(response[i].period.start) / 1000, eventEndTimestamp = Date.parse(response[i].period.end) / 1000; if( nowTimestamp < eventStartTimestamp || nowTimestamp > eventEndTimestamp || $.inArray(cst.itemCode, response[i].itemCode) === -1 ) continue; $('.sellTerms').eq(0).html(response[i].comment); if(response[i].showRegularPrice === '1') $('.useBorder').show(); break; } $('.FS2_itemPrice_area').each(function(){ var eleItemPrice = $('.itemPrice', $(this)), eleUseBorder = $('.useBorder', $(this)); if( !eleItemPrice[0] || !eleUseBorder[0] || eleUseBorder.css('display') === 'none' ) return true; var itemPrice = eleItemPrice.text().match(/[0-9,]+/), basePrice = eleUseBorder.text().match(/[0-9,]+/); if( itemPrice === null || basePrice === null ) return true; itemPrice = parseInt(itemPrice[0].replace(',', '')); basePrice = parseInt(basePrice[0].replace(',', '')); var parseNum = 100 - Math.floor(itemPrice / basePrice * 100); if(parseNum <= 0) return true; $(this).append('\