Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Create the DOM Elemets (Snippet)
- this.cWindow = function( data ) {
- var window_height = data.height;
- var window_width = data.width;
- var window_src = data.src;
- var show_time = data.show_time;
- var current_page = data.current_page;
- var attempts = data.attempts;
- var wd = data.ids;
- show_time = show_time * 1000;
- var windowFrame = '<div id="smart_window" style="display:none; z-index: 10001; width:'+ window_width +'px; height:'+ window_height +'px; position: absolute; left:50%; top: 50px; margin-left:-'+ window_width / 2 +'px;"><div id="smart_close"><div style="margin-bottom:5px; text-align:right;font-size:11px;font-style:italic"><a href="#" style="color:white;text-decoration:none">Stäng fönster</a></div><iframe id="smart_iframe" src="'+ window_src +'?cp='+ current_page +'&id='+ wd +'" width="'+ window_width +'" height="'+ window_height +'" style="overflow:hidden" scrolling="no" seamless="seamless" frameborder="0"></iframe></div>';
- var windowOverlay = '<div id="smart_overlay" style="display:none; width:100%; height:100%; position: fixed; top:0px; left:0px; background:black; opacity:0.5; z-index:10000;"></div>';
- jQuery('body').append( windowFrame );
- jQuery('body').append( windowOverlay );
- jQuery(window).load( function() {
- if( attempts == 0 ) {
- jQuery('#smart_window').delay(show_time).fadeIn(300);
- jQuery('#smart_overlay').delay(show_time).fadeIn(300);
- }
- });
- }
- // -------------------------------- //
- // Call the init function //
- function init_smarttalk( args ) {
- smarttalk = new smarttalkObj( args );
- var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {var r = Math.random()*16|0,v=c=='x'?r:r&0x3|0x8;return v.toString(16);});
- if( !jQuery.cookie('_smarttalk') ) {
- jQuery.cookie('_smarttalk', uuid , { expires: 30, path: '/' });
- } else {
- //console.log( jQuery.cookie('_smarttalk') );
- }
- smarttalk.saveRecord();
- smarttalk.callWindow();
- jQuery(window).load( function() {
- jQuery( '#smart_close' ).on( 'click', 'a', function() {
- jQuery( "#smart_window" ).hide();
- jQuery( "#smart_overlay" ).hide();
- smarttalk.attempt();
- return false;
- });
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment