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.