質問編集履歴
1
プログラムを投稿しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -33,3 +33,191 @@
|
|
33
33
|
|
34
34
|
|
35
35
|
の並びに改行したいです。
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
```ここに言語を入力
|
40
|
+
|
41
|
+
<script>
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
function getCSVFile() {
|
46
|
+
|
47
|
+
var xhr = new XMLHttpRequest();
|
48
|
+
|
49
|
+
xhr.onload = function() {
|
50
|
+
|
51
|
+
createArray(xhr.responseText);
|
52
|
+
|
53
|
+
};
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
xhr.open("get", "ここに表示させるCSV名", true);
|
58
|
+
|
59
|
+
xhr.send(null);
|
60
|
+
|
61
|
+
}
|
62
|
+
|
63
|
+
getCSVFile();
|
64
|
+
|
65
|
+
function createXMLHttpRequest() {
|
66
|
+
|
67
|
+
var XMLhttpObject = null;
|
68
|
+
|
69
|
+
XMLhttpObject = new XMLHttpRequest();
|
70
|
+
|
71
|
+
return XMLhttpObject;
|
72
|
+
|
73
|
+
}
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
function createArray(csvData) {
|
78
|
+
|
79
|
+
var tempArray = csvData.split("\r\n");
|
80
|
+
|
81
|
+
var csvArray = new Array();
|
82
|
+
|
83
|
+
var class_ = '';
|
84
|
+
|
85
|
+
var ul_elem = '';
|
86
|
+
|
87
|
+
var li_elem = '';
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
//行
|
92
|
+
|
93
|
+
for(var i = 0; i<tempArray.length;i++){
|
94
|
+
|
95
|
+
csvArray[i] = tempArray[i].split(",");
|
96
|
+
|
97
|
+
}
|
98
|
+
|
99
|
+
ul_elem += '<ul id="filter-menu">';
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
//ループ
|
104
|
+
|
105
|
+
for(var y=0; y<csvArray.length-1; y++){
|
106
|
+
|
107
|
+
if(csvArray[y][1]=="New"){
|
108
|
+
|
109
|
+
class_ = 'new';
|
110
|
+
|
111
|
+
}
|
112
|
+
|
113
|
+
//li要素
|
114
|
+
|
115
|
+
li_elem = '<li class='+class_+'>';
|
116
|
+
|
117
|
+
li_elem += '<div class="date"><p>'+csvArray[y][0]+'</p></div>';
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
if(csvArray[y][csvArray[y].length-1]!=""){
|
124
|
+
|
125
|
+
li_elem += "<div><p><a href='CSV/"+csvArray[y][csvArray[y].length-1]+"' download='"+csvArray[y][csvArray[y].length-1]+"'>"+csvArray[y][2]+"</a></div></p>"
|
126
|
+
|
127
|
+
}else{
|
128
|
+
|
129
|
+
li_elem += '<div><p>'+csvArray[y][2]+'</p></div>';
|
130
|
+
|
131
|
+
}
|
132
|
+
|
133
|
+
ul_elem += li_elem;
|
134
|
+
|
135
|
+
li_elem = '';
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
console.log(csvArray[y][csvArray[y].length-1]);
|
142
|
+
|
143
|
+
li_elem = "</li>";
|
144
|
+
|
145
|
+
ul_elem += li_elem;
|
146
|
+
|
147
|
+
li_elem = "";
|
148
|
+
|
149
|
+
}
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
ul_elem += "</ul>";
|
156
|
+
|
157
|
+
$("#tab-content").append(ul_elem);
|
158
|
+
|
159
|
+
}
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
window.onload = function(){
|
166
|
+
|
167
|
+
$('#filter-menu').children('li').hide().filter('.' + 'rikukyo').show();
|
168
|
+
|
169
|
+
}
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
$(function(){
|
176
|
+
|
177
|
+
$(document).ready(function(){
|
178
|
+
|
179
|
+
"use strict";
|
180
|
+
|
181
|
+
$('.bxslider').bxSlider({
|
182
|
+
|
183
|
+
auto: true,
|
184
|
+
|
185
|
+
autoControls: true,
|
186
|
+
|
187
|
+
adaptiveHeight: true
|
188
|
+
|
189
|
+
});
|
190
|
+
|
191
|
+
});
|
192
|
+
|
193
|
+
});
|
194
|
+
|
195
|
+
</script>
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
<body>
|
200
|
+
|
201
|
+
<div class="inner">
|
202
|
+
|
203
|
+
<div>
|
204
|
+
|
205
|
+
<div id="new-topics">
|
206
|
+
|
207
|
+
<ul class="tab-menu flexbox">
|
208
|
+
|
209
|
+
<li class="selected"><a href="javascript:void(0);" class="rikukyo">新着</a></li>
|
210
|
+
|
211
|
+
</ul>
|
212
|
+
|
213
|
+
<div id="tab-content"></div>
|
214
|
+
|
215
|
+
</div>
|
216
|
+
|
217
|
+
</div>
|
218
|
+
|
219
|
+
</body>
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
```
|