PageSourceSearch

https://www.crohns-sanity.org/forum/Themes/core/scripts/theme_fin20.js

js crohns-sanity.org collected 2026-09-24 12:17:41 UTC 3,704 bytes, 97 lines download raw bytes

1// The purpose of this code is to fix the height of overflow: auto blocks, because some browsers can't figure it out for themselves.
2function smf_codeBoxFix()
3{
4	var codeFix = document.getElementsByTagName('code');
5	for (var i = codeFix.length - 1; i >= 0; i--)
6	{
7		if (is_webkit && codeFix[i].offsetHeight < 20)
8			codeFix[i].style.height = (codeFix[i].offsetHeight + 20) + 'px';
9
10		else if (is_ff && (codeFix[i].scrollWidth > codeFix[i].clientWidth || codeFix[i].clientWidth == 0))
11			codeFix[i].style.overflow = 'scroll';
12
13		else if ('currentStyle' in codeFix[i] && codeFix[i].currentStyle.overflow == 'auto' && (codeFix[i].currentStyle.height == '' || codeFix[i].currentStyle.height == 'auto') && (codeFix[i].scrollWidth > codeFix[i].clientWidth || codeFix[i].clientWidth == 0) && (codeFix[i].offsetHeight != 0))
14			codeFix[i].style.height = (codeFix[i].offsetHeight + 24) + 'px';
15	}
16}
17
18// Add a fix for code stuff?
19if ((is_ie && !is_ie4) || is_webkit || is_ff)
20	addLoadEvent(smf_codeBoxFix);
21
22// Toggles the element height and width styles of an image.
23function smc_toggleImageDimensions()
24{
25	var oImages = document.getElementsByTagName('IMG');
26	for (oImage in oImages)
27	{
28		// Not a resized image? Skip it.
29		if (oImages[oImage].className == undefined || oImages[oImage].className.indexOf('bbc_img resized') == -1)
30			continue;
31
32		oImages[oImage].style.cursor = 'pointer';
33		oImages[oImage].onclick = function() {
34			this.style.width = this.style.height = this.style.width == 'auto' ? null : 'auto';
35		};
36	}
37}
38
39// Add a load event for the function above.
40addLoadEvent(smc_toggleImageDimensions);
41
42// Adds a button to a certain button strip.
43function smf_addButton(sButtonStripId, bUseImage, oOptions)
44{
45	var oButtonStrip = document.getElementById(sButtonStripId);
46	var aItems = oButtonStrip.getElementsByTagName('li');
47
48	// Remove the 'last' class from the last item.
49	if (aItems.length > 0)
50	{
51		var oLastItem = aItems[aItems.length - 1];
52		oLastItem.className = oLastItem.className.replace(/\s*last/, 'position_holder');
53	}
54
55	// Add the button.
56	var oButtonStripList = oButtonStrip.getElementsByTagName('ul')[0];
57	var oNewButton = document.createElement('li');
58	oNewButton.className = 'last';
59	setInnerHTML(oNewButton, '<a href="' + oOptions.sUrl + '" ' + ('sCustom' in oOptions ? oOptions.sCustom : '') + '><span' + ('sId' in oOptions ? ' id="' + oOptions.sId + '"': '') + '>' + oOptions.sText + '</span></a>');
60
61	oButtonStripList.appendChild(oNewButton);
62}
63
64// Adds hover events to list items. Used for a versions of IE that don't support this by default.
65var smf_addListItemHoverEvents = function()
66{
67	var cssRule, newSelector;
68
69	// Add a rule for the list item hover event to every stylesheet.
70	for (var iStyleSheet = 0; iStyleSheet < document.styleSheets.length; iStyleSheet ++)
71		for (var iRule = 0; iRule < document.styleSheets[iStyleSheet].rules.length; iRule ++)
72		{
73			oCssRule = document.styleSheets[iStyleSheet].rules[iRule];
74			if (oCssRule.selectorText.indexOf('LI:hover') != -1)
75			{
76				sNewSelector = oCssRule.selectorText.replace(/LI:hover/gi, 'LI.iehover');
77				document.styleSheets[iStyleSheet].addRule(sNewSelector, oCssRule.style.cssText);
78			}
79		}
80
81	// Now add handling for these hover events.
82	var oListItems = document.getElementsByTagName('LI');
83	for (oListItem in oListItems)
84	{
85		oListItems[oListItem].onmouseover = function() {
86			this.className += ' iehover';
87		};
88
89		oListItems[oListItem].onmouseout = function() {
90			this.className = this.className.replace(new RegExp(' iehover\\b'), '');
91		};
92	}
93}
94
95// Add hover events to list items if the browser requires it.
96if (is_ie6down && 'attachEvent' in window)
97	window.attachEvent('onload', smf_addListItemHoverEvents);

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.