PageSourceSearch

https://www.nipponham.co.jp/common/js/rcms.js?v=20250813

js nipponham.co.jp collected 2026-10-02 04:03:56 UTC 3,895 bytes, 104 lines download raw bytes

1(function($) {
2    /**
3     * トピックスリストを取ってきて整形するクラス
4     */
5    var TopicsFetcher = function(setting) {
6        
7        this.topicsGroupId = setting.topicsGroupId || '';
8        this.cnt = setting.cnt ?? 10; //  取得する記事数
9        this.dataType = setting.dataType || 'json'; // デフォルトを 'json' に
10        this.from_page = setting.from_page || "";;
11        this.target_contents = setting.target_contents || "";;
12        this.puts = setting.puts || function() {};
13        // search_ext_col_XX (01〜99) に対応
14        Object.keys(setting).forEach(key => {
15          if (/^search_ext_col_\d{2}$/.test(key)) {
16            this[key] = Array.isArray(setting[key]) ? setting[key] : [];
17          }
18        });
19        this.url = setting.url || '/topics_list' + this.topicsGroupId + '/';
20        this.contents_type = setting.contents_type || '';
21      };
22  
23    // 記事詳細のURL生成
24  //   TopicsFetcher.getTopicsDetailUrl = function(topic) {
25  //       if (topic.link_flg == '1') {
26  //           if (topic.ext_col_99) {
27  //               return topic.ext_col_99;
28  //           } else {
29  //               return '/topics_detail' + topic.topics_group_id + '/id=' + topic.topics_id;
30  //           }
31  //       } else if (topic.link_flg == '2') {
32  //           return topic.link_url;
33  //       } else {
34  //           return "";
35  //       }
36  //   };
37  
38    TopicsFetcher.formatYmd = function(ymd) {
39        if (!ymd || ymd.indexOf('-') === -1) return ''; // 不正な値チェック
40        var splitted = ymd.split('-');
41        return splitted[0] + '年' + splitted[1] + '月' + splitted[2] + '日';
42    };
43  
44    TopicsFetcher.prototype = {
45        constructor: TopicsFetcher,
46  
47        _makeOptions: function() {
48  
49          var self = this;
50          var data = {
51              data_format: "json",
52              cnt: self.cnt,
53              dataType: self.dataType,
54              from_page: self.from_page,
55              target_contents: self.target_contents,
56              contents_type: self.contents_type
57          };
58      
59          // search_ext_col_xx (01〜99) を追加
60          Object.keys(self).forEach(function(key) {
61              if (/^search_ext_col_\d{2}$/.test(key)) {
62                  data[key] = self[key];
63              }
64          });
65          console.log(data);
66            var self = this;
67            return {
68                type: 'GET',
69                url: self.url,
70                dataType: self.dataType, // dataTypeをリクエストに反映
71                data: data,
72                success: function(data) {
73  
74                    if (!data) {
75                        console.error("取得データが null または undefined:", data);
76                        return;
77                    }
78  
79                    // dataType が 'html' の場合は data をそのまま渡す
80                    if (self.dataType === 'html') {
81                        self.puts(data);
82                    } else {
83                        // JSONデータとして処理
84                        if (!data.html_source && (!data.topicsList || data.topicsList.length === 0)) {
85                            console.error("取得データが不正: html_source も topicsList も空", data);
86                            return;
87                        }
88                        self.puts(data.pageInfo, data.topicsList, data.html_source);
89                    }
90                },
91                error: function(xhr, status, error) {
92                    console.error("AJAXエラー:", status, error);
93                }
94            };
95        },
96  
97        run: function() {
98            $.ajax(this._makeOptions());
99        }
100    };
101  
102    window.TopicsFetcher = TopicsFetcher;
103  })(jQuery);
104  

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.