Skip to content

Instantly share code, notes, and snippets.

@luismec90
Created December 21, 2016 15:48
Show Gist options
  • Save luismec90/33f072b7d31804f3cf98634fb965d1c8 to your computer and use it in GitHub Desktop.
Save luismec90/33f072b7d31804f3cf98634fb965d1c8 to your computer and use it in GitHub Desktop.
<!doctype html>
<html class="" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div id="js-page-builder-container"></div>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script type="text/javascript" src="https://pages.genndidev.com/pagebuilder.js"></script>
<script>
function createPageBuilder(options) {
var options = options || {},
defaults = {
element: 'js-page-builder-container',
template: '',
content: JSON.stringify({}),
extraVars: {
'$cdn': 'http://localhost/',
'$contentUploadUrl': '/api/content/upload/',
'$createFunnelListUrl': 'http://localhost/createfunnel.php'
}
};
options = $.extend({}, defaults, options);
options.extraVars = $.extend({}, defaults.extraVars, options.extraVars);
options.extraVars = JSON.stringify(options.extraVars);
pageBuilder.exit = function () {
transitionToLaunchBuilder();
};
pageBuilder.init(options);
return pageBuilder;
}
function transitionToLaunchBuilder() {
$('.sidebar_pages').removeClass('open');
$('.step_1').show();
$('.sidebar_pages').removeClass('full-open');
setTimeout('$(".sidebar_pages .sidebar_footer").removeClass("shorter")', 300);
$('.sidebar_pages .sidebar_footer').removeClass('show');
$('#content-iframe').remove();
$('.js-header-wrapper').show();
$('.js-sidebar-pages').removeClass('hug-top');
$('.js-builder_exit').toggle();
}
function closeLaunchBuilder() {
$('body').removeClass('body-overflow');
$('.overlay_box_wait').fadeIn(600);
$('.flow-tpls-step-1').parents('.block-inner').show();
setTimeout(function () {
$('.overlay_box_wait').hide();
}, 2000);
setTimeout(function () {
$('.builder-module-placeholder').fadeOut();
}, 2000);
setTimeout(function () {
$('.builder-module-bg').fadeOut();
}, 2000);
}
var section = 'registration';
var selectedTemplateFile = '1'
newPageBuilder = createPageBuilder({
template: 'wj/' + section + '/' + selectedTemplateFile,
content: '[]' , //json FROM DB with the page contents that are returned by the builder
extraVars: {
}
});
newPageBuilder.activate();
newPageBuilder.save = function (data) {
// data.json and data.html are available - need both
console.log(data);
}
$('#js-page-builder-container').css({
'position': 'absolute',
'width': '100%',
'height': '100%',
'z-index' : '1000'
})
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment