Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type='text/javascript'>
- // In a Kartra membership, remove the // on the next line to hide the code in preview and live
- // if (location.pathname.indexOf('/membership/edit')) document.currentScript.parentElement.parentElement.style.display = 'none';
- // Replace {FROM SEP this year} in <p>aragraphs using jQuery (e.g. for copyright notices)
- // FROM (starting year) and SEP (separator) are optional; "this year" is case-insensitive
- // In 2020: {this year} => 2020; {2018-this year} => 2018-2020; {2018 to This Year} => 2018 to 2020; {2020-THIS YEAR} => 2020
- // Placed in the public domain by author Brian Katzung <briank@kappacs.com>
- jQuery(function () {
- var thisYear = new Date().getFullYear();
- // You could use jQuery('p,div')... if necessary, but it will take longer
- jQuery('p').each(function () {
- this.innerHTML = this.innerHTML.replace(/{[^}]*this year}/ig, function (outer) {
- var match = outer.match(/{(\d*)(.*)this year}/i);
- if (match[1] && match[1] != thisYear) {
- return '' + match[1] + match[2] + thisYear;
- }
- return thisYear;
- });
- });
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement