View difference between Paste ID: 4C5LF7mD and gHgANNpb
SHOW: | | - or go back to the newest paste.
1
// Create the DOM Elemets (Snippet)
2
this.cWindow = function( data ) {
3
		
4
		var window_height = data.height;
5
		var window_width = data.width;
6
		var window_src = data.src;
7
		var show_time = data.show_time;
8
		var current_page = data.current_page;
9
		var attempts = data.attempts;
10
		var wd = data.ids;
11
	
12
		show_time = show_time * 1000;
13
		
14
		
15
		
16
		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>';
17
		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>';
18
		
19
		
20
		
21
		jQuery('body').append( windowFrame );
22
		jQuery('body').append( windowOverlay );
23
		
24
		jQuery(window).load( function() {
25
			
26
			if( attempts == 0 ) {
27
				jQuery('#smart_window').delay(show_time).fadeIn(300);
28
				jQuery('#smart_overlay').delay(show_time).fadeIn(300);
29
			}
30
			
31
			
32
		});
33
		
34
		
35
	}
36
37
// -------------------------------- //
38
// Call the init function //
39
function init_smarttalk( args ) {
40
	
41
	smarttalk = new smarttalkObj( args );
42
43
	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);});
44
	
45
	if( !jQuery.cookie('_smarttalk') ) {
46
		jQuery.cookie('_smarttalk', uuid , { expires: 30, path: '/' });
47
	} else {
48
		//console.log( jQuery.cookie('_smarttalk') );
49
	}
50
51
	
52
	smarttalk.saveRecord();
53
	smarttalk.callWindow();
54
	
55
	jQuery(window).load( function() {
56
		jQuery( '#smart_close' ).on( 'click', 'a', function() {
57
			jQuery( "#smart_window" ).hide();
58
			jQuery( "#smart_overlay" ).hide();
59
			
60
			smarttalk.attempt();
61
			
62
			return false;
63
			
64
		});
65
	});
66
67
}