1(function () { 2'use strict'; 3var ENDPOINT = '/static/fnnews/log'; 4var CONTENT_TYPE = 'application/x-www-form-urlencoded; charset=UTF-8'; 5var DEBUG = /[?&](dev|test|debug)=y/i.test(window.location.search); 6function log() { 7if (!DEBUG) return; 8console.log.apply(console, ['%c[statics]', 'color:#795548;font-weight:bold;'] 9.concat([].slice.call(arguments))); 10} 11var referrer = ''; 12try { 13referrer = document.referrer || ''; 14} catch (e) { 15referrer = ''; 16} 17function enc(s) { 18return encodeURIComponent(s).replace(/%20/g, '+'); 19} 20function serialize(pairs) { 21var out = []; 22for (var i = 0; i < pairs.length; i++) { 23var k = pairs[i][0]; 24var v = pairs[i][1]; 25if (v === undefined) continue; 26if (v === null) v = ''; 27out.push(enc(k) + '=' + enc(String(v))); 28} 29return out.join('&'); 30} 31function send(body) { 32try { 33if (window.fetch) { 34window.fetch(ENDPOINT, { 35method: 'POST', 36headers: { 'Content-Type': CONTENT_TYPE }, 37body: body, 38keepalive: true, 39credentials: 'same-origin' 40})['catch'](function (e) { log('fetch ì¤í¨:', e && e.message); }); 41return 'fetch'; 42} 43} catch (e) { 44log('fetch ìì¸ â sendBeacon:', e && e.message); 45} 46try { 47if (navigator.sendBeacon) { 48var blob = new Blob([body], { type: CONTENT_TYPE }); 49if (navigator.sendBeacon(ENDPOINT, blob)) return 'beacon'; 50log('sendBeacon ê±°ë¶ â XHR'); 51} 52} catch (e) { 53log('sendBeacon ìì¸ â XHR:', e && e.message); 54} 55try { 56var xhr = new XMLHttpRequest(); 57xhr.open('POST', ENDPOINT, true); 58xhr.setRequestHeader('Content-Type', CONTENT_TYPE); 59xhr.send(body); 60return 'xhr'; 61} catch (e) { 62log('XHR ìì¸ â ì ì¡ ì¤í¨:', e && e.message); 63return 'fail'; 64} 65} 66window.LogOnly = function (arcId, title, writerNum, writerName, categoryId, categoryName, 67orginCode, orginName, articleDate, webcode, 68utm_source, utm_medium, utm_campaign, location_url) { 69var body = serialize([ 70['referrer', referrer], 71['article_code', arcId], 72['article_title', title], 73['writer_num', writerNum], 74['writer_name', writerName], 75['cat_id', categoryId], 76['cat_name', categoryName], 77['orgin_code', orginCode], 78['orgin_name', orginName], 79['article_date', articleDate], 80['webcode', webcode], 81['utm_source', utm_source], 82['utm_campaign', utm_campaign], // v2 ìì ì ì§ â medium ë³´ë¤ ì 83['utm_medium', utm_medium], 84['location_url', location_url] 85]); 86var via = send(body); 87log('ì ì¡(' + via + ')', body); 88return via; 89}; 90})();
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.