source: pro-violet-viettel/sourcecode/assets/js/frontend/lecture.js @ 576

Last change on this file since 576 was 555, checked in by dungnv, 11 years ago
  • Property svn:mime-type set to text/plain
File size: 3.1 KB
Line 
1if (licenseAvailable == "!OK")
2{
3    if (first_visit == '1') {
4        $('#alert-services').modal('show');
5    }
6}
7
8function showModal() {
9    console.log('Show modal!');
10    $('#alert-services-package').modal('show');
11}
12
13$('#services-reg').click(function () {
14        $('#alert-services').modal('hide');
15        window.location=url+"frontend/user/profile#services-register";
16});
17
18$('#save-package').click(function () {
19        DoSaveLecture();
20});
21
22$('#services-sign').click(function () {
23    $('#alert-services-reg').modal('hide');
24    $('#alert-services-reg-2').modal('show');
25})
26
27var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
28var g_Flash = null;
29var g_cbData = "";
30
31function InitViolet() {
32    g_Flash = document.getElementById('LectorEditorOnline');
33    //g_Flash = $('#LectorEditorOnline');
34    //g_Flash = isInternetExplorer ? LectorEditorOnline : document.LectorEditorOnline;
35}
36;
37
38function GetClipboardItem() {
39    var cbData = window.clipboardData ? window.clipboardData.getData('Text') : g_cbData;
40    g_Flash.SetVariable("clipboardData", cbData);
41    g_Flash.SetVariable("command", "Get Text");
42}
43;
44
45function SetClipboardItem(args) {
46    if (window.clipboardData)
47        window.clipboardData.setData('Text', args);
48    else
49        g_cbData = args;
50    g_Flash.SetVariable("command", "Set OK");
51}
52;
53
54function SetWindowTitle(fileName) {
55    if (fileName == "")
56        document.title = "Violet Online";
57    else {
58        var docName = fileName.substring(0, fileName.length - 4);
59        document.title = "Violet Online - " + docName;
60    }
61}
62;
63
64function SetWindowState() {
65    var full = (g_Flash.width == "100%");
66    g_Flash.width = full ? "800" : "100%";
67    g_Flash.height = full ? "580" : "100%";
68}
69;
70
71function DoSaveLecture () {
72        g_Flash.SetVariable("command", "Press Save");
73}
74
75// Handle all the FSCommand messages in a Flash movie.
76function LectorEditorOnline_DoFSCommand(command, args) {
77    switch (command) {
78        case "Set Title":
79            SetWindowTitle(args);
80            break;
81        case "Get Clipboard":
82            GetClipboardItem();
83            break;
84        case "Set Clipboard":
85            SetClipboardItem(args);
86            break;
87        case "Set State":
88            SetWindowState();
89            break;
90        case "Quit":
91            window.open('', '_self').close();
92            break;
93        case "trace":
94            alert(args);
95            break;
96        case "Check License":
97            showModal();
98            break;
99    }
100}
101;
102
103// Hook for Internet Explorer.
104if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
105    document.write('<script language=\"VBScript\"\>\n');
106    document.write('On Error Resume Next\n');
107    document.write('Sub LectorEditorOnline_FSCommand(ByVal command, ByVal args)\n');
108    document.write('  Call LectorEditorOnline_DoFSCommand(command, args)\n');
109    document.write('End Sub\n');
110    document.write('</script\>\n');
111}
112;
113
114$(document).ready(function () {
115    InitViolet();
116})
Note: See TracBrowser for help on using the repository browser.