summaryrefslogtreecommitdiff
path: root/views/new-post.php
diff options
context:
space:
mode:
authorAaron Parecki <aaron@parecki.com>2016-08-06 16:13:16 +0000
committerAaron Parecki <aaron@parecki.com>2016-08-06 16:13:16 +0000
commit9c3ef26741621285c6e1a2b29e36ed1812320a6e (patch)
tree6f16e64c42a1cd1b2de22827856ae1962d2ff764 /views/new-post.php
parentdbb17a5182c883a33ad14ba808fdb666c75568f3 (diff)
add manual photo URL field
Diffstat (limited to 'views/new-post.php')
-rw-r--r--views/new-post.php16
1 files changed, 15 insertions, 1 deletions
diff --git a/views/new-post.php b/views/new-post.php
index 0d79767..8128c4a 100644
--- a/views/new-post.php
+++ b/views/new-post.php
@@ -27,6 +27,7 @@
<div class="form-group">
<label for="note_photo"><code>photo</code></label>
<input type="file" name="note_photo" id="note_photo" accept="image/*">
+ <a href="javascript:switchToManualPhotoURL();" id="note_manual_photo">enter photo url</a>
<br>
<div id="photo_preview_container" class="hidden">
<img src="" id="photo_preview" style="max-width: 300px; max-height: 300px;">
@@ -185,6 +186,17 @@ function replacePhotoWithPhotoURL(url) {
$("#note_photo").remove();
$("#photo_preview").attr("src", url);
$("#photo_preview_container").removeClass("hidden");
+ $("#note_manual_photo").addClass("hidden");
+}
+
+function switchToManualPhotoURL() {
+ $("#note_photo").after('<input type="url" name="note_photo_url" id="note_photo_url" value="" class="form-control">');
+ $("#note_photo").remove();
+ $("#note_photo_url").change(function(){
+ $("#photo_preview").attr("src", $(this).val());
+ $("#photo_preview_container").removeClass("hidden");
+ });
+ $("#note_manual_photo").addClass("hidden");
}
$(function(){
@@ -193,7 +205,7 @@ $(function(){
var hasMediaEndpoint = <?= $this->media_endpoint ? 'true' : 'false' ?>;
- $("#note_content, #note_category, #note_in_reply_to, #note_slug").on('keyup change', function(e){
+ $("#note_content, #note_category, #note_in_reply_to, #note_slug, #note_photo_url").on('keyup change', function(e){
saveNoteState();
})
@@ -233,8 +245,10 @@ $(function(){
});
$("#remove_photo").on("click", function(){
$("#note_photo").val("");
+ $("#note_photo_url").val("");
$("#photo_preview").attr("src", "" );
$("#photo_preview_container").addClass("hidden");
+ saveNoteState();
});
$("#note_content").on('change keyup', function(e){