(function($){ $.fn.getJsonFromClass = function(){ elem = this; var cname = elem.attr('class'); if (matches = cname.match(/(\{.*\})/) ){ var jsonstr = decodeURIComponent(matches[1]); var string = jsonstr; if (true && !(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(string.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, ''))) { alert('Bad Parameters.'); } try{ var dataobj = eval( '(' + decodeURIComponent(matches[1]) + ')'); }catch(err){ alert('Bad Parameters.'); } return dataobj; } else { return {}; } } })(jQuery); (function($){ $.fn.addBadge = function(num){ elem = this; if(num==0){ $(elem).find('.badge').remove(); } else { var badge = $(elem).find('.badge'); if (badge.length > 0) { badge.html(''+num); } else { badge = $('
'+num+'
').appendTo(elem.find('.topmenuicon')); } $(elem).find('.topmenuicon').effect("bounce", { times:3,distance:15 }, 300); } } })(jQuery);