Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Klipfolio - Set Variables with Query String
- var getUrlParameter = function getUrlParameter(sParam) {
- var sPageURL = decodeURIComponent(window.location.search.substring(1)),
- sURLVariables = sPageURL.split('&'),
- sParameterName,
- i;
- for (i = 0; i < sURLVariables.length; i++) {
- sParameterName = sURLVariables[i].split('=');
- if (sParameterName[0] === sParam) {
- return sParameterName[1] === undefined ? true : sParameterName[1];
- }
- }
- };
- $( document ).ready( function() {
- var PROD = getUrlParameter('prod');
- var BETA = getUrlParameter('beta');
- var changeKlipfolioVariable = function changeKlipfolioVariable () {
- if (PROD == true) {
- $("select").val('DataWarehousePROD').change();
- console.log( "Switched variable to PROD" );
- } else if (BETA == true) {
- $("select").val('DataWarehouseBETA').change();
- console.log( "Switched variable to BETA" );
- }
- }
- changeKlipfolioVariable();
- //setTimeout(changeKlipfolioVariable, 5000)
- console.log( "Variables - PROD: " + PROD + " BETA: " + BETA );
- });
- window.addEventListener('load', function(){
- // Everything has loaded!
- console.log("Everything has loaded!");
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement