PageSourceSearch

https://training.smartworkplace.ca/v1/assets/js/dashboardLayout.js?version=20260828142246

js smartworkplace.ca collected 2026-10-05 20:11:27 UTC 7,858 bytes, 278 lines download raw bytes

1/*
2   Name        : /v1/assets/js/dashboardLayout.js
3   Date        : January 03, 2020
4   Author      : AP
5*/
6
7function switchAccount(userId) {
8  $.ajax({
9    type : "POST",
10    async : false,
11    url : "/v1/index.cfm?action=ajax.getswitchaccountlink",
12    data : {
13      user : userId
14    },
15    success : function(datas){
16      window.location.href = datas;
17    }
18  });
19};
20function userMenuPreferance(menuType) {
21  $.ajax({
22    type : "POST",
23    async : true,
24    url : "/v1/index.cfm?action=ajaxcommon.setmenupreference",
25    data : {
26      menuType : menuType
27    }
28  });
29  // SET HEADER MENU TYPE IN RC FOR REACT COMPONENTS. THIS IS USED TO DETERMINE THE TRM MATRIX GRID HEIGHT.
30  rc.headerMenuType = menuType;
31};
32
33$(document).ready(function() {
34 
35  $(".menu_switch li a").click(function() {
36    $(".menu_switch li a").removeClass("menu_switch_act");
37    $(this).addClass("menu_switch_act")
38  });
39  $("#horz_menu_btn").click(function() {
40    $("#layout-wrapper-sub").addClass("vertical_menu");
41    $("#layout-wrapper-sub").addClass("horizontal_menu");
42    $(".menu_bis .menu_wrapper ul").removeClass("fill").addClass("stroke");
43    $(".master-notification-holder").removeClass('master-notification-holder-vertical');
44    $("#horz_menu_btn").hide();
45    $("#vert_menu_btn").show();
46    userMenuPreferance(1);
47  });
48  $("#vert_menu_btn").click(function() {
49    $("#layout-wrapper-sub").removeClass("horizontal_menu");
50    $("#layout-wrapper-sub").addClass("vertical_menu");
51    $(".menu_bis .menu_wrapper ul").removeClass("stroke").addClass("fill");
52    $(".master-notification-holder").addClass('master-notification-holder-vertical');
53    $("#horz_menu_btn").show();
54    $("#vert_menu_btn").hide();
55    userMenuPreferance(2);
56  });
57  $(".mob_bars_shw").click(function() {
58    if($(".menu_bis").hasClass("fixed")) {
59      $(".menu_bis").removeClass("fixed");
60    } else {
61      $(".menu_bis").addClass("fixed");
62    }
63  });
64  $('#vert_menu').click(function(event){
65    event.stopPropagation();
66  });
67  $("#sidebar-close-mob").click(function() {
68    if($(".menu_bis").hasClass("fixed")) {
69      $(".menu_bis").removeClass("fixed");
70    } else {
71      $(".menu_bis").addClass("fixed");
72    }
73  });
74});
75$(".prof_img").click(function() {
76  $("#prf_drop").slideToggle();
77});
78$(document).on("click", function (b) {
79  var a = $(".prof_img");
80  if(a[0] !== b.target && !a.has(b.target).length) {
81    $("#prf_drop").hide();
82  }
83});
84$("#widget-sidebar-toggler").click(function() {
85  if($(".menu_bis").hasClass("fixed")) {
86    $(".menu_bis").removeClass("fixed");
87    userMenuPreferance(3);
88  } else {
89    $(".menu_bis").addClass("fixed");
90    userMenuPreferance(2);
91  }
92});
93$(".menu_bis").hover(function() {
94  $(".text_bis, .sb-scrollbar-container").addClass("show");
95}, function() {
96  $(".text_bis, .sb-scrollbar-container").removeClass("show");
97  if($(".wrapper_bis").hasClass("collapse-menu")) {
98    $(".a-has-submenu").removeClass("subnav_bis_act");
99    $(".bis-logo").attr("src", function(a, b) {
100      return $(this).attr("src").replace("BISLogoDarkBG.png", "BISLogoDarkBG_icon.png")
101    });
102    resetMenu()
103  }
104});
105var resetMenu = function() {
106  $(".has-submenu .subnav_bis").hide();
107  $(".has-submenu .sub_arrw_ic").removeClass("rotate");
108};
109var jContext = $("#layout-wrapper");
110var jSidebar = $(".widget-sidebar", jContext);
111(function(e, c, a, f) {
112  var d = "simpleSidebar";
113  function b(h, g) {
114    this.element = h;
115    this._name = d;
116    this._defaults = e.fn.simpleSidebar.defaults;
117    this.options = e.extend({}, this._defaults, g);
118    this.init()
119  }
120  e.extend(b.prototype, {
121    init: function () {
122      var g = e(this.element);
123      e(".widget-sidebar-toggler", g).on("click", function () {
124        if (g.hasClass("sidebar-show")) {
125          g.removeClass("sidebar-show");
126          g.addClass("sidebar-hide")
127        }
128        else {
129          if (g.hasClass("sidebar-hide")) {
130            g.removeClass("sidebar-hide");
131            g.addClass("sidebar-show")
132          }
133          else {
134            var h = true;
135            var i = parseInt(jSidebar.css("margin-left"));
136            if (0 === i) {
137              h = false
138            }
139            if (true === h) {
140              g.addClass("sidebar-show")
141            }
142            else {
143              g.addClass("sidebar-hide")
144            }
145          }
146        }
147        return false
148      })
149    },
150  });
151  e.fn.simpleSidebar = function(g) {
152    this.each(function () {
153      if (!e.data(this, "plugin_" + d)) {
154        e.data(this, "plugin_" + d, new b(this, g))
155      }
156    });
157    return this
158  };
159  e.fn.simpleSidebar.defaults = {};
160})(jQuery, window, document);
161
162try {
163  $(".wrapper_bis .menu_bis").scrollBox();
164} catch (error) {
165  console.log(error);
166}
167
168$("#close_profile").click(function() {
169  $('.profileContent').show().toggleClass('show-profile-content');
170});
171function showNotifLoader() {
172  var loader = document.getElementById("notifLoader");
173  if (loader) {
174    loader.innerHTML = '<i class="fad fa-cog fa-spin fa-2x"></i>';
175  }
176}
177function hideNotifLoader() {
178  var loader = document.getElementById("notifLoader");
179  if (loader) {
180    loader.style.display = "none";
181  }
182}
183
184function toggleProfileSection() {
185  if($('.profileContent').hasClass('show-profile-content')){
186    $('.profileContent').show().toggleClass('show-profile-content');
187  }
188  else{
189    $('.profileContent').show().toggleClass('show-profile-content');
190    showNotifLoader();
191    $.ajax({
192      type : "POST",
193      url : "/v1/index.cfm?action=ajaxmanager.toggleProfileSection",
194      data : {},
195      success : function(datas){
196        let htmlString = "";
197        Object.keys(datas.types).forEach(function(key){
198          htmlString += 
199            `<div class = "profile_card" id = "notification_${datas.types[key].notificationId}_${key}">
200              <div class = "close_notif">
201                <i class = "fa fa-close" id = "close_notif" onClick = "removeNotification('${datas.types[key].notificationId}', ${key})" aria-hidden = "true"></i>
202              </div>
203              <div class = "profile_tab" >
204                <span>
205                  ${datas.types[key].subject}
206                  ${$(datas.types[key].message).text()}
207                </span>
208                <a href = "/v1/index.cfm?action=manager.systemnotifications">
209                  <small class = "bttn-link-notif">${readMoreLinkLabel}</small>
210                </a>
211              </div>
212            </div>`;
213        });
214      
215          hideNotifLoader();
216          $('.notifContent').html(htmlString);
217          updateSessionNotif();
218      }
219    });
220  }
221}
222
223function removeNotification(notificationId, index){
224  
225  $.ajax({
226    type : "POST",
227    url : "/v1/index.cfm?action=ajaxmanager.updateRead",
228    contentType: "application/json",
229    data :JSON.stringify({
230      id : notificationId,
231      noticeSettingsId: ''
232    }),
233    success : function(data){
234      if(data.error == false){
235        $('#notification_' + notificationId + '_' + index ).remove();
236        updateSessionNotif();
237      }
238    }
239  })
240}
241
242function removeAllNotif(){
243  showNotifLoader();
244  $.ajax({
245    type : "POST",
246    url : "/v1/index.cfm?action=ajaxmanager.updateRead",
247    contentType: "application/json",
248    data :JSON.stringify({
249      id : 0,
250      noticeSettingsId: 0
251    }),
252    success : function(data){
253      if(data.error == false){
254        hideNotifLoader();
255        $('.notifContent').remove();
256        $("#notif_count").remove();
257        updateSessionNotif();
258      }
259    }
260  })
261}
262
263function updateSessionNotif() {
264  notifCount = '';
265  $.ajax({
266    type : "POST",
267    url : "/v1/index.cfm?action=ajaxmanager.updateSessionNotifCount",
268    data : {},
269    success : function(result){
270      if(result.count == 0) {
271        $("#notif_count").css("display", "none");
272        $(".notification_section").css("display","none");
273      } 
274    }
275  })
276}
277
278

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.