https://better-than-ever.com/wp-includes/js/jquery/ui/draggable.min.js?ver=1.11.4
/*!
* jQuery UI Draggable 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/draggable/
*/
!function(t){"function"==typeof define&&define.amd?define(["jquery","./core","./mouse","./widget"],t):t(jQuery)}(function(P){return P.widget("ui.draggable",P.ui.mouse,{version:"1.11.4",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._setHandleClassName(),this._mouseInit()},_setOption:function(t,e){this._super(t,e),"handle"===t&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){(this.helper||this.element).is(".ui-draggable-dragging")?this.destroyOnClear=!0:(this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._removeHandleClassName(),this._mouseDestroy())},_mouseCapture:function(t){var e=this.options;return this._blurActiveElement(t),!(this.helper||e.disabled||0").css("position","absolute").appendTo(t.parent()).outerWidth(t.outerWidth()).outerHeight(t.outerHeight()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(t){var e=this.document[0];if(this.handleElement.is(t.target))try{e.activeElement&&"body"!==e.activeElement.nodeName.toLowerCase()&&P(e.activeElement).blur()}catch(t){}},_mouseStart:function(t){var e=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),P.ui.ddmanager&&(P.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=0s[2]&&(n=s[2]+this.offset.click.left),t.pageY-this.offset.click.top>s[3]&&(r=s[3]+this.offset.click.top)),i.grid&&(t=i.grid[1]?this.originalPageY+Math.round((r-this.originalPageY)/i.grid[1])*i.grid[1]:this.originalPageY,r=!s||t-this.offset.click.top>=s[1]||t-this.offset.click.top>s[3]?t:t-this.offset.click.top>=s[1]?t-i.grid[1]:t+i.grid[1],t=i.grid[0]?this.originalPageX+Math.round((n-this.originalPageX)/i.grid[0])*i.grid[0]:this.originalPageX,n=!s||t-this.offset.click.left>=s[0]||t-this.offset.click.left>s[2]?t:t-this.offset.click.left>=s[0]?t-i.grid[0]:t+i.grid[0]),"y"===i.axis&&(n=this.originalPageX),"x"===i.axis&&(r=this.originalPageY)),{top:r-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:o?0:this.offset.scroll.top),left:n-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:o?0:this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_normalizeRightBottom:function(){"y"!==this.options.axis&&"auto"!==this.helper.css("right")&&(this.helper.width(this.helper.width()),this.helper.css("right","auto")),"x"!==this.options.axis&&"auto"!==this.helper.css("bottom")&&(this.helper.height(this.helper.height()),this.helper.css("bottom","auto"))},_trigger:function(t,e,s){return s=s||this._uiHash(),P.ui.plugin.call(this,t,[e,s,this],!0),/^(drag|start|stop)/.test(t)&&(this.positionAbs=this._convertPositionTo("absolute"),s.offset=this.positionAbs),P.Widget.prototype._trigger.call(this,t,e,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),P.ui.plugin.add("draggable","connectToSortable",{start:function(e,t,s){var i=P.extend({},t,{item:s.element});s.sortables=[],P(s.options.connectToSortable).each(function(){var t=P(this).sortable("instance");t&&!t.options.disabled&&(s.sortables.push(t),t.refreshPositions(),t._trigger("activate",e,i))})},stop:function(e,t,s){var i=P.extend({},t,{item:s.element});s.cancelHelperRemoval=!1,P.each(s.sortables,function(){var t=this;t.isOver?(t.isOver=0,s.cancelHelperRemoval=!0,t.cancelHelperRemoval=!1,t._storedCSS={position:t.placeholder.css("position"),top:t.placeholder.css("top"),left:t.placeholder.css("left")},t._mouseStop(e),t.options.helper=t.options._helper):(t.cancelHelperRemoval=!0,t._trigger("deactivate",e,i))})},drag:function(s,i,o){P.each(o.sortables,function(){var t=!1,e=this;e.positionAbs=o.positionAbs,e.helperProportions=o.helperProportions,e.offset.click=o.offset.click,e._intersectsWith(e.containerCache)&&(t=!0,P.each(o.sortables,function(){return this.positionAbs=o.positionAbs,this.helperProportions=o.helperProportions,this.offset.click=o.offset.click,t=this!==e&&this._intersectsWith(this.containerCache)&&P.contains(e.element[0],this.element[0])?!1:t})),t?(e.isOver||(e.isOver=1,o._parent=i.helper.parent(),e.currentItem=i.helper.appendTo(e.element).data("ui-sortable-item",!0),e.options._helper=e.options.helper,e.options.helper=function(){return i.helper[0]},s.target=e.currentItem[0],e._mouseCapture(s,!0),e._mouseStart(s,!0,!0),e.offset.click.top=o.offset.click.top,e.offset.click.left=o.offset.click.left,e.offset.parent.left-=o.offset.parent.left-e.offset.parent.left,e.offset.parent.top-=o.offset.parent.top-e.offset.parent.top,o._trigger("toSortable",s),o.dropped=e.element,P.each(o.sortables,function(){this.refreshPositions()}),o.currentItem=o.element,e.fromOutside=o),e.currentItem&&(e._mouseDrag(s),i.position=e.position)):e.isOver&&(e.isOver=0,e.cancelHelperRemoval=!0,e.options._revert=e.options.revert,e.options.revert=!1,e._trigger("out",s,e._uiHash(e)),e._mouseStop(s,!0),e.options.revert=e.options._revert,e.options.helper=e.options._helper,e.placeholder&&e.placeholder.remove(),i.helper.appendTo(o._parent),o._refreshOffsets(s),i.position=o._generatePosition(s,!0),o._trigger("fromSortable",s),o.dropped=!1,P.each(o.sortables,function(){this.refreshPositions()}))})}}),P.ui.plugin.add("draggable","cursor",{start:function(t,e,s){var i=P("body"),s=s.options;i.css("cursor")&&(s._cursor=i.css("cursor")),i.css("cursor",s.cursor)},stop:function(t,e,s){s=s.options;s._cursor&&P("body").css("cursor",s._cursor)}}),P.ui.plugin.add("draggable","opacity",{start:function(t,e,s){e=P(e.helper),s=s.options;e.css("opacity")&&(s._opacity=e.css("opacity")),e.css("opacity",s.opacity)},stop:function(t,e,s){s=s.options;s._opacity&&P(e.helper).css("opacity",s._opacity)}}),P.ui.plugin.add("draggable","scroll",{start:function(t,e,s){s.scrollParentNotHidden||(s.scrollParentNotHidden=s.helper.scrollParent(!1)),s.scrollParentNotHidden[0]!==s.document[0]&&"HTML"!==s.scrollParentNotHidden[0].tagName&&(s.overflowOffset=s.scrollParentNotHidden.offset())},drag:function(t,e,s){var i=s.options,o=!1,n=s.scrollParentNotHidden[0],r=s.document[0];n!==r&&"HTML"!==n.tagName?(i.axis&&"x"===i.axis||(s.overflowOffset.top+n.offsetHeight-t.pageY https://better-than-ever.com/wp-includes/js/jquery/ui/droppable.min.js?ver=1.11.4
/*!
* jQuery UI Droppable 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/droppable/
*/
!function(e){"function"==typeof define&&define.amd?define(["jquery","./core","./widget","./mouse","./draggable"],e):e(jQuery)}(function(a){function d(e,t,i){return t<=e&&e https://better-than-ever.com/wp-content/plugins/vibe-course-module/includes/js/course.js?ver=1.9.6
;(function($) {
!function(t){t.fn.liveEdit=function(e){var n,o,i,a,s,l,u=t.extend({afterSaveAll:function(){},doubleClick:function(){}},t.fn.liveEdit.defaults,e),c=[],d=function(e){t(e).attr("contenteditable","true")},r=function(e){t(e).find("a").click(function(t){t.preventDefault()})},f=function(){var t=window.getSelection(),e=t.getRangeAt(0),n=e.getBoundingClientRect();i.addClass("appear"),i.css("top",n.top-(i.height()+8)+window.pageYOffset+"px"),i.css("left",(n.left+n.right)/2-i.width()/2+"px")},h=function(){i.removeClass("appear"),i.css("top","-999px"),i.css("left","-999px")},g=function(e){t(e.focusNode).closest("b").length>0?i.addClass("bold"):i.removeClass("bold"),t(e.focusNode).closest("i").length>0?i.addClass("italic"):i.removeClass("italic"),t(e.focusNode).closest("li").length>0?i.addClass("unorderedlist"):i.removeClass("unorderedlist"),t(e.focusNode).closest("strike").length>0?i.addClass("strikethrough"):i.removeClass("strikethrough"),t(e.focusNode).closest("a").length>0?i.addClass("url"):i.removeClass("url")},b=function(){var t=document.getSelection().anchorNode,e=t&&3===t.nodeType?t.parentNode:t;return e},m=function(e){var n=window.getSelection();return y(),D(t(n.focusNode).closest("[data-editable=true]")),t(e.target).closest(".text-options").length>0?void g(n):(t(n.focusNode).closest("[data-editable=true]").length>0&&0==t(n.focusNode).closest("figure").length?(0===b().children.length&&t(n.focusNode).closest("[data-text-options=true]").length>0&&0==t(n.focusNode).closest("li").length&&0==t(n.focusNode).closest(".caption").length&&document.execCommand("formatBlock",!1,"p"),n.isCollapsed===!0&&l===!1&&h(),n.isCollapsed===!1?t(n.focusNode).closest("[data-text-options=true]").length>0&&(f(),g(n)):h()):h(),void(l=n.isCollapsed))},v=function(){document.execCommand("strong",!1,null)},C=function(){document.execCommand("italic",!1)},x=function(){document.execCommand("strikethrough",!1)},k=function(){document.execCommand("insertunorderedlist",!1),h(),E()},B=function(){i.hasClass("edit-url")?i.removeClass("edit-url"):(i.addClass("edit-url"),setTimeout(function(){var e=window.getSelection();t(e.focusNode).closest("a").length>0?t(urlField).find("input").val(t(e.focusNode).closest("a").attr("href")):document.execCommand("createLink",!1,"/"),lastSelection=window.getSelection().getRangeAt(0),l=!1,t(urlField).find("input").focus()},100))},w=function(){window.getSelection().addRange(lastSelection)},L=function(t){w(),document.execCommand("unlink",!1),""!==t&&(t.match("^(http|https)://")||(t="http://"+t),document.execCommand("createLink",!1,t))},N=function(e){t(e).on("paste",function(t){if(t.preventDefault(),t.originalEvent.clipboardData&&t.originalEvent.clipboardData.getData){var n="",o=t.originalEvent.clipboardData.getData("text/plain").split(/[\r\n]/g);for(p=0;p"+o[p]+"
");document.execCommand("insertHTML",!1,n),setTimeout(function(){D(e)},10)}})},S=function(e){t(e).on("dblclick",function(){setTimeout(function(){var t=window.getSelection();return t.isCollapsed===!0?u.doubleClick.call(this,e,t):void 0},10)})},y=function(){t.each(c,function(e,n){t(n).find("[data-editable=true]").each(function(){1==t(this).data("text-options")&&t(this).find("figure").each(function(){0===t(this).next("p").length&&t(this).after("
")})})})},D=function(e){t(e).find("span").each(function(){t(this).hasClass("caption")||t(this).contents().unwrap()})},E=function(){t.each(c,function(e,n){t(n).find("[data-editable=true]").each(function(){t(this).find("ul").each(function(){t(this).parent("p").length&&t(this).parent("p").contents().unwrap()})})})},T=function(){var e=[];return t.each(c,function(n,o){var i={},a=t(o).data("model"),s=t(o).data("id").toString(),l=t(o).data("url");i.model=a,i.id=s,i.url=l,t(o).find("[data-editable=true]").each(function(){var e=t(this).data("name"),n=t(this).html().replace(/\n/g,"").trim();i[e]=n}),e.push(i)}),u.afterSaveAll.call(this,e)},A=function(){sidebarInterface='",textOptionsInterface=''+u.urlButtonLabel+' '+u.boldButtonLabel+' '+u.italicButtonLabel+' '+u.strikethroughButtonLabel+' '+u.unorderedlistButtonLabel+" ",t("body").append(textOptionsInterface)},F=function(){n=t(".live-edit-sidebar"),o=t(".live-edit-sidebar .save-button"),i=t(".text-options"),urlButton=t(".text-options .url-button"),urlField=t(".text-options span.input-text"),a=t(".text-options .bold-button"),s=t(".text-options .italic-button"),strikethroughButton=t(".text-options .strikethrough-button"),unorderedListButton=t(".text-options .unorderedlist-button")},I=function(){o.on("click",T),urlButton.on("click",B),a.on("click",v),s.on("click",C),strikethroughButton.on("click",x),unorderedListButton.on("click",k),t(urlField).find("input").on("keydown",function(e){13===e.keyCode&&(e.preventDefault(),L(t(this).val()),t(this).blur())}),t(urlField).find("input").on("blur",function(){i.removeClass("edit-url"),L(t(this).val()),t(this).val(""),g(window.getSelection().focusNode)}),t(document).on("keyup",m),t(document).on("mousedown",m),t(document).on("mouseup",function(t){setTimeout(function(){m(t)},1)})};A(),F(),I();var R=function(e){var n=t(e).data("max-length");n&&t(e).on("keypress",function(t){(t.target.innerText.length>n||13===t.keyCode)&&t.preventDefault()})};return t.fn.liveEdit.loadingState=function(t){"on"==t?n.addClass("loading-state"):n.removeClass("loading-state")},this.each(function(){c.push(this),t(this).find("[data-editable=true]").each(function(){d(this),r(this),R(this),N(this),S(this)})})},t.fn.liveEdit.defaults={saveButtonLabel:"S",urlButtonLabel:"U",boldButtonLabel:"B",italicButtonLabel:"I",strikethroughButtonLabel:"ABC",unorderedlistButtonLabel:"L"}}(jQuery);
(function(e){"use strict";function t(t){var n=e("");try{n=e(t).clone()}catch(r){n=e(" ").html(t)}return n}function n(e){return!!(typeof Node==="object"?e instanceof Node:e&&typeof e==="object"&&typeof e.nodeType==="number"&&typeof e.nodeName==="string")}e.print=e.fn.print=function(){var r,i,s=this;if(s instanceof e){s=s.get(0)}if(n(s)){i=e(s);if(arguments.length>0){r=arguments[0]}}else{if(arguments.length>0){i=e(arguments[0]);if(n(i[0])){if(arguments.length>1){r=arguments[1]}}else{r=arguments[0];i=e("html")}}else{i=e("html")}}var o={globalStyles:true,mediaPrint:false,stylesheet:null,noPrintSelector:".no-print",iframe:true,append:null,prepend:null};r=e.extend({},o,r||{});var u=e("");if(r.globalStyles){u=e("style, link, meta, title")}else if(r.mediaPrint){u=e("link[media=print]")}if(r.stylesheet){u=e.merge(u,e(' '))}var a=i.clone();a=e(" ").append(a);a.find(r.noPrintSelector).remove();a.append(u.clone());a.append(t(r.append));a.prepend(t(r.prepend));var f=a.html();a.remove();var l,c;if(r.iframe){try{var h=e(r.iframe+"");var p=h.length;if(p===0){h=e('').prependTo("body").css({position:"absolute",top:-999,left:-999})}l=h.get(0);l=l.contentWindow||l.contentDocument||l;c=l.document||l.contentDocument||l;c.open();c.write(f);c.close();setTimeout(function(){l.focus();l.print();setTimeout(function(){if(p===0){h.remove()}},100)},250)}catch(d){console.error("Failed to print from iframe",d.stack,d.message);l=window.open();l.document.write(f);l.document.close();l.focus();l.print();l.close()}}else{l=window.open();l.document.write(f);l.document.close();l.focus();l.print();l.close()}return this}})(jQuery);
$.fn.timer = function( useroptions ){
var $this = $(this), opt,newVal, count = 0;
opt = $.extend( {
// Config
'timer' : 300, // 300 second default
'width' : 24 ,
'height' : 24 ,
'fgColor' : "#ED7A53" ,
'bgColor' : "#232323"
}, useroptions
);
$this.knob({
'min':0,
'max': opt.timer,
'readOnly': true,
'width': opt.width,
'height': opt.height,
'fgColor': opt.fgColor,
'bgColor': opt.bgColor,
'displayInput' : false,
'dynamicDraw': false,
'ticks': 0,
'thickness': 0.1
});
setInterval(function(){
newVal = ++count;
$this.val(newVal).trigger('change');
}, 1000);
};
$.urlParam = function(name){
var results = new RegExp('[\?&]' + name + '=([^]*)').exec(window.location.href);
if (results==null){
return null;
}
else{
return results[1] || 0;
}
}
// Necessary functions
function runnecessaryfunctions(){
jQuery('.fitvids').fitVids();
jQuery('.tip').tooltip();
jQuery('.nav-tabs li:first a').tab('show');
jQuery('.nav-tabs li a').click(function(event){
event.preventDefault();
$(this).tab('show');
});
$('audio,video').mediaelementplayer();
jQuery('.gallery').magnificPopup({
delegate: 'a',
type: 'image',
tLoading: 'Loading image #%curr%...',
mainClass: 'mfp-img-mobile',
gallery: {
enabled: true,
navigateByImgClick: true,
preload: [0,1] // Will preload 0 - before current, and 1 after the current image
},
image: {
tError: 'The image #%curr% could not be loaded.',
titleSrc: function(item) {
return item.el.attr('title');
}
}
});
$('.open_popup_link').magnificPopup({
type:'inline',
midClick: true
});
$('.ajax-popup-link').magnificPopup({
type: 'ajax',
alignTop: true,
fixedContentPos: true,
fixedBgPos: true,
overflowY: 'auto',
closeBtnInside: true,
preloader: false,
midClick: true,
removalDelay: 300,
mainClass: 'my-mfp-zoom-in'
});
$('.quiz_results_popup').magnificPopup({
type: 'ajax',
alignTop: true,
fixedContentPos: true,
fixedBgPos: true,
overflowY: 'auto',
closeBtnInside: true,
preloader: false,
midClick: true,
removalDelay: 300,
mainClass: 'my-mfp-zoom-in',
callbacks: {
parseAjax: function( mfpResponse ) {
mfpResponse.data = $(mfpResponse.data).find('#item-body');
},
ajaxContentAdded: function(){
$('.show_explaination').on('click',function(event){
event.preventDefault();
var $this = $(this);
$this.toggleClass('active');
$this.closest('li').find('.explaination').toggle();
});
$('#prev_results a').on('click',function(event){
event.preventDefault();
$(this).toggleClass('show');
$('.prev_quiz_results').toggleClass('show');
});
$('.print_results').click(function(event){
event.preventDefault();
$('.quiz_result').print();
});
$('.quiz_retake_form.start_quiz').on('click',function(e){
e.preventDefault();
var qid=$('#unit.quiz_title').attr('data-unit');
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'retake_inquiz',
security: $('#hash').val(),
quiz_id:qid,
},
cache: false,
success: function (html) {
$('a.unit[data-unit="'+qid+'"]').trigger('click');
$.magnificPopup.close();
$('#unit'+qid).removeClass('done');
var i = sessionStorage.length;
while(i--) {
var key = sessionStorage.key(i);
if($.isNumeric(key)) {
sessionStorage.removeItem(key);
}
}
$('body').find('.course_progressbar').removeClass('increment_complete');
$('body').find('.course_progressbar').trigger('decrement');
}
});
});
}
}
});
if ( typeof vc_js == 'function' ) {
window.vc_js();
}
}
//AJAX Comments
function ajaxsubmit_comments(){
$('#question').each(function(){
var $this=$(this);
$('#submit').click(function(event){
event.preventDefault();
var value = '';
$('#ajaxloader').removeClass('disabled');
$('#question').css('opacity',0.2);
if($this.find('input[type="radio"]:checked').length)
$this.find('input[type="radio"]:checked').each(function(){
value = $(this).val();
});
if($this.find('input[type="checkbox"]:checked').length)
$this.find('input[type="checkbox"]:checked').each(function(){
value= $(this).val()+','+value;
});
if($this.find('.vibe_fillblank').length)
$this.find('.vibe_fillblank').each(function(){
value += $(this).text();
});
if($this.find('#vibe_select_dropdown').length)
value = $this.find('#vibe_select_dropdown').val();
if($this.find('.matchgrid_options li.match_option').length){
$('.matchgrid_options li.match_option').each(function(){
var id = $(this).attr('id');
if( jQuery.isNumeric(id))
value +=id+',';
});
}
if($('#comment').hasClass('option_value'))
$('#comment.option_value').val(value);
$('#commentform').submit();
});
var commentform=$('#commentform'); // find the comment form
var statusdiv=$('#comment-status'); // define the infopanel
var qid = statusdiv.attr('data-quesid');
commentform.submit(function(){
var formdata=commentform.serialize();
statusdiv.html(''+vibe_course_module_strings.processing+'
');
var formurl=commentform.attr('action');
$.ajax({
type: 'post',
url: formurl,
data: formdata,
error: function(XMLHttpRequest, textStatus, errorThrown){
$('#ajaxloader').addClass('disabled');
$('#question').css('opacity',1);
statusdiv.html(''+vibe_course_module_strings.too_fast_answer+'
');
setTimeout(function(){statusdiv.hide(300).html('').show();}, 2000);
},
success: function(data, textStatus){
$('#question').css('opacity',1);
$('#ajaxloader').addClass('disabled');
if(data=="success"){
statusdiv.html(''+vibe_course_module_strings.answer_saved+'
');
setTimeout(function(){statusdiv.hide(300).html('').show();}, 2000);
$('#ques'+qid).addClass('done');
$('.reset_answer').removeClass('hide');
}
else{
statusdiv.html(''+vibe_course_module_strings.saving_answer+'
');
setTimeout(function(){statusdiv.hide(300).html('').show();}, 2000);
}
}
});
return false;
});
});
} // END Function
//Cookie evaluation
jQuery(document).ready( function($) {
$('.open_popup_link').magnificPopup({
type:'inline',
midClick: true
});
$('.item-list').each(function(){
var cookie_name = 'bp-'+$('.item-list').attr('id');
var cookieValue = $.cookie(cookie_name);
if ((cookieValue !== null) && cookieValue == 'grid') {
$('.item-list').addClass('grid');
$('#list_view').removeClass('active');
$('#grid_view').addClass('active');
}
});
function bp_course_extras_cookies(){
$('.category_filter .bp-course-category-filter,.type_filter .bp-course-free-filter,.level_filter .bp-course-level-filter,.instructor_filter .bp-course-instructor-filter').on('click',function(){
var category_filter=[];
$('.bp-course-category-filter:checked').each(function(){
var category={'type':'course-cat','value':$(this).val()};
category_filter.push(category);
});
$('.bp-course-free-filter:checked').each(function(){
var free={'type':'free','value':$(this).val()};
category_filter.push(free);
});
$('.bp-course-level-filter:checked').each(function(){
var level={'type':'level','value':$(this).val()};
category_filter.push(level);
});
$('.bp-course-instructor-filter:checked').each(function(){
var level={'type':'instructor','value':$(this).val()};
category_filter.push(level);
});
$.cookie('bp-course-extras', JSON.stringify(category_filter), { expires: 1 ,path: '/'});
});
}
function bp_course_category_filter_cookie(){
var category_filter_cookie = $.cookie("bp-course-extras");
if ((category_filter_cookie !== null)) {
var category_filter = JSON.parse(category_filter_cookie);
if($('#active_filters').length){
$('#active_filters').fadeIn(200);
}else{
$('#course-dir-list').before(''+vibe_course_module_strings.active_filters+' ');
}
//Detect and activate specific filters
jQuery.each(category_filter, function(index, item) {
$('input[value="'+item['value']+'"]').prop('checked', true);
var id = $('input[value="'+item['value']+'"]').attr('id');
var text = $('label[for="'+id+'"]').text();
if(!$('#active_filters span[data-id="'+id+'"]').length)
$('#active_filters').append(''+text+' ');
});
// Delete a specific filter
$('#active_filters li span').on('click',function(){
var id = $(this).attr('data-id');
$(this).parent().fadeOut(200,function(){
$(this).remove();
if($('#active_filters li').length < 3)
$('#active_filters').fadeOut(200);
else
$('#active_filters').fadeIn(200);
});
$('#'+id).prop('checked',false);
/*===== */
var category_filter=[];
$('.bp-course-category-filter:checked').each(function(){
var category={'type':'course-cat','value':$(this).val()};
category_filter.push(category);
});
$('.bp-course-free-filter:checked').each(function(){
var free={'type':'free','value':$(this).val()};
category_filter.push(free);
});
$('.bp-course-level-filter:checked').each(function(){
var level={'type':'level','value':$(this).val()};
category_filter.push(level);
});
$('.bp-course-instructor-filter:checked').each(function(){
var level={'type':'instructor','value':$(this).val()};
category_filter.push(level);
});
$.cookie('bp-course-extras', JSON.stringify(category_filter), { expires: 1 ,path: '/'});
$('#submit_filters').trigger('click');
/* ==== */
});
if(!$('#active_filters .all-filter-clear').length)
$('#active_filters').append(''+vibe_course_module_strings.clear_filters+' ');
// Clear all Filters link
$('#active_filters li.all-filter-clear').click(function(){
$('#active_filters li').each(function(){
var span = $(this).find('span');
var id = span.attr('data-id');
span.parent().fadeOut(200,function(){
$(this).remove(); });
$('#'+id).prop('checked',false);
$('#active_filters').fadeOut(200,function(){
$(this).remove();
});
$.removeCookie('bp-course-extras', { path: '/' });
$('#submit_filters').trigger('click');
});
});
// End Clear All
// Hide is no filter active
if($('#active_filters li').length < 3)
$('#active_filters').fadeOut(200);
else
$('#active_filters').fadeIn(200);
}
}
bp_course_category_filter_cookie();
bp_course_extras_cookies();
/*=========================================================================*/
$('.category_filter li > span,.category_filter li > label').click(function(event){
var parent= $(this).parent();
$('.category_filter li > span').toggleClass('active');
parent.find('ul.sub_categories').toggle(300);
});
$('#submit_filters').on('click',function(){
if ( jq('.item-list-tabs li.selected').length )
var el = jq('.item-list-tabs li.selected');
else
var el = jq(this);
var css_id = el.attr('id').split('-');
var object = css_id[0];
var scope = css_id[1];
var filter = jq(this).val();
var search_terms = false;
if ( jq('.dir-search input').length )
search_terms = jq('.dir-search input').val();
if ( 'friends' == object )
object = 'members';
bp_course_extras_cookies();
bp_filter_request( object, filter, scope, 'div.' + object, search_terms, 1, jq.cookie('bp-' + object + '-extras') );
bp_course_category_filter_cookie();
return false;
});
$('.quiz_results_popup').magnificPopup({
type: 'ajax',
alignTop: true,
fixedContentPos: true,
fixedBgPos: true,
overflowY: 'auto',
closeBtnInside: true,
preloader: false,
midClick: true,
removalDelay: 300,
mainClass: 'my-mfp-zoom-in',
callbacks: {
parseAjax: function( mfpResponse ) {
mfpResponse.data = $(mfpResponse.data).find('#item-body');
},
ajaxContentAdded: function() {
$('#prev_results a').on('click',function(event){
event.preventDefault();
$(this).toggleClass('show');
$('.prev_quiz_results').toggleClass('show');
});
$('.print_results').click(function(event){
event.preventDefault();
$('.quiz_result').print();
});
$('.quiz_retake_form.start_quiz').on('click',function(e){
e.preventDefault();
var qid=$('#unit.quiz_title').attr('data-unit');
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'retake_inquiz',
security: $('#hash').val(),
quiz_id:qid,
},
cache: false,
success: function (html) {
$('a.unit[data-unit="'+qid+'"]').trigger('click');
$.magnificPopup.close();
$('#unit'+qid).removeClass('done');
$('body').find('.course_progressbar').removeClass('increment_complete');
$('body').find('.course_progressbar').trigger('decrement');
}
});
});
}
}
});
$('#grid_view').click(function(){
if(!$('.item-list').hasClass('grid')){
$('.item-list').addClass('grid');
}
var cookie_name = 'bp-'+$('.item-list').attr('id');
$.cookie(cookie_name, 'grid', { expires: 2 ,path: '/'});
$('#list_view').removeClass('active');
$(this).addClass('active');
});
$('#list_view').click(function(){
$('.item-list').removeClass('grid');
var cookie_name = 'bp-'+$('.item-list').attr('id');
$.cookie(cookie_name, 'list', { expires: 2 ,path: '/'});
$('#grid_view').removeClass('active');
$(this).addClass('active');
});
$("#average .dial").knob({
'readOnly': true,
'width': 120,
'height': 120,
'fgColor': vibe_course_module_strings.theme_color,
'bgColor': '#f6f6f6',
'thickness': 0.1
});
$("#pass .dial").knob({
'readOnly': true,
'width': 120,
'height': 120,
'fgColor': vibe_course_module_strings.theme_color,
'bgColor': '#f6f6f6',
'thickness': 0.1
});
$("#badge .dial").knob({
'readOnly': true,
'width': 120,
'height': 120,
'fgColor': vibe_course_module_strings.theme_color,
'bgColor': '#f6f6f6',
'thickness': 0.1
});
$(".course_quiz .dial").knob({
'readOnly': true,
'width': 120,
'height': 120,
'fgColor': vibe_course_module_strings.theme_color,
'bgColor': '#f6f6f6',
'thickness': 0.1
});
//RESET Ajx
$( 'body' ).delegate( '.remove_user_course','click',function(event){
event.preventDefault();
var course_id=$(this).attr('data-course');
var user_id=$(this).attr('data-user');
$(this).addClass('animated spin');
var $this = $(this);
$.confirm({
text: vibe_course_module_strings.remove_user_text,
confirm: function() {
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'remove_user_course',
security: $('#security').val(),
id: course_id,
user: user_id
},
cache: false,
success: function (html) {
$(this).removeClass('animated');
$(this).removeClass('spin');
runnecessaryfunctions();
$('#message').html(html);
$('#s'+user_id).fadeOut('fast');
}
});
},
cancel: function() {
$this.removeClass('animated');
$this.removeClass('spin');
},
confirmButton: vibe_course_module_strings.remove_user_button,
cancelButton: vibe_course_module_strings.cancel
});
});
$( 'body' ).delegate( '.reset_course_user','click',function(event){
event.preventDefault();
var course_id=$(this).attr('data-course');
var user_id=$(this).attr('data-user');
$(this).addClass('animated spin');
var $this = $(this);
$.confirm({
text: vibe_course_module_strings.reset_user_text,
confirm: function() {
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'reset_course_user',
security: $('#security').val(),
id: course_id,
user: user_id
},
cache: false,
success: function (html) {
$this.removeClass('animated');
$this.removeClass('spin');
var cookie_id = 'course_progress'+course_id;
$.removeCookie(cookie_id,{ path: '/' });
$('#message').html(html);
}
});
},
cancel: function() {
$this.removeClass('animated');
$this.removeClass('spin');
},
confirmButton: vibe_course_module_strings.reset_user_button,
cancelButton: vibe_course_module_strings.cancel
});
});
$( 'body' ).delegate( '.course_stats_user', 'click', function(event){
event.preventDefault();
var $this=$(this);
var course_id=$this.attr('data-course');
var user_id=$this.attr('data-user');
if($this.hasClass('already')){
$('#s'+user_id).find('.course_stats_user').fadeIn('fast');
}else{
$this.addClass('animated spin');
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'course_stats_user',
security: $('#security').val(),
id: course_id,
user: user_id
},
cache: false,
success: function (html) {
$this.removeClass('animated');
$this.removeClass('spin');
$this.addClass('already');
$('#s'+user_id).append(html);
$(".dial").knob({
'readOnly': true,
'width': 160,
'height': 160,
'fgColor': vibe_course_module_strings.theme_color,
'bgColor': '#f6f6f6',
'thickness': 0.3
});
}
});
}
});
$('.data_stats li').click(function(event){
event.preventDefault();
var defaultxt = $(this).html();
var content = $('.content');
var $this = $(this);
var id = $(this).attr('id');
if(id == 'desc'){
$('.main_content').show();
$('.stats_content').hide();
}else{
if($(this).hasClass('loaded')){
$('.main_content').hide();
$('.stats_content').show();
}else{
$this.addClass('loaded');
$('.main_content').hide();
$(this).html(' ');
var quiz_id = $this.parent().attr('data-id');
var cpttype = $this.parent().attr('data-type');
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'load_stats',
cpttype: cpttype,
id: quiz_id
},
cache: false,
success: function (html) {
$('.main_content').after(html);
setTimeout(function(){$this.html(defaultxt); }, 1000);
}
});
}
}
$this.parent().find('.active').removeClass('active');
$this.addClass('active');
});
$('#calculate_avg_course').click(function(event){
event.preventDefault();
var course_id=$(this).attr('data-courseid');
$(this).addClass('animated spin');
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'calculate_stats_course',
security: $('#security').val(),
id: course_id
},
cache: false,
success: function (html) {
$(this).removeClass('animated');
$(this).removeClass('spin');
$('#message').html(html);
setTimeout(function(){location.reload();}, 3000);
}
});
});
$('.reset_quiz_user').click(function(event){
event.preventDefault();
var course_id=$(this).attr('data-quiz');
var user_id=$(this).attr('data-user');
$(this).addClass('animated spin');
var $this = $(this);
$.confirm({
text: vibe_course_module_strings.quiz_rest,
confirm: function() {
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'reset_quiz',
security: $('#qsecurity').val(),
id: course_id,
user: user_id
},
cache: false,
success: function (html) {
$(this).removeClass('animated');
$(this).removeClass('spin');
$('#message').html(html);
$('#qs'+user_id).fadeOut('fast');
}
});
},
cancel: function() {
$this.removeClass('animated');
$this.removeClass('spin');
},
confirmButton: vibe_course_module_strings.quiz_rest_button,
cancelButton: vibe_course_module_strings.cancel
});
});
$('.evaluate_quiz_user').click(function(event){
event.preventDefault();
var quiz_id=$(this).attr('data-quiz');
var user_id=$(this).attr('data-user');
$(this).addClass('animated spin');
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'evaluate_quiz',
security: $('#qsecurity').val(),
id: quiz_id,
user: user_id
},
cache: false,
success: function (html) {
$(this).removeClass('animated');
$(this).removeClass('spin');
$('.quiz_students').html(html);
calculate_total_marks();
}
});
});
$('.evaluate_course_user').click(function(event){
event.preventDefault();
var course_id=$(this).attr('data-course');
var user_id=$(this).attr('data-user');
$(this).addClass('animated spin');
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'evaluate_course',
security: $('#security').val(),
id: course_id,
user: user_id
},
cache: false,
success: function (html) {
$(this).removeClass('animated');
$(this).removeClass('spin');
$('.course_students').html(html);
calculate_total_marks();
}
});
});
$( 'body' ).delegate( '.reset_answer', 'click', function(event){
event.preventDefault();
var ques_id=$('#comment-status').attr('data-quesid');
var $this = $(this);
var qid = $('#comment-status').attr('data-quesid');
$this.prepend(' ');
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'reset_question_answer',
security: $this.attr('data-security'),
ques_id: ques_id,
},
cache: false,
success: function (html) {
$this.find('i').remove();
$('#comment-status').html(html);
$('#ques'+qid).removeClass('done');
setTimeout(function(){ $this.addClass('hide');}, 500);
}
});
});
$( 'body' ).delegate( '#course_complete', 'click', function(event){
event.preventDefault();
var $this=$(this);
var user_id=$this.attr('data-user');
var course = $this.attr('data-course');
var marks = parseInt($('#course_marks_field').val());
if(marks <= 0){
alert('Enter Marks for User');
return;
}
$this.prepend(' ');
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'complete_course_marks',
security: $('#security').val(),
course: course,
user: user_id,
marks:marks
},
cache: false,
success: function (html) {
$this.find('i').remove();
$this.html(html);
}
});
});
// Registeration BuddyPress
$('.register-section h4').click(function(){
$(this).toggleClass('show');
$(this).parent().find('.editfield').toggle('fast');
});
});
$( 'body' ).delegate( '.hide_parent', 'click', function(event){
$(this).parent().fadeOut('fast');
});
$( 'body' ).delegate( '.give_marks', 'click', function(event){
event.preventDefault();
var $this=$(this);
var ansid=$this.attr('data-ans-id');
var aval = $('#'+ansid).val();
$this.prepend(' ');
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'give_marks',
aid: ansid,
aval: aval
},
cache: false,
success: function (html) {
$this.find('i').remove();
$this.html(vibe_course_module_strings.marks_saved);
}
});
});
$( 'body' ).delegate( '#mark_complete', 'click', function(event){
event.preventDefault();
var $this=$(this);
var quiz_id=$this.attr('data-quiz');
var user_id = $this.attr('data-user');
var marks = parseInt($('#total_marks strong > span').text());
$this.prepend(' ');
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'save_quiz_marks',
quiz_id: quiz_id,
user_id: user_id,
marks: marks,
},
cache: false,
success: function (html) {
$this.find('i').remove();
$this.html(vibe_course_module_strings.quiz_marks_saved);
}
});
});
function calculate_total_marks(){
$('.question_marks').blur(function(){
var marks=parseInt(0);
var $this = $('#total_marks strong > span');
$('.question_marks').each(function(){
if($(this).val())
marks = marks + parseInt($(this).val());
});
$this.html(marks);
});
}
$( 'body' ).delegate( '.submit_quiz', 'click', function(event){
event.preventDefault();
$('#ajaxloader').removeClass('disabled');
if($(this).hasClass('disabled')){
return false;
}
var $this = $(this);
var quiz_id=$(this).attr('data-quiz');
$this.prepend(' ');
$('#question').addClass('quiz_submitted_fade');
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'submit_quiz',
start_quiz: $('#start_quiz').val(),
id: quiz_id
},
cache: false,
success: function (html) {
$('#question').css('opacity',0.2);
$this.find('i').remove();
window.location.assign(document.URL);
}
});
});
// QUIZ RELATED FUCNTIONS
// START QUIZ AJAX
jQuery(document).ready( function($) {
$('.begin_quiz').click(function(event){
event.preventDefault();
var $this = $(this);
var quiz_id=$(this).attr('data-quiz');
$this.prepend(' ');
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'begin_quiz',
start_quiz: $('#start_quiz').val(),
id: quiz_id
},
cache: false,
success: function (html) {
$this.find('i').remove();
$('.content').fadeOut("fast");
$('.content').html(html);
$('.content').fadeIn("fast");
ajaxsubmit_comments();
var ques=$($.parseHTML(html)).filter("#question");
var q='#ques'+ques.attr('data-ques');
$('.quiz_timeline').find('.active').removeClass('active');
$(q).addClass('active');
$('#question').trigger('question_loaded');
if(ques != 'undefined'){
$('.quiz_timer').trigger('activate');
}
runnecessaryfunctions();
$('.begin_quiz').each(function(){
$(this).removeClass('begin_quiz');
$(this).addClass('submit_quiz');
$(this).text(vibe_course_module_strings.submit_quiz);
});
}
});
});
});
$( 'body' ).delegate( '.show_hint', 'click', function(event){
event.preventDefault();
$(this).toggleClass('active');
$(this).parent().find('.hint').toggle(400);
});
$('.show_explaination').click(function(event){
event.preventDefault();
var $this = $(this);
$this.toggleClass('active');
$this.closest('li').find('.explaination').toggle();
});
$( 'body' ).delegate( '.quiz_question', 'click', function(event){
event.preventDefault();
var $this = $(this);
var quiz_id=$(this).attr('data-quiz');
var ques_id=$(this).attr('data-qid');
$this.prepend(' ');
$('#ajaxloader').removeClass('disabled');
$('#question').css('opacity',0.2);
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'quiz_question',
start_quiz: $('#start_quiz').val(),
quiz_id: quiz_id,
ques_id: ques_id
},
cache: false,
success: function (html) {
$this.find('i').remove();
$('.content').html(html);
$('#ajaxloader').addClass('disabled');
$('#question').css('opacity',1);
ajaxsubmit_comments();
var ques=$($.parseHTML(html)).filter("#question");
var q='#ques'+ques.attr('data-ques');
$('.quiz_timeline').find('.active').removeClass('active');
$(q).addClass('active');
$('#question').trigger('question_loaded');
$('.tip').tooltip();
//if(ques != 'undefined')
//$('.quiz_timer').trigger('activate');
$('audio,video').mediaelementplayer();
//END Match question type
//
if($('.timeline_wrapper').height() > $('.quiz_timeline').height()){
$('.quiz_timeline').animate({scrollTop: $(q).position().top}, 'slow');
}
}
});
});
$( 'body' ).delegate( '#question', 'question_loaded',function(){
runnecessaryfunctions();
jQuery('.question_options.sort').each(function(){
var defaultanswer='1';
var lastindex = $('ul.question_options li').size();
if(lastindex>1)
for(var i=2;i<=lastindex;i++){
defaultanswer = defaultanswer+','+i;
}
$('#comment').val(defaultanswer);
$('#comment').trigger('change');
jQuery('.question_options.sort').sortable({
revert: true,
cursor: 'move',
refreshPositions: true,
opacity: 0.6,
scroll:true,
containment: 'parent',
placeholder: 'placeholder',
tolerance: 'pointer',
update: function( event, ui ) {
var order = $('.question_options.sort').sortable('toArray').toString();
$('#comment').val(order);
$('#comment').trigger('change');
}
}).disableSelection();
});
//Fill in the Blank Live EDIT
$(".live-edit").liveEdit({
afterSaveAll: function(params) {
return false;
}
});
//Match question type
$('.question_options.match').droppable({
drop: function( event, ui ){
$(ui.draggable).removeAttr('style');
$( this )
.addClass( "ui-state-highlight" )
.append($(ui.draggable))
}
});
$('.question_options.match li').draggable({
revert: "invalid",
containment:'#question'
});
$( ".matchgrid_options li" ).droppable({
activeClass: "ui-state-default",
hoverClass: "ui-state-hover",
drop: function( event, ui ){
childCount = $(this).find('li').length;
$(ui.draggable).removeAttr('style');
if (childCount !=0){
return;
}
$( this )
.addClass( "ui-state-highlight" )
.append($(ui.draggable))
}
});
if($('.matchgrid_options').hasClass('saved_answer')){
var id;
$('.matchgrid_options li').each(function(index,value){
id = $('.matchgrid_options').attr('data-match'+index);
$(this).append($('#'+id));
});
}
});
jQuery(document).ready( function($) {
$('.quiz_timer').one('activate',function(){
var qtime = parseInt($(this).attr('data-time'));
var $timer =$(this).find('.timer');
var $this=$(this);
$timer.timer({
'timer': qtime,
'width' : 200 ,
'height' : 200 ,
'fgColor' : vibe_course_module_strings.theme_color ,
'bgColor' : vibe_course_module_strings.single_dark_color
});
var $timer =$(this).find('.timer');
$timer.on('change',function(){
var countdown= $this.find('.countdown');
var val = parseInt($timer.attr('data-timer'));
if(val > 0){
val--;
$timer.attr('data-timer',val);
var $text='';
if(val > 60){
$text = Math.floor(val/60) + ':' + ((parseInt(val%60) < 10)?'0'+parseInt(val%60):parseInt(val%60)) + '';
}else{
$text = '00:'+ ((val < 10)?'0'+val:val);
}
countdown.html($text);
}else{
countdown.html(vibe_course_module_strings.theme_color);
if(!$('.submit_quiz').hasClass('triggerred')){
$('.submit_quiz').trigger('click');
$('.submit_quiz').addClass('triggerred');
}
$('.quiz_timer').trigger('end');
}
});
});
$('.quiz_timer').one('deactivate',function(){
var qtime = parseInt($(this).attr('data-time'));
var $timer =$(this).find('.timer');
var $this=$(this);
$timer.knob({
'readonly':true,
'max': qtime,
'width' : 200 ,
'height' : 200 ,
'fgColor' : vibe_course_module_strings.theme_color ,
'bgColor' : vibe_course_module_strings.single_dark_color,
'thickness': 0.2 ,
'readonly':true
});
event.stopPropagation();
});
$('.quiz_timer').one('end',function(event){
var qtime = parseInt($(this).attr('data-time'));
var $timer =$(this).find('.timer');
var $this=$(this);
$timer.knob({
'readonly':true,
'max': qtime,
'width' : 200 ,
'height' : 200 ,
'fgColor' : vibe_course_module_strings.theme_color ,
'bgColor' : vibe_course_module_strings.single_dark_color,
'thickness': 0.2 ,
'readonly':true
});
event.stopPropagation();
});
// Timer function runs after Trigger event definition
$('.quiz_timer').each(function(){
var qtime = parseInt($(this).attr('data-time'));
var $timer =$(this).find('.timer');
$timer.knob({
'readonly':true,
'max': qtime,
'width' : 200 ,
'height' : 200 ,
'fgColor' : vibe_course_module_strings.theme_color ,
'bgColor' : vibe_course_module_strings.single_dark_color,
'thickness': 0.2 ,
'readonly':true
});
if($(this).hasClass('start')){
$('.quiz_timer').trigger('activate');
}
});
jQuery('.question_options.sort').each(function(){
var defaultanswer='1';
var lastindex = $('ul.question_options li').size();
if(lastindex>1)
for(var i=2;i<=lastindex;i++){
defaultanswer = defaultanswer+','+i;
}
$('#comment').val(defaultanswer);
$('#comment').trigger('change');
jQuery('.question_options.sort').sortable({
revert: true,
cursor: 'move',
refreshPositions: true,
opacity: 0.6,
scroll:true,
containment: 'parent',
placeholder: 'placeholder',
tolerance: 'pointer',
update: function( event, ui ) {
var order = $('.question_options.sort').sortable('toArray').toString();
$('#comment').val(order);
$('#comment').trigger('change');
}
}).disableSelection();
});
});
$( 'body' ).on( 'click','.expand_message',function(event){
event.preventDefault();
$('.bulk_message').toggle('slow');
});
$('body').on('click','.expand_change_status',function(event){
event.preventDefault();
$('.bulk_change_status').toggle('slow');
$('#status_action').on('change',function(){
if($(this).val() === 'finish_course' ){
$('#finish_marks').removeClass('hide');
}else{
$('#finish_marks').addClass('hide');
}
});
});
$( 'body' ).on( 'click','.expand_add_students',function(event){
event.preventDefault();
$('.bulk_add_students').toggle('slow');
});
$( 'body' ).on( 'click','.expand_assign_students', function(event){
event.preventDefault();
$('.bulk_assign_students').toggle('slow');
});
$( 'body' ).on( 'click','.extend_subscription_students', function(event){
event.preventDefault();
$('.bulk_extend_subscription_students').toggle('slow');
});
$( 'body' ).delegate( '#send_course_message', 'click', function(event){
event.preventDefault();
var members=[];
var $this = $(this);
var defaultxt=$this.html();
$this.html(' '+vibe_course_module_strings.sending_messages);
var i=0;
$('.member').each(function(){
if($(this).is(':checked')){
members[i]=$(this).val();
i++;
}
});
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'send_bulk_message',
security: $('#buk_action').val(),
course:$this.attr('data-course'),
sender: $('#sender').val(),
members: JSON.stringify(members),
subject: $('#bulk_subject').val(),
message: $('#bulk_message').val(),
},
cache: false,
success: function (html) {
$('#send_course_message').html(html);
setTimeout(function(){$this.html(defaultxt);}, 5000);
}
});
});
$( 'body' ).delegate( '#add_student_to_course', 'click', function(event){
event.preventDefault();
var $this = $(this);
var defaultxt=$this.html();
var students = $('#student_usernames').val();
if(students.length <= 0){
$('#add_student_to_course').html(vibe_course_module_strings.unable_add_students);
setTimeout(function(){$this.html(defaultxt);}, 2000);
return;
}
$this.html(' '+vibe_course_module_strings.adding_students);
var i=0;
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'add_bulk_students',
security: $('#buk_action').val(),
course:$this.attr('data-course'),
members: students,
},
cache: false,
success: function (html) {
if(html.length && html !== '0'){
$('#add_student_to_course').html(vibe_course_module_strings.successfuly_added_students);
$('ul.course_students').append(html);
}else{
$('#add_student_to_course').html(vibe_course_module_strings.unable_add_students);
}
setTimeout(function(){$this.html(defaultxt);}, 3000);
}
});
});
$( 'body' ).delegate( '#download_stats', 'click', function(event){
event.preventDefault();
var $this = $(this);
var defaultxt=$this.html();
var i=0;
var fields=[];
$('.field:checked').each(function(){
fields[i]=$(this).attr('id');//$(this).val();
i++;
});
if(i==0){
$this.html(vibe_course_module_strings.select_fields);
setTimeout(function(){$this.html(defaultxt);}, 13000);
return false;
}else{
$this.html(' '+vibe_course_module_strings.processing);
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'download_stats',
security: $('#stats_security').val(),
course:$this.attr('data-course'),
fields: JSON.stringify(fields),
type:$('#stats_students').val()
},
cache: false,
success: function (html) {
$this.attr('href',html);
$this.attr('id','download');
$this.html(vibe_course_module_strings.download)
//setTimeout(function(){$this.html(defaultxt);}, 5000);
}
});
}
});
$('body').delegate('#download_mod_stats','click',function(event){
event.preventDefault();
var $this = $(this);
var defaultxt=$this.html();
var i=0;
var fields=[];
$('.field:checked').each(function(){
fields[i]=$(this).attr('id');//$(this).val();
i++;
});
if(i==0){
$this.html(vibe_course_module_strings.select_fields);
setTimeout(function(){$this.html(defaultxt);}, 13000);
return false;
}else{
$this.html(' '+vibe_course_module_strings.processing);
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'download_mod_stats',
security: $('#stats_security').val(),
type:$this.attr('data-type'),
id:$this.attr('data-id'),
fields: JSON.stringify(fields),
select:$('#stats_students').val()
},
cache: false,
success: function (html) {
$this.attr('href',html);
$this.attr('id','download');
$this.html(vibe_course_module_strings.download)
//setTimeout(function(){$this.html(defaultxt);}, 5000);
}
});
}
});
$( 'body' ).delegate( '#assign_course_badge_certificate', 'click', function(event){
event.preventDefault();
var members=[];
var $this = $(this);
var defaultxt=$this.html();
$this.html(' '+vibe_course_module_strings.processing);
var i=0;
$('.member').each(function(){
if($(this).is(':checked')){
members[i]=$(this).val();
i++;
}
});
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'assign_badge_certificates',
security: $('#buk_action').val(),
course: $this.attr('data-course'),
members: JSON.stringify(members),
assign_action: $('#assign_action').val(),
},
cache: false,
success: function (html) {
$this.html(html);
setTimeout(function(){$this.html(defaultxt);}, 5000);
}
});
});
$( 'body' ).delegate( '#change_course_status', 'click', function(event){
event.preventDefault();
var members=[];
var $this = $(this);
var defaultxt=$this.html();
$this.html(' '+vibe_course_module_strings.processing);
var i=0;
$('.member').each(function(){
if($(this).is(':checked')){
members[i]=$(this).val();
i++;
}
});
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'change_course_status',
security: $('#buk_action').val(),
course: $this.attr('data-course'),
members: JSON.stringify(members),
status_action: $('#status_action').val(),
data: $('#finish_marks').val()
},
cache: false,
success: function (html) {
$this.html(html);
setTimeout(function(){$this.html(defaultxt);}, 5000);
}
});
});
$( 'body' ).delegate( '#extend_course_subscription', 'click', function(event){
event.preventDefault();
var members=[];
var $this = $(this);
var defaultxt=$this.html();
$this.html(' '+vibe_course_module_strings.processing);
var i=0;
$('.member').each(function(){
if($(this).is(':checked')){
members[i]=$(this).val();
i++;
}
});
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'extend_course_subscription',
security: $('#buk_action').val(),
course: $this.attr('data-course'),
members: JSON.stringify(members),
extend_amount: $('#extend_amount').val(),
},
cache: false,
success: function (html) {
$this.html(html);
setTimeout(function(){$this.html(defaultxt);}, 5000);
}
});
});
$( 'body' ).delegate( '#mark-complete', 'media_loaded', function(event){
event.preventDefault();
if($(this).hasClass('tip')){
$(this).addClass('disabled');
}
});
$( 'body' ).delegate( '#mark-complete', 'media_complete', function(event){
event.preventDefault();
if($(this).hasClass('tip')){
$(this).removeClass('disabled');
$(this).removeClass('tip');
$(this).tooltip('destroy');
jQuery('.tip').tooltip();
}
});
$( 'body' ).delegate( '#mark-complete', 'click', function(event){
event.preventDefault();
if($(this).hasClass('disabled')){
return false;
}
var $this = $(this);
var unit_id=$(this).attr('data-unit');
$this.prepend(' ');
$('body').find('.course_progressbar').removeClass('increment_complete');
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'complete_unit',
security: $('#hash').val(),
course_id: $('#course_id').val(),
id: unit_id
},
cache: false,
success: function (html) {
$this.find('i').remove();
$this.html(' ');
$('.course_timeline').find('.active').addClass('done');
$('body').find('.course_progressbar').trigger('increment');
$('#mark-complete').addClass('disabled');
var cookie_id = 'course_progress'+$('#course_id').val();
var value= $('.course_progressbar').attr('data-value');
$.cookie(cookie_id,value, { expires: 1 ,path: '/'});
if(html.length > 0){
$('#next_unit').removeClass('hide');
$('#next_unit').attr('data-unit',html);
$('#next_quiz').removeClass('hide');
$('#next_quiz').attr('data-unit',html);
$('#unit'+html).find('a').addClass('unit');
$('#unit'+html).find('a').attr('data-unit',html);
}
if(typeof unit != 'undefined')
$('.unit_timer').trigger('finish');
}
});
});
$('.course_progressbar').on('increment',function(event){
if($(this).hasClass('increment_complete')){
event.stopPropagation();
return false;
}else{
var iunit = parseFloat($(this).attr('data-increase-unit'));
var per = parseFloat($(this).attr('data-value'));
newper = iunit + per;
newper = newper.toFixed(2);
var amountunits = 100/iunit;
amountunits = amountunits.toFixed(2);
var maxper = iunit*amountunits;
maxper = maxper.toFixed(2);
if (newper == maxper) {
newper = 100;
}
//Boundary Conditions
if(newper>100)
newper=100;
$(this).find('.bar').css('width',newper+'%');
$(this).find('.bar span').html(newper + '%');
$(this).addClass('increment_complete');
$(this).attr('data-value',newper);
$.ajax({
type: "POST",
url: ajaxurl,
async:true,
data: { action: 'record_course_progress',
security: $('#hash').val(),
course_id: $('#course_id').val(),
progress: newper
},
cache: false,
cache: false,
success: function (html) {
var cookie_id ='course_progress'+$('#course_id').val();
$.cookie(cookie_id,newper, { path: '/' });
}
});
}
event.stopPropagation();
return false;
});
$('.course_progressbar').on('decrement',function(event){
if($(this).hasClass('increment_complete')){
event.stopPropagation();
return false;
}else{
var iunit = parseFloat($(this).attr('data-increase-unit'));
var per = parseFloat($(this).attr('data-value'));
newper = per-iunit;
if(newper<0)
newper=0;
$(this).find('.bar').css('width',newper+'%');
$(this).find('.bar span').html(newper + '%');
$(this).addClass('increment_complete');
$(this).attr('data-value',newper);
$.ajax({
type: "POST",
url: ajaxurl,
async:true,
data: { action: 'record_course_progress',
security: $('#hash').val(),
course_id: $('#course_id').val(),
progress: newper
},
cache: false,
success: function (html) {
var cookie_id ='course_progress'+$('#course_id').val();
$.cookie(cookie_id,newper, { path: '/' });
}
});
}
event.stopPropagation();
return false;
});
jQuery(document).ready(function($){
$('.showhide_indetails').click(function(event){
event.preventDefault();
$(this).find('i').toggleClass('icon-minus');
$(this).parent().find('.in_details').toggle();
});
$('.ajax-certificate').each(function(){
$(this).magnificPopup({
type: 'ajax',
fixedContentPos: true,
alignTop:true,
preloader: false,
midClick: true,
removalDelay: 300,
showCloseBtn:false,
mainClass: 'mfp-with-zoom',
callbacks: {
parseAjax: function( mfpResponse ) {
mfpResponse.data = $(mfpResponse.data).find('#certificate');
},
ajaxContentAdded: function() {
html2canvas($('#certificate'), {
backgrounnd:'#ffffff',
onrendered: function(canvas) {
var data = canvas.toDataURL("image/jpeg");
$('#certificate .certificate_content').html(' ');
$('#certificate').trigger('generate_certificate');
var doc = new jsPDF();
var width = 210;
var height = 80;
if($('#certificate .certificate_content').attr('data-width').length){
height = Math.round(210*parseInt($('#certificate .certificate_content').attr('data-height'))/parseInt($('#certificate .certificate_content').attr('data-width')));
}
doc.addImage(data, 'JPEG',0,0, 210,height);
$('.certificate_pdf').click(function(){
doc.output('dataurlnewwindow');
});
}
});
}
}
});
});
$('.ajax-badge').each(function(){
var $this=$(this);
var img=$this.find('img');
$(this).magnificPopup({
items: {
src: '',
type: 'inline'
},
fixedContentPos: false,
alignTop:false,
preloader: false,
midClick: true,
removalDelay: 300,
showCloseBtn:false,
mainClass: 'mfp-with-zoom center-aligned'
});
});
$( 'body' ).delegate( '.print_unit', 'click', function(event){
$('.unit_content').print();
});
$( 'body' ).delegate( '.printthis', 'click', function(event){
$(this).parent().print();
});
$( 'body' ).delegate( '#certificate', 'generate_certificate', function(event){
$(this).addClass('certificate_generated');
});
$( 'body' ).delegate( '.certificate_print', 'click', function(event){
event.preventDefault();
$(this).parent().parent().print();
});
$('.widget_carousel').flexslider({
animation: "slide",
controlNav: false,
directionNav: true,
animationLoop: true,
slideshow: false,
prevText: " ",
nextText: " ",
});
/*=== Quick tags ===*/
$( 'body' ).delegate( '.unit-page-links a', 'click', function(event){
if($('body').hasClass('single-unit'))
return;
event.preventDefault();
var $this=$(this);
$this.prepend(' ');
$( ".main_unit_content" ).load( $this.attr('href') +" .single_unit_content" ,function(){
$('.unit_content').trigger('unit_traverse');
$('body').trigger('unit_loaded');
});
$this.find('i').remove();
$( ".main_unit_content" ).trigger('unit_reload');
});
$( 'body' ).delegate('.pricing_course', 'click', function(event){
$(this).toggleClass('active');
});
$( 'body' ).delegate( '.pricing_course li', 'click', function(event){
var parent = $(this).parent();
var $this = $(this);
parent.find('.active').removeClass('active');
$this.addClass('active');
if($('.course_button').length){
var value = $(this).attr('data-value');
$('.course_button').attr('href',value);
}
});
});
$('.unit_content').on('unit_traverse',function(){
runnecessaryfunctions();
});
// Course Unit Traverse
$( 'body' ).delegate( '.unit', 'click', function(event){
event.preventDefault();
if($(this).hasClass('disabled')){
return false;
}
var $this = $(this);
var unit_id=$(this).attr('data-unit');
if($this.prev().is('span')){
$this.prev().addClass('loading');
}else{
$this.prepend(' ');
}
$('#ajaxloader').removeClass('disabled');
$('.unit_content').addClass("loading");
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'unit_traverse',
security: $('#hash').val(),
course_id: $('#course_id').val(),
id: unit_id
},
cache: false,
success: function (html) {
$('body,html').animate({
scrollTop: 0
}, 1200);
if($this.prev().is('span')){
$this.prev().removeClass('loading');
}else{
$this.find('i').remove();
}
$('#ajaxloader').addClass('disabled');
$('.unit_content').removeClass("loading");
$('.unit_content').html(html);
var unit=$($.parseHTML(html)).filter("#unit");
var u='#unit'+unit.attr('data-unit');
$('.course_timeline').find('.active').removeClass('active');
$(u).addClass('active');
$('.unit_content').trigger('unit_traverse');
$('audio,video').mediaelementplayer({
success: function(media,node,player) {
$('#mark-complete').trigger('media_loaded');
$('.mejs-container').each(function(){
$(this).addClass('mejs-mejskin');
});
media.addEventListener('ended', function (e) {
$('#mark-complete').trigger('media_complete');
});
}
});
runnecessaryfunctions();
//=== UNIT COMMENTS ======
if($('.unit_wrap').hasClass('enable_comments')){
$('.unit_content').trigger('load_comments');
}
if(typeof unit != 'undefined')
$('.unit_timer').trigger('activate');
}
});
});
/*==============================================================*/
/*======================= UNIT COMMENTS ========================*/
/*==============================================================*/
$( 'body' ).delegate( '.unit_content', 'load_comments', function(event){
if($(this).find('.main_unit_content').hasClass('stop_notes') || $('body').hasClass('wp-fee-body'))
return;
var unit_id=$('#unit').attr('data-unit');
$('.unit_content p').each(function(index){
if (!$(this).parents('.question').length){
$(this).attr('data-section-id',index);
$(this).append('');
}
});
unitComments();
$.ajax({
type: "POST",
dataType: "json",
url: ajaxurl,
data: { action: 'get_unit_comment_count',
security: $('#hash').val(),
unit_id: unit_id,
},
cache: false,
success: function (response) {
$.each(response, function(idx, obj) {
$('#'+obj.id).text(obj.count);
});
}
});
$('.side_comment').on('click',function(){
if($(this).hasClass('active'))
return false;
var $this = $(this);
var section = $('.side_comment.active').attr('id');
$('.side_comment').removeClass('active');
$('.side_comments .main_comments>li:not(".hide")').remove();
$(this).addClass('active');
var id = $(this).attr('id');
$('.add-comment').fadeIn();
$('.add-comment').next().fadeOut();
var check = $(this).text();
var href='#';
$('.side_comments .main_comments').find('.loaded').remove();
if( jQuery.isNumeric(check)){
var comment_html ='';
var cookie_id='unit_comments'+unit_id;
//var unit_comments = $.cookie(cookie_id);
var unit_comments = sessionStorage.getItem(cookie_id);
//CHeck cookie
if (unit_comments !== null){
unit_comments = JSON.parse(unit_comments);
$.each(unit_comments, function(idxx, objStr) {
$.each(objStr, function(idx, obj){
if(id == idx){
comment_html += '';
jQuery.each(obj.controls, function(i,o) {
if(o>1){
jQuery('.side_comments li.hide').find('.'+i).addClass('meta_info').attr('data-meta',o);
}
var control = jQuery('.side_comments li.hide').find('.'+i).parent()[0].outerHTML;
if(o>1){
jQuery('.side_comments li.hide').find('.'+i).removeClass('meta_info').removeAttr('data-meta');
}
comment_html +=control;
});
comment_html +=' ';
href=$(comment_html).find('.popup_unit_comment').removeClass('meta_info').attr('data-href');
href +='?unit_id='+unit_id+'§ion='+idx;
}
});
});
$('.side_comments .main_comments').append(comment_html);
$('.side_comments .main_comments .popup_unit_comment').attr('href',href);
jQuery('.tip').tooltip();
$('.popup_unit_comment').magnificPopup({
type: 'ajax',
alignTop: true,
fixedContentPos: true,
fixedBgPos: true,
overflowY: 'auto',
closeBtnInside: true,
preloader: false,
midClick: true,
removalDelay: 300,
mainClass: 'my-mfp-zoom-in',
callbacks: {
parseAjax: function( mfpResponse ) {
mfpResponse.data = $(mfpResponse.data).find('.content');
}
}
});
}else{ //ajax request and grab the json from ajax
section =$('.side_comment.active').attr('id');
$.ajax({
type: "POST",
dataType: "json",
url: ajaxurl,
data: { action: 'unit_section_comments',
security: $('#hash').val(),
unit_id: unit_id,
section: section,
num:$('.side_comment').length
},
cache: false,
success: function (jsonStr){
var cookie_value =JSON.stringify(jsonStr);
sessionStorage.setItem(cookie_id,cookie_value);
$.each(jsonStr, function(idxx, objStr){
$.each(objStr, function(idx, obj){
if(id == idx){
comment_html += '';
jQuery.each(obj.controls, function(i,o) {
if(o>1){
jQuery('.side_comments li.hide').find('.'+i).addClass('meta_info').attr('data-meta',o);
}
var control = jQuery('.side_comments li.hide').find('.'+i).parent()[0].outerHTML;
if(o>1){
jQuery('.side_comments li.hide').find('.'+i).removeClass('meta_info').removeAttr('data-meta');
}
comment_html +=control;
});
comment_html +=' ';
var href=$(comment_html).find('.popup_unit_comment').attr('href');
href +='?unit_id='+unit_id+'§ion='+idx;
$(comment_html).find('.popup_unit_comment').attr('href',href);
}
});
});
$('.side_comments .main_comments').append(comment_html);
jQuery('.tip').tooltip();
$('.popup_unit_comment').magnificPopup({
type: 'ajax',
alignTop: true,
fixedContentPos: true,
fixedBgPos: true,
overflowY: 'auto',
closeBtnInside: true,
preloader: false,
midClick: true,
removalDelay: 300,
mainClass: 'my-mfp-zoom-in',
callbacks: {
parseAjax: function( mfpResponse ) {
mfpResponse.data = $(mfpResponse.data).find('.content');
}
}
});
}
});
} //end else
} // end if numeric check
var all_href=$('#all_comments_link').attr('data-href');
all_href +='?unit_id='+unit_id+'§ion='+$('.side_comment.active').attr('id');
$('#all_comments_link').attr('href',all_href);
var top = $(this).offset().top;
var content_top=$('#unit_content').offset().top;
var height = $('.side_comments').height();
var limit = $('.unit_prevnext').offset().top;
if((top+height) > limit){
top = limit - content_top - height;
}else{
top = top - content_top;
}
if(top >0){
$('.side_comments').css('top',top+'px');
$('.side_comments').removeClass('scroll');
}else{
$('.side_comments').addClass('scroll');
var h=$('.main_unit_content').height();
$('.side_comments').css('height',h+'px');
}
});
/*=== END UNIT COMMENTS ======*/
});
/* ===== UNIT COMMENTS =====*/
jQuery(document).ready(function($){
$('.add-comment').on('click',function(){
$(this).fadeOut(0);
$(this).next('.comment-form').fadeIn(100);
});
$('.new_side_comment').on('click',function(){
if(!$(this).hasClass('cleared')){
$(this).html('');$(this).addClass('cleared');
$(this).parent().parent().addClass('active');
$(this).parent().parent().parent().find('.add-comment').addClass('deactive');
}
});
$('.remove_side_comment').on('click',function(){
$(this).closest('.side_comments').find('.add-comment').fadeIn(100);
$(this).closest('.comment-form').fadeOut();
$('.new_side_comment').removeClass('cleared');
$('.new_side_comment').text(vibe_course_module_strings.add_comment);
});
});
$( 'body' ).delegate( '.public_unit_comment', 'click', function(event){
event.preventDefault();
var $this = $(this);
var id =$this.closest('li.loaded>div').attr('data-id');
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'public_user_comment',
security: $('#hash').val(),
id: id
},
cache: false,
success: function (html) {
$this.removeClass('public_unit_comment');
$this.addClass('private_unit_comment');
$this.find('i').removeClass().addClass('icon-fontawesome-webfont-4');
$this.attr('data-original-title',vibe_course_module_strings.private_comment);
var unit_id = $('#unit').attr('data-unit');
var cookie_id='unit_comments'+unit_id;
sessionStorage.removeItem(cookie_id);
}
});
});
$( 'body' ).delegate( '.private_unit_comment', 'click', function(event){
event.preventDefault();
var $this = $(this);
var id =$this.closest('li.loaded>div').attr('data-id');
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'private_user_comment',
security: $('#hash').val(),
id: id
},
cache: false,
success: function (html) {
$this.removeClass('private_unit_comment');
$this.addClass('public_unit_comment');
$this.find('i').removeClass().addClass('icon-fontawesome-webfont-3');
$this.attr('data-original-title',vibe_course_module_strings.public_comment);
var unit_id = $('#unit').attr('data-unit');
var cookie_id='unit_comments'+unit_id;
sessionStorage.removeItem(cookie_id);
}
});
});
$( 'body' ).delegate( '.edit_unit_comment', 'click', function(event){
event.preventDefault();
var $this = $(this);
var content = $this.parent().parent().parent();
var form = $('.comment-form').first().clone();
var img = content.find('img').clone();
var unit_comment_author = content.find('.unit_comment_author').clone();
var id = content.attr('data-id');
form.find('img').replaceWith(function(){return img;});
form.find('span').replaceWith(function(){return unit_comment_author;});
var new_content = content.find('.unit_comment_content');
form.find('.new_side_comment').html(new_content.html());
//console.log(id+'#');
form.find('.post_unit_comment').removeClass().addClass('edit_form_unit_comment').attr('data-id',id);
form.find('.remove_side_comment').removeClass().addClass('remove_form_edit_unit_comment');
content.parent().append(form);
content.hide();
content.parent().find('.comment-form').show();
});
$( 'body' ).delegate( '.remove_form_edit_unit_comment', 'click', function(event){
$(this).parent().parent().parent().parent().find('.note,.public').show();
$(this).closest('.comment-form').remove();
$('.new_side_comment').removeClass('cleared');
});
$( 'body' ).delegate( '.reply_unit_comment', 'click', function(event){
event.preventDefault();
var parent_li = $(this).parent().parent().parent().parent();
if($(this).hasClass('meta_info')){
var id =$(this).attr('data-meta');
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'get_user_reply',
security: $('#hash').val(),
id: id
},
cache: false,
success: function (html) {
if(!jQuery.isNumeric(html)){
parent_li.after(html);
}
}
});
}else{
$('.add-comment').trigger('click');
$('.comment-form').addClass('creply');
$('.comment-form').attr('data-cid',$(this).closest('.actions').parent().attr('data-id'));
}
});
$( 'body' ).delegate( '.instructor_reply_unit_comment', 'click', function(event){
event.preventDefault();
if($(this).hasClass('call'))
return false;
var $ithis=$(this);
var message = $ithis.parent().parent().parent().find('.unit_comment_content').html();
var unit_id =$('#unit').attr('data-unit');
//console.log(unit_id);
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'instructor_reply_user_comment',
security: $('#hash').val(),
message:message,
id: unit_id,
section:$('.side_comment.active').attr('id')
},
cache: false,
success: function (html) {
$ithis.addClass('call');
}
});
});
$( 'body' ).delegate( '.edit_form_unit_comment', 'click', function(event){
event.preventDefault();
var $new_this = $(this);
var id =$new_this.attr('data-id');
var new_content = $('.new_side_comment').html();
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'edit_user_comment',
security: $('#hash').val(),
content:new_content,
id: id
},
cache: false,
success: function (html) {
var unit_id = $('#unit').attr('data-unit');
var cookie_id='unit_comments'+unit_id;
sessionStorage.removeItem(cookie_id);
var new_parent =$new_this.closest('.comment-form').prev().parent();
new_parent.find('.unit_comment_content').html(new_content);
$new_this.closest('.comment-form').remove();
new_parent.find('.note,.public').show();
}
});
});
$( 'body' ).delegate( '.remove_unit_comment', 'click', function(event){
event.preventDefault();
var $this = $(this);
var id =$this.parent().parent().closest('li>div').attr('data-id');
$this.addClass('animated spin');
$.confirm({
text: vibe_course_module_strings.remove_comment,
confirm: function() {
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'remove_user_comment',
security: $('#hash').val(),
id: id
},
cache: false,
success: function (html) {
$this.removeClass('animated');
$this.removeClass('spin');
var cid = $this.closest('.actions').attr('data-pid');
var count=parseInt($('#'+cid).text());
count--;
$('#'+cid).text(count);
$this.closest('li.loaded').fadeOut(200,function(){$(this).remove();});
var unit_id = $('#unit').attr('data-unit');
var cookie_id='unit_comments'+unit_id;
$('.new_side_comment').removeClass('cleared');
sessionStorage.removeItem(cookie_id);
}
});
},
cancel: function() {
$this.removeClass('animated');
$this.removeClass('spin');
},
confirmButton: vibe_course_module_strings.remove_comment_button,
cancelButton: vibe_course_module_strings.cancel
});
});
$( 'body' ).delegate( '.post_unit_comment', 'click', function(event){
event.preventDefault();
if($(this).hasClass('disabled')){
return false;
}
var reply =0;
if($(this).closest('.comment-form').hasClass('creply')){
reply = $(this).closest('.comment-form').attr('data-cid');
}
var $this = $(this);
var section = $('.side_comment.active').attr('id');
var unit_id = $('#unit').attr('data-unit');
var list =$this.closest('.side_comments').find('ul.main_comments');
var list_html = list.find('li.hide').clone();
var content = $(this).closest('.comment-form').find('.new_side_comment').html();
var cookie_id='unit_comments'+unit_id;
$this.addClass('disabled');
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'post_unit_comment',
security: $('#hash').val(),
course_id: $('#course_id').val(),
unit_id: unit_id,
content:content,
section:section,
reply:reply
},
cache: false,
success: function (id) {
$this.removeClass('disabled');
if( jQuery.isNumeric(id)){
var cookie_id='unit_comments'+unit_id;
var unit_comments = $.cookie(cookie_id);
var comment={
section:{
'content':content,
'type':'note',
'author':{
'img':list_html.find('img').attr('src'),
'name':list_html.find('.unit_comment_author').text(),
'link':list_html.find('.unit_comment_author').attr('href'),
},
'controls':{
'edit_unit_comment':1,
'public_unit_comment':1,
'instructor_reply_unit_comment':1,
'popup_unit_comment':1,
'remove_unit_comment':1
}
}
};
sessionStorage.removeItem(cookie_id);
list_html.find('.unit_comment_content').html(content);
list_html.removeClass();
list_html.find('.actions .private_unit_comment').parent().remove();
list.append(list_html);
var href=$(list_html).find('.popup_unit_comment').attr('data-href');
href +='?unit_id='+unit_id+'§ion='+$('.side_comment.active').attr('id');
$(list_html).find('.popup_unit_comment').attr('href',href);
jQuery('.tip').tooltip();
var count=$('#'+section).text();
if( jQuery.isNumeric(count)){
count=parseInt(count)+1;
}else{
count=1;
}
$('.new_side_comment').removeClass('cleared');
$('#'+section).text(count);
$('.add-comment').fadeIn();
$('.comment-form').removeClass('active').fadeOut();
$('.new_side_comment').text(vibe_course_module_strings.add_comment);
$('.popup_unit_comment').magnificPopup({
type: 'ajax',
alignTop: true,
fixedContentPos: true,
fixedBgPos: true,
overflowY: 'auto',
closeBtnInside: true,
preloader: false,
midClick: true,
removalDelay: 300,
mainClass: 'my-mfp-zoom-in',
callbacks: {
parseAjax: function( mfpResponse ) {
mfpResponse.data = $(mfpResponse.data).find('.content');
}
}
});
}else{
$this.closest('.comment-form').append(''+id+'
');
}
}
});
});
$( 'body' ).delegate( '.note-tabs li', 'click', function(event){
event.preventDefault();
$(this).parent().find('.selected').removeClass('selected');
$(this).addClass('selected');
var action = $(this).attr('id');
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: action,
security: $('#hash').val(),
unit_id:$.urlParam('unit_id'),
section:$.urlParam('section')
},
cache: false,
success: function (html) {
$('.content').html(html);
$(".live-edit").liveEdit({
afterSaveAll: function(params) {
return false;
}
});
}
});
});
$( 'body' ).delegate( '#load_more_notes', 'click', function(event){
var json = $('#notes_query').html();
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'load_more_notes',
security: $('#hash').val(),
json:json
},
cache: false,
success: function (html) {
if( jQuery.isNumeric(html)){
$('#load_more_notes').hide();
}else{
var newjson = $(html).filter('#new_notes_query').html();
$('#notes_query').html(newjson);
$('#notes_discussions .notes_list').append(html);
$('#new_notes_query').remove();
}
$(".live-edit").liveEdit({
afterSaveAll: function(params) {
return false;
}
});
}
});
});
jQuery(document).ready(function(){
jQuery('.course_curriculum.accordion .course_section').click(function(event){
jQuery(this).toggleClass('show');
jQuery(this).nextUntil('.course_section').toggleClass('show');
});
jQuery('.course_timeline.accordion .section').on('click',function(event){
jQuery(this).toggleClass('show');
jQuery(this).nextUntil('.section').toggleClass('show');
});
jQuery('.course_timeline.accordion').each(function(){
var $this = $(this);
$this.find('.unit_line.active').prevAll('.section').trigger('click');
});
$('.unit_content').on('unit_traverse',function(){
var section =$('.course_timeline.accordion').find('.unit_line.active').prev('.section');
if($('.course_timeline.accordion').find('.unit_line.active').prev().hasClass('section')){
jQuery('.course_timeline.accordion .section.show').trigger('click'); // Close the open one
}
if(!section.hasClass('show'))
section.trigger('click');
});
$('.retake_submit').click(function(){
$(this).parent().submit();
});
});
/*==============================================================*/
/*======================= In Course Quiz ========================*/
/*==============================================================*/
$(document).ready(function(){
$('.inquiz_timer').each(function(){
$('.inquiz_timer').one('activate',function(){
var qtime = parseInt($(this).attr('data-time'));
var $timer =$(this).find('.timer');
var $this=$(this);
$timer.timer({
'timer': qtime,
'width' : 72 ,
'height' : 72 ,
'fgColor' : vibe_course_module_strings.theme_color
});
$timer.on('change',function(){
var countdown= $this.find('.countdown');
var val = parseInt($timer.attr('data-timer'));
if(val > 0){
val--;
$timer.attr('data-timer',val);
var $text='';
if(val > 60){
$text = Math.floor(val/60) + ':' + ((parseInt(val%60) < 10)?'0'+parseInt(val%60):parseInt(val%60)) + '';
}else{
$text = '00:'+ ((val < 10)?'0'+val:val);
}
countdown.html($text);
}else{
countdown.html(vibe_course_module_strings.timeout);
if(!$('.submit_inquiz').hasClass('triggerred')){
$('.submit_inquiz').addClass('triggerred');
$('.submit_inquiz').trigger('click');
}
$('.inquiz_timer').trigger('deactivate');
}
});
});
$('.inquiz_timer').one('deactivate',function(event){
var qtime = 0;
var $timer =$(this).find('.timer');
var $this=$(this);
$timer.knob({
'readonly':true,
'max': qtime,
'width' : 72 ,
'height' : 72 ,
'fgColor' : vibe_course_module_strings.theme_color ,
'readonly':true
});
event.stopPropagation();
});
// END IN QUIZ TIMER
var qtime = parseInt($(this).attr('data-time'));
var $timer =$(this).find('.timer');
$timer.knob({
'readonly':true,
'max': qtime,
'width' : 72 ,
'height' : 72 ,
'fgColor' : vibe_course_module_strings.theme_color ,
'thickness': 0.1 ,
'readonly':true
});
if($(this).hasClass('start')){
$('.inquiz_timer').trigger('activate');
}
});
});
// IN QUIZ TIMER
$('.unit_content').on('unit_traverse',function(){
$('.inquiz_timer').each(function(){
$('.inquiz_timer').one('activate',function(){
var qtime = parseInt($(this).attr('data-time'));
var $timer =$(this).find('.timer');
var $this=$(this);
$timer.timer({
'timer': qtime,
'width' : 72 ,
'height' : 72 ,
'fgColor' : vibe_course_module_strings.theme_color
});
$timer.on('change',function(){
var countdown= $this.find('.countdown');
var val = parseInt($timer.attr('data-timer'));
if(val > 0){
val--;
$timer.attr('data-timer',val);
var $text='';
if(val > 60){
$text = Math.floor(val/60) + ':' + ((parseInt(val%60) < 10)?'0'+parseInt(val%60):parseInt(val%60)) + '';
}else{
$text = '00:'+ ((val < 10)?'0'+val:val);
}
countdown.html($text);
}else{
countdown.html(vibe_course_module_strings.timeout);
if(!$('.submit_inquiz').hasClass('triggerred')){
$('.submit_inquiz').addClass('triggerred');
$('.submit_inquiz').trigger('click');
}
$('.inquiz_timer').trigger('deactivate');
}
});
});
$('.inquiz_timer').one('deactivate',function(event){
var qtime = 0;
var $timer =$(this).find('.timer');
var $this=$(this);
$timer.knob({
'readonly':true,
'max': qtime,
'width' : 72 ,
'height' : 72 ,
'fgColor' : vibe_course_module_strings.theme_color ,
'readonly':true
});
event.stopPropagation();
});
// END IN QUIZ TIMER
var qtime = parseInt($(this).attr('data-time'));
var $timer =$(this).find('.timer');
$timer.knob({
'readonly':true,
'max': qtime,
'width' : 72 ,
'height' : 72 ,
'fgColor' : vibe_course_module_strings.theme_color ,
'thickness': 0.1 ,
'readonly':true
});
if($(this).hasClass('start')){
$('.inquiz_timer').trigger('activate');
}
});
});
$( 'body' ).delegate( '.unit_button.start_quiz', 'click', function(event){
event.preventDefault();
var $this=$(this);
$('#ajaxloader').removeClass('disabled');
$('#unit_content').addClass('loading');
if($this.hasClass('continue')){
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'in_start_quiz',
security: $('#hash').val(),
quiz_id:$('#unit.quiz_title').attr('data-unit'),
},
cache: false,
success: function (html) {
$('.main_unit_content').html(html);
$('.in_quiz').trigger('question_loaded');
$this.removeClass('start_quiz continue');
$this.attr('href','#');
$this.addClass('submit_inquiz');
runnecessaryfunctions();
$this.text(vibe_course_module_strings.submit_quiz);
$('.quiz_title .inquiz_timer').trigger('activate');
$('#ajaxloader').addClass('disabled');
$('#unit_content').removeClass('loading');
}
});
}else{
$.confirm({
text: vibe_course_module_strings.start_quiz_notification,
confirm: function() {
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'in_start_quiz',
security: $('#hash').val(),
quiz_id:$('#unit.quiz_title').attr('data-unit'),
},
cache: false,
success: function (html) {
$('#ajaxloader').addClass('disabled');
$('#unit_content').removeClass('loading');
$('.main_unit_content').html(html);
$('.in_quiz').trigger('question_loaded');
$this.removeClass('start_quiz');
$this.attr('href','#');
$this.addClass('submit_inquiz');
runnecessaryfunctions();
$this.text(vibe_course_module_strings.submit_quiz);
$('.quiz_title .inquiz_timer').trigger('activate');
}
});
},
cancel: function() {
$('#ajaxloader').addClass('disabled');
$('#unit_content').removeClass('loading');
},
confirmButton: vibe_course_module_strings.confirm,
cancelButton: vibe_course_module_strings.cancel
});
}
});
$( 'body' ).delegate( '.unit_button.submit_inquiz', 'click', function(event){
event.preventDefault();
var $this=$(this);
var answers=[];
$('#ajaxloader').removeClass('disabled');
$('#unit_content').addClass('loading');
if(typeof all_questions_json !== 'undefined') {
var unanswered_flag=0;
$.each(all_questions_json, function(key, value) {
var ans = sessionStorage.getItem(value);
if(ans){
var answer={'id':value,'value':ans};
answers.push(answer);
}else{
unanswered_flag++;
}
});
if($this.hasClass('triggerred')){ // Auto Submit
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'in_submit_quiz',
security: $('#hash').val(),
quiz_id:$('#unit.quiz_title').attr('data-unit'),
answers:JSON.stringify(answers)
},
cache: false,
success: function (html) {
$('#ajaxloader').addClass('disabled');
$('#unit_content').removeClass('loading');
if(html.indexOf('##')>=0){
var nextunit = html.substr(0, html.indexOf('##'));
html = html.substr(html.indexOf('##'));
if(nextunit.length>0){
$('#next_unit').removeClass('hide');
$('#next_unit').attr('data-unit',nextunit);
$('#next_quiz').removeClass('hide');
$('#next_quiz').attr('data-unit',nextunit);
$('#unit'+nextunit).find('a').addClass('unit');
$('#unit'+nextunit).find('a').attr('data-unit',nextunit);
}
}else{
if(html.indexOf('##') == 0){
html = html.substr(2);
console.log(html);
}
$('#next_unit').removeClass('hide');
}
$('.main_unit_content').html(html);
$('.quiz_title .inquiz_timer').trigger('deactivate');
$('.in_quiz').trigger('question_loaded');
$this.removeClass('submit_inquiz');
$('.quiz_title .quiz_meta').addClass('hide');
$this.addClass('quiz_results_popup');
$this.attr('href',$('#results_link').val());
runnecessaryfunctions();
$this.text(vibe_course_module_strings.check_results);
$('#unit'+$('#unit.quiz_title').attr('data-unit')).addClass('done');
$('body').find('.course_progressbar').removeClass('increment_complete');
$('body').find('.course_progressbar').trigger('increment');
}
});
}else{
if(unanswered_flag){
$.confirm({
text: vibe_course_module_strings.unanswered_questions,
confirm: function() {
$.confirm({
text: vibe_course_module_strings.submit_quiz_notification,
confirm: function() {
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'in_submit_quiz',
security: $('#hash').val(),
quiz_id:$('#unit.quiz_title').attr('data-unit'),
answers:JSON.stringify(answers)
},
cache: false,
success: function (html) {
$('#ajaxloader').addClass('disabled');
$('#unit_content').removeClass('loading');
if(html.indexOf('##')>=0){
var nextunit = html.substr(0, html.indexOf('##'));
html = html.substr((html.indexOf('##')+2));
if(nextunit.length>0){
$('#next_unit').removeClass('hide');
$('#next_unit').attr('data-unit',nextunit);
$('#next_quiz').removeClass('hide');
$('#next_quiz').attr('data-unit',nextunit);
$('#unit'+nextunit).find('a').addClass('unit');
$('#unit'+nextunit).find('a').attr('data-unit',nextunit);
}
}else{
if(html.indexOf('##') == 0){
html = html.substr(2);
console.log(html);
}
$('#next_unit').removeClass('hide');
}
$('.main_unit_content').html(html);
$('.quiz_title .inquiz_timer').trigger('deactivate');
$('.in_quiz').trigger('question_loaded');
$this.removeClass('submit_inquiz');
$('.quiz_title .quiz_meta').addClass('hide');
$this.addClass('quiz_results_popup');
$this.attr('href',$('#results_link').val());
runnecessaryfunctions();
$this.text(vibe_course_module_strings.check_results);
$('#unit'+$('#unit.quiz_title').attr('data-unit')).addClass('done');
$('body').find('.course_progressbar').removeClass('increment_complete');
$('body').find('.course_progressbar').trigger('increment');
}
});
},
cancel: function() {
$('#ajaxloader').addClass('disabled');
$('#unit_content').removeClass('loading');
},
confirmButton: vibe_course_module_strings.confirm,
cancelButton: vibe_course_module_strings.cancel
});
},
cancel: function() {
$('#ajaxloader').addClass('disabled');
$('#unit_content').removeClass('loading');
return false;
},
confirmButton: vibe_course_module_strings.confirm,
cancelButton: vibe_course_module_strings.cancel
});
}else{
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'in_submit_quiz',
security: $('#hash').val(),
quiz_id:$('#unit.quiz_title').attr('data-unit'),
answers:JSON.stringify(answers)
},
cache: false,
success: function (html) {
$('#ajaxloader').addClass('disabled');
$('#unit_content').removeClass('loading');
if(html.indexOf('##')){
var nextunit = html.substr(0, html.indexOf('##'));
html = html.substr((html.indexOf('##')+2));
if(nextunit.length>0){
$('#next_unit').removeClass('hide');
$('#next_unit').attr('data-unit',nextunit);
$('#next_quiz').removeClass('hide');
$('#next_quiz').attr('data-unit',nextunit);
$('#unit'+nextunit).find('a').addClass('unit');
$('#unit'+nextunit).find('a').attr('data-unit',nextunit);
}
}
$('.main_unit_content').html(html);
$('.quiz_title .inquiz_timer').trigger('deactivate');
$('.in_quiz').trigger('question_loaded');
$this.removeClass('submit_inquiz');
$('.quiz_title .quiz_meta').addClass('hide');
$this.addClass('quiz_results_popup');
$this.attr('href',$('#results_link').val());
runnecessaryfunctions();
$this.text(vibe_course_module_strings.check_results);
$('#unit'+$('#unit.quiz_title').attr('data-unit')).addClass('done');
$('body').find('.course_progressbar').removeClass('increment_complete');
$('body').find('.course_progressbar').trigger('increment');
}
});
}
}
}else{
$('#ajaxloader').addClass('disabled');
$('#unit_content').removeClass('loading');
alert(vibe_course_module_strings.submit_quiz_error);
}
});
$( 'body' ).delegate( '.in_quiz .pagination ul li a.quiz_page', 'click', function(event){
event.preventDefault();
var $this=$(this);
var page = $(this).text();
$('#ajaxloader').removeClass('disabled');
$('#unit_content').addClass('loading');
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'in_start_quiz',
security: $('#hash').val(),
quiz_id:$('#unit.quiz_title').attr('data-unit'),
page: page
},
cache: false,
success: function (html) {
$('#ajaxloader').addClass('disabled');
$('#unit_content').removeClass('loading');
$('.main_unit_content').html(html);
$('.in_quiz').trigger('question_loaded');
$this.removeClass('start_quiz');
$this.addClass('submit_quiz');
runnecessaryfunctions();
$this.text(vibe_course_module_strings.submit_quiz);
}
});
});
$( 'body' ).delegate( '.in_quiz', 'question_loaded',function(){
runnecessaryfunctions();
$('.quiz_meta').trigger('progress_check');
if($('.matchgrid_options').hasClass('saved_answer')){
var id;
$('.matchgrid_options li').each(function(index,value){
id = $('.matchgrid_options').attr('data-match'+index);
$(this).append($('#'+id));
});
}
jQuery('.in_question .question_options.sort').each(function(){
var defaultanswer='1';
var lastindex = $('ul.question_options li').size();
if(lastindex>1)
for(var i=2;i<=lastindex;i++){
defaultanswer = defaultanswer+','+i;
}
jQuery(this).sortable({
revert: true,
cursor: 'move',
refreshPositions: true,
opacity: 0.6,
scroll:true,
containment: 'parent',
placeholder: 'placeholder',
tolerance: 'pointer',
update: function( event, ui ) {
var order = $('.question_options.sort').sortable('toArray').toString();
var id = $(this).parent().attr('data-ques');
sessionStorage.setItem(id,order);
$('.quiz_meta').trigger('progress_check');
}
}).disableSelection();
});
//Fill in the Blank Live EDIT
$(".live-edit").liveEdit({
afterSaveAll: function(params) {
return false;
}
});
$(".vibe_fillblank").on('blur',function(){
var value = $(this).text();
var id = $(this).parent().parent().parent().parent().attr('data-ques');
sessionStorage.setItem(id,value);
$('.quiz_meta').trigger('progress_check');
});
//Match question type
$('.in_question .question_options.match').each(function(){
$(this).droppable({
drop: function( event, ui ){
$(ui.draggable).removeAttr('style');
$( this )
.addClass( "ui-state-highlight" )
.append($(ui.draggable))
}
});
$(this).find('li').draggable({
revert: "invalid",
containment:$(this).parent()
});
});
$( ".matchgrid_options li" ).droppable({
activeClass: "ui-state-default",
hoverClass: "ui-state-hover",
drop: function( event, ui ){
childCount = $(this).find('li').length;
$(ui.draggable).removeAttr('style');
if (childCount !=0){
return;
}
$( this )
.addClass( "ui-state-highlight" )
.append($(ui.draggable));
var value='';
$(this).parent().find('li.match_option').each(function(){
var id = $(this).attr('id');
if( jQuery.isNumeric(id))
value +=id+',';
});
var id = $(this).parent().parent().parent().parent().attr('data-ques');
sessionStorage.setItem(id,value);
$('.quiz_meta').trigger('progress_check');
}
});
$('.question.largetext+textarea').on('blur',function(){
var value = $(this).val();
var id = $(this).parent().attr('data-ques');
sessionStorage.setItem(id,value);
$('.quiz_meta').trigger('progress_check');
});
$('.question.smalltext+input').on('blur',function(){
var value = $(this).val();
var id = $(this).parent().attr('data-ques');
sessionStorage.setItem(id,value);
$('.quiz_meta').trigger('progress_check');
});
$('#vibe_select_dropdown').change(function(){
var id = $(this).parent().parent().parent().attr('data-ques');
var value = $(this).val();
sessionStorage.setItem(id,value);
$('.quiz_meta').trigger('progress_check');
});
$('.question_options.truefalse li').click(function(){
var id = $(this).find('input:checked').attr('name');
var value = $(this).find('input:checked').val();
sessionStorage.setItem(id,value);
$('.quiz_meta').trigger('progress_check');
});
$('.question_options.single li').click(function(){
var id = $(this).find('input:checked').attr('name');
var value = $(this).find('input:checked').val();
sessionStorage.setItem(id,value);
$('.quiz_meta').trigger('progress_check');
});
$('.question_options.multiple li').click(function(){
var iclass= $(this).find('input:checked').attr('class');
var id=$(this).parent().parent().attr('data-ques');
var value = '';
$(this).parent().find('input:checked').each(function(){
value += $(this).val()+',';
});
sessionStorage.setItem(id,value);
$('.quiz_meta').trigger('progress_check');
});
});
$( 'body' ).delegate( '.in_quiz', 'question_loaded',function(){
if(typeof questions_json !== 'undefined') {
$.each(questions_json, function(key, value) {
$('.in_question[data-ques='+value+']').each(function(){
var $this = $(this);
var type = $(this).find('.question').attr('class');
switch(type){
case 'question match':
var sval =sessionStorage.getItem(value);
if(sval !== null){
var new_vals = sval.split(',');
$.each(new_vals,function(k,vals){
if($.isNumeric(vals))
$this.find('.matchgrid_options>ul>li').eq(k).append($('#'+vals+'.ques'+value));
});
}
break;
case 'question sort':
var sval =sessionStorage.getItem(value);
if(sval !== null){
var new_vals = sval.split(',');
$.each(new_vals,function(k,vals){
if($.isNumeric(vals))
$this.find('.question_options.sort>li#'+vals+'.ques'+value).remove().appendTo('.question_options.sort');
});
}
break;
case 'question single':
var sval =sessionStorage.getItem(value);
if(sval !== null)
$(this).find('input[value="'+sval+'"]').prop( "checked", true );
break;
case 'question multiple':
var sval =sessionStorage.getItem(value);
if(sval !== null){
var new_vals = sval.split(',');
$.each(new_vals,function(k,vals){
$this.find('input[value="'+vals+'"]').prop( "checked", true );
});
}
break;
case 'question select':
$(this).find('select').val(sessionStorage.getItem(value));
break;
case 'question truefalse':
var sval =sessionStorage.getItem(value);
if(sval !== null)
$(this).find('input[value="'+sval+'"]').prop( "checked", true );
break;
case 'question fillblank':
var saved = sessionStorage.getItem(value);
if(saved !== 'null' && saved){
$(this).find('.vibe_fillblank').text(saved);
}
break;
case 'question smalltext':
$(this).find('input').val(sessionStorage.getItem(value));
break;
case 'question largetext':
$(this).find('textarea').val(sessionStorage.getItem(value));
break;
}
});
});
}
});
$( 'body' ).delegate( '.quiz_meta', 'progress_check',function(){
if(typeof all_questions_json !== 'undefined') {
var num = all_questions_json.length;
var progress=0;
$.each(all_questions_json, function(key, value) {
if(sessionStorage.getItem(value) !== null){
progress++;
}
});
if(!$('.quiz_meta').hasClass('show_progress')){
$('.quiz_meta').addClass('show_progress');
}
$('.quiz_meta i span').text(progress+'/'+num);
var percentage = Math.round(100*(progress/num));
$('.quiz_meta .progress .bar').css('width',percentage+'%');
}
});
/*=== In Unit Questions ===*/
$(document).ready(function($){
$('.unit_content').on('unit_traverse',function(){
$('.question').each(function(){
var $this = $(this);
jQuery('.question_options.sort').each(function(){
jQuery(this).sortable({
revert: true,
cursor: 'move',
refreshPositions: true,
opacity: 0.6,
scroll:true,
containment: 'parent',
placeholder: 'placeholder',
tolerance: 'pointer',
}).disableSelection();
});
//Fill in the Blank Live EDIT
$(".live-edit").liveEdit({
afterSaveAll: function(params) {
return false;
}
});
//Match question type
$('.question_options.match').droppable({
drop: function( event, ui ){
$(ui.draggable).removeAttr('style');
$( this )
.addClass( "ui-state-highlight" )
.append($(ui.draggable))
}
});
$('.question_options.match li').draggable({
revert: "invalid",
containment:'#question'
});
$( ".matchgrid_options li" ).droppable({
activeClass: "ui-state-default",
hoverClass: "ui-state-hover",
drop: function( event, ui ){
childCount = $(this).find('li').length;
$(ui.draggable).removeAttr('style');
if (childCount !=0){
return;
}
$( this )
.addClass( "ui-state-highlight" )
.append($(ui.draggable))
}
});
$this.find('.check_answer').click(function(){
$this.find('.message').remove();
var id = $(this).attr('data-id');
var answers = eval('ans_json'+id);
switch(answers['type']){
case 'select':
case 'truefalse':
case 'single':
case 'sort':
case 'match':
value ='';
if($this.find('input[type="radio"]:checked').length){
value = $this.find('input[type="radio"]:checked').val();
}
if($this.find('select').length){
value = $this.find('option:selected').val();
}
$this.find('.question_options.sort li.sort_option').each(function(){
var id = $(this).attr('id');
if( jQuery.isNumeric(id))
value +=id+',';
});
$this.find('.matchgrid_options li.match_option').each(function(){
var id = $(this).attr('id');
if( jQuery.isNumeric(id))
value +=id+',';
});
if(answers['type'] == 'sort' || answers['type'] == 'match'){
value = value.slice(0,-1);
}
if( value == answers['answer']){
$this.append(''+vibe_course_module_strings.correct+'
');
}else{
$this.append(''+vibe_course_module_strings.incorrect+'
');
}
break;
case 'multiple':
if($this.find('input[type="checkbox"]:checked').length){
if($this.find('input[type="checkbox"]:checked').length == answers['answer'].length){
$this.find('input[type="checkbox"]:checked').each(function(){
if ($.inArray($(this).val(), answers['answer']) == -1){
$this.append(''+vibe_course_module_strings.incorrect+'
');
return false;
}
});
$this.append(''+vibe_course_module_strings.correct+'
');
}else{
$this.append(''+vibe_course_module_strings.incorrect+'
');
}
}
break;
}
});
});
});
/* === simple notes and discussion ===*/
$('.unit_content').on('unit_traverse',function(){
$('#discussion').each(function(){
var $this = $(this);
$('.add_comment').click(function(){
$('.add_unit_comment_text').toggleClass('hide');
});
$('body').delegate('.post_question','click',function(e){
e.preventDefault();
var textarea=$(this).parent().find('textarea');
var val = textarea.val();
var parent = '';
if($(this).hasClass('comment_reply'))
parent = $(this).attr('data-parent');
$this.addClass('loading');
if(val.length){
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'add_unit_comment',
security: $('#hash').val(),
text: val,
parent:parent,
unit_id: $this.attr('data-unit')
},
cache: false,
success: function (html) {
$this.removeClass('loading');
if(html.indexOf(''+html+'');
$('#comment-'+parent +' .add_unit_comment_text').remove();
$('.unit_content .commentlist li .reply').removeClass('hide');
}else{
$this.find('ol.commentlist').append(html);
}
textarea.val('');
$('.add_unit_comment_text').addClass('hide');
}else{
$this.append(html);
}
}
});
}else{
$this.append(''+vibe_course_module_strings.incorrect+'
');
}
});
$('.load_more_comments').click(function(){
var page = parseInt($(this).attr('data-page'));
var max = parseInt($(this).attr('data-max'));
var $load = $(this);
$this.addClass('loading');
$.ajax({
type: "POST",
url: ajaxurl,
data: { action: 'load_unit_comments',
security: $('#hash').val(),
page: page,
unit_id: $this.attr('data-unit')
},
cache: false,
success: function (html) {
$this.removeClass('loading');
$this.find('.commentlist').append(html);
var count = parseInt($load.find('span').text());
var per = parseInt($load.attr('data-per'));
count = count -per;
page++;
$load.attr('data-page',page);
$load.find('span').text(count);
if(max <= page)
$load.hide(200);
}
});
});
$('body').delegate('.unit_content .commentlist li .reply','click',function(){
var $reply = $(this);
$reply.addClass('hide');
$('.unit_content .commentlist li .add_unit_comment_text').remove();
var form = $('#add_unit_comment').clone().removeClass('hide').attr('id','').appendTo($reply.parent());
form.find('.post_question').attr('data-parent',$reply.parent().parent().attr('data-id'));
form.find('.post_question').addClass('comment_reply').text($reply.text());
});
$('body').delegate('.unit_content .commentlist li .cancel','click',function(e){
if($(this).parent().parent().find('.reply').length){
$(this).parent().parent().find('.reply').removeClass('hide');
$(this).parent().parent().find('.add_unit_comment_text').remove();
}
});
$('#add_unit_comment .cancel').click(function(){
$('#add_unit_comment').addClass('hide');
});
});
});
if($('.unit_content').length){
$('.unit_content').trigger('unit_traverse');
}
});
})(jQuery);
// source --> https://better-than-ever.com/wp-content/themes/wplms/js/modernizr.custom.js?ver=4.9.29
/* Modernizr 2.6.2 (Custom Build) | MIT & BSD
* Build: http://modernizr.com/download/#-csstransitions-shiv-cssclasses-prefixed-testprop-testallprops-domprefixes-load
*/
;window.Modernizr=function(a,b,c){function x(a){j.cssText=a}function y(a,b){return x(prefixes.join(a+";")+(b||""))}function z(a,b){return typeof a===b}function A(a,b){return!!~(""+a).indexOf(b)}function B(a,b){for(var d in a){var e=a[d];if(!A(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function C(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:z(f,"function")?f.bind(d||b):f}return!1}function D(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+n.join(d+" ")+d).split(" ");return z(b,"string")||z(b,"undefined")?B(e,b):(e=(a+" "+o.join(d+" ")+d).split(" "),C(e,b,c))}var d="2.6.2",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m="Webkit Moz O ms",n=m.split(" "),o=m.toLowerCase().split(" "),p={},q={},r={},s=[],t=s.slice,u,v={}.hasOwnProperty,w;!z(v,"undefined")&&!z(v.call,"undefined")?w=function(a,b){return v.call(a,b)}:w=function(a,b){return b in a&&z(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=t.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(t.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(t.call(arguments)))};return e}),p.csstransitions=function(){return D("transition")};for(var E in p)w(p,E)&&(u=E.toLowerCase(),e[u]=p[E](),s.push((e[u]?"":"no-")+u));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)w(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},x(""),i=k=null,function(a,b){function k(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function l(){var a=r.elements;return typeof a=="string"?a.split(" "):a}function m(a){var b=i[a[g]];return b||(b={},h++,a[g]=h,i[h]=b),b}function n(a,c,f){c||(c=b);if(j)return c.createElement(a);f||(f=m(c));var g;return f.cache[a]?g=f.cache[a].cloneNode():e.test(a)?g=(f.cache[a]=f.createElem(a)).cloneNode():g=f.createElem(a),g.canHaveChildren&&!d.test(a)?f.frag.appendChild(g):g}function o(a,c){a||(a=b);if(j)return a.createDocumentFragment();c=c||m(a);var d=c.frag.cloneNode(),e=0,f=l(),g=f.length;for(;e",f="hidden"in a,j=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){f=!0,j=!0}})();var r={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,supportsUnknownElements:j,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:q,createElement:n,createDocumentFragment:o};a.html5=r,q(b)}(this,b),e._version=d,e._domPrefixes=o,e._cssomPrefixes=n,e.testProp=function(a){return B([a])},e.testAllProps=D,e.prefixed=function(a,b,c){return b?D(a,b,c):D(a,"pfx")},g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+s.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f https://better-than-ever.com/wp-content/themes/wplms/js/sidebarEffects.js?ver=4.9.29
/*!
* classie - class helper functions
* from bonzo https://github.com/ded/bonzo
*
* classie.has( elem, 'my-class' ) -> true/false
* classie.add( elem, 'my-new-class' )
* classie.remove( elem, 'my-unwanted-class' )
* classie.toggle( elem, 'my-class' )
*/
/*jshint browser: true, strict: true, undef: true */
/*global define: false */
( function( window ) {
'use strict';
// class helper functions from bonzo https://github.com/ded/bonzo
function classReg( className ) {
return new RegExp("(^|\\s+)" + className + "(\\s+|$)");
}
// classList support for class management
// altho to be fair, the api sucks because it won't accept multiple classes at once
var hasClass, addClass, removeClass;
if ( 'classList' in document.documentElement ) {
hasClass = function( elem, c ) {
return elem.classList.contains( c );
};
addClass = function( elem, c ) {
elem.classList.add( c );
};
removeClass = function( elem, c ) {
elem.classList.remove( c );
};
}
else {
hasClass = function( elem, c ) {
return classReg( c ).test( elem.className );
};
addClass = function( elem, c ) {
if ( !hasClass( elem, c ) ) {
elem.className = elem.className + ' ' + c;
}
};
removeClass = function( elem, c ) {
elem.className = elem.className.replace( classReg( c ), ' ' );
};
}
function toggleClass( elem, c ) {
var fn = hasClass( elem, c ) ? removeClass : addClass;
fn( elem, c );
}
var classie = {
// full names
hasClass: hasClass,
addClass: addClass,
removeClass: removeClass,
toggleClass: toggleClass,
// short names
has: hasClass,
add: addClass,
remove: removeClass,
toggle: toggleClass
};
// transport
if ( typeof define === 'function' && define.amd ) {
// AMD
define( classie );
} else {
// browser global
window.classie = classie;
}
})( window );
/**
* sidebarEffects.js v1.0.0
* http://www.codrops.com
*
* Licensed under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*
* Copyright 2013, Codrops
* http://www.codrops.com
*/
function SidebarMenuEffects() {
function hasParentClass( e, classname ) {
if(e === document) return false;
if( classie.has( e, classname ) ) {
return true;
}
return e.parentNode && hasParentClass( e.parentNode, classname );
}
function mobilecheck() {
var check = false;
(function(a){if(/(android|ipad|playbook|silk|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check = true})(navigator.userAgent||navigator.vendor||window.opera);
return check;
}
function init() {
var container = document.getElementById( 'global' ),
buttons = Array.prototype.slice.call( document.querySelectorAll( '#trigger' ) ),
// event type (if mobile use touch events)
eventtype = mobilecheck() ? 'touchstart' : 'click',
resetMenu = function() {
classie.remove( container, 'open' );
},
bodyClickFn = function(evt) {
if( !hasParentClass( evt.target, 'sidemenu' ) ) {
resetMenu();
document.removeEventListener( eventtype, bodyClickFn );
}
};
buttons.forEach( function( el, i ) {
el.addEventListener( eventtype, function( ev ) {
ev.stopPropagation();
ev.preventDefault();
container.className = 'global'; // clear
setTimeout( function() {
classie.add( container, 'open' );
}, 25 );
document.addEventListener( eventtype, bodyClickFn );
});
} );
}
init();
};
function unitComments() {
function hasParentClass( e, classname ) {
if(e === document) return false;
if( classie.has( e, classname ) ) {
return true;
}
return e.parentNode && hasParentClass( e.parentNode, classname );
}
function mobilecheck() {
var check = false;
(function(a){if(/(android|ipad|playbook|silk|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check = true})(navigator.userAgent||navigator.vendor||window.opera);
return check;
}
function init() {
var container = document.getElementById( 'unit_content' ),
buttons = Array.prototype.slice.call( document.querySelectorAll( '.side_comment' ) ),
// event type (if mobile use touch events)
eventtype = mobilecheck() ? 'touchstart' : 'click',
resetMenu = function() {
classie.remove( container, 'open' );
},
bodyClickFn = function(evt) {
var x = evt.target;
console.log(hasParentClass( x, 'unit'));
if( ((!hasParentClass( x, 'side_comments') ) && (x.tagName != 'A') && (x.tagName != 'BUTTON')) || (hasParentClass( x, 'unit') )){
resetMenu();
document.removeEventListener( eventtype, bodyClickFn );
}
};
buttons.forEach( function( el, i ) {
el.addEventListener( eventtype, function( ev ) {
ev.stopPropagation();
ev.preventDefault();
container.className = 'unit_content'; // clear
setTimeout( function() {
classie.add( container, 'open' );
}, 25 );
document.addEventListener( eventtype, bodyClickFn );
});
} );
}
init();
};
// source --> https://better-than-ever.com/wp-content/themes/wplms/js/buddypress.js?ver=0.1
/* ScrollTo plugin - just inline and minified */
;(function($){var h=$.scrollTo=function(a,b,c){$(window).scrollTo(a,b,c)};h.defaults={axis:'xy',duration:parseFloat($.fn.jquery)>=1.3?0:1,limit:true};h.window=function(a){return $(window)._scrollable()};$.fn._scrollable=function(){return this.map(function(){var a=this,isWin=!a.nodeName||$.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!isWin)return a;var b=(a.contentWindow||a).document||a.ownerDocument||a;return/webkit/i.test(navigator.userAgent)||b.compatMode=='BackCompat'?b.body:b.documentElement})};$.fn.scrollTo=function(e,f,g){if(typeof f=='object'){g=f;f=0}if(typeof g=='function')g={onAfter:g};if(e=='max')e=9e9;g=$.extend({},h.defaults,g);f=f||g.duration;g.queue=g.queue&&g.axis.length>1;if(g.queue)f/=2;g.offset=both(g.offset);g.over=both(g.over);return this._scrollable().each(function(){if(e==null)return;var d=this,$elem=$(d),targ=e,toff,attr={},win=$elem.is('html,body');switch(typeof targ){case'number':case'string':if(/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(targ)){targ=both(targ);break}targ=$(targ,this);if(!targ.length)return;case'object':if(targ.is||targ.style)toff=(targ=$(targ)).offset()}$.each(g.axis.split(''),function(i,a){var b=a=='x'?'Left':'Top',pos=b.toLowerCase(),key='scroll'+b,old=d[key],max=h.max(d,a);if(toff){attr[key]=toff[pos]+(win?0:old-$elem.offset()[pos]);if(g.margin){attr[key]-=parseInt(targ.css('margin'+b))||0;attr[key]-=parseInt(targ.css('border'+b+'Width'))||0}attr[key]+=g.offset[pos]||0;if(g.over[pos])attr[key]+=targ[a=='x'?'width':'height']()*g.over[pos]}else{var c=targ[pos];attr[key]=c.slice&&c.slice(-1)=='%'?parseFloat(c)/100*max:c}if(g.limit&&/^\d+$/.test(attr[key]))attr[key]=attr[key]<=0?0:Math.min(attr[key],max);if(!i&&g.queue){if(old!=attr[key])animate(g.onAfterFirst);delete attr[key]}});animate(g.onAfter);function animate(a){$elem.animate(attr,f,g.easing,a&&function(){a.call(this,e,g)})}}).end()};h.max=function(a,b){var c=b=='x'?'Width':'Height',scroll='scroll'+c;if(!$(a).is('html,body'))return a[scroll]-$(a)[c.toLowerCase()]();var d='client'+c,html=a.ownerDocument.documentElement,body=a.ownerDocument.body;return Math.max(html[scroll],body[scroll])-Math.min(html[d],body[d])};function both(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);
/* jQuery Easing Plugin, v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ */
jQuery.easing.jswing=jQuery.easing.swing;jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(e,f,a,h,g){return jQuery.easing[jQuery.easing.def](e,f,a,h,g)},easeInQuad:function(e,f,a,h,g){return h*(f/=g)*f+a},easeOutQuad:function(e,f,a,h,g){return -h*(f/=g)*(f-2)+a},easeInOutQuad:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f+a}return -h/2*((--f)*(f-2)-1)+a},easeInCubic:function(e,f,a,h,g){return h*(f/=g)*f*f+a},easeOutCubic:function(e,f,a,h,g){return h*((f=f/g-1)*f*f+1)+a},easeInOutCubic:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f+a}return h/2*((f-=2)*f*f+2)+a},easeInQuart:function(e,f,a,h,g){return h*(f/=g)*f*f*f+a},easeOutQuart:function(e,f,a,h,g){return -h*((f=f/g-1)*f*f*f-1)+a},easeInOutQuart:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f*f+a}return -h/2*((f-=2)*f*f*f-2)+a},easeInQuint:function(e,f,a,h,g){return h*(f/=g)*f*f*f*f+a},easeOutQuint:function(e,f,a,h,g){return h*((f=f/g-1)*f*f*f*f+1)+a},easeInOutQuint:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f*f*f+a}return h/2*((f-=2)*f*f*f*f+2)+a},easeInSine:function(e,f,a,h,g){return -h*Math.cos(f/g*(Math.PI/2))+h+a},easeOutSine:function(e,f,a,h,g){return h*Math.sin(f/g*(Math.PI/2))+a},easeInOutSine:function(e,f,a,h,g){return -h/2*(Math.cos(Math.PI*f/g)-1)+a},easeInExpo:function(e,f,a,h,g){return(f==0)?a:h*Math.pow(2,10*(f/g-1))+a},easeOutExpo:function(e,f,a,h,g){return(f==g)?a+h:h*(-Math.pow(2,-10*f/g)+1)+a},easeInOutExpo:function(e,f,a,h,g){if(f==0){return a}if(f==g){return a+h}if((f/=g/2)<1){return h/2*Math.pow(2,10*(f-1))+a}return h/2*(-Math.pow(2,-10*--f)+2)+a},easeInCirc:function(e,f,a,h,g){return -h*(Math.sqrt(1-(f/=g)*f)-1)+a},easeOutCirc:function(e,f,a,h,g){return h*Math.sqrt(1-(f=f/g-1)*f)+a},easeInOutCirc:function(e,f,a,h,g){if((f/=g/2)<1){return -h/2*(Math.sqrt(1-f*f)-1)+a}return h/2*(Math.sqrt(1-(f-=2)*f)+1)+a},easeInElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k)==1){return e+l}if(!j){j=k*0.3}if(g35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('M 6(A){4 $11=A.11||\'&\';4 $V=A.V===r?r:j;4 $1p=A.1p===r?\'\':\'[]\';4 $13=A.13===r?r:j;4 $D=$13?A.D===j?"#":"?":"";4 $15=A.15===r?r:j;v.1o=M 6(){4 f=6(o,t){8 o!=1v&&o!==x&&(!!t?o.1t==t:j)};4 14=6(1m){4 m,1l=/\\[([^[]*)\\]/g,T=/^([^[]+)(\\[.*\\])?$/.1r(1m),k=T[1],e=[];19(m=1l.1r(T[2]))e.u(m[1]);8[k,e]};4 w=6(3,e,7){4 o,y=e.1b();b(I 3!=\'X\')3=x;b(y===""){b(!3)3=[];b(f(3,L)){3.u(e.h==0?7:w(x,e.z(0),7))}n b(f(3,1a)){4 i=0;19(3[i++]!=x);3[--i]=e.h==0?7:w(3[i],e.z(0),7)}n{3=[];3.u(e.h==0?7:w(x,e.z(0),7))}}n b(y&&y.T(/^\\s*[0-9]+\\s*$/)){4 H=1c(y,10);b(!3)3=[];3[H]=e.h==0?7:w(3[H],e.z(0),7)}n b(y){4 H=y.B(/^\\s*|\\s*$/g,"");b(!3)3={};b(f(3,L)){4 18={};1w(4 i=0;i<3.h;++i){18[i]=3[i]}3=18}3[H]=e.h==0?7:w(3[H],e.z(0),7)}n{8 7}8 3};4 C=6(a){4 p=d;p.l={};b(a.C){v.J(a.Z(),6(5,c){p.O(5,c)})}n{v.J(1u,6(){4 q=""+d;q=q.B(/^[?#]/,\'\');q=q.B(/[;&]$/,\'\');b($V)q=q.B(/[+]/g,\' \');v.J(q.Y(/[&;]/),6(){4 5=1e(d.Y(\'=\')[0]||"");4 c=1e(d.Y(\'=\')[1]||"");b(!5)8;b($15){b(/^[+-]?[0-9]+\\.[0-9]*$/.1d(c))c=1A(c);n b(/^[+-]?[0-9]+$/.1d(c))c=1c(c,10)}c=(!c&&c!==0)?j:c;b(c!==r&&c!==j&&I c!=\'1g\')c=c;p.O(5,c)})})}8 p};C.1H={C:j,1G:6(5,1f){4 7=d.Z(5);8 f(7,1f)},1h:6(5){b(!f(5))8 d.l;4 K=14(5),k=K[0],e=K[1];4 3=d.l[k];19(3!=x&&e.h!=0){3=3[e.1b()]}8 I 3==\'1g\'?3:3||""},Z:6(5){4 3=d.1h(5);b(f(3,1a))8 v.1E(j,{},3);n b(f(3,L))8 3.z(0);8 3},O:6(5,c){4 7=!f(c)?x:c;4 K=14(5),k=K[0],e=K[1];4 3=d.l[k];d.l[k]=w(3,e.z(0),7);8 d},w:6(5,c){8 d.N().O(5,c)},1s:6(5){8 d.O(5,x).17()},1z:6(5){8 d.N().1s(5)},1j:6(){4 p=d;v.J(p.l,6(5,7){1y p.l[5]});8 p},1F:6(Q){4 D=Q.B(/^.*?[#](.+?)(?:\\?.+)?$/,"$1");4 S=Q.B(/^.*?[?](.+?)(?:#.+)?$/,"$1");8 M C(Q.h==S.h?\'\':S,Q.h==D.h?\'\':D)},1x:6(){8 d.N().1j()},N:6(){8 M C(d)},17:6(){6 F(G){4 R=I G=="X"?f(G,L)?[]:{}:G;b(I G==\'X\'){6 1k(o,5,7){b(f(o,L))o.u(7);n o[5]=7}v.J(G,6(5,7){b(!f(7))8 j;1k(R,5,F(7))})}8 R}d.l=F(d.l);8 d},1B:6(){8 d.N().17()},1D:6(){4 i=0,U=[],W=[],p=d;4 16=6(E){E=E+"";b($V)E=E.B(/ /g,"+");8 1C(E)};4 1n=6(1i,5,7){b(!f(7)||7===r)8;4 o=[16(5)];b(7!==j){o.u("=");o.u(16(7))}1i.u(o.P(""))};4 F=6(R,k){4 12=6(5){8!k||k==""?[5].P(""):[k,"[",5,"]"].P("")};v.J(R,6(5,7){b(I 7==\'X\')F(7,12(5));n 1n(W,12(5),7)})};F(d.l);b(W.h>0)U.u($D);U.u(W.P($11));8 U.P("")}};8 M C(1q.S,1q.D)}}(v.1o||{});',62,106,'|||target|var|key|function|value|return|||if|val|this|tokens|is||length||true|base|keys||else||self||false|||push|jQuery|set|null|token|slice|settings|replace|queryObject|hash|str|build|orig|index|typeof|each|parsed|Array|new|copy|SET|join|url|obj|search|match|queryString|spaces|chunks|object|split|get||separator|newKey|prefix|parse|numbers|encode|COMPACT|temp|while|Object|shift|parseInt|test|decodeURIComponent|type|number|GET|arr|EMPTY|add|rx|path|addFields|query|suffix|location|exec|REMOVE|constructor|arguments|undefined|for|empty|delete|remove|parseFloat|compact|encodeURIComponent|toString|extend|load|has|prototype'.split('|'),0,{}))
/*!
* jQuery UI Touch Punch 0.2.3
* Depends:
* jquery.ui.widget.js
* jquery.ui.mouse.js
*/
!function(a){function f(a,b){if(!(a.originalEvent.touches.length>1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery);
// AJAX Functions
var jq = jQuery;
// Global variable to prevent multiple AJAX requests
var bp_ajax_request = null;
jq(document).ready( function() {
/**** Page Load Actions *******************************************************/
/* Hide Forums Post Form */
if ( '-1' == window.location.search.indexOf('new') && jq('div.forums').length )
jq('#new-topic-post').hide();
else
jq('#new-topic-post').show();
/* Activity filter and scope set */
bp_init_activity();
/* Object filter and scope set. */
var objects = [ 'members', 'groups', 'blogs', 'forums','course' ];
bp_init_objects( objects );
/* @mention Compose Scrolling */
var $whats_new = jq('#whats-new');
if ( jq.query.get('r') && $whats_new.length ) {
jq('#whats-new-options').animate({
height:'50px'
});
jq("#whats-new-form textarea").animate({
height:'50px'
});
jq.scrollTo( $whats_new, 500, {
offset:-125,
easing:'easeOutQuad'
} );
var whats_new_content = $whats_new.val();
$whats_new.val('').focus().val(whats_new_content);
}
/**** Activity Posting ********************************************************/
/* Textarea focus */
$whats_new.focus( function(){
jq("#whats-new-options").animate({
height:'40px'
});
jq("#whats-new-form textarea").animate({
height:'50px'
});
jq("#aw-whats-new-submit").prop("disabled", false);
var $whats_new_form = jq("form#whats-new-form");
if ( $whats_new_form.hasClass("submitted") ) {
$whats_new_form.removeClass("submitted");
}
});
/* On blur, shrink if it's empty */
$whats_new.blur( function(){
if (!this.value.match(/\S+/)) {
this.value = "";
jq("#whats-new-options").animate({
height:'40px'
});
jq("form#whats-new-form textarea").animate({
height:'30px'
});
jq("#aw-whats-new-submit").prop("disabled", true);
}
});
/* New posts */
jq("#aw-whats-new-submit").on( 'click', function() {
var button = jq(this);
var form = button.closest("form#whats-new-form");
form.children().each( function() {
if ( jq.nodeName(this, "textarea") || jq.nodeName(this, "input") )
jq(this).prop( 'disabled', true );
});
/* Remove any errors */
jq('div.error').remove();
button.addClass('loading');
button.prop('disabled', true);
form.addClass("submitted");
/* Default POST values */
var object = '';
var item_id = jq("#whats-new-post-in").val();
var content = jq("#whats-new").val();
/* Set object for non-profile posts */
if ( item_id > 0 ) {
object = jq("#whats-new-post-object").val();
}
jq.post( ajaxurl, {
action: 'post_update',
'cookie': bp_get_cookies(),
'_wpnonce_post_update': jq("#_wpnonce_post_update").val(),
'content': content,
'object': object,
'item_id': item_id,
'_bp_as_nonce': jq('#_bp_as_nonce').val() || ''
},
function(response) {
form.children().each( function() {
if ( jq.nodeName(this, "textarea") || jq.nodeName(this, "input") ) {
jq(this).prop( 'disabled', false );
}
});
/* Check for errors and append if found. */
if ( response[0] + response[1] == '-1' ) {
form.prepend( response.substr( 2, response.length ) );
jq( '#' + form.attr('id') + ' div.error').hide().fadeIn( 200 );
} else {
if ( 0 == jq("ul.activity-list").length ) {
jq("div.error").slideUp(100).remove();
jq("#message").slideUp(100).remove();
jq("div.activity").append( '' );
}
jq("#activity-stream").prepend(response);
jq("#activity-stream li:first").addClass('new-update just-posted');
if ( 0 != jq("#latest-update").length ) {
var l = jq("#activity-stream li.new-update .activity-content .activity-inner p").html();
var v = jq("#activity-stream li.new-update .activity-content .activity-header p a.view").attr('href');
var ltext = jq("#activity-stream li.new-update .activity-content .activity-inner p").text();
var u = '';
if ( ltext != '' )
u = l + ' ';
u += '' + BP_DTheme.view + ' ';
jq("#latest-update").slideUp(300,function(){
jq("#latest-update").html( u );
jq("#latest-update").slideDown(300);
});
}
jq("li.new-update").hide().slideDown( 300 );
jq("li.new-update").removeClass( 'new-update' );
jq("#whats-new").val('');
}
jq("#whats-new-options").animate({
height:'0px'
});
jq("#whats-new-form textarea").animate({
height:'20px'
});
jq("#aw-whats-new-submit").prop("disabled", true).removeClass('loading');
});
return false;
});
/* List tabs event delegation */
jq('div.activity-type-tabs').on( 'click', function(event) {
var target = jq(event.target).parent();
if ( event.target.nodeName == 'STRONG' || event.target.nodeName == 'SPAN' )
target = target.parent();
else if ( event.target.nodeName != 'A' )
return false;
/* Reset the page */
jq.cookie( 'bp-activity-oldestpage', 1, {
path: '/'
} );
/* Activity Stream Tabs */
var scope = target.attr('id').substr( 9, target.attr('id').length );
var filter = jq("#activity-filter-select select").val();
if ( scope == 'mentions' )
jq( '#' + target.attr('id') + ' a strong' ).remove();
bp_activity_request(scope, filter);
return false;
});
/* Activity filter select */
jq('#activity-filter-select select').change( function() {
var selected_tab = jq( 'div.activity-type-tabs li.selected' );
if ( !selected_tab.length )
var scope = null;
else
var scope = selected_tab.attr('id').substr( 9, selected_tab.attr('id').length );
var filter = jq(this).val();
bp_activity_request(scope, filter);
return false;
});
/* Stream event delegation */
jq('div.activity').on( 'click', function(event) {
var target = jq(event.target);
/* Favoriting activity stream items */
if ( target.hasClass('fav') || target.hasClass('unfav') ) {
var type = target.hasClass('fav') ? 'fav' : 'unfav';
var parent = target.closest('.activity-item');
var parent_id = parent.attr('id').substr( 9, parent.attr('id').length );
target.addClass('loading');
jq.post( ajaxurl, {
action: 'activity_mark_' + type,
'cookie': bp_get_cookies(),
'id': parent_id
},
function(response) {
target.removeClass('loading');
target.fadeOut( 200, function() {
jq(this).html(response);
jq(this).attr('title', 'fav' == type ? BP_DTheme.remove_fav : BP_DTheme.mark_as_fav);
jq(this).fadeIn(200);
});
if ( 'fav' == type ) {
if ( !jq('.item-list-tabs #activity-favs-personal-li').length ) {
if ( !jq('.item-list-tabs #activity-favorites').length )
jq('.item-list-tabs ul #activity-mentions').before( '' + BP_DTheme.my_favs + ' 0 ');
jq('.item-list-tabs ul #activity-favorites span').html( Number( jq('.item-list-tabs ul #activity-favorites span').html() ) + 1 );
}
target.removeClass('fav');
target.addClass('unfav');
} else {
target.removeClass('unfav');
target.addClass('fav');
jq('.item-list-tabs ul #activity-favorites span').html( Number( jq('.item-list-tabs ul #activity-favorites span').html() ) - 1 );
if ( !Number( jq('.item-list-tabs ul #activity-favorites span').html() ) ) {
if ( jq('.item-list-tabs ul #activity-favorites').hasClass('selected') )
bp_activity_request( null, null );
jq('.item-list-tabs ul #activity-favorites').remove();
}
}
if ( 'activity-favorites' == jq( '.item-list-tabs li.selected').attr('id') )
target.parent().parent().parent().slideUp(100);
});
return false;
}
/* Delete activity stream items */
if ( target.hasClass('delete-activity') ) {
var li = target.parents('div.activity ul li');
var id = li.attr('id').substr( 9, li.attr('id').length );
var link_href = target.attr('href');
var nonce = link_href.split('_wpnonce=');
nonce = nonce[1];
target.addClass('loading');
jq.post( ajaxurl, {
action: 'delete_activity',
'cookie': bp_get_cookies(),
'id': id,
'_wpnonce': nonce
},
function(response) {
if ( response[0] + response[1] == '-1' ) {
li.prepend( response.substr( 2, response.length ) );
li.children('#message').hide().fadeIn(300);
} else {
li.slideUp(300);
}
});
return false;
}
// Spam activity stream items
if ( target.hasClass( 'spam-activity' ) ) {
var li = target.parents( 'div.activity ul li' );
target.addClass( 'loading' );
jq.post( ajaxurl, {
action: 'bp_spam_activity',
'cookie': encodeURIComponent( document.cookie ),
'id': li.attr( 'id' ).substr( 9, li.attr( 'id' ).length ),
'_wpnonce': target.attr( 'href' ).split( '_wpnonce=' )[1]
},
function(response) {
if ( response[0] + response[1] === '-1' ) {
li.prepend( response.substr( 2, response.length ) );
li.children( '#message' ).hide().fadeIn(300);
} else {
li.slideUp( 300 );
}
});
return false;
}
/* Load more updates at the end of the page */
if ( target.parent().hasClass('load-more') ) {
jq("#buddypress li.load-more").addClass('loading');
if ( null == jq.cookie('bp-activity-oldestpage') )
jq.cookie('bp-activity-oldestpage', 1, {
path: '/'
} );
var oldest_page = ( jq.cookie('bp-activity-oldestpage') * 1 ) + 1;
var just_posted = [];
jq('.activity-list li.just-posted').each( function(){
just_posted.push( jq(this).attr('id').replace( 'activity-','' ) );
});
jq.post( ajaxurl, {
action: 'activity_get_older_updates',
'cookie': bp_get_cookies(),
'page': oldest_page,
'exclude_just_posted': just_posted.join(',')
},
function(response)
{
jq("#buddypress li.load-more").removeClass('loading');
jq.cookie( 'bp-activity-oldestpage', oldest_page, {
path: '/'
} );
jq("#buddypress ul.activity-list").append(response.contents);
target.parent().hide();
}, 'json' );
return false;
}
});
// Activity "Read More" links
jq('div.activity').on('click', '.activity-read-more a', function(event) {
var target = jq(event.target);
var link_id = target.parent().attr('id').split('-');
var a_id = link_id[3];
var type = link_id[0]; /* activity or acomment */
var inner_class = type == 'acomment' ? 'acomment-content' : 'activity-inner';
var a_inner = jq('#' + type + '-' + a_id + ' .' + inner_class + ':first' );
jq(target).addClass('loading');
jq.post( ajaxurl, {
action: 'get_single_activity_content',
'activity_id': a_id
},
function(response) {
jq(a_inner).slideUp(300).html(response).slideDown(300);
});
return false;
});
/**** Activity Comments *******************************************************/
/* Hide all activity comment forms */
jq('form.ac-form').hide();
/* Hide excess comments */
if ( jq('.activity-comments').length )
bp_legacy_theme_hide_comments();
/* Activity list event delegation */
jq('div.activity').on( 'click', function(event) {
var target = jq(event.target);
/* Comment / comment reply links */
if ( target.hasClass('acomment-reply') || target.parent().hasClass('acomment-reply') ) {
if ( target.parent().hasClass('acomment-reply') )
target = target.parent();
var id = target.attr('id');
ids = id.split('-');
var a_id = ids[2]
var c_id = target.attr('href').substr( 10, target.attr('href').length );
var form = jq( '#ac-form-' + a_id );
form.css( 'display', 'none' );
form.removeClass('root');
jq('.ac-form').hide();
/* Hide any error messages */
form.children('div').each( function() {
if ( jq(this).hasClass( 'error' ) )
jq(this).hide();
});
if ( ids[1] != 'comment' ) {
jq('#acomment-' + c_id).append( form );
} else {
jq('#activity-' + a_id + ' .activity-comments').append( form );
}
if ( form.parent().hasClass( 'activity-comments' ) )
form.addClass('root');
form.slideDown( 200 );
jq.scrollTo( form, 500, {
offset:-100,
easing:'easeOutQuad'
} );
jq('#ac-form-' + ids[2] + ' textarea').focus();
return false;
}
/* Activity comment posting */
if ( target.attr('name') == 'ac_form_submit' ) {
var form = target.parents( 'form' );
var form_parent = form.parent();
var form_id = form.attr('id').split('-');
if ( !form_parent.hasClass('activity-comments') ) {
var tmp_id = form_parent.attr('id').split('-');
var comment_id = tmp_id[1];
} else {
var comment_id = form_id[2];
}
var content = jq( '#' + form.attr('id') + ' textarea' );
/* Hide any error messages */
jq( '#' + form.attr('id') + ' div.error').hide();
target.addClass('loading').prop('disabled', true);
content.addClass('loading').prop('disabled', true);
var ajaxdata = {
action: 'new_activity_comment',
'cookie': bp_get_cookies(),
'_wpnonce_new_activity_comment': jq("#_wpnonce_new_activity_comment").val(),
'comment_id': comment_id,
'form_id': form_id[2],
'content': content.val()
};
// Akismet
var ak_nonce = jq('#_bp_as_nonce_' + comment_id).val();
if ( ak_nonce ) {
ajaxdata['_bp_as_nonce_' + comment_id] = ak_nonce;
}
jq.post( ajaxurl, ajaxdata, function(response) {
target.removeClass('loading');
content.removeClass('loading');
/* Check for errors and append if found. */
if ( response[0] + response[1] == '-1' ) {
form.append( jq( response.substr( 2, response.length ) ).hide().fadeIn( 200 ) );
} else {
var activity_comments = form.parent();
form.fadeOut( 200, function() {
if ( 0 == activity_comments.children('ul').length ) {
if ( activity_comments.hasClass('activity-comments') ) {
activity_comments.prepend('');
} else {
activity_comments.append('');
}
}
/* Preceeding whitespace breaks output with jQuery 1.9.0 */
var the_comment = jq.trim( response );
activity_comments.children('ul').append( jq( the_comment ).hide().fadeIn( 200 ) );
form.children('textarea').val('');
activity_comments.parent().addClass('has-comments');
} );
jq( '#' + form.attr('id') + ' textarea').val('');
/* Increase the "Reply (X)" button count */
jq('#activity-' + form_id[2] + ' a.acomment-reply span').html( Number( jq('#activity-' + form_id[2] + ' a.acomment-reply span').html() ) + 1 );
// Increment the 'Show all x comments' string, if present
var show_all_a = activity_comments.find('.show-all').find('a');
if ( show_all_a ) {
var new_count = jq('li#activity-' + form_id[2] + ' a.acomment-reply span').html();
show_all_a.html( BP_DTheme.show_x_comments.replace( '%d', new_count ) );
}
}
jq(target).prop("disabled", false);
jq(content).prop("disabled", false);
});
return false;
}
/* Deleting an activity comment */
if ( target.hasClass('acomment-delete') ) {
var link_href = target.attr('href');
var comment_li = target.parent().parent();
var form = comment_li.parents('div.activity-comments').children('form');
var nonce = link_href.split('_wpnonce=');
nonce = nonce[1];
var comment_id = link_href.split('cid=');
comment_id = comment_id[1].split('&');
comment_id = comment_id[0];
target.addClass('loading');
/* Remove any error messages */
jq('.activity-comments ul .error').remove();
/* Reset the form position */
comment_li.parents('.activity-comments').append(form);
jq.post( ajaxurl, {
action: 'delete_activity_comment',
'cookie': bp_get_cookies(),
'_wpnonce': nonce,
'id': comment_id
},
function(response) {
/* Check for errors and append if found. */
if ( response[0] + response[1] == '-1' ) {
comment_li.prepend( jq( response.substr( 2, response.length ) ).hide().fadeIn( 200 ) );
} else {
var children = jq( '#' + comment_li.attr('id') + ' ul' ).children('li');
var child_count = 0;
jq(children).each( function() {
if ( !jq(this).is(':hidden') )
child_count++;
});
comment_li.fadeOut(200, function() {
comment_li.remove();
});
/* Decrease the "Reply (X)" button count */
var count_span = jq('#' + comment_li.parents('#activity-stream > li').attr('id') + ' a.acomment-reply span');
var new_count = count_span.html() - ( 1 + child_count );
count_span.html(new_count);
// Change the 'Show all x comments' text
var show_all_a = comment_li.siblings('.show-all').find('a');
if ( show_all_a ) {
show_all_a.html( BP_DTheme.show_x_comments.replace( '%d', new_count ) );
}
/* If that was the last comment for the item, remove the has-comments class to clean up the styling */
if ( 0 == new_count ) {
jq(comment_li.parents('#activity-stream > li')).removeClass('has-comments');
}
}
});
return false;
}
// Spam an activity stream comment
if ( target.hasClass( 'spam-activity-comment' ) ) {
var link_href = target.attr( 'href' );
var comment_li = target.parent().parent();
target.addClass('loading');
// Remove any error messages
jq( '.activity-comments ul div.error' ).remove();
// Reset the form position
comment_li.parents( '.activity-comments' ).append( comment_li.parents( '.activity-comments' ).children( 'form' ) );
jq.post( ajaxurl, {
action: 'bp_spam_activity_comment',
'cookie': encodeURIComponent( document.cookie ),
'_wpnonce': link_href.split( '_wpnonce=' )[1],
'id': link_href.split( 'cid=' )[1].split( '&' )[0]
},
function ( response ) {
// Check for errors and append if found.
if ( response[0] + response[1] == '-1' ) {
comment_li.prepend( jq( response.substr( 2, response.length ) ).hide().fadeIn( 200 ) );
} else {
var children = jq( '#' + comment_li.attr( 'id' ) + ' ul' ).children( 'li' );
var child_count = 0;
jq(children).each( function() {
if ( !jq( this ).is( ':hidden' ) ) {
child_count++;
}
});
comment_li.fadeOut( 200 );
// Decrease the "Reply (X)" button count
var parent_li = comment_li.parents( '#activity-stream > li' );
jq( '#' + parent_li.attr( 'id' ) + ' a.acomment-reply span' ).html( jq( '#' + parent_li.attr( 'id' ) + ' a.acomment-reply span' ).html() - ( 1 + child_count ) );
}
});
return false;
}
/* Showing hidden comments - pause for half a second */
if ( target.parent().hasClass('show-all') ) {
target.parent().addClass('loading');
setTimeout( function() {
target.parent().parent().children('li').fadeIn(200, function() {
target.parent().remove();
});
}, 600 );
return false;
}
// Canceling an activity comment
if ( target.hasClass( 'ac-reply-cancel' ) ) {
jq(target).closest('.ac-form').slideUp( 200 );
return false;
};
});
/* Escape Key Press for cancelling comment forms */
jq(document).keydown( function(e) {
e = e || window.event;
if (e.target)
element = e.target;
else if (e.srcElement)
element = e.srcElement;
if( element.nodeType == 3)
element = element.parentNode;
if( e.ctrlKey == true || e.altKey == true || e.metaKey == true )
return;
var keyCode = (e.keyCode) ? e.keyCode : e.which;
if ( keyCode == 27 ) {
if (element.tagName == 'TEXTAREA') {
if ( jq(element).hasClass('ac-input') )
jq(element).parent().parent().parent().slideUp( 200 );
}
}
});
/**** Directory Search ****************************************************/
/* The search form on all directory pages */
jq('.dir-search').on( 'click', function(event) {
if ( jq(this).hasClass('no-ajax') )
return;
var target = jq(event.target);
if ( target.attr('type') == 'submit' ) {
if(jq('.item-list-tabs li.selected').attr('id').indexOf('-')>=0){
var css_id = jq('.item-list-tabs li.selected').attr('id').split( '-' );
var object = css_id[0];
bp_filter_request( object, jq.cookie('bp-' + object + '-filter'), jq.cookie('bp-' + object + '-scope') , 'div.' + object, target.parent().children('label').children('input').val(), 1, jq.cookie('bp-' + object + '-extras') );
}
return false;
}
});
/**** Tabs and Filters ****************************************************/
/* When a navigation tab is clicked - e.g. | All Groups | My Groups | */
jq('div.item-list-tabs').click( function(event) {
if ( jq(this).hasClass('no-ajax') )
return;
var targetElem = ( event.target.nodeName == 'SPAN' ) ? event.target.parentNode : event.target;
var target = jq( targetElem ).parent();
if ( 'LI' == target[0].nodeName && !target.hasClass('last') ) {
var css_id = target.attr('id').split( '-' );
var object = css_id[0];
if ( 'activity' == object )
return false;
var scope = css_id[1];
var filter = jq("#" + object + "-order-select select").val();
var search_terms = jq("#" + object + "_search").val();
bp_filter_request( object, filter, scope, 'div.' + object, search_terms, 1, jq.cookie('bp-' + object + '-extras') );
return false;
}
});
/* When the filter select box is changed re-query */
jq('li.filter select').change( function() {
if ( jq('.item-list-tabs li.selected').length )
var el = jq('.item-list-tabs li.selected');
else
var el = jq(this);
var css_id = el.attr('id').split('-');
var object = css_id[0];
var scope = css_id[1];
var filter = jq(this).val();
var search_terms = false;
if ( jq('.dir-search input').length )
search_terms = jq('.dir-search input').val();
if ( 'friends' == object )
object = 'members';
bp_filter_request( object, filter, scope, 'div.' + object, search_terms, 1, jq.cookie('bp-' + object + '-extras') );
return false;
});
/* All pagination links run through this function */
jq('#buddypress').on( 'click', function(event) {
var target = jq(event.target);
if ( target.hasClass('button') )
return true;
if ( target.parent().parent().hasClass('pagination') && !target.parent().parent().hasClass('no-ajax') ) {
if ( target.hasClass('dots') || target.hasClass('current') )
return false;
if ( jq('.item-list-tabs li.selected').length )
var el = jq('.item-list-tabs li.selected');
else
var el = jq('li.filter select');
var page_number = 1;
var css_id = el.attr('id').split( '-' );
var object = css_id[0];
var search_terms = false;
var pagination_id = jq(target).closest('.pagination-links').attr('id');
if ( jq('div.dir-search input').length )
search_terms = jq('.dir-search input').val();
if ( jq(target).hasClass('next') )
var page_number = Number( jq('.pagination span.current').html() ) + 1;
else if ( jq(target).hasClass('prev') )
var page_number = Number( jq('.pagination span.current').html() ) - 1;
else
var page_number = Number( jq(target).html() );
if ( pagination_id.indexOf( 'pag-bottom' ) !== -1 ) {
var caller = 'pag-bottom';
} else {
var caller = null;
}
bp_filter_request( object, jq.cookie('bp-' + object + '-filter'), jq.cookie('bp-' + object + '-scope'), 'div.' + object, search_terms, page_number, jq.cookie('bp-' + object + '-extras'), caller );
return false;
}
});
/**** New Forum Directory Post **************************************/
/* Hit the "New Topic" button on the forums directory page */
jq('a.show-hide-new').on( 'click', function() {
if ( !jq('#new-topic-post').length )
return false;
if ( jq('#new-topic-post').is(":visible") )
jq('#new-topic-post').slideUp(200);
else
jq('#new-topic-post').slideDown(200, function() {
jq('#topic_title').focus();
} );
return false;
});
/* Cancel the posting of a new forum topic */
jq('#submit_topic_cancel').on( 'click', function() {
if ( !jq('#new-topic-post').length )
return false;
jq('#new-topic-post').slideUp(200);
return false;
});
/* Clicking a forum tag */
jq('#forum-directory-tags a').on( 'click', function() {
bp_filter_request( 'forums', 'tags', jq.cookie('bp-forums-scope'), 'div.forums', jq(this).html().replace( / /g, '-' ), 1, jq.cookie('bp-forums-extras') );
return false;
});
/** Invite Friends Interface ****************************************/
/* Select a user from the list of friends and add them to the invite list */
jq("#invite-list input").on( 'click', function() {
jq('.ajax-loader').toggle();
var friend_id = jq(this).val();
if ( jq(this).prop('checked') == true )
var friend_action = 'invite';
else
var friend_action = 'uninvite';
jq('.item-list-tabs li.selected').addClass('loading');
jq.post( ajaxurl, {
action: 'groups_invite_user',
'friend_action': friend_action,
'cookie': bp_get_cookies(),
'_wpnonce': jq("#_wpnonce_invite_uninvite_user").val(),
'friend_id': friend_id,
'group_id': jq("#group_id").val()
},
function(response)
{
if ( jq("#message") )
jq("#message").hide();
jq('.ajax-loader').toggle();
if ( friend_action == 'invite' ) {
jq('#friend-list').append(response);
} else if ( friend_action == 'uninvite' ) {
jq('#friend-list li#uid-' + friend_id).remove();
}
jq('.item-list-tabs li.selected').removeClass('loading');
});
});
/* Remove a user from the list of users to invite to a group */
jq("#friend-list").on('click', 'li a.remove', function() {
jq('.ajax-loader').toggle();
var friend_id = jq(this).attr('id');
friend_id = friend_id.split('-');
friend_id = friend_id[1];
jq.post( ajaxurl, {
action: 'groups_invite_user',
'friend_action': 'uninvite',
'cookie': bp_get_cookies(),
'_wpnonce': jq("#_wpnonce_invite_uninvite_user").val(),
'friend_id': friend_id,
'group_id': jq("#group_id").val()
},
function(response)
{
jq('.ajax-loader').toggle();
jq('#friend-list #uid-' + friend_id).remove();
jq('#invite-list #f-' + friend_id).prop('checked', false);
});
return false;
});
/** Profile Visibility Settings *********************************/
jq('.field-visibility-settings').hide();
jq('.visibility-toggle-link').on( 'click', function() {
var toggle_div = jq(this).parent();
jq(toggle_div).fadeOut( 600, function(){
jq(toggle_div).siblings('.field-visibility-settings').slideDown(400);
});
return false;
} );
jq('.field-visibility-settings-close').on( 'click', function() {
var settings_div = jq(this).parent();
var vis_setting_text = settings_div.find('input:checked').parent().text();
settings_div.slideUp( 400, function() {
settings_div.siblings('.field-visibility-settings-toggle').fadeIn(800);
settings_div.siblings('.field-visibility-settings-toggle').children('.current-visibility-level').html(vis_setting_text);
} );
return false;
} );
jq("#profile-edit-form input:not(:submit), #profile-edit-form textarea, #profile-edit-form select, #signup_form input:not(:submit), #signup_form textarea, #signup_form select").change( function() {
var shouldconfirm = true;
jq('#profile-edit-form input:submit, #signup_form input:submit').on( 'click', function() {
shouldconfirm = false;
});
window.onbeforeunload = function(e) {
if ( shouldconfirm ) {
return BP_DTheme.unsaved_changes;
}
};
});
/** Friendship Requests **************************************/
/* Accept and Reject friendship request buttons */
jq("#friend-list a.accept, #friend-list a.reject").on( 'click', function() {
var button = jq(this);
var li = jq(this).parents('#friend-list li');
var action_div = jq(this).parents('li div.action');
var id = li.attr('id').substr( 11, li.attr('id').length );
var link_href = button.attr('href');
var nonce = link_href.split('_wpnonce=');
nonce = nonce[1];
if ( jq(this).hasClass('accepted') || jq(this).hasClass('rejected') )
return false;
if ( jq(this).hasClass('accept') ) {
var action = 'accept_friendship';
action_div.children('a.reject').css( 'visibility', 'hidden' );
} else {
var action = 'reject_friendship';
action_div.children('a.accept').css( 'visibility', 'hidden' );
}
button.addClass('loading');
jq.post( ajaxurl, {
action: action,
'cookie': bp_get_cookies(),
'id': id,
'_wpnonce': nonce
},
function(response) {
button.removeClass('loading');
if ( response[0] + response[1] == '-1' ) {
li.prepend( response.substr( 2, response.length ) );
li.children('#message').hide().fadeIn(200);
} else {
button.fadeOut( 100, function() {
if ( jq(this).hasClass('accept') ) {
action_div.children('a.reject').hide();
jq(this).html( BP_DTheme.accepted ).contents().unwrap();
} else {
action_div.children('a.accept').hide();
jq(this).html( BP_DTheme.rejected ).contents().unwrap();
}
});
}
});
return false;
});
/* Add / Remove friendship buttons */
jq('#members-dir-list').on('click', '.friendship-button a', function() {
jq(this).parent().addClass('loading');
var fid = jq(this).attr('id');
fid = fid.split('-');
fid = fid[1];
var nonce = jq(this).attr('href');
nonce = nonce.split('?_wpnonce=');
nonce = nonce[1].split('&');
nonce = nonce[0];
var thelink = jq(this);
jq.post( ajaxurl, {
action: 'addremove_friend',
'cookie': bp_get_cookies(),
'fid': fid,
'_wpnonce': nonce
},
function(response)
{
var action = thelink.attr('rel');
var parentdiv = thelink.parent();
if ( action == 'add' ) {
jq(parentdiv).fadeOut(200,
function() {
parentdiv.removeClass('add_friend');
parentdiv.removeClass('loading');
parentdiv.addClass('pending_friend');
parentdiv.fadeIn(200).html(response);
}
);
} else if ( action == 'remove' ) {
jq(parentdiv).fadeOut(200,
function() {
parentdiv.removeClass('remove_friend');
parentdiv.removeClass('loading');
parentdiv.addClass('add');
parentdiv.fadeIn(200).html(response);
}
);
}
});
return false;
} );
/** Group Join / Leave Buttons **************************************/
// Confirmation when clicking Leave Group in group headers
jq('#buddypress').on('click', '.group-button .leave-group', function() {
if ( false == confirm( BP_DTheme.leave_group_confirm ) ) {
return false;
}
});
jq('#groups-dir-list').on('click', '.group-button a', function() {
var gid = jq(this).parent().attr('id');
gid = gid.split('-');
gid = gid[1];
var nonce = jq(this).attr('href');
nonce = nonce.split('?_wpnonce=');
nonce = nonce[1].split('&');
nonce = nonce[0];
var thelink = jq(this);
// Leave Group confirmation within directories - must intercept
// AJAX request
if ( thelink.hasClass( 'leave-group' ) && false == confirm( BP_DTheme.leave_group_confirm ) ) {
return false;
}
jq.post( ajaxurl, {
action: 'joinleave_group',
'cookie': bp_get_cookies(),
'gid': gid,
'_wpnonce': nonce
},
function(response)
{
var parentdiv = thelink.parent();
// user groups page
if ( ! jq('body.directory').length ) {
location.href = location.href;
// groups directory
} else {
jq(parentdiv).fadeOut(200,
function() {
parentdiv.fadeIn(200).html(response);
var mygroups = jq('#groups-personal span');
var add = 1;
if( thelink.hasClass( 'leave-group' ) ) {
// hidden groups slide up
if ( parentdiv.hasClass( 'hidden' ) ) {
parentdiv.closest('li').slideUp( 200 );
}
add = 0;
} else if ( thelink.hasClass( 'request-membership' ) ) {
add = false;
}
// change the "My Groups" value
if ( mygroups.length && add !== false ) {
if ( add ) {
mygroups.text( ( mygroups.text() >> 0 ) + 1 );
} else {
mygroups.text( ( mygroups.text() >> 0 ) - 1 );
}
}
}
);
}
});
return false;
} );
/** Button disabling ************************************************/
jq('#buddypress').on( 'click', '.pending', function() {
return false;
});
/** Private Messaging ******************************************/
/** Message search*/
jq('.message-search').on( 'click', function(event) {
if ( jq(this).hasClass('no-ajax') )
return;
var target = jq(event.target);
if ( target.attr('type') == 'submit' ) {
//var css_id = jq('.item-list-tabs li.selected').attr('id').split( '-' );
var object = 'messages';
bp_filter_request( object, jq.cookie('bp-' + object + '-filter'), jq.cookie('bp-' + object + '-scope') , 'div.' + object, target.parent().children('label').children('input').val(), 1, jq.cookie('bp-' + object + '-extras') );
return false;
}
});
/* AJAX send reply functionality */
jq("#send_reply_button").click(
function() {
var order = jq('#messages_order').val() || 'ASC',
offset = jq('#message-recipients').offset();
var button = jq("#send_reply_button");
jq(button).addClass('loading');
jq.post( ajaxurl, {
action: 'messages_send_reply',
'cookie': bp_get_cookies(),
'_wpnonce': jq("#send_message_nonce").val(),
'content': jq("#message_content").val(),
'send_to': jq("#send_to").val(),
'subject': jq("#subject").val(),
'thread_id': jq("#thread_id").val()
},
function(response)
{
if ( response[0] + response[1] == "-1" ) {
jq('#send-reply').prepend( response.substr( 2, response.length ) );
} else {
jq('#send-reply #message').remove();
jq("#message_content").val('');
if ( 'ASC' == order ) {
jq('#send-reply').before( response );
} else {
jq('#message-recipients').after( response );
jq(window).scrollTop(offset.top);
}
jq(".new-message").hide().slideDown( 200, function() {
jq('.new-message').removeClass('new-message');
});
}
jq(button).removeClass('loading');
});
return false;
}
);
/* Marking private messages as read and unread */
jq("#mark_as_read, #mark_as_unread").click(function() {
var checkboxes_tosend = '';
var checkboxes = jq("#message-threads tr td input[type='checkbox']");
if ( 'mark_as_unread' == jq(this).attr('id') ) {
var currentClass = 'read'
var newClass = 'unread'
var unreadCount = 1;
var inboxCount = 0;
var unreadCountDisplay = 'inline';
var action = 'messages_markunread';
} else {
var currentClass = 'unread'
var newClass = 'read'
var unreadCount = 0;
var inboxCount = 1;
var unreadCountDisplay = 'none';
var action = 'messages_markread';
}
checkboxes.each( function(i) {
if(jq(this).is(':checked')) {
if ( jq('#m-' + jq(this).attr('value')).hasClass(currentClass) ) {
checkboxes_tosend += jq(this).attr('value');
jq('#m-' + jq(this).attr('value')).removeClass(currentClass);
jq('#m-' + jq(this).attr('value')).addClass(newClass);
var thread_count = jq('#m-' + jq(this).attr('value') + ' td span.unread-count').html();
jq('#m-' + jq(this).attr('value') + ' td span.unread-count').html(unreadCount);
jq('#m-' + jq(this).attr('value') + ' td span.unread-count').css('display', unreadCountDisplay);
var inboxcount = jq('tr.unread').length;
jq('#user-messages span').html( inboxcount );
if ( i != checkboxes.length - 1 ) {
checkboxes_tosend += ','
}
}
}
});
jq.post( ajaxurl, {
action: action,
'thread_ids': checkboxes_tosend
});
return false;
});
/* Selecting unread and read messages in inbox */
jq( 'body.messages #item-body div.messages' ).on( 'change', '#message-type-select', function() {
var selection = this.value;
var checkboxes = jq( "td input[type='checkbox']" );
checkboxes.each( function(i) {
checkboxes[i].checked = "";
});
var checked_value = "checked";
switch ( selection ) {
case 'unread' :
checkboxes = jq("tr.unread td input[type='checkbox']");
break;
case 'read' :
checkboxes = jq("tr.read td input[type='checkbox']");
break;
case '' :
checked_value = "";
break;
}
checkboxes.each( function(i) {
checkboxes[i].checked = checked_value;
});
});
/* Bulk delete messages */
jq( 'body.messages #item-body div.messages' ).on( 'click', '.messages-options-nav a', function(event) {
event.preventDefault();
if ( -1 == jq.inArray( this.id , Array( 'delete_sentbox_messages', 'delete_inbox_messages' ) )) {
return;
}
checkboxes_tosend = '';
checkboxes = jq("#message-threads tr td input[type='checkbox']");
jq('#message').remove();
jq(this).addClass('loading');
jq(checkboxes).each( function(i) {
if( jq(this).is(':checked') )
checkboxes_tosend += jq(this).attr('value') + ',';
});
if ( '' == checkboxes_tosend ) {
jq(this).removeClass('loading');
return false;
}
jq.post( ajaxurl, {
action: 'messages_delete',
'thread_ids': checkboxes_tosend
}, function(response) {
if ( response[0] + response[1] == "-1" ) {
jq('#message-threads').prepend( response.substr( 2, response.length ) );
} else {
jq('#message-threads').before( '' );
jq(checkboxes).each( function(i) {
if( jq(this).is(':checked') ) {
// We need to uncheck because message is only hidden
// Otherwise, AJAX will be fired again with same data
jq(this).attr( 'checked', false );
jq(this).parent().parent().fadeOut(150);
}
});
}
jq('#message').hide().slideDown(150);
jq("#delete_inbox_messages, #delete_sentbox_messages").removeClass('loading');
});
return false;
});
/* Star action function */
starAction = function() {
var link = jq(this);
jq.post( ajaxurl, {
action: 'messages_star',
'message_id': link.data('message-id'),
'star_status': link.data('star-status'),
'nonce': link.data('star-nonce'),
'bulk': link.data('star-bulk')
},
function(response) {
if ( 1 === parseInt( response, 10 ) ) {
if ( 'unstar' === link.data('star-status') ) {
link.data('star-status', 'star');
link.removeClass('message-action-unstar').addClass('message-action-star');
link.find('.bp-screen-reader-text').text( BP_PM_Star.strings.text_star );
if ( 1 === BP_PM_Star.is_single_thread ) {
link.prop('title', BP_PM_Star.strings.title_star );
} else {
link.prop('title', BP_PM_Star.strings.title_star_thread );
}
} else {
link.data('star-status', 'unstar');
link.removeClass('message-action-star').addClass('message-action-unstar');
link.find('.bp-screen-reader-text').text(BP_PM_Star.strings.text_unstar);
if ( 1 === BP_PM_Star.is_single_thread ) {
link.prop('title', BP_PM_Star.strings.title_unstar );
} else {
link.prop('title', BP_PM_Star.strings.title_unstar_thread );
}
}
}
});
return false;
};
/* Star actions */
jq('#message-threads').on('click', 'td.thread-star a', starAction );
jq('#message-thread').on('click', '.message-star-actions a', starAction );
/* Star bulk manage - Show only the valid action based on the starred item. */
jq('#message-threads td.bulk-select-check :checkbox').on('change', function() {
var box = jq(this),
star = box.closest('tr').find('.thread-star a');
if ( box.prop('checked') ) {
if( 'unstar' === star.data('star-status') ) {
BP_PM_Star.star_counter++;
} else {
BP_PM_Star.unstar_counter++;
}
} else {
if( 'unstar' === star.data('star-status') ) {
BP_PM_Star.star_counter--;
} else {
BP_PM_Star.unstar_counter--;
}
}
if ( BP_PM_Star.star_counter > 0 && parseInt( BP_PM_Star.unstar_counter, 10 ) === 0 ) {
jq('option[value="star"]').hide();
} else {
jq('option[value="star"]').show();
}
if ( BP_PM_Star.unstar_counter > 0 && parseInt( BP_PM_Star.star_counter, 10 ) === 0 ) {
jq('option[value="unstar"]').hide();
} else {
jq('option[value="unstar"]').show();
}
});
/** Notifications **********************************************/
/* Selecting/Deselecting all notifications */
jq('#select-all-notifications').click(function(event) {
if( this.checked ) {
jq('.notification-check').each(function() {
this.checked = true;
});
} else {
jq('.notification-check').each(function() {
this.checked = false;
});
}
});
/* Make sure a 'Bulk Action' is selected before submitting the form */
jq('#notification-bulk-manage').attr('disabled', 'disabled');
/* Remove the disabled attribute from the form submit button when bulk action has a value */
jq('#notification-select').on('change', function(){
jq('#notification-bulk-manage').attr('disabled', jq(this).val().length <= 0);
});
/* Close site wide notices in the sidebar */
jq("#close-notice").on( 'click', function() {
jq(this).addClass('loading');
jq('#sidebar div.error').remove();
jq.post( ajaxurl, {
action: 'messages_close_notice',
'notice_id': jq('.notice').attr('rel').substr( 2, jq('.notice').attr('rel').length )
},
function(response) {
jq("#close-notice").removeClass('loading');
if ( response[0] + response[1] == '-1' ) {
jq('.notice').prepend( response.substr( 2, response.length ) );
jq( '#sidebar div.error').hide().fadeIn( 200 );
} else {
jq('.notice').slideUp( 100 );
}
});
return false;
});
/* Toolbar & wp_list_pages Javascript IE6 hover class */
jq("#wp-admin-bar ul.main-nav li, #nav li").mouseover( function() {
jq(this).addClass('sfhover');
});
jq("#wp-admin-bar ul.main-nav li, #nav li").mouseout( function() {
jq(this).removeClass('sfhover');
});
/* Clear BP cookies on logout */
jq('a.logout').on( 'click', function() {
jq.cookie('bp-activity-scope', null, {
path: '/'
});
jq.cookie('bp-activity-filter', null, {
path: '/'
});
jq.cookie('bp-activity-oldestpage', null, {
path: '/'
});
var objects = [ 'members', 'groups', 'blogs', 'forums' ];
jq(objects).each( function(i) {
jq.cookie('bp-' + objects[i] + '-scope', null, {
path: '/'
} );
jq.cookie('bp-' + objects[i] + '-filter', null, {
path: '/'
} );
jq.cookie('bp-' + objects[i] + '-extras', null, {
path: '/'
} );
});
});
/* if js is enabled then replace the no-js class by a js one */
if( jq('body').hasClass('no-js') )
jq('body').attr('class', jq('body').attr('class').replace( /no-js/,'js' ) );
});
/* Setup activity scope and filter based on the current cookie settings. */
function bp_init_activity() {
/* Reset the page */
jq.cookie( 'bp-activity-oldestpage', 1, {
path: '/'
} );
if ( null != jq.cookie('bp-activity-filter') && jq('#activity-filter-select').length )
jq('#activity-filter-select select option[value="' + jq.cookie('bp-activity-filter') + '"]').prop( 'selected', true );
/* Activity Tab Set */
if ( null != jq.cookie('bp-activity-scope') && jq('.activity-type-tabs').length ) {
jq('.activity-type-tabs li').each( function() {
jq(this).removeClass('selected');
});
jq('#activity-' + jq.cookie('bp-activity-scope') + ', .item-list-tabs li.current').addClass('selected');
}
}
/* Setup object scope and filter based on the current cookie settings for the object. */
function bp_init_objects(objects) {
jq(objects).each( function(i) {
if ( null != jq.cookie('bp-' + objects[i] + '-filter') && jq('#' + objects[i] + '-order-select select').length )
jq('#' + objects[i] + '-order-select select option[value="' + jq.cookie('bp-' + objects[i] + '-filter') + '"]').prop( 'selected', true );
if ( null != jq.cookie('bp-' + objects[i] + '-scope') && jq('div.' + objects[i]).length ) {
jq('.item-list-tabs li').each( function() {
jq(this).removeClass('selected');
});
jq('#' + objects[i] + '-' + jq.cookie('bp-' + objects[i] + '-scope') + ', #object-nav li.current').addClass('selected');
}
});
}
/* Filter the current content list (groups/members/blogs/topics) */
function bp_filter_request( object, filter, scope, target, search_terms, page, extras, caller ) {
if ( 'activity' == object )
return false;
if ( jq.query.get('s') && !search_terms )
search_terms = jq.query.get('s');
if ( null == scope )
scope = 'all';
/* Save the settings we want to remain persistent to a cookie */
jq.cookie( 'bp-' + object + '-scope', scope, {
path: '/'
} );
jq.cookie( 'bp-' + object + '-filter', filter, {
path: '/'
} );
jq.cookie( 'bp-' + object + '-extras', extras, {
path: '/'
} );
/* Set the correct selected nav and filter */
jq('.item-list-tabs li').each( function() {
jq(this).removeClass('selected');
});
jq('#' + object + '-' + scope + ', #object-nav li.current').addClass('selected');
jq('.item-list-tabs li.selected').addClass('loading');
jq('.item-list-tabs select option[value="' + filter + '"]').prop( 'selected', true );
if ( 'friends' == object )
object = 'members';
if ( bp_ajax_request )
bp_ajax_request.abort();
bp_ajax_request = jq.post( ajaxurl, {
action: object + '_filter',
'cookie': bp_get_cookies(),
'object': object,
'filter': filter,
'search_terms': search_terms,
'scope': scope,
'page': page,
'extras': extras
},
function(response)
{
/* animate to top if called from bottom pagination */
if ( caller == 'pag-bottom' && jq('#subnav').length ) {
var top = jq('#subnav').parent();
jq('html,body').animate({scrollTop: top.offset().top}, 'slow', function() {
jq(target).fadeOut( 100, function() {
jq(this).html(response);
jq(this).fadeIn(100);
});
});
} else {
jq(target).fadeOut( 100, function() {
jq(this).html(response);
jq(this).fadeIn(100);
});
}
jq('.item-list-tabs li.selected').removeClass('loading');
});
}
/* Activity Loop Requesting */
function bp_activity_request(scope, filter) {
/* Save the type and filter to a session cookie */
jq.cookie( 'bp-activity-scope', scope, {
path: '/'
} );
jq.cookie( 'bp-activity-filter', filter, {
path: '/'
} );
jq.cookie( 'bp-activity-oldestpage', 1, {
path: '/'
} );
/* Remove selected and loading classes from tabs */
jq('.item-list-tabs li').each( function() {
jq(this).removeClass('selected loading');
});
/* Set the correct selected nav and filter */
jq('#activity-' + scope + ', .item-list-tabs li.current').addClass('selected');
jq('#object-nav.item-list-tabs li.selected, div.activity-type-tabs li.selected').addClass('loading');
jq('#activity-filter-select select option[value="' + filter + '"]').prop( 'selected', true );
/* Reload the activity stream based on the selection */
jq('.widget_bp_activity_widget h2 span.ajax-loader').show();
if ( bp_ajax_request )
bp_ajax_request.abort();
bp_ajax_request = jq.post( ajaxurl, {
action: 'activity_widget_filter',
'cookie': bp_get_cookies(),
'_wpnonce_activity_filter': jq("#_wpnonce_activity_filter").val(),
'scope': scope,
'filter': filter
},
function(response)
{
jq('.widget_bp_activity_widget h2 span.ajax-loader').hide();
jq('div.activity').fadeOut( 100, function() {
jq(this).html(response.contents);
jq(this).fadeIn(100);
/* Selectively hide comments */
bp_legacy_theme_hide_comments();
});
/* Update the feed link */
if ( null != response.feed_url )
jq('.directory #subnav li.feed a, .home-page #subnav li.feed a').attr('href', response.feed_url);
jq('.item-list-tabs li.selected').removeClass('loading');
}, 'json' );
}
/* Hide long lists of activity comments, only show the latest five root comments. */
function bp_legacy_theme_hide_comments() {
var comments_divs = jq('div.activity-comments');
if ( !comments_divs.length )
return false;
comments_divs.each( function() {
if ( jq(this).children('ul').children('li').length < 5 ) return;
var comments_div = jq(this);
var parent_li = comments_div.parents('#activity-stream > li');
var comment_lis = jq(this).children('ul').children('li');
var comment_count = ' ';
if ( jq('#' + parent_li.attr('id') + ' a.acomment-reply span').length )
var comment_count = jq('#' + parent_li.attr('id') + ' a.acomment-reply span').html();
comment_lis.each( function(i) {
/* Show the latest 5 root comments */
if ( i < comment_lis.length - 5 ) {
jq(this).addClass('hidden');
jq(this).toggle();
if ( !i )
jq(this).before( '' + BP_DTheme.show_x_comments.replace( '%d', comment_count ) + ' ' );
}
});
});
}
/* Helper Functions */
function checkAll() {
var checkboxes = document.getElementsByTagName("input");
for(var i=0; i';
jQuery('.footerwidget ul#members-list,.widget ul#members-list').html(message);
jQuery('.footerwidget ul#members-list,.widget ul#members-list').fadeIn(200);
}
);
}
}
jQuery(document).ready( function() {
jQuery('.footerwidget div#groups-list-options a,.widget div#groups-list-options a').on('click',
function() {
var link = this;
jQuery(link).addClass('loading');
jQuery('.footerwidget div#groups-list-options a,.widget div#groups-list-options a').removeClass('selected');
jQuery(this).addClass('selected');
jQuery.post( ajaxurl, {
action: 'widget_groups_list',
'cookie': encodeURIComponent(document.cookie),
'_wpnonce': jQuery('input#_wpnonce-groups').val(),
'max_groups': jQuery('input#groups_widget_max').val(),
'filter': jQuery(this).attr('id')
},
function(response)
{
jQuery(link).removeClass('loading');
footergroups_wiget_response(response);
});
return false;
}
);
});
function footergroups_wiget_response(response) {
response = response.substr(0, response.length-1);
response = response.split('[[SPLIT]]');
if ( response[0] !== '-1' ) {
jQuery('.footerwidget ul#groups-list,.widget ul#groups-list').fadeOut(200,
function() {
jQuery('.footerwidget ul#groups-list,.widget ul#groups-list').html(response[1]);
jQuery('.footerwidget ul#groups-list,.widget ul#groups-list').fadeIn(200);
}
);
} else {
jQuery('.footerwidget ul#groups-list,.widget ul#groups-list').fadeOut(200,
function() {
var message = '' + response[1] + '
';
jQuery('.footerwidget ul#groups-list,.widget ul#groups-list').html(message);
jQuery('.footerwidget ul#groups-list,.widget ul#groups-list').fadeIn(200);
}
);
}
};
// source --> https://better-than-ever.com/wp-content/themes/wplms/js/custom.js?ver=4.9.29
(function($) {
$.expr[":"].onScreen = function(elem) {
var $window = $(window);
var viewport_top = $window.scrollTop();
var viewport_height = $window.height();
var viewport_bottom = viewport_top + viewport_height;
var $elem = $(elem);
var top = $elem.offset().top;
var height = $elem.height();
var bottom = top + height;
return (top >= viewport_top && top < viewport_bottom) ||
(bottom > viewport_top && bottom <= viewport_bottom) ||
(height > viewport_height && top <= viewport_top && bottom >= viewport_bottom);
};
})(jQuery);
(function($) {
jQuery(document).ready(function($) {
NProgress.inc();
SidebarMenuEffects();
$('.pagesidebar li.menu-item-has-children').click(function(){
var $ul = $(this).find('ul:first');
$ul.toggle(200);
$ul.addClass('active');
});
$('nav .menu-item').has('.sub-menu').each(function() {
if($(this).find('.megadrop').length > 0 ){
}else{
$(this).addClass('hasmenu');
}
});
$('.vbplogin').click(function(event) {
event.preventDefault();
$('#vibe_bp_login').fadeIn(300);
$('#vibe_bp_login').toggleClass('active');
event.stopPropagation();
});
$('#searchicon').click(function(event) {
$('#searchdiv').toggleClass('active');
});
$(document).mouseup(function (e) {
var container = $("#searchdiv");
if (!container.is(e.target) && container.has(e.target).length === 0) // ... nor a descendant of the container
{
container.hide();
container.removeClass('active');
}
container = $("#vibe_bp_login");
if (!container.is(e.target) && container.has(e.target).length === 0) // ... nor a descendant of the container
{
container.hide();
}
});
$('#headernotification').each(function() {
var cookieValue = $.cookie("closed");
if ((cookieValue !== null) && cookieValue == 'headernotification') {
$(this).hide();
}
});
$('#widget-tabs a').click(function (e) {
e.preventDefault();
$(this).tab('show');
});
$('#footernotification').each(function() {
var cookieValue = $.cookie("closed");
if ((cookieValue !== null) && cookieValue == 'footernotification') {
$(this).hide();
}
});
$('.close').click(function(){
var parent=$(this).parent().parent();
var id=parent.attr('id');
parent.hide(200);
$.cookie('closed', id, { expires: 2 ,path: '/'});
});
jQuery('#scrolltop a').click(function(event) {
event.preventDefault();
$('body,html').animate({
scrollTop: 0
}, 1200);
return false;
});
$('body').delegate('.woocommerce-error','click',function(event){
event.preventDefault();
$(this).fadeOut(200);
})
$('.tip').tooltip();
$('.nav-tabs li:first a').tab('show');
$('.course_description').on('click','#more_desc',function(event) {
event.preventDefault();
$(this).fadeOut('fast');
$('.full_desc').fadeIn('fast');
});
$('.course_description').on('click','#less_desc',function(event) {
event.preventDefault();
$('.full_desc').fadeOut('fast');
$('#more_desc').fadeIn('fast');
});
$('#signup_password, #account_password').each(function(){
var label;
var $this = $(this);
if($(this).hasClass('form_field')){
label = $('label[for="signup_password"]');
}else{
label = $('label[for="account_password"]');
}
$(this).keyup(function() {
if(label.find('span').length){
label.find('span').html((checkStrength($this.val(),label)));
}else{
label.append(''+(checkStrength($this.val(),label))+' ');
}
});
function checkStrength(password,label) {
var strength = 0
if (password.length < 6) {
label.removeClass();
label.addClass('short');
return BP_DTheme.too_short
}
if (password.length > 7) strength += 1
// If password contains both lower and uppercase characters, increase strength value.
if (password.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/)) strength += 1
// If it has numbers and characters, increase strength value.
if (password.match(/([a-zA-Z])/) && password.match(/([0-9])/)) strength += 1
// If it has one special character, increase strength value.
if (password.match(/([!,%,&,@,#,$,^,*,?,_,~])/)) strength += 1
// If it has two special characters, increase strength value.
if (password.match(/(.*[!,%,&,@,#,$,^,*,?,_,~].*[!,%,&,@,#,$,^,*,?,_,~])/)) strength += 1
// Calculated strength value, we can return messages
// If value is less than 2
if (strength < 2) {
label.removeClass();
label.addClass('weak');
return BP_DTheme.weak
} else if (strength == 2) {
label.removeClass();
label.addClass('good');
return BP_DTheme.good
} else {
label.removeClass()
label.addClass('strong')
return BP_DTheme.strong
}
}
});
}); // END ready
jQuery(document).ready(function($){
if(jQuery().chosen) {
$('.form select').chosen({
allow_single_deselect: true,
disable_search_threshold: 8});
$('.chosen').chosen({
allow_single_deselect: true,
disable_search_threshold: 8});
}
$(window).scroll(function(event){
var st = $(this).scrollTop();
if($('#headertop').hasClass('fix')){
var headerheight=$('header').height();
if(st > headerheight){
$('#headertop').addClass('fixed');
}else{
$('#headertop').removeClass('fixed');
}
}
if(st > 700){
$('#scrolltop').addClass('fix');
}else{
$('#scrolltop').removeClass('fix');
}
});
$('.twitter_carousel').each(function(){
var $this = $(this);
$this.flexslider({
animation: "slide",
controlNav: false,
directionNav: false,
animationLoop: true,
slideshow: true,
prevText: " ",
nextText: " ",
start: function() {
$this.removeClass('loading');
}
});
});
/*$('.certifications').flexslider({
animation: "slide",
controlNav: false,
directionNav: true,
animationLoop: true,
slideshow: false,
itemWidth: 212,
itemMargin:10,
maxItems:4,
minItems:1,
prevText: " ",
nextText: " ",
});*/
});// END ready
//* To be Removed in next update
jQuery(document).ready(function($){
$('.v_parallax_block').each(function(){
var $bgobj = $(this);
var i = parseInt($bgobj.attr('data-scroll'));
var rev = parseInt($bgobj.attr('data-rev'));
var ptop = $bgobj.parent().position().top;
var adjust = parseInt($bgobj.attr('data-adjust'));
var height = $bgobj.height();
var v_parallax_block_height = $bgobj.find('.parallax_content').height();
if(heightli').click(function(){
var $this = $(this);
$('.payment_methods.methods >li').find('div').hide(0,function(){$this.find('div').show(0);});
});
function v_carousel_fx($this){
var direction,control,itemwidth,maxitem,minitem,scroll,vmargin;
direction=control=false;vmargin=margin=30;
scroll='horizontal';
$this.find('li.product').removeClass().addClass('product');
if($this.parent().hasClass('direction'))
direction = true;
else
direction = false;
if($this.parent().hasClass('control'))
control = true;
else
control = false;
if($this.parent().hasClass('columns1')){
itemwidth=true;
maxitem=1;
minitem=1;
margin=0;
}
if($this.parent().hasClass('columns2')){
itemwidth = 420;
maxitem=2;
minitem=2;
}
if($this.parent().hasClass('columns3')){
itemwidth=320;
maxitem=3;
minitem=2;
}
if($this.parent().hasClass('columns4')){
itemwidth=200;
maxitem=4;
minitem=2;
}
if($this.parent().hasClass('columns5')){
itemwidth=180;
maxitem=5;
minitem=2;
}
if($this.parent().hasClass('columns6')){
itemwidth=140;
maxitem=6;
minitem=2;
}
$this.flexslider({
animation: "slide",
selector: ".products > li",
controlNav: control,
directionNav: direction,
animationLoop: false,
slideshow: false,
itemWidth: itemwidth,
itemMargin:margin,
maxItems:maxitem,
minItems:minitem,
prevText: " ",
nextText: " ",
});
}
$('.vibe_carousel.flexslider .woocommerce').each(function(){
var $this= $(this);
if($this.is(":visible")){
v_carousel_fx($this);
}
});
$('#prev_results a').on('click',function(event){
event.preventDefault();
$(this).toggleClass('show');
$('.prev_quiz_results').toggleClass('show');
});
});
jQuery(document).ready(function($){
$('#filtercontainer').each(function(){
var $container = $('#filtercontainer'),
filters = {};
$container.isotope({
itemSelector : '.filteritem',
});
// filter buttons
$('.filters a').click(function(){
var $this = $(this);
// don't proceed if already selected
if ( $this.hasClass('active') ) {
return;
}
var $optionSet = $this.parents('.option-set');
// change selected class
$optionSet.find('.active').removeClass('active');
$this.addClass('active');
// store filter value in object
// i.e. filters.color = 'red'
var group = $optionSet.attr('data-filter-group');
filters[ group ] = $this.attr('data-filter-value');
// convert object into array
var isoFilters = [];
for ( var prop in filters ) {
isoFilters.push( filters[ prop ] );
}
var selector = isoFilters.join('');
$container.isotope({ filter: selector });
return false;
});
});
});// END ready
jQuery(document).ready(function($){
//inscroll menu
$('.inmenu').each(function(){
var inmenu_top = $('.inmenu').offset().top - 40;
var footer_top = $('footer').offset().top - Math.round($(window).height()/2) - 90;
$(window).scroll(function(){
var top=$(window).scrollTop();
if(top > inmenu_top && top < footer_top){
$('.inmenu').addClass('affix');
}else{
$('.inmenu').removeClass('affix');
}
});
});
});// END ready
jQuery(document).ready(function($) {
// Cache selectors
var lastId;
var topMenu = $(".scrollmenu");
var topMenuHeight = 0;//topMenu.outerHeight()+15
// All list items
var menuItems = topMenu.find("a"),
// Anchors corresponding to menu items
scrollItems = menuItems.map(function(){
var item = $($(this).attr("href"));
if (item.length) { return item; }
});
// Bind click handler to menu items
// so we can get a fancy scroll animation
menuItems.click(function(e){
e.preventDefault();
var href = $(this).attr("href"),
offsetTop = href === "#" ? 0 : $(href).offset().top-topMenuHeight+1;
$('html, body').stop().animate({
scrollTop: offsetTop
}, 800);
//return false;
});
$(window).scroll( function ()
{
var fromTop = $(this).scrollTop()+25;
var cur = scrollItems.map(function(){
if ($(this).offset().top < fromTop)
return this;
});
cur = cur[cur.length-1];
var id = cur && cur.length ? cur[0].id : "";
if (lastId !== id) {
lastId = id;
menuItems
.parent().removeClass("active");
menuItems.filter("[href*=\\#"+id+"]").parent().addClass("active");
}
// Animation function
$('.animate').filter(":onScreen").not('.load').each(function(i){
var $this=$(this);
var ind = i * 100;
var docViewTop = $(window).scrollTop();
var docViewBottom = docViewTop + $(window).height();
var elemTop = $this.offset().top;
if (docViewBottom >= elemTop) {
setTimeout(function(){
$this.addClass('load');
}, ind);
}
});
//End function
});
});// END ready
//CHECKOUT FORM
jQuery(document).ready(function ($) {
$('.minmax').click(function(event){
event.preventDefault();
$(this).parent().toggleClass('show');
$(this).find('i').toggleClass('icon-minus');
});
});// END ready
// ADD Question Form
jQuery(document).ready(function($){
$( ".repeatablelist" ).each(function(){
$(this).sortable({ handle: '.sort_handle' });
});
$('.add_repeatable').click(function(){
var repeatablelist=$(this).parent().find('.repeatablelist');
var lastitem=$(this).parent().find('.repeatablelist li:last-child');
var cloneditem=lastitem.clone();
var name= cloneditem.find('.option_text').attr('rel-name');
cloneditem.find('.option_text').attr('name',name);
repeatablelist.append(cloneditem);
});
$('.print_results').click(function(event){
event.preventDefault();
$('.quiz_result').print();
});
});// END ready
jQuery(window).load(function($){
NProgress.done();
});
})(jQuery);
/*!
* Bootstrap v3.1.0 (http://getbootstrap.com)
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
if("undefined"==typeof jQuery)throw new Error("Bootstrap requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one(a.support.transition.end,function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b()})}(jQuery),+function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype.close=function(b){function c(){f.trigger("closed.bs.alert").remove()}var d=a(this),e=d.attr("data-target");e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,""));var f=a(e);b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one(a.support.transition.end,c).emulateTransitionEnd(150):c())};var d=a.fn.alert;a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("bs.alert");e||d.data("bs.alert",e=new c(this)),"string"==typeof b&&e[b].call(d)})},a.fn.alert.Constructor=c,a.fn.alert.noConflict=function(){return a.fn.alert=d,this},a(document).on("click.bs.alert.data-api",b,c.prototype.close)}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.isLoading=!1};b.DEFAULTS={loadingText:"loading..."},b.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",f.resetText||d.data("resetText",d[e]()),d[e](f[b]||this.options[b]),setTimeout(a.proxy(function(){"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},b.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")&&(c.prop("checked")&&this.$element.hasClass("active")?a=!1:b.find(".active").removeClass("active")),a&&c.prop("checked",!this.$element.hasClass("active")).trigger("change")}a&&this.$element.toggleClass("active")};var c=a.fn.button;a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof c&&c;e||d.data("bs.button",e=new b(this,f)),"toggle"==c?e.toggle():c&&e.setState(c)})},a.fn.button.Constructor=b,a.fn.button.noConflict=function(){return a.fn.button=c,this},a(document).on("click.bs.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle"),b.preventDefault()})}(jQuery),+function(a){"use strict";var b=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};b.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},b.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},b.prototype.getActiveIndex=function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},b.prototype.to=function(b){var c=this,d=this.getActiveIndex();return b>this.$items.length-1||0>b?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},b.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition.end&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},b.prototype.next=function(){return this.sliding?void 0:this.slide("next")},b.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},b.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g="next"==b?"left":"right",h="next"==b?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}if(e.hasClass("active"))return this.sliding=!1;var j=a.Event("slide.bs.carousel",{relatedTarget:e[0],direction:g});return this.$element.trigger(j),j.isDefaultPrevented()?void 0:(this.sliding=!0,f&&this.pause(),this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid.bs.carousel",function(){var b=a(i.$indicators.children()[i.getActiveIndex()]);b&&b.addClass("active")})),a.support.transition&&this.$element.hasClass("slide")?(e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid.bs.carousel")},0)}).emulateTransitionEnd(1e3*d.css("transition-duration").slice(0,-1))):(d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid.bs.carousel")),f&&this.cycle(),this)};var c=a.fn.carousel;a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c),g="string"==typeof c?c:f.slide;e||d.data("bs.carousel",e=new b(this,f)),"number"==typeof c?e.to(c):g?e[g]():f.interval&&e.pause().cycle()})},a.fn.carousel.Constructor=b,a.fn.carousel.noConflict=function(){return a.fn.carousel=c,this},a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(b){var c,d=a(this),e=a(d.attr("data-target")||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"")),f=a.extend({},e.data(),d.data()),g=d.attr("data-slide-to");g&&(f.interval=!1),e.carousel(f),(g=d.attr("data-slide-to"))&&e.data("bs.carousel").to(g),b.preventDefault()}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var b=a(this);b.carousel(b.data())})})}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.DEFAULTS={toggle:!0},b.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},b.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b=a.Event("show.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.$parent&&this.$parent.find("> .panel > .in");if(c&&c.length){var d=c.data("bs.collapse");if(d&&d.transitioning)return;c.collapse("hide"),d||c.data("bs.collapse",null)}var e=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[e](0),this.transitioning=1;var f=function(){this.$element.removeClass("collapsing").addClass("collapse in")[e]("auto"),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return f.call(this);var g=a.camelCase(["scroll",e].join("-"));this.$element.one(a.support.transition.end,a.proxy(f,this)).emulateTransitionEnd(350)[e](this.$element[0][g])}}},b.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return a.support.transition?(this.$element[c](0).one(a.support.transition.end,a.proxy(d,this)).emulateTransitionEnd(350),void 0):d.call(this)}}},b.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var c=a.fn.collapse;a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c);e||d.data("bs.collapse",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.collapse.Constructor=b,a.fn.collapse.noConflict=function(){return a.fn.collapse=c,this},a(document).on("click.bs.collapse.data-api","[data-toggle=collapse]",function(b){var c,d=a(this),e=d.attr("data-target")||b.preventDefault()||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,""),f=a(e),g=f.data("bs.collapse"),h=g?"toggle":d.data(),i=d.attr("data-parent"),j=i&&a(i);g&&g.transitioning||(j&&j.find('[data-toggle=collapse][data-parent="'+i+'"]').not(d).addClass("collapsed"),d[f.hasClass("in")?"addClass":"removeClass"]("collapsed")),f.collapse(h)})}(jQuery),+function(a){"use strict";function b(b){a(d).remove(),a(e).each(function(){var d=c(a(this)),e={relatedTarget:this};d.hasClass("open")&&(d.trigger(b=a.Event("hide.bs.dropdown",e)),b.isDefaultPrevented()||d.removeClass("open").trigger("hidden.bs.dropdown",e))})}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}var d=".dropdown-backdrop",e="[data-toggle=dropdown]",f=function(b){a(b).on("click.bs.dropdown",this.toggle)};f.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a('
').insertAfter(a(this)).on("click",b);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;f.toggleClass("open").trigger("shown.bs.dropdown",h),e.focus()}return!1}},f.prototype.keydown=function(b){if(/(38|40|27)/.test(b.keyCode)){var d=a(this);if(b.preventDefault(),b.stopPropagation(),!d.is(".disabled, :disabled")){var f=c(d),g=f.hasClass("open");if(!g||g&&27==b.keyCode)return 27==b.which&&f.find(e).focus(),d.click();var h=" li:not(.divider):visible a",i=f.find("[role=menu]"+h+", [role=listbox]"+h);if(i.length){var j=i.index(i.filter(":focus"));38==b.keyCode&&j>0&&j--,40==b.keyCode&&j ').appendTo(document.body),this.$element.on("click.dismiss.modal",a.proxy(function(a){a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),d&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;d?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()):b&&b()};var c=a.fn.modal;a.fn.modal=function(c,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},b.DEFAULTS,e.data(),"object"==typeof c&&c);f||e.data("bs.modal",f=new b(this,g)),"string"==typeof c?f[c](d):g.show&&f.show(d)})},a.fn.modal.Constructor=b,a.fn.modal.noConflict=function(){return a.fn.modal=c,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d=c.attr("href"),e=a(c.attr("data-target")||d&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(d)&&d},e.data(),c.data());c.is("a")&&b.preventDefault(),e.modal(f,this).one("hide",function(){c.is(":visible")&&c.focus()})}),a(document).on("show.bs.modal",".modal",function(){a(document.body).addClass("modal-open")}).on("hidden.bs.modal",".modal",function(){a(document.body).removeClass("modal-open")})}(jQuery),+function(a){"use strict";var b=function(a,b){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",a,b)};b.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},b.prototype.init=function(b,c,d){this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d);for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},b.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},b.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);return clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show),void 0):c.show()},b.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);return clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide),void 0):c.hide()},b.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){if(this.$element.trigger(b),b.isDefaultPrevented())return;var c=this,d=this.tip();this.setContent(),this.options.animation&&d.addClass("fade");var e="function"==typeof this.options.placement?this.options.placement.call(this,d[0],this.$element[0]):this.options.placement,f=/\s?auto?\s?/i,g=f.test(e);g&&(e=e.replace(f,"")||"top"),d.detach().css({top:0,left:0,display:"block"}).addClass(e),this.options.container?d.appendTo(this.options.container):d.insertAfter(this.$element);var h=this.getPosition(),i=d[0].offsetWidth,j=d[0].offsetHeight;if(g){var k=this.$element.parent(),l=e,m=document.documentElement.scrollTop||document.body.scrollTop,n="body"==this.options.container?window.innerWidth:k.outerWidth(),o="body"==this.options.container?window.innerHeight:k.outerHeight(),p="body"==this.options.container?0:k.offset().left;e="bottom"==e&&h.top+h.height+j-m>o?"top":"top"==e&&h.top-m-j<0?"bottom":"right"==e&&h.right+i>n?"left":"left"==e&&h.left-i
'}),b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),b.prototype.constructor=b,b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content")[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},b.prototype.hasContent=function(){return this.getTitle()||this.getContent()},b.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},b.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var c=a.fn.popover;a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof c&&c;(e||"destroy"!=c)&&(e||d.data("bs.popover",e=new b(this,f)),"string"==typeof c&&e[c]())})},a.fn.popover.Constructor=b,a.fn.popover.noConflict=function(){return a.fn.popover=c,this}}(jQuery),+function(a){"use strict";function b(c,d){var e,f=a.proxy(this.process,this);this.$element=a(c).is("body")?a(window):a(c),this.$body=a("body"),this.$scrollElement=this.$element.on("scroll.bs.scroll-spy.data-api",f),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||(e=a(c).attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.offsets=a([]),this.targets=a([]),this.activeTarget=null,this.refresh(),this.process()}b.DEFAULTS={offset:10},b.prototype.refresh=function(){var b=this.$element[0]==window?"offset":"position";this.offsets=a([]),this.targets=a([]);{var c=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[b]().top+(!a.isWindow(c.$scrollElement.get(0))&&c.$scrollElement.scrollTop()),e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){c.offsets.push(this[0]),c.targets.push(this[1])})}},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,d=c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(b>=d)return g!=(a=f.last()[0])&&this.activate(a);if(g&&b<=e[0])return g!=(a=f[0])&&this.activate(a);for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parentsUntil(this.options.target,".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")};var c=a.fn.scrollspy;a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=c,this},a(window).on("load",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(jQuery),+function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});if(b.trigger(f),!f.isDefaultPrevented()){var g=a(d);this.activate(b.parent("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})}}},b.prototype.activate=function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one(a.support.transition.end,e).emulateTransitionEnd(150):e(),f.removeClass("in")};var c=a.fn.tab;a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new b(this)),"string"==typeof c&&e[c]()})},a.fn.tab.Constructor=b,a.fn.tab.noConflict=function(){return a.fn.tab=c,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})}(jQuery),+function(a){"use strict";var b=function(c,d){this.options=a.extend({},b.DEFAULTS,d),this.$window=a(window).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(c),this.affixed=this.unpin=this.pinnedOffset=null,this.checkPosition()};b.RESET="affix affix-top affix-bottom",b.DEFAULTS={offset:0},b.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(b.RESET).addClass("affix");var a=this.$window.scrollTop(),c=this.$element.offset();return this.pinnedOffset=c.top-a},b.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},b.prototype.checkPosition=function(){if(this.$element.is(":visible")){var c=a(document).height(),d=this.$window.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;"top"==this.affixed&&(e.top+=d),"object"!=typeof f&&(h=g=f),"function"==typeof g&&(g=f.top(this.$element)),"function"==typeof h&&(h=f.bottom(this.$element));var i=null!=this.unpin&&d+this.unpin<=e.top?!1:null!=h&&e.top+this.$element.height()>=c-h?"bottom":null!=g&&g>=d?"top":!1;if(this.affixed!==i){this.unpin&&this.$element.css("top","");var j="affix"+(i?"-"+i:""),k=a.Event(j+".bs.affix");this.$element.trigger(k),k.isDefaultPrevented()||(this.affixed=i,this.unpin="bottom"==i?this.getPinnedOffset():null,this.$element.removeClass(b.RESET).addClass(j).trigger(a.Event(j.replace("affix","affixed"))),"bottom"==i&&this.$element.offset({top:c-h-this.$element.height()}))}}};var c=a.fn.affix;a.fn.affix=function(c){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof c&&c;e||d.data("bs.affix",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.affix.Constructor=b,a.fn.affix.noConflict=function(){return a.fn.affix=c,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var b=a(this),c=b.data();c.offset=c.offset||{},c.offsetBottom&&(c.offset.bottom=c.offsetBottom),c.offsetTop&&(c.offset.top=c.offsetTop),b.affix(c)})})}(jQuery);
// source --> https://better-than-ever.com/wp-content/plugins/mailchimp-for-wp/assets/js/forms-api.min.js?ver=4.5.3
!function(){var s=void 0;!function o(u,s,a){function c(e,t){if(!s[e]){if(!u[e]){var n=!1;if(!t&&n)return n(e,!0);if(f)return f(e,!0);var r=new Error("Cannot find module '"+e+"'");throw r.code="MODULE_NOT_FOUND",r}var i=s[e]={exports:{}};u[e][0].call(i.exports,function(t){return c(u[e][1][t]||t)},i,i.exports,o,u,s,a)}return s[e].exports}for(var f=!1,t=0;t