Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<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