(function($){ $.fn.colorTip = function(settings){ var defaultSettings = { color : 'yellow', timeout : 500 } var supportedColors = ['red','green','blue','white','yellow','black']; /* Combining the default settings object with the supplied one */ settings = $.extend(defaultSettings,settings); /* * Looping through all the elements and returning them afterwards. * This will add chainability to the plugin. */ return this.each(function(){ var elem = $(this); // If the title attribute is empty, continue with the next element if(!elem.attr('title')) return true; // Creating new eventScheduler and Tip objects for this element. // (See the class definition at the bottom). var scheduleEvent = new eventScheduler(); var tip = new Tip(elem.attr('title')); // Adding the tooltip markup to the element and // applying a special class: elem.append(tip.generate()).addClass('colorTipContainer'); // Checking to see whether a supported color has been // set as a classname on the element. var hasClass = false; for(var i=0;i