PageSourceSearch

http://ads.usi32.com/usi32/pc_article_analysis_insert.js

js usi32.com collected 2026-09-30 17:14:06 UTC 12,927 bytes, 386 lines download raw bytes

1jQuery(document).ready(function() {
2    var Lib = {};
3
4// Device
5Lib.Device = {
6  isMobile: function() {
7    return /(?:iPhone|iPad|iPod|Android|Mobile)/.test(navigator.userAgent) === true;
8  }
9};
10
11// Time
12Lib.Time = {
13  now: (new Date()).getTime(),
14  // beginStr, endStr: YYYYMMDD[HH[mm[ss]]]
15  // ex. if (Lib.Time.isInsidePeriod('20190809131200', '20190810000000')) {}
16  isInsidePeriod: function(beginStr, endStr) {
17    var beginNum = beginStr.replace(/[^\d]/g, '');
18    if (beginNum.length < 8) return false;
19    var beginYear = parseInt(beginNum.substr(0, 4), 10);
20    var beginMonth = parseInt(beginNum.substr(4, 2), 10) - 1;
21    var beginDay = parseInt(beginNum.substr(6, 2), 10);
22    var beginHour = parseInt(beginNum.substr(8, 2), 10) || 0;
23    var beginMin = parseInt(beginNum.substr(10, 2), 10) || 0;
24    var beginSec = parseInt(beginNum.substr(12, 2), 10) || 0;
25    var beginDate = (new Date(
26      beginYear,
27      beginMonth,
28      beginDay,
29      beginHour,
30      beginMin,
31      beginSec
32    )).getTime();
33    var endNum = endStr.replace(/[^\d]/g, '');
34    if (endNum.length < 8) return false;
35    var endYear = parseInt(endNum.substr(0, 4), 10);
36    var endMonth = parseInt(endNum.substr(4, 2), 10) - 1;
37    var endDay = parseInt(endNum.substr(6, 2), 10);
38    var endHour = parseInt(endNum.substr(8, 2), 10) || 0;
39    var endMin = parseInt(endNum.substr(10, 2), 10) || 0;
40    var endSec = parseInt(endNum.substr(12, 2), 10) || 0;
41    var endDate = (new Date(
42      endYear,
43      endMonth,
44      endDay,
45      endHour,
46      endMin,
47      endSec
48    )).getTime();
49
50    if (Lib.Time.now < beginDate || endDate < Lib.Time.now) return false;
51    return true;
52  }
53};
54
55Lib.Fif = {
56  uuid: function() {
57    // https://github.com/GoogleChrome/chrome-platform-analytics/blob/master/src/internal/identifier.js
58    let chars = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.split('');
59    for (let i = 0, len = chars.length; i < len; i++) {
60      switch (chars[i]) {
61        case 'x':
62          chars[i] = Math.floor(Math.random() * 16).toString(16);
63          break;
64        case 'y':
65          chars[i] = (Math.floor(Math.random() * 4) + 8).toString(16);
66          break;
67      }
68    }
69    return chars.join('');
70  },
71  write: function(targetClass, content, width, height) {
72    var proc = function() {
73      var elements = document.getElementsByClassName(targetClass);
74      if (elements.length < 1) return;
75      var target = elements[0];
76      var iframe = document.createElement('iframe');
77      iframe.width = width;
78      iframe.height = height;
79      iframe.frameBorder = "0";
80      iframe.scrolling = "no";
81      iframe.marginWidth = 0;
82      iframe.marginHeight = 0;
83      iframe.src = "about:self";
84      target.appendChild(iframe);
85      var doc = iframe.contentWindow.document;
86      doc.open();
87      var d = "";
88      d += '<html><head></head>';
89      d += '<body>';
90      d += content;
91      d += '<script>inDapIF = true;</script>';
92      d += '</body></html>';
93      doc.write(d);
94      doc.close();
95    }
96
97    Lib.attachEventListener(proc);
98  }
99};
100
101Lib.Track = {
102  page: '',
103  generateDomTreeIndex: function(element, text) {
104    var label = text.replace(/"/g, '');
105    var selector = 'a[data-track-label="' + label + '"]';
106    var num = document.querySelectorAll(selector).length;
107    element.setAttribute('data-track-label', label);
108    element.setAttribute('data-track-index', num);
109    return num;
110  },
111  isExternalUrl: function(url) {
112    var match = url.match(/^(?:https?:)\/\/([^\/]+)/);
113    if (match === null || match[1] === document.domain) return false;
114    return true;
115  },
116  begin: function() {
117    var Lib = Lib || {};
118    Lib.Track = Lib.Track || this;
119
120    if (Lib.Track.page === '') return;
121
122    var aElements = document.getElementsByTagName('a');
123    Array.prototype.forEach.call(aElements, function(aElement) {
124      var eventHref = aElement.getAttribute('href') || '';
125      var eventText = (aElement.innerText || aElement.innerHTML || '')
126        .replace(/\r|\n/g, ' ')
127        .replace(/\s+/g, ' ')
128        .trim() + ' (' + eventHref + ')';
129      var eventIndex = Lib.Track.generateDomTreeIndex(aElement, eventText);
130      var eventLabrl = eventText + ' [' + eventIndex + '] ';
131      var eventAction = Lib.Track.page
132                      + (
133                        Lib.Track.isExternalUrl(eventHref)
134                        ? 'External'
135                        : 'Internal'
136                      )
137                      + 'LinkClick';
138      var proc = function(e) {
139        ga('send', 'event', {
140          eventCategory: 'LinkClick',
141          eventAction: eventAction,
142          eventLabel: eventLabrl,
143          transport: 'beacon'
144        });
145      }
146
147      if (aElement.addEventListener) {
148        aElement.addEventListener('click', proc, false);
149      } else if (window.attachEvent) {
150        aElement.attachEvent('onclick', proc);
151      }
152    });
153  },
154  beginAfterLoaded: function(page) {
155    Lib.Track.page = page;
156    var proc = Lib.Track.begin.bind(Lib.Track);
157
158    if (window.addEventListener) {
159      window.addEventListener('load', proc, false);
160    } else if (window.attachEvent) {
161      window.attachEvent('onload', proc);
162    }
163  }
164};
165
166// Policy
167//Lib.Policy = function() {
168//  var instance = null;
169//
170//  Lib.Policy = function() {
171//    if ((this instanceof Lib.Policy) == false) {
172//      throw new Error('Please create instance of Lib.Policy.');
173//    }
174//
175//    return instance;
176//  };
177//
178//  Lib.Policy.prototype = this;
179//  instance = new Lib.Policy();
180//  instance.constructor = Lib.Policy;
181//  instance._isSafe = instance.isSafe();
182//  return instance;
183//};
184//
185//Lib.Policy.prototype.isSafe = function() {
186//  return true;
187//}
188
189// Ads
190Lib.Ads = function(isSafe) {
191  var isSafe = typeof isSafe === 'undefined' ? true : isSafe;
192  if ((this instanceof Lib.Ads) == false) {
193    throw new Error('Please create instance of Lib.Ads.');
194  }
195
196  //var policy = new Lib.Policy();
197  //this._isSafe = (policy._isSafe == true);
198  this._isSafe = true;
199  this._totalRates = 0;
200  this._items = [];
201};
202
203Lib.Ads.prototype.isSafe = function() {
204  return this._isSafe;
205};
206
207Lib.Ads.prototype.add = function(proc, rate, allowSafeOnly) {
208  var allowSafeOnly = typeof allowSafeOnly === 'undefined' ? false : allowSafeOnly;
209  if (this._isSafe == false && allowSafeOnly == true) return;
210  this._totalRates += rate;
211  this._items.push({
212    proc: proc,
213    rate: rate
214  });
215};
216
217Lib.Ads.prototype.run = function() {
218  var proc = null;
219  var limit = 0;
220  var sample = Math.floor(Math.random() * this._totalRates);
221  for (var index in this._items) {
222    var item = this._items[index];
223    limit += item.rate;
224    if (limit <= sample) continue;
225    proc = item.proc;
226    break;
227  }
228  if (proc == null) return;
229  return proc();
230}
231
232// attachEventListener
233Lib.attachEventListener = function(proc) {
234  if (window.addEventListener) {
235    //window.addEventListener('load', proc, false);
236    document.addEventListener('DOMContentLoaded', proc, false);
237  } else if (window.attachEvent) {
238    window.attachEvent('onload', proc);
239  } else {
240    //window.onload = proc;
241  }
242};
243
244
245//Lib.Policy.prototype.isSafe = isSafePage;
246
247
248    let ins_rss_style = document.createElement('style');
249    ins_rss_style.innerText = '\
250    div.article-body-outer div.article-body ul li {\
251        list-style-type: none;\
252        list-style-position: outside;\
253        margin-left: 0px;\
254        font-weight: 100;\
255    }\
256    .blogroll-list { \
257        padding: 8px 0px 8px 0px; \
258        border-top: 0px solid #eee; \
259        font-size: 16px;\
260        line-height: 1.3; \
261        font-size: 17px;\
262        border-left: 5px solid #65318e;\
263        padding: 0 0 0 10px;\
264        margin-bottom: 15px;\
265        font-weight: normal;\
266        margin-left:0px;\
267        text-decoration:none;\
268    }\
269    #out_link a { color:#545454;}';
270    document.querySelector('#more').insertAdjacentElement('afterbegin',ins_rss_style);
271
272    let ins_rss_div = document.createElement('div');
273    ins_rss_div.id = 'out_link_01';
274    ins_rss_div.class = 'out_link';
275    ins_rss_div.style = 'margin-bottom:0px; line-height:1.7;';
276    ins_rss_div.innerHTML = '<p  style="font-weight:bold; font-size:16px; margin-bottom:16px; color:#000000;">最新おすすめ記事</p>\
277    \
278    <div id="modernRSS-135" class="blogroll-channel"></div><br>\
279    ';
280    document.querySelector('#more').insertAdjacentElement('afterbegin',ins_rss_div);
281    let ins_rss_script = document.createElement('script');
282    ins_rss_script.src = '//rss.solty.biz/135.js';
283    document.querySelector('#out_link_01').insertAdjacentElement('afterbegin',ins_rss_script);
284
285    let ins_rss_style_02 = document.createElement('style');
286    ins_rss_style_02.innerText = '\
287        div.article-body-outer div.article-body ul li {\
288            list-style-type: none;\
289            list-style-position: outside;\
290            margin-left: 0px;\
291            font-weight: 100;\
292        }\
293        .blogroll-list { \
294            padding: 8px 0px 8px 0px; \
295            border-top: 0px solid #eee; \
296            font-size: 16px;\
297            line-height: 1.3; \
298            font-size: 17px;\
299            border-left: 5px solid #65318e;\
300            padding: 0 0 0 10px;\
301            margin-bottom: 15px;\
302            font-weight: normal;\
303            margin-left:0px;\
304            text-decoration:none;\
305        }\
306        #out_link a { color:#545454;}';
307    document.querySelector('#more').insertAdjacentElement('beforeend',ins_rss_style_02);
308
309    let ins_rss_div_02 = document.createElement('div');
310    ins_rss_div_02.id = 'out_link_02';
311    ins_rss_div_02.class = 'out_link';
312    ins_rss_div_02.style = 'margin-top: 40px; margin-bottom:0px; line-height:1.7;';
313    ins_rss_div_02.innerHTML = '<p  style="font-weight:bold; font-size:16px; margin-bottom:16px; color:#000000;">おすすめリンク(外部)</p>\
314    \
315    <div id="modernRSS-236" class="blogroll-channel"></div>\
316    ';
317    document.querySelector('#more').insertAdjacentElement('beforeend',ins_rss_div_02);
318    let ins_rss_script_02 = document.createElement('script');
319    ins_rss_script_02.src = '//rss.solty.biz/236.js';
320    document.querySelector('#out_link_02').insertAdjacentElement('afterbegin',ins_rss_script_02);
321
322    // 記事内
323    var article_ad_interval = 0;
324    var article_ad_count = 0;
325    Array.prototype.some.call(
326        document.querySelectorAll('#more div.t_b + br, #more .twitter-tweet'),
327        function(article_ad_element) {
328        article_ad_interval += article_ad_element.classList.contains('twitter-tweet') ? 2 : 1;
329        if(article_ad_count === 0 && article_ad_interval >= 2){
330            article_ad_interval = 0;
331            article_ad_count += 1;
332            // 初回はインターバルが2以上であれば広告を表示
333            createArticleAdsense(article_ad_element, article_ad_count);
334        }
335        if (article_ad_interval < 9) return;
336        article_ad_interval = 0;
337        article_ad_count += 1;
338        createArticleAdsense(article_ad_element, article_ad_count);
339        if (article_ad_count >= 10) return true;
340        }
341    );
342
343    function createArticleAdsense(el,ad_cnt){
344        const adsense_ads = [
345            'div-gpt-ad-1654074124280-0', // pc_kijinai_01
346            'div-gpt-ad-1654074236292-0', // pc_kijinai_02
347            'div-gpt-ad-1654074329380-0', // pc_kijinai_03
348            'div-gpt-ad-1654074421625-0', // pc_kijinai_04
349            'div-gpt-ad-1654074508646-0', // pc_kijinai_05
350            'div-gpt-ad-1654074578017-0', // pc_kijinai_06
351            'div-gpt-ad-1654074648090-0', // pc_kijinai_07
352            'div-gpt-ad-1654074732236-0', // pc_kijinai_08
353            'div-gpt-ad-1654074807118-0', // pc_kijinai_09
354            'div-gpt-ad-1654074880363-0', // pc_kijinai_10
355        ];
356
357        const ad_num = ( '00' + ad_cnt ).slice( -2 );
358        let my_id = 'js-pc-kijinai-' + ad_num;
359        let ins_ad_div = document.createElement('div');
360        ins_ad_div.id = my_id;
361        el.insertAdjacentElement('afterend', ins_ad_div);
362
363        const left_slot_id = adsense_ads[ad_cnt];
364        const ins_left_ad_slot = document.createElement('div');
365        ins_left_ad_slot.id = left_slot_id;
366        ins_ad_div.insertAdjacentElement('beforeend', ins_left_ad_slot);
367        let ins_left_ad_script = document.createElement('script');
368        ins_left_ad_script.type = 'text/javascript';
369        ins_left_ad_script.innerText = '\
370        googletag.cmd.push(function () {\
371        googletag.pubads().disableInitialLoad();\
372        googletag.enableServices();\
373        var lines = [\
374            {\
375            code: "/21692532096/usi32_pc_kijinai_' + ad_num + '",\
376            sizes: [[300, 250],[336, 280]],\
377            divId: "' + left_slot_id + '",\
378            isAps: true\
379            }\
380        ];\
381        window.fluxtag.enableLazyLoad(lines);\
382        });';
383
384        ins_ad_div.insertAdjacentElement('beforeend', ins_left_ad_script);
385    }
386});

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.