index.js 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896
  1. var Index = function () {
  2. return {
  3. //main function to initiate the module
  4. init: function () {
  5. App.addResponsiveHandler(function () {
  6. Index.initCalendar();
  7. jQuery('.vmaps').each(function () {
  8. var map = jQuery(this);
  9. map.width(map.parent().width());
  10. });
  11. });
  12. },
  13. initJQVMAP: function () {
  14. var showMap = function (name) {
  15. jQuery('.vmaps').hide();
  16. jQuery('#vmap_' + name).show();
  17. }
  18. var setMap = function (name) {
  19. var data = {
  20. map: 'world_en',
  21. backgroundColor: null,
  22. borderColor: '#333333',
  23. borderOpacity: 0.5,
  24. borderWidth: 1,
  25. color: '#c6c6c6',
  26. enableZoom: true,
  27. hoverColor: '#c9dfaf',
  28. hoverOpacity: null,
  29. values: sample_data,
  30. normalizeFunction: 'linear',
  31. scaleColors: ['#b6da93', '#909cae'],
  32. selectedColor: '#c9dfaf',
  33. selectedRegion: null,
  34. showTooltip: true,
  35. onLabelShow: function (event, label, code) {
  36. },
  37. onRegionOver: function (event, code) {
  38. if (code == 'ca') {
  39. event.preventDefault();
  40. }
  41. },
  42. onRegionClick: function (element, code, region) {
  43. var message = 'You clicked "' + region + '" which has the code: ' + code.toUpperCase();
  44. alert(message);
  45. }
  46. };
  47. data.map = name + '_en';
  48. var map = jQuery('#vmap_' + name);
  49. if (!map) {
  50. return;
  51. }
  52. map.width(map.parent().parent().width());
  53. map.show();
  54. map.vectorMap(data);
  55. map.hide();
  56. }
  57. setMap("world");
  58. setMap("usa");
  59. setMap("europe");
  60. setMap("russia");
  61. setMap("germany");
  62. showMap("world");
  63. jQuery('#regional_stat_world').click(function () {
  64. showMap("world");
  65. });
  66. jQuery('#regional_stat_usa').click(function () {
  67. showMap("usa");
  68. });
  69. jQuery('#regional_stat_europe').click(function () {
  70. showMap("europe");
  71. });
  72. jQuery('#regional_stat_russia').click(function () {
  73. showMap("russia");
  74. });
  75. jQuery('#regional_stat_germany').click(function () {
  76. showMap("germany");
  77. });
  78. $('#region_statistics_loading').hide();
  79. $('#region_statistics_content').show();
  80. },
  81. initCalendar: function () {
  82. if (!jQuery().fullCalendar) {
  83. return;
  84. }
  85. var date = new Date();
  86. var d = date.getDate();
  87. var m = date.getMonth();
  88. var y = date.getFullYear();
  89. var h = {};
  90. if ($('#calendar').width() <= 400) {
  91. $('#calendar').addClass("mobile");
  92. h = {
  93. left: 'title, prev, next',
  94. center: '',
  95. right: 'today,month,agendaWeek,agendaDay'
  96. };
  97. } else {
  98. $('#calendar').removeClass("mobile");
  99. if (App.isRTL()) {
  100. h = {
  101. right: 'title',
  102. center: '',
  103. left: 'prev,next,today,month,agendaWeek,agendaDay'
  104. };
  105. } else {
  106. h = {
  107. left: 'title',
  108. center: '',
  109. right: 'prev,next,today,month,agendaWeek,agendaDay'
  110. };
  111. }
  112. }
  113. $('#calendar').fullCalendar('destroy'); // destroy the calendar
  114. $('#calendar').fullCalendar({ //re-initialize the calendar
  115. disableDragging: false,
  116. header: h,
  117. editable: true,
  118. events: [{
  119. title: 'All Day Event',
  120. start: new Date(y, m, 1),
  121. backgroundColor: App.getLayoutColorCode('yellow')
  122. }, {
  123. title: 'Long Event',
  124. start: new Date(y, m, d - 5),
  125. end: new Date(y, m, d - 2),
  126. backgroundColor: App.getLayoutColorCode('green')
  127. }, {
  128. title: 'Repeating Event',
  129. start: new Date(y, m, d - 3, 16, 0),
  130. allDay: false,
  131. backgroundColor: App.getLayoutColorCode('red')
  132. }, {
  133. title: 'Repeating Event',
  134. start: new Date(y, m, d + 4, 16, 0),
  135. allDay: false,
  136. backgroundColor: App.getLayoutColorCode('green')
  137. }, {
  138. title: 'Meeting',
  139. start: new Date(y, m, d, 10, 30),
  140. allDay: false,
  141. }, {
  142. title: 'Lunch',
  143. start: new Date(y, m, d, 12, 0),
  144. end: new Date(y, m, d, 14, 0),
  145. backgroundColor: App.getLayoutColorCode('grey'),
  146. allDay: false,
  147. }, {
  148. title: 'Birthday Party',
  149. start: new Date(y, m, d + 1, 19, 0),
  150. end: new Date(y, m, d + 1, 22, 30),
  151. backgroundColor: App.getLayoutColorCode('purple'),
  152. allDay: false,
  153. }, {
  154. title: 'Click for Google',
  155. start: new Date(y, m, 28),
  156. end: new Date(y, m, 29),
  157. backgroundColor: App.getLayoutColorCode('yellow'),
  158. url: 'http://google.com/',
  159. }
  160. ]
  161. });
  162. },
  163. initCharts: function () {
  164. if (!jQuery.plot) {
  165. return;
  166. }
  167. var data = [];
  168. var totalPoints = 250;
  169. // random data generator for plot charts
  170. function getRandomData() {
  171. if (data.length > 0) data = data.slice(1);
  172. // do a random walk
  173. while (data.length < totalPoints) {
  174. var prev = data.length > 0 ? data[data.length - 1] : 50;
  175. var y = prev + Math.random() * 10 - 5;
  176. if (y < 0) y = 0;
  177. if (y > 100) y = 100;
  178. data.push(y);
  179. }
  180. // zip the generated y values with the x values
  181. var res = [];
  182. for (var i = 0; i < data.length; ++i) res.push([i, data[i]])
  183. return res;
  184. }
  185. function showTooltip(title, x, y, contents) {
  186. $('<div id="tooltip" class="chart-tooltip"><div class="date">' + title + '<\/div><div class="label label-success">CTR: ' + x / 10 + '%<\/div><div class="label label-important">Imp: ' + x * 12 + '<\/div><\/div>').css({
  187. position: 'absolute',
  188. display: 'none',
  189. top: y - 100,
  190. width: 75,
  191. left: x - 40,
  192. border: '0px solid #ccc',
  193. padding: '2px 6px',
  194. 'background-color': '#fff',
  195. }).appendTo("body").fadeIn(200);
  196. }
  197. function randValue() {
  198. return (Math.floor(Math.random() * (1 + 50 - 20))) + 10;
  199. }
  200. var pageviews = [
  201. [1, randValue()],
  202. [2, randValue()],
  203. [3, 2 + randValue()],
  204. [4, 3 + randValue()],
  205. [5, 5 + randValue()],
  206. [6, 10 + randValue()],
  207. [7, 15 + randValue()],
  208. [8, 20 + randValue()],
  209. [9, 25 + randValue()],
  210. [10, 30 + randValue()],
  211. [11, 35 + randValue()],
  212. [12, 25 + randValue()],
  213. [13, 15 + randValue()],
  214. [14, 20 + randValue()],
  215. [15, 45 + randValue()],
  216. [16, 50 + randValue()],
  217. [17, 65 + randValue()],
  218. [18, 70 + randValue()],
  219. [19, 85 + randValue()],
  220. [20, 80 + randValue()],
  221. [21, 75 + randValue()],
  222. [22, 80 + randValue()],
  223. [23, 75 + randValue()],
  224. [24, 70 + randValue()],
  225. [25, 65 + randValue()],
  226. [26, 75 + randValue()],
  227. [27, 80 + randValue()],
  228. [28, 85 + randValue()],
  229. [29, 90 + randValue()],
  230. [30, 95 + randValue()]
  231. ];
  232. var visitors = [
  233. [1, randValue() - 5],
  234. [2, randValue() - 5],
  235. [3, randValue() - 5],
  236. [4, 6 + randValue()],
  237. [5, 5 + randValue()],
  238. [6, 20 + randValue()],
  239. [7, 25 + randValue()],
  240. [8, 36 + randValue()],
  241. [9, 26 + randValue()],
  242. [10, 38 + randValue()],
  243. [11, 39 + randValue()],
  244. [12, 50 + randValue()],
  245. [13, 51 + randValue()],
  246. [14, 12 + randValue()],
  247. [15, 13 + randValue()],
  248. [16, 14 + randValue()],
  249. [17, 15 + randValue()],
  250. [18, 15 + randValue()],
  251. [19, 16 + randValue()],
  252. [20, 17 + randValue()],
  253. [21, 18 + randValue()],
  254. [22, 19 + randValue()],
  255. [23, 20 + randValue()],
  256. [24, 21 + randValue()],
  257. [25, 14 + randValue()],
  258. [26, 24 + randValue()],
  259. [27, 25 + randValue()],
  260. [28, 26 + randValue()],
  261. [29, 27 + randValue()],
  262. [30, 31 + randValue()]
  263. ];
  264. if ($('#site_statistics').size() != 0) {
  265. $('#site_statistics_loading').hide();
  266. $('#site_statistics_content').show();
  267. var plot_statistics = $.plot($("#site_statistics"), [{
  268. data: pageviews,
  269. label: "Unique Visits"
  270. }, {
  271. data: visitors,
  272. label: "Page Views"
  273. }
  274. ], {
  275. series: {
  276. lines: {
  277. show: true,
  278. lineWidth: 2,
  279. fill: true,
  280. fillColor: {
  281. colors: [{
  282. opacity: 0.05
  283. }, {
  284. opacity: 0.01
  285. }
  286. ]
  287. }
  288. },
  289. points: {
  290. show: true
  291. },
  292. shadowSize: 2
  293. },
  294. grid: {
  295. hoverable: true,
  296. clickable: true,
  297. tickColor: "#eee",
  298. borderWidth: 0
  299. },
  300. colors: ["#d12610", "#37b7f3", "#52e136"],
  301. xaxis: {
  302. ticks: 11,
  303. tickDecimals: 0
  304. },
  305. yaxis: {
  306. ticks: 11,
  307. tickDecimals: 0
  308. }
  309. });
  310. var previousPoint = null;
  311. $("#site_statistics").bind("plothover", function (event, pos, item) {
  312. $("#x").text(pos.x.toFixed(2));
  313. $("#y").text(pos.y.toFixed(2));
  314. if (item) {
  315. if (previousPoint != item.dataIndex) {
  316. previousPoint = item.dataIndex;
  317. $("#tooltip").remove();
  318. var x = item.datapoint[0].toFixed(2),
  319. y = item.datapoint[1].toFixed(2);
  320. showTooltip('24 Jan 2013', item.pageX, item.pageY, item.series.label + " of " + x + " = " + y);
  321. }
  322. } else {
  323. $("#tooltip").remove();
  324. previousPoint = null;
  325. }
  326. });
  327. }
  328. if ($('#load_statistics').size() != 0) {
  329. //server load
  330. $('#load_statistics_loading').hide();
  331. $('#load_statistics_content').show();
  332. var updateInterval = 30;
  333. var plot_statistics = $.plot($("#load_statistics"), [getRandomData()], {
  334. series: {
  335. shadowSize: 1
  336. },
  337. lines: {
  338. show: true,
  339. lineWidth: 0.2,
  340. fill: true,
  341. fillColor: {
  342. colors: [{
  343. opacity: 0.1
  344. }, {
  345. opacity: 1
  346. }
  347. ]
  348. }
  349. },
  350. yaxis: {
  351. min: 0,
  352. max: 100,
  353. tickFormatter: function (v) {
  354. return v + "%";
  355. }
  356. },
  357. xaxis: {
  358. show: false
  359. },
  360. colors: ["#e14e3d"],
  361. grid: {
  362. tickColor: "#a8a3a3",
  363. borderWidth: 0
  364. }
  365. });
  366. function statisticsUpdate() {
  367. plot_statistics.setData([getRandomData()]);
  368. plot_statistics.draw();
  369. setTimeout(statisticsUpdate, updateInterval);
  370. }
  371. statisticsUpdate();
  372. $('#load_statistics').bind("mouseleave", function () {
  373. $("#tooltip").remove();
  374. });
  375. }
  376. if ($('#site_activities').size() != 0) {
  377. //site activities
  378. var previousPoint2 = null;
  379. $('#site_activities_loading').hide();
  380. $('#site_activities_content').show();
  381. var activities = [
  382. [1, 10],
  383. [2, 9],
  384. [3, 8],
  385. [4, 6],
  386. [5, 5],
  387. [6, 3],
  388. [7, 9],
  389. [8, 10],
  390. [9, 12],
  391. [10, 14],
  392. [11, 15],
  393. [12, 13],
  394. [13, 11],
  395. [14, 10],
  396. [15, 9],
  397. [16, 8],
  398. [17, 12],
  399. [18, 14],
  400. [19, 16],
  401. [20, 19],
  402. [21, 20],
  403. [22, 20],
  404. [23, 19],
  405. [24, 17],
  406. [25, 15],
  407. [25, 14],
  408. [26, 12],
  409. [27, 10],
  410. [28, 8],
  411. [29, 10],
  412. [30, 12],
  413. [31, 10],
  414. [32, 9],
  415. [33, 8],
  416. [34, 6],
  417. [35, 5],
  418. [36, 3],
  419. [37, 9],
  420. [38, 10],
  421. [39, 12],
  422. [40, 14],
  423. [41, 15],
  424. [42, 13],
  425. [43, 11],
  426. [44, 10],
  427. [45, 9],
  428. [46, 8],
  429. [47, 12],
  430. [48, 14],
  431. [49, 16],
  432. [50, 12],
  433. [51, 10]
  434. ];
  435. var plot_activities = $.plot(
  436. $("#site_activities"), [{
  437. data: activities,
  438. color: "rgba(107,207,123, 0.9)",
  439. shadowSize: 0,
  440. bars: {
  441. show: true,
  442. lineWidth: 0,
  443. fill: true,
  444. fillColor: {
  445. colors: [{
  446. opacity: 1
  447. }, {
  448. opacity: 1
  449. }
  450. ]
  451. }
  452. }
  453. }
  454. ], {
  455. series: {
  456. bars: {
  457. show: true,
  458. barWidth: 0.9
  459. }
  460. },
  461. grid: {
  462. show: false,
  463. hoverable: true,
  464. clickable: false,
  465. autoHighlight: true,
  466. borderWidth: 0
  467. },
  468. yaxis: {
  469. min: 0,
  470. max: 20
  471. }
  472. });
  473. $("#site_activities").bind("plothover", function (event, pos, item) {
  474. $("#x").text(pos.x.toFixed(2));
  475. $("#y").text(pos.y.toFixed(2));
  476. if (item) {
  477. if (previousPoint2 != item.dataIndex) {
  478. previousPoint2 = item.dataIndex;
  479. $("#tooltip").remove();
  480. var x = item.datapoint[0].toFixed(2),
  481. y = item.datapoint[1].toFixed(2);
  482. showTooltip('24 Feb 2013', item.pageX, item.pageY, x);
  483. }
  484. }
  485. });
  486. $('#site_activities').bind("mouseleave", function () {
  487. $("#tooltip").remove();
  488. });
  489. }
  490. },
  491. initMiniCharts: function () {
  492. $('.easy-pie-chart .number.transactions').easyPieChart({
  493. animate: 1000,
  494. size: 75,
  495. lineWidth: 3,
  496. barColor: App.getLayoutColorCode('yellow')
  497. });
  498. $('.easy-pie-chart .number.visits').easyPieChart({
  499. animate: 1000,
  500. size: 75,
  501. lineWidth: 3,
  502. barColor: App.getLayoutColorCode('green')
  503. });
  504. $('.easy-pie-chart .number.bounce').easyPieChart({
  505. animate: 1000,
  506. size: 75,
  507. lineWidth: 3,
  508. barColor: App.getLayoutColorCode('red')
  509. });
  510. $('.easy-pie-chart-reload').click(function(){
  511. $('.easy-pie-chart .number').each(function() {
  512. var newValue = Math.floor(100*Math.random());
  513. $(this).data('easyPieChart').update(newValue);
  514. $('span', this).text(newValue);
  515. });
  516. });
  517. $("#sparkline_bar").sparkline([8,9,10,11,10,10,12,10,10,11,9,12,11,10,9,11,13,13,12], {
  518. type: 'bar',
  519. width: '100',
  520. barWidth: 5,
  521. height: '55',
  522. barColor: '#35aa47',
  523. negBarColor: '#e02222'}
  524. );
  525. $("#sparkline_bar2").sparkline([9,11,12,13,12,13,10,14,13,11,11,12,11,11,10,12,11,10], {
  526. type: 'bar',
  527. width: '100',
  528. barWidth: 5,
  529. height: '55',
  530. barColor: '#ffb848',
  531. negBarColor: '#e02222'}
  532. );
  533. $("#sparkline_line").sparkline([9,10,9,10,10,11,12,10,10,11,11,12,11,10,12,11,10,12], {
  534. type: 'line',
  535. width: '100',
  536. height: '55',
  537. lineColor: '#ffb848'
  538. });
  539. },
  540. initChat: function () {
  541. var cont = $('#chats');
  542. var list = $('.chats', cont);
  543. var form = $('.chat-form', cont);
  544. var input = $('input', form);
  545. var btn = $('.btn', form);
  546. var handleClick = function (e) {
  547. e.preventDefault();
  548. var text = input.val();
  549. if (text.length == 0) {
  550. return;
  551. }
  552. var time = new Date();
  553. var time_str = time.toString('MMM dd, yyyy hh:mm');
  554. var tpl = '';
  555. tpl += '<li class="out">';
  556. tpl += '<img class="avatar" alt="" src="assets/img/avatar1.jpg"/>';
  557. tpl += '<div class="message">';
  558. tpl += '<span class="arrow"></span>';
  559. tpl += '<a href="#" class="name">Bob Nilson</a>&nbsp;';
  560. tpl += '<span class="datetime">at ' + time_str + '</span>';
  561. tpl += '<span class="body">';
  562. tpl += text;
  563. tpl += '</span>';
  564. tpl += '</div>';
  565. tpl += '</li>';
  566. var msg = list.append(tpl);
  567. input.val("");
  568. $('.scroller', cont).slimScroll({
  569. scrollTo: list.height()
  570. });
  571. }
  572. /*
  573. $('.scroller', cont).slimScroll({
  574. scrollTo: list.height()
  575. });
  576. */
  577. btn.click(handleClick);
  578. input.keypress(function (e) {
  579. if (e.which == 13) {
  580. handleClick();
  581. return false; //<---- Add this line
  582. }
  583. });
  584. },
  585. initDashboardDaterange: function () {
  586. $('#dashboard-report-range').daterangepicker({
  587. ranges: {
  588. 'Today': ['today', 'today'],
  589. 'Yesterday': ['yesterday', 'yesterday'],
  590. 'Last 7 Days': [Date.today().add({
  591. days: -6
  592. }), 'today'],
  593. 'Last 30 Days': [Date.today().add({
  594. days: -29
  595. }), 'today'],
  596. 'This Month': [Date.today().moveToFirstDayOfMonth(), Date.today().moveToLastDayOfMonth()],
  597. 'Last Month': [Date.today().moveToFirstDayOfMonth().add({
  598. months: -1
  599. }), Date.today().moveToFirstDayOfMonth().add({
  600. days: -1
  601. })]
  602. },
  603. opens: (App.isRTL() ? 'right' : 'left'),
  604. format: 'MM/dd/yyyy',
  605. separator: ' to ',
  606. startDate: Date.today().add({
  607. days: -29
  608. }),
  609. endDate: Date.today(),
  610. minDate: '01/01/2012',
  611. maxDate: '12/31/2014',
  612. locale: {
  613. applyLabel: 'Submit',
  614. fromLabel: 'From',
  615. toLabel: 'To',
  616. customRangeLabel: 'Custom Range',
  617. daysOfWeek: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
  618. monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
  619. firstDay: 1
  620. },
  621. showWeekNumbers: true,
  622. buttonClasses: ['btn-danger']
  623. },
  624. function (start, end) {
  625. App.blockUI(jQuery("#dashboard"));
  626. setTimeout(function () {
  627. App.unblockUI(jQuery("#dashboard"));
  628. $.gritter.add({
  629. title: 'Dashboard',
  630. text: 'Dashboard date range updated.'
  631. });
  632. App.scrollTo();
  633. }, 1000);
  634. $('#dashboard-report-range span').html(start.toString('MMMM d, yyyy') + ' - ' + end.toString('MMMM d, yyyy'));
  635. });
  636. $('#dashboard-report-range').show();
  637. $('#dashboard-report-range span').html(Date.today().add({
  638. days: -29
  639. }).toString('MMMM d, yyyy') + ' - ' + Date.today().toString('MMMM d, yyyy'));
  640. },
  641. initIntro: function () {
  642. if ($.cookie('intro_show')) {
  643. return;
  644. }
  645. $.cookie('intro_show', 1);
  646. setTimeout(function () {
  647. var unique_id = $.gritter.add({
  648. // (string | mandatory) the heading of the notification
  649. title: 'Meet Metronic!',
  650. // (string | mandatory) the text inside the notification
  651. text: 'Metronic is a brand new Responsive Admin Dashboard Template you have always been looking for!',
  652. // (string | optional) the image to display on the left
  653. image: './assets/img/avatar1.jpg',
  654. // (bool | optional) if you want it to fade out on its own or just sit there
  655. sticky: true,
  656. // (int | optional) the time you want it to be alive for before fading out
  657. time: '',
  658. // (string | optional) the class name you want to apply to that specific message
  659. class_name: 'my-sticky-class'
  660. });
  661. // You can have it return a unique id, this can be used to manually remove it later using
  662. setTimeout(function () {
  663. $.gritter.remove(unique_id, {
  664. fade: true,
  665. speed: 'slow'
  666. });
  667. }, 12000);
  668. }, 2000);
  669. setTimeout(function () {
  670. var unique_id = $.gritter.add({
  671. // (string | mandatory) the heading of the notification
  672. title: 'Buy Metronic!',
  673. // (string | mandatory) the text inside the notification
  674. text: 'Metronic comes with a huge collection of reusable and easy customizable UI components and plugins. Buy Metronic today!',
  675. // (string | optional) the image to display on the left
  676. image: './assets/img/avatar1.jpg',
  677. // (bool | optional) if you want it to fade out on its own or just sit there
  678. sticky: true,
  679. // (int | optional) the time you want it to be alive for before fading out
  680. time: '',
  681. // (string | optional) the class name you want to apply to that specific message
  682. class_name: 'my-sticky-class'
  683. });
  684. // You can have it return a unique id, this can be used to manually remove it later using
  685. setTimeout(function () {
  686. $.gritter.remove(unique_id, {
  687. fade: true,
  688. speed: 'slow'
  689. });
  690. }, 13000);
  691. }, 8000);
  692. setTimeout(function () {
  693. $('#styler').pulsate({
  694. color: "#bb3319",
  695. repeat: 10
  696. });
  697. $.extend($.gritter.options, {
  698. position: 'top-left'
  699. });
  700. var unique_id = $.gritter.add({
  701. position: 'top-left',
  702. // (string | mandatory) the heading of the notification
  703. title: 'Customize Metronic!',
  704. // (string | mandatory) the text inside the notification
  705. text: 'Metronic allows you to easily customize the theme colors and layout settings.',
  706. // (string | optional) the image to display on the left
  707. image1: './assets/img/avatar1.png',
  708. // (bool | optional) if you want it to fade out on its own or just sit there
  709. sticky: true,
  710. // (int | optional) the time you want it to be alive for before fading out
  711. time: '',
  712. // (string | optional) the class name you want to apply to that specific message
  713. class_name: 'my-sticky-class'
  714. });
  715. $.extend($.gritter.options, {
  716. position: 'top-right'
  717. });
  718. // You can have it return a unique id, this can be used to manually remove it later using
  719. setTimeout(function () {
  720. $.gritter.remove(unique_id, {
  721. fade: true,
  722. speed: 'slow'
  723. });
  724. }, 15000);
  725. }, 23000);
  726. setTimeout(function () {
  727. $.extend($.gritter.options, {
  728. position: 'top-left'
  729. });
  730. var unique_id = $.gritter.add({
  731. // (string | mandatory) the heading of the notification
  732. title: 'Notification',
  733. // (string | mandatory) the text inside the notification
  734. text: 'You have 3 new notifications.',
  735. // (string | optional) the image to display on the left
  736. image1: './assets/img/image1.jpg',
  737. // (bool | optional) if you want it to fade out on its own or just sit there
  738. sticky: true,
  739. // (int | optional) the time you want it to be alive for before fading out
  740. time: '',
  741. // (string | optional) the class name you want to apply to that specific message
  742. class_name: 'my-sticky-class'
  743. });
  744. setTimeout(function () {
  745. $.gritter.remove(unique_id, {
  746. fade: true,
  747. speed: 'slow'
  748. });
  749. }, 4000);
  750. $.extend($.gritter.options, {
  751. position: 'top-right'
  752. });
  753. var number = $('#header_notification_bar .badge').text();
  754. number = parseInt(number);
  755. number = number + 3;
  756. $('#header_notification_bar .badge').text(number);
  757. $('#header_notification_bar').pulsate({
  758. color: "#66bce6",
  759. repeat: 5
  760. });
  761. }, 40000);
  762. setTimeout(function () {
  763. $.extend($.gritter.options, {
  764. position: 'top-left'
  765. });
  766. var unique_id = $.gritter.add({
  767. // (string | mandatory) the heading of the notification
  768. title: 'Inbox',
  769. // (string | mandatory) the text inside the notification
  770. text: 'You have 2 new messages in your inbox.',
  771. // (string | optional) the image to display on the left
  772. image1: './assets/img/avatar1.jpg',
  773. // (bool | optional) if you want it to fade out on its own or just sit there
  774. sticky: true,
  775. // (int | optional) the time you want it to be alive for before fading out
  776. time: '',
  777. // (string | optional) the class name you want to apply to that specific message
  778. class_name: 'my-sticky-class'
  779. });
  780. $.extend($.gritter.options, {
  781. position: 'top-right'
  782. });
  783. setTimeout(function () {
  784. $.gritter.remove(unique_id, {
  785. fade: true,
  786. speed: 'slow'
  787. });
  788. }, 4000);
  789. var number = $('#header_inbox_bar .badge').text();
  790. number = parseInt(number);
  791. number = number + 2;
  792. $('#header_inbox_bar .badge').text(number);
  793. $('#header_inbox_bar').pulsate({
  794. color: "#dd5131",
  795. repeat: 5
  796. });
  797. }, 60000);
  798. }
  799. };
  800. }();