Last active
June 16, 2020 14:43
-
-
Save vfontjr/0e9f394f744a6fc9d9159f02d7c75736 to your computer and use it in GitHub Desktop.
Source code for https://formidable-masterminds.com/return-to-previous-page/
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
<div class="return-to-codex-list"> | |
<a id="return_page_url" href="/action-list/"><i class="fad fa-arrow-alt-left"></i>Return to Actions List</a> | |
</div> |
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
<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> |
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
$( "a#return_page_url" ).prop( "href", referrer_url ); |
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
$( "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