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

Last change on this file since 658 was 658, checked in by quyenla, 11 years ago

error

  • 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    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    if (licenseAvailable == "!OK")
53    {
54        $('#alert-services-package').modal('show');
55    }
56}
57
58$('#services-reg').click(function () {
59    $('#alert-services').modal('hide');
60    window.location = url + "frontend/user/profile#services-register";
61});
62
63$('#save-package').click(function () {
64    DoSaveLecture();
65});
66
67$('#services-sign').click(function () {
68    $('#alert-services-reg').modal('hide');
69    $('#alert-services-reg-2').modal('show');
70})
71
72var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
73var g_Flash = null;
74var g_cbData = "";
75
76function InitViolet() {
77    g_Flash = document.getElementById('LectorEditorOnline');
78    //g_Flash = $('#LectorEditorOnline');
79    //g_Flash = isInternetExplorer ? LectorEditorOnline : document.LectorEditorOnline;
80}
81;
82
83function GetClipboardItem() {
84    var cbData = window.clipboardData ? window.clipboardData.getData('Text') : g_cbData;
85    g_Flash.SetVariable("clipboardData", cbData);
86    g_Flash.SetVariable("command", "Get Text");
87}
88;
89
90function SetClipboardItem(args) {
91    if (window.clipboardData)
92        window.clipboardData.setData('Text', args);
93    else
94        g_cbData = args;
95    g_Flash.SetVariable("command", "Set OK");
96}
97;
98
99function SetWindowTitle(fileName) {
100    if (fileName == "")
101        document.title = "Violet Online";
102    else {
103        var docName = fileName.substring(0, fileName.length - 4);
104        document.title = "Violet Online - " + docName;
105    }
106}
107;
108
109function SetWindowState() {
110    var full = (g_Flash.width == "100%");
111    g_Flash.width = full ? "800" : "100%";
112    g_Flash.height = full ? "580" : "100%";
113}
114;
115
116function DoSaveLecture() {
117    g_Flash.SetVariable("command", "Press Save");
118}
119
120function DoOpenLecture(filename) {
121    g_Flash.SetVariable("openedFileName", filename);
122    g_Flash.SetVariable("command", "Open File");
123}
124
125// Handle all the FSCommand messages in a Flash movie.
126function LectorEditorOnline_DoFSCommand(command, args) {
127    switch (command) {
128        case "Set Title":
129            SetWindowTitle(args);
130            break;
131        case "Get Clipboard":
132            GetClipboardItem();
133            break;
134        case "Set Clipboard":
135            SetClipboardItem(args);
136            break;
137        case "Set State":
138            //SetWindowState();
139            break;
140        case "Quit":
141            window.open('', '_self').close();
142            break;
143        case "trace":
144            alert(args);
145            break;
146        case "Check License":
147            showModal();
148            break;
149    }
150}
151;
152
153// Hook for Internet Explorer.
154if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
155    document.write('<script language=\"VBScript\"\>\n');
156    document.write('On Error Resume Next\n');
157    document.write('Sub LectorEditorOnline_FSCommand(ByVal command, ByVal args)\n');
158    document.write('  Call LectorEditorOnline_DoFSCommand(command, args)\n');
159    document.write('End Sub\n');
160    document.write('</script\>\n');
161}
162;
163
164
165$(document).ready(function () {
166    InitViolet();
167    //$('#open-lecture').click(function(e){DoOpenLecture('http://sbgapi.violet.vn/space/file/id/7');});
168
169})
Note: See TracBrowser for help on using the repository browser.