PageSourceSearch

https://www.ber.org/store/js/accordion.js

js ber.org collected 2026-10-03 22:41:21 UTC 28,744 bytes, 423 lines download raw bytes

1//** Accordion Content script: By Dynamic Drive, at http://www.dynamicdrive.com
2//** Created: Jan 7th, 08'. Last updated: Feb 16th, 2012 to v2.0
3
4//Version 1.9: June 7th, 2010':
5//**1) Ajax content support added, so a given header's content can be dynamically fetched from an external file and on demand.
6//**2) Optimized script performance by caching header and content container references
7
8//Version 2.0: Feb 16th, 2012':
9//** 1) Added option ("scrolltoheader") to scroll to the expanded header in question after it expands (useful if a header contains long content).
10
11
12var ddaccordion = {
13    ajaxloadingmsg: '<img src="loading2.gif" /><br />Loading Content...', //customize HTML to output while Ajax content is being fetched (if applicable)
14
15    headergroup: {}, //object to store corresponding header group based on headerclass value
16    contentgroup: {}, //object to store corresponding content group based on headerclass value
17
18    preloadimages: function ($images) {
19        $images.each(function () {
20            var preloadimage = new Image()
21            preloadimage.src = this.src
22        })
23    },
24
25    expandone: function (headerclass, selected, scrolltoheader) { //PUBLIC function to expand a particular header
26        this.toggleone(headerclass, selected, "expand", scrolltoheader)
27    },
28
29    collapseone: function (headerclass, selected) { //PUBLIC function to collapse a particular header
30        this.toggleone(headerclass, selected, "collapse")
31    },
32
33    expandall: function (headerclass) { //PUBLIC function to expand all headers based on their shared CSS classname
34        var $headers = this.headergroup[headerclass]
35        this.contentgroup[headerclass].filter(':hidden').each(function () {
36            $headers.eq(parseInt($(this).attr('contentindex'))).trigger("evt_accordion")
37        })
38    },
39
40    collapseall: function (headerclass) { //PUBLIC function to collapse all headers based on their shared CSS classname
41        var $headers = this.headergroup[headerclass]
42        this.contentgroup[headerclass].filter(':visible').each(function () {
43            $headers.eq(parseInt($(this).attr('contentindex'))).trigger("evt_accordion")
44        })
45    },
46
47    toggleone: function (headerclass, selected, optstate, scrolltoheader) { //PUBLIC function to expand/ collapse a particular header
48        var $targetHeader = this.headergroup[headerclass].eq(selected)
49        var $subcontent = this.contentgroup[headerclass].eq(selected)
50        if (typeof optstate == "undefined" || optstate == "expand" && $subcontent.is(":hidden") || optstate == "collapse" && $subcontent.is(":visible"))
51            $targetHeader.trigger("evt_accordion", [false, scrolltoheader])
52    },
53
54    ajaxloadcontent: function ($targetHeader, $targetContent, config, callback) {
55        var ajaxinfo = $targetHeader.data('ajaxinfo')
56
57        function handlecontent(content) { //nested function
58            if (content) { //if ajax content has loaded
59                ajaxinfo.cacheddata = content //remember ajax content 
60                ajaxinfo.status = "cached" //set ajax status to cached
61                if ($targetContent.queue("fx").length == 0) { //if this content isn't currently expanding or collapsing
62                    $targetContent.hide().html(content) //hide loading message, then set sub content's HTML to ajax content
63                    ajaxinfo.status = "complete" //set ajax status to complete
64                    callback() //execute callback function- expand this sub content
65                }
66            }
67            if (ajaxinfo.status != "complete") {
68                setTimeout(function () { handlecontent(ajaxinfo.cacheddata) }, 100) //call handlecontent() again until ajax content has loaded (ajaxinfo.cacheddata contains data)
69            }
70        } //end nested function
71
72        if (ajaxinfo.status == "none") { //ajax data hasn't been fetched yet
73            $targetContent.html(this.ajaxloadingmsg)
74            $targetContent.slideDown(config.animatespeed)
75            ajaxinfo.status = "loading" //set ajax status to "loading"
76            $.ajax({
77                url: ajaxinfo.url, //path to external menu file
78                error: function (ajaxrequest) {
79                    handlecontent('Error fetching content. Server Response: ' + ajaxrequest.responseText)
80                },
81                success: function (content) {
82                    content = (content == "") ? " " : content //if returned content is empty, set it to "space" is content no longer returns false/empty (hasn't loaded yet)
83                    handlecontent(content)
84                }
85            })
86        }
87        else if (ajaxinfo.status == "loading")
88            handlecontent(ajaxinfo.cacheddata)
89    },
90
91    expandit: function ($targetHeader, $targetContent, config, useractivated, directclick, skipanimation, scrolltoheader) {
92        var ajaxinfo = $targetHeader.data('ajaxinfo')
93        if (ajaxinfo) { //if this content should be fetched via Ajax
94            if (ajaxinfo.status == "none" || ajaxinfo.status == "loading")
95                this.ajaxloadcontent($targetHeader, $targetContent, config, function () { ddaccordion.expandit($targetHeader, $targetContent, config, useractivated, directclick) })
96            else if (ajaxinfo.status == "cached") {
97                $targetContent.html(ajaxinfo.cacheddata)
98                ajaxinfo.cacheddata = null
99                ajaxinfo.status = "complete"
100            }
101        }
102        this.transformHeader($targetHeader, config, "expand")
103        $targetContent.slideDown(skipanimation ? 0 : config.animatespeed, function () {
104            config.onopenclose($targetHeader.get(0), parseInt($targetHeader.attr('headerindex')), $targetContent.css('display'), useractivated)
105            if (scrolltoheader) {
106                var sthdelay = (config["collapseprev"]) ? 20 : 0
107                clearTimeout(config.sthtimer)
108                config.sthtimer = setTimeout(function () { ddaccordion.scrollToHeader($targetHeader) }, sthdelay)
109            }
110            if (config.postreveal == "gotourl" && directclick) { //if revealtype is "Go to Header URL upon click", and this is a direct click on the header
111                var targetLink = ($targetHeader.is("a")) ? $targetHeader.get(0) : $targetHeader.find('a:eq(0)').get(0)
112                if (targetLink) //if this header is a link
113                    setTimeout(function () { location = targetLink.href }, 200 + (scrolltoheader ? 400 + sthdelay : 0)) //ignore link target, as window.open(targetLink, targetLink.target) doesn't work in FF if popup blocker enabled
114            }
115        })
116    },
117
118    scrollToHeader: function ($targetHeader) {
119        ddaccordion.$docbody.stop().animate({ scrollTop: $targetHeader.offset().top }, 400)
120    },
121
122    collapseit: function ($targetHeader, $targetContent, config, isuseractivated) {
123        this.transformHeader($targetHeader, config, "collapse")
124        $targetContent.slideUp(config.animatespeed, function () { config.onopenclose($targetHeader.get(0), parseInt($targetHeader.attr('headerindex')), $targetContent.css('display'), isuseractivated) })
125    },
126
127    transformHeader: function ($targetHeader, config, state) {
128        $targetHeader.addClass((state == "expand") ? config.cssclass.expand : config.cssclass.collapse) //alternate btw "expand" and "collapse" CSS classes
129		.removeClass((state == "expand") ? config.cssclass.collapse : config.cssclass.expand)
130        if (config.htmlsetting.location == 'src') { //Change header image (assuming header is an image)?
131            $targetHeader = ($targetHeader.is("img")) ? $targetHeader : $targetHeader.find('img').eq(0) //Set target to either header itself, or first image within header
132            $targetHeader.attr('src', (state == "expand") ? config.htmlsetting.expand : config.htmlsetting.collapse) //change header image
133        }
134        else if (config.htmlsetting.location == "prefix") //if change "prefix" HTML, locate dynamically added ".accordprefix" span tag and change it
135            $targetHeader.find('.accordprefix').html((state == "expand") ? config.htmlsetting.expand : config.htmlsetting.collapse)
136        else if (config.htmlsetting.location == "suffix")
137            $targetHeader.find('.accordsuffix').html((state == "expand") ? config.htmlsetting.expand : config.htmlsetting.collapse)
138    },
139
140    urlparamselect: function (headerclass) {
141        var result = window.location.search.match(new RegExp(headerclass + "=((\\d+)(,(\\d+))*)", "i")) //check for "?headerclass=2,3,4" in URL
142        if (result != null)
143            result = RegExp.$1.split(',')
144        return result //returns null, [index], or [index1,index2,etc], where index are the desired selected header indices
145    },
146
147    getCookie: function (Name) {
148        var re = new RegExp(Name + "=[^;]+", "i") //construct RE to search for target name/value pair
149        if (document.cookie.match(re)) //if cookie found
150            return document.cookie.match(re)[0].split("=")[1] //return its value
151        return null
152    },
153
154    setCookie: function (name, value) {
155        document.cookie = name + "=" + value + "; path=/"
156    },
157
158    init: function (config) {
159        document.write('<style type="text/css">\n')
160        document.write('.' + config.contentclass + '{display: none}\n') //generate CSS to hide contents
161        document.write('a.hiddenajaxlink{display: none}\n') //CSS class to hide ajax link
162        document.write('<\/style>')
163        jQuery(document).ready(function ($) {
164            ddaccordion.urlparamselect(config.headerclass)
165            var persistedheaders = ddaccordion.getCookie(config.headerclass)
166            ddaccordion.headergroup[config.headerclass] = $('.' + config.headerclass) //remember header group for this accordion
167            ddaccordion.contentgroup[config.headerclass] = $('.' + config.contentclass) //remember content group for this accordion
168            ddaccordion.$docbody = (window.opera) ? (document.compatMode == "CSS1Compat" ? jQuery('html') : jQuery('body')) : jQuery('html,body')
169            var $headers = ddaccordion.headergroup[config.headerclass]
170            var $subcontents = ddaccordion.contentgroup[config.headerclass]
171            config.cssclass = { collapse: config.toggleclass[0], expand: config.toggleclass[1] } //store expand and contract CSS classes as object properties
172            config.revealtype = config.revealtype || "click"
173            config.revealtype = config.revealtype.replace(/mouseover/i, "mouseenter")
174            if (config.revealtype == "clickgo") {
175                config.postreveal = "gotourl" //remember added action
176                config.revealtype = "click" //overwrite revealtype to "click" keyword
177            }
178            if (typeof config.togglehtml == "undefined")
179                config.htmlsetting = { location: "none" }
180            else
181                config.htmlsetting = { location: config.togglehtml[0], collapse: config.togglehtml[1], expand: config.togglehtml[2] } //store HTML settings as object properties
182            config.oninit = (typeof config.oninit == "undefined") ? function () { } : config.oninit //attach custom "oninit" event handler
183            config.onopenclose = (typeof config.onopenclose == "undefined") ? function () { } : config.onopenclose //attach custom "onopenclose" event handler
184            var lastexpanded = {} //object to hold reference to last expanded header and content (jquery objects)
185            var expandedindices = ddaccordion.urlparamselect(config.headerclass) || ((config.persiststate && persistedheaders != null) ? persistedheaders : config.defaultexpanded)
186            if (typeof expandedindices == 'string') //test for string value (exception is config.defaultexpanded, which is an array)
187                expandedindices = expandedindices.replace(/c/ig, '').split(',') //transform string value to an array (ie: "c1,c2,c3" becomes [1,2,3]
188            if (expandedindices.length == 1 && expandedindices[0] == "-1") //check for expandedindices value of [-1], indicating persistence is on and no content expanded
189                expandedindices = []
190            if (config["collapseprev"] && expandedindices.length > 1) //only allow one content open?
191                expandedindices = [expandedindices.pop()] //return last array element as an array (for sake of jQuery.inArray())
192            if (config["onemustopen"] && expandedindices.length == 0) //if at least one content should be open at all times and none are, open 1st header
193                expandedindices = [0]
194            $headers.each(function (index) { //loop through all headers
195                var $header = $(this)
196                if (/(prefix)|(suffix)/i.test(config.htmlsetting.location) && $header.html() != "") { //add a SPAN element to header depending on user setting and if header is a container tag
197                    $('<span class="accordprefix"></span>').prependTo(this)
198                    $('<span class="accordsuffix"></span>').appendTo(this)
199                }
200                $header.attr('headerindex', index + 'h') //store position of this header relative to its peers
201                $subcontents.eq(index).attr('contentindex', index + 'c') //store position of this content relative to its peers
202                var $subcontent = $subcontents.eq(index)
203                var $hiddenajaxlink = $subcontent.find('a.hiddenajaxlink:eq(0)') //see if this content should be loaded via ajax
204                if ($hiddenajaxlink.length == 1) {
205                    $header.data('ajaxinfo', { url: $hiddenajaxlink.attr('href'), cacheddata: null, status: 'none' }) //store info about this ajax content inside header
206                }
207                var needle = (typeof expandedindices[0] == "number") ? index : index + '' //check for data type within expandedindices array- index should match that type
208                if (jQuery.inArray(needle, expandedindices) != -1) { //check for headers that should be expanded automatically (convert index to string first)
209                    ddaccordion.expandit($header, $subcontent, config, false, false, !config.animatedefault) //3rd last param sets 'isuseractivated' parameter, 2nd last sets isdirectclick, last sets skipanimation param
210                    lastexpanded = { $header: $header, $content: $subcontent }
211                }  //end check
212                else {
213                    $subcontent.hide()
214                    config.onopenclose($header.get(0), parseInt($header.attr('headerindex')), $subcontent.css('display'), false) //Last Boolean value sets 'isuseractivated' parameter
215                    ddaccordion.transformHeader($header, config, "collapse")
216                }
217            })
218            //if (config["scrolltoheader"] && lastexpanded.$header)
219            //ddaccordion.scrollToHeader(lastexpanded.$header)
220            $headers.bind("evt_accordion", function (e, isdirectclick, scrolltoheader) { //assign CUSTOM event handler that expands/ contacts a header
221                var $subcontent = $subcontents.eq(parseInt($(this).attr('headerindex'))) //get subcontent that should be expanded/collapsed
222                if ($subcontent.css('display') == "none") {
223                    ddaccordion.expandit($(this), $subcontent, config, true, isdirectclick, false, scrolltoheader) //2nd last param sets 'isuseractivated' parameter
224                    if (config["collapseprev"] && lastexpanded.$header && $(this).get(0) != lastexpanded.$header.get(0)) { //collapse previous content?
225                        ddaccordion.collapseit(lastexpanded.$header, lastexpanded.$content, config, true) //Last Boolean value sets 'isuseractivated' parameter
226                    }
227                    lastexpanded = { $header: $(this), $content: $subcontent }
228                }
229                else if (!config["onemustopen"] || config["onemustopen"] && lastexpanded.$header && $(this).get(0) != lastexpanded.$header.get(0)) {
230                    ddaccordion.collapseit($(this), $subcontent, config, true) //Last Boolean value sets 'isuseractivated' parameter
231                }
232            })
233            $headers.bind(config.revealtype, function () {
234                if (config.revealtype == "mouseenter") {
235                    clearTimeout(config.revealdelay)
236                    var headerindex = parseInt($(this).attr("headerindex"))
237                    config.revealdelay = setTimeout(function () { ddaccordion.expandone(config["headerclass"], headerindex, config.scrolltoheader) }, config.mouseoverdelay || 0)
238                }
239                else {
240                    $(this).trigger("evt_accordion", [true, config.scrolltoheader]) //last parameter indicates this is a direct click on the header
241                    return false //cancel default click behavior
242                }
243            })
244            $headers.bind("mouseleave", function () {
245                clearTimeout(config.revealdelay)
246            })
247            config.oninit($headers.get(), expandedindices)
248            $(window).bind('unload', function () { //clean up and persist on page unload
249                $headers.unbind()
250                var expandedindices = []
251                $subcontents.filter(':visible').each(function (index) { //get indices of expanded headers
252                    expandedindices.push($(this).attr('contentindex'))
253                })
254                if (config.persiststate == true && $headers.length > 0) { //persist state?
255                    expandedindices = (expandedindices.length == 0) ? '-1c' : expandedindices //No contents expanded, indicate that with dummy '-1c' value?
256                    ddaccordion.setCookie(config.headerclass, expandedindices)
257                }
258            })
259        })
260    }
261}
262
263//preload any images defined inside ajaxloadingmsg variable
264ddaccordion.preloadimages(jQuery(ddaccordion.ajaxloadingmsg).filter('img'))
265
266ddaccordion.init({
267    headerclass: "expandable1", //Shared CSS class name of headers group that are expandable
268    contentclass: "categoryitems1", //Shared CSS class name of contents group
269    revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
270    mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
271    collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
272    defaultexpanded: [], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
273    onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
274    animatedefault: false, //Should contents open by default be animated into view?
275    persiststate: true, //persist state of opened contents within browser session?
276    toggleclass: ["", "openheader"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
277    togglehtml: ["prefix", "<a href='#' onClick='ddaccordion.collapseone(&#39;expandable2&#39;,0);ddaccordion.collapseone(&#39;expandable3&#39;,0);return false'><span class='closedarrow'></span> </a>", "<a href='#' onClick='ddaccordion.collapseone(&#39;expandable2&#39;,0);ddaccordion.collapseone(&#39;expandable3&#39;,0);return false'>
277<span class='openarrow'></span> </a>"], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
278    animatespeed: "normal", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
279    oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
280        //do nothing
281    },
282    onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
283        //do nothing
284    }
285})
286
287ddaccordion.init({
288    headerclass: "expandable2", //Shared CSS class name of headers group that are expandable
289    contentclass: "categoryitems2", //Shared CSS class name of contents group
290    revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
291    mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
292    collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
293    defaultexpanded: [], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
294    onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
295    animatedefault: false, //Should contents open by default be animated into view?
296    persiststate: true, //persist state of opened contents within browser session?
297    toggleclass: ["", "openheader"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
298    togglehtml: ["prefix", "<a href='#' onClick='ddaccordion.collapseone(&#39;expandable1&#39;,0);ddaccordion.collapseone(&#39;expandable3&#39;,0);return false'><span class='closedarrow'></span> </a>", "<a href='#' onClick='ddaccordion.collapseone(&#39;expandable1&#39;,0);ddaccordion.collapseone(&#39;expandable3&#39;,0);return false'><span class='openarrow'></span> </a>"], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
299    animatespeed: "normal", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
300    oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
301        //do nothing
302    },
303    onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
304        //do nothing
305    }
306})
307
308ddaccordion.init({
309    headerclass: "expandable3", //Shared CSS class name of headers group that are expandable
310    contentclass: "categoryitems3", //Shared CSS class name of contents group
311    revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
312    mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
313    collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
314    defaultexpanded: [], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
315    onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
316    animatedefault: false, //Should contents open by default be animated into view?
317    persiststate: true, //persist state of opened contents within browser session?
318    toggleclass: ["", "openheader"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
319    togglehtml: ["prefix", "<a href='#' onClick='ddaccordion.collapseone(&#39;expandable1&#39;,0);ddaccordion.collapseone(&#39;expandable2&#39;,0);;return false'><span class='closedarrow'></span> </a>", "<a href='#' onClick='ddaccordion.collapseone(&#39;expandable1&#39;,0);ddaccordion.collapseone(&#39;expandable2&#39;,0);return false'><span class='openarrow'></span> </a>"], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
320    animatespeed: "normal", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
321    oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
322        //do nothing
323    },
324    onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
325        //do nothing
326    }
327})
328
329ddaccordion.init({
330    headerclass: "subexpandable", //Shared CSS class name of headers group that are expandable
331    contentclass: "subcategoryitems", //Shared CSS class name of contents group
332    revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
333    mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
334    collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
335    defaultexpanded: [], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
336    onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
337    animatedefault: false, //Should contents open by default be animated into view?
338    persiststate: true, //persist state of opened contents within browser session?
339    toggleclass: ["", "openheader"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
340    togglehtml: ["prefix", "<span class='closedarrow'></span>
340 ", "<span class='openarrow'></span> "], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
341    animatespeed: "normal", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
342    oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
343        //do nothing
344    },
345    onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
346        //do nothing
347    }
348})
349
350function ondemand() // Opens the "By Format -> On Demand" subsection
351{
352    ddaccordion.collapseall('expandable1'); ddaccordion.collapseall('expandable3'); ddaccordion.expandone('expandable2', 0); ddaccordion.expandone('subexpandable', 17); ddaccordion.collapseone('subexpandable', 18);
353}
354
355function instructor() // Opens the "By Format -> Instructor-Led" subsection
356{
357    ddaccordion.collapseall('expandable1'); ddaccordion.collapseall('expandable3');
357 ddaccordion.expandone('expandable2', 0); ddaccordion.expandone('subexpandable', 18); ddaccordion.collapseone('subexpandable', 17);
358}
359
360function newcourses() // Opens the "By Topic -> New" subsection
361{
362    ddaccordion.collapseall('subexpandable'); ddaccordion.collapseall('expandable2'); ddaccordion.collapseall('expandable3'); ddaccordion.expandone('expandable1', 0); ddaccordion.expandone('subexpandable', 0);
363}
364
365function allcourses() // Opens the "All Courses" section
366{
367    ddaccordion.collapseall('subexpandable'); ddaccordion.collapseall('expandable1'); ddaccordion.collapseall('expandable2'); ddaccordion.expandone('expandable3', 0);
368}
369
370function topics() // Opens the "By Topic" section
371{
372    ddaccordion.collapseall('subexpandable'); ddaccordion.collapseall('expandable2'); ddaccordion.collapseall('expandable3'); ddaccordion.expandone('expandable1', 0);
373}
374
375function CloseAll() {
376    ddaccordion.collapseall('subexpandable'); ddaccordion.collapseall('expandable1'); ddaccordion.collapseall('expandable2'); ddaccordion.collapseall('expandable3');
377}
378
379// Expand & contract specific sections via URL query link
380// Parse URL Queries
381function url_query(query) {
382    query = query.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
383    var expr = "[\\?&]" + query + "=([^&#]*)";
384    var regex = new RegExp(expr);
385    var results = regex.exec(window.location.href);
386    if (results !== null) {
387        return results[1];
388    } else {
389        return false;
390    }
391}
392
393function expand() {
394    var url_param1 = url_query('load1');
395    var url_param2 = url_query('load2');
396    var url_param3 = url_query('load3');
397    var url_param4 = url_query('load4');
398    var url_param5 = url_query('load5');
399    var url_param6 = url_query('utm_campaign');
400    if (url_param1) {
401        newcourses() // Opens the "By Topic -> New" subsection
402    }
403    if (url_param2) {
404        allcourses() // Opens the "All Courses" section
405    }
406    if (url_param3) {
407        topics() // Opens the "By Topic" section
408    }
409    if (url_param4) {
410        ondemand() // Opens the "By Format -> On Demand" subsection
411    }
412    if (url_param5) {
413        instructor() // Opens the "By Format -> Instructor-Led" subsection
414    }
415    if (url_param6) {
416        ondemand() // Opens the "By Format -> On Demand" subsection
417    } else {
418        return false;
419    }
420}
421
422// Run URL query link on page load
423//window.onload = expand;�

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.