PageSourceSearch

https://toolbox.injoyonline.com/InJoyLibrary/injoy/js/pano2UpdateBanner.js?update=7

js injoyonline.com collected 2026-09-30 14:34:29 UTC 6,918 bytes, 132 lines download raw bytes

1var Pano2UpdateBanner = {
2    // Script must be placed on the landing page.
3    // Dependencies: globalObserver - globalObserver fires Pano2UpdateBanner.main() inside its initiateGlobalScripts function, which also means this need to be loaded first.
4
5    bannerText : "In the coming weeks there will be some changes to how learners will be registered for eClasses. You will no longer need to create individual learner accounts. Instead, you will provide learners with an access code, which they will then use to set up their own account.<br><br>To learn more, contact InJoy’s Customer Success team by phone at <a class='ij-a' href='tel:8003262082,0'>1-800-326-2082 x0</a> or via email at <a class='ij-a' href='mailto:[email protected]?subject=Panorama%20User%20Invitation%20changes'>[email protected]</a>.",
6
7    bannerLinks : [/* {link:"https://vimeo.com/187823078", text:"Relaxing meditation music video"} , {link:"https://vimeo.com/339349131", text:"Open heart meditation video"} */],
8
9    bannerClasses : {main:"ij-pano2UpdateBanner", text:"ij-uBannerTextCont", link:"ij-uBannerLink", closeBtn:"ij-uBannerCloseBtn", closeHover:"ij-uBannerCloseBtn:hover", a:"ij-a"},
10
11    bannerStyles : {main:["display: flex;", "background-color:#262626;", "top:0;", "left:0;", "color: white;", "text-align:center;", "justify-content:center;", "align-items:center;"], text:["display:inline-block;", "width:calc(100% - 80px);", "font-size: 1.2em;", "padding: 16px 24px;", "height: auto;", ], link:["display:block;","background-color:green;", "margin:5px;",], closeBtn:[ "display:inline-block;", "float:right;", "cursor:pointer;", "font-size:1.3em;", "color:black;", "background-color:white;", "padding:5px 10px;", "text-align:center;", "margin-right:15px;"], closeHover:["color: #c0c0cf;"], a:["color:#1fbdc5;"]}, // fix -- Fix... what?
12
13    pagePaths : [/\/learn\/manager\/user\/new/, /\/learn\/manager\/panorama\/.+?\/users/, /\/learn\/manager\/user\/beta-index/, /\/learn\/manager\/clients\/.+?\/users/],
14
15    roleNames : ["org-admin-eclass-plus", "org-admin-eclass-premium", "admin"],
16
17    sessionStorageKey : "Pano2UpdateBanner",
18
19    main : function(iteration=0) {
20        
21        try {
22
23            // determine if user needs banner: Page, userRole.
24            var path = window.location.pathname;
25            try {
26                var role = window.CONF.preload.currentUser.currentUser.role._data.keyName;
27            } catch (err) {
28                console.warn("no keyname");
29                iteration++;
30                if (iteration > 5) {
31                    return;
32                }
33                console.log("retrying");
34                setTimeout(function(){
35                  Pano2UpdateBanner.main(iteration);  
36                }, iteration*200 + 300);
37                return;
38            }
39            // console.log("success")
40            if (Pano2UpdateBanner.needsBanner(path, role, Pano2UpdateBanner.pagePaths, Pano2UpdateBanner.roleNames)) {
41                // console.log("needs banner")
42                // Create banner
43                var banner = Pano2UpdateBanner.createBanner();
44                // banner.style.display = "none"; // TODO remove for launch
45                // Create stylesheet
46                var sheet = document.createElement("style");
47                var classes = Object.keys(Pano2UpdateBanner.bannerClasses);
48                for (var i=classes.length-1; i >= 0; i--) {
49                    var cls = classes[i];
50                    sheet.innerHTML += Pano2UpdateBanner.createStyle(cls) +"\n";
51                }
52                // Append stylesheet
53                document.head.insertBefore(sheet, document.head.children[document.head.children.length-1]);
54                // display banner
55                document.body.insertBefore(banner, document.body.children[0]);
56                document.querySelector(".application__content").insertBefore(banner, document.querySelector(".application__content").children[0]);
57                // Add event listener to close banner if clicked;
58                document.querySelector(".ij-uBannerCloseBtn").addEventListener("click", function(evt) {
59                    sessionStorage.setItem(Pano2UpdateBanner.sessionStorageKey, 'closed');
60                    document.querySelector(".ij-pano2UpdateBanner").parentElement.removeChild(document.querySelector(".ij-pano2UpdateBanner"));
61                });
62            }
63        } catch (err) {
64            console.warn(err.stack);
65        }
66        
67    },
68
69    createBanner : function() {
70        var bannerText = Pano2UpdateBanner.bannerText;
71
72        var banner = document.createElement("div");
73        banner.setAttribute("class", Pano2UpdateBanner.bannerClasses.main);
74
75        var bannerTextCont = document.createElement("div");
76        bannerTextCont.setAttribute("class", Pano2UpdateBanner.bannerClasses.text);
77        bannerTextCont.innerHTML = bannerText;
78
79        for (var link of Pano2UpdateBanner.bannerLinks) {
80            var linkDiv = document.createElement("div");
81            linkDiv.setAttribute("class", Pano2UpdateBanner.bannerClasses.link);
82
83            var bannerLink = document.createElement("a");
84            bannerLink.setAttribute("href", link.link);
85            bannerLink.setAttribute("target", "_blank");
86            bannerLink.style.color = "white";
87            bannerLink.innerHTML = link.text;
88            linkDiv.appendChild(bannerLink);
89            bannerTextCont.appendChild(linkDiv);
90        }
91
92        var bannerCloseBtn = document.createElement("div");
93        bannerCloseBtn.setAttribute("class", Pano2UpdateBanner.bannerClasses.closeBtn);
94        bannerCloseBtn.innerHTML = "Close";
95
96        banner.appendChild(bannerTextCont);
97        banner.appendChild(bannerCloseBtn);
98
99        return banner;
100    },
101
102    createStyle : function(key) {
103        var cls = "." + Pano2UpdateBanner.bannerClasses[key] + " {";
104        var clsJoined = Pano2UpdateBanner.bannerStyles[key].join(" ");
105        cls += clsJoined + "} ";
106        return cls;
107    },
108
109    needsBanner : function(currentPath, currentRole, activePaths, activeRoles) {
110        if (document.querySelector("." + Pano2UpdateBanner.bannerClasses.main)) {
111            // We already have a banner.
112            return false; 
113        }
114        if (sessionStorage.getItem(Pano2UpdateBanner.sessionStorageKey)) {
115            return false;
116        }
117        if (activeRoles.indexOf(currentRole) >= 0) {
118            // console.log("correct role")
119            for (var page of activePaths) {
120                if (currentPath.match(page)) {
121                    // console.log("correct page")
122                    return true;
123                }
124            }
125            return false;
126        } else {
127            return false;
128        }
129    },
130}
131
132// Pano2UpdateBanner.main();

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.