admin.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  1. jQuery(function($){
  2. // http://stackoverflow.com/questions/24816/escaping-html-strings-with-jquery
  3. var entityMap = {
  4. '&': '&',
  5. '<': '&lt;',
  6. '>': '&gt;',
  7. '"': '&quot;',
  8. "'": '&#39;',
  9. '/': '&#x2F;',
  10. '`': '&#x60;',
  11. '=': '&#x3D;'
  12. };
  13. function escapeHtml(string) {
  14. return String(string).replace(/[&<>"'`=\/]/g, function (s) {
  15. return entityMap[s];
  16. });
  17. }
  18. function humanFileSize(bytes) {
  19. if(Math.abs(bytes) < 1024) {
  20. return bytes + ' B';
  21. }
  22. var units = ['KiB','MiB','GiB','TiB','PiB','EiB','ZiB','YiB'];
  23. var u = -1;
  24. do {
  25. bytes /= 1024;
  26. ++u;
  27. } while(Math.abs(bytes) >= 1024 && u < units.length - 1);
  28. return bytes.toFixed(1)+' '+units[u];
  29. }
  30. $("#refresh_postfix_log").on('click', function(e) {
  31. e.preventDefault();
  32. draw_postfix_logs();
  33. });
  34. $("#refresh_dovecot_log").on('click', function(e) {
  35. e.preventDefault();
  36. draw_dovecot_logs();
  37. });
  38. $("#refresh_sogo_log").on('click', function(e) {
  39. e.preventDefault();
  40. draw_sogo_logs();
  41. });
  42. $("#refresh_fail2ban_log").on('click', function(e) {
  43. e.preventDefault();
  44. draw_fail2ban_logs();
  45. });
  46. $("#refresh_rspamd_history").on('click', function(e) {
  47. e.preventDefault();
  48. draw_rspamd_history();
  49. });
  50. $("#import_dkim_legend").on('click', function(e) {
  51. e.preventDefault();
  52. $('#import_dkim_arrow').toggleClass("animation");
  53. });
  54. function draw_postfix_logs() {
  55. ft_postfix_logs = FooTable.init('#postfix_log', {
  56. "columns": [
  57. {"name":"time","formatter":function unix_time_format(tm) { var date = new Date(tm ? tm * 1000 : 0); return date.toLocaleString();},"title":lang.time,"style":{"width":"170px"}},
  58. {"name":"priority","title":lang.priority,"style":{"width":"80px"}},
  59. {"name":"message","title":lang.message},
  60. ],
  61. "rows": $.ajax({
  62. dataType: 'json',
  63. url: '/api/v1/get/logs/postfix/1000',
  64. jsonp: false,
  65. error: function () {
  66. console.log('Cannot draw postfix log table');
  67. },
  68. success: function (data) {
  69. $.each(data, function (i, item) {
  70. item.message = escapeHtml(item.message);
  71. var danger_class = ["emerg", "alert", "crit", "err"];
  72. var warning_class = ["warning", "warn"];
  73. var info_class = ["notice", "info", "debug"];
  74. if (jQuery.inArray(item.priority, danger_class) !== -1) {
  75. item.priority = '<span class="label label-danger">' + item.priority + '</span>';
  76. }
  77. else if (jQuery.inArray(item.priority, warning_class) !== -1) {
  78. item.priority = '<span class="label label-warning">' + item.priority + '</span>';
  79. }
  80. else if (jQuery.inArray(item.priority, info_class) !== -1) {
  81. item.priority = '<span class="label label-info">' + item.priority + '</span>';
  82. }
  83. });
  84. }
  85. }),
  86. "empty": lang.empty,
  87. "paging": {
  88. "enabled": true,
  89. "limit": 5,
  90. "size": log_pagination_size
  91. },
  92. "filtering": {
  93. "enabled": true,
  94. "position": "left",
  95. "placeholder": lang.filter_table
  96. },
  97. "sorting": {
  98. "enabled": true
  99. }
  100. });
  101. }
  102. function draw_fail2ban_logs() {
  103. ft_fail2ban_logs = FooTable.init('#fail2ban_log', {
  104. "columns": [
  105. {"name":"time","formatter":function unix_time_format(tm) { var date = new Date(tm ? tm * 1000 : 0); return date.toLocaleString();},"title":lang.time,"style":{"width":"170px"}},
  106. {"name":"priority","title":lang.priority,"style":{"width":"80px"}},
  107. {"name":"message","title":lang.message},
  108. ],
  109. "rows": $.ajax({
  110. dataType: 'json',
  111. url: '/api/v1/get/logs/fail2ban/1000',
  112. jsonp: false,
  113. error: function () {
  114. console.log('Cannot draw fail2ban log table');
  115. },
  116. success: function (data) {
  117. $.each(data, function (i, item) {
  118. var danger_class = ["emerg", "alert", "crit", "err"];
  119. var warning_class = ["warning", "warn"];
  120. var info_class = ["notice", "info", "debug"];
  121. item.message = escapeHtml(item.message);
  122. if (jQuery.inArray(item.priority, danger_class) !== -1) {
  123. item.priority = '<span class="label label-danger">' + item.priority + '</span>';
  124. }
  125. else if (jQuery.inArray(item.priority, warning_class) !== -1) {
  126. item.priority = '<span class="label label-warning">' + item.priority + '</span>';
  127. }
  128. else if (jQuery.inArray(item.priority, info_class) !== -1) {
  129. item.priority = '<span class="label label-info">' + item.priority + '</span>';
  130. }
  131. });
  132. }
  133. }),
  134. "empty": lang.empty,
  135. "paging": {
  136. "enabled": true,
  137. "limit": 5,
  138. "size": log_pagination_size
  139. },
  140. "filtering": {
  141. "enabled": true,
  142. "position": "left",
  143. "connectors": false,
  144. "placeholder": lang.filter_table
  145. },
  146. "sorting": {
  147. "enabled": true
  148. }
  149. });
  150. }
  151. function draw_sogo_logs() {
  152. ft_sogo_logs = FooTable.init('#sogo_log', {
  153. "columns": [
  154. {"name":"time","formatter":function unix_time_format(tm) { var date = new Date(tm ? tm * 1000 : 0); return date.toLocaleString();},"title":lang.time,"style":{"width":"170px"}},
  155. {"name":"priority","title":lang.priority,"style":{"width":"80px"}},
  156. {"name":"message","title":lang.message},
  157. ],
  158. "rows": $.ajax({
  159. dataType: 'json',
  160. url: '/api/v1/get/logs/sogo/1000',
  161. jsonp: false,
  162. error: function () {
  163. console.log('Cannot draw sogo log table');
  164. },
  165. success: function (data) {
  166. $.each(data, function (i, item) {
  167. var danger_class = ["emerg", "alert", "crit", "err"];
  168. var warning_class = ["warning", "warn"];
  169. var info_class = ["notice", "info", "debug"];
  170. item.message = escapeHtml(item.message);
  171. if (jQuery.inArray(item.priority, danger_class) !== -1) {
  172. item.priority = '<span class="label label-danger">' + item.priority + '</span>';
  173. }
  174. else if (jQuery.inArray(item.priority, warning_class) !== -1) {
  175. item.priority = '<span class="label label-warning">' + item.priority + '</span>';
  176. }
  177. else if (jQuery.inArray(item.priority, info_class) !== -1) {
  178. item.priority = '<span class="label label-info">' + item.priority + '</span>';
  179. }
  180. });
  181. }
  182. }),
  183. "empty": lang.empty,
  184. "paging": {
  185. "enabled": true,
  186. "limit": 5,
  187. "size": log_pagination_size
  188. },
  189. "filtering": {
  190. "enabled": true,
  191. "position": "left",
  192. "connectors": false,
  193. "placeholder": lang.filter_table
  194. },
  195. "sorting": {
  196. "enabled": true
  197. }
  198. });
  199. }
  200. function draw_dovecot_logs() {
  201. ft_postfix_logs = FooTable.init('#dovecot_log', {
  202. "columns": [
  203. {"name":"time","formatter":function unix_time_format(tm) { var date = new Date(tm ? tm * 1000 : 0); return date.toLocaleString();},"title":lang.time,"style":{"width":"170px"}},
  204. {"name":"priority","title":lang.priority,"style":{"width":"80px"}},
  205. {"name":"message","title":lang.message},
  206. ],
  207. "rows": $.ajax({
  208. dataType: 'json',
  209. url: '/api/v1/get/logs/dovecot/1000',
  210. jsonp: false,
  211. error: function () {
  212. console.log('Cannot draw dovecot log table');
  213. },
  214. success: function (data) {
  215. $.each(data, function (i, item) {
  216. var danger_class = ["emerg", "alert", "crit", "err"];
  217. var warning_class = ["warning", "warn"];
  218. var info_class = ["notice", "info", "debug"];
  219. item.message = escapeHtml(item.message);
  220. if (jQuery.inArray(item.priority, danger_class) !== -1) {
  221. item.priority = '<span class="label label-danger">' + item.priority + '</span>';
  222. }
  223. else if (jQuery.inArray(item.priority, warning_class) !== -1) {
  224. item.priority = '<span class="label label-warning">' + item.priority + '</span>';
  225. }
  226. else if (jQuery.inArray(item.priority, info_class) !== -1) {
  227. item.priority = '<span class="label label-info">' + item.priority + '</span>';
  228. }
  229. });
  230. }
  231. }),
  232. "empty": lang.empty,
  233. "paging": {
  234. "enabled": true,
  235. "limit": 5,
  236. "size": log_pagination_size
  237. },
  238. "filtering": {
  239. "enabled": true,
  240. "position": "left",
  241. "connectors": false,
  242. "placeholder": lang.filter_table
  243. },
  244. "sorting": {
  245. "enabled": true
  246. }
  247. });
  248. }
  249. function draw_domain_admins() {
  250. ft_domainadmins = FooTable.init('#domainadminstable', {
  251. "columns": [
  252. {"name":"chkbox","title":"","style":{"maxWidth":"40px","width":"40px"},"filterable": false,"sortable": false,"type":"html"},
  253. {"sorted": true,"name":"username","title":lang.username,"style":{"width":"250px"}},
  254. {"name":"selected_domains","title":lang.admin_domains,"breakpoints":"xs sm"},
  255. {"name":"tfa_active","title":"TFA", "filterable": false,"style":{"maxWidth":"80px","width":"80px"}},
  256. {"name":"active","filterable": false,"style":{"maxWidth":"80px","width":"80px"},"title":lang.active},
  257. {"name":"action","filterable": false,"sortable": false,"style":{"text-align":"right","maxWidth":"180px","width":"180px"},"type":"html","title":lang.action,"breakpoints":"xs sm"}
  258. ],
  259. "rows": $.ajax({
  260. dataType: 'json',
  261. url: '/api/v1/get/domain-admin/all',
  262. jsonp: false,
  263. error: function () {
  264. console.log('Cannot draw domain admin table');
  265. },
  266. success: function (data) {
  267. $.each(data, function (i, item) {
  268. item.chkbox = '<input type="checkbox" data-id="domain_admins" name="multi_select" value="' + item.username + '" />';
  269. item.action = '<div class="btn-group">' +
  270. '<a href="/edit.php?domainadmin=' + encodeURI(item.username) + '" class="btn btn-xs btn-default"><span class="glyphicon glyphicon-pencil"></span> ' + lang.edit + '</a>' +
  271. '<a href="#" id="delete_selected" data-id="single-domain-admin" data-api-url="delete/domain-admin" data-item="' + encodeURI(item.username) + '" class="btn btn-xs btn-danger"><span class="glyphicon glyphicon-trash"></span> ' + lang.remove + '</a>' +
  272. '</div>';
  273. });
  274. }
  275. }),
  276. "empty": lang.empty,
  277. "paging": {
  278. "enabled": true,
  279. "limit": 5,
  280. "size": log_pagination_size
  281. },
  282. "filtering": {
  283. "enabled": true,
  284. "position": "left",
  285. "connectors": false,
  286. "placeholder": lang.filter_table
  287. },
  288. "sorting": {
  289. "enabled": true
  290. }
  291. });
  292. }
  293. function draw_fwd_hosts() {
  294. ft_forwardinghoststable = FooTable.init('#forwardinghoststable', {
  295. "columns": [
  296. {"name":"chkbox","title":"","style":{"maxWidth":"40px","width":"40px"},"filterable": false,"sortable": false,"type":"html"},
  297. {"name":"host","type":"text","title":lang.host,"style":{"width":"250px"}},
  298. {"name":"source","title":lang.source,"breakpoints":"xs sm"},
  299. {"name":"keep_spam","title":lang.spamfilter, "type": "text","style":{"maxWidth":"80px","width":"80px"}},
  300. {"name":"action","filterable": false,"sortable": false,"style":{"text-align":"right","maxWidth":"180px","width":"180px"},"type":"html","title":lang.action,"breakpoints":"xs sm"}
  301. ],
  302. "rows": $.ajax({
  303. dataType: 'json',
  304. url: '/api/v1/get/fwdhost/all',
  305. jsonp: false,
  306. error: function () {
  307. console.log('Cannot draw forwarding hosts table');
  308. },
  309. success: function (data) {
  310. $.each(data, function (i, item) {
  311. item.action = '<div class="btn-group">' +
  312. '<a href="#" id="delete_selected" data-id="single-fwdhost" data-api-url="delete/fwdhost" data-item="' + encodeURI(item.host) + '" class="btn btn-xs btn-danger"><span class="glyphicon glyphicon-trash"></span> ' + lang.remove + '</a>' +
  313. '</div>';
  314. if (item.keep_spam == "yes") {
  315. item.keep_spam = lang.no;
  316. }
  317. else {
  318. item.keep_spam = lang.yes;
  319. }
  320. item.chkbox = '<input type="checkbox" data-id="fwdhosts" name="multi_select" value="' + item.host + '" />';
  321. });
  322. }
  323. }),
  324. "empty": lang.empty,
  325. "paging": {
  326. "enabled": true,
  327. "limit": 5,
  328. "size": log_pagination_size
  329. },
  330. "sorting": {
  331. "enabled": true
  332. }
  333. });
  334. }
  335. function draw_relayhosts() {
  336. ft_forwardinghoststable = FooTable.init('#relayhoststable', {
  337. "columns": [
  338. {"name":"chkbox","title":"","style":{"maxWidth":"40px","width":"40px"},"filterable": false,"sortable": false,"type":"html"},
  339. {"name":"id","type":"text","title":"ID","style":{"width":"50px"}},
  340. {"name":"hostname","type":"text","title":lang.host,"style":{"width":"250px"}},
  341. {"name":"username","title":lang.username,"breakpoints":"xs sm"},
  342. {"name":"used_by_domains","title":lang.in_use_by, "type": "text","breakpoints":"xs sm"},
  343. {"name":"active","filterable": false,"style":{"maxWidth":"80px","width":"80px"},"title":lang.active},
  344. {"name":"action","filterable": false,"sortable": false,"style":{"text-align":"right","maxWidth":"280px","width":"280px"},"type":"html","title":lang.action,"breakpoints":"xs sm"}
  345. ],
  346. "rows": $.ajax({
  347. dataType: 'json',
  348. url: '/api/v1/get/relayhost/all',
  349. jsonp: false,
  350. error: function () {
  351. console.log('Cannot draw forwarding hosts table');
  352. },
  353. success: function (data) {
  354. $.each(data, function (i, item) {
  355. item.action = '<div class="btn-group">' +
  356. '<a href="#" data-toggle="modal" id="miau" data-target="#testRelayhostModal" data-relayhost-id="' + encodeURI(item.id) + '" class="btn btn-xs btn-default"><span class="glyphicon glyphicon-stats"></span> Test</a>' +
  357. '<a href="/edit.php?relayhost=' + encodeURI(item.id) + '" class="btn btn-xs btn-default"><span class="glyphicon glyphicon-pencil"></span> ' + lang.edit + '</a>' +
  358. '<a href="#" id="delete_selected" data-id="single-rlshost" data-api-url="delete/relayhost" data-item="' + encodeURI(item.id) + '" class="btn btn-xs btn-danger"><span class="glyphicon glyphicon-trash"></span> ' + lang.remove + '</a>' +
  359. '</div>';
  360. item.chkbox = '<input type="checkbox" data-id="rlyhosts" name="multi_select" value="' + item.id + '" />';
  361. });
  362. }
  363. }),
  364. "empty": lang.empty,
  365. "paging": {
  366. "enabled": true,
  367. "limit": 5,
  368. "size": log_pagination_size
  369. },
  370. "sorting": {
  371. "enabled": true
  372. }
  373. });
  374. }
  375. function draw_rspamd_history() {
  376. ft_postfix_logs = FooTable.init('#rspamd_history', {
  377. "columns": [{
  378. "name":"unix_time",
  379. "formatter":function unix_time_format(tm) { var date = new Date(tm ? tm * 1000 : 0); return date.toLocaleString();},
  380. "title":lang.time,
  381. "style":{
  382. "width":"170px"
  383. }
  384. }, {
  385. "name": "ip",
  386. "title": "IP address",
  387. "breakpoints": "all",
  388. "style": {
  389. "minWidth": 88
  390. }
  391. }, {
  392. "name": "sender_mime",
  393. "title": "From",
  394. "breakpoints": "xs sm md",
  395. "style": {
  396. "minWidth": 100
  397. }
  398. }, {
  399. "name": "rcpt_mime",
  400. "title": "To",
  401. "breakpoints": "xs sm md",
  402. "style": {
  403. "minWidth": 100
  404. }
  405. }, {
  406. "name": "subject",
  407. "title": "Subject",
  408. "breakpoints": "all",
  409. "style": {
  410. "word-break": "break-all",
  411. "minWidth": 150
  412. }
  413. }, {
  414. "name": "action",
  415. "title": "Action",
  416. "style": {
  417. "minwidth": 82
  418. }
  419. }, {
  420. "name": "score",
  421. "title": "Score",
  422. "style": {
  423. "maxWidth": 110
  424. },
  425. }, {
  426. "name": "symbols",
  427. "title": "Symbols",
  428. "breakpoints": "all",
  429. }, {
  430. "name": "size",
  431. "title": "Msg size",
  432. "breakpoints": "all",
  433. "style": {
  434. "minwidth": 50,
  435. },
  436. "formatter": function(value) { return humanFileSize(value); }
  437. }, {
  438. "name": "scan_time",
  439. "title": "Scan time",
  440. "breakpoints": "all",
  441. "style": {
  442. "maxWidth": 72
  443. },
  444. }, {
  445. "name": "message-id",
  446. "title": "ID",
  447. "breakpoints": "all",
  448. "style": {
  449. "minWidth": 130,
  450. "overflow": "hidden",
  451. "textOverflow": "ellipsis",
  452. "wordBreak": "break-all",
  453. "whiteSpace": "normal"
  454. }
  455. }, {
  456. "name": "user",
  457. "title": "Authenticated user",
  458. "breakpoints": "xs sm md",
  459. "style": {
  460. "minWidth": 100
  461. }
  462. }],
  463. "rows": $.ajax({
  464. dataType: 'json',
  465. url: '/api/v1/get/logs/rspamd-history',
  466. jsonp: false,
  467. error: function () {
  468. console.log('Cannot draw rspamd history table');
  469. },
  470. success: function (data) {
  471. $.each(data, function (i, item) {
  472. item.rcpt_mime = item.rcpt_mime.join(",&#8203;");
  473. Object.keys(item.symbols).map(function(key) {
  474. var sym = item.symbols[key];
  475. if (sym.score <= 0) {
  476. sym.score_formatted = '(<span class="text-success"><b>' + sym.score + '</b></span>)'
  477. }
  478. else {
  479. sym.score_formatted = '(<span class="text-danger"><b>' + sym.score + '</b></span>)'
  480. }
  481. var str = '<strong>' + key + '</strong> ' + sym.score_formatted;
  482. if (sym.options) {
  483. str += ' [' + sym.options.join(",") + "]";
  484. }
  485. item.symbols[key].str = str;
  486. });
  487. item.symbols = Object.keys(item.symbols).
  488. map(function(key) {
  489. return item.symbols[key];
  490. }).sort(function(e1, e2) {
  491. return Math.abs(e1.score) < Math.abs(e2.score);
  492. }).map(function(e) {
  493. return e.str;
  494. }).join("<br>\n");
  495. var scan_time = item.time_real.toFixed(3) + ' / ' + item.time_virtual.toFixed(3);
  496. item.scan_time = {
  497. "options": {
  498. "sortValue": item.time_real
  499. },
  500. "value": scan_time
  501. };
  502. if (item.action === 'clean' || item.action === 'no action') {
  503. item.action = "<div class='label label-success'>" + item.action + "</div>";
  504. } else if (item.action === 'rewrite subject' || item.action === 'add header' || item.action === 'probable spam') {
  505. item.action = "<div class='label label-warning'>" + item.action + "</div>";
  506. } else if (item.action === 'spam' || item.action === 'reject') {
  507. item.action = "<div class='label label-danger'>" + item.action + "</div>";
  508. } else {
  509. item.action = "<div class='label label-info'>" + item.action + "</div>";
  510. }
  511. var score_content;
  512. if (item.score < item.required_score) {
  513. score_content = "[ <span class='text-success'>" + item.score.toFixed(2) + " / " + item.required_score + "</span> ]";
  514. } else {
  515. score_content = "[ <span class='text-danger'>" + item.score.toFixed(2) + " / " + item.required_score + "</span> ]";
  516. }
  517. item.score = {
  518. "options": {
  519. "sortValue": item.score
  520. },
  521. "value": score_content
  522. };
  523. if (item.user == null) {
  524. item.user = "none";
  525. }
  526. });
  527. }
  528. }),
  529. "empty": lang.empty,
  530. "paging": {
  531. "enabled": true,
  532. "limit": 5,
  533. "size": log_pagination_size
  534. },
  535. "filtering": {
  536. "enabled": true,
  537. "position": "left",
  538. "connectors": false,
  539. "placeholder": lang.filter_table
  540. },
  541. "sorting": {
  542. "enabled": true
  543. }
  544. });
  545. }
  546. draw_postfix_logs();
  547. draw_dovecot_logs();
  548. draw_sogo_logs();
  549. draw_fail2ban_logs();
  550. draw_domain_admins();
  551. draw_fwd_hosts();
  552. draw_relayhosts();
  553. draw_rspamd_history();
  554. $('#testRelayhostModal').on('show.bs.modal', function (e) {
  555. $('#test_relayhost_result').text("-");
  556. button = $(e.relatedTarget)
  557. if (button != null) {
  558. $('#relayhost_id').val(button.data('relayhost-id'));
  559. }
  560. })
  561. $('#test_relayhost').on('click', function (e) {
  562. e.preventDefault();
  563. prev = $('#test_relayhost').text();
  564. $(this).prop("disabled",true);
  565. $(this).html('<span class="glyphicon glyphicon-refresh glyphicon-spin"></span> ');
  566. $.ajax({
  567. type: 'GET',
  568. url: 'inc/relay_check.php',
  569. dataType: 'text',
  570. data: $('#test_relayhost_form').serialize(),
  571. complete: function (data) {
  572. $('#test_relayhost_result').html(data.responseText);
  573. $('#test_relayhost').prop("disabled",false);
  574. $('#test_relayhost').text(prev);
  575. }
  576. });
  577. })
  578. });
  579. $(window).load(function(){
  580. initial_width = $("#sidebar-admin").width();
  581. $("#scrollbox").css("width", initial_width);
  582. $(window).bind('scroll', function() {
  583. if ($(window).scrollTop() > 70) {
  584. $('#scrollbox').addClass('scrollboxFixed');
  585. } else {
  586. $('#scrollbox').removeClass('scrollboxFixed');
  587. }
  588. });
  589. });
  590. function resizeScrollbox() {
  591. on_resize_width = $("#sidebar-admin").width();
  592. $("#scrollbox").removeAttr("style");
  593. $("#scrollbox").css("width", on_resize_width);
  594. }
  595. $(window).on('resize', resizeScrollbox);
  596. $('a[data-toggle="tab"]').on('shown.bs.tab', resizeScrollbox);