1var _____WB$wombat$assign$function_____=function(name){return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name))||self[name];};if(!self.__WB_pmw){self.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{ 2let window = _____WB$wombat$assign$function_____("window"); 3let self = _____WB$wombat$assign$function_____("self"); 4let document = _____WB$wombat$assign$function_____("document"); 5let location = _____WB$wombat$assign$function_____("location"); 6let top = _____WB$wombat$assign$function_____("top"); 7let parent = _____WB$wombat$assign$function_____("parent"); 8let frames = _____WB$wombat$assign$function_____("frames"); 9let opens = _____WB$wombat$assign$function_____("opens"); 10var historyModule = (function ($) { 11 12 var EXPIRES = 365; 13 var EXPIRES_ITEM = 30; 14 var saveMax = 40; 15 var saveMax_ck = 24; 16 17 /** ******** æè¿ãã§ãã¯ããã¢ã¤ãã ï¼éå§ï¼ ********* */ 18 var OLD_ITEM_KEY = 'itemhis'; 19 var ITEM_KEY = 'itemhis_2'; 20 var itemurl = '/item/#bic#?via=itemshis'; 21 var itemurlWithBrand = '/brand/#brurl#/item/#bic#?via=itemshis'; 22 23 /* 24 items = [ 25 {"bic":åºæ¬ã¢ã¤ãã ã³ã¼ã, "iu":ç»åURL, "bn":ãã©ã³ãURLå, "e":æå¹æé},.. 26 ] 27 28 ãã¹ãã«ã¤ãã¦ã¯ä»¥ä¸ãåç § 29 /test/his-test.html 30 */ 31 32 function clearItem() { 33 if (Modernizr.localstorage) { 34 clearItemByLs(); 35 } else { 36 clearItemByCk(); 37 } 38 } 39 40 function clearItemByCk() { 41 $.removeCookie(ITEM_KEY, { 42 path: '/' 43 }); 44 $.removeCookie(OLD_ITEM_KEY, { 45 path: '/' 46 }); 47 } 48 49 function clearItemByLs() { 50 localStorage.removeItem(ITEM_KEY); 51 localStorage.removeItem(OLD_ITEM_KEY); 52 } 53 54 function addItem(bic, imageUrl, brurl) { 55 _addItem(bic, imageUrl, brurl, Modernizr.localstorage); 56 } 57 58 function addItemByCk(bic, imageUrl, brurl) { 59 _addItem(bic, imageUrl, brurl, false); 60 } 61 62 function addItemByLs(bic, imageUrl, brurl) { 63 _addItem(bic, imageUrl, brurl, true); 64 } 65 66 function _addItem(bic, imageUrl, brurl, isLs) { 67 if (bic.length !== 12) { 68 return; 69 } 70 71 if (brurl == "" || brurl == null){ 72 return; 73 } 74 75 var additionalItem = { 76 "bic": bic, "iu": imageUrl, "bn": brurl, "e": _getExpiryTime() 77 }; 78 79 var items = _getItemDate(isLs); 80 if (items == null) { 81 items = []; 82 } 83 84 // éè¤ãããã°åé¤ 85 var index = -1; 86 for (var i in items) { 87 if (items[i].bic == bic) { 88 index = i; 89 break; 90 } 91 } 92 if (index > -1) { 93 items.splice(index, 1); 94 } 95 96 items.unshift(additionalItem); 97 98 while (items.length > _getSaveMax(isLs)) { 99 items.pop(); 100 } 101 102 _saveItemDate(items, isLs); 103 } 104 105 function showItem(selector, showMax) { 106 return _showItem(selector, showMax, Modernizr.localstorage); 107 } 108 109 function showItemByCk(selector, showMax) { 110 return _showItem(selector, showMax, false); 111 } 112 113 function showItemByLs(selector, showMax) { 114 return _showItem(selector, showMax, true); 115 } 116 117 function _showItem(selector, showMax, isLs) { 118 var jObj = $(selector); 119 120 var items = _getItemDate(isLs); 121 if (items == null || items.length == 0) { 122 jObj.slideUp(); 123 return; 124 } 125 126 var _showMax = showMax; 127 if (showMax == null) { 128 _showMax = 27; 129 } else if (showMax > _getSaveMax(isLs)) { 130 _showMax = saveMax; 131 } 132 133 var sb = []; 134 $.each(items, function (idx, item) { 135 if (idx >= showMax) { 136 return; 137 } 138 sb.push(outputItem(item)); 139 }); 140 141 if (sb.length > 0) { 142 jObj.html(sb.join('\n')).show(); 143 } 144 145 return sb.length; 146 } 147 148 var outputItem = function (item) { 149 var bic = item.bic; 150 var imageUrl = item.iu; 151 var brandUrlName = item.bn; 152 153 imageUrl = imageUrl.replace('_pz_', '_pr_'); 154 155 var itemLink = ''; 156 if (brandUrlName == null || brandUrlName.length == 0) { 157 itemLink = itemurl.replace(/#bic#/g, bic); 158 } else { 159 itemLink = itemurlWithBrand.replace(/#bic#/g, bic).replace(/#brurl#/g, brandUrlName); 160 } 161 162 return '<li><a href="' 163 + itemLink 164 + '"><img data-original="' 165 + imageUrl 166 + '" src="' 167 + imageUrl 168 + '" alt="ååç»å" style="visibility: visible;" class="lazy"/></a></li>'; 169 }; 170 171 function _getItemDate(isLs) { 172 var data = null; 173 var wrapItm = []; 174 175 if (isLs) { 176 data = localStorage.getItem(ITEM_KEY); 177 } 178 179 //Lsã®è¦ç´ (bn)ã空ã®å ´åããã®ãªãã¸ã§ã¯ãèªä½ã空ã«ããã 180 if (isLs && localStorage.getItem(ITEM_KEY)) { 181 wrapItm = JSON.parse(data); 182 for ( var i = 0 ; i < wrapItm.length ; i++ ) { 183 if (JSON.stringify(wrapItm[i]) != JSON.stringify(null) ) { 184 if (JSON.stringify(wrapItm[i].bn) == JSON.stringify("")) { 185 wrapItm[i] = ""; 186 } 187 } 188 } 189 data = JSON.stringify(wrapItm); 190 localStorage.setItem(ITEM_KEY , data ); 191 } 192 193 194 if (data == null) { 195 data = $.cookie(ITEM_KEY); 196 197 /* localstrageã使ãããªããã¡ãã«ç§»ã */ 198 if (data != null && isLs) { 199 $.removeCookie(ITEM_KEY, { 200 path: '/' 201 }); 202 localStorage.setItem(ITEM_KEY, data); 203 } 204 } 205 206 if (data == null) { 207 return _migrate(isLs); 208 } 209 210 var currentTime = core._getCurrentDate().getTime(); 211 var items = JSON.parse(data); 212 var filteredItems = []; 213 for (var idx in items) { 214 var item = items[idx]; 215 if (item.e > currentTime) { 216 filteredItems.push(item); 217 } 218 } 219 220 if (filteredItems.length != items.length) { 221 _saveItemDate(filteredItems, isLs) 222 } 223 224 return filteredItems; 225 } 226 227 function _saveItemDate(items, isLs) { 228 if (items == null) { 229 return; 230 } 231 232 var itemsStr = JSON.stringify(items); 233 if (isLs) { 234 localStorage.setItem(ITEM_KEY, itemsStr); 235 } else { 236 var ck = $.cookie(ITEM_KEY); 237 $.cookie(ITEM_KEY, itemsStr, { 238 path: '/', 239 expires: EXPIRES 240 }); 241 } 242 } 243 244 function _getExpiryTime() { 245 var date = core._getCurrentDate(); 246 date.setDate(date.getDate() + EXPIRES_ITEM); 247 return date.getTime(); 248 } 249 250 function _getSaveMax(isLs) { 251 return isLs ? saveMax : saveMax_ck; 252 } 253
254 // æå¹æé90æ¥ãè¨å®ãããã®ã§ããã®ã¢ã¸ã¥ã¼ã«ããªãªã¼ã¹ããã¦90æ¥å¾ããã®é¢æ°ã¯æ¶ãã¦ãã 255 function _migrate(isLs) { 256 var oldData = null; 257 if (isLs) { 258 oldData = localStorage.getItem(OLD_ITEM_KEY); 259 } else { 260 oldData = $.cookie(OLD_ITEM_KEY); 261 } 262 263 if (oldData == null) { 264 return null; 265 } 266 267 if (isLs) { 268 localStorage.removeItem(OLD_ITEM_KEY); 269 } else { 270 $.removeCookie(OLD_ITEM_KEY, { 271 path: '/' 272 }); 273 } 274 275 var items = []; 276 $.each(oldData.split(','), function (idx, item) { 277 item = '' + item; 278 items.push(_outputItemByOldData(item)); 279 }); 280 281 _saveItemDate(items, isLs); 282 283 return items; 284 } 285 286 var _outputItemByOldData = function (item) { 287 item = item.replace(' ', ''); 288 var bic = item.substring(0, 12); 289 var imageBrandUrl = item.substring(12).split(";"); 290 var imageUrl = imageBrandUrl[0]; 291 var brandUrlName = imageBrandUrl[1]; 292 return { "bic": bic, "iu": imageUrl, "bn": brandUrlName, "e": _getExpiryTime() }; 293 }; 294 295 var core = { 296 _getCurrentDate: function () { 297 return new Date(); 298 } 299 }; 300 301 /** ******** æè¿ãã§ãã¯ããã¢ã¤ãã ï¼çµäºï¼ ********* */ 302 303 /** ******** æè¿ãã§ãã¯ããã³ã¼ãã£ãã¼ãï¼éå§ï¼ ********* */ 304 var COORDINATE_KEY = 'coordinatehis'; 305 var coordinateurl = '/coord/#coid#'; 306 307 function clearCoordinate() { 308 if (Modernizr.localstorage) { 309 localStorage.removeItem(COORDINATE_KEY); 310 } else { 311 $.removeCookie(COORDINATE_KEY, { 312 path: '/' 313 }); 314 } 315 } 316 317 function addCoordinate(coid, imageUrl) { 318 if (coid.length === 10) { 319 if (Modernizr.localstorage) { 320 var ls = localStorage.getItem(COORDINATE_KEY); 321 if (ls == null) { 322 /* cookieã«å¤ãããã°åå¾ããlocalstorageã«ä¿åããªããã */ 323 var ck = $.cookie(COORDINATE_KEY); 324 if (ck != null) { 325 ls = ck; 326 $.removeCookie(COORDINATE_KEY, { 327 path: '/' 328 }); 329 } 330 } 331 localStorage.setItem(COORDINATE_KEY, makeCoordinate(ls, coid, imageUrl)); 332 } else { 333 var ck = $.cookie(COORDINATE_KEY); 334 $.cookie(COORDINATE_KEY, makeCoordinate(ck, coid, imageUrl), { 335 path: '/', 336 expires: EXPIRES 337 }); 338 } 339 } 340 } 341 342 function showCoordinate(selector, showMax) { 343 if (Modernizr.localstorage) { 344 var ls = localStorage.getItem(COORDINATE_KEY); 345 if (ls == null) { 346 /* cookieã«å¤ãããã°åå¾ããlocalstorageã«ä¿åããªããã */ 347 var ck = $.cookie(COORDINATE_KEY); 348 if (ck != null) { 349 ls = ck; 350 ls = ls.replace(new RegExp(',$'), ''); 351 ls = ls.split(',').slice(0, saveMax).join(','); 352 $.removeCookie(COORDINATE_KEY, { 353 path: '/' 354 }); 355 localStorage.setItem(COORDINATE_KEY, ls); 356 } 357 } 358 return displayCoordinate(ls, $(selector), showMax); 359 } else { 360 var ck = $.cookie(COORDINATE_KEY); 361 return displayCoordinate(ck, $(selector), showMax); 362 } 363 } 364 365 function clearCoordinateByCk() { 366 $.removeCookie(COORDINATE_KEY, { 367 path: '/' 368 }); 369 } 370 371 function addCoordinateByCk(coid, imageUrl) { 372 if (coid.length === 10) { 373 var ck = $.cookie(COORDINATE_KEY); 374 $.cookie(COORDINATE_KEY, makeCoordinate(ck, coid, imageUrl), { 375 path: '/', 376 expires: EXPIRES 377 }); 378 } 379 } 380 381 function showCoordinateByCk(selector, showMax) { 382 var ck = $.cookie(COORDINATE_KEY);
383 return displayCoordinate(ck, $(selector), showMax); 384 } 385 386 function clearCoordinateByLs() { 387 localStorage.removeItem(COORDINATE_KEY); 388 } 389 390 function addCoordinateByLs(coid, imageUrl) { 391 if (coid.length === 10) { 392 var ls = localStorage.getItem(COORDINATE_KEY); 393 if (ls == null) { 394 /* cookieã«å¤ãããã°åå¾ããlocalstorageã«ä¿åããªããã */ 395 var ck = $.cookie(COORDINATE_KEY); 396 if (ck != null) { 397 ls = ck; 398 $.removeCookie(COORDINATE_KEY, { 399 path: '/' 400 }); 401 } 402 } 403 localStorage.setItem(COORDINATE_KEY, makeCoordinate(ls, coid, imageUrl)); 404 } 405 } 406 407 function showCoordinateByLs(selector, showMax) { 408 var ls = localStorage.getItem(COORDINATE_KEY); 409 if (ls == null) { 410 /* cookieã«å¤ãããã°åå¾ããlocalstorageã«ä¿åããªããã */ 411 var ck = $.cookie(COORDINATE_KEY); 412 if (ck != null) { 413 ls = ck; 414 ls = ls.replace(new RegExp(',$'), ''); 415 ls = ls.split(',').slice(0, saveMax).join(','); 416 $.removeCookie(COORDINATE_KEY, { 417 path: '/' 418 }); 419 localStorage.setItem(COORDINATE_KEY, ls); 420 } 421 } 422 return displayCoordinate(ls, $(selector), showMax); 423 } 424 425 var makeCoordinate = function (value, coid, imageUrl) { 426 if (value == null) { 427 value = coid + imageUrl; 428 } else { 429 /* æ¢ã«å±¥æ´ã«åå¨ããã³ã¼ãã£ãã¼ãã§ããã°ãå é ã«ä¸¦ã³æ¿ãã */ 430 value = value.replace(new RegExp(coid + imageUrl + ',?', 'g'), ''); 431 value = coid + imageUrl + ',' + value; 432 } 433 value = String(value); 434 value = value.replace(new RegExp(',$'), ''); 435 value = value.split(',').slice(0, saveMax).join(','); 436 return value; 437 } 438 439 var displayCoordinate = function (value, jObj, showMax) { 440 if (value == null || value.length == 0) { 441 jObj.slideUp(); 442 return; 443 } 444 445 var _showMax = showMax; 446 if (showMax == null) { 447 _showMax = 27; 448 } else if (showMax > saveMax) { 449 _showMax = saveMax; 450 } 451 452 var ca = []; 453 $.each(value.split(',').slice(0, _showMax), function (idx, coord) { 454 coord = '' + coord; 455 ca.push(outputCoordinate(coord)); 456 }); 457 458 if (ca.length > 0) { 459 jObj.html(ca.join('\n')).show(); 460 } 461 return ca.length; 462 }; 463 464 var outputCoordinate = function (coord) { 465 coord = coord.replace(' ', ''); 466 var coid = coord.substring(0, 10); 467 var imageUrl = coord.substring(10); 468 var coordinateLink = coordinateurl; 469 470 imageUrl = imageUrl.replace('.jpg', '_m.jpg'); 471 coordinateLink = coordinateLink.replace(/#coid#/g, coid); 472 473 return '<li><a href="' 474 + coordinateLink 475 + '"><img data-original="' 476 + imageUrl 477 + '" src="' 478 + imageUrl 479 + '" alt="ã³ã¼ãã£ãã¼ãç»å" style="visibility: visible;" class="lazy"/></a></li>'; 480 }; 481 482 /** ******** æè¿ãã§ãã¯ããã³ã¼ãã£ãã¼ãï¼çµäºï¼ ********* */ 483 484 return { 485 clearItem: clearItem, 486 addItem: addItem, 487 showItem: showItem, 488 clearItemByCk: clearItemByCk, 489 addItemByCk: addItemByCk, 490 showItemByCk: showItemByCk, 491 clearItemByLs: clearItemByLs, 492 addItemByLs: addItemByLs, 493 showItemByLs: showItemByLs, 494 495 clearCoordinate: clearCoordinate, 496 addCoordinate: addCoordinate, 497 showCoordinate: showCoordinate, 498 clearCoordinateByCk: clearCoordinateByCk, 499 addCoordinateByCk: addCoordinateByCk, 500 showCoordinateByCk: showCoordinateByCk, 501 clearCoordinateByLs: clearCoordinateByLs, 502 addCoordinateByLs: addCoordinateByLs, 503 showCoordinateByLs: showCoordinateByLs, 504 505 core: core 506 } 507 508})(jQuery); 509 510var favModule = (function ($) { 511 /** ******** ãæ°ã«å ¥ãç»é² ********* */ 512 function addFavoriteItem(ssc, actk, callback, opt) { 513 514 var data = { 515 "fid": ssc, 516 "fdv": "01" 517 }; 518 519 if (opt) { 520 data = _.extend(data, opt); 521 } 522 523 $.ajax({ 524 url: "/member/api/favorite-item?op=favorite", 525 data: data, 526 type: "POST", 527 dataType: "json", 528 cache: false 529 }).then( 530 function (data) { 531 refleshFavListFromStorage(function(){ 532 callback(data); 533 }); 534 } 535 ) 536 } 537 538 /** ******** ãæ°ã«å ¥ãã¢ã¤ãã è§£é¤ ********* */ 539 function disfavoriteItem(sscs, actk, callback) { 540 541 var data = { 542 "fids": sscs, 543 "fdv": "01" 544 }; 545 546 $.ajax({ 547 url: "/member/api/favorite-item?op=disfavorite", 548 data: data, 549 type: "POST", 550 dataType: "json", 551 cache: false 552 }).then( 553 function (data) { 554 refleshFavListFromStorage(function(){ 555 callback(data); 556 }); 557 } 558 ) 559 } 560 561 /** ******** ãæ°ã«å ¥ãã¢ã¤ãã ç¢ºèª ********* */ 562 function isFavoritedItem(ssc, actk, callback) { 563 564 var data = { 565 "fid": ssc, 566 "fdv": "01" 567 }; 568 569 $.ajax({ 570 url: "/member/api/favorite-item?op=isFavorited", 571 data: data, 572 type: "GET", 573 dataType: "json", 574 cache: false, 575 success: callback 576 }) 577 } 578 579 /** ******** ãæ°ã«å ¥ããã©ã³ãç»é² ********* */ 580 function addFavoriteBrand(bid, actk, callback, opt) { 581 582 var data = { 583 "fid": bid 584 }; 585 586 if (opt) { 587 data = _.extend(data, opt); 588 } 589 590 $.ajax({ 591 url: "/member/api/favorite-brand?op=favorite", 592 data: data, 593 type: "POST", 594 dataType: "json", 595 cache: false, 596 success: callback 597 }) 598 } 599 600 /** ******** ãæ°ã«å ¥ããã©ã³ãè§£é¤ ********* */
601 function disfavoriteBrand(bids, actk, callback) { 602 603 var data = { 604 "fids": bids 605 }; 606 607 $.ajax({ 608 url: "/member/api/favorite-brand?op=disfavorite", 609 data: data, 610 type: "POST", 611 dataType: "json", 612 cache: false, 613 success: callback 614 }) 615 } 616 617 618 619 /** ******** ãæ°ã«å ¥ããã©ã³ãç¢ºèª ********* */ 620 function isFavoritedBrand(bid, actk, callback) { 621 622 var data = { 623 "fid": bid 624 }; 625 626 $.ajax({ 627 url: "/member/api/favorite-brand?op=isFavorited", 628 data: data, 629 type: "GET", 630 dataType: "json", 631 cache: false, 632 success: callback 633 }) 634 } 635 636 /** ******** ãæ°ã«å ¥ãã¢ã¤ãã ä¸è¦§è¡¨ç¤º ********* */ 637 function displayFavoritedItem(start, num, actk, callback, purchase, salesStatus) { 638 639 var data = { 640 "start": start, 641 "num": num, 642 "purchase": purchase, 643 "salesStatus": salesStatus 644 }; 645 646 $.ajax({ 647 url: "/member/api/favorite-item?op=getItem", 648 data: data, 649 type: "GET", 650 dataType: "json", 651 cache: false, 652 success: callback 653 }) 654 } 655 656 /** ******** ãæ°ã«å ¥ããã©ã³ãä¸è¦§è¡¨ç¤º ********* */ 657 function displayFavoritedBrand(actk, callBack) { 658 659 var data = { 660 }; 661 662 $.ajax({ 663 url: "/member/api/favorite-brand?op=getBrand", 664 data: data, 665 type: "GET", 666 dataType: "json", 667 cache: false, 668 success: callBack 669 }) 670 } 671 672 /** ******** ãã¨ã§è²·ãã¢ã¤ãã ç»é² ********* */ 673 function addSavedForLaterItem(ssc, actk, callback, opt) { 674 675 var data = { 676 "fid": ssc 677 }; 678 679 if (opt) { 680 data = _.extend(data, opt); 681 } 682 683 $.ajax({ 684 url: "/member/api/favorite-forlateritem?op=favorite", 685 data: data, 686 type: "POST", 687 dataType: "json", 688 cache: false, 689 success: callback 690 }) 691 } 692 693 /** ******** ãã¨ã§è²·ãã¢ã¤ãã è§£é¤ ********* */ 694 function removeSavedForLaterItem(sscs, actk, callback) { 695 696 var data = { 697 "fids": sscs 698 }; 699 700 $.ajax({ 701 url: "/member/api/favorite-forlateritem?op=disfavorite", 702 traditional: true, 703 data: data, 704 type: "POST", 705 dataType: "json", 706 cache: false, 707 success: callback 708 }) 709 } 710 /** ******** ãã¨ã§è²·ãã¢ã¤ãã ç¢ºèª ********* */ 711 function isSavedForLaterItem(ssc, actk, callback) { 712 713 var data = { 714 "fid": ssc 715 }; 716 717 $.ajax({ 718 url: "/member/api/favorite-forlateritem?op=isFavorited", 719 data: data, 720 type: "GET", 721 dataType: "json", 722 cache: false, 723 success: callback 724 }) 725 } 726 727 /** ******** ãã¨ã§è²·ãã¢ã¤ãã ä¸è¦§è¡¨ç¤º ********* */ 728 function displaySavedForLaterItem(start, num, actk, callback) { 729 730 var data = { 731 "start": start, 732 "num": num 733 }; 734 735 $.ajax({ 736 url: "/member/api/favorite-forlateritem?op=getItem", 737 data: data, 738 type: "GET", 739 dataType: "json", 740 cache: false, 741 success: callback 742 743 }) 744 } 745 746 var onGoingGetFavoritedItemCodes = false; 747 var lastModifiedOnFavoriteItem = null; 748 749 var favListKeyName = 'favorite-item-list'; 750 /** ******** ãæ°ã«å ¥ãç»é²ã¢ã¤ãã ã³ã¼ãåå¾ ********* */ 751 function getFavoritedItemCodes(callbackFunc) { 752 if (onGoingGetFavoritedItemCodes) { 753 setTimeout(function () { 754 getFavoritedItemCodes(callbackFunc); 755 }, 100); 756 return; 757 } 758 759 onGoingGetFavoritedItemCodes = true; 760 761 var favList = getFavListFromStorage(favListKeyName); 762 if (favList) { 763 onGoingGetFavoritedItemCodes = false;
764 callbackFunc(favList); 765 return; 766 } 767 getFavoritedItemCodesFromApi().done(function (result) { 768 saveFavListToStorage(favListKeyName, result.data); 769 onGoingGetFavoritedItemCodes = false; 770 callbackFunc(result.data); 771 }); 772 } 773 774 /** ******** ãæ°ã«å ¥ããã¹ãã¬ã¼ã¸ããåé¤ ********* */ 775 function clearStorage() { 776 if (Modernizr.localstorage) { 777 localStorage.removeItem(favListKeyName); 778 } 779 }; 780 781 /** ******** ããããã¯Private Method ******** */ 782 783 /** toISOString ã® Polyfill */ 784 if (!Date.prototype.toISOString) { 785 (function() { 786 function pad(number) { 787 if (number < 10) { return '0' + number; } 788 return number; 789 } 790 Date.prototype.toISOString = function() { 791 return this.getUTCFullYear() 792 + '-' + pad(this.getUTCMonth() + 1) 793 + '-' + pad(this.getUTCDate()) 794 + 'T' + pad(this.getUTCHours()) 795 + ':' + pad(this.getUTCMinutes()) 796 + ':' + pad(this.getUTCSeconds()) 797 + '.' + (this.getUTCMilliseconds() / 1000).toFixed(3).slice(2, 5) + 'Z'; 798 }; 799 }()); 800 } 801 802 /** ******** APIã§ãæ°ã«å ¥ãç»é²ã¢ã¤ãã ã³ã¼ãä¸è¦§ãåå¾ ********* */ 803 function getFavoritedItemCodesFromApi() { 804 return $.ajax({ 805 url: "/member/api/favorite-item?op=getItemCodeList", 806 type: "GET", 807 dataType: "json", 808 cache: false 809 }); 810 }; 811 812 /** ******** LocalStorageãããæ°ã«å ¥ãä¸è¦§ãåå¾ ********* */ 813 function getFavListFromStorage(keyName) { 814 if (!Modernizr.localstorage) { 815 return null; 816 } 817 var dt = new Date(); 818 var tmp = JSON.parse(localStorage.getItem(keyName)); 819 if (tmp) { 820 // æçµæ´æ°æ¥æããã使æ¥ãå¤ãã£ããç¡å¹ 821 if (lastModifiedOnFavoriteItem && tmp.createdDate && tmp.createdDate < lastModifiedOnFavoriteItem) { 822 localStorage.removeItem(keyName); 823 return null; 824 } 825 // æéåãã¯ç¡å¹ 826 if (tmp.expiredDate < dt.toISOString()) { 827 localStorage.removeItem(keyName); 828 return null; 829 } 830 // 訪åè IDãéãå ´åã«ã¯ç¡å¹ 831 if (tmp.visitorId != visitorId) { 832 localStorage.removeItem(keyName); 833 return null; 834 } 835 return tmp.data || []; 836 } 837 return null; 838 } 839 840 /** ãæ°ã«å ¥ãã¢ã¤ãã ã®ç»é²ç¶æ³ã«å¤åã®ãã£ãæçµæ¥æãè¨å®ãã */ 841 function setLastModifiedOnFavoriteItem(lastModifiedMillis) { 842 lastModifiedOnFavoriteItem = lastModifiedMillis; 843 } 844 845 /** ******** LocalStorageã«ãæ°ã«å ¥ãä¸è¦§ãä¿å ********* */ 846 function saveFavListToStorage(keyName, data) { 847 848 // ãã¼ã«ã«ã¹ãã¬ã¼ã¸ãæå¹ãªãã°set 849 if (Modernizr.localstorage) { 850 var dt = new Date(), now = new Date(); 851 //æå¹æéã®è¨å®(60åã¨ãã¦ãã) 852 //ãµã¼ãã¼ã¨ã©ã¼ã¾ãã¯ãæ°ã«å ¥ãã1ä»¶ããªãå ´åã¯data=nullã«ãªãï¼åºå¥ãã¤ããªãï¼ããã®å ´åã¯1åã¨ããã 853 dt.setMinutes(dt.getMinutes() + (data == null ? 1 : 60)); 854 var saveData = { "data": data, "createdDate": now.toISOString(), "expiredDate": dt.toISOString(), "visitorId": visitorId } 855 localStorage.setItem(keyName, JSON.stringify(saveData)); 856 } 857 } 858 /** ******** LocalStorageã«ãæ°ã«å ¥ãä¸è¦§ãæ´æ° ********* */ 859 function refleshFavListFromStorage(callback) { 860 getFavoritedItemCodesFromApi().done(function (result) { 861 saveFavListToStorage(favListKeyName, result.data); 862 if(callback){ 863 callback(); 864 } 865 }); 866 } 867 868 return { 869 addFavoriteItem: addFavoriteItem, 870 isFavoritedItem: isFavoritedItem, 871 disfavoriteItem: disfavoriteItem, 872 addFavoriteBrand: addFavoriteBrand, 873 disfavoriteBrand: disfavoriteBrand, 874 isFavoritedBrand: isFavoritedBrand, 875 displayFavoritedItem: displayFavoritedItem, 876 displayFavoritedBrand: displayFavoritedBrand, 877 addSavedForLaterItem: addSavedForLaterItem, 878 isSavedForLaterItem: isSavedForLaterItem, 879 removeSavedForLaterItem: removeSavedForLaterItem, 880 displaySavedForLaterItem: displaySavedForLaterItem, 881 getFavoritedItemCodes: getFavoritedItemCodes, 882 setLastModifiedOnFavoriteItem: setLastModifiedOnFavoriteItem, 883 clearStorage: clearStorage 884 } 885})(jQuery); 886}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.