<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">var viewers = [];
var temp_temp_path = "";
var temp_video_url = "";
var temp_video_file = "";
function updateVideoStatus(progress, video_file) {
	var data = {
		action: 'mfn_update_video_status',
		students : viewers,
		video_file : video_file,
		progress : progress
	};
	$.post(ajaxurl, data, function(response) {
		console.log(response);
		var json = JSON.parse(response);
		
	});
}
function playVideo(video_file, video_url, temp_path, students) {
	var flashvars = {};
	flashvars.video_file = video_file;
	flashvars.video_url = video_url;
	viewers = students;
	var params = {};
	params.allowfullscreen = "true";
	params.allowscriptaccess = "true";
	var attributes = {};
	swfobject.embedSWF(temp_path+"/assets/mfn_player.swf", "mfn_player", "100%", "100%", "9.0.0", temp_path+"/assets/swfobjectexpressInstall.swf", flashvars, params, attributes);
	showPopup(".mfn_player");
}
function prestartVideo(video_file, video_url, temp_path) {
	temp_temp_path = temp_path;
	temp_video_url = video_url;
	temp_video_file = video_file;
	showPopup(".mfn_student_chooser");
}
function startVideoWithSelectedUsers() {
	var selected = getJournalChecked(".mfn_student_chooser");
	playVideo(temp_video_file, temp_video_url, temp_temp_path, selected);
}
function showPopup(popup) {
	$(".mfn_popup .popup_content").addClass("hidden");
	$(popup).removeClass("hidden");
	$(".mfn_popup").removeClass("hidden");
}
function hidePopup() {
	$(".mfn_popup").addClass("hidden");
}
function saveStudents(students, jid) {
	var data = {
		action: 'mfn_send_students',
		students : students,
		journal : jid
	};
	$.post(ajaxurl, data, function(response) {
		var json = JSON.parse(response);
		$(".preimport_info").hide();
		if(json.error) {
			$(".possible_errors").append('&lt;div class="mfn_block mfn_warning mfn_block_small"&gt;&lt;b class="fa fa-warning"&gt;&lt;/b&gt;'+json.error+'&lt;/div&gt;');
		} else {
			if(json.warnings.length &gt; 0) {
				for(var w in json.warnings) {
					$(".possible_errors").append('&lt;div class="mfn_block mfn_warning mfn_block_small"&gt;&lt;b class="fa fa-warning"&gt;&lt;/b&gt;'+json.warnings[w]+'&lt;/div&gt;');
				}
			}
			if(json.info.length &gt; 0) {
				for(var i in json.info) {
					$(".possible_errors").append('&lt;div class="mfn_block mfn_info mfn_block_small"&gt;'+json.info[i]+'&lt;/div&gt;');
				}
			}
			$(".possible_errors").append('&lt;div class="mfn_block mfn_normal mfn_block_small"&gt;Pievienoti vai pؤپrvietoti kopؤپ &lt;b&gt;'+json.students.length+'&lt;/b&gt; lietotؤپji&lt;/div&gt;');
			
		}
	});
}
function addExistingStudent(journal) {
	last_journal = journal;
	last_scope = ".mfn_student_chooser";
	showPopup(".mfn_student_chooser");
}
var last_scope;
var last_journal;
function setAllCheckboxes(scope, selector) {
	$(scope+" .selector").attr("checked", $(selector).is(":checked"));
}
function getJournalChecked(scope) {
	var checked_ids = [];
	$(scope+" .selector").each(function() {
		if($(this).is(":checked")) {
			checked_ids.push($(this).val());
		}
	});
	return checked_ids;
}
function sendToSchool(scope, journal) {
	var selected = getJournalChecked(scope);
	if(selected.length &gt; 0) {
		last_scope = scope;
		last_journal = journal;
		showPopup(".mfn_send_students");
	} else {
		showPopup(".mfn_no_user_selected");
	}
}
function moveToJournal(scope, journal) {
	var selected = getJournalChecked(scope);
	if(selected.length &gt; 0) {
		last_scope = scope;
		last_journal = journal;
		$(".mfn_jounal_chooser tr").show();
		$(".mfn_jounal_chooser tr#journal_" + journal).hide();
		showPopup(".mfn_jounal_chooser");
	} else {
		showPopup(".mfn_no_user_selected");
	}
}
function removeFromJournal(scope, journal) {
	var selected = getJournalChecked(scope);
	if(selected.length &gt; 0) {
		last_scope = scope;
		last_journal = journal;
		showPopup(".mfn_remove_students");
	} else {
		showPopup(".mfn_no_user_selected");
	}
}
function addSelectedUsers() {
	var selected = getJournalChecked(last_scope);
	var data = {
		action: 'mfn_add_students_to_journal',
		students : selected,
		journal : last_journal
	};
	$.post(ajaxurl, data, function(response) {
		console.log(response);
		var json = JSON.parse(response);
		if(json.error) {
			showErrorPopup(json.error);
		} else { showPopup(".mfn_user_moved"); }
	});
}
function moveSelectedUsers() {
	var selected = getJournalChecked(last_scope);
	var selected_journals = [];
	$(".mfn_jounal_chooser input").each(function() {
		if($(this).is(":checked")) {
			selected_journals.push($(this).val());
		}
	});
	var data = {
		action: 'mfn_move_students_to_journal',
		students : selected,
		to_journal : selected_journals,
		from_journal : last_journal
	};
	$.post(ajaxurl, data, function(response) {
		console.log(response);
		var json = JSON.parse(response);
		if(json.error) {
			showErrorPopup(json.error);
		} else { showPopup(".mfn_user_moved"); }
	});
}
function removeSelectedUsers() {
	var selected = getJournalChecked(last_scope);
	var data = {
		action: 'mfn_remove_students_from_journal',
		students : selected,
		journal : last_journal
	};
	$.post(ajaxurl, data, function(response) {
		showPopup(".mfn_user_removed");
	});
}
function showErrorPopup(error) {
	$(".mfn_error_popup .possible_errors").html('&lt;div class="mfn_block mfn_warning mfn_block_small"&gt;&lt;b class="fa fa-warning"&gt;&lt;/b&gt;'+error+'&lt;/div&gt;');
	showPopup(".mfn_error_popup");
}
function sendSelectedUsers() {
	var selected = getJournalChecked(last_scope);
	var data = {
		action: 'mfn_notify_students',
		students : selected,
		journal : last_journal
	};
	$.post(ajaxurl, data, function(response) {
		showPopup(".mfn_user_sent");
	});
}
function refreshPage() {
	top.location.reload(true);
}
(function($){
	$.fn.mfn_block = function(options) {
		var self = this;
		
		var defaults = {
			onClose : function() {  }
		};
		
		var settings = $.extend({}, defaults, options);
		
		this.methods = {
			onClose : function(li) {
				$(self).hide();
				settings.onClose();
			}
		};
		
		this.each(function() {
			$(this).children("a.fa").click(function() {
				$(this).parent().hide();
			});
		});
		//returns the jQuery object to allow for chainability.
		return this;
	}
	
	$.fn.mfn_toggle = function(options) {
		var self = this;
		
		var defaults = {
			
		};
		
		var settings = $.extend({}, defaults, options);
		
		this.each(function() {
			$(this).children("a").click(function() {
				var parent = $(this).parent();
				if(!parent.hasClass("mfn_toggle_closed")) {
					$(this).children("i").addClass("fa-plus").removeClass("fa-minus");
					parent.addClass("mfn_toggle_closed");
				} else {
					$(this).children("i").removeClass("fa-plus").addClass("fa-minus");
					parent.removeClass("mfn_toggle_closed");
				}
			});
		});
		return this;
	}
	
	$.fn.mfn_select = function(options) {
		var self = this;
		
		var defaults = {
			
		};
		
		var settings = $.extend({}, defaults, options);
		
		this.each(function() {
			$(this).click(function() {
				if($(this).hasClass("mfn_select_closed")) {
					$(this).removeClass("mfn_select_closed");
				} else {
					$(this).addClass("mfn_select_closed");
				}
			});
			$(this).mouseleave(function() {
				if(!$(this).hasClass("mfn_select_closed")) {
					$(this).addClass("mfn_select_closed");
				}
			});
		});
		return this;
	}
	
	$.fn.mfn_tabs = function(options) {
		var self = this;
		
		var defaults = {
			
		};
		
		var settings = $.extend({}, defaults, options);
		
		this.each(function() {
			var current = $(this);
			$(this).children(".mfn_tab").click(function() {
				current.children(".mfn_tab.mfn_tab_active").removeClass("mfn_tab_active");
				$(this).addClass("mfn_tab_active");
				var target = $(this).attr("data-target");
				current.children(".mfn_tab_content").hide();
				$("#"+target).show();
			});
		});
		return this;
	}
})(jQuery);
$(document).ready(function() {
	$(".mfn_block").mfn_block();
	$(".mfn_toggle").mfn_toggle();
	$(".mfn_select").mfn_select();
	$(".mfn_tabs").mfn_tabs();
	$(".mfn_page table tr.clickable").click(function() {
		if($(this).next().hasClass("hidden")) {
			$(this).next().removeClass("hidden");
		} else {
			$(this).next().addClass("hidden");
		}
	});
	$(".mfn_page table tr.clickable input").click(function(event) {
		event.stopPropagation();
	});
	$(".mfn_page table tr.clickable .statuss_icon").click(function(event) {
		event.stopPropagation();
	});
	$(".mfn_page table tr.openable input").click(function(event) {
		event.stopPropagation();
	});
	$(".mfn_page table tr.openable .statuss_icon").click(function(event) {
		event.stopPropagation();
	});
});</pre></body></html>