
// Moodle Groups
// version 0.9 BETA!
// 2008-13-10
// Copyright (c) 2008, Eamon Costello
// Released under the GPL license
// http://www.gnu.org/copyleft/gpl.html
//
// --------------------------------------------------------------------
//
// This is a Greasemonkey user script.  To install it, you need
// Greasemonkey 0.3 or later: http://greasemonkey.mozdev.org/
// Then restart Firefox and revisit this script.
// Under Tools, there will be a new menu item to "Install User Script".
// Accept the default configuration and install.
//
// To uninstall, go to Tools/Manage User Scripts,
// select "Moodle Groups", and click Uninstall.
//
// --------------------------------------------------------------------
//
// ==UserScript==
// @name          Moodle Groups 
// @namespace     http://www.dcu.ie/~costelle
// @description   hides people already assigned to a group from list of potential assignees
// @include       *
// ==/UserScript==

hideGroups()

function hideGroups(){


if(document.location.href.indexOf("group/members.php?group=") == -1) return false;
	var ops = document.getElementById("addselect").getElementsByTagName("option");
	//alert( 	alert(ops[1].innerHTML.split("(")[1].split(")")[0])  )
for  (i = 0; i < ops.length; i ++){
	if(  parseInt (ops[i].innerHTML.split("(")[1].split(")")[0]) > 0 ){
		
				ops[i].style.cssText = 'visibility:hidden;display:none'; 											 
	 }else{
		
	 }
}
	
		
}

