PageSourceSearch

https://agenda-note.com/files/user/js/function.js?v=1542602430

js agenda-note.com collected 2026-10-02 03:57:03 UTC 6,887 bytes, 204 lines download raw bytes

1//////////////////////////////////////////////
2// onload読み込み (全てのDOM読み込み後に発火)
3//////////////////////////////////////////////
4$(function() {
5/* ===========================================
6グローバルナビゲーション
7=========================================== */
8  /* -------------------------------------------
9  common:SP時のハンバーガーメニュー menu-btnクラスを持つ要素をトリガーとする
10  ------------------------------------------- */
11  var trigger = $('.menu-btn');
12  var target = $('.hd_navi'); // SPのメニューの親を指定
13  trigger.on('click',function() {
14    trigger.toggleClass('active');
15    target.toggleClass('active');
16    return false;
17  });
18
19  /* -------------------------------------------
20  スクロール時 ページ上部固定
21  ------------------------------------------- */
22  var nav_offset = jQuery('.hd_navi').offset().top;
23
24  jQuery(window).on('scroll load',function(){
25    var now_offset = jQuery(window).scrollTop();
26    if ( now_offset >= nav_offset ) {
27      jQuery('.hd_navi').css('position','fixed').addClass("changed");
28    } else {
29      jQuery('.hd_navi').css('position','inherit').removeClass("changed");
30    }
31  });
32
33  /* -------------------------------------------
34  現在地表示
35  ------------------------------------------- */
36  // URL取得
37  var url_pathname = location.pathname;
38  // console.log("location.pathname: " + url_pathname);
39
40  // TOPページの場合
41  if(url_pathname == '/'){
42    // TOPページへリンクにハイライトターゲットを指定
43    $("#header .hd_naviList > ul > li:first-child > a").addClass("active");
44  }
45  // 伊東塾の場合
46  else if(url_pathname == '/itoujuku/'){
47    // 「/(スラッシュ)」で分割し、ディレクトリを取得
48    url_pathname = 'conference/';
49    // console.log("split.pathname: " + url_pathname);
50
51    // 後方後方一致にてハイライトターゲットを指定
52    $("#header .hd_naviList > ul > li > a[href$='" + url_pathname + "']").addClass("active");
53  }
54  // スペシャルページの場合
55  else if(url_pathname == '/special_list/'){
56    // 「/(スラッシュ)」で分割し、ディレクトリを取得
57    url_pathname = 'special/';
58    // console.log("split.pathname: " + url_pathname);
59
60    // 後方後方一致にてハイライトターゲットを指定
61    $("#header .hd_naviList > ul > li > a[href$='" + url_pathname + "']").addClass("active");
62  }
63  // TOPページ以外の場合
64  else{
65    // 「/(スラッシュ)」で分割し、ディレクトリを取得
66    url_pathname = url_pathname.split('/');
67    url_pathname = url_pathname[1] + '/';
68    // console.log("split.pathname: " + url_pathname);
69
70    // 後方後方一致にてハイライトターゲットを指定
71    $("#header .hd_naviList > ul > li > a[href$='" + url_pathname + "']").addClass("active");
72  }
73
74
75/* ===========================================
76メインビジュアル ローテーション
77=========================================== */
78  $('.regular').slick({
79      dots: true,
80      infinite: true, // ループ
81      speed: 300, // スピード
82      slidesToShow: 2, //通常
83      slidesToScroll: 2,
84      responsive: [{
85          breakpoint: 480,
86          settings: { //480px以下では画像 1
87              slidesToShow: 1,
88              slidesToScroll: 1
89          }
90      }]
91  });
92
93
94/* ===========================================
95記事タイトル 文字省略
96=========================================== */
97  var window_width = window.innerWidth;
98  /* // 横幅に応じて省略文字数を調整
99  if(860 < window_width){ size = 20; }
100  else if(768 < window_width){ size = 20; }
101  else if(580 < window_width){ size = 20; }
102  else if(480 < window_width){ size = 20; }
103  */
104
105  // メインビジュアルタイトル
106  var target01 = ".mainv .sliderblock dl dt p";
107  var size01 = 30; // 省略 全角文字数
108  title_size(target01, size01);
109
110  // 記事一覧タイトル
111  var target02 = ".article_list li h2";
112  var size02 = 36; // 省略 全角文字数
113  title_size(target02, size02);
114
115  // ランキング
116  var target03 = ".ranking_area dl dd.txt a";
117  var size03 = 36; // 省略 全角文字数
118  title_size(target03, size03);
119
120  function title_size(target, size){
121    $(target).each(function(){
122      var txt = $(this).text();
123      var suffix = '…';
124      var b = 0;
125      for(var i = 0; i < txt.length; i++) {
126        b += txt.charCodeAt(i) <= 255 ? 0.5 : 1;
127        if (b > size) {
128          txt = txt.substr(0, i) + suffix;
129          break;
130        }
131      }
132      $(this).text(txt);
133    });
134  }
135
136
137/* ===========================================
138記事タイトル&URLコピー
139=========================================== */
140  // ターゲット指定
141  var targetClass = '.article_cont .sns_share li.url_cp span';
142
143  // ターゲットが存在するなら
144  if($(targetClass).length){
145    //clipboard.min.jsが動作する要素をクラス名で指定
146    var clipboard = new Clipboard(targetClass);
147
148    //クリックしたときの挙動
149    $(targetClass).click(function(){
150        //ボタンの色などを変更するためにクラスを追加
151        $(this).addClass('copied');
152    });
153  }
154
155/* ===========================================
156シェア数取得
157=========================================== */
158  // {assign var="full_path" value=$this_host$SCRIPT_NAME}
159  // {$full_path|urlencode}
160  var url = location.href;
161  var access_token = '165390060809223|E-Kfyw5x67rZwnGyP5oayaCXYk8';
162
163  //Facebookのシェア数を取得
164  //参考:https://nelog.jp/sns-buttons-on-ajax
165  function sns_facebook_count(url, get_cnt) {
166    jQuery.ajax({
167      type: 'GET',
168      url: 'https://graph.facebook.com/v2.9/?id=' + encodeURIComponent(url) + '&fields=engagement&access_token=' + access_token + '&callback=callback',
169      dataType:'jsonp',
170      data:{
171        id:url
172      },
173      dataType: 'jsonp',
174      jsonp: 'callback',//コールバックパラメータ名の指定
175      // jsonpCallback: 'testCallback',//callback関数名を自分で指名
176    })
177    .done(function(data){
178      // var fb_cnt = data.engagement[get_cnt];
179      var fb_cnt = 0;
180      if(fb_cnt){
181        // $("#fb_cnt").addClass("cnt_on").text(fb_cnt);
182      }
183    })
184    .fail(function(data){
185       // console.log("0");
186    });
187  }
188  sns_facebook_count(url, 'share_count');
189
190/* ===========================================
191iframeレスポンシブ対応
192  $(".pr_img>div>iframe").cbIframeSize();
193=========================================== */
194
195});
196
197//////////////////////////////////////////////
198// トリガー系発火 (全てのDOM読み込み前に発火)
199//////////////////////////////////////////////
200
201/* ===========================================
202広告固定IE対応
203=========================================== */
204$('.fixed_sticky').Stickyfill();

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.