forked from ZnakZorro/onerss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
477 lines (391 loc) · 16.4 KB
/
index.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
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>OneRSS 3.0</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />
<!--link href='http://fonts.googleapis.com/css?family=PT+Sans+Narrow:400,700&subset=latin,latin-ext' rel='stylesheet' type='text/css'-->
<link href='css/font_PT_Sans_Narrow.css' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css/bootstrap.mi.css">
<link rel="stylesheet" href="css/telegap.css">
<style>
article {width: 100%;}
/*
article {
width: 30.95%;
float: left;
margin: 1%;
}
@media (max-width:1279px){
article {
width: 47.95%;
}
}
@media (max-width:599px){
article {
width: 100%;
float: none;
margin: 0;
}
}
*/
#infotest {display:block;}
</style>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript" charset="utf-8" src="js/kapiszon.js"></script>
<script type="text/javascript" charset="utf-8" src="rssone.list.js"></script>
<script type="text/javascript" charset="utf-8" src="cordova-2.2.0.js"></script>
<script type="text/javascript" charset="utf-8" src="js/telegap.js"></script>
<script type="text/javascript" charset="utf-8" src="js/popup.js"></script>
<script type="text/javascript" charset="utf-8" src="js/accelerometer.js"></script>
<script type="text/javascript" charset="utf-8">
var ___moje='eede2de857491ec7';
var ___self=false;
var menuOpen=false;
// The watch id references the current `watchAcceleration`
var watchID = null;
google.load("feeds", "1");
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
try {if (device.uuid) {document.getElementById('infotest').innerHTML=device.platform+'<br />'+device.uuid;} }
catch(err) {onDeviceReady();}
}
function onDeviceReady() {
try {if (device.uuid == ___moje) ___self=true;}
catch(er) {}
//document.getElementById('feeddiv').innerHTML='<h1>Czekamy</h1>';
document.addEventListener("resume", onResume, false);
document.addEventListener("pause", onPause, false);
document.addEventListener("online", onOnline, false);
document.addEventListener("offline", onOffline, false);
document.addEventListener("backbutton", onBackKeyDown, false);
document.addEventListener("menubutton", onMenuKeyDown, false);
//document.getElementById('test').innerHTML='onDeviceReady end<br />';
//pokazFEED();
//document.getElementById('infotest').innerHTML+=device.uuid+'<br />';
//document.getElementById('infotest').innerHTML+=device.platform+'<br />';
pokazFEED(czytajID());
document.getElementById("viewConfig").onclick=function(){viewConfig()};
// font
var font_family = localStorage.getItem('_font_');
var font_size = localStorage.getItem('_font_size_') || 15;
if (font_size || font_family){
var sheet_font = document.createElement('style');
sheet_font.innerHTML = 'body {';
if (font_size) sheet_font.innerHTML += 'font-size:'+font_size+'px;';
if (font_family) sheet_font.innerHTML += 'font-family:"'+font_family+'";';
sheet_font.innerHTML += '}';
document.body.appendChild(sheet_font);
}
// --font
startWatch();
}
function onResume() {
startWatch();
//document.getElementById('test').innerHTML='onResume<br />';
}
function onPause() {
stopWatch();
//document.getElementById('test').innerHTML='onPause<br />';
}
function onOnline() {
//document.getElementById('test').innerHTML='onOnline<br />';
}
function onOffline() {
///////////////
navigator.notification.alert(
'You are the winner!', // message
alertDismissed, // callback
'Game Over', // title
'Done' // buttonName
);
///////////
//document.getElementById('test').innerHTML='onOffline<br />';
var id=czytajID();
moveID(-1);
rssfeedsetup(id);
}
function onBackKeyDown() {
//document.getElementById('test').innerHTML='onBackKeyDown<br />';
navigator.app.backHistory();
//super.loadUrl("file:///android_asset/www/index.html");
//console.log('onBackKeyDown');
moveID(-1);
var id=czytajID();
//document.getElementById('test').innerHTML='onBackKeyDown '+opiszID();
if (id) rssfeedsetup(id); else onMenuKeyDown();
}
function onMenuKeyDown() {
if (menuOpen) {document.getElementById("menu").style.display="none"; zapal();menuOpen=false;}
else {document.getElementById("menu").style.display="block";zgas();menuOpen=true;}
}
function czytajID(){
var id=window.localStorage.getItem('__id__1') || '0';
if (id==='undefined') id='0';
return id;
}
function zapiszID(id){
window.localStorage.setItem('__id__1',id);
//document.getElementById('test').innerHTML+=' Z='+opiszID();
}
function moveID(kier){
var id1=window.localStorage.getItem('__id__1') || '0';
var id2=window.localStorage.getItem('__id__2') || '0';
var id3=window.localStorage.getItem('__id__3') || '0';
if (id1==='undefined') id1='0';
if (id2==='undefined') id2='0';
if (id3==='undefined') id3='0';
//console.log('move= '+kier+'='+id1+' '+id2+' '+id3)
if (kier>0){
window.localStorage.setItem('__id__1',id3);
window.localStorage.setItem('__id__2',id1);
window.localStorage.setItem('__id__3',id2);
}
if (kier<0){
window.localStorage.setItem('__id__1',id2);
window.localStorage.setItem('__id__2',id3);
window.localStorage.setItem('__id__3',id1);
}
//document.getElementById('test').innerHTML+=' M='+kier+'='+opiszID();
}
function gonext() {
var idmax=rssy.length;
var id=czytajID();
id++;
if (id>=idmax) id=0;
zapiszID(id);
rssfeedsetup(id);
}
function goback() {
var idmax=rssy.length-1;
var id=czytajID();
id--;
if (id<0) id=idmax;
zapiszID(id);
rssfeedsetup(id);
}
function goforwad() {
document.getElementById("menu").style.display="none";
zapal();
window.scrollTo(0,0);
onMenuKeyDown();
}
function goback___() {
document.getElementById("menu").style.display="none";
zapal();
window.scrollTo(0,0);
onBackKeyDown();
}
function koniec(){
try {navigator.app.exitApp();}
catch(err) {
window.scrollTo(0,0);
}
}
function uid(t){
var suma=0;
for (var i in t) {suma+=t.charCodeAt(i);}
return 'id'+suma;
}
function uidiv(url,i){
var feedcontainer=document.getElementById("feeddiv");
var uniqueId=uid(url);
var el = document.createElement('article');
el.className='col box';
el.style.display='none';
el.setAttribute("id",uniqueId);
feedcontainer.appendChild(el);
//document.getElementById('menu'+i).setClass('k'+uniqueId);
}
function pokazFEED(id){
document.getElementById("menu").style.display="none";
//document.getElementById('test').innerHTML+='feed '+id+' '+opiszID();
//var html='';
//html+='<div class="arty"><div class="art">Szczecin moje miasto</div></div>';
//document.getElementById("feeddiv").innerHTML=html;
moveID(1);
rssfeedsetup(id);
zapal();
//document.getElementById('test').innerHTML=opiszID();
}
function rssfeedsetup(id){
menuOpen=false;
zapiszID(id);
var godzin=localStorage.getItem('czas') || 24;
//console.log(godzin);
//if (id===undefined) id=0;
//console.log('rssfeedsetup id='+id);
//document.getElementById('test').innerHTML+='rss '+id+' '+opiszID();
kasuj();
//document.getElementById("feeddiv").innerHTML='<h1 class="hh1" style="background:'+kolory[id]+'">'+sekcje[id]+'</h1>';
document.getElementById("feeddiv").innerHTML='<h2 id="title"><button onClick="gonext();" class="btn btn-next"> \u00BB </button> '+sekcje[id]+' / '+godzin+'h</h2>';
for(var i in rssy[id]) {
//console.log(i);
var v = rssy[id][i].url;
var feedlimit=rssy[id][i].limit || 6;
var j=parseInt(i)+1;
uidiv(v,j);
var feedpointer=new google.feeds.Feed(v);
//feedpointer.includeHistoricalEntries()
feedpointer.setNumEntries(feedlimit);
feedpointer.load(displayfeed);
}
}
//=========================================================================
function displayfeed(result){
var godzin=localStorage.getItem('czas') || 24;
var last=localStorage.getItem('last') || 0;
var title=result.feed.title || 'Portal';
if (sekcja!='WIZUT') {
//var arr=title.split(' '); arr=arr.slice(0,3); title=arr.join(' ');
title=title.replace('Zachodniopomorski Uniwersytet Technologiczny','ZUT');
title=title.replace('Kanał RSS','');
}
if (title.length>40) {var arr=title.split(' '); arr=arr.slice(0,5); title=arr.join(' ');}
//Android.com.pl - Największe Polskie Centrum Google Android.
var id=czytajID();
var sekcja=sekcje[id];
var kolor=kolory[id];
var uniqueId=uid(result.feed.feedUrl);
var el = document.getElementById(uniqueId);
var rssheader='';
rssheader+='<div class="hh1 box" style="background:'+kolor+'">';
rssheader+='<span class="pull-left">'+title+'</span>';
rssheader+='<span class="pull-right"><button class="btn btn-info btn-small">⇑ top</button></span>';
rssheader+='</div>';
var thefeeds=result.feed.entries;
var rssoutput='<div class="arty box">';
var j=0;
var ilefeeds=thefeeds.length;
//console.log(rssy[id]);
//var ftitle=rssy[id][i].title;
//console.log(id+' '+i+' '+ftitle);
for (var i=0; i<ilefeeds; i++) {
j=i+1;
// czas -----------------------------------------
var delta = deltaCzas(thefeeds[i].publishedDate);
if (delta>godzin) continue;
// ostatnio
var rssczas = new Date(thefeeds[i].publishedDate);
var teraz=Date.parse(rssczas);
//console.log(last+'-'+teraz);
if (last>teraz) continue;
// czas ostatnio -----------------------------------------
//console.log(thefeeds[i]);
var link = korekta_link(thefeeds[i].link,thefeeds[i].content);
var image = szukaj_img(thefeeds[i].link,thefeeds[i].content);
rssoutput+='<div class="art">';
/*rssoutput+="<a href='javascript:void(0)' rel-title='" + thefeeds[i].title + "' rel-link='" + link + "' rel-lokalizacja='"+result.feed.title+"' rel-sekcja='"+sekcja+"' onClick='popup_open(this);'>";
rssoutput+="<span class='btn btn-small pull-right czas'>" + toDate(thefeeds[i].publishedDate) + "</span>";
rssoutput+="</a>";*/
rssoutput+="<button class='btn btn-small pull-right czas' rel-title='" + thefeeds[i].title + "' rel-link='" + link + "' rel-lokalizacja='"+result.feed.title+"' rel-sekcja='"+sekcja+"' onClick='popup_open(this);'>";
rssoutput+=toDate(thefeeds[i].publishedDate);
rssoutput+="</button>";
//rssoutput+="<a href='" + link + "' class='title' title='Internet' target='_blank' rel='external' >" + thefeeds[i].title + "</a>";
rssoutput+="<a href='javascript:void(0);' onClick='loadURL(\""+link+"\");' class='title' title='Internet' target='_blank' rel='external' >"+j+". " + thefeeds[i].title + "</a>";
//rssoutput+="<a class='btn btn-small' href='javascript:void(0);' onClick='loadURL(\""+link+"\");' > [>>>] </a>";
rssoutput+="<div class='well'>";
rssoutput+="<div class='image'>"+image+"</div>";
rssoutput+=thefeeds[i].contentSnippet;
rssoutput+="</div>";
rssoutput+='</div>';
}
rssoutput+='</div>';
if (rssoutput.length<50) {
rssheader='';
rssoutput='<p class="title"> \u2248 '+title+' \u2248 </p>';
}
{
el.innerHTML+=rssheader+rssoutput;
el.style.display='inline-block';
}
}
// =================================================================
</script>
</head>
<body onload="onLoad()" id="body">
<!--
<div><a href="javascript:void(0);" onClick="onMenuKeyDown();" class="btn">Menu</a> <b> PhoneGap test cordova</b></div>
-->
<div id="menu" style="width:100%; display:none; position:fixed; left:0; bottom:49px; background:#888; padding:2px; z-index:2;border-top:1px solid #444;">
<button onClick="pokazFEED(0);" class="btn btn-info">Szczecin</button>
<button onClick="pokazFEED(1);" class="btn btn-info">Wiadomosci</button>
<button onClick="pokazFEED(2);" class="btn btn-inverse">Portale</button>
<button onClick="pokazFEED(3);" class="btn btn-info">InfoTech</button>
<button onClick="pokazFEED(4);" class="btn btn-primary">Dzone</button>
<button onClick="pokazFEED(5);" class="btn btn-primary">WebDev</button>
<button onClick="pokazFEED(6);" class="btn btn-primary">Code</button>
<button onClick="pokazFEED(7);" class="btn btn-inverse">Allegro</button>
<button onClick="pokazFEED(8);" class="btn btn-success">WIZUT</button>
<button onClick="pokazFEED(9);" class="btn btn-inverse">Zapas</button>
<button onClick="viewInfo();" class="btn btn-warning">InfoSzczecin</button>
<!--button onClick="deviceInfo();" class="btn btn-warning">device Info</button-->
<button onClick="koniec();" class="btn btn-danger">Koniec</button>
<div class="batony" id="strefa_czasu">
<button onClick="zaznacz_czas();" class="h btn btn-mini btn-primary" id="zaznacz_czas" >0</button>
<button onClick="ustawCzas(this);" rel="6" class="h btn btn-mini btn-inverse" id="h6" title="do 6 godzin"> 6h </button>
<button onClick="ustawCzas(this);" rel="3" class="h btn btn-mini btn-inverse" id="h3" title="do 3 godzin"> 3h </button>
<button onClick="ustawCzas(this);" rel="12" class="h btn btn-mini btn-inverse" id="h12" title="do 12 godzin"> 12h </button>
<button onClick="ustawCzas(this);" rel="24" class="h btn btn-mini btn-inverse" id="h24" title="ostatnia doba"> 1d </button>
<button onClick="ustawCzas(this);" rel="72" class="h btn btn-mini btn-inverse" id="h72" title="ostatnie 3 dni"> 3d </button>
<button onClick="ustawCzas(this);" rel="168" class="h btn btn-mini btn-inverse" id="h168" title="ostatni tydzień"> 7d </button>
<button onClick="ustawCzas(this);" rel="0" class="h btn btn-mini btn-inverse" id="h0" title="infinity"> ∞ </button>
<button onClick="kasuj_czas();" class="h btn btn-mini btn-danger" id="kasuj_czas" >all</button>
</div>
</div>
<div id="test" style="display:none; padding:0.5em; border:1px solid gray; background:#eee;"></div>
<div id="feeddiv" class="wrapper fullwidth box"></div>
<div class="hh1"><button onClick="scroll();" class="btn btn-info btn-small pull-right "> ⇑ top</button></div>
<!--
<button onClick="podzielsie();" class="btn2 btn-inverse">Share1</button>
<button onClick="podzielsie2();" >Share2</button>
<input type="button" class="btn2 btn-info" onClick="podzielsie3();" value="Share3" />
-->
<div id="menufooter" style="position:fixed; left:0px; bottom:0px; background:#222; float:left; width:96%; padding:0.1% 2%; margin:0; opacity:0.8;z-index:2;border-top:1px solid #444;">
<button onClick="goback();" class="btn btn-line" style="float:left;"><img src="pliki/arr-left.png" /></button>
<button onClick="onMenuKeyDown();" class="btn btn-primary">Menu</button>
<button onClick="viewLSlinki(___self);" class="btn btn-danger">Linki</button>
<button onClick="viewRemotelinki(___self);" class="btn">zURL</button>
<button onClick="gonext();" class="btn btn-line" style="float:right;"><img src="pliki/arr-right.png" /></button>
</div>
<div id='infotest'></div>
<br /><br /><br />
<div id="popup" class="box">
<div id="popup_header"><h4 id="popup_title">Tytuł</h4> <a href="javascript:void(0)" class="btn btn-danger" onClick="popup_close();"> X </a></div>
<div id="popup_body" class="box">
</div>
<div id="popup_info"></div>
<div id="popup_config"><span class="btn btn-info" id="viewConfig">Config</span></div>
<div id="popup_menu"></div>
<div id="popup_footer"> <a href="javascript:void(0)" class="btn btn-danger" onClick="popup_close();">Close</a></div>
</div>
<!--
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://strona.pl" data-text="tytul" data-via="znakzorro" data-lang="pl" data-count="none">Tweetnij</a>
<br /><br /><br /><br />
<script>
(function(d,s,id){
var js,fjs=d.getElementsByTagName(s)[0];
if(!d.getElementById(id)){
js=d.createElement(s);
js.id=id;
js.src="http://platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js,fjs);
}
})
(document,"script","twitter-wjs");
</script>
-->
<script type="text/javascript">
//Socialite
/*
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
*/
//Socialite
</script>
</body>
</html>