1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- $(document).ready(function() {
- // menu drop downs
- $('ul.dropmenu, ul.quickbuttons').superfish({delay : 600, speed: 200, 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()
- {
- var images = $('img.bbc_img');
- $.each(images, function(key, img)
- {
- if ($(img).hasClass('resized'))
- {
- $(img).css({cursor: 'pointer'});
- $(img).on('click', function()
- {
- var size = $(this)[0].style.width == 'auto' ? '' : 'auto';
- $(this).css({width: size, height: size});
- });
- }
- });
- }
- // Add a load event for the function above.
- addLoadEvent(smc_toggleImageDimensions);
- function smf_addButton(stripId, image, options)
- {
- var strip = $('#' + stripId);
- var anchorItems = $('#' + stripId + '.span');
- // Kill the class name "last" in the last item.
- if (anchorItems.length > 0)
- {
- var lastSpan = anchorItems[anchorItems.length - 1];
- var lastSpanClass = $(lastSpan).attr('class');
- $(lastSpan).attr('class') = lastSpanClass.replace(/\s*last/, 'position_holder');
- }
- // Add in the new button!
- var buttonStrip = strip.children('ul');
- buttonStrip.append(
- '<li' + ('sId' in options ? ' id="' + options.sId + '"' : '') + '>' +
- '<a href="' + options.sUrl + '"' + ('sCustom' in options ? options.sCustom : '') + '>' +
- '<span class="last"' + ('sId' in options ? ' id="' + options.sId + '_text"' : '') + '>' + options.sText + '</span>' +
- '</a>' +
- '</li>'
- );
- }
|