PageSourceSearch

https://www.orso.jp/article.js?20220208

js orso.jp collected 2026-09-24 12:32:28 UTC 3,948 bytes, 117 lines download raw bytes

1$(function () {
2  var $lists = $('#js-lists')
3    , $pager = $('#pager')
4    , json = $lists.data('json')
5    , filter = $lists.data('filter')
6    , type = $lists.data('type')
7    //1ページの表示数
8    , limit = $lists.data('limit') || 300
9    //現在のページをクエリーから取得
10    , page = getParameterByName('p') || 1
11    , allPage = 1;
12
13  page = parseInt(page),
14    //記事取得
15    $.ajax({
16      cache: false,
17      dataType: 'json',
18      url: json
19    }).done(function (data) {
20      //記事の挿入処理
21      insertData(data);
22    });
23
24  function insertData(entries) {
25    //フィルターとタイプがある場合はフィルタリング
26    if (type && filter) {
27      entries = entryFilter(entries);
28    }
29    //すべてのページ数を決定
30    allPage = parseInt(entries.length / limit);
31    if (entries.length % limit !== 0) {
32      allPage++;
33    }
34    var $li, $link;
35    //すべての記事から表示するようだけをフィルタリング
36    var index = limit * (page - 1);
37    //ページ数から取得するindex を指定
38    // ul に 挿入  render部分
39    // for loop まとめ
40    for (var i = index; i < index + limit; i++) {
41      if (!entries[i]) {
42        continue;
43      }
44      $li = $('<li  class="news-item">');
45      $link = $(`<a id="news-button" href=${entries[i].link}>`);
46      $title = $('<div  class="news-item-title">').text(entries[i].title);
47      $date = $('<div  class="news-item-info">').text(entries[i].date);
48      $date.appendTo($link);
49 	  $title.appendTo($link);
50 	  $link.appendTo($link);
51      $link.appendTo($li);
52      $li.appendTo($lists);
53    }
54    //ページリンクを作成 (外部プラグイン)
55    $pager.twbsPagination({
56		totalPages: allPage,
57		startPage: page,
58		visiblePages: 16,
59		initiateStartPageClick: false,
60		prev : '  ',
61		next : '  ',
62		pageClass: 'item',
63    	nextClass: 'next',
64    	prevClass: 'prev',
65      onPageClick: function (event, next) {
66        $('.prev').after('<div class="pagenation-list">');
67  	 	$('.item').appendTo($('.pagenation-list'));
68      location.href = "https://www.orso.jp/" + location.pathname.slice(1) + '?p=' + next;
69      	jQuery(`.pagenation-list :nth-child(${next})`).removeClass('active');
70      	jQuery(`.pagenation-list :nth-child(${page})`).addClass('active');
71      console.log(page != allPage);
72     	if(page != allPage){
73      		jQuery('.pagination :nth-last-child(2)').removeClass('disabled');
74        } else {
75        	jQuery('.pagination :nth-last-child(2)').addClass('disabled');
76        };
77        if(page != 1){
78      		jQuery('.pagination :nth-child(2)').removeClass('disabled');
79        } else {
80        	jQuery('.pagination :nth-child(2)').addClass('disabled');
81        };
82      	return true;
83      }
84    });
85  	  	$('.prev').after('<div class="pagenation-list">');
86  	$('.item').appendTo($('.pagenation-list'));
87  }
88  //フィルター用関数
89  function entryFilter(entries) {
90    switch (type) {
91      //カテゴリーの場合は json の category の値から
92      //登録されているcategory の , つなぎを配列にしフィルタリング
93      case 'category':
94        entries = entries.filter(function (entry) {
95          return entry.category.split(',').indexOf(filter) !== -1;
96        });
97        break;
98      //年別の場合は year_month キーでフィルタリング /yyyy/mm/ の形式
99      case 'year_month':
100        entries = entries.filter(function (entry) {
101          return entry.year_month === filter;
102        });
103        break;
104    }
105    return entries;
106  }
107  //query 取得関数
108  function getParameterByName(name, url) {
109    if (!url) url = window.location.href;
110    name = name.replace(/[\[\]]/g, "\\$&");
111    var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
112      results = regex.exec(url);
113    if (!results) return null;
114    if (!results[2]) return '';
115    return decodeURIComponent(results[2].replace(/\+/g, " "));
116  }
117});

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.