TXT

upload

By Amanda Rodriguez,2014-04-12 16:49
11 views 0
upload

var _classTable=new classTable();var upload={};upload.info={title_tip:"请输入标题

    ",summary_tip:"简要介绍资料的主要内容?以获得更多的关注",no_title:"请填写文档标题

    ",title2long:"标题过长?请删减",no_summary:"请简要填写文档介绍",summary2long:"

    档介绍过长?请删减",unaccept_chars:"抱歉?您输入的字符我们暂不支持?请修改

    ",kw2long:"每个关键词最多10个汉字",kw_tip:";选填?多个关键词用逗号分隔;

    ",kw2many:"您最多可以添加5个关键词

    "};upload.start=function(A){login.check(function(){var

    B=cookie.get("BDUSS");baidu.swf.getMovie("uploader").NS_IK_doUpload(B);upload.changeStepTo(2);upload.initForm(A)});return 0};upload.changeStepTo=function(B){var A=(B==1)?2:1;baidu.hide("step"+A);baidu.show("step"+B)};upload.initForm=function(E,F){var C=new sForm();C.inputCheck("title",100);C.inputCheck("summary",400);var B=G("title");B.focus();B.value=E;var

    D=G("summary");if(F){D.focusFlag=true}else{D.value=upload.info.summary_tip;baidu.addClass(D,"init")}_classTable.create();var

    A=cookie.get("LASTCID");if(A){_classTable.set(A)}baidu.on("priceList","change",function(){G("nonFreeCharge").checked=true});baidu.on("uploadForm","submit",function(H){baidu.preventDefault(H);upload.checkForm()});sug=baidu.suggestion.create("keyword",{onpick:sug_opt.onpick,onconfirm:sug_opt.onconfirm,onhighlight:sug_opt.onhighlight,onhide:sug_opt.onhide,getData:function(I){var

    J=sug_opt.parse(I);if(J==""){return false}var

    H="http://nssug.baidu.com/su?wd="+encodeURIComponent(J)+"&t="+(new Date()).getTime()+"&prod=iknow-team";baidu.loadJS(H,{id:"sug_req"})},append_html:"",prepend_html:""})};upload.setPrice=function(B){if(B=="0"){return }G("nonFreeCharge").checked=true;var

    A=baidu.GT("option",G("priceList"));baidu.each(A,function(C){if(C.value==B){C.selected=true}})};upload.success=function(A){log.send("submit","uploadsuccess");document.uploadForm.doc_id.value=A;var

    B=G("submitBtn");B.disabled=false;baidu.removeClass(B,"btn-disable");baidu.hide("disableTip");baidu.on(B,"mouseover",function(){baidu.addClass(this,"btn-over")});baidu.on(B,"mouseout",function(){baidu.removeClass(this,"btn-over")})};upload.checkForm=function(){var

    A=false;baidu.each([G("title"),G("summary")],function(B){if(A){return false}var C=G(B.id+"Info");if(this.errFlag){baidu.addClass(this,"input-err");this.focus();A=true;return

    false}if(B.value==upload.info[B.id+"_tip"]||B.value.length==0){C.innerHTML=upload.info["no_"+B.id];baidu.addClass(C,"error");A=true;baidu.addClass(this,"input-err");this.checkFailed=true;this.focus();return

    false}});if(!A){upload.doSubmit()}};upload.rememberCid=function(A){if(cookie.get("LASTCID")){cookie.del("LASTCID")}cookie.set("LASTCID",A)};upload.doSubmit=function(){var

    A=document.uploadForm;A.price.value=(G("freeCharge").checked)?"0":G("priceList").options[G("priceList").selectedIndex].value;var

    B=_classTable.get();A.cid1.value=B[0];A.cid2.value=B[1];A.cid3.value=B[2];upload.rememberCid(B.join("-"));log.send("submit","uploaddesc");setTimeout(function(){

pop.show("文档上传成功

    ",{url:"/static/html/empty.html",width:440,height:270});A.submit()},500)};function setUploaderHeight(A){baidu.swf.getMovie("uploader").height=A}function sForm(){this.inputCheck=function(E,C){var

    D=G(E+"Info");baidu.each(["focus","keyup"],function(F){baidu.on(E,F,function(){if(E=="summary"&&!this.focusFlag){this.value="";this.focusFlag=true;baidu.removeClass(this,"init")}if(F=="keyup"){baidu.removeClass(this,"input-err")}if((E=="title"&&A(this.value))||B(this.value)){D.innerHTML=upload.info.unaccept_chars;baidu.addClass(D,"error");this.errFlag=true;return }var

    I=C-this.value.byteLength();if(I>=0&&!this.checkFailed){D.innerHTML="还可以输入

    "+parseInt(I/2)+"";baidu.removeClass(D,"error")}else{var

    H=this.value;while(H.byteLength()>C){H=H.substring(0,H.length-1)}this.value=H}this.errFlag=this.checkFailed=false;baidu.show(D)})});baidu.on(E,"blur",function(){if(this.errFlag){return }D.innerHTML=" "})};function A(E){var C=false;var D=[/\\/,/\//,/:/,/\*/,/\?/,/"/,//,/\|/,/;/];baidu.each(D,function(H,F){if(H.test(E)){C=true}});return C}function B(D){for(var C=0;CE=D.charCodeAt(C);if((E>12592)&&(E<12687)){return

    true}if((E>=44032)&&(E<=55203)){return true}}return false}}var sug={};var sug_opt={oldstr:"",maxlenth:20,sp:",",onpick:function(C,A,D,B){sug_opt.oldstr=D},onconfirm:function(C,A,D,B){G("keyword").focus();sug_opt.oldstr=D},onhighlight:function(C,A,D,B){},onhide:function(){},getdata:function(E,D){var B=[];var A=(D.length>5)?5:D.length;for(var

    C=0;Ca(E,B)},parse:function(D){D=D.replace(//g,",",D);var B=D.split(this.sp);var

    C=B.pop();this.oldstr=(B.length>0)?B.slice(0,5).join(this.sp)+this.sp:"";var A=this.check(C,B);return(A)?C:""},check:function(H,A){var F=G("keywordInfo");var E=G("keyword");if(A.length>=5){E.value=this.oldstr;this.showErr("kw2many");return false}var C=[];A.push(H);for(var D=0;D

    B=A[D].trim();if(B.byteLength()>this.maxlenth){this.showErr("kw2long")}C.push(B)}return true},showErr:function(A){var

    B=G("keywordInfo");B.innerHTML=upload.info[A];baidu.addClass(B,"error");setTimeout(function(){baidu.removeClass(B,"error");B.innerHTML=upload.info.kw_tip},5000)},getSugTag:function(){var B=_classTable.get();var

    A="/async?ct=20026&cid1="+B[0]+"&cid2="+B[1]+"&cid3="+B[2]+"&callback=sug_opt.setSugTag&_t="+(new

    Date()).getTime();baidu.loadJS(A,{id:"sug_tag_req"})},setSugTag:function(B){var E=G("sugTags");E.innerHTML="";if(B.length==0){return }var

    A=document.createElement("p");A.innerHTML="常用关键词推荐?

    ";E.appendChild(A);for(var D=0;D

    C=document.createElement("a");C.href="javascript:void(0)";C.innerHTML=B[D];baidu.on(C,"click",function(H){if(this.disabled){return }var

    F=G("keyword");F.focus();F.value=F.value+this.innerHTML+sug_opt.sp;sug_opt.parse(F.value);baidu.addClass(this,"selected");this.disabled=true;baidu.preventDefault(H)});E.appendChild(C)}}};

Report this document

For any questions or suggestions please email
cust-service@docsford.com