|
|
|
@ -354,16 +354,7 @@ function enablePasteImg(_editor) {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function df() {
|
|
|
|
|
var haspicContainer = document.getElementById("has_pic");
|
|
|
|
|
if (haspicContainer == null) {
|
|
|
|
|
haspicContainer = document.createElement("div");
|
|
|
|
|
haspicContainer.id = "has_pic";
|
|
|
|
|
haspicContainer.innerHTML = "<input type='text' id='piclist' value='' style='display:none;'/><div id='upload'><b>您有图片需要上传到服务器</b> <a href='javascript:uploadpic();' >上传</a></div><div id='confirm'></div>";
|
|
|
|
|
$(".ke-toolbar").after(haspicContainer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var img = $(".ke-edit-iframe").contents().find("img");
|
|
|
|
|
|
|
|
|
|
var piccount = 0;
|
|
|
|
|
var sstr = "";
|
|
|
|
|
$(img).each(function (i) {
|
|
|
|
@ -376,26 +367,17 @@ function df() {
|
|
|
|
|
sstr += that.attr("src") + "|";
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$("#piclist").val(sstr);
|
|
|
|
|
document.getElementById("has_pic").style.display = (piccount > 0) ? "block" : "none";
|
|
|
|
|
uploadpic(sstr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function closeupload() {
|
|
|
|
|
$("#has_pic").hide();
|
|
|
|
|
$("#upload").show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function uploadpic() {
|
|
|
|
|
var piclist = encodeURI($("#piclist").val());
|
|
|
|
|
function uploadpic(piclist) {
|
|
|
|
|
if (piclist.length == 0) return false;
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "/kindeditor/uploadpic",
|
|
|
|
|
data: "pic=" + piclist,
|
|
|
|
|
type: "GET",
|
|
|
|
|
beforeSend: function () {
|
|
|
|
|
$("#upload").hide();
|
|
|
|
|
$("#confirm").text("正在上传中...");
|
|
|
|
|
$("#ajax-indicator").text("图片上传中请稍等...");
|
|
|
|
|
},
|
|
|
|
|
success: function (msg) {
|
|
|
|
|
if (msg !== "") {
|
|
|
|
@ -403,17 +385,19 @@ function uploadpic() {
|
|
|
|
|
str = msg.split('|');
|
|
|
|
|
var img = $(".ke-edit-iframe").contents().find("img");
|
|
|
|
|
|
|
|
|
|
var tIndex = 0;
|
|
|
|
|
$(img).each(function (i) {
|
|
|
|
|
var that = $(this);
|
|
|
|
|
if (that.attr("src").indexOf("http://") >= 0 || that.attr("src").indexOf("https://") >= 0) {
|
|
|
|
|
that.attr("src", "/uploads/image/" + str[i]);
|
|
|
|
|
that.attr("data-ke-src", "/uploads/image/" + str[i]);
|
|
|
|
|
that.attr("src", str[tIndex]);
|
|
|
|
|
that.attr("data-ke-src", str[tIndex]);
|
|
|
|
|
that.parent().attr("href", str[tIndex]);
|
|
|
|
|
that.parent().attr("data-ke-src", str[tIndex]);
|
|
|
|
|
tIndex = tIndex + 1;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$("#confirm").html(img.length + "张图片已经上传成功! <a href='javascript:closeupload();'>关闭</a>");
|
|
|
|
|
}
|
|
|
|
|
else $("#confirm").text("上传失败!");
|
|
|
|
|
// else $("#confirm").text("上传失败!");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|