Skip to content

Instantly share code, notes, and snippets.

View devdays's full-sized avatar

Bruce D Kyle devdays

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<title>Footnoter</title>
</head>
<body>
<p id="myParagraph">
In up so discovery my middleton eagerness dejection explained. Estimating excellence ye contrasted
insensible as. Oh up unsatiable <span class="footnote">Unpacked reserved sir.</span> interested.
Present suppose in esteems indemesne colonel it to. End horrible she landlord screened stanhill.
@devdays
devdays / setting-options.js
Created February 23, 2015 00:19
Setting and using options
$.fn.footnote = function (options) {
// This is the easiest way to have default options.
var settings = $.extend({
// These are the defaults.
color: "blue",
referencesLocation: "#references"
}, options);
// use the options
@devdays
devdays / chaining.html
Created February 23, 2015 00:13
Chaining the result to another jQuery method
<script>
$("#myParagraph").footnote().css("background-color", "yellow");
</script>
@devdays
devdays / footnotes-0.0.2.js
Created February 22, 2015 23:30
Sample for moving footnotes using jQuery plugin
(function ($) {
$.fn.footnote = function () {
// console.log("footnote");
var footnotes = this.find("span.footnote");
footnotes.each(function (key, value) {
//console.log("footnote" + key + " : " + $(value).contents().text());
var footnoteContentsNode = $(value).clone();
var footnoteNumberTextNode = document.createTextNode("[" + key + "] ");
$("#references").append(footnoteNumberTextNode).append(footnoteContentsNode).css("color", "blue").append("<br />");
$(value).text("[" + key + "] ").css("color", "blue").css("vertical-align", "super").css("font-size", "60%");
@devdays
devdays / jquery.footnoter-0.0.1.js
Created February 22, 2015 21:40
Make footnotes red
(function ($) {
$.fn.footnote = function () {
console.log("footnote");
var footnotes = this.find("span.footnote");
footnotes.css("color", "red");
return footnotes;
};
}(jQuery));
@devdays
devdays / protect-jQuery.js
Created February 22, 2015 21:38
Protecting the $ Alias and Adding Scope
(function ( $ ) {
// use $ in your code as the jQuery alias here
}( jQuery ));
@devdays
devdays / footnoter.0.0.1.html
Last active August 29, 2015 14:15
Sample footnoter html
<!DOCTYPE html>
<html>
<head>
<title>Footnoter</title>
</head>
<body>
<p id="myParagraph">
In up so discovery my middleton eagerness dejection explained. Estimating excellence ye contrasted
insensible as. Oh up unsatiable <span class="footnote">Unpacked reserved sir.</span> interested.
Present suppose in esteems indemesne colonel it to. End horrible she landlord screened stanhill.
@devdays
devdays / jQuery-basic-plugin-greenify.js
Created February 22, 2015 19:02
jQuery Basic Plugin
$.fn.greenify = function() {
this.css( "color", "green" );
};
$( "a" ).greenify(); // Makes all the links green.
<div style="border: 1px solid orange">
<span style="width: 300px; margin-left: 100px; padding: 3px 3px 3px 3px;
background-color: lightgreen">Now is the time for all good men to come to the aid of their country. The quick fox jumped over the lazy dog.</span>
<span style="width: 300px; margin-left: 100px; padding: 3px 3px 3px 3px;
background-color: lightgreen">Now is the time for all good men to come to the aid of their country. The quick fox jumped over the lazy dog.</span>
</div>
@devdays
devdays / css-SeeTheBoxes.css
Created February 16, 2015 21:20
See the boxes on your page
* {
border: 1px solid red !important;
}