
$(document).ready(function(){

        // // External link, add image + make open in new page
        // $('.ext').filter(function(obj) {
        //     this.target="_blank";
        //     return 1;
        // }).after(' <img src="/i/external.v1.png" alt="external link"/>');
        //
        // $("a:not(img)").filter(function(obj) {
        //     this.target="_blank";
        //     return 1;
        // }).after(' <img src="/i/external.v1.png" alt="external link"/>');
        //


        $('#content a').filter(function() {
            // If it's an image, do NOT show icon
            if($(this).find('img').length)
                return 0;
            // If it's external, ok
            if(this.hostname && this.hostname !== location.hostname) {
                this.target="_blank";
                return 1;
            }
            return 0;
        }).after('<img class="extlink" src="/i/external.v1.png" alt="external link"/>');

        $('#footer a').filter(function() {
            // If it's an image, do NOT show icon
            if($(this).find('img').length)
                return 0;
                // If it's external, ok
                if(this.hostname && this.hostname !== location.hostname) {
                    this.target="_blank";
                    return 1;
                }
                return 0;
        }).after('<img class="extlink" src="/i/external.v1.png" alt="external link"/>');

        $('.round').corner("7px top");
		$('.module').corner("10px top");
		//$('.button').corner("7px");
		// Any divs that should get hidden onload should have this as a class
		$('.hidediv').toggle();
});


@@ -483,25 +483,24 @@
     //%0A%0A
-%0A
         
 $('#cont
@@ -495,31 +495,26 @@
     
-$('#content a').
+var link_
 filter
-(
+ = 
 func
@@ -806,63 +806,14 @@
     
-return 1;%0A            %7D%0A            return 0;%0A        %7D
+$(this
 ).af
@@ -888,25 +888,24 @@
 k%22/%3E');%0A
-%0A
         
 $('#foot
@@ -900,140 +900,14 @@
     
-$('#footer a').filter(function() %7B%0A            // If it's an image, do NOT show icon%0A            if($(this).find('img').length)%0A
     
+%7D%0A
     
@@ -936,317 +936,98 @@
     
-       
- // If it's external, ok%0A                if(this.hostname && this.hostname !== location.hostname) %7B%0A                    this.target=%22_blank%22;%0A                    return 1;%0A                %7D%0A                return 0;%0A        %7D).after('%3Cimg class=%22extlink%22 src=%22/i/external.v1.png%22 alt=%22external link%22/%3E'
+%7D;%0A%0A        $('#content a').filter(link_filter);%0A        $('#footer a').filter(link_filter
 );%0A%0A

Refactor leo.js to avoid code duplication