User:Fumple/common.js

$(".i-menu-filter").click(function{	if($(this).next.css("display") == "none"){		$(this).next.css("display", "block")		$(this).css("background", "#aaaaaa")	}	else{		$(this).next.css("display", "none")		$(this).css("background", "")	} }) $(".i-checkbox").click(function{	if($(this).children.css("opacity") == "0"){		$(this).children.css("opacity", "1")		if($(this).hasClass("i-category")){			icheckboxes;		}	}	else{		$(this).children.css("opacity", "0")		if($(this).hasClass("i-category")){			icheckboxes;		}	} }) function icheckboxes{ var allclass = []; var classStatus = {}; $(".i-checkbox.i-category").each(function{       var classes = $(this)[0].classList;        for(var i = 0, len = classes.length;i<len;i++){            var curr = classes[i];            if(curr.startsWith("i-category-")){                if(allclass.indexOf(curr) == -1){                    allclass[allclass.length] = curr;                    classStatus[curr] = $(this).children.css("opacity");                }            }        }    }) console.log(classStatus); var select = "." + allclass.join(", ."); $(select).each(function{       if($(this).hasClass("i-checkbox")){            return;        }        var classes = $(this)[0].classList;        var status = 1;        for(var i = 0, len = classes.length;i<len;i++){            var curr = classes[i];            if(curr.startsWith("i-category-")){                if(classStatus[curr] == 0){                    status = 0;                }            }        }        if(status == 1){            status = ""        }        else{            status = "none"        }        $(this).css("display", status)    }) }