<script language="javascript" type="text/javascript">
function check() {
var d = document.forms[0];
if (d.title.value.replace(/(^\s*)|(\s*$)/g, "") == "") {
alert("请填写视频地址或内容~");
return false;
}
if (d.textarea.value.length > 4000) {
var num = d.textarea.value.length - 4000;
alert("不能超过4000个字符!当前字数为:" + d.textarea.value.length + " 应减去:" + num + "个字");
return false;
}
return true;
}
var jq = jQuery.noConflict();
var istrue = false;
var radiourl = "";
var imageurl = "";
var playurl = "";
var user = "";
jq(document).ready(function () {
var cookie_info = ' <%=user_Mes%>';
if (cookie_info != "") {
user = cookie_info.split(',');
blogname.innerHTML = user[1];
img_user(user[0], "2"); //处理个人图片问题
}
//退出时,进行session和cookie的清空
jq("#uer_Exit").click(function () {
jq.ajax({
type: "post",
url: '/ashx/Dd_userExit.ashx',
data: { type: "exit", time: new Date().getDate() },
success: function (data) {
if (data == "1") {
window.location.href = "/Dd_login.aspx";
}
},
error: function () {
}
});
});
jq("#not-support").hide();
jq("#is-search").hide();
jq("#pb-video-preview-holder").hide();
var text = jq("#pb-text-title").val();
var edit = '<%=video_edit %>';
if (edit == "edit") {
//jq("#pb-video-thumb").attr("src", result);
}
jq("#pb-text-title").keyup(function () {
if (!istrue) {
title_check();
}
});
jq("#pb-text-title").mouseleave(function () {
if (!istrue) {
title_check();
}
});
jq("#pb-video-repick-btn").click(function () {
jq("#pb-video-preview-holder").hide();
jq("#pb-text-title-holder").show();
jq("#pb-text-title").val("");
});
jq("post-tag-input").click(function () { document.getElementById("post-tag-list").style.display = "none"; });
//发布
jq("#pb-submit").click(function () {
if (jq("#pb-main-title-name").html() == "转载视频") {
if (istrue == true) {
jq("#pb-submiting-tip").css("display", "");
jq.ajax({
url: "/ashx/Dd_Video_Save.ashx",
data: {
originID: "<%=video_originID %>",
ArticleID: "<%=text_ID %>",
CopyFrom: "<%=userid %>",
Order: "4",
state: "reship_Video",
userID: user[0],
radiourl: radiourl,
imageurl: imageurl,
content: jq('#pb-text-textarea').val(),
label: jq('#post-tag-input').val(),
check: jq('#pb-top-post').attr("checked"),
mark: "video_submit",
time: new Date().getDate()
},
success: function (data) {
if (data == "1") {
window.location.href = "/Default.aspx";
}
},
error: function () {
alert("视频地址不支持~~");
jq("#not-support").show();
}
});
}
else {
alert("视频地址不支持~~");
return false;
}
}
else {
if (istrue == true) {
jq("#pb-submiting-tip").css("display", "");
jq.ajax({
url: "/ashx/Dd_Video_Save.ashx",
data: { userID: user[0], radiourl: radiourl, imageurl: imageurl, content: jq('#pb-text-textarea').val(), label: jq('#post-tag-input').val(), check: jq('#pb-top-post').attr("checked"), state: "Video", mark: "video_submit", time: new Date().getDate() },
success: function (data) {
if (data == "1") {
window.location.href = "/Default.aspx";
}
else {
alert("发布失败~");
}
},
error: function () {
alert("视频地址不支持~~");
jq("#not-support").show();
}
});
}
else {
alert("视频地址不支持~~");
return false;
}
}
});
jq("#pb-cancel").click(function () {
if (confirm('确定要取消吗?')) {
window.location.href = "/Default.aspx";
}
})
jq("#pb-preview").click(function () {
if (check()) {
jq.ajax({
type: "post",
url: "/web/Dd_preview.aspx",
data: { title: jq("#pb-text-title").val(), address: imageurl, content: jq('#pb-text-textarea').val(), lable: jq('#post-tag-input').val(), type: "4", user: "视频预览", time: new Date().getTime() },
success: function () {
window.open("Dd_preview.aspx");
},
error: function () {
}
});
}
});
});
function title_check() {
if (jq("#pb-text-title").val() == "") {
jq("#not-support").hide();
jq("#is-search").hide();
return false;
}
jq("#not-support").hide();
jq("#is-search").show();
jq.ajax({
url: "/ashx/Dd_search_video_image.ashx",
data: { url: jq("#pb-text-title").val(), mark: "1" },
success: function (result) {
if (result == "error") {
jq("#not-support").show();
jq("#is-search").hide()
}
else {
var img_cont = result.split(',');
imageurl = img_cont[0];
radiourl = jq("#pb-text-title").val();
jq("#pb-text-title-holder").hide();
jq("#pb-video-thumb").attr("src", img_cont[0]);
jq("#pb-video-preview-holder").show();
jq("#is-search").hide();
jq("#text_content").text(img_cont[1]);
jq("#pb-text-textarea").text(img_cont[1]);
istrue = true;
}
},
error: function () {
jq("#not-support").show();
jq("#is-search").hide()
}
});
}
function lable_check() {
document.getElementById("post-tag-list").style.display = "none";
jq("#post-tag-input").focus();
}
</script>
发表评论:
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。