PageSourceSearch

https://www.hwunion.com/stylesheet/hw/scripts-rb.js?v=273

js hwunion.com collected 2026-10-02 08:09:13 UTC 20,408 bytes, 520 lines download raw bytes

1$(document).ready(function () {
2    
3    $("span.emph").each(function(index) {
4        $(this).parent().addClass("heading-emph");
5    });
6    
7    $(".policies .msl-resourcelist .msl-resource .msl-resourcetitle").each(function(index) {
8        $(this).unwrap();
9    });
10    
11    if ($(location).attr('href') == "https://www.hwunion.com/elections/candidates/24/") {
12        window.location.replace("/vote");
13    }
14    //.profile-navigation
15    
16    if ($(".profile-navigation").length) {
17        $(".profile-navigation").append("<div class='row profile-row mr-4 ml-4'></div>");
18        $(".profile-navigation ul li").each(function() {
19            navLink = $(this).find("a").attr("href");
20            navImg = $(this).find("img").attr("src");
21            navNme = $(this).find(".msl-imagenav-title").html();
22            navTitle = $(this).find(".msl-imagenav-description").html();
23            //console.log(navLink + navImg + navNme + navTitle);
24            $(".profile-navigation .profile-row").append("<div class='col-6 col-md-4 mb-4'><div class='card'><img src='" + navImg + "' class='card-img-top'/><div class='card-body'><h5 class='card-title'>" + navNme + "</h5><p class='card-text'>" + navTitle + "</p><a href='" + navLink + "' class='btn btn-union'>More...</a></div></div></div>");
25        });
26        $(".profile-navigation ul").remove();
27    }
28    
29    if ($(".opportunity-types li[title='Show Apply Button']").length) {
30        $(".opportunity-types li[title='Show Apply Button'] span").remove();
31        actType = $(".opportunity-types li[title='Show Apply Button']").html();
32        console.log(actType);
33        if (actType == "No") {
34            $(".opportunity-apply").addClass("hide");
35        }
36    }
37    if ($(".faq h3")) {
38        var faqlistcount = 0;
39        var faqcount = 0
40        var str;
41        
42        $(".faq").each(function() {
43            faqlistcount++;
44            $(this).after("<div class='faq-list panel-group' id='faq-list" + faqlistcount + "'></div>");
45            $(this).find("h3").each(function() {
46            //$(this + " h3").each(function() {
47                faqcount++;
48                ll = $(this).nextUntil("h3").nextUntil("h3").addBack();
49                str = "";
50                str += "<div class='panel panel-default'>";
51                str += "<div class='panel-heading' id='heading" + faqcount + "'>";
52                str += "<h3 class='panel-title'>";
53                str += "<a aria-controls='collapse" + faqcount + "' aria-expanded='false' class='collapsed' data-parent='#results' data-toggle='collapse' data-uw-styling-context='true' href='#collapse" + faqcount + "'>";
54                str += "<span class='fas fa-chevron-down'></span> ";
55                str += "</a></h3>";
56                str += "</div>";
57                str += "<div aria-expanded='false' class='panel-collapse collapse' id='collapse" + faqcount + "'>";
58                str += "<div class='panel-body'>";
59                str += "</div>";
60                str += "</div>";
61                str += "</div>";
62                $("#faq-list" + faqlistcount).append(str);
63                $("#heading" + faqcount + " h3 a").html($(this).html() + " <span class='fas fa-chevron-down'></span>");
64                $("#collapse" + faqcount + " .panel-body").html(ll);
65            });
66            $(this).remove();
67        
68        });
69    }    
70    $("#news .msl-tags").remove();
71    $(".nav-item ul li:empty").append("<hr class='menu-hr'/>");
72    
73    $(".msl_eventlist").each(function(index) {
74        totEvents = $(this).children(".event_item").length;
75        if (totEvents === 0) {
76            curStr = $(this).html();
77            $(this).html("<p class='no-events'>" + curStr + "</p>");
78        }
79    });
80    
81    // Big Ask Popup
82    //ba(0);
83    $(".new_quote").each(function( index ) {
84       $(this).prepend("<div class='quote_icon'>&nbsp;</div>")
85    });
86    
87    
88    if ($(".content h2").html() == "welcome-team") {
89        $(".content h1").html("Edit Entries");
90        $(".msl_add").html("Add Entry");
91        $(".msl_view").html("View All Entries");
92    }
93    
94    if ($(".msl-election-polltimes").length > 0) {
95        electime = $(".msl-election-polltimes").html();
96        if (electime.match(/(([0-9]{2}):([0-9]{2}))/gm) !== null) {
97            tttime = electime.match(/(([0-9]{2}):([0-9]{2}))/gm).toString();
98            finaltime = electime.replace(tttime, tttime + " (GMT)");
99        } else {
100            finaltime = electime;
101        }
102        
103        $(".msl-election-polltimes").html(finaltime);
104    }
105    
106    if ($(".event_tickets").length > 0) {
107        $( ".event_tickets .event_ticket" ).each(function( index ) {
108            $(this).addClass("d-flex");
109            $(this).children("select").addClass("flex-fill p-2");
110            $(this).children("span").addClass("flex-fill p-2");
111            $(this).children("input").addClass("flex-fill p-2");
112            
113            
114        });
115    }
116    
117    if ($(".ftonews").length) {
118
119    } else {
120        $(".ftonews-wrap").remove();
121    }
122    
123    if ($(".fto-reports .fto-report-list .msl-resourcelist").length) {
124
125    } else {
126        $(".fto-reports").remove();
127    }
128    
129
130    
131    if ($(".msl-election-stage").length > 0) {
132        electime2 = $(".msl-election-stage").html();
133        if (electime2.match(/(([0-9]{2}):([0-9]{2}))/gm) !== null) {
134            tttime = electime2.match(/(([0-9]{2}):([0-9]{2}))/gm).toString();
135            finaltime = electime2.replace(tttime, tttime + " (GMT)");
136        } else {
137            finaltime = electime2;
138        }
139        
140        $(".msl-election-stage").html(finaltime);
141    }
142    $( "#navigation-rb" ).each(function( index ) {
143        $(this).removeClass("mslwidget");
144        $(this).removeClass("navigation-rb");
145        $(this).addClass("collapse");
146        $(this).addClass("navbar-collapse");
147    });
148    $(".navbar .logo img").addClass("header-logo");
149    $(".navbar .logo").addClass("nav-link");
150    $(".navbar .logo").addClass("nav-logo");
151    $(".navbar .logo").removeClass("logo");
152    $("#navigation-rb .msl_navbar").addClass("navbar-nav mr-auto");
153    $("#navigation-rb .msl_navbar").removeClass("msl_navbar");
154    $( "#navigation-rb .navbar-nav li" ).each(function( index ) {
155        $(this).addClass("nav-item");
156    });
157    $( "#navigation-rb .navbar-nav li a" ).each(function( index ) {
158        $(this).addClass("nav-link");
159    });
160    $( "#navigation-rb .navbar-nav li ul" ).each(function( index ) {
161        $(this).removeClass("level_1");
162        snav = $(this).attr('class');
163        $(this).attr("aria-labelledby", snav);
164        $(this).parent().addClass("dropdown");
165        $(this).siblings("a").attr("role", "button");
166        $(this).siblings("a").attr("data-toggle", "dropdown");
167        $(this).siblings("a").attr("aria-haspopup", "true");
168        $(this).siblings("a").attr("aria-expanded", "false");
169        $(this).removeClass();
170        $(this).addClass("dropdown-menu");
171        
172    });
173    $("#navigation-rb .navbar-nav .dropdown-menu li").each(function( index ) {
174       $(this).removeClass();
175       $(this).addClass("dropdown-item");
176    });
177    $("#navigation-rb .navbar-nav .dropdown-menu li a").each(function( index ) {
178       $(this).removeClass();
179    });
180    $( "#navigation-rb .navbar-nav li a.msl-itemhassubnav" ).each(function( index ) {
181        $(this).addClass("dropdown-toggle");
182        $(this).removeClass("msl-itemhassubnav");
183    });
184    $("#nav-rb").removeClass("invisible");
185    $("#navigation-rb").removeClass("nav-load");
186    headimg = $(".msl-pagebanner img").attr("src");
187    //console.log(headimg);
188    if (headimg===undefined) {
189        headimg = "/stylesheet/hw/background-pink.png";
190    } else {
191        picsize = headimg.split('?');
192	    picsize = picsize[0]+'?thumbnail_height=336&thumbnail_width=2000&resize_type=CropToFit';
193	    headimg = picsize;
194    }
195    
196    var searchvisible = 0;			
197    $(".search-link").click(function(e){ 
198            console.log('true');
199    	//This stops the page scrolling to the top on a # link.
200    	e.preventDefault();
201    	if (searchvisible ===0) {
202    		//Search is currently hidden. Slide down and show it.
203    		$(".search-form").slideDown(200);
204    		$(".search-form input.textbox").focus(); //Set focus on the search input field.
205    		searchvisible = 1; //Set search visible flag to visible.
206    	} else {
207    		//Search is currently showing. Slide it back up and hide it.
208    		$(".search-form").slideUp(200);
209    		searchvisible = 0;
210    	}
211    });
212    
213    $( ".add-new" ).each(function( index ) {
214        $(this).append("&nbsp;<span class='badge badge-pill badge-union'>New!</span>")
215    });
216    
217    $(".heading-banner").css("background-image", "url(" + headimg + ")");
218    $(".heading-banner .msl-pagebanner").remove();
219    $(".heading-banner h1").appendTo(".msl-pagebanner");
220    if($(".also-in .level_2").length) {
221        $(".also-in").prepend("<h4>or maybe...</h4>");
222        $(".also-in").prepend($(".also-in .level_3"));
223        $(".also-in").prepend($(".also-in .level_2"));
224    }
225    
226    if (!$.trim( $('.also-in').html() ).length) {
227        $(".also-in-title").remove();
228    }
229    
230    $(".footer-nav-links .level_1, .footer-nav-links .level_2, .footer-nav-links .level_3").each(function( index ) {
231       $(this).remove();
232    });
233
234	$( ".news_full .news_item img" ).each(function( index ) {
235        picsize = $(this).attr('src').split('?');
236        $(this).attr('src', picsize[0]+'?thumbnail_height=200&thumbnail_width=200&resize_type=CropToFit')
237
238    });
239    
240    $(".auto-col").prepend("<div class='row'>");
241    var cc=0;
242    $(".auto-col td").each(function () {
243        cc++;
244        $(".auto-col .row").append("<div class='col-12 col-md-4' id='col" + cc + "'>");
245        $(".auto-col .row #col" + cc).append($(this).children());
246    });
247    $(".auto-col table").remove();
248    
249    $('#single-checkbox input:checkbox').each(function () {
250        var infoDiv;
251        $( this ).click(function() {
252            curSel = $(this);
253            updateChkbox($(this).prop('name'));
254        });
255        if ($(this).prop('checked') === true) {
256            infoDiv = $(this).siblings("label").html();
257            infoDiv = infoDiv.replace(/[^a-z0-9+]+/gi, "");
258            $(".single-checkbox-info[data-info=" + infoDiv + "]").removeClass("d-none");
259        }
260    });
261    
262    
263    
264    function updateChkbox(curSel) {
265        var subBtn;
266        $('#single-checkbox input').each(function () {
267            if ($(this).prop('type') == "submit") {
268                subBtn = $(this);
269            } else {
270                if ($(this).prop('name') === curSel) {
271                    
272                } else {
273                    $(this).prop("checked", false);
274                }
275            }
276        });
277        $(subBtn).click();
278    }
279    
280
281
282    
283    $('#single-checkbox label, #single-checkbox-man label').each(function () {
284        switch ($(this).html()) {
285            case "Segment - New":
286                $(this).html("I'm new here and don't know anything about the Student Union");
287                $(this).css("visibility","visible");
288                break;
289            case "Segment - Intermediate":
290                $(this).html("I'm a returning student, but don't know much about you!");
291                $(this).css("visibility","visible");
292                break;
293            case "Segment - Active":
294                $(this).html("I'm a returning student, and we know each other well!");
295                $(this).css("visibility","visible");
296                break;
297            default:
298                $(this).css("visibility","visible");
299                break;
300        }
301    });
302    
303    if ($("#single-checkbox-man input[type=submit]").length > 0) {
304        $("#single-checkbox-man").append("<p class='sub-btn'>");
305        $("#single-checkbox-man .sub-btn").append($("#single-checkbox-man input[type=submit]"));
306    }
307    
308    $( ".msl_table" ).each(function( index ) {
309        $(this).removeClass("msl_table");
310        $(this).addClass("table table-striped table-bordered table-hover table-sm rb-table");
311    });
312    $("#ctl00_Main_txtExternalUrl_fp").append("<p class='text-danger'><strong>A note about External URL:</strong> Putting a link in this box (like a Facebook Event) will mean the user is sent to this link when they click on your event - they will not see the event page / any information you write in the Event Description. It's not for showing a link to a Zoom / Teams Meeting.</p>")
313    
314    $("#newnews .msl-tag").each(function () {
315       $(this).addClass("badge badge-union"); 
316       $(this).wrap("<a href=/wattu/?f=" + $(this).html().replace(/[\W\s]/g, '').toLowerCase() + "></a>");
317    });
318    
319    $(".method-pp div div div").prepend("<p>Click Check Out with PayPal below to make your payment. Paypal will ask for your email address - if you have a PayPal account it will then ask for your password. If you don't, you will have the option to pay with your Debit or Credit Card.</p>");
320    
321    $(".msl_event_types").each(function () {
322       cur = $(this).html();
323       cur = cur.replace(/\|/g,"");
324       $(this).html(cur);
325    });
326    
327    $(".msl_event_types a").each(function () {
328       cur = $(this).html();
329       switch (cur) {
330           case "Featured":
331               //$(this).addClass("d-none");
332               break;
333            case "Recurring Event":
334                //$(this).addClass("d-none");
335                break;
336            case "Edinburgh Campus":
337            case "SBC Campus":
338                $(this).addClass("badge badge-union show badge-campus");
339                $(this).removeAttr("href");
340                break;
341            default:
342                $(this).addClass("badge badge-union show");
343                //$(this).attr("href","")
344                $(this).removeAttr("href");
345                break;
346       }
347    });
348    
349    $( ".timeline > li > h3" ).each(function( index ) {
350      $(this).parent().addClass("heading");
351    });
352    
353    $( ".timeline > li > h4" ).each(function( index ) {
354      $(this).parent().addClass("subheading");
355    })
356    
357    $("span[data-field]").each( function () {
358		$(this).html(eval("mslUserInfo.userinfo." + $(this).attr("data-field")));
359		//$(this).html(mslUserInfo.userinfo.FirstName);
360	});
361	
362	$("#profile_about dl dt, #profile_about dl dd").each(function(){
363        if ($(this).is("dt")) {
364            if ($(this).html() != "Say Hi") {
365                $("#profile_about").append("<h3>" + $(this).html() + "</h3>");
366            }
367        }
368        if ($(this).is("dd")) {
369            $("#profile_about").append("<p>" + $(this).html() + "</p>");
370        }
371    });
372    $("#profile_about dl").remove();
373    
374    
375    
376});
377
378// for starting the confetti 
379
380        const start = () => {
381            setTimeout(function() {
382                confetti.start()
383            }, 500); // 1000 is time that after 1 second start the confetti ( 1000 = 1 sec)
384        };
385
386        //  for stopping the confetti 
387
388        const stop = () => {
389            setTimeout(function() {
390                confetti.stop()
391            }, 3000); // 5000 is time that after 5 second stop the confetti ( 5000 = 5 sec)
392        };
393        
394/**
395* @app ReadMoreJS
396* @desc Breaks the content of an element to the specified number of words
397* @version 1.0.0
398* @license The MIT License (MIT)
399* @author George Raptis | http://georap.gr 
400*/
401(function (c, b, a) {
402    var d = {};
403    d.helpers = {
404        extendObj: function () {
405            for (var g = 1, e = arguments.length; g < e; g++) {
406                for (var f in arguments[g]) {
407                    if (arguments[g].hasOwnProperty(f)) {
408                        if (arguments[g][f] && arguments[g][f].constructor && arguments[g][f].constructor === Object) {
409                            arguments[0][f] = arguments[0][f] || {};
410                            this.extendObj(arguments[0][f], arguments[g][f]);
411                        } else {
412                            arguments[0][f] = arguments[g][f];
413                        }
414                    }
415                }
416            }
417            return arguments[0];
418        },
419    };
420    d.countWords = function (e) {
421        return e.split(/\s+/).length;
422    };
423    d.generateTrimmed = function (f, e) {
424        return f.split(/\s+/).slice(0, e).join(" ") + "...";
425    };
426    d.init = function (w) {
427        var f = { target: "", numOfWords: 50, toggle: true, moreLink: "read more...", lessLink: "read less" };
428        w = d.helpers.extendObj({}, f, w);
429        var q = b.querySelectorAll(w.target),
430            t = q.length,
431            v,
432            s,
433            r,
434            u = [],
435            n = [],
436            m,
437            k,
438            e,
439            h,
440            p,
441            g,
442            o;
443        for (m = 0; m < t; m++) {
444            v = q[m].innerHTML;
445            s = d.generateTrimmed(v, w.numOfWords);
446            r = d.countWords(v);
447            u.push(v);
448            n.push(s);
449            if (w.numOfWords < r - 1) {
450                q[m].innerHTML = n[m];
451                h = b.createElement("div");
452                h.setAttribute("class", "rm-cont");
453                h.innerHTML = '<a id="rm-more_' + m + '" class="rm-link" style="cursor:pointer;">' + w.moreLink + "</a>";
454                q[m].parentNode.insertBefore(h, q[m].nextSibling);
455            }
456        }
457        p = b.querySelectorAll(".rm-link");
458        for (k = 0, e = p.length; k < e; k++) {
459            p[k].onclick = function () {
460                g = this.getAttribute("id");
461                o = g.split("_")[1];
462                if (this.getAttribute("data-clicked") !== "true") {
463                    q[o].innerHTML = u[o];
464                    if (w.toggle !== false) {
465                        this.innerHTML = w.lessLink;
466                        this.setAttribute("data-clicked", true);
467                    } else {
468                        this.innerHTML = "";
469                    }
470                } else {
471                    q[o].innerHTML = n[o];
472                    this.innerHTML = w.moreLink;
473                    this.setAttribute("data-clicked", false);
474                }
475            };
476        }
477    };
478    window.$readMoreJS = d;
479    
480})(this, this.document);
481$(document).ready(function () {
482    
483    $readMoreJS.init({
484    target: '.condense',           // Selector of the element the plugin applies to (any CSS selector, eg: '#', '.'). Default: ''
485    numOfWords: 50,               // Number of words to initially display (any number). Default: 50
486    toggle: true,                 // If true, user can toggle between 'read more' and 'read less'. Default: true
487    moreLink: '<span class="fas fa-angle-double-down"></span> Read More ...',    // The text of 'Read more' link. Default: 'read more ...'
488    lessLink: '<span class="fas fa-angle-double-up"></span> Read Less'         // The text of 'Read less' link. Default: 'read less'
489    });
490});
491
492function ba(selection) {
493  switch (selection) {
494        case 1:
495            start();
496            stop();
497            $("#bigAsk .modal-body").html("<h2>WOW YOU'RE AMAZING!</h2><p>Thank you SO much for giving us your feedback.</p><p>Have some confetti to celebrate your awesome-ness!</p><p><a href='javascript:ba(4);' class='btn btn-block btn-union btn-lg'>OK</a></p>");
498            break;
499        case 2:
500            window.location.href = "/bigask";
501            break;
502        case 3:
503            $('#bigAsk').modal('hide');
504            break;
505        case 4:
506            $('#bigAsk').modal('hide');
507            break;
508        case 0:
509            if (getCookie("bigask21") == "yes") {
510
511            } else {
512                $('#bigAsk').modal('show');
513            }
514            var d = new Date();
515            d.setTime(d.getTime() + (180*24*60*60*1000));
516            var expires = "expires="+ d.toUTCString();
517            document.cookie = "bigask21=yes;" + expires + ";path=/";
518            break;
519  }  
520};

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.