1 | <script type="text/javascript" language="JavaScript">
|
---|
2 | <!--//
|
---|
3 |
|
---|
4 | var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
|
---|
5 | var g_Flash = null;
|
---|
6 | var g_cbData = "";
|
---|
7 |
|
---|
8 | function InitViolet() {
|
---|
9 | console.log('onload');
|
---|
10 | g_Flash = document.getElementById('LectorEditorOnline');
|
---|
11 | //g_Flash = isInternetExplorer ? LectorEditorOnline : document.LectorEditorOnline;
|
---|
12 |
|
---|
13 | console.log(LectorEditorOnline);
|
---|
14 | }
|
---|
15 |
|
---|
16 | function GetClipboardItem() {
|
---|
17 | var cbData = window.clipboardData? window.clipboardData.getData('Text'): g_cbData;
|
---|
18 | g_Flash.SetVariable("clipboardData", cbData);
|
---|
19 | g_Flash.SetVariable("command", "Get Text");
|
---|
20 | }
|
---|
21 |
|
---|
22 | function SetClipboardItem(args) {
|
---|
23 | if (window.clipboardData) window.clipboardData.setData('Text', args);
|
---|
24 | else g_cbData = args;
|
---|
25 | g_Flash.SetVariable("command", "Set OK");
|
---|
26 | }
|
---|
27 |
|
---|
28 | function SetWindowTitle(fileName) {
|
---|
29 | if (fileName == "") document.title = "Violet Online";
|
---|
30 | else {
|
---|
31 | var docName = fileName.substring(0, fileName.length - 4);
|
---|
32 | document.title = "Violet Online - " + docName;
|
---|
33 | }
|
---|
34 | }
|
---|
35 |
|
---|
36 | function SetWindowState() {
|
---|
37 | var full = (g_Flash.width == "100%");
|
---|
38 | g_Flash.width = full? "800": "100%";
|
---|
39 | g_Flash.height = full? "580": "100%";
|
---|
40 | }
|
---|
41 |
|
---|
42 | // Handle all the FSCommand messages in a Flash movie.
|
---|
43 | function LectorEditorOnline_DoFSCommand(command, args) {
|
---|
44 |
|
---|
45 | switch (command) {
|
---|
46 | case "Set Title": SetWindowTitle(args); break;
|
---|
47 | case "Get Clipboard": GetClipboardItem(); break;
|
---|
48 | case "Set Clipboard": SetClipboardItem(args); break;
|
---|
49 | case "Set State": SetWindowState(); break;
|
---|
50 | case "Quit": window.open('','_self').close(); break;
|
---|
51 | case "trace": alert(args); break;
|
---|
52 | case "Check License": alert('Bạn chưa ÄÄng kÜ sá» dụng dá»ch vụ!'); break;
|
---|
53 | }
|
---|
54 | }
|
---|
55 |
|
---|
56 | // Hook for Internet Explorer.
|
---|
57 | if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
|
---|
58 | document.write('<script language=\"VBScript\"\>\n');
|
---|
59 | document.write('On Error Resume Next\n');
|
---|
60 | document.write('Sub LectorEditorOnline_FSCommand(ByVal command, ByVal args)\n');
|
---|
61 | document.write(' Call LectorEditorOnline_DoFSCommand(command, args)\n');
|
---|
62 | document.write('End Sub\n');
|
---|
63 | document.write('</script\>\n');
|
---|
64 | }
|
---|
65 |
|
---|
66 | //-->
|
---|
67 | </script> |
---|