PageSourceSearch

https://noroi-grant.com/blog/wp-content/themes/simplicity2/javascript.js?ver=7.1.3&fver=20200223014351

js noroi-grant.com collected 2026-10-07 14:25:26 UTC 18,780 bytes, 576 lines download raw bytes

1/////////////////////////////////
2//TOPへ戻るボタン
3/////////////////////////////////
4(function($){
5  var prevScrollTop = -1;
6  var $window = $(window);
7  $window.scroll(function(){
8    //最上部から現在位置までの距離を取得して、変数[scrollTop]に格納
9    var scrollTop = $window.scrollTop();
10    var threashold = 600;
11    var s1 = (prevScrollTop > threashold);
12    var s2 = (scrollTop > threashold);
13
14    // スレッショルドを跨いだ時のみ処理をする
15    if (s1 ^ s2) {
16      if (s2) {
17        //[#page-top]をゆっくりフェードインする
18        $('#page-top').fadeIn('slow');
19      } else {
20        //それ以外だったらフェードアウトする
21        $('#page-top').fadeOut('slow');
22      }
23    }
24
25    prevScrollTop = scrollTop;
26  });
27  //ボタン(id:move-page-top)のクリックイベント
28  $('#move-page-top').click(function(){
29  //ページトップへ移動する
30    $('body,html').animate({
31            scrollTop: 1
32        }, 800);
33  });
34})(jQuery);
35
36/////////////////////////////////
37//スクロール追従
38/////////////////////////////////
39var wrapperTop;//追従エリアのトップ位置を格納(追従開始位置
40var wrapperHeight;//追従エリアの高さを格納
41var sidebarHeight;//サイドバーの高さを格納
42
43//非同期ブログパーツがあっても追従開始位置がずれないように修正(無理やり)
44//スマートな良い方法があれば、ご教授お願いします。
45setInterval(function (){
46  wrapperHeight = jQuery('#sidebar-scroll').outerHeight();
47  sidebarHeight = jQuery('#sidebar').outerHeight();
48  wrapperTop = sidebarHeight - wrapperHeight + 240;
49}, 2000);
50
51(function($) {
52  $(document).ready(function() {
53    /*
54    Ads Sidewinder
55    by Hamachiya2. http://d.hatena.ne.jp/Hamachiya2/20120820/adsense_sidewinder
56    */
57    var main = $('#main'); // メインカラムのID
58    var side = $('#sidebar'); // サイドバーのID
59    var wrapper = $('#sidebar-scroll'); // スクロール追従要素のID
60    var side_top_margin = 60;
61    if (!wrapper.size()) {return;}//スクロール追従エリアにウイジェットが入っていないときはスルー
62    if (side.css('clear') == 'both') {return;}//レスポンシブでサイドバーをページ下に表示しているときはスルー
63
64    if (main.length === 0 || side.length === 0 || wrapper.length === 0) {
65      return;
66    }
67
68    var w = $(window);
69    wrapperHeight = wrapper.outerHeight();
70    wrapperTop = wrapper.offset().top;//とりあえずドキュメントを読み込んだ時点でスクロール追従領域の
70高さを取得
71    var sideLeft = side.offset().left;
72    //console.log(wrapperTop);
73
74    var sideMargin = {
75      top: side.css('margin-top') ? side.css('margin-top') : 0,
76      right: side.css('margin-right') ? side.css('margin-right') : 0,
77      bottom: side.css('margin-bottom') ? side.css('margin-bottom') : 0,
78      left: side.css('margin-left') ? side.css('margin-left') : 0
79    };
80
81    var winLeft;
82    var pos;
83
84    var scrollAdjust = function() {
85      var
86        sideHeight = side.outerHeight(),
87        mainHeight = main.outerHeight(),
88        mainAbs = main.offset().top + mainHeight,
89        winTop = w.scrollTop()+side_top_margin,
90        winLeft = w.scrollLeft(),
91        winHeight = w.height();
92      var nf = (winTop > wrapperTop) && (mainHeight > sideHeight) ? true : false;
93      pos = !nf ? 'static' : (winTop + wrapperHeight) > mainAbs ? 'absolute' : 'fixed';
94      if (pos === 'fixed') {
95        side.css({
96          position: pos,
97          top: '',
98          bottom: winHeight - wrapperHeight,
99          left: sideLeft - winLeft,
100          margin: 0,
101          marginBottom: '-'+side_top_margin+'px'
102        });
103
104      } else if (pos === 'absolute') {
105        side.css({
106          position: pos,
107          top: mainAbs - sideHeight,
108          bottom: '',
109          left: sideLeft,
110          margin: 0,
111          marginBottom: '-'+side_top_margin+'px'
112        });
113
114      } else {
115        side.css({
116          position: pos,
117          marginTop: sideMargin.top,
118          marginRight: sideMargin.right,
119          marginBottom: sideMargin.bottom,
120          marginLeft: sideMargin.left
121        });
122      }
123    };
124
125    var resizeAdjust = function() {
126      side.css({
127        position:'static',
128        marginTop: sideMargin.top,
129        marginRight: sideMargin.right,
130        marginBottom: sideMargin.bottom,
131        marginLeft: sideMargin.left
132      });
133      sideLeft = side.offset().left;
134      winLeft = w.scrollLeft();
135      if (pos === 'fixed') {
136        side.css({
137          position: pos,
138          left: sideLeft - winLeft,
139          margin: 0,
140          marginBottom: '-'+side_top_margin+'px'
141        });
142
143      } else if (pos === 'absolute') {
144        side.css({
145          position: pos,
146          left: sideLeft,
147          margin: 0,
148          marginBottom: '-'+side_top_margin+'px'
149        });
150      }
151    };
152    w.on('load', scrollAdjust);
153    w.on('scroll', scrollAdjust);
154    w.on('resize', resizeAdjust);
155  });
156})(jQuery);
157
158/////////////////////////////////
159// メニューボタンの開閉
160/////////////////////////////////
161(function($){
162  $(document).ready(function() {
163    $('#mobile-menu-toggle').click(function(){
164      var header_menu = $('#navi ul');
165      if (header_menu.css('display') == 'none') {
166        header_menu.slideDown();
167      } else{
168        header_menu.slideUp();
169      }
170    });
171  });
172})(jQuery);
173
174///////////////////////////////////
175// ソーシャルボタンカウントの非同期取得
176///////////////////////////////////
177(function($){
178  $(window).scroll(function(){
179    //console.log($('#sidebar').css('clear'));
180    //最上部から現在位置までの距離を取得して、変数[now]に格納
181    var now = $(window).scrollTop();
182    var sharebar = $('#sharebar');
183    if (!sharebar.size()) {return;}
184    var main = $('#main');
185    var sharebar_top = sharebar.offset().top;
186    var sharebar_h = sharebar.outerHeight();
187    var main_top = main.offset().top;
188    var main_h = main.outerHeight();
189
190    var bottom_line = main_h-400;
191    if(now < (main_h-sharebar_h)){
192      if (now > main_top) {
193        sharebar.css({
194          position: 'fixed',
195          top: '70px'
196        });
197      } else{
198        sharebar.css({
199          position: 'absolute',
200            top: main_top+70
201        });
202      }
203    }else{
204      sharebar.css({
205        position: 'absolute',
206        top: main_h-sharebar_h
207      });
208    }
209  });
210})(jQuery);
211
212// // Twitterのシェア数を取得
213// function fetch_twitter_count(url, selector) {
214//   jQuery.ajax({
215//     url:'//urls.api.twitter.com/1/urls/count.json',
216//     dataType:'jsonp',
217//     timeout: 10000, //10sec
218//     data:{
219//       url:url
220//     }
221//   }).done(function(res){
222//     jQuery( selector ).text( res.count || 0 );
223//   }).fail(function(){
224//     jQuery( selector ).html('<span class="fa fa-exclamation"></span>');
225//   });
226// }
227
228// //Twitterのシェア数を取得(自分のサーバーからPHPで取得)
229// function fetch_twitter_count(url, selector) {
230//   jQuery.ajax({
231//     url: social_count_config.theme_url+'/lib/fetch-twitter.php?url='+url,
232//     dataType:'text',
233//     timeout: 10000, //10sec
234//   }).done(function(res){
235//     jQuery( selector ).text( res || 0 );
236//   }).fail(function(){
237//     jQuery( selector ).html('<span class="fa fa-exclamation"></span>');
238//   });
239// }
240
241//count.jsoonからTwitterのツイート数を取得
242function fetch_twitter_count_from_count_jsoon(url, selector) {
243  jQuery.ajax({
244    url:'//jsoon.digitiminimi.com/twitter/count.json',
245    dataType:'jsonp',
246    timeout: 10000, //10sec
247    data:{
248      url:url
249  },
250  success:function(res){
251    jQuery( selector ).html( res.count || 0 );
252  },
253  error:function(){
254    jQuery( selector ).html('error');
255  }
256  });
257}
258
259
260//Facebookのシェア数を取得
261function fetch_facebook_count(url, selector) {
262  if ( social_count_config.facebook_count_visible ) {
263    jQuery( selector ).text( social_count_config.facebook_count );
264  } else {
265    jQuery( selector ).text( 0 );
266  }
267  // jQuery.ajax({
268  //   url:'https://graph.facebook.com/',
269  //   dataType:'jsonp',
270  //   timeout: 10000, //10sec
271  //   data:{
272  //     id: url
273  //   }
274  // }).done(function(res){
275  //   console.log(fb_access_token);
276  //   console.log(res);
277  //   if ( facebookCount ) {
278  //     jQuery( selector ).text( facebookCount );
279  //   } else {
280  //     jQuery( selector ).text( 0 );
281  //   }
282  // }).fail(function(){
283  //   jQuery( selector ).html('<span class="fa fa-exclamation"></span>');
284  // });
285}
286
287//Google+のシェア数を取得
288function fetch_google_plus_count(url, selector) {
289  jQuery.ajax({
290    url: social_count_config.theme_url+'/lib/fetch-google-plus.php?url='+url,
291    dataType:'text',
292    timeout: 10000, //10sec
293  }).done(function(res){
294    jQuery( selector ).text( res || 0 );
295  }).fail(function(){
296    jQuery( selector ).html('<span class="fa fa-exclamation"></span>');
297  });
298}
299
300//はてなブックマークではてブ数を取得
301function fetch_hatebu_count(url, selector) {
302  jQuery.ajax({
303    url:'//b.hatena.ne.jp/entry.count?callback=?',
304    //url:'//api.b.st-hatena.com/entry.count?callback=?',
305    dataType:'jsonp',
306    timeout: 10000, //10sec
307    data:{
308      url:url
309    }
310  }).done(function(res){
311    jQuery( selector ).text( res || 0 );
312  }).fail(function(){
313    jQuery( selector ).html('<span class="fa fa-exclamation"></span>');
314  });
315}
316
317//ポケットのストック数を取得
318function fetch_pocket_count(url, selector) {
319  jQuery.ajax({
320    url: social_count_config.theme_url+'/lib/fetch-pocket.php?url='+url,
321    dataType:'text',
322    timeout: 10000, //10sec
323  }).done(function(res){
324    jQuery( selector ).text( res || 0 );
325  }).fail(function(){
326    jQuery( selector ).html('<span class="fa fa-exclamation"></span>');
327  });
328}
329
330//feedlyの購読者数を取得
331function fetch_feedly_count(rss_url, selector) {
332  jQuery.ajax({
333    url: social_count_config.theme_url+'/lib/fetch-feedly.php?url='+rss_url,
334    dataType:'text',
335    timeout: 10000, //10sec
336  }).done(function(res){
337    jQuery( selector ).text( res || 0 );
338  }).fail(function(){
339    jQuery( selector ).html('<span class="fa fa-exclamation"></span>');
340  });
341}
342
343//Push7で購読者数を取得
344function fetch_push7_count(app_no, selector) {
345  url = 'https://api.push7.jp/api/v1/'+app_no+'/head';
346  jQuery.ajax({
347    url:url,
348    dataType:'json',
349    timeout: 10000, //10sec
350    data:{
351      url:url
352    }
353  }).done(function(res){
354    jQuery( selector ).text( res.subscribers || 0 );
355  }).fail(function(){
356    jQuery( selector ).html('<span class="fa fa-exclamation"></span>');
357  });
358}
359
360jQuery(function(){
361  if (typeof social_count_config !== 'undefined') {
362    //console.log(social_count_config.all_sns_share_btns_visible);
363    //シェアボタンを全部表示しているとき
364    if ( social_count_config.all_sns_share_btns_visible &&
365         social_count_config.all_share_count_visible ) {
366
367      //Twitterカウントの取得
368      if ( social_count_config.twitter_btn_visible ){
369        fetch_twitter_count_from_count_jsoon(social_count_config.permalink, '.twitter-count');
370      }
371
372      //Facebookカウントの取得
373      if ( social_count_config.facebook_btn_visible ){
374        fetch_facebook_count(social_count_config.permalink, '.facebook-count');
375      }
376      //Google+カウントの取得
377      if ( social_count_config.google_plus_btn_visible ){
378        fetch_google_plus_count(social_count_config.permalink, '.googleplus-count');
379      }
380      //はてブカウントの取得
381      if ( social_count_config.hatena_btn_visible ){
382        fetch_hatebu_count(social_count_config.permalink, '.hatebu-count');
383      }
384      //Pocketカウントの取得
385      if ( social_count_config.pocket_btn_visible ){
386        fetch_pocket_count(social_count_config.permalink, '.pocket-count');
387      }
388      //feedlyカウントの取得
389      if ( social_count_config.feedly_btn_visible ){
390        fetch_feedly_count(social_count_config.rss2_url, '.feedly-count');
391      }
392      //push7カウントの取得
393      if ( social_count_config.push7_btn_visible ){
394        fetch_push7_count(social_count_config.push7_app_no, '.push7-count');
395      }
396
397    }
398
399  }
400
401  if (typeof lazyload_config !== 'undefined') {
402    jQuery('img').lazyload(lazyload_config);
403  }
404});
405
406function doMasonry() {
407  jQuery('#list').masonry({ //<!-- #listは記事一覧を囲んでる部分 -->
408    itemSelector: '.entry', //<!--.entryは各記事を囲んでる部分-->
409    isAnimated: false //<!--アニメーションON-->
410  });
411}
412
413jQuery(window).load(function(){
414  if (typeof do_masonry !== 'undefined') {
415    doMasonry()
416  }
417});
418jQuery(function(){
419  if (typeof do_masonry !== 'undefined') {
420    doMasonry()
421  }
422});
423
424///////////////////////////////////
425// レスポンス表示時のメニューの挙動
426// メニューのスタイル表示崩れの防止
427///////////////////////////////////
428(function($){
429  $(window).resize(function(){
430    if ( $(window).width() > 1110 ) {
431      $('#navi-in ul').removeAttr('style');
432    }
433  });
434})(jQuery);
435
436///////////////////////////////////
437// Facebookページいいねエリアのリサイズ(Androidブラウザ対応用)
438///////////////////////////////////
439// function adjast_article_like_arrow_box() {
440//   var w = jQuery('#main').width();
441//   jQuery('#main .article-like-arrow-box').css('width', (w - 114) + 'px');
442//   w = jQuery('#sidebar').width();
443//   jQuery('#sidebar .article-like-arrow-box').css('width', (w - 114) + 'px');
444//   //console.log(w);
445// }
446// jQuery(window).resize(function() {
447//   adjast_article_like_arrow_box()
448// });
449
450// jQuery(document).ready(function() {
451//   adjast_article_like_arrow_box()
452// });
453
454// ///////////////////////////////////
455// // Twitterのツイート数取得関数を呼び出す
456// ///////////////////////////////////
457// jQuery(function(){
458//   if (typeof social_count_config !== 'undefined') {
459//     //シェアボタンを全部表示しているとき
460//     if ( social_count_config.all_sns_share_btns_visible &&
461//          social_count_config.all_share_count_visible &&
462//          social_count_config.twitter_count_visible ) {
463//       fetch_twitter_count_from_count_jsoon('http://nelog.jp/google-map-to-amp', '.twitter-count');
464//     }
465//   }
466// });
467
468/////////////////////////////////
469// 折り畳み式アーカイブウィジェット
470/////////////////////////////////
471(function($) {
472  $(function() {
473    var wgts = $(".widget_archive");//アーカイブウィジェット全てを取得
474    //アーカイブウィジェットを1つずつ処理する
475    wgts.each(function(i, el) {
476      var wgt = $(el);
477
478      //日付表示+投稿数か
479      var has_date_count = wgt.text().match(/\d+年\d+月\s\(\d+\)/);
480      //日付表示だけか
481      var has_date_only = wgt.text().match(/\d+年\d+月/) && !has_date_count;
482
483      //日付表示されているとき(ドロップダウン表示でない時)
484      if ( has_date_count || has_date_only ) {
485        var
486          clone = wgt.clone(),//アーカイブウィジェットの複製を作成
487          year = [];
488        //クローンはウィジェットが後にに挿入。クローンはcssで非表示
489        wgt.after(clone);
490        clone.attr("class", "archive_clone").addClass('hide');
491
492        var
493          acv = wgt, //ウィジェット
494          acvLi = acv.find("li"); //ウィジェット内のli全て
495        //ul.yearsをアーカイブウィジェット直下に追加してそのDOMを取得
496        var acv_years =  acv.append('<ul class="years"></ul>').find("ul.years");
497
498        //liのテキストから年がどこからあるかを調べる
499        acvLi.each(function(i) {
500          var reg = /(\d+)年(\d+)月/;
501          //日付表示+投稿数か
502          if ( has_date_count ) {
503            reg = /(\d+)年(\d+)月\s\((\d+)\)/;
504          }
505          var dt = $(this).text().match(reg);
506          year.push(dt[1]);
507
508        });
509        $.unique(year); //重複削除
510
511        acvLi.unwrap(); //liの親のulを解除
512
513        //投稿年があるだけ中にブロックを作る
514        var
515          yearCount = year.length,
516          ii = 0;
517        while (ii < yearCount) {
518          acv_years.append("<li class='year_" + year[ii] + "'><a class='year'>" + year[ii] + "å¹´</a><ul class='month'></ul></li>");
519          ii++;
520        }
521
522        //作ったブロック内のulに内容を整形して移動
523        //オリジナルのクローンは順番に削除
524        var j = 0;
525        acvLi.each(function(i, el) {
526          var reg = /(\d+)年(\d+)月/;
527          //日付表示+投稿数か
528          if ( has_date_count ) {
529            reg = /(\d+)年(\d+)月\s\((\d+)\)/;
530          }
531          var
532            dt = $(this).text().match(reg),
533            href = $(this).find("a").attr("href");
534
535          //月の追加
536          var rTxt = "<li><a href='" + href + "'>" + "" + dt[2] + "月</a>";
537          //日付表示+投稿数か
538          if ( has_date_count ) {
539            rTxt += " (" + dt[3] + ")" + "</li>"; //投稿数の追加
540          }
541
542          //作成した月のHTMLを追加、不要なものは削除
543          if (year[j] === dt[1]) {
544            acv_years.find(".year_" + year[j] + " ul").append(rTxt);
545            $(this).remove();
546          } else {
547            j++;
548            acv_years.find(".year_" + year[j] + " ul").append(rTxt);
549            $(this).remove();
550          }
551        });
552
553        //クローン要素を削除
554        clone.remove();
555
556        //直近の年の最初以外は.hide
557        acv.find("ul.years ul:not(:first)").addClass("hide");
558
559        //年をクリックでトグルshow
560        acv.find("a.year").on("click", function() {
561          $(this).next().toggleClass("hide");
562        });
563      }//if has_date_count || has_date_only
564    });//wgts.each
565
566  });
567
568})(jQuery);
569
570/////////////////////////////////
571//テーブルにレスポンシブ用のラップを追加する
572/////////////////////////////////
573// (function($){
574//   $('table:not(.table-wrap table)').wrap('<div class="table-wrap"></div>');
575// })(jQuery);
576

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.