PageSourceSearch

https://helenacollege.edu/js/component/knockout-notification-components.js

js helenacollege.edu collected 2026-10-02 14:39:05 UTC 23,558 bytes, 701 lines download raw bytes

1function JobNotificationsViewModel() {
2	var self = this;
3	
4	self.jobNotificationsList = ko.mapping.fromJS([]);
5	
6	self.getJobNotifications = function() {
7		
8		self.jobNotificationsList.removeAll();
9		
10		$.ajax({ 
11        	url: "/php/getNotificationsByCategory.php",
12        	data: {
13        		"category" : 9
14        	},
15        	type: "POST",
16        	dataType:"json",
17        	success: function(data) {
18        		$.each(data, function(i, notification) {
19        		    if($.inArray(9, notification.categories) != -1) {
20        		        self.jobNotificationsList.push(ko.mapping.fromJS(notification));    
21        		    }
22			    });
23        	}, error: function(error) {
24        		 
25        		console.log(error);
26        	}
27        });
28	};
29	self.getJobNotifications();
30	
31	ko.bindingHandlers.readmore = { 
32        init: function(element, valueAccessor, allBindings, viewModel, bindingContext) { 
33            //This limit you can set after how much characters you want to show Read More.
34            var carLmt = 255;
35            var readMoreTxt = " ... Read More";
36            var readLessTxt = " Read Less";
37            
38            if ($(element).html().length > carLmt) {
39                
40                var lHtml = $(element).html();
41                var sHtml = $(element).find("p:first").html();
42                
43                readMore();
44                
45                function readMore() {
46                    $(element).html(sHtml).append('<a href="javascript:void(0)" class="readmore">...Read More</a>');
47                    var readMoreLink = $(element).find("a.readmore");
48                    readMoreLink.on("click", function() {
49                        readLess();
50                    });
51                }
52                
53                function readLess() {
54                    $(element).html(lHtml).append('<a href="javascript:void(0)" class="readless">...Read Less</a>');
55                    var readLessLink = $(element).find("a.readless");
56                    readLessLink.on("click", function() {
57                        readMore();
58                    });
59                }
60            }
61        }
62    }; 
63}
64
65ko.components.register('job-posting-component', {
66    viewModel: JobNotificationsViewModel,
67    template: { element: 'job-posting-tempate' }
68});
69
70/* /\/\/\/\/\/\/\/\/\/\/\/\/ STUDENT NOTIFICATIONS \/\/\/\/\/\/ */
71
72function StudentNotificationsViewModel() {
73	var self = this;
74	
75	self.studentNotificationsList = ko.mapping.fromJS([]);
76	
77	self.getStudentNotifications = function() {
78		
79		self.studentNotificationsList.removeAll();
80		
81		$.ajax({ 
82        	url: "/php/getNotificationsByCategory.php",
83        	data: {
84        		"category" : 1
85        	},
86        	type: "POST",
87        	dataType:"json",
88        	success: function(data) {
89        		$.each(data, function(i, notification) {
90        		    if($.inArray(1, notification.categories) != -1) {
91        		        self.studentNotificationsList.push(ko.mapping.fromJS(notification));    
92        		    }
93			    });
94        	}, error: function(error) {
95        		 
96        		console.log(error);
97        	}
98        });
99	};
100	self.getStudentNotifications();
101	
102	ko.bindingHandlers.readmore = { 
103        init: function(element, valueAccessor, allBindings, viewModel, bindingContext) { 
104            //This limit you can set after how much characters you want to show Read More.
105            var carLmt = 255;
106            var readMoreTxt = " ... Read More";
107            var readLessTxt = " Read Less";
108            
109            if ($(element).html().length > carLmt) {
110                
111                var lHtml = $(element).html();
112                var sHtml = $(element).find("p:first").html();
113                
114                readMore();
115                
116                function readMore() {
117                    $(element).html(sHtml).append('<a href="javascript:void(0)" class="readmore">...Read More</a>');
118                    var readMoreLink = $(element).find("a.readmore");
119                    readMoreLink.on("click", function() {
120                        readLess();
121                    });
122                }
123                
124                function readLess() {
125                    $(element).html(lHtml).append('<a href="javascript:void(0)" class="readless">...Read Less</a>');
126                    var readLessLink = $(element).find("a.readless");
127                    readLessLink.on("click", function() {
128                        readMore();
129                    });
130                }
131            }
132        }
133    }; 
134}
135
136ko.components.register('student-news-component', {
137    viewModel: StudentNotificationsViewModel,
138    template: { element: 'student-news-tempate' }
139});
140
141/* /\/\/\/\/\/\/\/\/\/\/\/\/ IT NOTIFICATIONS \/\/\/\/\/\/ */
142
143function ITNotificationsViewModel() {
144	var self = this;
145	
146	self.itNotificationsList = ko.mapping.fromJS([]);
147	
148	self.getItNotifications = function() {
149		
150		self.itNotificationsList.removeAll();
151		
152		$.ajax({ 
153        	url: "/php/getNotificationsByCategory.php",
154        	data: {
155        		"category" : 17
156        	},
157        	type: "POST",
158        	dataType:"json",
159        	success: function(data) {
160        		 
161        		$.each(data, function(i, notification) {
162				self.itNotificationsList.push(ko.mapping.fromJS(notification));
163			});
164        	}, error: function(error) {
165        		 
166        		console.log(error);
167        	}
168        });
169	};
170	self.getItNotifications();
171	
172	ko.bindingHandlers.readmore = { 
173        init: function(element, valueAccessor, allBindings, viewModel, bindingContext) { 
174            //This limit you can set after how much characters you want to show Read More.
175            var carLmt = 255;
176            var readMoreTxt = " ... Read More";
177            var readLessTxt = " Read Less";
178            
179            if ($(element).html().length > carLmt) {
180                
181                var lHtml = $(element).html();
182                var sHtml = $(element).find("p:first").html();
183                
184                readMore();
185                
186                function readMore() {
187                    $(element).html(sHtml).append('<a href="javascript:void(0)" class="readmore">...Read More</a>');
188                    var readMoreLink = $(element).find("a.readmore");
189                    readMoreLink.on("click", function() {
190                        readLess();
191                    });
192                }
193                
194                function readLess() {
195                    $(element).html(lHtml).append('<a href="javascript:void(0)" class="readless">...Read Less</a>');
196                    var readLessLink = $(element).find("a.readless");
197                    readLessLink.on("click", function() {
198                        readMore();
199                    });
200                }
201            }
202        }
203    }; 
204}
205
206ko.components.register('it-news-component', {
207    viewModel: ITNotificationsViewModel,
208    template: { element: 'it-news-tempate' }
209});
210
211/* /\/\/\/\/\/\/\/\/\/\/\/\/ STAFF NOTIFICATIONS \/\/\/\/\/\/ */
212
213function StaffNotificationsViewModel() {
214	var self = this;
215	
216	self.staffNotificationsList = ko.mapping.fromJS([]);
217	
218	self.getStaffNotifications = function() {
219		
220		self.staffNotificationsList.removeAll();
221		
222		$.ajax({ 
223        	url: "/php/getNotificationsByCategory.php",
224        	data: {
225        		"category" : 2
226        	},
227        	type: "POST",
228        	dataType:"json",
229        	success: function(data) {
230        		 
231        		$.each(data, function(i, notification) {
232        		    if($.inArray(2, notification.categories) != -1) {
233				        self.staffNotificationsList.push(ko.mapping.fromJS(notification));
234        		    }
235			    });
236        	}, error: function(error) {
237        		 
238        		console.log(error);
239        	}
240        });
241	};
242	self.getStaffNotifications();
243	
244	ko.bindingHandlers.readmore = { 
245        init: function(element, valueAccessor, allBindings, viewModel, bindingContext) { 
246            //This limit you can set after how much characters you want to show Read More.
247            var carLmt = 255;
248            var readMoreTxt = " ... Read More";
249            var readLessTxt = " Read Less";
250            
251            if ($(element).html().length > carLmt) {
252                
253                var lHtml = $(element).html();
254                var sHtml = $(element).find("p:first").html();
255                
256                readMore();
257                
258                function readMore() {
259                    $(element).html(sHtml).append('<a href="javascript:void(0)" class="readmore">...Read More</a>');
260                    var readMoreLink = $(element).find("a.readmore");
261                    readMoreLink.on("click", function() {
262                        readLess();
263                    });
264                }
265                
266                function readLess() {
267                    $(element).html(lHtml).append('<a href="javascript:void(0)" class="readless">...Read Less</a>');
268                    var readLessLink = $(element).find("a.readless");
269                    readLessLink.on("click", function() {
270                        readMore();
271                    });
272                }
273            }
274        }
275    }; 
276}
277
278ko.components.register('staff-news-component', {
279    viewModel: StaffNotificationsViewModel,
280    template: { element: 'staff-news-tempate' }
281});
282
283/* /\/\/\/\/\/\/\/\/\/\/\/\/ DEAN NOTIFICATIONS \/\/\/\/\/\/ */
284
285function DeanNotificationsViewModel() {
286	var self = this;
287	
288	self.deanNotificationsList = ko.mapping.fromJS([]);
289	
290	self.getDeanNotifications = function() {
291		
292		self.deanNotificationsList.removeAll();
293		
294		$.ajax({ 
295        	url: "/php/getNotificationsByCategory.php",
296        	data: {
297        		"category" : 13
298        	},
299        	type: "POST",
300        	dataType:"json",
301        	success: function(data) {
302        		 
303        		$.each(data, function(i, notification) {
304				    self.deanNotificationsList.push(ko.mapping.fromJS(notification));
305			    });
306        	}, error: function(error) {
307        		 
308        		console.log(error);
309        	}
310        });
311	};
312	self.getDeanNotifications();
313	
314	ko.bindingHandlers.readmore = { 
315        init: function(element, valueAccessor, allBindings, viewModel, bindingContext) { 
316            //This limit you can set after how much characters you want to show Read More.
317            var carLmt = 255;
318            var readMoreTxt = " ... Read More";
319            var readLessTxt = " Read Less";
320            
321            if ($(element).html().length > carLmt) {
322                
323                var lHtml = $(element).html();
324                var sHtml = $(element).find("p:first").html();
325                
326                readMore();
327                
328                function readMore() {
329                    $(element).html(sHtml).append('<a href="javascript:void(0)" class="readmore">...Read More</a>');
330                    var readMoreLink = $(element).find("a.readmore");
331                    readMoreLink.on("click", function() {
332                        readLess();
333                    });
334                }
335                
336                function readLess() {
337                    $(element).html(lHtml).append('<a href="javascript:void(0)" class="readless">...Read Less</a>');
338                    var readLessLink = $(element).find("a.readless");
339                    readLessLink.on("click", function() {
340                        readMore();
341                    });
342                }
343            }
344        }
345    }; 
346}
347
348ko.components.register('dean-news-component', {
349    viewModel: DeanNotificationsViewModel,
350    template: { element: 'dean-news-tempate' }
351});
352
353/* /\/\/\/\/\/\/\/\/\/\/\/\/ HR NOTIFICATIONS \/\/\/\/\/\/ */
354
355function HRNotificationsViewModel() {
356	var self = this;
357	
358	self.hrNotificationsList = ko.mapping.fromJS([]);
359	
360	self.getHrNotifications = function() {
361		
362		self.hrNotificationsList.removeAll();
363		
364		$.ajax({ 
365        	url: "/php/getNotificationsByCategory.php",
366        	data: {
367        		"category" : 15
368        	},
369        	type: "POST",
370        	dataType:"json",
371        	success: function(data) {
372        		 
373        		$.each(data, function(i, notification) {
374				    self.hrNotificationsList.push(ko.mapping.fromJS(notification));
375			    });
376        	}, error: function(error) {
377        		 
378        		console.log(error);
379        	}
380        });
381	};
382	self.getHrNotifications();
383	
384	ko.bindingHandlers.readmore = { 
385        init: function(element, valueAccessor, allBindings, viewModel, bindingContext) { 
386            //This limit you can set after how much characters you want to show Read More.
387            var carLmt = 255;
388            var readMoreTxt = " ... Read More";
389            var readLessTxt = " Read Less";
390            
391            if ($(element).html().length > carLmt) {
392                
393                var lHtml = $(element).html();
394                var sHtml = $(element).find("p:first").html();
395                
396                readMore();
397                
398                function readMore() {
399                    $(element).html(sHtml).append('<a href="javascript:void(0)" class="readmore">...Read More</a>');
400                    var readMoreLink = $(element).find("a.readmore");
401                    readMoreLink.on("click", function() {
402                        readLess();
403                    });
404                }
405                
406                function readLess() {
407                    $(element).html(lHtml).append('<a href="javascript:void(0)" class="readless">...Read Less</a>');
408                    var readLessLink = $(element).find("a.readless");
409                    readLessLink.on("click", function() {
410                        readMore();
411                    });
412                }
413            }
414        }
415    }; 
416}
417
418ko.components.register('hr-news-component', {
419    viewModel: HRNotificationsViewModel,
420    template: { element: 'hr-news-tempate' }
421});
422
423/* /\/\/\/\/\/\/\/\/\/\/\/\/ ACADEMIC STUDENT AFFAIRS NOTIFICATIONS \/\/\/\/\/\/ */
424
425function ASANotificationsViewModel() {
426	var self = this;
427	
428	self.asaNotificationsList = ko.mapping.fromJS([]);
429	
430	self.getAsaNotifications = function() {
431		
432		self.asaNotificationsList.removeAll();
433		
434		$.ajax({ 
435        	url: "/php/getNotificationsByCategory.php",
436        	data: {
437        		"category" : 19
438        	},
439        	type: "POST",
440        	dataType:"json",
441        	success: function(data) {
442        		 
443        		$.each(data, function(i, notification) {
444				    self.asaNotificationsList.push(ko.mapping.fromJS(notification));
445			    });
446        	}, error: function(error) {
447        		 
448        		console.log(error);
449        	}
450        });
451	};
452	self.getAsaNotifications();
453	
454	ko.bindingHandlers.readmore = { 
455        init: function(element, valueAccessor, allBindings, viewModel, bindingContext) { 
456            //This limit you can set after how much characters you want to show Read More.
457            var carLmt = 255;
458            var readMoreTxt = " ... Read More";
459            var readLessTxt = " Read Less";
460            
461            if ($(element).html().length > carLmt) {
462                
463                var lHtml = $(element).html();
464                var sHtml = $(element).find("p:first").html();
465                
466                readMore();
467                
468                function readMore() {
469                    $(element).html(sHtml).append('<a href="javascript:void(0)" class="readmore">...Read More</a>');
470                    var readMoreLink = $(element).find("a.readmore");
471                    readMoreLink.on("click", function() {
472                        readLess();
473                    });
474                }
475                
476                function readLess() {
477                    $(element).html(lHtml).append('<a href="javascript:void(0)" class="readless">...Read Less</a>');
478                    var readLessLink = $(element).find("a.readless");
479                    readLessLink.on("click", function() {
480                        readMore();
481                    });
482                }
483            }
484        }
485    }; 
486}
487
488ko.components.register('asa-news-component', {
489    viewModel: ASANotificationsViewModel,
490    template: { element: 'asa-news-tempate' }
491});
492
493/* /\/\/\/\/\/\/\/\/\/\/\/\/ Community Engagement & Workforce Development \/\/\/\/\/\/ */
494
495function CEWDNotificationsViewModel() {
496	var self = this;
497	
498	self.cewdNotificationsList = ko.mapping.fromJS([]);
499	
500	self.getCewdNotifications = function() {
501		
502		self.cewdNotificationsList.removeAll();
503		
504		$.ajax({ 
505        	url: "/php/getNotificationsByCategory.php",
506        	data: {
507        		"category" : 18
508        	},
509        	type: "POST",
510        	dataType:"json",
511        	success: function(data) {
512        		 
513        		$.each(data, function(i, notification) {
514				    self.cewdNotificationsList.push(ko.mapping.fromJS(notification));
515			    });
516        	}, error: function(error) {
517        		 
518        		console.log(error);
519        	}
520        });
521	};
522	self.getCewdNotifications();
523	
524	ko.bindingHandlers.readmore = { 
525        init: function(element, valueAccessor, allBindings, viewModel, bindingContext) { 
526            //This limit you can set after how much characters you want to show Read More.
527            var carLmt = 255;
528            var readMoreTxt = " ... Read More";
529            var readLessTxt = " Read Less";
530            
531            if ($(element).html().length > carLmt) {
532                
533                var lHtml = $(element).html();
534                var sHtml = $(element).find("p:first").html();
535                
536                readMore();
537                
538                function readMore() {
539                    $(element).html(sHtml).append('<a href="javascript:void(0)" class="readmore">...Read More</a>');
540                    var readMoreLink = $(element).find("a.readmore");
541                    readMoreLink.on("click", function() {
542                        readLess();
543                    });
544                }
545                
546                function readLess() {
547                    $(element).html(lHtml).append('<a href="javascript:void(0)" class="readless">...Read Less</a>');
548                    var readLessLink = $(element).find("a.readless");
549                    readLessLink.on("click", function() {
550                        readMore();
551                    });
552                }
553            }
554        }
555    }; 
556}
557
558ko.components.register('cewd-news-component', {
559    viewModel: CEWDNotificationsViewModel,
560    template: { element: 'cewd-news-tempate' }
561});
562
563/* /\/\/\/\/\/\/\/\/\/\/\/\/ FISCAL & PLANT \/\/\/\/\/\/ */
564
565function FPNotificationsViewModel() {
566	var self = this;
567	
568	self.fpNotificationsList = ko.mapping.fromJS([]);
569	
570	self.getFpNotifications = function() {
571		
572		self.fpNotificationsList.removeAll();
573		
574		$.ajax({ 
575        	url: "/php/getNotificationsByCategory.php",
576        	data: {
577        		"category" : 14
578        	},
579        	type: "POST",
580        	dataType:"json",
581        	success: function(data) {
582        		 
583        		$.each(data, function(i, notification) {
584				    self.fpNotificationsList.push(ko.mapping.fromJS(notification));
585			    });
586        	}, error: function(error) {
587        		 
588        		console.log(error);
589        	}
590        });
591	};
592	self.getFpNotifications();
593	
594	ko.bindingHandlers.readmore = { 
595        init: function(element, valueAccessor, allBindings, viewModel, bindingContext) { 
596            //This limit you can set after how much characters you want to show Read More.
597            var carLmt = 255;
598            var readMoreTxt = " ... Read More";
599            var readLessTxt = " Read Less";
600            
601            if ($(element).html().length > carLmt) {
602                
603                var lHtml = $(element).html();
604                var sHtml = $(element).find("p:first").html();
605                
606                readMore();
607                
608                function readMore() {
609                    $(element).html(sHtml).append('<a href="javascript:void(0)" class="readmore">...Read More</a>');
610                    var readMoreLink = $(element).find("a.readmore");
611                    readMoreLink.on("click", function() {
612                        readLess();
613                    });
614                }
615                
616                function readLess() {
617                    $(element).html(lHtml).append('<a href="javascript:void(0)" class="readless">...Read Less</a>');
618                    var readLessLink = $(element).find("a.readless");
619                    readLessLink.on("click", function() {
620                        readMore();
621                    });
622                }
623            }
624        }
625    }; 
626}
627
628ko.components.register('fp-news-component', {
629    viewModel: FPNotificationsViewModel,
630    template: { element: 'fp-news-tempate' }
631});
632
633/* /\/\/\/\/\/\/\/\/\/\/\/\/ INSTITUTIONAL RESEARCH \/\/\/\/\/\/ */
634
635function IRNotificationsViewModel() {
636	var self = this;
637	
638	self.irNotificationsList = ko.mapping.fromJS([]);
639	
640	self.getIrNotifications = function() {
641		
642		self.irNotificationsList.removeAll();
643		
644		$.ajax({ 
645        	url: "/php/getNotificationsByCategory.php",
646        	data: {
647        		"category" : 16
648        	},
649        	type: "POST",
650        	dataType:"json",
651        	success: function(data) {
652        		 
653        		$.each(data, function(i, notification) {
654				    self.irNotificationsList.push(ko.mapping.fromJS(notification));
655			    });
656        	}, error: function(error) {
657        		 
658        		console.log(error);
659        	}
660        });
661	};
662	self.getIrNotifications();
663	
664	ko.bindingHandlers.readmore = { 
665        init: function(element, valueAccessor, allBindings, viewModel, bindingContext) { 
666            //This limit you can set after how much characters you want to show Read More.
667            var carLmt = 255;
668            var readMoreTxt = " ... Read More";
669            var readLessTxt = " Read Less";
670            
671            if ($(element).html().length > carLmt) {
672                
673                var lHtml = $(element).html();
674                var sHtml = $(element).find("p:first").html();
675                
676                readMore();
677                
678                function readMore() {
679                    $(element).html(sHtml).append('<a href="javascript:void(0)" class="readmore">...Read More</a>');
680                    var readMoreLink = $(element).find("a.readmore");
681                    readMoreLink.on("click", function() {
682                        readLess();
683                    });
684                }
685                
686                function readLess() {
687                    $(element).html(lHtml).append('<a href="javascript:void(0)" class="readless">...Read Less</a>');
688                    var readLessLink = $(element).find("a.readless");
689                    readLessLink.on("click", function() {
690                        readMore();
691                    });
692                }
693            }
694        }
695    }; 
696}
697
698ko.components.register('ir-news-component', {
699    viewModel: IRNotifications
699ViewModel,
700    template: { element: 'ir-news-tempate' }
701});

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.