User:Westgrass/common.js

//if("ontouchstart" in window){ $(function{		var procRule = function($rule){			switch($rule.constructor.name){				case "CSSStyleRule":			 		if( $rule.selectorText.indexOf(':hover') == -1){			  			return;			  		}			  		$rule.selectorText = $rule.selectorText.split(',').map(function($item){ if($item.indexOf(':hover')){ return $item + ', ' + $item.replace(':hover', '.hoverhover'); }else{ return $item; }			 		}).join(', ');			  		break;			  	case "CSSMediaRule":			  		for (var i = 0; i < $rule.cssRules.length; i++) {						procRule( $rule.cssRules[i]);					}					break;		  		default:		  			//skip.			  		break;			  }		}		for (var i = 0; i < document.styleSheets.length; i++) {			var styleSheet = document.styleSheets[i];			try{				for (var j = 0; j < styleSheet.cssRules.length; j++) {						procRule( styleSheet.cssRules[j], styleSheet );				}			}			catch(e){//cross domain				//console.log('Access to stylesheet %s is denied. Ignoring...', styleSheet.href);			}		}		var $hoverhoverElement = null; 		$("body, .fandom-community-header__local-navigation .more-menu .wds-dropdown__toggle").on("click", function{ if(!$hoverhoverElement){ return; }			$hoverhoverElement.removeClass('hoverhover'); $hoverhoverElement = null; });		$(".wds-dropdown:not(.more-menu) .wds-dropdown__toggle").click(function(event){ var $box = $(this).closest(".wds-dropdown"); if($hoverhoverElement && ($hoverhoverElement.get(0) != $box.get(0))){ $hoverhoverElement.removeClass('hoverhover'); $hoverhoverElement = null; }			$box.toggleClass('hoverhover'); if($box.hasClass('hoverhover')){ $hoverhoverElement = $box; }			event.stopPropagation; });	}); //}