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

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

bug

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