Commit | Line | Data |
---|---|---|
ff6ab9ba AE |
1 | <!DOCTYPE html> |
2 | <html> | |
3 | <head> | |
4 | <meta charset="UTF-8"> | |
5 | <title>iframe</title> | |
6 | ||
7 | <style> | |
8 | html,body{ | |
9 | margin: 0; | |
10 | height: 100%; | |
11 | font: 13px/1.555 "Trebuchet MS", sans-serif; | |
12 | } | |
13 | a{ | |
14 | color: #888; | |
15 | font-weight: bold; | |
16 | text-decoration: none; | |
17 | border-bottom: 1px solid #888; | |
18 | } | |
19 | .main-box { | |
20 | color:#252525; | |
21 | padding: 3px 5px; | |
22 | text-align: justify; | |
23 | } | |
24 | .main-box p{margin: 0 0 14px;} | |
25 | .main-box .cerr{ | |
26 | color: #f00000; | |
27 | border-bottom-color: #f00000; | |
28 | } | |
29 | </style> | |
30 | </head> | |
31 | <body> | |
32 | <div id="content" class="main-box"></div> | |
33 | <iframe src="" frameborder="0" id="spelltext" name="spelltext" style="display:none; width: 100%" ></iframe> | |
34 | <iframe src="" frameborder="0" id="loadsuggestfirst" name="loadsuggestfirst" style="display:none; width: 100%" ></iframe> | |
35 | <iframe src="" frameborder="0" id="loadspellsuggestall" name="loadspellsuggestall" style="display:none; width: 100%" ></iframe> | |
36 | <iframe src="" frameborder="0" id="loadOptionsForm" name="loadOptionsForm" style="display:none; width: 100%" ></iframe> | |
37 | <script> | |
38 | (function(window) { | |
39 | // Constructor Manager PostMessage | |
40 | ||
41 | var ManagerPostMessage = function() { | |
42 | var _init = function(handler) { | |
43 | if (document.addEventListener) { | |
44 | window.addEventListener('message', handler, false); | |
45 | } else { | |
46 | window.attachEvent("onmessage", handler); | |
47 | }; | |
48 | }; | |
49 | var _sendCmd = function(o) { | |
50 | var str, | |
51 | type = Object.prototype.toString, | |
52 | fn = o.fn || null, | |
53 | id = o.id || '', | |
54 | target = o.target || window, | |
55 | message = o.message || { 'id': id }; | |
56 | ||
57 | if (type.call(o.message) == "[object Object]") { | |
58 | (o.message['id']) ? o.message['id'] : o.message['id'] = id; | |
59 | message = o.message; | |
60 | }; | |
61 | ||
62 | str = JSON.stringify(message, fn); | |
63 | target.postMessage(str, '*'); | |
64 | }; | |
65 | ||
66 | return { | |
67 | init: _init, | |
68 | send: _sendCmd | |
69 | }; | |
70 | }; | |
71 | ||
72 | var manageMessageTmp = new ManagerPostMessage; | |
73 | ||
74 | ||
75 | var appString = (function(){ | |
76 | var spell = parent.CKEDITOR.config.wsc.DefaultParams.scriptPath; | |
77 | var serverUrl = parent.CKEDITOR.config.wsc.DefaultParams.serviceHost; | |
78 | return serverUrl + spell; | |
79 | })(); | |
80 | ||
81 | function loadScript(src, callback) { | |
82 | var scriptTag = document.createElement("script"); | |
83 | scriptTag.type = "text/javascript"; | |
84 | callback ? callback : callback = function() {}; | |
85 | if(scriptTag.readyState) { | |
86 | //IE | |
87 | scriptTag.onreadystatechange = function() { | |
88 | if (scriptTag.readyState == "loaded" || | |
89 | scriptTag.readyState == "complete") { | |
90 | scriptTag.onreadystatechange = null; | |
91 | setTimeout(function(){scriptTag.parentNode.removeChild(scriptTag)},1) | |
92 | callback(); | |
93 | } | |
94 | }; | |
95 | }else{ | |
96 | //Others | |
97 | scriptTag.onload = function() { | |
98 | setTimeout(function(){scriptTag.parentNode.removeChild(scriptTag)},1); | |
99 | callback(); | |
100 | }; | |
101 | }; | |
102 | scriptTag.src = src; | |
103 | document.getElementsByTagName("head")[0].appendChild(scriptTag); | |
104 | }; | |
105 | ||
106 | ||
107 | window.onload = function(){ | |
108 | loadScript(appString, function(){ | |
109 | manageMessageTmp.send({ | |
110 | 'id': 'iframeOnload', | |
111 | 'target': window.parent | |
112 | }); | |
113 | }); | |
114 | } | |
115 | })(this); | |
116 | </script> | |
117 | </body> | |
118 | </html> |