x
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
    <meta charset="utf-8" />
5
    <title>Система контроля за подвижными элементами</title>
6
    <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
7
    <script type="text/javascript" src="https://hst-api.wialon.com/wsdk/script/wialon.js"></script>
8
</head>
9
<body> 
10
    
11
<input id="login" type="button" value="Click to open login page" onclick="getToken()"/>
12
<input id="logout" type="button" value="Click to logout" disabled onclick="logout()"/>
13
<table id="form" style="display:none;">
14
    <tr><td>Текущий пользователь</td><td id="user"></td></tr>
15
  <tr>
16
    <td>Выберите ресурс:</td>
17
      <td>
18
        <select id="res"></select>
19
      </td>
20
  </tr>
21
<tr><td>Гос № ТС:</td>
22
    <td><input type = "text" id="unit"/></td></tr>
23
<tr><td>От: (дата, время)</td>
24
    <td><input type="datetime-local" id = "from"/></td></tr>
25
<td>До: (дата, время)</td>
26
    <td><input type="datetime-local" id = "to"/></td>
27
<tr><td colspan="2" style="text-align:center;"><input type="button" value="Выполнить отчет" id="exec_btn"/></td></tr>
28
</table>
29
<div id="log"></div>
30
31
</body>
32
</html>
HTML
5
 
1
td, th{ border: 1px solid #c6c6c6; }
2
.wrap{ max-height:150px; overflow-y: auto; }
3
.odd, th{ background:#EEE; border: 1px solid #c6c6c6; }
4
ul{ list-style: none; margin:0px; padding:0px; display:block;overflow-y: auto; max-height: 200px;width: 300px}
5
label{ cursor:pointer; }
CSS
255
 
1
// Print message to log
2
function msg(text) { $("#log").prepend(text + "<br/>"); }
3
4
// Wialon site dns
5
var dns = "http://hosting.wialon.com";
6
7
// Main function
8
function getToken() {
9
    // construct login page URL
10
    var url = dns + "/login.html"; // your site DNS + "/login.html"
11
    url += "?client_id=" + "App";   // your application name
12
    url += "&access_type=" + 0x100; // access level, 0x100 = "Online tracking only"
13
    url += "&activation_time=" + 0; // activation time, 0 = immediately; you can pass any UNIX time value
14
    url += "&duration=" + 604800;   // duration, 604800 = one week in seconds
15
    url += "&flags=" + 0x1;         // options, 0x1 = add username in response
16
    
17
    url += "&redirect_uri=" + dns + "/post_token.html"; // if login succeed - redirect to this page
JS
Result
Source code of example Close ✕
1
 
1
/*source*/