1 line
No EOL
33 KiB
JavaScript
Executable file
1 line
No EOL
33 KiB
JavaScript
Executable file
!function(window){var _cb=function(){var self=this;if(this.baseurl=baseurl,this.imageurl="",this.page=this.baseurl+"/ajax.php",this.loading_img="<img allign='center' style='vertical-align:middle' src='"+imageurl+"/ajax-loader-big.gif'>",this.loading=this.loading_img+" Loading...",this.download=0,this.total_size=0,this.cur_speed=0,this.status_refesh=1,this.result_page=this.baseurl+"/actions/file_results.php",this.download_page=this.baseurl+"/actions/file_downloader.php",this.count=0,this.hasLoaded=!1,this.perc_download=0,this.force_stop=!1,this.remoteObjID="",this.current_menu="",this.normal_player_html="",this.hq_player_html="",this.has_hq_function=!1,this.collectionID=!1,this.keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",this.ua=navigator.userAgent.toLowerCase(),this.ua.indexOf(" chrome/")>=0||this.ua.indexOf(" firefox/")>=0||this.ua.indexOf(" gecko/")>=0)var StringMaker=function(){this.str="",this.length=0,this.append=function(t){this.str+=t,this.length+=t.length},this.prepend=function(t){this.str=t+this.str,this.length+=t.length},this.toString=function(){return this.str}};else var StringMaker=function(){this.parts=[],this.length=0,this.append=function(t){this.parts.push(t),this.length+=t.length},this.prepend=function(t){this.parts.unshift(t),this.length+=t.length},this.toString=function(){return this.parts.join("")}};this.setRemoteId=function(){this.remoteObjID=this.randomString()},this.Confirm_Delete=function(t){confirm("Are you sure you want to delete")&&(document.location=t)},this.Confirm_Uninstall=function(t){confirm("Are you sure you want to uninstall this plugin ?")&&(document.location=t)},this.confirm_it=function(t){return!!confirm(t)},this.reloadImage=function(t,e){img=document.getElementById(e),img.src=t+"?"+Math.random()},this.validate_category_form=function(thisform){var self=this;with(thisform){if(0==validate_required(title,"Title must be filled out!"))return title.focus(),!1;if(0==validate_required(description,"Description must be filled out!"))return description.focus(),!1}},this.validate_ad_form=function(thisform){var self=this;with(thisform){if(0==validate_required(name,"Name must be filled out!"))return name.focus(),!1;if(0==validate_required(type,"Type must be filled out!"))return type.focus(),!1;if(0==validate_required(syntax,"Syntax Must Be Filled Out"))return syntax.focus(),!1;if(0==validate_required(code,"Code Must Be Filled Out"))return code.focus(),!1}},this.randomString=function(){for(var t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",e="",a=0;a<8;a++){var i=Math.floor(Math.random()*t.length);e+=t.substring(i,i+1)}return e},this.check_remote_url=function(){var t=this,e=$("#remote_file_url").val(),a=$("#ytUploadBttn"),i=$("#remoteUploadBttn"),s=$("#remoteUploadBttnStop");if(this.force_stop=!1,e.match(/^e.g/)||void 0===e||0===e.length)return $("#error_msgs").html('<div class="alert alert-danger" role="alert">Given URL is invalid!</div>'),!1;var o,n=function(t){void 0!==t?(s.removeAttr("disabled").hide(),a.removeAttr("disabled"),i.removeAttr("disabled").show()):($(".downloadStatusContainer").addClass("hidden"),s.removeAttr("disabled").hide(),a.removeAttr("disabled"),i.removeAttr("disabled").show())};void 0!==o?(i.attr("disabled","disabled"),a.attr("disabled","disabled")):($(".downloadStatusContainer").removeClass("hidden"),i.attr("disabled","disabled").hide(),a.attr("disabled","disabled"),s.show());var l=$.ajax({url:t.download_page,type:"POST",data:{file:e,file_name:file_name},dataType:"JSON",beforeSend:function(){t.remoteUploadStatusUpdate();var a=t.getName(e);$("#loading").html("Downloading"),$("#remoteFileName").replaceWith('"'+a+'"')},success:function(e){if(t.force_stop=!0,e.error)return t.force_stop=!0,n(),$("#error_msgs").html('<div class="alert alert-danger" role="alert"> File Type Not Allowed!</div>'),!1;n(),$("#loading").html("");var a=e.vid;$.post(t.baseurl+"/actions/getVideoDetails.php",{file_name:file_name,vid:a},function(t){var e=$("#updateVideoInfoForm").clone();$(e).find("input[name=title]").val(t.title),$(e).find("textarea#desc").val(t.description),$(e).find("input[name='category[]']:first").attr("checked","checked");var i=document.createElement("input");i.name="videoid",i.type="hidden",i.value=a;var s=document.createElement("input");s.name="file_name",s.type="hidden",s.value=file_name,$(e).append(i),$(e).append(s),$("#remoteForm").html(""),$(e).removeClass("hidden").attr("id","uploadFormContainer_remote").appendTo("#remoteForm"),$(e).find("form").on({submit:function(t){t.preventDefault();var e=$(this),a=$(e).serialize();a+="&updateVideo=yes",$.ajax({url:baseurl+"/actions/file_uploader.php",type:"post",data:a}).success(function(t){msg=$.parseJSON(t),$("#uploadMessage").removeClass("hidden"),msg.error?$("#uploadMessage").html(msg.error).attr("class","alert alert-danger"):$("#uploadMessage").html(msg.msg).attr("class","alert alert-success"),setTimeout(function(){$("#uploadMessage").addClass("hidden")},5e3)})}}),$(".formSection h4").on({click:function(t){t.preventDefault(),$(this).find("i").hasClass("glyphicon-chevron-down")?($(this).find("i").removeClass("glyphicon-chevron-down").addClass("glyphicon-chevron-up"),$(this).next().toggleClass("hidden")):($(this).find("i").removeClass("glyphicon-chevron-up").addClass("glyphicon-chevron-down"),$(this).next().toggleClass("hidden"))}}),$(e).on({submit:function(t){t.preventDefault();var e=$(this).serialize();e+="&updateVideo=yes",$.ajax({url:baseurl+"/actions/file_uploader.php",type:"post",data:e,dataType:"JSON"}).success(function(t){$("#uploadMessage").removeClass("hidden"),t.error?$("#uploadMessage").html(t.error).attr("class","alert alert-danger"):$("#uploadMessage").html(t.msg).attr("class","alert alert-success"),setTimeout(function(){$("#uploadMessage").addClass("hidden")},5e3)}).fail(function(t){console.log(t)})}})},"json")}});$("#remoteUploadBttnStop").click(function(){l.abort(),this.force_stop=!0,$("#loading").html(""),$("#remoteDownloadStatus").hide(),$(this).hide(),$("#remoteUploadBttn").attr("disabled","").show()})},this.remoteUploadStatusUpdate=function(){var t=this;$.ajax({url:t.result_page,type:"POST",data:{file_name:file_name},dataType:"JSON"}).success(function(e){!1===t.force_stop&&(t.updateProgress(e),setTimeout(function(){t.remoteUploadStatusUpdate()},1e3*t.status_refesh))})},this.updateProgress=function(t){if(void 0!==t&&null!==t){var e=(t.downloaded/1048576).toFixed(2),a=(t.total_size/1048576).toFixed(2),i=t.downloaded/t.total_size*100;$("#downloadStatus").find("#downloaded").text(e+" Mb"),$("#downloadStatus").find("#totalSize").text(a+" Mb"),$("#prog_bar").css("width",i+"%")}},this.youtube_check_url=function(){var t=$("#remote_file_url").val();$("#ytUploadBttn"),$("#remoteUploadBttn"),$("#remoteUploadBttnStop");return this.force_stop=!1,!t.match(/^e.g/)&&void 0!==t&&0!==t.length||($("#error_msgs").html('<div class="alert alert-danger" role="alert"> Please enter valid URL !</div>'),!1)},this.youtube_upload=function(){if(!this.youtube_check_url())return!1;$("#remoteUploadBttn").attr("disabled","disabled"),$("#ytUploadBttn").attr("disabled","disabled");var t=$("#remote_file_url").val();if(force_stop=!1,!t||"undefined"==t)return alert("Please enter file url"),$("#remoteUploadBttn").attr("disabled",""),$("#ytUploadBttn").attr("disabled",""),!1;$.ajax({url:download_page,type:"POST",data:{file:t,file_name:file_name,youtube:"yes"},dataType:"json",beforeSend:function(){$("#loading").html('<div style="float: left; display: inline-block;"><img src="'+imageurl+'/ajax-loader.gif"></div><div style="float: left; line-height: 16px; padding-left:5px">Uploading video from youtube, please wait...</div><div class="clear"></div>')},success:function(t){t.error?(force_stop=!0,$("#remoteUploadBttn").attr("disabled",""),$("#ytUploadBttn").attr("disabled",""),alert(t.error)):t.vid&&(alert("this is checked success"),vid=t.vid,$("#remoteUploadBttn").attr("disabled","disabled").hide(),$("#ytUploadBttn").attr("disabled","disabled").hide(),$.post(baseurl+"/actions/file_uploader.php",{getForm:"get_form",title:t.title,desc:t.desc,tags:t.tags,objId:remoteObjID},function(t){$("#remoteForm").append(t),$("#cbSubmitUpload"+remoteObjID).before('<span id="updateVideoDataLoading" style="margin-right:5px"></span>').attr("disabled","").attr("value",lang.saveData).attr("onClick","doUpdateVideo('#uploadForm"+remoteObjID+"','"+remoteObjID+"')").after('<input type="hidden" name="videoid" value="'+vid+'" id="videoid" />').after('<input type="hidden" name="updateVideo" value="yes" id="updateVideo" />')},"text")),$("#loading").html("")}})},this.status_update=function(){var t=this;$.ajax({url:t.result_page,type:"POST",data:{file_name:file_name},dataType:"json",success:function(e){if(e){var a=parseFloat(e.total_size),i=parseFloat(e.downloaded),s=parseFloat(e.total_size_fm),o=parseFloat(e.downloaded_fm),n=parseFloat(e.speed_download),l=(parseFloat(e.time_eta),parseFloat(e.time_eta_fm)),r=(parseFloat(e.time_took),parseFloat(e.time_took_fm));if(n/1024/1024>1)var d=Math.round(n/1024/1024)+" Mbps";else d=Math.round(n/1024)+" Kbps";t.perc_download=Math.round(i/a*100),isNaN(o)?($("#remoteDownloadStatus").show(),$("#prog_bar").html("Loading"),$("#dspeed").html("Loading"),$("#eta").html("Loading"),$("#status").html("Loading")):($("#remoteDownloadStatus").show(),$("#prog_bar").animate({width:t.perc_download+"%"},1e3),$("#prog_bar").html(t.perc_download+"%"),$("#dspeed").html(d),$("#eta").html(l),$("#status").html(o+" of "+s))}var c=1e3*t.status_refesh;t.perc_download>99&&(t.force_stop=!0),t.force_stop?100==t.perc_download&&a>1&&$("#time_took").html("Time Took : "+r):setTimeout(function(){t.status_update()},c)}})},this.upload_file=function(t,e){var a=this.baseurl+"/actions/file_downloader.php";$.post(a,{file_url:t,file_name:e},function(t){t?submit_upload_form():alert("No data")},"text")},this.delete_item=function(t,e,a,i){$("#"+t+"-"+e).click(function(){confirm(a)&&(document.location=i)})},this.delete_video=function(t,e,a,i){return delete_item(t,e,a,i)},this.get_video=function(t,e){$(e).css("display","block"),$(e).html(this.loading),$(e).html(this.loading),$.post(page,{mode:t},function(t){$(e).html(t)},"text")},this.getAjaxPhoto=function(t,e){$(e).css("display","block");var a=$(e).html();$.ajax({url:this.page,type:"POST",dataType:"json",data:{mode:"loadAjaxPhotos",photosType:t},beforeSend:function(){$(e).html(this.loading)},success:function(t){t.failed&&$(e).html(a),t.completed&&$(e).html(t.photoBlocks)}})},this.rating_over=function(t,e){"disabled"!=e&&$("#rating_result_container").html(t)},this.rating_out=function(t,e){"disabled"!=e&&$("#rating_result_container").html(t)},this.submit_share_form=function(t,e){$("#share_form_results").css("display","block"),$("#share_form_results").html(this.loading),$.post(page,{mode:"share_object",type:e,users:$("#ShareUsers").val(),message:$("#message").val(),id:$("#objectid").val()},function(t){t?$("#share_form_results").html(t):alert("No data")},"text")},this.flag_object=function(t,e,a){$("#flag_form_result").css("display","block"),$("#flag_form_result").html(this.loading),$.post(page,{mode:"flag_object",type:a,flag_type:$("#"+t+" select option:selected").val(),id:e},function(t){t?($("#flag_form_result").css("display","block"),$("#flag_form_result").html(t)):alert("No data")},"text")},this.slide_up_watch_video=function(t){"block"!=$(".video_action_result_boxes "+t).css("display")&&$(".video_action_result_boxes > *").slideUp()},this.add_to_fav=function(t,e){$("#video_action_result_cont").css("display","block"),$("#video_action_result_cont").html(this.loading),$.post(page,{mode:"add_to_fav",type:t,id:e},function(t){t?($("#video_action_result_cont").css("display","block"),$("#video_action_result_cont").html(t)):alert("No data")},"text")},this.subscriber=function(t,e,a){$("#"+a).css("display","block"),$("#"+a).html(this.loading),$.post(page,{mode:e,subscribe_to:t},function(t){t?($("#"+a).css("display","block"),$("#"+a).html(t)):alert("No data")},"text")},this.add_friend=function(t,e){$("#"+e).css("display","block"),$("#"+e).html(this.loading),$.post(page,{mode:"add_friend",uid:t},function(t){t?($("#"+e).css("display","block"),$("#"+e).html(t)):alert("No data")},"text")},this.block_user=function(t,e){$("#"+e).css("display","block"),$("#"+e).html(this.loading),$.post(page,{mode:"ban_user",user:t},function(t){t?($("#"+e).css("display","block"),$("#"+e).html(t)):alert("No data")},"text")},this.rate_comment=function(t,e,a,i){$.post(page,{mode:"rate_comment",thumb:e,cid:t,type:a,typeid:i},function(e){e?(""!=e.msg&&alert(e.msg),""!=e.rate&&$("#comment_rating_"+t).html(e.rate)):alert("No data")},"json")},this.delete_comment=function(t,e){$.post(page,{mode:"delete_comment",cid:t,type:e},function(e){e?(e.msg&&(alert(e.msg),$("#comment_"+t).fadeOut("slow"),$("#spam_comment_"+t).fadeOut("slow")),e.err&&alert(e.err)):alert("No data")},"json")},this.add_comment_js=function(t,e){$("#add_comment_result").css("display","block"),$("#add_comment_result").html(this.loading),$("#add_comment_button").attr("disabled","disabled");var a=$("#"+t).serialize()+"&mode=add_comment";$.post(page,a,function(t){t?($("#add_comment_button").attr("disabled",""),$("#add_comment_result").css("display","block"),""!=t.err&&$("#add_comment_result").html(t.err),""!=t.msg&&$("#add_comment_result").html(t.msg),t.cid&&get_the_comment(t.cid,"#latest_comment_container")):alert("No data")},"json")},this.get_the_comment=function(t,e){$(e).html(this.loading),$.post(page,{mode:"get_comment",cid:t},function(t){t?($(e).css("display","none"),$(e).html(t).fadeIn("slow")):alert("No data")},"text")},this.add_playlist=function(t,e,a,i){switch($("#playlist_form_result").css("display","block"),$("#playlist_form_result").html(this.loading),t){case"add":$.post(page,{mode:"add_playlist",id:e,objtype:i,pid:$("#playlist_id option:selected").val()},function(t){t?(""!=t.err&&($("#playlist_form_result").css("display","block"),$("#playlist_form_result").html(t.err)),""!=t.msg&&($("#playlist_form_result").css("display","block"),$("#playlist_form_result").html(t.msg),$("#"+a).css("display","none"))):alert("No data")},"json");break;case"new":$.post(page,{mode:"add_new_playlist",id:e,objtype:i,plname:$("#playlist_name").val()},function(t){t?(t.err&&($("#playlist_form_result").css("display","block"),$("#playlist_form_result").html(t.err)),t.msg&&($("#playlist_form_result").css("display","block"),$("#playlist_form_result").html(t.msg),$("#"+a).css("display","none"))):alert("No data")},"json")}},this.add_quicklist=function(t,e){$(t).attr("src",this.imageurl+"/ajax-loader.gif"),$(t).css("background-position","-200px 200px"),$.post(page,{mode:"quicklist",todo:"add",vid:e},function(e){e?($(t).attr("src",this.imageurl+"/dot.gif"),$(t).css("background-position","-0px -0px"),$(t).removeClass("add_icon"),$(t).addClass("check_icon"),$(t).removeAttr("onClick"),load_quicklist_box()):alert("No data")},"text")},this.remove_qucklist=function(t,e){$.post(page,{mode:"quicklist",todo:"remove",vid:e},function(e){e?($(t).slideUp(),$(t).hide()):alert("No data")},"text")},this.load_quicklist_box=function(){$.post(page,{mode:"getquicklistbox"},function(t){(t=$.trim(t))?($("#quicklist_box").css("display","block"),$("#quicklist_box").html(t),"hide"!=$.cookie("quick_list_box")&&$("#quicklist_cont").css("display","block")):$("#quicklist_box").css("display","none")},"text")},this.clear_quicklist=function(){$.post(page,{mode:"clear_quicklist"},function(t){load_quicklist_box()},"text")},this.quick_show_hide_toggle=function(t){$(t).slideToggle(),"show"==$.cookie("quick_list_box")?$.cookie("quick_list_box","hide"):$.cookie("quick_list_box","show")},this.ini_cookies=function(){$.cookie("quick_list_box")||$.cookie("quick_list_box","show")},this.get_group_info=function(t,e){"none"==$(t).css("display")&&($("#group_info_cont > div").slideUp(),$("#group_info_cont "+t).slideDown(),$(".group_detail_tabs .selected").removeClass("selected"),$(e).addClass("selected"))},this.show_menu=function(t,e){if(window.location.hash&&e){var a=window.location.hash;return show_menu(a.substr(9),!1),!1}window.location.hash="current_"+t,this.current_menu!=t&&hide_menu(),$("#"+t).show(),this.current_menu=t,$("."+t).addClass("selected")},this.hide_menu=function(){if(""!=this.current_menu)return $("#"+this.current_menu).hide(),$("."+this.current_menu).removeClass("selected"),!0},this.to_reply=function(t){$("#reply_to").val(t),window.location="#add_comment"},this.spam_comment=function(t,e,a){$.post(page,{mode:"spam_comment",cid:t,type:e,typeid:a},function(e){e?(e.msg&&($("#comment_"+t).hide(),$("#spam_comment_"+t).fadeIn("slow")),e.err&&alert(e.err)):alert("No data")},"json")},this.hq_toggle=function(t,e){if(this.has_hq_function){t=t,e=e;return hq_function(),!1}"block"==$(t).css("display")?(""==this.normal_player_html&&(this.normal_player_html=$(t).html()),$(t).html("")):""!=this.normal_player_html&&$(t).html(this.normal_player_html),"block"==$(e).css("display")?(""==this.hq_player_html&&(this.hq_player_html=$(e).html()),$(e).html("")):""!=this.hq_player_html&&$(e).html(this.hq_player_html),$(t+","+e).toggle()},this.swap_auto_play=function(){"true"==$.cookie("auto_play_playlist")?($.cookie("auto_play_playlist","false",{path:"/"}),window.location=document.location,$("#ap_status").html("off")):($.cookie("auto_play_playlist","true",{path:"/"}),window.location=document.location,$("#ap_status").html("on"))},this.collection_actions=function(t,e,a,i,s,o){switch($(i).css("display","block"),$(i).html(this.loading),e){case"add_new_item":$.post(page,{mode:e,cid:$("#"+t+" #collection").val(),obj_id:a,type:s},function(t){t?(t.msg&&$(i).html(t.msg),t.err&&$(i).html(t.err)):alert("No Data returned")},"json");break;case"remove_collection_item":$("#"+t).hide(),$.post(page,{mode:e,obj_id:a,type:s,cid:o},function(e){e?(e.err&&(alert(e.err),$(i+"_"+a).hide(),$("#"+t+a).show()),e.msg&&($(i).html(e.msg),$("#"+t+"_"+a).slideUp(350))):(alert("No Data Returned"),$(i+"_"+a).hide(),$("#"+t).show())},"json")}return!1},this.openURL=function(t){document.locati=t},this.get_item=function(t,e,a,i,s){var o=$(t).html();$(t).html(this.loading),$.post(page,{mode:"get_item",ci_id:e,cid:a,type:i,direction:s},function(e){if(e){var a=new Array(i,e.cid,e.key);construct_url(a),$("#collectionItemView").html(e.content)}else alert("No "+i+" returned"),$(t).text(o)},"json")},this.construct_url=function(t){var e;"yes"==Seo?(e="#!/item/"+t[0]+"/"+t[1]+"/"+t[2],window.location.hash=e):(e="#!?item="+t[2]+"&type="+t[0]+"&collection="+t[1],window.location.hash=e)},this.onReload_item=function(){var t,e;window.location.hash&&(t=window.location.href,"yes"==Seo?(e=RegExp("/item.+#!")).test(t)&&(t=t.replace(e,""),window.location.href=t):(e=RegExp("\\?item.+#!")).test(t)&&(t=t.replace(e,""),window.location.href=t))},this.pagination=function(t,e,a,i){var s=this,o=$(t),n=(o.id,o.parent()),l=o.html();n.attr("id")?parent.attr("id"):(n.attr("id","loadMoreParent"),n.attr("id")),newCall=$.ajax({url:s.page,type:"post",dataType:"json",data:{mode:"moreItems",page:i,cid:e,type:a},beforeSend:function(){o.removeAttr("onClick"),o.html(s.loading)},success:function(e){e.error?("BUTTON"==t.tagName&&o.attr("disabled","disabled"),o.removeAttr("onClick"),o.html("No more "+a)):($("#collectionItemsList").append(e.content),$("#NewPagination").html(e.pagination),o.html(l))}})},this.ajax_add_collection=function(t){var e=t.form.id,a=$("#"+e),i=$(t),s=i.html(),o=$("#CollectionResult");$.ajax({url:this.page,type:"post",dataType:"json",data:"mode=add_collection&"+a.serialize(),beforeSend:function(){"block"==o.css("display")&&o.slideUp("fast"),i.attr("disabled","disabled"),i.html(this.loading)},success:function(t){t.msg?($("#CollectionDIV").slideUp("fast"),o.html(t.msg).slideDown("fast"),this.collectionID=t.id):(o.html(t.err).slideDown("fast"),i.removeAttr("disabled"),i.html(s))}})},this.getDetails=function(t){var e=getInputs(t),a=new Array(e.length);return $.each(e,function(t,e){query=$("#"+e.id+" *").serialize(),query+="&mode=ajaxPhotos",a[t]=query}),a},this.getName=function(t){var e=t;return e.substring(e.lastIndexOf("/")+1)},this.viewRatings=function(t,e){var a=$(t),i=a.html();document.getElementById("RatingStatContainer")?$("#RatingStatContainer").toggle():loadAjax=$.ajax({url:page,type:"post",dataType:"text",data:{mode:"viewPhotoRating",photoid:e},beforeSend:function(){a.html(this.loading)},success:function(t){a.html(i),t?$("<div />").attr("id","RatingStatContainer").addClass("clearfix").css({padding:"8px",font:"normal 11px Tahoma",border:"1px solid #ccc",backgroundColor:"#FFF"}).html(t).fadeIn(350).insertAfter(a):(a.removeAttr("onclick"),alert("Photo has not recieved any rating yet."))}})},this.showAdvanceSearch=function(t,e,a,i){$("#"+t);var s=$("#"+e),o=$("#SearchType").val();s.toggle(),"block"==s.css("display")&&s.children().hide().filter("#"+o).show(),$("."+a).toggleClass(i)},this.toggleCategory=function(t,e){var a=$(t),i=a.attr("alt"),s=$("#"+i),o=i.split("_")[0],n=$.browser.msie,l=$.browser.version;"none"==s.css("display")?(s.slideDown(350),n&&"7.0"==l&&s.addClass("internetExplorer7CategoryToggleFix"),$.cookie(o,"expanded",{expires:1,path:"/"}),a.removeClass("none").addClass("block")):(s.slideUp(350),n&&"7.0"==l&&s.removeClass("internetExplorer7CategoryToggleFix"),$.cookie(o,"collapsed",{expires:1,path:"/"}),a.removeClass("block").addClass("none"))},this.loadObject=function(t,e,a,i){var s=new Array(4);s.this=t,s.type=e,s.objID=a,s.container=i;var o=$(s.this);o.parent().css("position","relative"),$.ajax({url:this.page,type:"POST",dataType:"json",data:{mode:"channelFeatured",contentType:s.type,objID:s.objID},beforeSend:function(){o.find("img").animate({opacity:.5}),$("#"+s.container).animate({opacity:.5})},success:function(t){t.error?(o.find("img").animate({opacity:1}),$("#"+s.container).animate({opacity:1}),alert(t.error)):(o.parent().children(".selected").removeClass("selected"),o.addClass("selected"),o.find("img").animate({opacity:1}),$("#"+s.container).html(t.data),$("#"+s.container).animate({opacity:1}))}})},this.channelObjects=function(t,e,a,i,s){var o=$(t),n=o.attr("rel"),l=$(e),r=o.parents("ul").find("a.selected").attr("rel");if(n){if("block"==$("#"+n).css("display"))return!1;o.parents("ul").find("a.selected").removeClass("selected"),o.addClass("selected"),$("#"+r).hide(),$("#"+n).show()}else{var d=a+"DIV";o.attr("rel",d),$.ajax({url:this.page,type:"POST",dataType:"json",data:{mode:"channelObjects",content:a,user:i,assign:s},beforeSend:function(){o.append(this.loading_img)},success:function(t){o.find("img").remove(),o.parents("ul").find("a.selected").removeClass("selected"),o.addClass("selected"),$("#"+r).hide(),$("<div></div>").attr("id",d).addClass($("#"+r).attr("class")).html(t.html).appendTo(l)}})}};var comments_voting="no";this.getComments=function(t,e,a,i,s,o,n){$("#comments").html("<div style='padding:5px 0px;'>"+this.loading+"</div>"),$.ajax({type:"POST",url:this.page,data:{mode:"getComments",page:i,type:t,type_id:e,object_type:o,last_update:a,total_comments:s,comments_voting:comments_voting,admin:n},success:function(t){$("#comments").hide(),$("#comments").html(t),$("#comments").fadeIn("slow")},dataType:"text"})},this.checkUncheckAll=function(t){var e=theElemeform,a=0;for(a=0;a<e.length;a++)"checkbox"==e[a].type&&"checkall"!=e[a].name&&(e[a].checked=t.checked)},this.rate=function(t,e,a){alert("BIEATCh");var i=this.baseurl+"/ajax.php";$.post(i,{mode:"rating",id:t,rating:e,type:a},function(t){t?$("#rating_container").html(t):alert("No data")},"text")},this.setPageHash=function(t){var e=t.replace(this.baseurl,"");window.location.hash.replace("#!","");window.location.hash="#!"+e},this.callURLParser=function(){var t,e=window.location.href.match(/(\#![/a-zA-Z0-9=\.\&\-\_\?]*)/g);e&&(t=e[e.length-1])&&(window.location.href=this.baseurl+t.replace("#!",""))},this.groupsAjax=function(t,e,a){t.preventDefault();var i,s,o=!1;if(void 0==a&&(a="ajaxGroupResultContainer"),e.href?(i=e.href,o=!0,jqueryObj=$(e),javaObj=e):(i=e.childNodes[0].href,jqueryObj=$(e.childNodes[0]),javaObj=e.childNodes[0]),"undefined"==i)return alert("URL not found"),!1;s=jqueryObj.html(),setPageHash(i),1==o?(jqueryObj.parent().parent().children().filter(".selected").removeClass("selected"),jqueryObj.parent().addClass("selected")):(jqueryObj.parent().children().filter(".selected").removeClass("selected"),jqueryObj.addClass("selected")),jqueryObj.html(this.loading_img),$("#"+a).load(i+" #"+a,function(t,e,a){jqueryObj.html(s),document.getElementById("flag_item")&&$("#flag_item").show()})},this.encode64=function(t){for(var e,a,i,s,o,n,l,r=nStringMaker(),d=0;d<t.length;)s=(e=t.charCodeAt(d++))>>2,o=(3&e)<<4|(a=t.charCodeAt(d++))>>4,n=(15&a)<<2|(i=t.charCodeAt(d++))>>6,l=63&i,isNaN(a)?n=l=64:isNaN(i)&&(l=64),r.append(this.keyStr.charAt(s)+this.keyStr.charAt(o)+this.keyStr.charAt(n)+this.keyStr.charAt(l));return r.toString()},this.decode64=function(t){var e,a,i,s,o,n,l=nStringMaker(),r=0;for(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");r<t.length;)e=this.keyStr.indexOf(t.charAt(r++))<<2|(s=this.keyStr.indexOf(t.charAt(r++)))>>4,a=(15&s)<<4|(o=this.keyStr.indexOf(t.charAt(r++)))>>2,i=(3&o)<<6|(n=this.keyStr.indexOf(t.charAt(r++))),l.append(String.fromCharCode(e)),64!=o&&l.append(String.fromCharCode(a)),64!=n&&l.append(String.fromCharCode(i));return l.toString()},this.getAllComments=function(t,e,a,i,s,o,n){$("#userCommentsList").html("<div style='padding:5px 0px;'>"+loading+"</div>"),$.ajax({type:"POST",url:page,data:{mode:"getComments",page:i,type:t,type_id:e,object_type:o,last_update:a,total_comments:s,comments_voting:comments_voting,admin:n},success:function(t){$("#userCommentsList").html(t)},dataType:"text"})},this.getCommentsNew=function(t,e,a,i,s,o,n){$.ajax({type:"POST",url:page,data:{mode:"getCommentsNew",page:i,type:t,type_id:e,object_type:o,last_update:a,total_comments:s,comments_voting:comments_voting,admin:n},beforeSend:function(){$(document).find("#load-more-comments").text("loading comments..")},success:function(t){"none"==t?($("#load-more-comments").text("End of comments list"),$("#load-more-comments").attr("disabled","disabled")):($("#userCommentsList").append(t),$(document).find("#load-more-comments").text("Load More"))},dataType:"text"})},this.addToFav=function(t,e){$("#messageFav").show(),$.post(page,{mode:"add_to_fav",type:t,id:e},function(t){t?($("#messageFav").html(t),setTimeout(function(){$("#messageFav").hide()},5e3)):alert("No data")},"text")},this.subscribeToChannel=function(t,e,a){$("#messageFav").show(),$.post(page,{mode:e,subscribe_to:t},function(t){t?($("#messageFav").html(t),setTimeout(function(){$("#messageFav").hide()},5e3)):alert("No data")},"text")},this.debounce=function(t,e,a){var i;return function(){var s=this,o=arguments,n=a&&!i;clearTimeout(i),i=setTimeout(function(){i=null,a||t.apply(s,o)},e),n&&t.apply(s,o)}},this.throwHeadMsg=function(t,e,a,i){$(document).find("#headErr").remove(),(a=parseInt(a))<10&&(a=3e3),t.length<3&&(t="info"),$('<div id="headErr" class="alert_messages_holder" style="display:none"><div class="alert alert-'+t+' alert-messages alert-ajax" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>'+e+"</div></div>").insertAfter("#header").fadeIn("slow").delay(a).fadeOut()},this.rateNew=function(t,e,a){curObj=this;var i=baseurl+"/ajax.php";$.post(i,{mode:"rating",id:t,rating:e,type:a},function(t){t?(likesSect=$(".likes").find("span:nth-child(2)").html(),dislikesSect=$(".dislikes").find("span:nth-child(2)").html(),currLikes=parseInt(likesSect),currDislikes=parseInt(dislikesSect),isError=$(t).find("span.error").html(),isOk=$(t).find("span.msg").html(),isError?isError.length>2&&curObj.throwHeadMsg("danger",isError,5e3,!0):isOk&&isOk.length>2&&(5==e?(newRating=currLikes+1,$(".likes").addClass("rated"),$(".likes").find("span:nth-child(2)").html(newRating)):(newRating=currDislikes+1,newRating<0&&(newRating=0),$(".dislikes").addClass("rated"),$(".dislikes").find("span:nth-child(2)").html(newRating)),curObj.throwHeadMsg("success",isOk,5e3,!0))):alert("No data")},"text")},this.showMeTheMsg=function(t,e){curObj=this,isOk=1==e?$(t).filter("div.msg").find("div.alert").html():$(t).filter("div.msg").html(),isError=$(t).filter("div.error").html(),isError?isError.length>2&&curObj.throwHeadMsg("danger",isError,5e3,!0):isOk&&isOk.length>2&&curObj.throwHeadMsg("success",isOk,5e3,!0)},this.subscribeToChannelNew=function(t,e){curObj=this,$.post(page,{mode:e,subscribe_to:t},function(t){t?curObj.showMeTheMsg(t):alert("No data")},"text")},this.add_friendNew=function(t,e){curObj=this,$("#"+e).css("display","block"),$("#"+e).html(this.loading),$.post(page,{mode:"add_friend",uid:t},function(t){t?($("#"+e).css("display","none"),curObj.showMeTheMsg(t)):alert("No data")},"text")},this.subscribeToChannelNew=function(t,e){var a=this;$.post(page,{mode:e,subscribe_to:t},function(t){t?a.showMeTheMsg(t):alert("No data")},"text")},this.add_to_favNew=function(t,e){var a=this;$("#video_action_result_cont").css("display","block"),$("#video_action_result_cont").html(a.loading),$.post(page,{mode:"add_to_fav",type:t,id:e},function(t){t?($("#video_action_result_cont").hide(),a.showMeTheMsg(t,!0)):alert("No data")},"text")},this.flag_objectNew=function(t,e,a){var i=this;$("#flag_form_result").css("display","block"),$("#flag_form_result").html(this.loading),$.post(page,{mode:"flag_object",type:a,flag_type:$("#"+t+" select option:selected").val(),id:e},function(t){t?($("#flag_form_result").hide(),i.showMeTheMsg(t)):alert("No data")},"text")},this.uploadSubtitle=function(t,e,a){if(a.length<5)return!1;var i=$("#captions").prop("files")[0],s=new FormData;s.append("subtitle_lang",e),s.append("file",i),s.append("videoid",t),$.ajax({type:"post",cache:!1,contentType:!1,processData:!1,url:a,data:s,beforeSend:function(){},success:function(t){}})},this.add_playlistNew=function(t,e,a,i){switch(curObj=this,$("#playlist_form_result").css("display","block"),$("#playlist_form_result").html("loading"),t){case"add":$.post(page,{mode:"add_playlist",id:e,objtype:i,pid:$("#playlist_id option:selected").val()},function(t){if($("#playlist_form_result").html(""),t){if(t.err.length>2){cleanedHtml=$.parseHTML(t.err);var e=$(cleanedHtml).html();curObj.throwHeadMsg("danger",e,5e3,!0)}if(t.msg.length>2){cleanedHtml=$.parseHTML(t.msg);e=$(cleanedHtml).find("div.alert").html();curObj.throwHeadMsg("success",e,5e3,!0),$("#"+a).css("display","none")}}else alert("No data")},"json");break;case"new":$.post(page,{mode:"add_new_playlist",id:e,objtype:i,plname:$("#playlist_name").val()},function(t){t?(t.err&&($("#playlist_form_result").css("display","block"),$("#playlist_form_result").html(t.err)),t.msg&&($("#playlist_form_result").css("display","block"),$("#playlist_form_result").html(t.msg),$("#"+a).css("display","none"))):alert("No data")},"json")}},this.getModalVideo=function(t){this.loading_img;$.ajax({type:"post",url:baseurl+"/ajax/commonAjax.php",data:{videoid:t,mode:"get_video"},dataType:"json",beforeSend:function(t){$(".my-modal-content").html('<div align="center" style="color:#fff;font-size:25px;padding:10px 10px 10px 10px;">'+loadingImg+"</div>"),$(".my-modal-content").attr("id","")},success:function(t){if(t.success){var e=t.video_link,a=t.video_details;$(".my-modal-content").attr("id",a.videoid),$(".my-modal-content").html(t.video);var i=(i=$(document).find("#cb_video_js_"+a.videoid+"_html5_api"))[0],s=setInterval(function(){navigator.userAgent.match(/Android/i)||(i.play(),$(o).find(".uploaderName").append('<a href="'+e+'" title="Watch Video Page" style="margin:-2px 5px 0 0;"><i class="glyphicon glyphicon-log-in pull-right" style="font-size:20px;color:#fff;"></i></a>'));var t=!i.paused,o=$(document).find("#cb_video_js_"+a.videoid),n=$(document).find("video");if(n.length>0)for(var l=0;l<n.length;l++){var r=$(n[l]).attr("id").split("_");r=r[3],a.videoid!=r&&$(n[l])[0].pause()}t&&clearInterval(s)},300)}else t.failure&&$(".my-modal-content").html('<div class="alert alert-warning">'+t.message+"</div>")}})},this.getPlayerEl=function(t){var e=t,a=$(document).find(".cb_video_js_"+e+"-dimensions");return!!a&&a[0]},this.unsubscribeToChannel=function(t,e){curObj=this;var a=document.getElementsByClassName("unsubs_"+t);a.length>0&&Array.prototype.forEach.call(a,function(t){t.disabled=!0}),$.post(page,{mode:e,subscribe_to:t},function(e){if(e){curObj.showMeTheMsg(e);var a=document.getElementsByClassName("unsubs_"+t);a.length>0&&Array.prototype.forEach.call(a,function(e){e.innerHTML="Subscribe",e.setAttribute("onclick","_cb.subscribeToChannelNew("+t+",'subscribe_user');"),e.id="subs_"+t,e.disabled=!1,curObj.updateSubscribersCount(t)})}else alert("No data")},"text")},this.subscribeToChannelNew=function(t,e){var a=this,i=document.getElementsByClassName("subs_"+t);i.length>0&&Array.prototype.forEach.call(i,function(t){t.disabled=!0}),$.post(page,{mode:e,subscribe_to:t},function(e){if(e)if("err"==(e=JSON.parse(e)).typ?a.showMeTheMsg('<div class="error">'+e.msg+"</div>"):a.showMeTheMsg('<div class="msg">'+e.msg+"</div>"),e.severity<2){(i=document.getElementsByClassName("subs_"+t)).length>0&&Array.prototype.forEach.call(i,function(e){e.innerHTML="Unsubscribe",e.setAttribute("onclick","_cb.unsubscribeToChannel("+t+",'unsubscribe_user');"),e.id="unsubs_"+t,e.disabled=!1,a.updateSubscribersCount(t)})}else{var i=document.getElementsByClassName("subs_"+t);Array.prototype.forEach.call(i,function(t){t.disabled=!1})}else alert("No data")},"text")},this.updateSubscribersCount=function(t){$.post(page,{mode:"get_subscribers_count",userid:t},function(e){e?(subsObj=JSON.parse(e),$("#user_subscribers_"+t).html(subsObj.subscriber_count)):alert("No data")},"text")}};window._cb=new _cb,window._cb.setRemoteId()}(window); |