summaryrefslogtreecommitdiff
path: root/views/new-post.php
diff options
context:
space:
mode:
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){