This repository was archived by the owner on May 2, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSource.html
More file actions
699 lines (600 loc) · 20.3 KB
/
Source.html
File metadata and controls
699 lines (600 loc) · 20.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>Collection | My RSS</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="format-detection" content="telephone=no">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="alternate icon" type="image/png" href="assets/i/favicon.png">
<link rel="stylesheet" href="assets/css/amazeui.min.css" />
<style>
@media only screen and (min-width: 1200px) {
.blog-g-fixed {
max-width: 1200px;
}
}
@media only screen and (min-width: 641px) {
.blog-sidebar {
font-size: 1.4rem;
}
}
.blog-main {
padding: 20px 0;
}
.blog-title {
margin: 10px 0 20px 0;
}
.blog-meta {
font-size: 14px;
margin: 10px 0 20px 0;
color: #222;
}
.blog-meta a {
color: #27ae60;
}
.blog-option{
font-size: 14px;
color: #6b6b6b;
}
.blog-option a{
color: #6b6b6b;
}
.edit-label{
float: left;
margin-left: 10px;
}
.edit-status{
position: static;
padding-right: 220px;
}
.blog-pagination a {
font-size: 1.4rem;
}
.blog-content {
max-width: 800px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.blog-content img {
max-width: 100%;
height: auto;
}
.blog-footer {
padding: 10px 0;
text-align: center;
}
.collection-list a{
color:#434343;
}
.collection-list-add {
float:right;
}
.content-icon {
float: right;
margin: 0 10px;
}
</style>
</head>
<body>
<!-- header -->
<header class="am-topbar">
<h1 class="am-topbar-brand">
<a href="#">My RSS</a>
</h1>
<button class="am-topbar-btn am-topbar-toggle am-btn am-btn-sm am-btn-success am-show-sm-only" data-am-collapse="{target: '#doc-topbar-collapse'}"><span
class="am-sr-only">导航切换</span> <span class="am-icon-bars"></span></button>
<div class="am-collapse am-topbar-collapse" id="doc-topbar-collapse">
<ul id="nav" class="am-nav am-nav-pills am-topbar-nav">
<li><a href="Home_Page.html">发现</a></li>
<li><a href="Share.html">分享</a></li>
<li><a href="Collection.html">收藏</a></li>
<li><a href="Group.html">小组</a></li>
<li class="am-active"><a href="Source.html">来源</a></li>
<li><a href="Personal_information.html">个人信息</a></li>
</ul>
</div>
</header>
<div class="am-g am-g-fixed blog-g-fixed">
<!-- catalogue -->
<div class="am-u-md-4 blog-sidebar">
<div class="am-panel-group">
<section class="am-panel am-panel-default">
<div class="am-panel-hd">关于RSS</div>
<div class="am-panel-bd">
<p>我们在首页上为你推荐了RSS源,你可以订阅到这里,以备以后查看。</p>
<p>你也可以在这里导入自己喜欢的RSS源,注意:请输入标准RSS格式(xml格式)。</p>
<p>例如:http://www.people.com.cn/rss/politics.xml</p>
<button type="button" class="am-btn am-btn-success am-btn-sm" id="entry-save-toggle">导入RSS源</button>
</div>
<!-- save entry-->
<div class="am-modal am-modal-prompt" tabindex="-1" id="save-confirm">
<div class="am-modal-dialog">
<div class="am-modal-hd">导入RSS源</div>
<div class="am-modal-bd">
<p>请输入RSS链接</p>
<input type="text" class="am-modal-prompt-input" id="new-entry-link">
</div>
<div class="am-modal-footer">
<span class="am-modal-btn" data-am-modal-confirm>导入</span>
</div>
</div>
</div>
</section>
<section class="am-panel am-panel-default">
<div class="am-panel-hd">RSS源
<a class="collection-list-add" id="collection-new-toggle" onclick="BatchRefresh()">刷新</a>
</div>
<ul class="am-nav collection-list" id="mylist">
<!-- collection list -->
</ul>
</section>
</div>
</div>
<!-- content -->
<div class="am-u-md-8">
<section class="am-panel am-panel-primary">
<header class="am-panel-hd">
<h3 class="am-panel-title">
<label value="" id="collection-name">默认收藏夹</label>
<a class="am-icon-remove content-icon" id="collection-delete-toggle"></a>
</h3>
</header>
<div class="am-panel-bd">
<a id="collection-status"></a>
</div>
<!-- collection delete confirm -->
<div class="am-modal am-modal-confirm" tabindex="-1" id="collection-delete-confirm">
<div class="am-modal-dialog">
<div class="am-modal-hd">取消订阅</div>
<div class="am-modal-bd">
你确定要取消订阅吗?
</div>
<div class="am-modal-footer">
<span class="am-modal-btn" data-am-modal-cancel>取消</span>
<span class="am-modal-btn" data-am-modal-confirm>确定</span>
</div>
</div>
</div>
<!-- edit confirm -->
</section>
<section id="articles">
<article class="blog-main">
<h3 class="am-article-title blog-title">
<a href="#">Google fonts 的字體(display 篇)</a>
</h3>
<h4 class="am-article-meta blog-meta">by <a href="">User</a> · 2018/06/17 · <a href="#">CSDN</a></h4>
<div class="am-g blog-content am-u-lg-12">
<p>你自信滿滿的跟客戶進行第一次 demo。秀出你精心設計的內容時,你原本期許客戶冷不防地掉下感動的眼淚。</p>
<p>因為那實在是太高級了。</p>
</div>
</article>
<h4 class="am-article-meta blog-option"><a class="entry-delete-option">删除</a></h4>
<hr class="am-article-divider blog-hr">
</section>
<!-- entry delete -->
<div class="am-modal am-modal-confirm" tabindex="-1" id="entry-delete-confirm">
<div class="am-modal-dialog">
<div class="am-modal-hd">删除文章</div>
<div class="am-modal-bd">
你确定要删除这篇文章吗?
</div>
<div class="am-modal-footer">
<span class="am-modal-btn" data-am-modal-cancel>取消</span>
<span class="am-modal-btn" data-am-modal-confirm>确定</span>
</div>
</div>
</div>
<ul class="am-pagination blog-pagination">
<li class="am-pagination-prev"><a onclick="goLastPage()">« 上一页</a></li>
<li class="am-pagination-next"><a onclick="goNextPage()">下一页 »</a></li>
</ul>
</div>
</div>
<footer class="blog-footer">
<p>Source | My RSS<br />
<small>© Copyright 2018</small>
</p>
</footer>
<!--[if lt IE 9]>
<script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="assets/js/amazeui.ie8polyfill.min.js"></script>
<![endif]-->
<!--[if (gte IE 9)|!(IE)]><!-->
<!-- <script src="assets/js/jquery.min.js"></script> -->
<!--<![endif]-->
<!-- <script src="assets/js/amazeui.min.js"></script> -->
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script src="assets/js/amazeui.min.js"></script>
<script>
function Logincheck() {
var userId = document.URL.split("html")[1];
if (userId == "") {
alert("请先登录或注册!");
window.location.href = "Login.html";
}
}
Logincheck();
licolection = document.getElementById("nav").childNodes;
for (i = 0; i < licolection.length / 2; ++i) {
element = licolection[i * 2 + 1].childNodes[0];
element.setAttribute('href', element.getAttribute('href') + "?" + document.URL.split("?")[1])
}
</script>
<script>
var pageNum = 1;
//初始化页面
List();
ListCollection(1);
$(EntryDeleteConfirm());
//事件监听
$(CollectionDeleteConfirm());
$(CollectionEditCheck());
$(EntrySaveConfirm());
//注意该监听需要在页面生成完毕后开始
// $(EntryDeleteConfirm());
//DONE: collection-delete-confirm
function CollectionDeleteConfirm() {
$('#collection-delete-toggle').on('click', function () {
$('#collection-delete-confirm').modal({
relatedTarget: this,
onConfirm: function () {
CollectionDelete();
}
});
});
}
//DONE: collection-new-confirm
var newStatus = 3;//编辑后的收藏夹权限
function CollectionEditCheck() {
$('#new-selected').on('change', function () {
newStatus = $(this).val();
});
}
function CollectionNewConfirm() {
$('#collection-new-toggle').on('click', function () {
$('#new-confirm').modal({
relatedTarget: this,
onConfirm: function () {
var title = document.getElementById("new-title").value;
var status = newStatus;
if ("" != title) {
CollectionSave();
} else {
alert("请输入收藏夹名称并选择公开权限");
}
}
});
});
}
//TODO: save-confirm
function EntrySaveConfirm() {
$('#entry-save-toggle').on('click', function () {
$('#save-confirm').modal({
relatedTarget: this,
onConfirm: function () {
var link = document.getElementById("new-entry-link").value;
if ("" != link) {
EntrySave();
} else {
alert("请输入链接");
}
}
});
});
}
//entry-delete-confirm
function EntryDeleteConfirm() {
$('#articles').find('.entry-delete-option').add('#entry-delete-toggle').
on('click', function () {
// $('#entry-delete-toggle').on('click', function () {
$('#entry-delete-confirm').modal({
relatedTarget: this,
onConfirm: function () {
var entryId = this.relatedTarget.id
RemoveEntry(entryId);
}
});
});
}
function goLastPage() {
if (pageNum == 1)
return;
else {
pageNum--;
ListCollection(pageNum);
}
}
function goNextPage() {
pageNum++;
ListCollection(pageNum);
}
//DONE 获取所有公开的收藏夹
function List() {
var reqId = "1";
var reqType = "List";
var type = "0";
var userID = document.URL.split("?")[1];
var device = "pc";
var pageSize = 10;
var pageNum = 1;
var objParam =
{
"reqId": reqId,
"reqType": reqType,
"reqParam":
{
"type": type,
"device": device
},
"reqUserInfo": {
"userId": userID
},
"reqPageInfo":
{
"pageSize": pageSize,
"pageNum": pageNum
}
};
$.ajax
({
url: "http://120.79.191.240:8089/rssbackend/api/v1/source/list",
// get与post的data格式不同
data: {
reqId: reqId,
reqType: reqType,
reqParam: JSON.stringify(
{
"device": device,
"type": type
}),
reqUserInfo: JSON.stringify(
{
"userId": userID
}),
reqPageInfo: JSON.stringify(
{
"pageSize": pageSize,
"pageNum": pageNum
})
},
datatype: "json",
type: "GET",
async: false,
contentType: "application/json",
success: function (objResult) {
//显示所有公开收藏夹信息
var collectionList = document.getElementById("mylist");
for (var i = 0; i < objResult.resResult.curData.numberOfElements; i++) {
var collection = document.createElement("li");
var link = document.createElement("a");
var rsslink = objResult.resResult.curData.content[i].link;
var id = objResult.resResult.curData.content[i].sourceId;//收藏夹ID
var name = objResult.resResult.curData.content[i].name;//收藏夹名字
link.id = id;
link.text = name;
link.setAttribute("value", rsslink);
link.setAttribute("onclick", "changeCollection(this)");
if (i == 0) {
collection.className = "am-active";//默认激活第一个收藏夹
var cur = document.getElementById("collection-name")
cur.innerText = name;
cur.setAttribute("value", id);
document.getElementById("collection-status").innerText = rsslink;
}
collection.appendChild(link);
collectionList.appendChild(collection);
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(XMLHttpRequest.status);
}
});
}
function changeCollection(obj) {
var collectionId = document.getElementById("collection-name").getAttribute("value");
document.getElementById(collectionId).parentNode.className = "";
obj.parentNode.className = "am-active";
//获取当前激活的收藏夹的文章
var name = obj.text;
var id = obj.id;
var rsslink = obj.getAttribute("value");
var cur = document.getElementById("collection-name")
cur.innerText = name;
cur.setAttribute("value", id);
document.getElementById("collection-status").innerText = rsslink;
ListCollection(1);
$(EntryDeleteConfirm());
}
//DONE 获得收藏夹所有的文章
function ListCollection(pageNum) {
var reqId = "1";
var reqType = "ListBySource";
var userId = document.URL.split("?")[1];
var sourceId = document.getElementById("collection-name").getAttribute("value");
var device = "pc";
var pageSize = 3;
var objParam =
{
"reqId": reqId,
"reqType": reqType,
"reqParam":
{
"sourceId": sourceId,
"device": device
},
"reqPageInfo":
{
"pageSize": pageSize,
"pageNum": pageNum
}
};
$.ajax
({
url: "http://120.79.191.240:8089/rssbackend/api/v1/entry/list/source",
data: {
reqId: reqId,
reqType: reqType,
reqParam: JSON.stringify(
{
"sourceId": sourceId,
"device": device
}),
reqPageInfo: JSON.stringify(
{
"pageSize": pageSize,
"pageNum": pageNum
})
},
datatype: "json",
type: "GET",
async: false,
contentType: "application/json",
success: function (objResult) {
var articles = document.getElementById("articles");
articles.innerHTML = "";//清空页面上的现有文章信息
for (var i = 0; i < objResult.resResult.curData.numberOfElements; i++) {
var article = document.createElement("article");
article.className = "blog-main";
//标题
var h3 = document.createElement("h3");
h3.className = "am-article-title blog-title";
var a1 = document.createElement("a");
a1.href = objResult.resResult.curData.content[i].entryLink;//文章链接
a1.text = objResult.resResult.curData.content[i].title;//文章标题
h3.appendChild(a1);
article.appendChild(h3);
//"by <a href="">User</a> · 2018/06/17 · <a href="#">CSDN</a>"
var meta = document.createElement("h4");
meta.className = "am-article-meta blog-meta";
var by = document.createTextNode("by ");
var author = document.createElement("a");
author.text = objResult.resResult.curData.content[i].sourceName;//TODO:作者?
var updateTime = objResult.resResult.curData.content[i].updateTime;//时间
var time = document.createTextNode(updateTime);
var source = document.createElement("a");
source.text = objResult.resResult.curData.content[i].sourceName;//RSS来源
var split1 = document.createTextNode(" · ");
meta.appendChild(by);
meta.appendChild(author);
meta.appendChild(split1);
meta.appendChild(time);
article.appendChild(meta);
//内容
var content = document.createElement("div");
content.className = "am-g blog-content am-u-lg-12";
var p = document.createElement("p");
p.className = "blog-content";
p.innerText = objResult.resResult.curData.content[i].description;//文章内容
content.appendChild(p);
article.appendChild(content);
var hr = document.createElement("hr");
hr.className = "am-article-divider blog-hr";
articles.appendChild(article);
articles.appendChild(hr);
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(XMLHttpRequest.status);
}
});
}
//刷新
function BatchRefresh() {
var reqId = "1";
var reqType = "BatchRefresh";
var userId = document.URL.split("?")[1];
var objParam =
{
"reqId": reqId,
"reqType": reqType,
"reqUserInfo":
{
"userId": userId
}
};
$.ajax
({
url: "http://120.79.191.240:8089/rssbackend/api/v1/source/rss/batch/refresh",
data: JSON.stringify(objParam),
datatype: "json",
type: "POST",
contentType: "application/json",
success: function (objResult) {
alert("刷新成功!");
window.location.href = "Source.html?" + document.URL.split("?")[1];
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(XMLHttpRequest.status);
}
});
}
//删除RSS
function CollectionDelete() {
var reqId = "1";
var reqType = "Delete";
var sourceId = document.getElementById("collection-name").getAttribute("value");
var objParam =
{
"reqId": reqId,
"reqType": reqType,
"reqParam":
{
"sourceId": sourceId
}
};
$.ajax
({
url: "http://120.79.191.240:8089/rssbackend/api/v1/source/delete",
data: JSON.stringify(objParam),
datatype: "json",
type: "POST",
contentType: "application/json",
success: function (objResult) {
window.location.href = "Source.html?" + document.URL.split("?")[1];
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(XMLHttpRequest.status);
}
});
}
//新建RSS
function EntrySave() {
var reqId = "1";
var reqType = "SingleLink";
var link = document.getElementById("new-entry-link").value;
var userId = document.URL.split("?")[1];
var objParam =
{
"reqId": reqId,
"reqType": reqType,
"reqParam":
{
"link": link,
},
"reqUserInfo": {
"userId": userId
}
};
$.ajax
({
url: "http://120.79.191.240:8089/rssbackend/api/v1/source/rss/single/link",
data: JSON.stringify(objParam),
datatype: "json",
type: "POST",
contentType: "application/json",
success: function (objResult) {
window.location.href = "Source.html?" + document.URL.split("?")[1];
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(XMLHttpRequest.status);
}
});
}
</script>
</body>
</html>