User:Bequw/HideGlossParens.js

function localGetSpansFromClass(str){ var spans = []; if (document.querySelectorAll){ spans = document.querySelectorAll('.' + str); } else { //IE <8 var allSpans = document.getElementsByTagName('span'); for (var i = 0; i < allSpans.length; i++){ if(allSpans[i].getAttribute('class') == str) spans.push(allSpans[i]); }	}	return spans; }

function hidetheglossparens{ mgpSpans = localGetSpansFromClass('mention-gloss-paren'); for(var i = 0; i < mgpSpans.length; i++){ mgpSpans[i].parentNode.removeChild(mgpSpans[i]); }	mtgscSpans = localGetSpansFromClass('mention-tr-gloss-separator-comma'); for(var i = 0; i < mtgscSpans.length; i++){ var parent = mtgscSpans[i].parentNode; var mtpSpan = document.createElement('span'); mtpSpan.setAttribute('class','mention-tr-paren'); mtpSpan.innerHTML = ")";		parent.insertBefore(mtpSpan, mtgscSpans[i]);		parent.removeChild(mtgscSpans[i]);	} } jQuery(hidetheglossparens);