This repository was archived by the owner on May 15, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
685 lines (398 loc) · 18.5 KB
/
index.html
File metadata and controls
685 lines (398 loc) · 18.5 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
<!DOCTYPE html>
<html>
<head>
<!-- Standard Meta -->
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<!-- Site Properties -->
<meta name="description" content="Peer Query is an open source query platform built on the Steem Blockchain. Ask questions, submit proposals, run contests and more with over half a million Steemians on all other Steem clients.">
<meta property="og:type" content="website">
<meta property="og:site_name" content="Peer Query">
<meta property="og:title" content="Peer Query: Ask, Contribute & Earn!">
<meta property="og:description" content="Peer Query is an open source query platform built on the Steem Blockchain. Ask questions, submit proposals, run contests and more with over half a million Steemians on all other Steem clients.">
<meta property="og:image" content="https://www.peerquery.com/assets/img/peerquery.png">
<meta property="fb:app_id" content="384491628645652">
<link rel="icon" type="image/x-icon" href="/assets/img/favicon.ico">
<meta name="application-name" content="Peer Query">
<title>Peer to Peer Collaboration powered by Steem!</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.13/semantic.min.css" />
<link rel="stylesheet" href="/assets/css/custom.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.13/semantic.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.13/components/visibility.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.13/components/sidebar.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.13/components/transition.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/1.8.6/showdown.min.js"></script>
<script src="/assets/scripts/timeago.js"></script>
<script src="https://cdn.steemjs.com/lib/latest/steem.min.js"></script>
<script src="https://steemit.github.io/sc2-angular/sc2.min.js"></script>
</head>
<body>
<!-- Page Contents -->
<div class="pusher">
<div class="ui inverted vertical masthead center aligned segment">
<div id="navbar"></div>
<div class="ui text container">
<h1 class="ui inverted header">
Imagine a World
</h1>
<h2>Where we could collaborate and reward seamlessly.</h2>
<a class="ui scroll huge right labeled primary icon button">
<i class="chevron down icon"></i>
It's possible with Steem
</a>
</div>
</div>
<div class="ui vertical stripe segment">
<div class="ui top aligned stackable grid container">
<!-- query type menu -->
<div class="ui five item menu">
<a class="item active" id="proposal" onClick="display(this)">
<i class="handshake icon"></i>
<span class="desktop-only">Trending proposals</span>
</a>
<a class="item" id="contest" onClick="display(this)">
<i class="game icon"></i>
<span class="desktop-only">Trending contests</span>
</a>
<a class="item" id="question" onClick="display(this)">
<i class="help circle outline icon"></i>
<span class="desktop-only">Trending questions</span>
</a>
<a class="item" id="quiz" onClick="display(this)">
<i class="pointing up icon"></i>
<span class="desktop-only">Trending quizzes</span>
</a>
<a class="item" id="gig" onClick="display(this)">
<i class="money icon"></i>
<span class="desktop-only">Trending gigs</span>
</a>
</div>
<!-- end of query type menu -->
<div class="row">
<div class="ten wide column">
<br/>
<!-- top questions -->
<div class="ui container">
<div class="ui active centered inline loader" id="post-loader" style="display:none"></div>
<div class="ui relaxed divided items" id="item-container">
</div>
</div>
</div>
<!-- end of top questions -->
<div class="six wide right floated column">
<!-- Top earners -->
<div class="ui container">
<br/>
<div class="ui active centered inline loader" id="responses-loader" style="display:none"></div>
<br/>
<div class="ui left pointing label grid" style="visibility:hidden" id="responses-label">
<div class="ui grid">
<div class="two wide column"><i class="big comments icon"></i></div>
<div class="fourteen wide column" id="responses-title"></div>
</div>
</div>
<div class="ui comments" id="responses-container">
</div>
</div>
<!-- end of top earners -->
</div>
</div>
<div class="row">
<div class="center aligned column">
<br/><br/>
<a class="ui huge button" id="more-button" style="visibility:hidden">More proposals</a>
</div>
</div>
</div>
</div>
<div class="ui vertical stripe segment">
<h3 class="ui center aligned header">What's the secret sauce?</h3>
<br/><br/>
<div class="ui last container">
<div class="ui three steps">
<div class="step">
<div class="content">
<div class="title"><i class="cubes icon"></i>Steem Blockchain</div>
<div class="description">
<p>The world's most powerful Blockchain, with the most processed transactions, instant transfers, conventional account names and feeless transfers.</p>
</div>
</div>
</div>
<div class="active step">
<div class="content">
<div class="title"><i class="power icon"></i>Computer intelligence</div>
<div class="description">
<p>The Steem Blockchain permanently stores user generated content - including your queries and their replies, while rewarding us for using it.</p>
</div>
</div>
</div>
<div class="step">
<div class="content">
<div class="title"><i class="world icon"></i>Uncensored community</div>
<div class="description">
<p>Blockchain-grade security means no-censorship of your earnings, no censoring of your account, no censoring or corruption of your content.</p></div>
</div>
</div>
</div>
</div>
</div>
<div class="ui vertical stripe segment">
<div class="ui text container">
<h3 class="ui header">Meet the Query interface of the Blockchain</h3>
<p>Peer Query is an open source query platform built on the Steem Blockchain. Ask questions, submit proposals, run contests and more with over half a million Steemians on all other Steem clients.</p>
<a class="ui large button" href="/@peerquery" target="_blank">See what's new in the Alpha</a>
<a class="ui large button" href="https://steem.io" target="_blank">Explore Steem</a>
<a class="ui disabled large button" href="#" target="_blank">Do it better; fork the code</a>
</div>
</div>
<!-- mounting div -->
<div id="temp" style="display:none"></div>
<!-- end of mounting div -->
<div id="footer"></div>
</div>
<script>
$("#navbar").load("/navbar.html"); //load the footer!!!
$("#footer").load("/footer.html"); //load the footer!!!
var converter = new showdown.Converter();
$(".scroll").click(function(event){
$('html, body').animate({scrollTop: '+=600px'}, 800);
});
$(document).ready(function() {
$('.ui.menu .ui.dropdown').dropdown({
on: 'hover'
});
$('.ui.menu a.item')
.on('click', function() {
$(this)
.addClass('active')
.siblings()
.removeClass('active')
;
});
});
steem.api.setOptions({ url: 'https://api.steemit.com' });
function display(element) {
document.getElementById("item-container").innerHTML = "";
document.getElementById("responses-container").innerHTML = "";
document.getElementById("more-button").style.visibility = "hidden";
document.getElementById("responses-label").style.visibility = "hidden";
document.getElementById("post-loader").style.display = "block";
document.getElementById("responses-loader").style.display = "block";
query = { tag: element.id, limit: 8 };
//console.log(query);
steem.api.getDiscussionsByTrending(query, function(err, results) {
//console.log(err, results);
if (err) { alert(err); return };
document.getElementById("post-loader").style.display = "none";
document.getElementById("responses-loader").style.display = "none";
document.getElementById("more-button").style.visibility = "visible";
var href = "";
var msg = "";
if(element.id == "proposal") { href = "/proposals"; msg = "More Proposals"; };
if(element.id == "contest") { href = "/contests"; msg = "More Constests"; };
if(element.id == "question") { href = "/questions"; msg = "More Questions"; };
if(element.id == "quiz") { href = "/quizzes"; msg = "More Quizzes"; };
if(element.id == "gig") { href = "/gigs"; msg = "More Gigs"; };
document.getElementById("more-button").innerText = msg;
document.getElementById("more-button").href = href;
if (results.length <= 1) return;
for (x in results) {
create_post_card(results[x]);
if (x == results.length -1) timeAgo();
}
get_responses_to_top(results[0]);
});
}
display(document.getElementById("proposal"));
function create_post_card(result) {
var html = converter.makeHtml(result.body);
document.getElementById("temp").innerHTML = html;
body_raw = $("#temp").text();
body1 = body_raw.replace(/ *\([^)]*\) */g, ""); //removes () and all content in it
body2 = body1.replace(/ *\[[^\]]*\] */g, ""); //removes [] and all content in it
body3 = body2.replace(/(?:https?|ftp):\/\/[\S\n]+/g, ''); //removes all links - targetted at image links
var summary = body3.substr(0, 150) + " ...";
summary = summary.replace(/\n/g, "");
var src = "/assets/img/image.png";
src = $('#temp img').attr('src');
document.getElementById("temp").innerHTML = "";
var item = document.createElement("div");
item.className = "item";
var image_div = document.createElement("div");
image_div.className = "ui small image";
var post_image = document.createElement("img");
post_image.onerror = function() {this.src='/assets/img/image.png'; this.onerror='';};
post_image.style.height = "124px";
post_image.style.width = "150px";
post_image.src = src;
image_div.appendChild(post_image);
var content_div = document.createElement("div");
content_div.className = "content";
var header_a = document.createElement("a");
header_a.className = "header";
header_a.href = "/" + result.parent_permlink + "/@" + result.author + "/" + result.permlink;
header_a.innerText = result.title;
var extra_div = document.createElement("div");
extra_div.className = "extra";
var author_a = document.createElement("a");
author_a.className = "ui blue image label";
author_a.href = "/@" + result.author;
var author_img = document.createElement("img");
author_img.onerror = function() {this.src='/assets/img/image.png'; this.onerror='';};
author_img.src = "https://img.busy.org/@" + result.author;
var author_span = document.createElement("span");
author_span.innerText = result.author;
var author_rep_div = document.createElement("div");
author_rep_div.className = "detail";
author_rep_div.title = "User's reputation";
author_rep_div.innerText = steem.formatter.reputation(result.author_reputation);
author_a.appendChild(author_img);
author_a.appendChild(author_span);
author_a.appendChild(author_rep_div);
var time_span = document.createElement("span");
var time_span_icon = document.createElement("i");
time_span_icon.className = "wait icon";
var time = document.createElement("span");
time.className = "timeago";
time.title = result.created;
time.innerText = result.created;
time_span.appendChild(time_span_icon);
time_span.appendChild(time);
extra_div.appendChild(author_a);
extra_div.appendChild(time_span);
var description_div = document.createElement("div");
description_div.className = "description";
description_div.innerText = summary;
var extra_label_div = document.createElement("div");
extra_label_div.className = "extra";
var a_category = document.createElement("a");
a_category.className = "ui label";
a_category.title = "Category";
a_category.href = "/tag/" + result.parent_permlink;
var i_category = document.createElement("i");
i_category.className = "tag icon";
var span_category = document.createElement("span");
span_category.innerText = result.parent_permlink;
a_category.appendChild(i_category);
a_category.appendChild(span_category);
var a_earned = document.createElement("a");
a_earned.className = "ui label";
a_earned.title = "Earned";
var i_earned = document.createElement("i");
i_earned.className = "dollar icon";
var span_earned = document.createElement("span");
span_earned.innerText = Math.max(Number(result.pending_payout_value.split(' ')[0]), Number(result.total_payout_value.split(' ')[0]) + Number(result.curator_payout_value.split(' ')[0])).toLocaleString();
a_earned.appendChild(i_earned);
a_earned.appendChild(span_earned);
var a_votes = document.createElement("a");
a_votes.className = "ui label";
a_votes.title = "Votes";
var i_votes = document.createElement("i");
i_votes.className = "heart icon";
var span_votes = document.createElement("span");
span_votes.innerText = Number(result.active_votes.length).toLocaleString();
a_votes.appendChild(i_votes);
a_votes.appendChild(span_votes);
var a_responses = document.createElement("a");
a_responses.className = "ui label";
a_responses.title = "Responses";
var i_responses = document.createElement("i");
i_responses.className = "comments icon";
var span_responses = document.createElement("span");
span_responses.innerText = result.children.toLocaleString();
a_responses.appendChild(i_responses);
a_responses.appendChild(span_responses);
extra_label_div.appendChild(a_category);
extra_label_div.appendChild(a_earned);
extra_label_div.appendChild(a_votes);
extra_label_div.appendChild(a_responses);
content_div.appendChild(header_a);
content_div.appendChild(extra_div);
content_div.appendChild(description_div);
content_div.appendChild(extra_label_div);
item.appendChild(image_div);
item.appendChild(content_div);
document.getElementById("item-container").appendChild(item);
}
function get_responses_to_top(result) {
document.getElementById("responses-title").innerText = result.title;
steem.api.getContentReplies(result.author, result.permlink, function(err, result) {
//console.log(err, result);
if(err) { alert(err); return }
document.getElementById("responses-label").style.visibility = "visible";
for(x in result) {
if(x == result.length -1) timeAgo();
if(x == "25") return;
create_comment(result[x]);
}
});
}
function create_comment(cmt) {
var md = cmt.body;
var html = converter.makeHtml(md);
var tmp = document.createElement('div');
tmp.innerHTML = html;
var img = tmp.getElementsByTagName('img')[0];
var src = "/img/thumbnail-placeholder.png";
if (img !== undefined || null) src = img.src;
var summary = tmp.innerText.replace(/\W+/g, " ");
summary = summary.substr(0, 100) + " ...";
var comment = document.createElement("div");
comment.className = "comment";
var a_avatar = document.createElement("a");
a_avatar.className = "avatar";
var img_avatar = document.createElement("img");
img_avatar.onerror = function() {this.src='/assets/img/image.png'; this.onerror='';};
img_avatar.src = "https://img.busy.org/@" + cmt.author;
a_avatar.appendChild(img_avatar);
var div_content = document.createElement("div");
div_content.className = "content";
var a_author = document.createElement("a");
a_author.className = "author";
a_author.href = "/@" + cmt.author;
a_author.innerText = "@" + cmt.author + "(" + steem.formatter.reputation(cmt.author_reputation) + ")";
var div_meta = document.createElement("div");
div_meta.className = "metadata";
var div_date = document.createElement("div");
div_date.className = "date";
var i_date = document.createElement("i");
i_date.className = "wait icon";
var span_date = document.createElement("span");
span_date.className = "timeago";
span_date.title = cmt.created;
div_date.appendChild(i_date);
div_date.appendChild(span_date);
var div_votes = document.createElement("div");
div_votes.className = "rating";
var i_votes = document.createElement("i");
i_votes.className = "heart icon";
var span_votes = document.createElement("span");
span_votes.innerText = Number(cmt.net_votes).toLocaleString();
div_votes.appendChild(i_votes);
div_votes.appendChild(span_votes);
var div_earned = document.createElement("div");
div_earned.className = "earned";
var i_earned = document.createElement("i");
i_earned.className = "dollar icon";
var span_earned = document.createElement("span");
span_earned.innerText = Math.max(Number(cmt.pending_payout_value.split(' ')[0]), Number(cmt.total_payout_value.split(' ')[0]) + Number(cmt.curator_payout_value.split(' ')[0])).toLocaleString();
div_earned.appendChild(i_earned);
div_earned.appendChild(span_earned);
div_comment = document.createElement("div");
div_comment.className = "text";
div_comment.innerText = summary;
div_meta.appendChild(div_date);
div_meta.appendChild(div_votes);
div_meta.appendChild(div_earned);
div_content.appendChild(a_author);
div_content.appendChild(div_meta);
div_content.appendChild(div_comment);
comment.appendChild(a_avatar);
comment.appendChild(div_content);
document.getElementById("responses-container").appendChild(comment);
}
</script>
</body>
</html>