Created
November 1, 2013 11:06
-
-
Save lajunta/7263948 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function insert_medias(s){ | |
//var app_path="/kpy/dc"; | |
var app_path=""; | |
if(s==1){ | |
jsonurl=app_path+"/tempmedias/show"; | |
see_prefix=app_path+"/new_see/"; | |
$.getJSON(jsonurl, function(data) { | |
var items = []; | |
$.each(data, function(index, media) { | |
mediasrc=see_prefix+media.grid_id; | |
if(media.content_type.indexOf("image") != -1){ | |
items.push("\n<p align='center'><img class='img' src="+mediasrc+"></p>\n"); | |
} | |
if(media.content_type.indexOf("flash") != -1){ | |
items.push("\n<p align='center'><embed src="+mediasrc+"></embed></p>\n"); | |
} | |
}); | |
var ifrcontents=$("p.media_content iframe").contents(); | |
//ifrcontents.find("body").append(items.join('')); | |
var editor=$("#media_content").cleditor()[0]; | |
editor.execCommand("inserthtml",items.join(''),null,null); | |
$("#overlay").css("visibility","hidden"); | |
$("p.media_content iframe").trigger('focus'); | |
}); | |
}else{ | |
alert("文件上传出错"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment