PageSourceSearch

https://newspark.jp/assets/js/common.base.js

js newspark.jp collected 2026-10-02 10:26:03 UTC 4,632 bytes, 135 lines download raw bytes

1// JavaScript Document
2$(function(){
3  "use strict"
4  var $pageLang = $("html").attr("lang");
5  if( $pageLang!="" ){
6    $(".nav__language--"+$pageLang ).addClass("active");
7  }
8  $(".section.section-main a,.section.section-main a").each(function(){
9    if(
10      $(this).attr("name") != ""
11      && $(this).attr("id") != ""
12      && $(this).attr("name") != undefined
13      && $(this).attr("id") != undefined
14      && $(this).attr("name") === $(this).attr("id")
15    ){
16      $(this).addClass("anchor");
17    }
18  });
19  var userAgent = window.navigator.userAgent;
20  $("html").addClass(userAgent);
21  if( userAgent.indexOf("Trident") != -1 || userAgent.indexOf("msie") != -1 ){
22    $("html").addClass("is-intenetexplorer");
23  }
24/*  
25  if( $(".exhibition_main_img img") ){
26    var mi = $(".exhibition_main_img img").attr("src");
27    var $bgcss = '<style>.section.section-mainimage:before {background-image:url("'+mi+'");}</style>';
28    $(".section.section-mainimage").css({"backgroundImage":"none"}).append($bgcss);
29  }
30*/
31/*
32  $aside = $("aside.aside");
33  $asideInner = $("aside.aside").html();
34  $asideIE = $('<div class="aside col"></aside>');
35  $asideIE.html($asideInner);
36  $asideIE.insertAfter($asideIE);
37  $aside.remove();
38*/  
39/**** <link rel="alternate" href="https://newspark.jp/about/" hreflang="ja"> ****/
40  var $urlja = $("link[rel=alternate][hreflang=ja]").attr("href");
41  var $urlen = $("link[rel=alternate][hreflang=en]").attr("href");
42  if($urlja!="" && $urlja!=undefined){$(".nav__language--ja").attr("href",$urlja.replace('https://newspark.jp',''));}else{}
43  if($urlen!="" && $urlen!=undefined){$(".nav__language--en").attr("href",$urlen.replace('https://newspark.jp',''));}else{$(".nav__language--en").addClass("go-home")}
44  var $href = location.href;
45  var $hostname = location.hostname;
46  var $hostnamePort = $hostname.split(":");
47//  console.log( $href );
48//  console.log( $hostname );
49//  console.log( $hostnamePort );
50  var $exhtml = '/exhibition/include.glnavi.exhibition.html';
51  //
52  var $thispath = document.URL;
53  $(".aside a.list-group-item").each(function(){
54    var linkPath = $(this).attr("href");
55    //console.log("href:"+linkPath);
56    if($thispath.match( linkPath )) {
57      var pasthAry = $thispath.split( linkPath );
58      //console.log( pasthAry );
59      if( pasthAry[1]=="" ){
60        $(this).addClass("active");
61      }
62    }
63  });
64/*
65  $(".aside a.list-group-item,.glmenu a.list-group-item,.glmenu li.list-group-item > a").each(function(){
66    var linkPath = $(this).attr("href");
67    if($thispath.match( linkPath )) {
68      var pasthAry = $thispath.split( linkPath );
69      console.log(pasthAry);
70    }
71  });
72*/  
73  $(document).ready(function() {
74    chkScroll();
75    sectionh2();
76    $.ajax({
77      type: 'GET',
78      url: $exhtml,
79      dataType: 'html',
80      success: function(data){
81        //console.log(data);
82        $("#smenu05").prepend($(data));
83      },
84      error:function() {
85        console.log($exhtml+'の読み込みに問題がありました。');
86      }
87    });
88  });
89  $(window).resize(function() {
90    sectionh2();
91  });
92  $(window).scroll(function () {
93    chkScroll();
94  });
95  $('[name=nav__menu-toggle]').on("change",function(){
96    if( $(this).prop("checked") ){//メニュー開いている
97      $("html").addClass("glmenu-opened");
98    } else {//メニュー閉じてる
99      $("html").removeClass("glmenu-opened");
100    }
101  });
102  function chkScroll(){
103    if ($(window).scrollTop() > 2) {
104      $("html").addClass("main-scrolled");
105    } else {
106      $("html").removeClass("main-scrolled");
107    }
108    if ($(window).scrollTop() > 100) {
109    } else {
110    }
111  }
112  function sectionh2(){
113    var h2num = 1;
114    $(".section .h2").each(function(){
115      $(this).addClass("h2-"+h2num);
116      $(this).find("style").remove();
117      var lineW = 0;
118      var h2w = $(this).width();
119      var h2spanw = $(this).find("span").width();
120      if (window.matchMedia('(max-width:575px)').matches) {
121        lineW = (Math.round((h2w - h2spanw - 16) * 100))/100;
122        $(this).append('<style>.section .h2.h2-'+h2num+':after { width: '+lineW+'px; }</style>');
123      } else {
124        lineW = (Math.round((h2w - h2spanw - 60)/2 * 100))/100;
125        $(this).append('<style>.section .h2.h2-'+h2num+':before { width: '+lineW+'px; }.section .h2.h2-'+h2num+':after { width: '+lineW+'px; }</style>');
126      }    
127      h2num++;
128    });
129  }
130  
131  //
132  if( $('section.emergency').length > 0 ){
133    $('.sitewrap').prepend( $('section.emergency') );
134  }
135});

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.