Skip to content

Commit

Permalink
add js function to get value from a key in the url
Browse files Browse the repository at this point in the history
  • Loading branch information
buepro committed May 16, 2018
1 parent d5c766a commit af5b450
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Resources/Public/JavaScripts/General.js
@@ -1,3 +1,16 @@
/**
* return value from a key (name) in the url
*
* @see davidwalsh.name/query-string-javascript
*/
function getUrlParameter(name) {
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
var results = regex.exec(location.search);
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
};


/**
* open the element from collapsable elements (e.g. accordion elements)
* if the css style .csc-space-after-1 is found within .collapse
Expand Down

0 comments on commit af5b450

Please sign in to comment.