1document.addEventListener( 'DOMContentLoaded', function () { 2 3 // # è²·ãåãCookie ä¿åç¨ 4 // 5 // ç¹å®ååãã«ã¼ãã«å ¥ããéãCookieã«é¢é£ååIDãä¿åãã¦ã 6 // è³¼å ¥ãã¼ã¸ã§ãããã表示ããæºåã®ããã®ã©ã¤ãã©ãª 7 8 'use strict'; 9 10 var ONE_SECOND = 1000; 11 var ONE_MINUTE = 60 * ONE_SECOND; 12 var HALF_HOUR = 30 * ONE_MINUTE; 13 var ATTR_IDS_MAX_LENGTH = 3; // ã«ã³ãåºåãã§ç»é²ã§ããrelated-item-idsã®ä¸éæ° 14 var ATTR_IDS = 'data-s5-storeInfo-related-item-ids'; 15 var ATTR_URL = 'data-s5-storeInfo-related-currenturl'; 16 var ATTR_TITLE = 'data-s5-storeInfo-related-currenttitle'; 17 18 var $body = document.body; 19 20 $body.addEventListener( 'click', function ( event ) { 21 22 var selector = '[' + ATTR_IDS + ']'; 23 var delegateTarget = closest( event.target, selector ); 24 25 if ( !! delegateTarget ) { 26 27 var pg_id = delegateTarget.getAttribute( ATTR_IDS ).replace( /\s/g, '' ).split( ',' ); 28 var url = delegateTarget.getAttribute( ATTR_URL ); 29 var title = delegateTarget.getAttribute( ATTR_TITLE ); 30 31 // pg_idã®æå®ã空ã®å ´åãcookieã¯ä½ããªãã 32 if ( ! pg_id[ 0 ] ) return; 33 34 if ( pg_id.length >= ATTR_IDS_MAX_LENGTH ) pg_id.length = ATTR_IDS_MAX_LENGTH; 35 36 var cookieValue = { 37 pg_id: pg_id, 38 url : url, 39 title: title 40 }; 41 42 var now = Date.now(); 43 var expirationDate = new Date( now + HALF_HOUR ); 44 45 var sKey = 'frp', 46 sValue = JSON.stringify( cookieValue ), 47 vEnd = expirationDate.toGMTString(), 48 sPath = '/', 49 sDomain = '.sony.jp', 50 bSecure = location.protocol === 'https:'; 51 52 s5.docCookies.setItem( sKey, sValue, vEnd, sPath, sDomain, bSecure ); 53 54 } 55 56 } ); 57 58 function closest ( element, selector ) { 59 60 var DOCUMENT_NODE_TYPE = 9; 61 62 while ( element && element.nodeType !== DOCUMENT_NODE_TYPE ) { 63 64 if ( elementMatches( element, selector ) ) { 65 66 return element; 67 68 } 69 70 element = element.parentNode; 71 72 } 73 74 } 75 76 function elementMatches ( element, selector ) { 77 78 if ( !! Element.prototype.matches ) { 79 80 return element.matches( selector ); 81 82 } 83 84 if ( !! Element.prototype.msMatchesSelector ) { 85 86 return element.msMatchesSelector( selector ); 87 88 } 89 90 if ( !! Element.prototype.webkitMatchesSelector ) { 91 92 return element.webkitMatchesSelector( selector ); 93 94 } 95 96 } 97 98} );
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.