1/* 2 Main Script 3 -------------------------------------------------------------- 4 Script name: ForumUS - Responsive phpBB 3.2 Theme/Style 5 Based on style: prosilver (the default phpBB 3.1.x style) 6 Author: ThemeLooks ( https://themeloooks.com/ ) 7 -------------------------------------------------------------- 8*/ 9 10;(function ($) { 11 "use strict"; 12 13 /* ------------------------------------------------------------------------- * 14 * COMMON VARIABLES 15 * ------------------------------------------------------------------------- */ 16 var $wn = $(window), 17 $body = $('body'); 18 19 $(function () { 20 /* ------------------------------------------------------------------------- * 21 * CUSTOM BACKGROUND IMAGE 22 * ------------------------------------------------------------------------- */ 23 var dataBgImg = $('[data-bg-img]'); 24 25 dataBgImg.each(function () { 26 $(this).css('background-image', 'url('+ $(this).data('bg-img') +')').removeAttr('data-bg-img'); 27 }); 28 29 /* ------------------------------------------------------------------------- * 30 * COLORPICKER 31 * ------------------------------------------------------------------------- */ 32 var $colorpicker = $('[data-trigger="colorpicker"]'); 33 34 if ( $colorpicker.length ) { 35 $colorpicker.colorpicker({ 36 'component': '.input-group-addon', 37 'format': 'hex' | 'rgb' | 'rgba', 38 'extensions': [ 39 { 40 'name': 'swatches', 41 'colors': { 42 '#03a9f4': '#03a9f4', 43 '#293a4a': '#293a4a', 44 '#8bc34a': '#8bc34a', 45 '#ff9600': '#ff9600', 46 '#e91e63': '#e91e63', 47 '#00BCD4': '#00BCD4', 48 '#FC5143': '#FC5143', 49 '#00B249': '#00B249', 50 '#D48B91': '#D48B91', 51 '#8CBEB2': '#8CBEB2', 52 '#4267b2': '#4267b2', 53 '#ff5252': '#ff5252' 54 } 55 } 56 ] 57 }); 58 } 59 60 /* -------------------------------------------------------------------------* 61 * HEADER STICKY 62 * -------------------------------------------------------------------------*/ 63 var $headerEl = $('#header'), 64 $headerNavEl = $('.header--nav'), 65 headerH = $headerEl.outerHeight(); 66 67 $headerNavEl.sticky(); 68 69 /* -------------------------------------------------------------------------* 70 * HEADER NAV TAB 71 * -------------------------------------------------------------------------*/ 72 var $headerNavLinks = $('.header--nav [data-toggle="tab"]') 73 , $headerNavTab = $('.header-nav--tab') 74 , $headerNavTabPane = $('.header-nav--tabpane') 75 , headerNavTabPaneH = $headerNavTabPane.outerHeight(); 76 77 $headerNavLinks.on('click', function () { 78 var $t = $(this) 79 , $tp = $(this).parent('li') 80 , toggleClas = 'active' 81 , curHref = $t.attr('href') 82 , $targetEl = $(curHref); 83 84 if ( $tp.hasClass(toggleClas) ) { 85 $tp.removeClass(toggleClas); 86 87 $targetEl.slideUp(); 88 89 $('#sticky-wrapper').css('height', ($headerNavEl.outerHeight() - $headerNavTab.outerHeight())); 90 } else { 91 $tp.siblings().removeClass(toggleClas); 92 $tp.addClass(toggleClas); 93 94 $targetEl.siblings().slideUp(); 95 $targetEl.slideDown(); 96 97 if ( !$('#sticky-wrapper').hasClass('is-sticky') ) { 98 $('#sticky-wrapper').css('height', ($headerNavEl.outerHeight() + headerNavTabPaneH)); 99 } 100 } 101 102 return false; 103 }); 104 105 /* -------------------------------------------------------------------------* 106 * HEADER SLIDER BACKGROUND 107 * -------------------------------------------------------------------------*/ 108 /* HEADER SLIDER */ 109 var $headerSliderEl = $('.header--slider.header--animated'); 110 111 if ( $headerSliderEl.length ) { 112 var jParticleNumber = function () { 113 var particles = 0; 114 115 if ( $(window).width() < 480 ) { 116 particles = 20; 117 } else if ( $(window).width() < 767 ) { 118 particles = 50; 119 } else if ( $(window).width() > 767 ) { 120 particles = 80; 121 } 122 123 return particles; 124 }; 125
126 $headerSliderEl.jParticle({ 127 background: "transparent", 128 particlesNumber: jParticleNumber() 129 }); 130 } 131 132 /* -------------------------------------------------------------------------* 133 * TOGGLE TOPIC 134 * -------------------------------------------------------------------------*/ 135 var $topicToggleBtn = $('.topic-list-header--toggle-btn'); 136 137 $topicToggleBtn.on('click', function () { 138 var $t = $(this) 139 , $toggleEl = $t.parent('.topic-list--header').siblings('.topic-list--content'); 140 141 if ( $toggleEl.height() === 0 ) { 142 $t.removeClass('toggled'); 143 $toggleEl.animate({ height: $toggleEl.data('old-height') }, 500).removeAttr('data-old-height'); 144 } else { 145 $t.addClass('toggled'); 146 $toggleEl.attr('data-old-height', $toggleEl.outerHeight()).animate({ height: '0' }, 500); 147 } 148 }); 149 150 /* -------------------------------------------------------------------------* 151 * TOGGLE SIDEBAR 152 * -------------------------------------------------------------------------*/ 153 var $toggleSidebarEl = $('.toggle-sidebar') 154 , $topicBodyEl = $('.topic--body') 155 , $topicSidebarEl = $('.topic--sidebar'); 156 157 $toggleSidebarEl.on('click', function () { 158 var $t = $(this); 159 160 if ( $t.hasClass('active') ) { 161 $toggleSidebarEl.removeClass('active'); 162 163 $topicBodyEl.add($topicSidebarEl).removeClass('expended'); 164 165 $topicSidebarEl.delay(300).fadeIn('slow'); 166 } else { 167 $toggleSidebarEl.addClass('active'); 168 169 $topicSidebarEl.fadeOut('slow', function () { 170 $topicBodyEl.add($topicSidebarEl).addClass('expended'); 171 }); 172 } 173 }); 174 175 /* -------------------------------------------------------------------------* 176 * PAGES 177 * -------------------------------------------------------------------------*/ 178 var $pagesContent = $('.pages-content'); 179 180 if ( $pagesContent.length ) { 181 $headerEl.next('.panel, .pages-content').addClass('page-template'); 182 } 183 184 /* -------------------------------------------------------------------------* 185 * FORM VALIDATION 186 * -------------------------------------------------------------------------*/ 187 var $searchFormEl = $('.header--search-bar form'); 188 189 if ( $searchFormEl.length ) { 190 $searchFormEl.validate({ 191 rules: { 192 keywords: "required" 193 }, 194 errorPlacement: function () { 195 return false; 196 } 197 }); 198 } 199 200 var $LoginFormEl = $('#LoginForm form'); 201 202 if ( $LoginFormEl.length ) { 203 $LoginFormEl.validate({ 204 rules: { 205 "username": "required", 206 "password": "required" 207 }, 208 errorPlacement: function () { 209 return false; 210 } 211 }); 212 } 213 214 var $SignupFormEl = $('#SignupForm form'); 215 216 if ( $SignupFormEl.length ) { 217 $SignupFormEl.validate({ 218 rules: { 219 signupEmail: { 220 email: true, 221 required: true 222 } 223 }, 224 errorPlacement: function () { 225 return false; 226 } 227 }); 228 } 229 230 var footerSubscribeFormEl = $('#footerSubscribeForm'); 231 232 if ( footerSubscribeFormEl.length ) { 233 footerSubscribeFormEl.validate({ 234 rules: { 235 EMAIL: { 236 required: true, 237 email: true 238 } 239 }, 240 errorPlacement: function () { 241 return true; 242 } 243 }); 244 } 245 246 /* -------------------------------------------------------------------------* 247 * PHPBB AJAX CALLBACKS 248 * -------------------------------------------------------------------------*/ 249 var $headerMNotifyEl = $('.header-member--notifications'); 250 251 phpbb.addAjaxCallback('notifications.mark_all', function(res) { 252 if (typeof res.success !== 'undefined') { 253 /* Remove Has Unread Class */ 254 $headerMNotifyEl.removeClass('has-unread'); 255 256 /* Close Popup Box */ 257 phpbb.closeDarkenWrapper(1000); 258 } 259 }); 260 261 /* ------------------------------------------------------------------------- * 262 * COLOR SWITCHER 263 * ------------------------------------------------------------------------- */
264 var themePath = $body.data('theme-path'); 265 266 if ( typeof $.cColorSwitcher !== "undefined" ) { 267 $.cColorSwitcher({ 268 'switcherTitle': 'Style 1 Colors:', 269 'switcherColors': [{ 270 bgColor: '#293a4a', 271 fgColor: '#ff6c2c', 272 filepath: themePath + '/colors/style-1-color-1.css' 273 }, { 274 bgColor: '#8bc34a', 275 fgColor: '#303030', 276 filepath: themePath + '/colors/style-1-color-2.css' 277 }, { 278 bgColor: '#03a9f4', 279 fgColor: '#303030', 280 filepath: themePath + '/colors/style-1-color-3.css' 281 }, { 282 bgColor: '#ff9600', 283 fgColor: '#293a4a', 284 filepath: themePath + '/colors/style-1-color-4.css' 285 }, { 286 bgColor: '#e91e63', 287 fgColor: '#303030', 288 filepath: themePath + '/colors/style-1-color-5.css' 289 }, { 290 bgColor: '#00BCD4', 291 fgColor: '#303030', 292 filepath: themePath + '/colors/style-1-color-6.css' 293 }, { 294 bgColor: '#FC5143', 295 fgColor: '#303030', 296 filepath: themePath + '/colors/style-1-color-7.css' 297 }, { 298 bgColor: '#00B249', 299 fgColor: '#303030', 300 filepath: themePath + '/colors/style-1-color-8.css' 301 }, { 302 bgColor: '#D48B91', 303 fgColor: '#303030', 304 filepath: themePath + '/colors/style-1-color-9.css' 305 }, { 306 bgColor: '#8CBEB2', 307 fgColor: '#303030', 308 filepath: themePath + '/colors/style-1-color-10.css' 309 }, { 310 bgColor: '#4267b2', 311 fgColor: '#303030', 312 filepath: themePath + '/colors/style-1-color-11.css' 313 }, { 314 bgColor: '#ff5252', 315 fgColor: '#293a4a', 316 filepath: themePath + '/colors/style-1-color-12.css' 317 }], 318 'switcherTarget': $('#mainColorScheme') 319 }) 320 .children('.ccs--body') 321 .children('ul') 322 .eq(1) 323 .children('li') 324 .each(function () { 325 var $t = $(this), 326 $tD = $t.data('file-path'), 327 $tDR = $tD.replace('style-1', 'style-2'); 328 329 $(this).attr('data-file-path', $tDR); 330 }) 331 .end() 332 .siblings('a') 333 .css({ 334 'display': 'block', 335 'color': '#293a4a', 336 'text-align': 'center', 337 'line-height': '40px' 338 }); 339 } 340 341 /* ------------------------------------------------------------------------- * 342 * BACK TO TOP BUTTON 343 * ------------------------------------------------------------------------- */ 344 var backToTop = { 345 $el: $('.back-to-top'), 346 $btn: $('.back-to-top button'), 347 show: function () { 348 return ( $(window).scrollTop() > 1 ) ? backToTop.$el.addClass('show') : backToTop.$el.removeClass('show'); 349 } 350 }; 351 352 backToTop.show(); 353 354 backToTop.$btn.on('click', function() { 355 $("html, body").animate({scrollTop: 0}, 500); 356 }); 357 358 /* -------------------------------------------------------------------------* 359 * ON SCROLL 360 * -------------------------------------------------------------------------*/ 361 $(window).on('scroll', function () { 362 backToTop.show(); 363 }); 364 });
365 366 $(window).on('load', function () { 367 /* ------------------------------------------------------------------------- * 368 * PRELOADER 369 * ------------------------------------------------------------------------- */ 370 $('#preloader').fadeOut('slow'); 371 }); 372})(jQuery);
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.