- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2016 01:53 PM
I see the code in /scripts/js_includes_sp.jsx. I'd like to modify the function addNotification() in the Angular directive spNotifications so that non-trivial messages don't fade away.
Is there a way to change or extend the JavaScript?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2016 06:56 PM
I discovered that decorating the directive spNotifications allows you to extend or overwrite the directive any way you want. In this case, I overrode two controller functions:
/* Override spNotificationsDirective controller */
angular.module('sn.$sp').config(function($provide) {
$provide.decorator('spNotificationsDirective', function($delegate, $controller) {
var controllerName = directive.controller;
directive.controller = function($scope) {
var controller = $controller(controllerName, {$scope: $scope});
// Override functions getMilliSeconds and areTrivial
controller.getMilliSeconds = function() {
var seconds = (areTrivial(controller.notifications)) ? 10 : 3000;
return input.length >= 1 && input.every(function(item) {
return item && item.type === 'trivial';
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-12-2017 12:08 PM
Where are you doing this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2017 02:36 AM
Hi,
Can you describe some more briefly where you have added the script to prevent info message disapearing in few seconds.
I have added the script in client controller of "SC Catalog Item" but it is not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-13-2017 07:22 AM
Mihir,
Try placing the code into a new UI Script. Create a JS include for the Service Portal Theme you're using, set the Source to "UI Script", and select the UI script you created.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2018 06:47 AM
Hello Artsupsiri,
Where in the Service Portal would you add that code? Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2018 08:34 PM
Try placing the code into a new UI Script. Create a JS include for the Service Portal Theme you're using, set the Source to "UI Script", and select the UI script you created.