Blame view

WebRoot/static/js/dailog.js 1.98 KB
6429ab88   孙向锦   remove
1
2
3
4
5
  var modal={
  	init:function(obj){
  		this.init.title=obj.title;
  		this.init.url=obj.url;
  		this.init.func = obj.func;
8fb81e72   =   1.增加练习列表页和布置练习页面
6
7
  		this.init.width = obj.width;
  		this.init.height = obj.height;
6429ab88   孙向锦   remove
8
9
10
11
  		},
  	show:function(){
  		if(window.top!=window.self){
  			$("body",top.document).append('<div class="mb"><div class="mb_box"><div class="mb_head"><p>'+window.top.init.title+'</p><div class="close"><img src="../static/images/close.png" /></div></div><div class="mb_content"><iframe src="'+window.top.modal.init.url+'"></iframe></div></div></div>');
8fb81e72   =   1.增加练习列表页和布置练习页面
12
13
14
15
16
17
18
19
  			if(window.top.init.width){
  				var w=(window.top.init.width>window.document.body.clientWidth)?window.document.body.clientWidth:window.top.init.width;
  				$(".mb_box",top.document).css("width",w);
  			}
  			if(window.top.init.height){
  				var h=(window.top.init.height>window.document.body.clientHeight)?window.document.body.clientHeight:window.top.init.height;
  				$(".mb_box",top.document).css("height",h);
  			}
6429ab88   孙向锦   remove
20
21
22
23
  		}else{
  			if($(".loading").length==0)
  			{
  				$("body").append('<div class="mb"><div class="mb_box"><div class="mb_head"><p>'+window.top.modal.init.title+'</p><div class="close"><img src="../static/images/close.png" /></div></div><div class="mb_content"><iframe src="'+window.top.modal.init.url+'"></iframe></div></div></div>');
8fb81e72   =   1.增加练习列表页和布置练习页面
24
25
26
27
28
29
30
31
  				if(window.top.modal.init.width){
  					var w=(window.top.modal.init.width>window.document.body.clientWidth)?window.document.body.clientWidth:window.top.modal.init.width;
  					$(".mb_box").css("width",w);
  				}
  				if(window.top.modal.init.height){
  					var h=(window.top.modal.init.height>window.document.body.clientHeight)?window.document.body.clientHeight:window.top.modal.init.height;
  					$(".mb_box").css("height",h);
  				}
6429ab88   孙向锦   remove
32
33
  			}
  		}
8fb81e72   =   1.增加练习列表页和布置练习页面
34
  	
6429ab88   孙向锦   remove
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
  		
  	},
  	remove:function(){
  		if(window.top!=window.self){
  			$(".mb",top.document).remove();
  		}else{
  			if($(".mb").length>0)
  			$(".mb").remove();
  		}
  		if(window.top.modal.init.func){
  			window.top.modal.init.func();
  		}
  	}
  }
  $(document).on("click",".close",function(){
  	window.top.modal.remove();
  })