This repository has been archived by the owner on Nov 21, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnewspapers.html
168 lines (161 loc) · 6.44 KB
/
newspapers.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>NationStates++</title>
<link href="assets//css/bootstrap.css" rel="stylesheet">
<link rel="icon" type="image/ico" href="favicon.ico?v=1"/>
<link href="jumbotron.css?v=4" rel="stylesheet">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-47457755-1', 'nationstatesplusplus.com');
ga('send', 'pageview');
</script>
</head>
<style type="text/css">
.a_title {
font-size: 18px;
color: black;
font-weight: bold;
}
</style>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="https://nationstatesplusplus.net/">NationStates++</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="https://nationstatesplusplus.net/newspapers">Newspapers</a></li>
<li><a href="https://nationstatesplusplus.net/wa">World Assembly</a></li>
<li><a href="https://nationstatesplusplus.net/happenings">Happenings</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="http://blog.nationstatesplusplus.net">Blog</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
<div id='article_pattern' style='display:none;'>
<div class="panel content">
<div class="panel-heading panel-header">
<h3 class="panel-title article_title">Panel title</h3>
<h3 class="panel-title newspaper" style="float: right; margin-top: -16px;">News Source</h3>
</div>
<div class="panel-body article_content">
Panel content
</div>
<div class="panel-footer" style="background: white;">
<h3 class="panel-title article_link"><a href="">Read the full article »</a></h3>
</div>
</div>
</div>
<div class="container">
<h1 style="text-align:center">Latest News In NationStates</h1>
<div id="articles"></div>
</div>
<footer class="bs-footer" role="contentinfo">
<p>NationStates++, <a href="http://opensource.org/licenses/MIT">Licensed MIT</a>, 2014</p>
<ul class="footer-links muted">
<li><a href="https://nationstatesplusplus.net/install">Install NS++</a></li>
<li>·</li>
<li><a href="https://github.com/Afforess/nspp-website">GitHub</a></li>
<li>·</li>
<li><a href="https://nationstatesplusplus.net">About</a></li>
<li>·</li>
<li><a href="https://nationstatesplusplus.netprivacy">Privacy</a></li>
<li>·</li>
<li><a href="https://nationstatesplusplus.nettos">Terms Of Service</a></li>
<li>·</li>
<li><a href="http://blog.nationstatesplusplus.net/">Blog</a></li>
<li>·</li>
</ul>
</footer>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="assets//js/bootstrap.min.js"></script>
<script src="nspp.js"></script>
<script src="functions.js"></script>
<script type="text/javascript">
$(document).ready(function() {
if (typeof String.prototype.toTitleCase != 'function') {
String.prototype.toTitleCase = function (){
return this.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
};
}
RegExp.escape = function(text) {
return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
}
String.prototype.replaceAll = function(search, replace) {
return this.replace(new RegExp(RegExp.escape(search),'g'), replace);
};
$.fn.scrolled = function (waitTime, fn) {
var tag = "scrollTimer";
this.scroll(function () {
var self = $(this);
var timer = self.data(tag);
if (timer) {
clearTimeout(timer);
}
timer = setTimeout(function () {
self.data(tag, null);
fn();
}, waitTime);
self.data(tag, timer);
});
};
var articlePattern = $("#article_pattern").clone();
$("#article_pattern").remove();
var loadArticles = function(start) {
$.get("https://nationstatesplusplus.net/api/newspaper/recent/?start=" + start, function(data) {
//var panels = ["panel panel-primary", "panel panel-grey"]
var html = "";
endOfArticles = data.length == 0;
var articleCount = 0;
for (var i = 0; i < data.length; i++) {
var article = data[i];
if (article.article.length > 5) {
articleCount += 1;
var body = articlePattern.clone();
$(body).find(".article_title").html("<span class='a_title'>" + $("<div></div>").html(parseBBCodes(article.title)).text().toUpperCase() + "</span>");
if (article.newspaper_id == 0) {
$(body).find(".newspaper").html("<a target='_blank' href='/newspaper?id=0'>NationStates Gameplay News</a>");
} else if (article.newspaper_id == 1) {
$(body).find(".newspaper").html("<a target='_blank' href='/newspaper?id=1'>NationStates Roleplay News</a>");
} else {
$(body).find(".newspaper").html("<a target='_blank' href='/newspaper?id=" + article.newspaper_id + "'>" + article.region.replaceAll("_", " ").toTitleCase() + " Regional News</a>");
}
$(body).find(".panel-body").html(parseBBCodes(article.article));
$(body).find(".article_link a").attr("href", "/newspaper?id=" + + article.newspaper_id + "&article=" + article.article_id);
html += $(body).html();
}
}
$("#articles").html($("#articles").html() + html);
});
};
loadArticles(0);
var start = 10;
var endOfArticles = false;
$(window).scrolled(250, function() {
if ($(window).scrollTop() + 300 > $(document).height() - $(window).height() && !endOfArticles) {
loadArticles(start);
start += 10;
}
});
});
</script>
</body>
</html>