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

Last change on this file since 682 was 662, checked in by quyenla, 10 years ago

trial

  • Property svn:mime-type set to text/plain
File size: 4.6 KB
Line 
1if (licenseAvailable == "!OK")
2{
3    $('#alert-services').modal('show');
4    if (first_visit == '1') {
5        $('#alert-services').modal('show');
6    }
7}
8if (first_visit == '1') {
9
10    if (p_period == -1)
11    {
12        $('#alert-trial-services').modal('show');
13        $('#alert-trial-services').on('hidden.bs.modal', function () {
14            if (update_user_info == "1")
15            {
16                $('#update_user_info').modal({backdrop: 'static',keyboard: false,});
17            }
18        });
19    }
20    else
21    {
22        if (update_user_info == "1")
23        {
24            $('#update_user_info').modal({backdrop: 'static'});
25        }
26    }
27
28}
29
30
31$("#update_user_info.btn").click(function () {
32    $(".error").html("");
33    $.ajax({
34        url: 'user/update_info/',
35        type: 'POST',
36        data: $("#update_user_info.form").serialize(),
37        success: function (data, textStatus, jqXHR)
38        {
39            result = jQuery.parseJSON(data);
40            if (result.success == "1")
41            {
42                $('#update_user_info').modal('hide');
43
44            }
45            else
46            {
47                for (var key in result.errors)
48                {
49                    $("#" + result.errors[key]['field'] + ".error").html(result.errors[key]['content']);
50
51                }
52            }
53        }
54    });
55});
56
57function showModal() {
58    console.log('Show modal!');
59    $('#alert-services-package').modal('show');
60}
61
62$('#services-reg').click(function () {
63    $('#alert-services').modal('hide');
64    window.location = url + "frontend/user/profile#services-register";
65});
66
67$('#save-package').click(function () {
68    DoSaveLecture();
69});
70
71$('#services-sign').click(function () {
72    $('#alert-services-reg').modal('hide');
73    $('#alert-services-reg-2').modal('show');
74})
75
76var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
77var g_Flash = null;
78var g_cbData = "";
79
80function InitViolet() {
81    g_Flash = document.getElementById('LectorEditorOnline');
82    //g_Flash = $('#LectorEditorOnline');
83    //g_Flash = isInternetExplorer ? LectorEditorOnline : document.LectorEditorOnline;
84}
85;
86
87function GetClipboardItem() {
88    var cbData = window.clipboardData ? window.clipboardData.getData('Text') : g_cbData;
89    g_Flash.SetVariable("clipboardData", cbData);
90    g_Flash.SetVariable("command", "Get Text");
91}
92;
93
94function SetClipboardItem(args) {
95    if (window.clipboardData)
96        window.clipboardData.setData('Text', args);
97    else
98        g_cbData = args;
99    g_Flash.SetVariable("command", "Set OK");
100}
101;
102
103function SetWindowTitle(fileName) {
104    if (fileName == "")
105        document.title = "Violet Online";
106    else {
107        var docName = fileName.substring(0, fileName.length - 4);
108        document.title = "Violet Online - " + docName;
109    }
110}
111;
112
113function SetWindowState() {
114    var full = (g_Flash.width == "100%");
115    g_Flash.width = full ? "800" : "100%";
116    g_Flash.height = full ? "580" : "100%";
117}
118;
119
120function DoSaveLecture() {
121    g_Flash.SetVariable("command", "Press Save");
122}
123
124function DoOpenLecture(filename) {
125    g_Flash.SetVariable("openedFileName", filename);
126    g_Flash.SetVariable("command", "Open File");
127}
128
129// Handle all the FSCommand messages in a Flash movie.
130function LectorEditorOnline_DoFSCommand(command, args) {
131    switch (command) {
132        case "Set Title":
133            SetWindowTitle(args);
134            break;
135        case "Get Clipboard":
136            GetClipboardItem();
137            break;
138        case "Set Clipboard":
139            SetClipboardItem(args);
140            break;
141        case "Set State":
142            //SetWindowState();
143            break;
144        case "Quit":
145            window.open('', '_self').close();
146            break;
147        case "trace":
148            alert(args);
149            break;
150        case "Check License":
151            showModal();
152            break;
153    }
154}
155;
156
157// Hook for Internet Explorer.
158if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
159    document.write('<script language=\"VBScript\"\>\n');
160    document.write('On Error Resume Next\n');
161    document.write('Sub LectorEditorOnline_FSCommand(ByVal command, ByVal args)\n');
162    document.write('  Call LectorEditorOnline_DoFSCommand(command, args)\n');
163    document.write('End Sub\n');
164    document.write('</script\>\n');
165}
166;
167
168
169$(document).ready(function () {
170    InitViolet();
171    //$('#open-lecture').click(function(e){DoOpenLecture('http://sbgapi.violet.vn/space/file/id/7');});
172
173})
Note: See TracBrowser for help on using the repository browser.