Y-SLD/assets/playkit/js/usermain.js

1 line
8.6 KiB
JavaScript
Raw Permalink Normal View History

2024-03-01 11:23:55 +00:00
function showMsg(e,t){"add"==e?swal("Added!",t,"success"):"update"==e?swal("Updated!",t,"success"):"deleted"==e?swal("Deleted!",t,"success"):"success"==e?swal({title:"Success!",text:t,html:!0,type:"success"}):swal({title:"Error!",text:t,html:!0,type:"error"})}function ajaxRequest(e,t,r,o,i){jQuery.ajax({url:baseURL+e,type:t,dataType:r,data:o}).done(function(e){i(e)}).fail(function(e){var e=JSON.parse(e.responseText),t="<ul>";$.each(e,function(e,r){t+="<li>"+r+"</li>"}),t+="</ul>",showMsg("error",t)}).always(function(){})}function getDetailsByAttr(e,t,r){var o=[];for(var i in e)e.hasOwnProperty(i)&&("object"==typeof e[i]?o=o.concat(getDetailsByAttr(e[i],t,r)):i==t&&e[t]==r&&o.push(e));return o}function validateForm(e){e.validate({errorElement:"span",errorClass:"help-inline",focusInvalid:!1,rules:{},messages:{}})}function uniqId(e){return e+Math.round((new Date).getTime()+1e13*Math.random())}function sort_value_layer(e,t){return e.order<t.order?-1:e.order>t.order?1:0}function isGoogle(){return"undefined"!=typeof map&&92==map.id||1==googleMapsDefault}!function(e){e.fn.extend({slimScroll:function(r){var o=e.extend({width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200,borderRadius:"7px",railBorderRadius:"7px"},r);return this.each(function(){function i(t){if(u){t=t||window.event;var r=0;t.wheelDelta&&(r=-t.wheelDelta/120),t.detail&&(r=t.detail/3),e(t.target||t.srcTarget||t.srcElement).closest("."+o.wrapperClass).is(y.parent())&&n(r,!0),t.preventDefault&&!b&&t.preventDefault(),b||(t.returnValue=!1)}}function n(e,t,r){b=!1;var i=y.outerHeight()-m.outerHeight();t&&(t=parseInt(m.css("top"))+e*parseInt(o.wheelStep)/100*m.outerHeight(),t=Math.min(Math.max(t,0),i),t=0<e?Math.ceil(t):Math.floor(t),m.css({top:t+"px"})),g=parseInt(m.css("top"))/(y.outerHeight()-m.outerHeight()),t=g*(y[0].scrollHeight-y.outerHeight()),r&&(t=e,e=t/y[0].scrollHeight*y.outerHeight(),e=Math.min(Math.max(e,0),i),m.css({top:e+"px"})),y.scrollTop(t),y.trigger("slimscrolling",~~t),s(),l()}function a(){d=Math.max(y.outerHeight()/y[0].scrollHeight*y.outerHeight(),30),m.css({height:d+"px"});var e=d==y.outerHeight()?"none":"block";m.css({display:e})}function s(){a(),clearTimeout(f),g==~~g?(b=o.allowPageScroll,v!=g&&y.trigger("slimscroll",0==~~g?"top":"bottom")):b=!1,v=g,d>=y.outerHeight()?b=!0:(m.stop(!0,!0).fadeIn("fast"),o.railVisible&&x.stop(!0,!0).fadeIn("fast"))}function l(){o.alwaysVisible||(f=setTimeout(function(){o.disableFadeOut&&u||c||p||(m.fadeOut("slow"),x.fadeOut("slow"))},1e3))}var u,c,p,f,h,d,g,v,b=!1,y=e(this);if(y.parent().hasClass(o.wrapperClass)){var w=y.scrollTop(),m=y.siblings("."+o.barClass),x=y.siblings("."+o.railClass);if(a(),e.isPlainObject(r)){if("height"in r&&"auto"==r.height){y.parent().css("height","auto"),y.css("height","auto");var S=y.parent().parent().height();y.parent().css("height",S),y.css("height",S)}else"height"in r&&(S=r.height,y.parent().css("height",S),y.css("height",S));if("scrollTo"in r)w=parseInt(o.scrollTo);else if("scrollBy"in r)w+=parseInt(o.scrollBy);else if("destroy"in r)return m.remove(),x.remove(),void y.unwrap();n(w,!1,!0)}}else if(!(e.isPlainObject(r)&&"destroy"in r)){o.height="auto"==o.height?y.parent().height():o.height,w=e("<div></div>").addClass(o.wrapperClass).css({position:"relative",overflow:"hidden",width:o.width,height:o.height}),y.css({overflow:"hidden",width:o.width,height:o.height});var x=e("<div></div>").addClass(o.railClass).css({width:o.size,height:"100%",position:"absolute",top:0,display:o.alwaysVisible&&o.railVisible?"block":"none","border-radius":o.railBorderRadius,background:o.railColor,opacity:o.railOpacity,zIndex:90}),m=e("<div></div>").addClass(o.barClass).css({background:o.color,width:o.size,position:"absolute",top:0,opacity:o.opacity,display:o.alwaysVisible?"block":"none","border-radius":o.borderRadius,BorderR