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

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

error

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