-
Notifications
You must be signed in to change notification settings - Fork 258
/
Copy paththeme.js
executable file
·60 lines (51 loc) · 1.79 KB
/
theme.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
$(function() {
$('ul.dropmenu, ul.quickbuttons').superfish({delay : 250, speed: 100, sensitivity : 8, interval : 50, timeout : 1});
// tooltips
$('.preview').SMFtooltip();
// find all nested linked images and turn off the border
$('a.bbc_link img.bbc_img').parent().css('border', '0');
});
// The purpose of this code is to fix the height of overflow: auto blocks, because some browsers can't figure it out for themselves.
function smf_codeBoxFix()
{
var codeFix = $('code');
$.each(codeFix, function(index, tag)
{
if (is_webkit && $(tag).height() < 20)
$(tag).css({height: ($(tag).height() + 20) + 'px'});
else if (is_ff && ($(tag)[0].scrollWidth > $(tag).innerWidth() || $(tag).innerWidth() == 0))
$(tag).css({overflow: 'scroll'});
// Holy conditional, Batman!
else if (
'currentStyle' in $(tag) && $(tag)[0].currentStyle.overflow == 'auto'
&& ($(tag).innerHeight() == '' || $(tag).innerHeight() == 'auto')
&& ($(tag)[0].scrollWidth > $(tag).innerWidth() || $(tag).innerWidth == 0)
&& ($(tag).outerHeight() != 0)
)
$(tag).css({height: ($(tag).height + 24) + 'px'});
});
}
// Add a fix for code stuff?
if (is_ie || is_webkit || is_ff)
addLoadEvent(smf_codeBoxFix);
// Toggles the element height and width styles of an image.
function smc_toggleImageDimensions()
{
$('.postarea .bbc_img.resized').each(function(index, item)
{
$(item).click(function(e)
{
$(item).toggleClass('original_size');
});
});
}
// Add a load event for the function above.
addLoadEvent(smc_toggleImageDimensions);
function smf_addButton(stripId, image, options)
{
$('#' + stripId).append(
'<a href="' + options.sUrl + '" class="button last" ' + ('sCustom' in options ? options.sCustom : '') + ' ' + ('sId' in options ? ' id="' + options.sId + '_text"' : '') + '>'
+ options.sText +
'</a>'
);
}