1/** 2 * global.js: ver 1.0.1 3 * éæç¡ææè¨ 4 * JSONä½¿ç¨ 5 * åºåå 容ãç°ãªããããããã¤ã¹å¤å®ãã 6 * 7 * Last Modified - 2022.09.01 8 * æ¥ä»ã®æ¯è¼ã®ä¿®æ£ 9 * 10 * 2nd Phase æ¥æåå¾ 11 * æ¹ä¿®ãã 12 */ 13 14(function (global) { 15 'use strict'; 16 17 var path = location.pathname, 18 device = document.documentElement.getAttribute('data-browse-mode') === 'S' ? 'sp' : 'pc', 19 d = document, 20 root = d.querySelector('#header-nav'), 21 logo = d.querySelector('#header h1 [href]').getAttribute('href'), 22 OLT = 'rOLT', 23 json = '/campaign/global/json/echo.json'; 24 25 var GLOBAL = { 26 result: function (e) { return (e === '' || e === null || e === undefined) ? false : true; }, 27 genre: function (e) { 28 if (e.indexOf(OLT) !== -1) return 'outlet'; 29 return 'sws'; 30 }, 31 path: function (e) { 32 var e = e.split('/'); 33 if (!(e[1] === 'sws')) return false; 34 if (!(e[2] === 'r' || e[2] === 'goods')) return false; 35 return true; 36 }, 37 init: function () { 38 if (!GLOBAL.path(path)) return; 39 if (!GLOBAL.result(root)) return; 40 root.innerHTML = ''; 41 GLOBAL.getJSON(); 42 }, 43 getJSON: function () { 44 var xhr = new XMLHttpRequest(); 45 xhr.open('GET', json, false); 46 //xhr.responseType = 'json'; 47 xhr.onreadystatechange = function () { 48 if (this.readyState === 4) { 49 if (this.status === 200) { 50 var r = xhr.response; 51 if (typeof r === 'string') r = JSON.parse(r); 52 GLOBAL.parse(r); 53 } 54 } 55 } 56 xhr.send(null); 57 }, 58 parse: function (arg) { 59 var genre = GLOBAL.genre(logo); 60 if (!(arg.pages.length > 0)) return; 61 for (var i=0; i<arg.pages.length; i++) { 62 var e = arg.pages[i], 63 start = GLOBAL.startDate(e.startdate), 64 end = GLOBAL.endDate(e.enddate); 65 66 if (!GLOBAL.getTimed(start, end)) continue; 67 if (!(e.genre === 'all' || e.genre === genre)) continue; 68 switch (device) { 69 case 'pc': GLOBAL.PC(e); break; 70 case 'sp': GLOBAL.SP(e); break; 71 } 72 break; 73 } 74 }, 75 PC: function (arg) { 76 root.insertAdjacentHTML('beforeend', '<div class="block-site-aside--outer">'+ 77 '<div class="block-site-aside--inner">' + 78 '<a href="'+arg.link+'">'+ 79 '<img class="lazyload" data-src="'+arg.image.pc+'" alt="'+arg.brand+' '+arg.title+'">'+ 80 '</a>'+ 81 '</div>'+ 82 '</div>'); 83 }, 84 SP: function (arg) { 85 root.insertAdjacentHTML('beforeend', '<figure class="block-site-aside--inner">'+ 86 '<a href="'+arg.link+'">'+ 87 '<img class="lazyload" data-src="'+arg.image.sp+'" alt="'+arg.brand+' '+arg.title+'">'+ 88 '</a>'+ 89 '</figure>'); 90 }, 91 startDate: function (e) { return GLOBAL.result(e) ? e : '20210101000000'; }, 92 endDate: function (e) { return GLOBAL.result(e) ? e : '29991231235959'; }, 93 formatDate: function () { 94 var date = new Date(), array = []; 95 array[0] = date.getFullYear(); 96 array[1] = (date.getMonth() + 1).toString().padStart(2, 0); 97 array[2] = date.getDate().toString().padStart(2, 0); 98 return array.join(''); 99 }, 100 formatTime: function () { 101 var date = new Date(), array = []; 102 array[0] = date.getHours().toString().padStart(2, 0); 103 array[1] = date.getMinutes().toString().padStart(2, 0); 104 array[2] = date.getSeconds().toString().padStart(2, 0); 105 return array.join(''); 106 }, 107 getTimed: function (start, end) { 108 var today = GLOBAL.formatDate() + GLOBAL.formatTime(); 109 return (start <= today && end >= today) ? true : false; 110 } 111 } 112 global.GLOBAL = GLOBAL; 113})((this || 0).self || global); 114//////////////////////////////////////// 115// ãã¡ã¤ã«å å®è¡ 116//////////////////////////////////////// 117GLOBAL.init();
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.