-
Notifications
You must be signed in to change notification settings - Fork 0
/
opener.js
45 lines (44 loc) · 1001 Bytes
/
opener.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
var opener = {
defaultOptions : {
url : '',
type : null,
name : '',
features : 'fullscreen=yes, scrollbars=yes'
},
win : null,
popup : function(args){
var options = arguments[0];
options = $.extend(true,this.defaultOptions,options)
this.win = window.open(options.url,options.name,options.features);
var type = typeof(options.type);
if(type === 'number'){
this.popupTimer(options.type);
}else if(type === 'string'){
if(type === 'onload'){
this.popupOnload();
}else{
this.popupOnready();
}
}else{
return;
}
},
popupTimer : function(time){
var self = this;
setTimeout(function(){
self.win.alert(time)
},time);
},
popupOnload : function(){
this.win.onload = this.callback;
},
popupOnready : function(){
var self = this;
$(this.win.document).ready(function($){
self.callback();
});
},
callback : function(){
this.win.alert('callback');
}
}