%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/bitrix/www/bitrix/components/bitrix/voting.vote.edit/templates/.default/
Upload File :
Create Path :
Current File : /home/bitrix/www/bitrix/components/bitrix/voting.vote.edit/templates/.default/script.min.js

(function(){if(window.BVoteConstructor)return;BX.addCustomEvent("onClickMulti",function(e){var i=BX.findChildren(e.parentNode.previousSibling,{attribute:{"data-bx-answer-field":"field-type"}},true);for(var t=0;t<i.length;t++){i[t].value=e.checked?"1":"0"}});top.BVoteConstructor=window.BVoteConstructor=function(e){this.controller=e.controller;this.maxQ=parseInt(e["maxQ"]);this.maxA=parseInt(e["maxA"]);this.q={num:0,cnt:0};this.a=[{num:0,cnt:0}];this.InitVoteForm()};window.BVoteConstructor.prototype.checkAnswerAdding=function(e){var i=BX("question_"+e);if(this.a[e].list){if(this.a[e].list.firstChild){BX.unbindAll(i);var t=this.a[e].list.firstChild;do{BX.unbind(t.firstChild,"focus",BX.proxy(this._do,this))}while((t=t.nextSibling)&&BX(t))}}if(this.maxA>0&&this.a[e].cnt>=this.maxA){if(this.a[e].node){BX.hide(this.a[e].node)}return false}if(this.a[e].node){BX.show(this.a[e].node)}else if(this.a[e].list){if(this.a[e].list.lastChild){BX.bind(this.a[e].list.lastChild.firstChild,"focus",BX.proxy(this._do,this))}else{BX.bind(i,"focus",BX.proxy(this._do,this))}}return true};window.BVoteConstructor.prototype.checkQuestionAdding=function(){if(this.maxQ>0&&this.q.cnt>=this.maxQ){if(this.q.node)this.q.node.style.display="none";return false}if(this.q.node)this.q.node.style.display="";return true};window.BVoteConstructor.prototype.InitVoteForm=function(){var e=BX.findChild(this.controller,{tagName:"OL",className:"vote-questions"},true),i=e.childNodes,t=/question_(\d+)/gi,s=!!i?t.exec(e.lastChild.firstChild.firstChild.id):[0,0,0];this.q.cnt=i.length;this.q.num=parseInt(s[1]);this.q.node=BX.findChild(this.controller,{tagName:"A",className:"addq"},true);var n,a,r,d;for(d=0;d<i.length;d++){if(i[d]&&i[d]["tagName"]=="LI"){n=BX.findChild(i[d],{tagName:"OL"},true);a=BX.findChildren(n,{tagName:"LI"},false);r=/answer_(\d+)__(\d+)_/gi;s=[0,0,0];if(n.lastChild){s=r.exec(n.lastChild.firstChild.id)}else{s=t.exec(i[d].firstChild.firstChild.id);s[2]=0}this.a[s[1]]={cnt:a.length,num:parseInt(s[2]),node:false,list:n};this.checkAnswerAdding(s[1])}}this.checkQuestionAdding();var l=["LABEL","A"],h;for(var o in l){if(l.hasOwnProperty(o)){h=BX.findChildren(e.parentNode,{tagName:l[o]},true);for(d in h){if(h.hasOwnProperty(d)&&!BX.hasClass(h[d],"vote-checkbox-label")){BX.bind(h[d],"click",BX.delegate(this._do,this))}}}}};window.BVoteConstructor.prototype._do=function(e){BX.PreventDefault(e);var i=/(add|del)\w/,t=BX.proxy_context,s=i.exec(BX.proxy_context.className),n,a,r,d,l,h,o;if(!!s){switch(s[0]){case"adda":var c=BX.findParent(t,{className:"vote-question",tagName:"li"});l=BX.findChild(c,{tagName:"OL"},true);o=/answer_(\d+)__(\d+)_/i;d=o.exec(t.getAttribute("id"));if(!d){o=/question_(\d+)/i;d=o.exec(t.getAttribute("id"))}d=!!d?d[1]:null;if(d!=null&&this.checkAnswerAdding(d)){this.a[d].num++;this.a[d].cnt++;n=BX.create("DIV",{html:BX.message("VOTE_TEMPLATE_ANSWER").replace(/#Q#/gi,d).replace(/#A#/gi,this.a[d].num).replace(/#A_FIELD_TYPE#/gi,BX("multi_"+d)&&BX("multi_"+d).checked?"1":"0").replace(/#A_VALUE#/gi,"").replace(/#A_PH#/gi,this.a[d].num+1)});r=BX.findChildren(n.firstChild,{tagName:"LABEL"},true);for(a in r){if(r.hasOwnProperty(a)&&!BX.hasClass(r[a],"vote-checkbox-label")){BX.bind(r[a],"click",BX.delegate(this._do,this))}}l.appendChild(n.firstChild);this.checkAnswerAdding(d)}break;case"dela":o=/answer_(\d+)__(\d+)_/i;d=o.exec(t.getAttribute("for"));d=!!d?d[1]:null;var f=BX.findParent(t,{tagName:"li"});l=BX.findParent(f,{tagName:"OL"});t=BX(t.getAttribute("for"));if(t.value!=""&&!confirm(BX.message("VVE_ANS_DELETE")))return false;l.removeChild(f);this.a[d].cnt--;this.checkAnswerAdding(d);break;case"addq":if(this.checkQuestionAdding()){h=BX.findChild(t.parentNode,{tag:"OL"},false);this.q.num++;this.q.cnt++;n=BX.message("VOTE_TEMPLATE_ANSWER").replace(/#A#/gi,0).replace(/#A_PH#/gi,1).replace(/#A_FIELD_TYPE#/gi,"0").replace(/#A_VALUE#/gi,"")+BX.message("VOTE_TEMPLATE_ANSWER").replace(/#A#/gi,1).replace(/#A_PH#/gi,2).replace(/#A_FIELD_TYPE#/gi,"0").replace(/#A_VALUE#/gi,"");n=BX.create("DIV",{html:BX.message("VOTE_TEMPLATE_QUESTION").replace(/#ANSWERS#/gi,n).replace(/#Q#/gi,this.q.num).replace(/#Q_VALUE#/gi,"").replace(/#Q_MULTY#/gi,"")});r=BX.findChildren(n.firstChild,{tagName:"LABEL"},true);for(a in r){if(r.hasOwnProperty(a)&&!BX.hasClass(r[a],"vote-checkbox-label")){BX.bind(r[a],"click",BX.delegate(this._do,this))}}this.a[this.q.num]={num:1,cnt:2,node:false,list:BX.findChild(n,{tag:"OL"},true,false)};h.appendChild(n.firstChild);BX("question_"+this.q.num).focus();this.checkQuestionAdding();this.checkAnswerAdding(this.q.num)}break;case"delq":d=t.getAttribute("for");var u=t.previousSibling;h=BX.findParent(u,{tagName:"OL"});d=parseInt(d.replace(/question_/gi,""));if(u.value!=""&&!confirm(BX.message("VVE_QUESTION_DELETE")))return false;h.removeChild(BX.findParent(u,{tagName:"LI"}));this.q.cnt--;this.checkQuestionAdding();break}}return true}})();
//# sourceMappingURL=script.map.js

Zerion Mini Shell 1.0