PageSourceSearch

https://benesse.jp/_shared/js/utility.js

js benesse.jp collected 2026-09-24 08:52:39 UTC 32,316 bytes, 974 lines download raw bytes

1(function ($) {
2
3  'use strict';
4
5  $().ready(function () {
6
7    var thisPathName = location.pathname;
8    var $device;
9    var $categoryArr = ['kosodate', 'kyouiku', 'juken', 'eigo'];
10    var $category;
11    var subCategoryArr = [
12      [
13        '育児・子育て',
14        '病気',
15        '離乳食・レシピ',
16        '習い事',
17        'トイレトレーニング',
18        '幼稚園・保育園',
19        '入学準備',
20        '遊び・ゲーム',
21        '特集'
22      ], [
23        '入試改革',
24        '教育動向',
25        'テスト対策',
26        '学習',
27        '教育費',
28        '自由研究',
29        '読書感想文',
30        '語学',
31        '部活',
32        '特集'
33      ], [
34        '中学受験',
35        '高校受験',
36        '中高一貫校',
37        '大学受験',
38        '進路・職業',
39        '特集'
40      ], [
41        '4技能',
42        '勉強法'
43      ]
44    ];
45
46    var $width = $(window).width();
47    if ($width < 740) {
48      $device = 'SP';
49    } else {
50      $device = 'PC';
51    }
52
53    if (location.href.match(/kosodate/)) {
54      $category = "kosodate";
55    } else if (location.href.match(/kyouiku/)) {
56      $category = "kyouiku";
57    } else if (location.href.match(/juken/)) {
58      $category = "juken";
59    } else if (location.href.match(/eigo/)) {
60      $category = "eigo";
61    } else {
62      $category = "all";
63    }
64    var thisCategoryIndex = $categoryArr.indexOf($category);
65
66    var iregularPathArr = [
67      [
68        '/contents/toilet_training/index.shtml',
69        '/special/kosodate/'
70      ], [
71        '/special/kyouiku/'
72      ], [
73        '/special/juken/'
74      ], [
75        '/special/eigo/'
76      ]
77    ];
78    for (var i = 0, len = iregularPathArr.length; i < len; i++) {
79      var thisArr = iregularPathArr[i];
80      for (var b = 0, lenB = thisArr.length; b < lenB; b++) {
81        if (location.href.indexOf(thisArr[b]) > -1) {
82          thisCategoryIndex = i;
83          break;
84        }
85      }
86    }
87
88    var isSiteTop = false;
89    if (thisPathName == '/' || thisPathName == '/index.html') {
90      isSiteTop = true;
91    }
92
93    /*
94     * スムーススクロール
95     **/
96    $("a[href^='#']").not("[href$='#'], .noscr").on('click', function (e) {
97      var h, t;
98      e.preventDefault();
99      try {
100        t = this.hash;
101        h = $(t).offset().top;
102        return $("html,body").animate({ scrollTop: h }, 800);
103      } catch (err) { }
104    });
105    $('.pagetop a').on('click', function (e) {
106      e.preventDefault();
107      $('html,body').animate({ scrollTop: 0 }, 800);
108    });
109
110    /*
111     * ロールオーバー
112     **/
113    $('.over').not('[src*="_on."]').each(function () {
114      var img, src, src_on;
115      img = $(this);
116      src = img.attr('src');
117      src_on = src.substr(0, src.lastIndexOf('.')) + '_on' + src.substring(src.lastIndexOf('.'));
118
119      //プリロード
120      $('<img>').attr('src', src_on);
121
122      //アクティブ化対策のため、マウスオン・オフのたびにクラスが存在するか確認。
123      return img.on("mouseenter", function() {
124        if ($(this).hasClass("over")) {
125          $(this).attr("src", src_on);
126        }
127      }).on("mouseleave", function() {
128        if ($(this).hasClass("over")) {
129          $(this).attr("src", src);
130        }
131      });
132    });
133
134    /*
135     * アクティブ化
136     **/
137    var currentNavi;
138    if (location.href.match('/kosodate/')) {
139      activateNavi(1);
140    } else if (location.href.match('/kyouiku/')) {
141      activateNavi(2);
142    } else if (location.href.match('/juken/')) {
143      activateNavi(3);;
144    } else if (location.href.match('/eigo/')) {
145      activateNavi(4);;
146    }
147
148    /*
149     * 新着記事にnewをつける
150     **/
151    $('.recent').each(function () {
152      $(this).find('.img').append('<span class="new"><img src="/_shared/img/icon_new.png" alt="NEW"></span>');
153    });
154
155    $('.btn').on("mouseenter",
156      function () {
157        $(this).css({ opacity: 0.7 });
158      });
159    $('.btn').on("mouseleave",
160      function () {
161        $(this).css({ opacity: 1.0 });
162      });
163
164    //動画サムネイルに再生アイコンをつける
165    $('.item .play').append('<img src="/_shared/img/img_play.png" class="icon_play" alt="">');
166
167    if ('PC' === $device) {
168      $('#related a img, #recommend a img, #sidebar .side-ranking a img, .hover a img').on("mouseenter",
169        function () {
170          $(this).stop().animate({ 'opacity': 0.7 }, 500);
171        }
172      );
173      $('#related a img, #recommend a img, #sidebar .side-ranking a img, .hover a img').on("mouseleave",
174        function () {
175          $(this).stop().animate({ 'opacity': 1.0 }, 500);
176        }
177      );
178
179      $('#food-recipe .row').each(function () {
180        $(this).find('.item').heightLine();
181      });
182      $('.triple').each(function () {
183        $(this).find('.atc-info').heightLine();
184        $(this).find('.title').heightLine();
185      });
186    } else {
187      $('#food-recipe .acc').on('click', function () {
188        $(this).toggleClass('on');
189        $(this).next('.recipe-body').find('.recipe-main').slideToggle();
190      });
191
192      //スクロールで戻るボタン表示
193      var btn = $('.pagetop');
194      btn.hide();
195      //スクロールが100に達したらボタン表示
196      $(window).on("scroll", function () {
197        if ($(this).scrollTop() > 100) {
198          btn.fadeIn();
199        } else {
200          btn.fadeOut();
201        }
202      });
203    }
204    $('.double').each(function () {
205      $(this).find('.atc-info').heightLine();
206      $(this).find('.title').heightLine();
207    });
208
209    $('#pagenation .current-page a, .pagenation .current-page a').on('click', function (e) {
210      e.preventDefault();
211    });
212    /*
213     * 会員メニュー
214     *
215     **/
216    setTimeout(function () {
217      if ($(window).width() > 740) {
218        $('#kaiin_menu .kaiinbtn').on('click', function (e) {
219
220          var $this = $(this);
221          if (!$('#kaiin_menu').hasClass('on')) {
222            $('#kaiin_menu').addClass('on');
223            $('.menu-block').find('ul').slideDown();
224            $this.find('img').attr('src', $this.find('img').attr('src').replace(/\./, '_on.'));
225          } else {
226            $('.menu-block').find('ul').slideUp('normal', function () {
227              $('#kaiin_menu').removeClass('on');
228            });
229            try {
230              $this.find('img').attr('src', $this.find('img').attr('src').replace('_on', ''));
231            } catch (e) { }
232          }
233
234          e.stopPropagation();
235          return false;
236        });
237      } else {
238        $('#kaiin_menu .kaiinbtn').on('click', function (e) {
239          var $this = $(this);
240          $('.menu-block').addClass('on');
241          $('#overlay').fadeIn();
242
243          e.stopPropagation();
244          return false;
245        });
246        $('#kaiin_menu .close').on('click', function (e) {
247          $('.menu-block').removeClass('on');
248          $('#overlay').fadeOut();
249
250          e.stopPropagation();
251          return false;
252        });
253      }
254    }, 1000);
255
256    /*
257     * サービス紹介モーダル
258     *
259     **/
260    if ($(window).width() > 740) {
261      $('.resistbox').colorbox({
262        inline: true,
263        innerWidth: '423px',
264        innerHeight: '565px'
265      });
266    } else {
267      $('.resistbox').colorbox({
268        inline: true,
269        maxWidth: '288px',
270        maxHeight: '577px'
271      });
272    }
273
274    /*
275     * ターゲット選択モーダル
276     *
277     **/
278    if ($(window).width() > 740) {
279      $('.targetbox').colorbox({
280        inline: true,
281        innerWidth: '418px',
282        innerHeight: '290px',
283        onOpen: function () {
284          if ($('#target_balloon').is(':visible')) {
285            $('#target_balloon a').on("click");
286          }
287        }
288      });
289      $('#target_regist a').on('click', function (e) {
290        e.preventDefault();
291
292        var param = [];
293        var hash = location.hash;
294        var search = location.search;
295        var url = location.href.replace(hash, "").replace(search, "").replace("#", "");
296        var s = "";
297        var p = "";
298
299        if (search !== "") {
300          var queries = search.replace('?', '').split('&');
301          var query = new Object();
302
303          $.each(queries, function () {
304            query[this.split('=')[0]] = this.split('=')[1];
305          });
306
307          if (query['search'] !== undefined) s = "&search=" + query['search'];
308          if (query['page'] !== undefined) p = "&page=" + query['page'];
309        }
310
311        $('#target_select :checked').map(function () {
312          param.push($(this).val());
313        });
314        if (param.length === 0) {
315          param.push("all");
316        }
317        location.href = url + "?target=" + param.join(',') + s + p;
318      });
319      $('.themebox').colorbox({
320        inline: true,
321        innerWidth: '900px',
322        innerHeight: '410px'
323      });
324    } else {
325      $('.targetbox').colorbox({
326        inline: true,
327        maxWidth: '288px',
328        maxHeight: '392px',
329        onOpen: function () {
330          if ($('#target_balloon').is(':visible')) {
331            $('#target_balloon a').on("click");
332          }
333        }
334      });
335      $('#target_regist a').on('click', function (e) {
336        e.preventDefault();
337
338        var param = [];
339        var hash = location.hash;
340        var search = location.search;
341        var url = location.href.replace(hash, "").replace(search, "").replace("#", "");
342        var s = "";
343        var p = "";
344
345        if (search !== "") {
346          var queries = search.replace('?', '').split('&');
347          var query = new Object();
348
349          $.each(queries, function () {
350            query[this.split('=')[0]] = this.split('=')[1];
351          });
352
353          if (query['search'] !== undefined) s = "&search=" + query['search'];
354          if (query['page'] !== undefined) p = "&page=" + query['page'];
355        }
356
357        $('#target_select input:checkbox:checked').map(function () {
358          param.push($(this).val());
359        });
360        if (param.length === 0) {
361          param.push("all");
362        }
363        location.href = url + "?target=" + param.join(',') + s + p;
364      });
365      $('.themebox').colorbox({
366        inline: true,
367        innerWidth: '288px',
368        innerHeight: '170px'
369      });
370      $('#theme_select .category_select a').on('click', function (e) {
371        e.preventDefault();
372        if (!$(this).hasClass('now')) {
373          var $this = $(this);
374          var target = $(this).parent('p').index();
375          $('#theme_select .actv').removeClass('actv');
376          $('#theme_select .theme_item').eq(target).addClass('actv');
377
378          $('.category_select .now').find('img').attr('src', $('.category_select .now').find('img').attr('src').replace('_on', ''));
379          $('.category_select .now').removeClass('now');
380          $this.addClass('now').find('img').attr('src', $this.find('img').attr('src').replace(/\./, "_on."));
381        }
382      });
383      $('.nav-global_sp_last a').on('click', function (e) {
384        e.preventDefault();
385        var $this = $(this);
386        var $img = $this.find('img');
387        var tgt = $('.hdr-site_search_sp');
388        if (tgt.is(':visible')) {
389          tgt.hide();
390          $img.attr('src', '/_shared/img_sp/btn-search.gif');
391        } else {
392          tgt.show();
393          $img.attr('src', '/_shared/img_sp/btn-search_on.gif');
394        }
395      });
396    }
397    $('#target_select label').on('click', function () {
398      $(this).toggleClass('on');
399    });
400    $('#target_select #target_clear a').on('click', function (e) {
401      e.preventDefault();
402      $('#target_select input').each(function () {
403        $(this).prop('checked', false);
404      });
405      $('#target_select label').each(function () {
406        if ($(this).hasClass('on')) {
407          $(this).removeClass('on');
408        }
409      });
410    });
411    $('#target_balloon a').on('click', function (e) {
412      e.preventDefault();
413      $('#target_balloon').fadeOut();
414      var expire = new Date();
415      expire.setTime(expire.getTime() + 1000 * 3600 * 24 * 365);
416
417      document.cookie = 'balloon=1; path="/"; expires=' + expire.toUTCString();
418    });
419
420    setTimeout(function () {
421      if ($category !== 'all') {
422        var useful_link = $('#useful .more-link a').attr('href') + '#t_' + $category;
423        $('#useful .more-link a').attr('href', useful_link);
424      }
425      $('#related li, #recommend .item').each(function () {
426        $(this).find('h3').text($(this).find('h3').text().replace('潤オ', '~'));
427      });
428      $('.side-ranking .txt, .side-topics .dtl').each(function () {
429        if ($(this).text().length > 18) {
430          $(this).text($(this).text().substr(0, 17) + '…');
431        }
432      });
433      $('.side-ranking .img').each(function () {
434        var w = $(this).find('img').width();
435        var h = $(this).find('img').height();
436        if (w < h) {
437          $(this).addClass('horizontal')
438        }
439      });
440      $('.side-keywords li').each(function () {
441        if ($(this).find('a').text().length > 6) {
442          $(this).addClass('l2');
443        }
444      });
445      try {
446        $('#useful .dtl').heightLine();
447      } catch (e) { }
448    }, 1500);
449
450    $('.icon_play').on('click', function () {
451      $(this).prev('a').on("click");
452    });
453
454    //アプリ誘導バナー
455    $('.app_banner_close').on('click', function (e) {
456      e.preventDefault();
457      $('#app_banner').hide();
458      document.cookie = 'app=1; path="/";';
459    });
460
461    /**
462     * 現在見ている環境によって飛び先を書き換える
463     */
464    var u, host;
465    if ($('a[href^="https://id"]').length > 0 && (location.hostname.indexOf('133') === 0 || location.hostname.indexOf('t2-www') === 0)) {
466      host = location.hostname;
467      $('a[href^="https://id"]').each(function () {
468        u = $(this).attr('href').replace('id', 't-id').replace('%2Fbenesse.jp', '%2F' + host);
469        $(this).attr('href', u);
470      });
471    }
472
473    if ($('a[href^="https://member"]').length > 0 && (location.hostname.indexOf('133') === 0 || location.hostname.indexOf('t2-www') === 0)) {
474      host = location.hostname;
475      $('a[href^="https://member"]').each(function () {
476        u = $(this).attr('href').replace('member', 't-member').replace('%2Fbenesse.jp', '%2F' + host);
477        $(this).attr('href', u);
478      });
479    }
480
481
482    /**
483     * クリップ状態切替え
484     */
485    $('.clip_btn a').on('click', function (e) {
486      e.preventDefault();
487
488      var $updateType;
489      if ($(this).find('img').attr('src').match(/clip2/)) {
490        $updateType = 2;
491      } else {
492        $updateType = 1;
493      }
494
495      var $api_url, $api_key, $url, $title, $id, $target, $category, $img, $date;
496
497      if (location.href.indexOf('133') >= 0 || location.href.indexOf('t2-www') >= 0) {
498        $api_url = 'http://t-member.benesse.jp/api/member/v1/updateclipstatus/';
499        $api_key = 'f359d7ee9016bc2d4a022f502df197a5471a6738a444d70a3c122f9d24072256';
500      } else {
501        $api_url = 'http://member.benesse.jp/api/member/v1/updateclipstatus/';
502        $api_key = 'a4733b4ef9145ee01d52221a04b1b860664a9c989c101d145931db98debc8a4f';
503      }
504
505      $url = location.href;
506      $title = $('.article-title').text();
507      $id = $('.article-theme a').attr('href').match(/[a-z0-9]+\/$/)[0].replace('/', '');
508      $target = $('.categories li').text();
509      $category = location.href.match(/(kosodate|kyouiku|juken|eigo)/)[0];
510      if ($('.mainvisual').length > 0) {
511        $img = 'http://benesse.jp' + $('.mainvisual img').attr('src');
512      } else {
513        $img = 'http://benesse.jp/_shared/img/thumbnail/' + $category + '01.jpg';
514      }
515      $date = location.href.match(/(\d{8})/)[0];
516
517      var data = {
518        api_key: $api_key,
519        articleUrl: $url,
520        articleTitle: $title,
521        themeBigId: $id,
522        target: $target,
523        Category: $category,
524        imgPath: $img,
525        postDt: $date,
526        updateType: $updateType
527      }
528
529      $.ajax({
530        type: "post",
531        url: $api_url,
532        data: JSON.stringify(data),
533        contentType: "application/json",
534        dataType: "json",
535        xhrFields: {
536          withCredentials: true
537        },
538        success: function (json_data) {
539          if (json_data['header']['status'] === 'success') {
540            location.reload();
541          } else {
542            location.href = "https://member.benesse.jp/web/open/common/usererror";
543          }
544        }
545      });
546    });
547
548    /**
549     * bodyクリックでアコーディオンを閉じる
550     */
551    $('body').on('click', function (e) {
552      if ($('#kaiin_menu').hasClass('on')) {
553        $('.kaiinbtn').on("click");
554      }
555    });
556
557  });
558
559  function activateNavi(index) {
560    var navi = $('.nav-global li').eq(index);
561    var oimg_pc = navi.find('.pc');
562    var oimg_sp = navi.find('.spi');
563
564    if(navi.length != 0){
565      oimg_pc.attr('src', oimg_pc.attr('src').replace(/\./, '_on.')).removeClass('over');
566      oimg_sp.attr('src', oimg_sp.attr('src').replace(/\./, '_on.')).removeClass('over');
567    }
568  }
569
570})(jQuery);
571
572
573Array.prototype.shuffle = function () {
574  var i = this.length;
575  while (i) {
576    var j = Math.floor(Math.random() * i);
577    var t = this[--i];
578    this[i] = this[j];
579    this[j] = t;
580  }
581  return this;
582}
583
584"use strict";
585
586var markupBreadcrumb = function markupBreadcrumb() {
587  var breadcrumbs = document.querySelectorAll('ul.breadcrumb');
588  breadcrumbs.forEach(function (breadcrumb) {
589    breadcrumb.setAttribute("itemscope", "");
590    breadcrumb.setAttribute("itemtype", "http://schema.org/BreadcrumbList");
591    var breadcrumbList = breadcrumb.querySelectorAll('li');
592    breadcrumbList.forEach(function (item, index) {
593      if (index < breadcrumbList.length - 1) {
594        item.setAttribute("itemprop", "itemListElement");
595        item.setAttribute("itemscope", "");
596        item.setAttribute("itemtype", "http://schema.org/ListItem");
597        var names = item.querySelectorAll('a');
598        names.forEach(function (name) {
599          name.setAttribute("itemprop", "item");
600          var value = name.innerText;
601          name.innerText = '';
602          name.insertAdjacentHTML('beforeend', "<span itemprop=\"name\">".concat(value, "</span>"));
603        });
604        item.insertAdjacentHTML('beforeend', "<meta itemprop=\"position\" content=\"".concat(index + 1, "\" />"));
605      }
606    });
607  });
608};
609
610"use strict";
611
612var markupBreadcrumb = function markupBreadcrumb() {
613  var breadcrumbs = document.querySelectorAll('ul.breadcrumb');
614  if (breadcrumbs) {
615    breadcrumbs.forEach(function (breadcrumb) {
616      breadcrumb.setAttribute("itemscope", "");
617      breadcrumb.setAttribute("itemtype", "http://schema.org/BreadcrumbList");
618      var breadcrumbList = breadcrumb.querySelectorAll('li');
619      if (breadcrumbList) {
620        breadcrumbList.forEach(function (item, index) {
621          if (index < breadcrumbList.length - 1) {
622            item.setAttribute("itemprop", "itemListElement");
623            item.setAttribute("itemscope", "");
624            item.setAttribute("itemtype", "http://schema.org/ListItem");
625            var names = item.querySelectorAll('a');
626            if (names) {
627              names.forEach(function (name) {
628                name.setAttribute("itemprop", "item");
629                var value = name.innerText;
630                name.innerText = '';
631                name.insertAdjacentHTML('beforeend', "<span itemprop=\"name\">".concat(value, "</span>"));
632              });
633              item.insertAdjacentHTML('beforeend', "<meta itemprop=\"position\" content=\"".concat(index + 1, "\" />"));
634            }
635          }
636        });
637      }
638    });
639  }
640};
641
642var markupArticle = function markupPubdate() {
643  var contents = document.getElementById('contents');
644  if (contents) {
645    contents.setAttribute("itemscope", "");
646    contents.setAttribute("itemtype", "http://schema.org/Article");
647  }
648};
649
650var markupPubdate = function markupPubdate() {
651  var pubDateElements = document.querySelectorAll('.pub-date');
652  if(pubDateElements) {
653    pubDateElements.forEach(function (pubDateEle) {
654      var pubDate = pubDateEle.innerText;
655      var formatPubDate = pubDate.replace(/\//g, '-');
656      pubDateEle.insertAdjacentHTML('beforebegin', "<meta itemprop=\"datePublished\" content=\"".concat(formatPubDate, "\" />"));
657    });
658  }
659};
660
661var markupPublisher = function markupPublisher() {
662  var contents = document.getElementById('contents');
663  if(contents) {
664    contents.insertAdjacentHTML('beforeend', "<div itemprop=\"publisher\" itemscope itemtype=\"https://schema.org/Organization\" style=\"display: none;\"><div itemprop=\"logo\" itemscope itemtype=\"https://schema.org/ImageObject\"><img src=\"https://benesse.jp/_shared/img/20170606/logo-corporate_top.gif\"/><meta itemprop=\"url\" content=\"https://benesse.jp/_shared/img/20170606/logo-corporate_top.gif\"><meta itemprop=\"width\" content=\"108\"><meta itemprop=\"height\" content=\"26\"></div><meta itemprop=\"name\" content=\"ベネッセコーポレーション\"></div>");
665  }
666};
667var markupLogo = function markupLogo(){
668  var contents = document.getElementById('main');
669  if(contents) {
670    contents.insertAdjacentHTML('beforeend',' <div itemscope itemprop="\logo\" itemtype=\"http://schema.org/Organization\" style=\"display: none;\"><meta content=\"https://benesse.jp\" itemprop=\"url\"><img src=\"https://benesse.jp/_shared/img/20170606/logo-corporate_top.gif\" alt=\"Benesse(R)\" itemprop=\"logo\"></div>');
671  }
672};
673
674var markupHeadline = function markupHeadline() {
675  var contents = document.getElementById('contents');
676  if(contents) {
677    var headline = contents.querySelector('.article-title');
678    if(headline) {
679      headline.setAttribute("itemprop", "headline");
680    }
681  }
682};
683
684var markupImage = function markupImage() {
685  var articles = document.getElementById('articles');
686  if (articles) {
687    var image = articles.querySelector('.mainvisual');
688    if (image) {
689      var src = image.querySelector('img').getAttribute('src');
690      src = src.substring(0, 4) === 'http' ? src : "https://benesse.jp".concat(src);
691      image.setAttribute("itemprop", "image");
692      image.setAttribute("itemscope", "");
693      image.setAttribute("itemtype", "https://schema.org/ImageObject");
694      image.insertAdjacentHTML('beforeend', "<meta itemprop=\"url\" content=\"".concat(src, "\">"));
695    }
696  }
697};
698
699var markupAuthor = function markupAuthor() {
700  var articles = document.getElementById('articles');
701  if (articles) {
702    var authorEle = articles.querySelector('.author');
703    if (authorEle) {
704      var nameWrapEle = authorEle.querySelector('.dtl');
705      var nameEle = authorEle.querySelector('.name');
706
707      if (nameWrapEle && nameEle) {
708        nameWrapEle.setAttribute("itemprop", "author");
709        nameWrapEle.setAttribute("itemscope", "");
710        nameWrapEle.setAttribute("itemtype", "https://schema.org/Person");
711        nameEle.setAttribute("itemprop", "name");
712      }
713    }
714  }
715};
716
717
718window.onload = function () {
719};
720
721
722
723"use strict";
724
725window.addEventListener('DOMContentLoaded', function(){
726  // 構造化マークアップ支援
727  markupBreadcrumb();
728  markupArticle();
729  markupPubdate();
730  markupPublisher();
731  markupLogo();
732  markupHeadline();
733  markupImage();
734  markupAuthor();
735
736  // テキストアクティブ
737  // textActivate();
738});
739
740var wrapSourceAndAuthor = function wrapSourceAndAuthor() {
741  // const sourceEle = document.querySelector('.concl > .img-cap');
742  var sourceEle = $('.concl > .img-cap');
743
744  if (sourceEle) {
745    var lastSourceEle = sourceEle.last();
746    var sourceAccWrap = $("<div id='sourceAcc' class='sourceAcc article-acc'></div>");
747    var sourceHead = $("<p id='sourceAcc-head' class='sourceAcc-head article-acc-head'>出典</p>");
748    sourceHead.on("click", function () {
749      $(this).toggleClass('article-acc-head--open');
750      $(this).next().slideToggle();
751    });
752    lastSourceEle.after(sourceAccWrap);
753    sourceAccWrap.before(sourceHead);
754    sourceEle.appendTo(sourceAccWrap);
755    sourceAccWrap.slideToggle();
756  } else if($('#articles .single_source')) {
757    var sourceEle = $('#articles .single_source');
758
759    var lastSourceEle = sourceEle.last();
760    var sourceAccWrap = $("<div id='sourceAcc' class='sourceAcc article-acc'></div>");
761    var sourceHead = $("<p id='sourceAcc-head' class='sourceAcc-head article-acc-head'>出典</p>");
762    sourceHead.on("click", function () {
763      $(this).toggleClass('article-acc-head--open');
764      $(this).next().slideToggle();
765    });
766    lastSourceEle.after(sourceAccWrap);
767    sourceAccWrap.before(sourceHead);
768    sourceEle.appendTo(sourceAccWrap);
769    sourceAccWrap.slideToggle();
770  }
771
772  var authorEle = $('#articles .author');
773
774  if (authorEle) {
775    var lastAuthorEle = authorEle.last();
776    var authorAccWrap = $("<div id='authorAcc' class='authorAcc article-acc'></div>");
777    var authorHead = $("<p id='authorAcc-head' class='authorAcc-head article-acc-head'>プロフィール</p>");
778    authorHead.on("click", function () {
779      $(this).toggleClass('article-acc-head--open');
780      $(this).next().slideToggle();
781    });
782    lastAuthorEle.after(authorAccWrap);
783    authorAccWrap.before(authorHead);
784    authorEle.appendTo(authorAccWrap);
785    authorAccWrap.slideToggle();
786  }
787};
788
789// window.addEventListener('DOMContentLoaded', function () {
790//   var pathname = location.pathname;
791
792//   if (pathname.indexOf('/kosodate/') === 0 || pathname.indexOf('/kyouiku/') === 0 || pathname.indexOf('/juken/') === 0 || pathname.indexOf('/eigo/') === 0 || pathname.indexOf('/dokusho/') === 0) {
793//     wrapSourceAndAuthor();
794//   }
795// });
796
797
798
799
800
801
802/*
803==================================
8042022/04/01 renewal
805==================================
806*/
807
808/*
809============================
810modal
811============================
812*/
813
814$(function() {
815  // 開く
816  $(".js-modal-btn").on("click", function() {
817    let target = $(this).data("modal");
818    let modal = document.querySelector("." + target);
819    if (!$(modal).hasClass("js-open")) {
820      $(modal).addClass("js-open");
821      $('body').css('overflow-y', 'hidden');
822    }
823  });
824  // 閉じる
825  $(".js-modal-bg").on("click", function() {
826    if ($(this).parents(".c-modal").hasClass("js-open")) {
827      $(this).parents(".c-modal").removeClass("js-open");
828      $('body').css('overflow-y','auto');
829    }
830
831  });
832});
833
834
835
836/*
837============================
838g-navi *humber-menu *only-sp
839============================
840*/
841$(function() {
842  var flagHeaderInner = document.getElementById('header_wrap_inner');
843  if(flagHeaderInner){
844    // console.log("ari");
845
846    $('.js-hdr-hamb').on('click', function() {
847      if ($(".js-hdr-hamb").hasClass("js-open")) {
848        $('.js-humb-bg').removeClass('js-open');
849        $('.js-hdr-hamb').removeClass('js-open');
850        $('.js-humb-inner').removeClass('js-open');
851        $('body').css('overflow-y', 'auto');
852        // ios用 ヘッダースクロール
853        $('#header_wrap_inner')[0].removeEventListener("touchmove", notscroll, { passive: false });
854        // page-top
855        $('.pagetop').css('display', 'block');
856      }
857      else {
858        // 高さ調整
859        var hambPositionY = $('#header_wrap_inner').outerHeight() + document.getElementById('header_wrap_inner').getBoundingClientRect().top;
860        var hambPositionY_bg = $('#header_wrap_inner').outerHeight();
861        var pageVh = $(window).height()
862        $('.js-humb-inner').css('top', hambPositionY+'px');
863        $('.js-humb__scroll').css('height', pageVh-hambPositionY+'px');
864        $('.js-humb-bg').css('top', hambPositionY_bg+'px');
865
866        $('.js-hdr-hamb').addClass('js-open');
867        $('.js-humb-inner').addClass('js-open');
868        $('.js-humb-bg').addClass('js-open');
869        $('body').css('overflow-y', 'hidden');
870        // ios用 ヘッダースクロールさせない
871        $('#header_wrap_inner')[0].addEventListener("touchmove", notscroll, { passive: false });
872        // 崩れるため、page-top非表示にさせる。
873        $('.pagetop').css('display', 'none');
874      }
875    });
876    $('.js-humb-close').on('click', function() {
877      console.log("aaa");
878      if ($(".js-hdr-hamb").hasClass("js-open")) {
879        $('.js-humb-bg').removeClass('js-open');
880        $('.js-hdr-hamb').removeClass('js-open');
881        $('.js-humb-inner').removeClass('js-open');
882        $('body').css('overflow-y', 'auto');
883        // ios用 ヘッダーでスクロールアクション
884        $('#header_wrap_inner')[0].removeEventListener("touchmove", notscroll, { passive: false });
885        // page-top
886        $('.pagetop').css('display', 'block');
887      }
888    })
889
890  }
891});
892
893
894function notscroll(e) {
895	e.preventDefault();
896}
897
898
899
900
901
902/*
903==================================
9042023/03/15 renewal
905==================================
906*/
907window.onload = function(){
908  $(function(){
909    $('.m-hdr__inner-wrap-menu').on('click', function(){
910      $('.open-1').toggleClass('active');
911      $(this).toggleClass('on');
912      $(this).toggleClass('move-1');
913      $('body').toggleClass('scrollinvalid');
914      $('.m-hdr__inner-wrap-menu').toggleClass('m-hdr__inner-wrap-menu--opened');
915
916      let docHdrInrWrapSp = $('.m-hdr__inner-wrap--sp')
917      let docHamburger = $('.m-hdr__inner-wrap--sp + .m-hdr__hamburger')
918      docHamburger.toggleClass('m-hdr__hamburger--opend');
919      if(docHamburger.hasClass('m-hdr__hamburger--opend')){
920        let posHdr = docHdrInrWrapSp.offset().top - $(window).scrollTop();
921        let heightHdr = docHdrInrWrapSp.innerHeight();
922        let posBottomHdr = posHdr + heightHdr;
923        docHamburger.css('top', posBottomHdr+'px');
924        $('.m-hdr__hamburger--in').css('height', 'calc(100vh - '+posBottomHdr+'px)')
925      }
926    });
927  }());
928
929  if(document.getElementById('gsc-i-id1')){
930    document.getElementById('gsc-i-id1').placeholder = 'キーワードで検索';
931  }
932  if(document.getElementById('gsc-i-id2')){
933    document.getElementById('gsc-i-id2').placeholder = 'キーワード(例:子育て 小学生)で検索する';
934  }
935};
936
937/*
938===============================================
9392025/01/20 /contents/eninfo/配下のテキスト非表示
940===============================================
941*/
942document.addEventListener("DOMContentLoaded", function() {
943  if (window.location.pathname.includes('/contents/eninfo/')) {
944    const elementIds = ["eninfo-supervisor", "Sensei"];
945
946    elementIds.forEach(elementId => {
947      const targetElement = document.getElementById(elementId);
948
949      if(elementId === "eninfo-supervisor" && targetElement) {
950        const checkTargetName = targetElement.textContent.includes("磯部頼子");
951        if(checkTargetName) {
952          const links = targetElement.querySelectorAll("#eninfo-supervisor a");
953          for (let link of links) {
954            link.style.display = "none";
955          }
956        }
957      } else if (elementId === "Sensei" && targetElement) {
958        const checkTargetName = targetElement.textContent.includes("磯部頼子") || targetElement.textContent.includes("酒井美代子");
959        if(checkTargetName) {
960          const links = targetElement.querySelectorAll(".wrapper a");
961          for (let link of links) {
962            link.style.pointerEvents = "none";
963            link.style.backgroundImage = "none";
964          }
965        }
966
967        const targetPtag = targetElement.querySelector(".name p");
968        if (targetPtag.textContent.includes("プロフィールを見る")) {
969          targetPtag.style.display = "none";
970        }
971      }
972    });
973  }
974});

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.