What is happening:
The three jQuery PlugIn's
$(document).ready(function () { });
<head>
<script type="text/javascript">
(function ($) {
$.fn.showLinkRuntime = function () {
return this.filter("a").append(function () {
return " (" + this.href + ")";
});
};
}(jQuery));
(function ($) {
$.fn.greenify = function (options) {
// This is the easiest way to have default options.
var settings = $.extend({
// These are the defaults.
color: "#556b2f",
backgroundColor: "white"
}, options);
// Greenify the collection based on the settings variable.
return this.css({
color: settings.color,
backgroundColor: settings.backgroundColor
});
};
}(jQuery));
</script>
<script type="text/javascript">
(function ($) {
$.fn.showLinkDesigntime = function () {
return this.filter("a").each(
function () {
$(this).append(" (" + $(this).attr("href") + ")");
});
};
}(jQuery));
$(document).ready(function () {
$("a").showLinkDesigntime();
$("a").showLinkRuntime();
$("div").greenify({ color: "orange" });
$("#div1").greenify({ color: "cyan", backgroundColor: "red" });
});
</script>
</head>
<body>
<a href="page.html">Foo</a> <br/>
<a href="page0.html">Foo0</a> <br/>
<a href="page1.html">Foo1</a> <br/>
</body>