PageSourceSearch

https://www.coloradocollege.edu/other/ssi/js/ssi-ui-2025.js

js coloradocollege.edu collected 2026-10-01 08:52:47 UTC 11,455 bytes, 288 lines download raw bytes

1console.log('2025');
2
3const userPreferences = {
4    buttonDescriptions: false,
5    pinnedButtons: [],
6    
7    load: function() {
8        const savedPreferences = localStorage.getItem("userPreferences");
9        if (savedPreferences) {
10            Object.assign(this, JSON.parse(savedPreferences));
11        }
12    },
13    
14    save: function() {
15        localStorage.setItem("userPreferences", JSON.stringify({
16            buttonDescriptions: this.buttonDescriptions,
17            pinnedButtons: this.pinnedButtons
18        }));
19    },
20    
21    toggleButtonDescriptions: function() {
22        this.buttonDescriptions = !this.buttonDescriptions;
23        this.save();
24    },
25    
26    togglePinButton: function(buttonId) {
27        const index = this.pinnedButtons.indexOf(buttonId);
28        if (index > -1) {
29            this.pinnedButtons.splice(index, 1);
30        } else {
31            this.pinnedButtons.push(buttonId);
32        }
33        this.save();
34    },
35    
36    reorderButtons: function() {
37        const buttonsContainer = document.querySelector(".cc-login-buttons");
38        if (!buttonsContainer) return;
39        
40        const buttons = Array.from(buttonsContainer.querySelectorAll(".ssi-btn"));
41        
42        // Remove all buttons from the container
43        buttons.forEach(button => buttonsContainer.removeChild(button));
44        
45        // Append pinned buttons in the order they were pinned
46        this.pinnedButtons.forEach(buttonId => {
47            const button = buttons.find(btn => {
48                const link = btn.querySelector("a");
49                const id = btn.id || (link ? link.href : '');
50                return id === buttonId;
51            });
52            if (button) {
53                button.style.display = "block";
54                buttonsContainer.appendChild(button);
55            }
56        });
57        
58        // Append unpinned buttons
59        buttons.forEach(button => {
60            const link = button.querySelector("a");
61            const buttonId = button.id || (link ? link.href : '');
62            if (!this.pinnedButtons.includes(buttonId)) {
63                buttonsContainer.appendChild(button);
64            }
65        });
66    }
67};
68
69document.addEventListener("DOMContentLoaded", function() {
70    // First, handle the initial page setup
71    // Check if oneColumn is visible and move elements
72    const oneColumn = document.getElementById('oneColumn');
73    if (oneColumn && window.getComputedStyle(oneColumn).display !== 'none') {
74        const buttonsColor = document.querySelector('.intranet-buttons-color');
75        if (buttonsColor) {
76            const elementsToMove = [
77                '.intranet-emmaemailarchive',
78                '.intranet-today-at-cc-student-events',
79                '.intranet-today-at-cc-employee-events',
80                '.intranet-today-at-cc-student-announcements',
81                '.intranet-today-at-cc-employee-announcements'
82            ];
83            
84            elementsToMove.forEach(selector => {
85                const element = document.querySelector(selector);
86                if (element && buttonsColor.parentNode) {
87                    buttonsColor.parentNode.insertBefore(element, buttonsColor.nextSibling);
88                }
89            });
90        }
91    }
92    
93    // Append text to page title based on body class
94    const body = document.body;
95    let pageTitle = document.querySelector('.cc-subsite-pagetitle');
96    if (pageTitle) {
97        if (body.classList.contains('ssi-type-employee')) {
98            pageTitle.innerHTML += '/​Information for Staff & Faculty';
99        } else if (body.classList.contains('ssi-type-student')) {
100            pageTitle.innerHTML += '/​Information for Students';
101        }
102    }
103    
104    // Handle URL parameters for audience
105    const queryString = window.location.search;
106    const searchParams = new URLSearchParams(queryString);
107    
108    if (searchParams.has('audience')) {
109        const audience = searchParams.get('audience');
110        
111        // FIX: Check which template class currently exists before we wipe them
112        // Default to 2018, but switch to 2025 if detected
113        let templateClass = 'cc-template-single-col-2018'; 
114        if (body.classList.contains('cc-template-single-col-2025')) {
115            templateClass = 'cc-template-single-col-2025';
116        }
117
118        // Initialize array with the detected class
119        const newClasses = [templateClass];
120        
121        const pageTitle = document.querySelector('.cc-subsite-pagetitle');
122        
123        if (audience === 'staff') {
124            newClasses.push('ssi-type-employee', 'ssi-type-staff');
125            if (pageTitle) {
126                pageTitle.textContent = "Sign into CC/Information for Staff & Faculty";
127            }
128        } else if (audience === 'student') {
129            newClasses.push('ssi-type-student');
130            if (pageTitle) {
131                pageTitle.textContent = "Sign into CC/Information for Students";
132            }
133        } else if (audience === 'faculty') {
134            newClasses.push('ssi-type-employee', 'ssi-type-faculty');
135            if (pageTitle) {
136                pageTitle.textContent = "Sign into CC/Information for Staff & Faculty";
137            }
138        } else if (audience === 'none') {
139            newClasses.push('ssi-type-other');
140            if (pageTitle) {
141                pageTitle.textContent = "Sign into CC";
142            }
143        }
144        
145        // Only apply changes if we have more than just the template class
146        if (newClasses.length > 1) {
147            body.className = ''; // Wipes previous classes
148            newClasses.forEach(className => body.classList.add(className));
149        }
150    }
151    
152    // Load user preferences first
153    userPreferences.load();
154    
155    // Find the "show all buttons" link element
156    const showAllButtonsLink = document.getElementById("cc-ssi-showall-buttons");
157    
158    // Create the "toggle descriptions" link
159    const toggleLink = document.createElement("a");
160    toggleLink.href = "#";
161    toggleLink.id = "cc-ssi-button-descriptions";
162    toggleLink.textContent = "Show descriptions";
163    toggleLink.addEventListener("click", toggleButtonDescriptions);
164    
165    // Insert the "toggle descriptions" link after the "show all buttons" link
166    if (showAllButtonsLink) {
167        showAllButtonsLink.insertAdjacentElement("afterend", toggleLink);
168        
169        // Add ONE event listener for show/hide all buttons
170        showAllButtonsLink.addEventListener('click', function(e) {
171            e.preventDefault();
172            e.stopPropagation();
173            const buttonsContainer = document.querySelector('.cc-login-buttons');
174            if (buttonsContainer) {
175                buttonsContainer.classList.toggle('showall');
176                // Update button text based on state
177                if (buttonsContainer.classList.contains('showall')) {
178                    this.textContent = 'Hide buttons';
179                } else {
180                    this.textContent = 'Show all buttons';
181                }
182            }
183            return false;
184        });
185    }
186    
187    // Add title text to buttons inside <small> elements and add pin icons
188    const buttons = document.querySelectorAll(".ssi-btn");
189    buttons.forEach(button => {
190        const link = button.querySelector("a.button");
191        if (link) {
192            const title = link.getAttribute("title");
193            const span = link.querySelector("span");
194            
195            if (title && span) {
196                const smallElement = document.createElement("small");
197                smallElement.textContent = title;
198                smallElement.style.display = "none";
199                span.appendChild(smallElement);
200            }
201            
202            const pinIconContainer = document.createElement("div");
203            pinIconContainer.classList.add("pin-icon-container");
204            const pinIcon = document.createElement("i");
205            pinIcon.title = "Pin to top";
206            pinIcon.classList.add("fal", "fa-star", "pin-icon");
207            pinIconContainer.appendChild(pinIcon);
208            link.appendChild(pinIconContainer);
209            
210            // Add event listener to pin icon container
211            pinIconContainer.addEventListener("click", function(e) {
212                e.preventDefault();
213                e.stopPropagation();
214                const buttonId = button.id || link.href;
215                userPreferences.togglePinButton(buttonId);
216                pinIcon.classList.toggle("fas");
217                pinIcon.classList.toggle("fal");
218                userPreferences.reorderButtons();
219            });
220        }
221    });
222    
223    // Set initial state of button descriptions based on user preferences
224    const parentElement = document.querySelector(".ssi-intranet-block");
225    if (parentElement) {
226        if (userPreferences.buttonDescriptions) {
227            parentElement.classList.add("show-button-descriptions");
228            toggleLink.textContent = "Hide descriptions";
229            buttons.forEach(button => {
230                const small = button.querySelector("small");
231                if (small) small.style.display = "block";
232            });
233        } else {
234            parentElement.classList.remove("show-button-descriptions");
235            toggleLink.textContent = "Show descriptions";
236            buttons.forEach(button => {
237                const small = button.querySelector("small");
238                if (small) small.style.display = "none";
239            });
240        }
241    }
242    
243    // Reorder buttons based on pinned status
244    userPreferences.reorderButtons();
245    
246    // Initialize pin icons based on user preferences
247    buttons.forEach(button => {
248        const pinIcon = button.querySelector(".pin-icon");
249        const link = button.querySelector("a");
250        const buttonId = button.id || (link ? link.href : '');
251        if (pinIcon && userPreferences.pinnedButtons.includes(buttonId)) {
252            pinIcon.classList.remove("fal");
253            pinIcon.classList.add("fas");
254            button.style.display = "block"; // Ensure pinned buttons are always visible
255        }
256    });
257});
258
259function toggleButtonDescriptions(e) {
260    e.preventDefault();
261    const buttonDescriptions = document.querySelectorAll(".ssi-btn small");
262    const parentElement = document.querySelector(".ssi-intranet-block");
263    const toggleLink = document.getElementById("cc-ssi-button-descriptions");
264    
265    userPreferences.toggleButtonDescriptions();
266    
267    if (userPreferences.buttonDescriptions) {
268        buttonDescriptions.forEach(description => {
269            description.style.display = "block";
270        });
271        if (parentElement) {
272            parentElement.classList.add("show-button-descriptions");
273        }
274        if (toggleLink) {
275            toggleLink.textContent = "Hide descriptions";
276        }
277    } else {
278        buttonDescriptions.forEach(description => {
279            description.style.display = "none";
280        });
281        if (parentElement) {
282            parentElement.classList.remove("show-button-descriptions");
283        }
284        if (toggleLink) {
285            toggleLink.textContent = "Show descriptions";
286        }
287    }
288}

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.