diff options
Diffstat (limited to 'views')
-rw-r--r-- | views/new-bookmark.php | 8 | ||||
-rw-r--r-- | views/new-post.php | 8 | ||||
-rw-r--r-- | views/settings.php | 48 |
3 files changed, 54 insertions, 10 deletions
diff --git a/views/new-bookmark.php b/views/new-bookmark.php index 35e1907..0181dae 100644 --- a/views/new-bookmark.php +++ b/views/new-bookmark.php @@ -32,11 +32,11 @@ <input type="text" id="note_category" value="<?= $this->bookmark_tags ?>" class="form-control" placeholder="e.g. web, personal"> </div> + <?php if($this->syndication_targets): ?> <div class="form-group"> <label for="note_syndicate-to">Syndicate <a href="javascript:reload_syndications()">refresh</a></label> <div id="syndication-container"> <?php - if($this->syndication_targets) { echo '<ul>'; foreach($this->syndication_targets as $syn) { echo '<li>' @@ -47,13 +47,11 @@ . '</li>'; } echo '</ul>'; - } else { - ?><div class="bs-callout bs-callout-warning">No syndication targets were found on your site. - You can provide a <a href="/docs#syndication">list of supported syndication targets</a> that will appear as checkboxes here.</div><?php - } ?> </div> </div> + <?php endif ?> + </form> diff --git a/views/new-post.php b/views/new-post.php index b31d2be..ec74b28 100644 --- a/views/new-post.php +++ b/views/new-post.php @@ -78,11 +78,12 @@ <?php endif ?> + + <?php if($this->syndication_targets): ?> <div class="form-group" style="margin-top: 1em;"> <label for="note_syndicate-to">Syndicate <a href="javascript:reload_syndications()">(refresh list)</a></label> <div id="syndication-container"> <?php - if($this->syndication_targets) { echo '<ul>'; foreach($this->syndication_targets as $syn) { echo '<li>' @@ -93,13 +94,10 @@ . '</li>'; } echo '</ul>'; - } else { - ?><div class="bs-callout bs-callout-warning">No syndication targets were found on your site. - You can provide a <a href="/docs#syndication">list of supported syndication targets</a> that will appear as checkboxes here.</div><?php - } ?> </div> </div> + <?php endif ?> <div class="form-group"> <label for="note_location">Location</label> diff --git a/views/settings.php b/views/settings.php index 247aaf6..be32df8 100644 --- a/views/settings.php +++ b/views/settings.php @@ -50,11 +50,39 @@ </table> + <h3>Syndication Targets</h3> + + <div class="form-group"> + <label for="note_syndicate-to"><a href="javascript:reload_syndications()">Reload</a></label> + <div id="syndication-container"> + <?php + if($this->syndication_targets) { + echo '<ul>'; + foreach($this->syndication_targets as $syn) { + echo '<li>' + . '<button data-syndicate-to="'.(isset($syn['uid']) ? htmlspecialchars($syn['uid']) : htmlspecialchars($syn['target'])).'" class="btn btn-default btn-block">' + . ($syn['favicon'] ? '<img src="'.htmlspecialchars($syn['favicon']).'" width="16" height="16"> ' : '') + . htmlspecialchars($syn['target']) + . '</button>' + . '</li>'; + } + echo '</ul>'; + } else { + ?><div class="bs-callout bs-callout-warning">No syndication targets were found on your site. + Your server can provide a <a href="/docs#syndication">list of supported syndication targets</a> that will appear as checkboxes here.</div><?php + } + ?> + </div> + </div> + + + <h3>Twitter</h3> <p>Connecting a Twitter account will automatically "favorite" and "retweet" tweets on Twitter when you favorite and retweet a Twitter URL in Quill.</p> <input type="button" id="twitter-button" value="Checking" class="btn"> + <h3>Backwards Compatibility</h3> <p>You can customize some of the properties that are sent in the Micropub request to work with your specific endpoint.</p> @@ -139,5 +167,25 @@ $(function(){ }); }); + + }); + +function reload_syndications() { + $.getJSON("/micropub/syndications", function(data){ + if(data.targets) { + $("#syndication-container").html('<ul></ul>'); + for(var i in data.targets) { + var target = data.targets[i].target; + var uid = data.targets[i].uid; + var favicon = data.targets[i].favicon; + $("#syndication-container ul").append('<li><button data-syndicate-to="'+htmlspecialchars(uid ? uid : target)+'" class="btn btn-default btn-block">'+(favicon ? '<img src="'+htmlspecialchars(favicon)+'" width="16" height="16"> ':'')+htmlspecialchars(target)+'</button></li>'); + } + bind_syndication_buttons(); + } else { + + } + console.log(data); + }); +} </script> |