summaryrefslogtreecommitdiff
path: root/themes/okadmin/public
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2016-03-28 19:10:26 -0400
committerJules Laplace <jules@okfoc.us>2016-03-28 19:11:20 -0400
commitd8e9b4d5334db049feec81b0083c3adcedaf7e12 (patch)
tree844a9fa3fe6cfd08ad4a4085c50dd9e139648b85 /themes/okadmin/public
parent49fe25c8e884c14ab3258d22240a62f0b57da490 (diff)
allow generic urls in media fieldv0.1.21
Diffstat (limited to 'themes/okadmin/public')
-rw-r--r--themes/okadmin/public/js/app.js38
-rw-r--r--themes/okadmin/public/js/parser.js4
2 files changed, 28 insertions, 14 deletions
diff --git a/themes/okadmin/public/js/app.js b/themes/okadmin/public/js/app.js
index da398eb..61fc8c8 100644
--- a/themes/okadmin/public/js/app.js
+++ b/themes/okadmin/public/js/app.js
@@ -47,17 +47,33 @@ var OKAdmin = function(){
$("ol", parent).prepend($el)
}
uploader.addVideo = function(media){
- console.log(media)
- var videoTemplate = $(".video-template", parent).html()
- var $el = $(videoTemplate)
- $el.addClass("loaded")
- $el.find(".video-type").val( media.type )
- $el.find(".video-token").val( media.token )
- $el.find(".video-title").val( media.title )
- $el.find(".video-thumb").val( media.thumbnail )
- $el.find("img").attr("src", media.thumbnail )
- $("ol", parent).prepend($el)
- }
+ switch (media.type) {
+ case 'youtube':
+ case 'vimeo':
+ case 'video':
+ var videoTemplate = $(".video-template", parent).html()
+ var $el = $(videoTemplate)
+ $el.addClass("loaded")
+ $el.find(".video-type").val( media.type )
+ $el.find(".video-token").val( media.token )
+ $el.find(".video-title").val( media.title )
+ $el.find(".video-thumb").val( media.thumbnail )
+ $el.find(".video-width").val( media.width )
+ $el.find(".video-height").val( media.height )
+ $el.find("img").attr("src", media.thumbnail )
+ $("ol", parent).prepend($el)
+ break
+ case 'link':
+ var linkTemplate = $(".link-template", parent).html()
+ var $el = $(linkTemplate)
+ $el.addClass("loaded")
+ $el.find(".uri").val( media.url )
+ $("ol", parent).prepend($el)
+ break
+ default:
+ alert("Unsupported link type!")
+ }
+ }
})
// delete image from gallery
$(document).on("mousedown", ".media-list .remove", function(){
diff --git a/themes/okadmin/public/js/parser.js b/themes/okadmin/public/js/parser.js
index 411f425..95b391c 100644
--- a/themes/okadmin/public/js/parser.js
+++ b/themes/okadmin/public/js/parser.js
@@ -145,7 +145,6 @@ var Parser = {
'&amp;color=ff6600&amp;auto_play=false&amp;show_artwork=true"></iframe>'
}
},
- /*
{
type: 'link',
regex: /^http.+/i,
@@ -163,8 +162,7 @@ var Parser = {
tag: function (media) {
return '<a href="' + media.url + '" target="_blank">' + media.url + '</a>'
}
- }
- */
+ },
],
tumblr: function(url, cb){