1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/styles/art_air_green/template/style.js Fri Mar 09 16:14:29 2012 +0400
1.3 @@ -0,0 +1,214 @@
1.4 +if(typeof(oldIE) == 'undefined') var oldIE = false;
1.5 +
1.6 +$(document).ready(function() {
1.7 + // detect browser
1.8 + var browser = (navigator.userAgent) ? navigator.userAgent : '';
1.9 + if(typeof(clrIE) == 'boolean')
1.10 + {
1.11 + browser = 'ie';
1.12 + }
1.13 + else
1.14 + {
1.15 + browser = (browser.indexOf('Opera') >= 0) ? (
1.16 + (browser.indexOf('Opera Mini/') > 0) ? 'opera-mini' : 'opera') : (
1.17 + (browser.indexOf('Gecko/') > 0) ? 'mozilla' : (
1.18 + (browser.indexOf('WebKit/') > 0) ? 'webkit' : (
1.19 + (browser.indexOf('MSIE') > 0) ? 'ie' : 'unknown'
1.20 + )
1.21 + )
1.22 + );
1.23 + }
1.24 + $('body').addClass('browser-' + browser + ((oldIE) ? ' old-ie transform' : ''));
1.25 +
1.26 + // transformations and test browser
1.27 + if(!oldIE)
1.28 + {
1.29 + var test = document.createElement('canvas'),
1.30 + found = false,
1.31 + list = new Array('MozTransform', 'webkitTransform', 'OTransform', 'transform', 'msTransform');
1.32 + for(var i=0; i<list.length; i++)
1.33 + {
1.34 + if(typeof(test.style[list[i]]) != 'undefined') found = true;
1.35 + }
1.36 + if(found) $('body').addClass('can-transform');
1.37 + if(test.style['textShadow'] != 'undefined') $('body').addClass('has-shadows');
1.38 + delete test;
1.39 +
1.40 + setTimeout("$('body').addClass('transform');", 500);
1.41 + $(window).load(function() { $('body').addClass('transform'); });
1.42 + }
1.43 +
1.44 + // navigation
1.45 + $('div.nav-extra').not('div.nav-extra-footer').each(function()
1.46 + {
1.47 + var count = 0;
1.48 + $(this).find('a').each(function() {
1.49 + if(count > 0) $(this).before(' • ');
1.50 + count ++;
1.51 + });
1.52 + if(!count) $(this).css('display', 'none');
1.53 + });
1.54 +
1.55 + $('#footer div.nav-links > a').each(function(i)
1.56 + {
1.57 + if(i > 0) $(this).before(' • ');
1.58 + });
1.59 +
1.60 + // clear divs
1.61 + $('#page-body, #footer').append('<div class="clear"></div>');
1.62 + $('.cp-mini:last').after('<div class="clear"></div>');
1.63 +
1.64 + // remove extra lines
1.65 + $('#page-body > hr, #cp-main > hr, #page-body > form > hr').remove();
1.66 +
1.67 + // unread posts
1.68 + $('dl.icon').each(function()
1.69 + {
1.70 + var bg = $(this).css('background-image');
1.71 + if(bg.length && bg.indexOf('_unread') > 0)
1.72 + {
1.73 + $(this).parents('li:first').addClass('unread');
1.74 + }
1.75 + else if(bg.length && bg.indexOf('forum_link') > 0)
1.76 + {
1.77 + $(this).parents('li:first').addClass('forum-link');
1.78 + }
1.79 + });
1.80 +
1.81 + // topic title
1.82 + $('body.section-viewtopic #page-body > h2:first').addClass('title');
1.83 +
1.84 + // index: reported/unapproved topics
1.85 + $('li.row a img').each(function()
1.86 + {
1.87 + if(this.src.indexOf('icon_topic_unapproved') > 0)
1.88 + {
1.89 + $(this).parents('li.row:first').addClass('unapproved');
1.90 + }
1.91 + });
1.92 + $('dd.lastpost a img').each(function()
1.93 + {
1.94 + if(this.src.indexOf('icon_topic_unapproved') > 0 || this.src.indexOf('icon_topic_reported') > 0)
1.95 + {
1.96 + var prev = $(this).parents('dl.icon:first').find('dt');
1.97 + if(!prev.length) return;
1.98 + if(!prev.find('div.extra').length)
1.99 + {
1.100 + prev.prepend('<div class="extra"></div>');
1.101 + }
1.102 + prev = prev.find('div.extra');
1.103 + $(this).parent('a').appendTo(prev);
1.104 + }
1.105 + });
1.106 +
1.107 + // remove rounded block within rounded block
1.108 + $('div.panel div.post, div.panel ul.topiclist, div.panel table.table1, div.panel dl.panel').parents('div.panel').addClass('panel-wrapper');
1.109 +
1.110 + // tabs
1.111 + $('#tabs, #navigation, #minitabs').each(function()
1.112 + {
1.113 + var last = false,
1.114 + count = 0;
1.115 + $('li', $(this)).each(function(i)
1.116 + {
1.117 + if(i == 0) $(this).addClass('first');
1.118 + last = $(this);
1.119 + count ++;
1.120 + });
1.121 + if(count < 2)
1.122 + {
1.123 + $(this).hide();
1.124 + }
1.125 + else
1.126 + {
1.127 + if(last !== false) last.addClass('last');
1.128 + $(this).find('hr').remove();
1.129 + $(this).parents('form').css('display', 'inline');
1.130 + $(this).append('<div class="clear"></div>');
1.131 + $(this).find('a').each(function()
1.132 + {
1.133 + if(!$('span', this).length)
1.134 + {
1.135 + $(this).html('<span>' + $(this).html() + '</span>');
1.136 + }
1.137 + });
1.138 + }
1.139 + });
1.140 + $('#navigation').parents('.panel').removeClass('panel').addClass('cp-panel');
1.141 +
1.142 + // control panel: remove empty boxes
1.143 + $('#cp-main .panel').each(function()
1.144 + {
1.145 + var inner = $(this).find('.inner:first');
1.146 + if(!inner.length) return;
1.147 + if(inner.children().length < 2)
1.148 + {
1.149 + $(this).hide();
1.150 + }
1.151 + });
1.152 +
1.153 + // fix right side margin
1.154 + $('#page-body > p.rightside').each(function()
1.155 + {
1.156 + var next = $(this).next();
1.157 + if(next.is('p') && !next.hasClass('rightside')) next.css('margin-top', 0);
1.158 + });
1.159 +
1.160 + // pm post
1.161 + $('.post > div, .panel > div').addClass('inner');
1.162 +
1.163 + // emulate multiple backgrounds
1.164 + if(oldIE)
1.165 + {
1.166 + $('#header, #footer').wrapInner('<div class="hdr1"><div class="hdr2"><div class="hdr3"><div class="hdr4"><div class="hdr5"><div class="hdr6"></div></div></div></div></div></div>');
1.167 + $('#footer').wrapInner('<div class="hdr1"><div class="hdr2"></div></div>');
1.168 + $('div.panel > .inner').addClass('inner-panel');
1.169 + $('div.forabg, div.forumbg, div.panel-wrapper').not('.cp-panel').addClass('old-ie-wrap-1').wrapInner('<div class="hdr1-1"><div class="hdr1-2"><div class="hdr1-3"><div class="hdr1-4"><div class="hdr1-5"></div></div></div></div></div>');
1.170 + $('div.post, .panel, .cp-mini, ul.topiclist li').not('.header, .panel-wrapper').addClass('old-ie-wrap-2').wrapInner('<div class="hdr2-1"><div class="hdr2-2"><div class="hdr2-3"><div class="hdr2-4"><div class="hdr2-5"><div class="hdr2-6"><div class="hdr2-last"></div></div></div></div></div></div></div>');
1.171 + }
1.172 +
1.173 + // search box
1.174 + $('div.search-box input').focus(function() { $(this).parents('.search-box').addClass('focus'); }).blur(function() { $(this).parents('.search-box').removeClass('focus'); })
1.175 +
1.176 + // header search box
1.177 + $('#search-box form').submit(function() { var value = $('#search-box input:text').val(); return (value == laSearchMini || value == '') ? false : true; });
1.178 + $('#search-box input:text').focus(function() {
1.179 + if(this.value == laSearchMini) this.value = '';
1.180 + $('#search-box').addClass('focused');
1.181 + }).blur(function() {
1.182 + if(this.value == '') this.value = laSearchMini;
1.183 + $('#search-box').removeClass('focused');
1.184 + });
1.185 +
1.186 + // old browser warning
1.187 + function hasCookie(search)
1.188 + {
1.189 + var cookie = document.cookie.split(';');
1.190 + search += '=';
1.191 + for(var i=0; i<cookie.length; i++)
1.192 + {
1.193 + var c = cookie[i];
1.194 + while (c.charAt(0)==' ') c = c.substring(1,c.length);
1.195 + if (c.indexOf(search) == 0) return true;
1.196 + }
1.197 + return false;
1.198 + }
1.199 + if(oldIE && imagesetLang && !hasCookie('oldie'))
1.200 + {
1.201 + $('body').prepend('<div id="old-browser" style="display: none;"></div>');
1.202 + $('#old-browser').load(imagesetLang + '/oldie.txt', function() { $('#old-browser').slideDown(); });
1.203 + }
1.204 +});
1.205 +
1.206 +$(window).load(function() {
1.207 + // set min width
1.208 + var min = 40;
1.209 + $('#nav-header a, #search-adv, #search-box').each(function()
1.210 + {
1.211 + min += $(this).width() + 20;
1.212 + });
1.213 + $('body').css('min-width', Math.min(
1.214 + Math.floor(min),
1.215 + Math.floor($('body').width())
1.216 + ) + 'px');
1.217 +});