Modified: jquery/jquery.extlink.js
===================================================================
--- jquery/jquery.extlink.js 2007-04-01 09:09:17 UTC (rev 20)
+++ jquery/jquery.extlink.js 2007-04-01 09:10:01 UTC (rev 21)
@@ -8,17 +8,22 @@
*/
(function($) {
- $(document).ready(function () {
- var site = String(document.location)
- .replace(/^(https?:\/\/[^:\/]+).*$/, "$1");
- $("a").filter(function (i) {
- return ($(this).attr("href").match(RegExp("^("+site+"|(https?:)?/)")) != null);
- }).after("<img class=\"extlink\" src=\"jquery.extlink.d/extlink-grey.gif\"/>");
- $("img.extlink")
- .css("border", "0px")
- .css("padding", "0px 2px 0px 2px")
- .css("position", "relative")
- .css("bottom", "-1px");
+ $.fn.extend({
+ extlink: function (color) {
+ if (typeof color === "undefined")
+ color = "grey";
+ var site = String(document.location)
+ .replace(/^(https?:\/\/[^:\/]+).*$/, "$1");
+ $("a", this).filter(function (i) {
+ return ($(this).attr("href").match(RegExp("^("+site+"|(https?:)?/)")) != null);
+ }).each(function () {
+ $(this)
+ .css("backgroundImage", "url('jquery.extlink.d/extlink-" + color + ".gif')")
+ .css("backgroundRepeat", "no-repeat")
+ .css("backgroundPosition", "right center")
+ .css("padding-right", "11px");
+ });
+ }
});
})(jQuery);