Last active
August 29, 2015 14:01
-
-
Save cmchap/8b2f7a3a8372eab04542 to your computer and use it in GitHub Desktop.
CopyrightNotice: a jQuery plugin to create an always-up-to-date copyright notice
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Javascript CopyrightNotice | |
* | |
* Copyright (c) 2014 Cory Chapman | |
* Licensed under the MIT license | |
* | |
* For more info on copyright see: http://www.bitlaw.com/copyright/formalities.html | |
* | |
* Example usage: | |
* $('.copyright').copyrightNotice({ byLine: 'Cory Chapman', published: false }); | |
* | |
*/ | |
(function($) { | |
$.fn.copyrightNotice = function(options) { | |
var settings = $.extend({ | |
byLine: '[COPYRIGHT HOLDER NAME]', | |
published: true | |
}, options); | |
return this.each(function() { | |
var byLine = settings.byLine; | |
var published = settings.published; | |
var currentYear = new Date().getFullYear(); | |
var copyrightText = '© ' + currentYear + ' ' + byLine; | |
if (published != true) { | |
copyrightText = 'Unpublished Work ' + copyrightText; | |
} | |
$(this).html(copyrightText); | |
}); | |
}; | |
}(jQuery)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment