var mod_path = "//www.nutramax.biz/mods/helper.main_menu/"; var mod_id = "nmxmod_helper_main_menu6111"; console.log(mod_path); console.log("#"+mod_id); jQuery("document").ready(function(){ Center_DropDown_Menu(); RecolorSvg(); }); function Center_DropDown_Menu(){ jQuery("#"+mod_id+" .dropdown").each(function(){ jQuery(this).find(".dropdown-list").css("margin-left","-"+(jQuery(this).find(".dropdown-list").width()-jQuery(this).width())/2+"px") }); } function RecolorSvg(){ jQuery("img[color][src*='.svg']").each(function(){ var $img = jQuery(this); var imgID = $img.attr('id'); var imgClass = $img.attr('class'); var imgURL = $img.attr('src'); var color = $img.attr('color'); jQuery.get(imgURL, function(data) { var $svg = jQuery(data).find('svg'); if(typeof imgID !== 'undefined') { $svg = $svg.attr('id', imgID); console.log("imgID:"+imgID); } if(typeof imgClass !== 'undefined') { $svg = $svg.attr('class', imgClass+' replaced-svg'); console.log("imgID:"+imgClass); } $svg = $svg.removeAttr('xmlns:a'); $svg.css("margin-top",($svg.css("margin-top")+5)+"px").find("path").attr("fill",color); $img.replaceWith($svg); }, 'xml'); }); } jQuery("#nmxmod_helper_main_menu6111").attr("path","//www.nutramax.biz/mods/helper.main_menu/").each(function(){ jQuery(this).each(function() { jQuery.each(this.attributes, function() { if(this.specified) { console.log(this.name, this.value); } }); });});