You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
105 lines
4.2 KiB
JavaScript
105 lines
4.2 KiB
JavaScript
6 years ago
|
// JavaScript Document
|
||
|
// page ID: StoryWizard.js
|
||
|
// author: Wushitang
|
||
|
//Create Date:20110223
|
||
|
//describe: Story Wazard script..
|
||
|
|
||
|
function changTag(Re, ID, reach, tb){
|
||
|
//RE 前缀,字段名
|
||
|
//ID 记录ID
|
||
|
//reach 是否用textarea文本框
|
||
|
//tb 更新的表 main:sub
|
||
|
var objID = Re + ID;
|
||
|
var objJq = $("#"+objID);
|
||
|
var obj = objJq.get(0);
|
||
|
var oldHTML = objJq.html();
|
||
|
tb = tb=="main"?"main":"sub"
|
||
|
with(obj){
|
||
|
if(reach){
|
||
|
innerHTML = "<form class=\"ajaxForm\" id=\""+objID+"_form\" method=\"post\" name=\""+objID+"_form\" action=\"\" onsubmit=\"return setValue('"+objID+"',$('#"+objID+"_text').val());\"><div><textarea name=\"TextV\" onkeyup=\"setRows(this)\" class=\"ajaxText\" id=\""+objID+"_text\">"+oldHTML+"</textarea></div><div><input type=\"submit\" value=\"save\"/><input type=\"reset\" value=\"reset\"/></div><input type=\"hidden\" value=\""+ID+"\" name=\"id\"><input type=\"hidden\" value=\""+tb+"\" name=\"tb\"><input type=\"hidden\" name=\"ac\" value=\"UpdateStory\"/><input type=\"hidden\" name=\"Re\" value=\""+Re+"\"/></form>";
|
||
|
}else{
|
||
|
innerHTML = "<form class=\"ajaxForm\" id=\""+objID+"_form\" method=\"post\" name=\""+objID+"_form\" action=\"\" onsubmit=\"return setValue('"+objID+"',$('#"+objID+"_text').val());\"><div><input type=\"text\" name=\"TextV\" class=\"ajaxText\" value=\""+oldHTML+"\" id=\""+objID+"_text\"/></div><div><input type=\"submit\" value=\"save\"/><input type=\"reset\" value=\"reset\"/></div><input type=\"hidden\" value=\""+ID+"\" name=\"id\"><input type=\"hidden\" value=\""+tb+"\" name=\"tb\"><input type=\"hidden\" name=\"ac\" value=\"UpdateStory\"/><input type=\"hidden\" name=\"Re\" value=\""+Re+"\"/></form>";
|
||
|
}
|
||
|
}
|
||
|
objJq.parent().find("span.EditButton").hide();
|
||
|
setRows($("#"+objID+"_text").get(0));
|
||
|
}
|
||
|
|
||
|
|
||
|
function setValue(objID,txt){
|
||
|
var obj = document.getElementById(objID);
|
||
|
$.ajax({
|
||
|
url:"/community/do.asp",
|
||
|
data:$("#"+objID+"_form").serialize(),
|
||
|
type:"POST",
|
||
|
beforeSend:function(){$("#"+objID).find("input[type=submit]").attr({"disabled":"disabled","value":"waiting"})},
|
||
|
dataType:"xml",
|
||
|
success:function(msg){
|
||
|
//obj.innerHTML = txt;
|
||
|
if($(msg).find('statu').text()=="0"){
|
||
|
obj.innerHTML = $(msg).find("message").text();
|
||
|
$(obj).parent().find("span.EditButton").show();
|
||
|
}else{
|
||
|
$("#"+objID).find("input[type=submit]").attr({"disabled":"","value":"Save"})
|
||
|
alert($(msg).find("message").text());
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
function setRows(obj){
|
||
|
$(obj).height("");
|
||
|
var newH=$(obj).attr("scrollHeight");
|
||
|
if(newH<25){newH=25;}
|
||
|
$(obj).height(newH);
|
||
|
}
|
||
|
|
||
|
function StoryLoading(){
|
||
|
var iWidth = $(document).width();
|
||
|
var iHeight = $(window).height();
|
||
|
var DHeight = $(document).height();
|
||
|
$("body").css({'overflow':'scroll','overflow-y':'hidden'});
|
||
|
$("<div id=\"StoryLoading\"><div class=\"lodding\" align=center><div>Loading....</div><img src=\"/pic/horloading.gif\"/></div></div>")
|
||
|
.css({'width':iWidth+"px",'height':DHeight+"px"}).children().css('margin-top',(iHeight-30)/2 + "px").end()
|
||
|
.appendTo("body");
|
||
|
$(window).scroll(function(){$("#StoryLoading").children().css('margin-top',($(window).height()-30)/2 +$(window).scrollTop()+ "px")})
|
||
|
.resize(function(){$("#StoryLoading").children().css('margin-top',($(window).height()-30)/2 +$(window).scrollTop()+ "px")});
|
||
|
}
|
||
|
function stopLoding(){
|
||
|
$("#StoryLoading").remove();
|
||
|
$(window).scroll(function(){}).resize(function(){});
|
||
|
$("body").css({'overflow':'','overflow-y':''});
|
||
|
}
|
||
|
|
||
|
function loadingTravelStory(){
|
||
|
$.ajax({
|
||
|
url:"/community/do.asp",
|
||
|
data:"ac=loadStory&SN="+$("#coldsn").val(),
|
||
|
beforeSend:StoryLoading,
|
||
|
type:"POST",
|
||
|
dataType:'xml',
|
||
|
success:function(msg){
|
||
|
alert($(msg).find('message').text()+$(msg).find('nowid').text());
|
||
|
stopLoding();
|
||
|
if($(msg).find('statu').text()=="0"){
|
||
|
$("input[name=PostOrderId]").click();
|
||
|
//$("#selectGP").submit()
|
||
|
}
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
|
||
|
function storyView(cancel){
|
||
|
//$("#detail").find("span .EditButton").remove();
|
||
|
if(cancel == "r"){
|
||
|
$("#detail,.UPbutton").find("span .EditButton").remove();
|
||
|
$(".UPbutton").remove();
|
||
|
}else if(cancel == "s"){
|
||
|
$("#detail,.UPbutton").find("span .EditButton").show();
|
||
|
$(".UPbutton").show();
|
||
|
}else{
|
||
|
$("#detail,.UPbutton").find("span .EditButton").hide();
|
||
|
$(".UPbutton").hide();
|
||
|
}
|
||
|
}
|