Skip to content

Instantly share code, notes, and snippets.

@cfxd
Created September 17, 2021 08:12
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 cfxd/98d899d65079b68d60c0f635ee59b324 to your computer and use it in GitHub Desktop.
Save cfxd/98d899d65079b68d60c0f635ee59b324 to your computer and use it in GitHub Desktop.
For Tomas
find
var t=window.location.protocol+"//"+window.location.host+window.location.pathname+"?variant="+e.id;
replace with
var newUrlRegex=/variant=\d*/g;var newUrlExt='?variant='+e.id;if(window.location.search!=''){if(window.location.search.includes('variant=')){newUrlExt=window.location.search.replace(newUrlRegex,'variant='+e.id);}else{newUrlExt=window.location.search+'&variant='+e.id;}}var t=window.location.protocol+"//"+window.location.host+window.location.pathname+newUrlExt;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment