%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/bitrix/www/bitrix/components/bitrix/voting.current/templates/.userfield/
Upload File :
Create Path :
Current File : //home/bitrix/www/bitrix/components/bitrix/voting.current/templates/.userfield/script.min.js

(function(t){var e=t.BX;if(e["Vote"])return;e.Vote=function(){var t=function(){};t.prototype={};return t}();var i={};e.Vote.init=function(t){i[t["cid"]+"_count"]=i[t["cid"]+"_count"]||1;if(i[t["cid"]+"_count"]>100)throw"Vote with cid "+t["cid"]+" could not be found.";else if(!e("vote-"+t["cid"]))setTimeout(function(){e.Vote.init(t)},100);else if(!e("vote-"+t["cid"]).hasAttribute("data-bx-bound")){e("vote-"+t["cid"]).setAttribute("data-bx-bound","vote");i[t["cid"]]=new r({CID:t["cid"],controller:e("vote-"+t["cid"]),urlTemplate:t["urlTemplate"],nameTemplate:t["nameTemplate"],url:t["url"],voteId:t["id"],startCheck:t["startCheck"]});if(e("vote-"+t["cid"]+"-stop")){e.bind(e("vote-"+t["cid"]+"-stop"),"click",function(i){n(this,t["cid"],this.href,{VOTE_ID:t["id"],stopVoting:t["id"]});return e.PreventDefault(i)})}else if(e("vote-"+t["cid"]+"-resume")){e.bind(e("vote-"+t["cid"]+"-resume"),"click",function(i){n(this,t["cid"],this.href,{VOTE_ID:t["id"],resumeVoting:t["id"]});return e.PreventDefault(i)})}if(e("vote-"+t["cid"]+"-revote")){e.bind(e("vote-"+t["cid"]+"-revote"),"click",function(i){n(this,t["cid"],this.href,{VOTE_ID:t["id"],view_form:"Y"});return e.PreventDefault(i)})}if(e("vote-"+t["cid"]+"-act")){e.bind(e("vote-"+t["cid"]+"-act"),"click",function(i){e.addClass(e("vote-"+t["cid"]+"-act"),"feed-add-button-load");var s=e("vote-form-"+t["cid"]);if(!!s){n(this,t["cid"],s.action,e.ajax.prepareForm(s).data)}return e.PreventDefault(i)})}if(e("vote-"+t["cid"]+"-results")){e.bind(e("vote-"+t["cid"]+"-results"),"click",function(n){var r=this,a=i[t["cid"]].controller;o(r);e.addCustomEvent(a,"OnBeforeChangeData",function(){var t=e.findParent(a,{className:"bx-vote-block"});e.addClass(t,"bx-vote-block-result");s(r)});e.addCustomEvent(a,"OnAfterChangeData",function(){if(!!r)e.hide(r)});i[t["cid"]].send(true);return e.PreventDefault(n)})}}};var s=function(t){e.removeClass(t,"bx-vote-loading")},o=function(t){e.addClass(t,"bx-vote-loading")},n=function(t,n,r,a){if(t.disabled===true)return false;r=r.replace(/.AJAX_RESULT=Y/g,"").replace(/.AJAX_POST=Y/g,"").replace(/.sessid=[^&]*/g,"").replace(/.VOTE_ID=([\d]+)/,"").replace(/.view_form=Y/g,"").replace(/.view_result=Y/g,"");a["AJAX_POST"]="Y";a["sessid"]=e.bitrix_sessid();o(t);e.ajax({method:"POST",processData:false,url:r,data:a,onsuccess:function(o){s(t);var r=e.processHTML(o,false),a=e.findParent(t,{className:"bx-vote-block"});if(!!a){a.innerHTML=r.HTML;e.removeClass(a,"bx-vote-block-result");e.removeClass(a,"bx-vote-block-result-view");if(r.HTML.indexOf("<form")<0){e.addClass(a,"bx-vote-block-result")}e.defer(function(){e.ajax.processScripts(r.SCRIPT)})()}if(i[n]){i[n].__destruct();i[n]=null;delete i[n]}}});return true};var r=function(){var t=function(t){this.CID=t["CID"];this.url=t["url"];this.urlTemplate=t["urlTemplate"];this.nameTemplate=t["nameTemplate"];this.dateTemplate=t["dateTemplate"];this.data={};this.popup=null;this.controller=t["controller"];this.startCheck=!!t["startCheck"]?parseInt(t["startCheck"]):false;this.voteId=t["voteId"];this.status="ready";this.__construct()};t.prototype={__construct:function(){var t=e.findChildren(this.controller,{tagName:"A",className:"bx-vote-voted-users"},true),i,s=e.delegate(function(){this.get()},this);for(i in t){if(t.hasOwnProperty(i)){e.bind(t[i],"click",s)}}this.onPullEvent=e.delegate(function(t,i){if(t=="voting"&&!!i&&i["VOTE_ID"]==this.voteId){var s=e.findParent(this.controller,{className:"bx-vote-block"});if(!!s&&e.hasClass(s,"bx-vote-block-result")){this.changeData(i)}}},this);e.addCustomEvent("onPullEvent-vote",this.onPullEvent)},__destruct:function(){var t=e.findChildren(this.controller,{tagName:"A",className:"bx-vote-voted-users"},true),i;if(!!t){for(i in t){if(t.hasOwnProperty(i)){e.unbindAll(t[i])}}}e.removeCustomEvent("onPullEvent",this.onPullEvent)},init:function(t){var i=e.proxy_context;if(!!i.timeoutOver){clearTimeout(i.timeoutOver);i.timeoutOver=false}if(t.type=="mouseover"){i.timeoutOver=setTimeout(e.proxy(function(){this.get(i);if(this.popup){e.bind(this.popup.popupContainer,"mouseout",e.proxy(function(){this.popup.timeoutOut=setTimeout(e.proxy(function(){if(this.node==i&&!!this.popup){this.popup.close()}},this),400)},this));e.bind(this.popup.popupContainer,"mouseover",e.proxy(function(){if(this.popup.timeoutOut)clearTimeout(this.popup.timeoutOut)},this))}},this),400)}},getID:function(){return"vote"+(new Date).getTime()},make:function(t,i){if(!this.popup)return true;i=i!==false;var s=this.popup&&this.popup.contentContainer?this.popup.contentContainer:e("popup-window-content-bx-vote-popup-cont-"+this.CID),o=false,n=false,r;if(this.popup.isNew){o=e.create("SPAN",{props:{className:"bx-ilike-popup"},children:[e.create("SPAN",{props:{className:"bx-ilike-bottom_scroll"}})]});n=e.create("SPAN",{props:{className:"bx-ilike-wrap-block"},children:[o]})}else{o=e.findChild(this.popup.contentContainer,{className:"bx-ilike-popup"},true)}if(!!o&&typeof t.items=="object"){var a=null;for(r in t.items){if(t.items.hasOwnProperty(r)&&!e.findChild(o,{tag:"A",attr:{id:"a"+t["answer_id"]+"u"+t.items[r]["ID"]}},true)){if(t.items[r]["PHOTO_SRC"].length>0){a=e.create("IMG",{attrs:{src:t.items[r]["PHOTO_SRC"]},props:{className:"bx-ilike-popup-avatar-img"}})}else{a=e.create("IMG",{attrs:{src:"/bitrix/images/main/blank.gif"},props:{className:"bx-ilike-popup-avatar-img bx-ilike-popup-avatar-img-default"}})}o.appendChild(e.create("A",{attrs:{id:"a"+t["answer_id"]+"u"+t.items[r]["ID"]},props:{href:t.items[r]["URL"],target:"_blank",className:"bx-ilike-popup-img"+(!!t.items[r]["TYPE"]?" bx-ilike-popup-img-"+t.items[r]["TYPE"]:"")},text:"",children:[e.create("SPAN",{props:{className:"bx-ilike-popup-avatar-new"},children:[a,e.create("SPAN",{props:{className:"bx-ilike-popup-avatar-status-icon"}})]}),e.create("SPAN",{props:{className:"bx-ilike-popup-name-new"},html:t.items[r]["FULL_NAME"]})]}))}}}if(this.popup.isNew){this.popup.isNew=false;if(!!s){try{s.removeChild(s.firstChild)}catch(u){}s.appendChild(n)}}this.adjustWindow();if(i)this.popupScroll();return true},show:function(){if(this.popup!=null&&this.node.id!=this.popup.nodeID)this.popup.close();if(this.popup==null){this.popup=new e.PopupWindow("bx-vote-popup-cont-"+this.CID,this.node,{lightShadow:true,offsetTop:-2,offsetLeft:3,autoHide:true,closeByEsc:true,bindOptions:{position:"top"},events:{onPopupClose:function(){this.destroy()},onPopupDestroy:e.proxy(function(){this.popup=null},this)},content:e.create("SPAN",{props:{className:"bx-ilike-wait"}})});this.popup.nodeID=this.node.id;this.popup.isNew=true;this.popup.show()}this.popup.setAngle({position:"bottom"});this.adjustWindow()},adjustWindow:function(){if(this.popup!=null){this.popup.bindOptions.forceBindPosition=true;this.popup.adjustPosition();this.popup.bindOptions.forceBindPosition=false}},popupScroll:function(){if(this.popup){var t=e.findChild(this.popup.contentContainer,{className:"bx-ilike-popup"},true);e.bind(t,"scroll",e.proxy(this.popupScrollCheck,this))}},popupScrollCheck:function(){var t=e.proxy_context;if(t.scrollTop>(t.scrollHeight-t.offsetHeight)/1.5){e.unbind(t,"scroll",e.proxy(this.popupScrollCheck,this));this.get(this.popup.bindElement)}},get:function(t){this.node=!!t?t:e.proxy_context;if(!this.node)return false;if(!this.node.getAttribute("id"))this.node.setAttribute("id",this.getID());if(!this.node.getAttribute("rel")&&!this.node.getAttribute("rev")||parseInt(this.node.innerHTML)<=0)return false;if(this.node.getAttribute("status")==="busy")return false;if(!this.node.getAttribute("inumpage"))this.node.setAttribute("inumpage","1");else if(this.node.getAttribute("inumpage")!="done")this.node.setAttribute("inumpage",parseInt(this.node.getAttribute("inumpage"))+1+"");this.show();if(this.data[this.node.getAttribute("id")])this.make(this.data[this.node.getAttribute("id")],this.node.getAttribute("inumpage")!="done");if(this.node.getAttribute("inumpage")!="done"){this.node.setAttribute("status","busy");e.ajax({url:"/bitrix/components/bitrix/voting.current/templates/.userfield/users.php",method:"POST",dataType:"json",data:{ID:this.node.getAttribute("rel"),answer_id:this.node.getAttribute("rev"),request_id:this.node.getAttribute("id"),iNumPage:this.node.getAttribute("inumpage"),URL_TEMPLATE:this.urlTemplate,NAME_TEMPLATE:this.nameTemplate,sessid:e.bitrix_sessid()},onsuccess:e.proxy(function(t){if(!!t&&!!t.items){t["StatusPage"]=!!t["StatusPage"]?t["StatusPage"]:false;if(t.StatusPage=="done"||t.items.length<=0)this.node.setAttribute("inumpage","done");var e,i=this.data[this.node.getAttribute("id")]?this.data[this.node.getAttribute("id")]["items"]:[];for(e=0;e<t.items.length;e++){i.push(t.items[e])}this.data[this.node.getAttribute("id")]=t;this.data[this.node.getAttribute("id")]["items"]=i;this.make(this.data[this.node.getAttribute("id")],this.node.getAttribute("inumpage")!="done")}this.node.setAttribute("status","ready")},this),onfailure:e.proxy(function(){this.node.setAttribute("status","ready")},this)})}return true},send:function(){if(this.status==="ready"){this.status="busy";e.ajax({url:this.url.replace(/.AJAX_RESULT=Y/g,"").replace(/.AJAX_POST=Y/g,"").replace(/.sessid=[^&]*/g,"").replace(/.VOTE_ID=([\d]+)/,"").replace(/.view_form=Y/g,"").replace(/.view_result=Y/g,""),method:"POST",dataType:"json",data:{VOTE_ID:this.voteId,AJAX_RESULT:"Y",view_result:"Y",sessid:e.bitrix_sessid()},onsuccess:e.proxy(function(t){this.changeData(t);this.status="ready"},this),onfailure:e.proxy(function(){this.status="ready"},this)})}},changeData:function(t){t=t["QUESTIONS"];e.onCustomEvent(this.controller,"OnBeforeChangeData");var i,s,o,n,r;for(n in t){if(t.hasOwnProperty(n)){i=e.findChild(this.controller,{attr:{id:"question"+n}},true);if(!!i){for(o in t[n]){if(t[n].hasOwnProperty(o)){s=e.findChild(i,{attr:{id:"answer"+o}},true);if(!!s){r=parseInt(t[n][o]["PERCENT"]);r=isNaN(r)?0:r;e.adjust(e.findChild(s,{tagName:"A",className:"bx-vote-voted-users"},true),{attrs:{id:"",rel:t[n][o]["USERS"],rev:o,inumpage:false},html:t[n][o]["COUNTER"]});e.adjust(e.findChild(s,{tagName:"SPAN",className:"bx-vote-data-percent"},true),{html:r+"%"});e.adjust(e.findChild(s,{tagName:"DIV",className:"bx-vote-result-bar"},true),{style:{width:r+"%"}})}}}}}}e.onCustomEvent(this.controller,"OnAfterChangeData")}};return t}()})(window);
//# sourceMappingURL=script.map.js

Zerion Mini Shell 1.0