<button gc-prompt-caller class="btn">Open</button>
<button id="openmodal" class="btn">Open</button>
<script>
openmodal = document.getElementById('openmodal');
openmodal.addEventListener('click', function(){
console.log('01 - Modal Opened via Javascript');
getComplied.command('show');
});
</script>
<button id="openmodallangpt" class="btn">Open in Portuguese </button>
<button id="openmodallangen" class="btn">Open in English </button>
<script>
// Open modal in Portuguese
openmodallangpt = document.getElementById('openmodallangpt');
openmodallangpt.addEventListener('click', function(){
console.log('02 - Open in Portuguese');
getComplied.lang = 'pt-PT';
getComplied.command('show');
});
// Open modal in English
openmodallangen = document.getElementById('openmodallangen');
openmodallangen.addEventListener('click', function(){
console.log('03 - Open in English');
getComplied.lang = 'en-US';
getComplied.command('show');
});
</script>
<script>
getComplied.container = document.getElementById('insidecontainer');
getComplied.callback.oninit = function(){
updateResults('oninit', 'default');
$('body').addClass('o-hidden');
$('body').append('<div id="overlay-example"></div>');
$('#insidecontainer').addClass('active');
}
</script>
<script>
console.log('06 - Force required');
getComplied.continueAnyway = false;
getComplied.callback.oninit = function(){
updateResults('oninit', 'default');
getComplied.command('show');
}
</script>
<script>
getComplied.callback.oninit = function(){
updateResults('oninit', 'default');
getComplied.command('change-view', 'static', 'languages');
getComplied.command('show');
}
</script>
<script>
getComplied.callback.oninit = function(){
updateResults('oninit', 'default');
getComplied.command('change-view', 'id', 119);
getComplied.command('show');
}
</script>
<script>
getComplied.callback.oninit = function(){
updateResults('oninit', 'default');
getComplied.command('change-view', 'index', 1)
getComplied.command('show');
}
</script>
Examples:
<script>
getComplied.callback.oninit = function(){
updateResults('oninit', 'default');
getComplied.command('user', {
Name: 'Firstname Lastname',
Email: 'user@email.com'
});
getComplied.command('show');
}
</script>
<a href="?gc_show=true">Open</a>
<a href="?gc_lang=pt-PT">Open in Portuguese</a>
<a href="?gc_lang=en-GB">Open in English</a>
<a href="?gc_view_id=13">View Example</a>
<a href="?gc_view_index=1">View Example</a>
Examples:
<a href="?gc_email=user@email.com&gc_birthdate_day=1&gc_birthdate_month=1&gc_birthdate_year=1990&gc_callingcode=+351&gc_countrycode=PT&gc_gender=0&gc_addressline1=Address&gc_city=City&gc_phonenumber=912345678">
Send User's Data
</a>
<a href="?gc_console=true">Open debug mode</a>
<div class="btn" gc-open-view-index="0"> Terms and Conditions </div>
<div class="btn" gc-open-view-index="1"> Cookies Policy </div>
<div class="btn" gc-open-view-index="2"> Privacy Policy </div>
<div class="btn" gc-open-view-index="3"> Marketing Policy </div>
<script>
getComplied.callback.onopen = function(){
/* your code goes here */
updateResults('Modal was opened', 'info');
}
getComplied.callback.onclose = function(){
/* your code goes here */
updateResults('Modal was closed', 'danger');
}
getComplied.callback.onlangchange = function(data){
/* your code goes here */
updateResults('Language was changed', 'secondary');
}
getComplied.callback.onsave = function(data){
/* your code goes here */
updateResults('User Approved Consent', 'success');
}
getComplied.callback.oninit = function(data){
updateResults('GetComplied was Initiated', 'success');
}
function updateResults(event, style){
$('#results ul').prepend('<li class="list-group-item montserrat text-white bg-'+style+'">' + event + '</li>');
}
</script>
Copyright © Getcomplied 2018