Skip to content

Instantly share code, notes, and snippets.

@vfontjr
Last active June 16, 2020 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vfontjr/0e9f394f744a6fc9d9159f02d7c75736 to your computer and use it in GitHub Desktop.
Save vfontjr/0e9f394f744a6fc9d9159f02d7c75736 to your computer and use it in GitHub Desktop.
<script>
jQuery(document).ready(function($) {
"use strict";
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
$( function() {
var referrer_url = window.document.referrer,
this_url = window.location.href,
about_page = getParameterByName("return_page", this_url);
if ( ( referrer_url.indexOf("return_page") !== -1 && this_url.indexOf("return_page") ) || about_page == "about-the-codex" ) {
if ( about_page !== "about-the-codex" ) {
$( "a#return_page_url" ).prop( "href", referrer_url ).html('<i class="fad fa-arrow-alt-left"></i>Return to Previous Page');
} else {
$( "a#return_page_url" ).prop( "href", referrer_url ).html('<i class="fad fa-arrow-alt-left"></i>Return to About the Codex');
}
}
});
});
</script>
$( "a#return_page_url" ).prop( "href", referrer_url );
$( "a#return_page_url" ).prop( "href", referrer_url ).html('<i class="fad fa-arrow-alt-left"></i>Return to Previous Page');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment