1
+ <!doctype html>
2
+ < html >
3
+ < head >
4
+ < link rel ="stylesheet " href ="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css " />
5
+ < link rel ="stylesheet " href ="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.min.css " />
6
+ < link rel ="stylesheet " href ="http://node-os.com/css/default.css " />
7
+ <!-- START: ANGULAR DEPENDENCY -->
8
+ < script type ="text/javascript " src ="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.13/angular.min.js "> </ script >
9
+ < script type ="text/javascript " src ="/blog/api.js " > </ script >
10
+ < style >
11
+ # articles img {max-width : 100% }
12
+ </ style >
13
+ <!-- END: ANGULAR DEPENDENCY -->
14
+ </ head >
15
+ < body >
16
+ < header class ="navbar navbar-default navbar-fixed-top " role ="navigation ">
17
+ <!-- Brand and toggle get grouped for better mobile display -->
18
+ < div class ="navbar-header ">
19
+ < button type ="button " class ="navbar-toggle " data-toggle ="collapse " data-target =".navbar-ex1-collapse ">
20
+ < span class ="sr-only "> Toggle navigation</ span >
21
+ < span class ="icon-bar "> </ span >
22
+ < span class ="icon-bar "> </ span >
23
+ < span class ="icon-bar "> </ span >
24
+ </ button >
25
+ < a class ="navbar-brand " href ="http://node-os.com "> node-os</ a >
26
+ </ div >
27
+
28
+ <!-- Collect the nav links, forms, and other content for toggling -->
29
+ < div class ="collapse navbar-collapse navbar-ex1-collapse ">
30
+ < ul class ="nav navbar-nav ">
31
+ < li > < a href ="http://node-os.com/blog "> Blog</ a > </ li >
32
+ < li > < a href ="http://npkg.org "> npkg.org</ a > </ li >
33
+ </ ul >
34
+ </ div > <!-- /.navbar-collapse -->
35
+ </ header >
36
+ <!-- START: ISSUES ITEM TEMPLATE -->
37
+ < section ng-app ="NodeOsBlog " id ="articles " class ="section ">
38
+ < div class ="container " ng-controller ="ErrorListCtrl " >
39
+ < article ng-repeat ="(index, error) in errors " class ="row ">
40
+ < div class ="col-sm-8 col-sm-offset-2 {{error.class}} " ng-mousedown ="removeError(error) ">
41
+ < header class ="alert alert-danger " role ="alert ">
42
+ < h3 class ="title "> {{error.name}}</ h3 >
43
+ </ header >
44
+ < div class ="content "> {{error.message}}</ div >
45
+ < footer >
46
+ Don't worry, it probably was not your fault... probably....
47
+ < br /> < br />
48
+ Even if it was,
49
+ < a target ="_blank " href ="https://github.com/formula1/NodeOS-Blog/issues " > just submit an issue :)</ a >
50
+ < br /> < br />
51
+ To remove this message, click it.
52
+ </ footer >
53
+ </ div >
54
+ </ article >
55
+ </ div >
56
+ < div class ="container " ng-controller ="BlogSingleCtrl " >
57
+ < article ng-repeat ="item in blog " class ="row ">
58
+ < div class ="col-sm-8 col-sm-offset-2 ">
59
+ < header class ="{{item.state}} ">
60
+ < h3 class ="title ">
61
+ < a href ="http://node-os.com/blog/article#{{item.number}} ">
62
+ {{item.title}}
63
+ </ a >
64
+ </ h3 >
65
+ < a href ="{{item.html_url}} "> View on Github</ a >
66
+ </ header >
67
+ < div class ="content " ng-bind-html ="item.bodyHTML | to_trusted "> </ div >
68
+ < footer >
69
+ < a href ="http://node-os.com/blog/{{item.number}} " class ="comments ">
70
+ There are {{item.comments}} comments.
71
+ </ a >
72
+ </ footer >
73
+ </ div >
74
+ </ article >
75
+ </ div >
76
+ < div class ="container " ng-controller ="CommentListCtrl " >
77
+ < article ng-repeat ="item in blog " class ="row ">
78
+ < div class ="col-sm-8 col-sm-offset-2 ">
79
+ < header class ="{{item.state}} ">
80
+ < h3 class ="title ">
81
+ < a href ="{{item.user.html_url}} ">
82
+ < img src ="{{item.user.avatar_url}} " />
83
+ < span > {{item.user.login}}</ span >
84
+ </ a >
85
+ </ h3 >
86
+ < a href ="{{item.html_url}} "> View on Github</ a >
87
+ </ header >
88
+ < div class ="content " ng-bind-html ="item.bodyHTML | to_trusted "> </ div >
89
+ </ div >
90
+ </ article >
91
+ </ div >
92
+ </ section >
93
+ <!-- END: ISSUES ITEM TEMPLATE -->
94
+
95
+ < div class ="section inverse trampstamp ">
96
+ < div class ="row ">
97
+ < div class ="col-xs-12 "> < img src ="http://node-os.com/images/nodeos-update.png "> </ div >
98
+ </ div >
99
+ </ div >
100
+
101
+ < footer >
102
+ < div class ="container " id ="footer ">
103
+ < div class ="row ">
104
+ < div class ="col-sm-7 ">
105
+ < h3 class ="footer-title "> Share</ h3 >
106
+ < p > node-os is a work in progress.</ p >
107
+ < p > If you would like to support us, please share node-os via Twitter</ p >
108
+ < p class ="pvl ">
109
+ < a href ="https://twitter.com/TheNodeOS " class ="twitter-follow-button " data-show-count ="false " data-size ="large "> Follow @TheNodeOS</ a >
110
+ < script type ="text/javascript ">
111
+ ( function ( d , s , id ) {
112
+ var js ;
113
+ fjs = d . getElementsByTagName ( s ) [ 0 ] ;
114
+ p = / ^ h t t p \: / . test ( d . location ) ?'http' :'https' ;
115
+ if ( ! d . getElementById ( id ) ) {
116
+ js = d . createElement ( s ) ;
117
+ js . id = id ;
118
+ js . src = p + '://platform.twitter.com/widgets.js' ;
119
+ fjs . parentNode . insertBefore ( js , fjs ) ;
120
+ }
121
+ } ) ( document , 'script' , 'twitter-wjs' ) ;
122
+ </ script >
123
+ < a href ="https://twitter.com/share " class ="twitter-share-button " data-url ="http://node-os.com/blog/OS-flavors " data-text ="NodeOS - The NodeJS Powered Operating System " data-via ="TheNodeOS " data-size ="large "> Tweet</ a >
124
+ </ p >
125
+
126
+ </ div >
127
+
128
+ </ div >
129
+ </ div >
130
+ </ footer >
131
+
132
+ <!-- START: BIND DATA TO VIEW -->
133
+ < script type ="text/javascript ">
134
+
135
+ var NodeOsBlog = angular . module ( 'NodeOsBlog' , [ ] ) ;
136
+ NodeOsBlog . filter ( 'to_trusted' , [ '$sce' , function ( $sce ) {
137
+ return function ( text ) {
138
+ return $sce . trustAsHtml ( text ) ;
139
+ } ;
140
+ } ] ) ;
141
+ var errors = [ ] ;
142
+ var is_authed = false ;
143
+ function add403 ( ) {
144
+ var topush = {
145
+ class :"four-zero-three" ,
146
+ name :"You've hit max data"
147
+ } ;
148
+ if ( is_authed ) {
149
+ topush . message = "Apparently, people have been using our app too much..." ;
150
+ } else {
151
+ topush . message = "If you'd like to continue, please " +
152
+ "<button onclick='hello(\"github\").login()'>Log in</button>" ;
153
+ }
154
+ errors . push ( topush ) ;
155
+ }
156
+ NodeOsBlog . controller ( 'ErrorListCtrl' , function ( $scope ) {
157
+ $scope . removeError = function ( error ) {
158
+ var l = errors . length ;
159
+ while ( l -- ) {
160
+ if ( errors [ l ] == error ) return errors . splice ( l , 1 ) ;
161
+ }
162
+ } ;
163
+ $scope . errors = errors ;
164
+ var oldwinerr = window . onerror ;
165
+ window . onerror = function ( message , filename , lineno , colno , error ) {
166
+ if ( error !== undefined && error . hasOwnProperty ( "name" ) && error . name == "Magic" ) {
167
+ errors . push ( { name :"Uncaught Error: " + error . name , message : message + "<pre>" + error . stack + "</pre>" } ) ;
168
+ }
169
+ } ;
170
+ } ) ;
171
+ var hello = require ( "hello" ) ;
172
+ hello . on ( "auth.login" , function ( auth ) {
173
+ hello ( auth . network ) . api ( "/me" ) . then ( function ( r ) {
174
+ document . querySelector ( ".four-zero-three .content" ) . innerHTML ( "You've authenticated!" ) ;
175
+ } ) ;
176
+ } ) ;
177
+ var hash = url . parse ( document . location ) . hash ;
178
+ NodeOsBlog . controller ( 'BlogSingleCtrl' , function ( $scope , $http ) {
179
+ $scope . uriPath = "/NodeOS/NodeOS/issues/" + hash ;
180
+ $scope . blog = [ ] ;
181
+
182
+ var markdown = require ( "markdown" ) . markdown ;
183
+ $scope . parseMarkdown = function ( item , next ) {
184
+ try {
185
+ item . bodyHTML = markdown . toHTML ( item . body ) ;
186
+ } catch ( e ) {
187
+ item . bodyHTML = "<pre>" + item . body + "</pre>" ;
188
+ }
189
+ next ( item ) ;
190
+ } ;
191
+ $http . get ( 'https://api.github.com/repos' + $scope . uriPath )
192
+ . success ( function ( data , status , headers ) {
193
+ var l = data . labels . length ;
194
+ while ( l -- ) {
195
+ if ( data . labels [ l ] . name === "blog" ) {
196
+ break ;
197
+ }
198
+ }
199
+ if ( l < 0 ) {
200
+ return errors . push ( {
201
+ name :"Trying to load a non-blog?" ,
202
+ message : "I technically can't stop you since this is clientside." +
203
+ " Hopefully my code feels clean enough to hack"
204
+ } ) ;
205
+ }
206
+ $scope . parseMarkdown ( data , function ( item ) {
207
+ $scope . blog . push ( item ) ;
208
+ } ) ;
209
+ } ) . error ( function ( data , status , headers , config ) {
210
+ if ( status === 403 ) {
211
+ add403 ( ) ;
212
+ } else {
213
+ errors . push ( { name :"Bad issues list request: " + status , message : data . message } ) ;
214
+ }
215
+ } ) ;
216
+ } ) ;
217
+ NodeOsBlog . controller ( 'BlogListCtrl' , function ( $scope , $http ) {
218
+ $scope . uriPath = "/NodeOS/NodeOS/issues/" + hash + "/comments" ;
219
+ $scope . blog = [ ] ;
220
+ $scope . parseMarkdown = function ( item , next ) {
221
+ $http . post ( "https://api.github.com/markdown" , { text :item . body } )
222
+ . success ( function ( data ) {
223
+ item . bodyHTML = data ;
224
+ next ( item ) ;
225
+ } ) . error ( function ( data , status , headers , config ) {
226
+ errors . push ( { name :"Bad markdown call: " + status , message : data . message } ) ;
227
+ item . bodyHTML = "<pre>" + item . body + "</pre>" ;
228
+ next ( item ) ;
229
+ } ) ;
230
+ } ;
231
+ $scope . last = void ( 0 ) ;
232
+ $scope . loadMore = function ( page ) {
233
+ if ( $scope . last && $scope . last < page ) return ;
234
+ var i = 0 ;
235
+ var l = - 1 ;
236
+ $http . get ( 'https://api.github.com/repos' + $scope . uriPath + '?labels=blog&sort=created&page=' + page )
237
+ . success ( function ( data , status , headers ) {
238
+ if ( ! $scope . last ) $scope . last = headers . link ?headers . link . split ( "=" ) . pop ( ) :1 ;
239
+ l = data . length ;
240
+ if ( i === l ) return ; //No more
241
+ var iterator = function ( item ) {
242
+ $scope . blog . push ( item ) ;
243
+ i ++ ;
244
+ if ( i === l ) return ;
245
+ $scope . parseMarkdown ( data [ i ] , iterator ) ;
246
+ } ;
247
+ $scope . parseMarkdown ( data [ 0 ] , iterator ) ;
248
+ } ) . error ( function ( data , status , headers , config ) {
249
+ if ( status === 403 ) {
250
+ add403 ( ) ;
251
+ } else {
252
+ errors . push ( { name :"Bad issues list request: " + status , message : data . message } ) ;
253
+ }
254
+ } ) ;
255
+ } ;
256
+ $scope . loadMore ( 1 ) ;
257
+ } ) ;
258
+ </ script >
259
+ <!-- END: BIND DATA TO VIEW -->
260
+ < script type ="text/javascript " src ="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js " > </ script >
261
+ </ body >
262
+ </ html >
0 commit comments