Browse Source
show syndication links with icons in reply context
pull/96/head
Aaron Parecki
7 years ago
No known key found for this signature in database
GPG Key ID: 276C2817346D6056
6 changed files with
41 additions and
3 deletions
-
controllers/controllers.php
-
BIN
public/images/services/default.png
-
BIN
public/images/services/facebook.ico
-
BIN
public/images/services/github.ico
-
BIN
public/images/services/twitter.ico
-
views/new-post.php
|
|
@ -767,14 +767,38 @@ $app->get('/reply/preview', function() use($app) { |
|
|
|
} |
|
|
|
|
|
|
|
$mentions = array_values(array_unique($mentions)); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
$syndications = []; |
|
|
|
if($entry && isset($entry['syndication'])) { |
|
|
|
foreach($entry['syndication'] as $s) { |
|
|
|
$host = parse_url($s, PHP_URL_HOST); |
|
|
|
switch($host) { |
|
|
|
case 'twitter.com': |
|
|
|
case 'www.twitter.com': |
|
|
|
$icon = 'twitter.ico'; break; |
|
|
|
case 'facebook.com': |
|
|
|
case 'www.facebook.com': |
|
|
|
$icon = 'facebook.ico'; break; |
|
|
|
case 'github.com': |
|
|
|
case 'www.github.com': |
|
|
|
$icon = 'github.ico'; break; |
|
|
|
default: |
|
|
|
$icon = 'default.png'; break; |
|
|
|
} |
|
|
|
$syndications[] = [ |
|
|
|
'url' => $s, |
|
|
|
'icon' => $icon |
|
|
|
]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$app->response()['Content-type'] = 'application/json'; |
|
|
|
$app->response()->body(json_encode([ |
|
|
|
'canonical_reply_url' => $reply_url, |
|
|
|
'entry' => $entry, |
|
|
|
'mentions' => $mentions |
|
|
|
'mentions' => $mentions, |
|
|
|
'syndications' => $syndications, |
|
|
|
])); |
|
|
|
} |
|
|
|
}); |
|
|
|
Width: 32
|
Height: 32
|
Size: 1.7 KiB
|
|
|
@ -16,7 +16,7 @@ |
|
|
|
</div> |
|
|
|
<div class="reply-content"> |
|
|
|
<img src="" class="post-img hidden"> |
|
|
|
<div class="author"><span class="name"></span> <span class="url"></span></div> |
|
|
|
<div class="author"><div class="syndications"></div><span class="name"></span> <span class="url"></span></div> |
|
|
|
<h4 class="post-name hidden"></h4> |
|
|
|
<span class="content"></span> |
|
|
|
</div> |
|
|
@ -244,6 +244,13 @@ |
|
|
|
width: 48px; |
|
|
|
margin-right: 4px; |
|
|
|
} |
|
|
|
.reply-context .syndications { |
|
|
|
float: right; |
|
|
|
padding-right: 4px; |
|
|
|
} |
|
|
|
.reply-context .syndications img { |
|
|
|
width: 16px; |
|
|
|
} |
|
|
|
.reply-context .author { |
|
|
|
color: #777;
|
|
|
|
font-weight: bold; |
|
|
@ -582,6 +589,13 @@ $(function(){ |
|
|
|
} else { |
|
|
|
$("#form_rsvp").addClass("hidden"); |
|
|
|
} |
|
|
|
if(data.syndications) { |
|
|
|
$(".reply-context .syndications").html(''); |
|
|
|
for(var i in data.syndications) { |
|
|
|
var syn = data.syndications[i]; |
|
|
|
$(".reply-context .syndications").append('<a href="'+syn.url+'"><img src="/images/services/'+syn.icon+'"></a>'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$(".reply-context").removeClass("hidden"); |
|
|
|
} |
|
|
|