1'use strict'; 2 3function otw_shortcode_tabs(selectors) { 4 5 for (var cS = 0; cS < selectors.size(); cS++) { 6 7 var selector = jQuery(selectors[cS]); 8 9 var links = selector.find('ul.ui-tabs-nav>li a'); 10 11 var active_tab = 0; 12 13 for (var cA = 0; cA < links.length; cA++) { 14 15 if (jQuery(links[cA]).parent().hasClass('ui-tabs-active ui-state-active')) { 16 17 active_tab = cA; 18 break; 19 } 20 } 21 for (var cA = 0; cA < links.length; cA++) { 22 23 if (active_tab == cA) { 24 jQuery(links[cA]).parent().addClass('ui-tabs-active ui-state-active'); 25 selector.find(jQuery(links[cA]).attr('href')).show(); 26 } else { 27 jQuery(links[cA]).parent().removeClass('ui-tabs-active ui-state-active'); 28 selector.find(jQuery(links[cA]).attr('href')).hide(); 29 } 30 ; 31 } 32 ; 33 selector.find('ul.ui-tabs-nav>li a').on( 'click', function (event) { 34 event.preventDefault(); 35 jQuery(this).parents('li').siblings().removeClass("ui-tabs-active ui-state-active"); 36 jQuery(this).parents('li').addClass("ui-tabs-active ui-state-active"); 37 var tab = jQuery(this).attr("href"); 38 jQuery(this).parents('li').parent().parent().children(".ui-widget-content").not(tab).hide(); 39 jQuery(this).parents('li').parent().parent().children(tab).show(); 40 }); 41 }; 42 43 var preselected = window.location.hash; 44 if( preselected.length ){ 45 46 preselected = preselected.replace( /^#/, '' ); 47 48 var tab_links = preselected.split( '&' ); 49 50 for( var cT = 0; cT < tab_links.length; cT++ ){ 51 52 var link = jQuery( '.otw-sc-tabs [href=#' + tab_links[ cT ] + ']' ); 53 54 if( link.length ){ 55 link.click(); 56 }; 57 }; 58 setTimeout( function(){ 59 var sc_el = jQuery( '#' + tab_links[ cT - 1 ] ); 60 jQuery('html, body').animate({ scrollTop: sc_el.offset().top - 50 }, 500); 61 }, 500 ); 62 }; 63} 64; 65function otw_shortcode_content_toggle(selector, closed) { 66 67 selector.off('click'); 68 selector.on( 'click', function () { 69 jQuery(this).toggleClass('closed').next('.toggle-content').slideToggle(350); 70 }); 71 closed.next('.toggle-content').hide(); 72} 73; 74 75function otw_shortcode_accordions(accordions) { 76 77 78 for (var cA = 0; cA < accordions.size(); cA++) { 79 80 var headers = jQuery(accordions[ cA ]).find('h3.accordion-title'); 81 var contents = jQuery(accordions[ cA ]).find('.ui-accordion-content'); 82 83 var has_open = false; 84 85 for (var cH = 0; cH < headers.size(); cH++) { 86 87 if (jQuery(headers[cH]).hasClass('closed') || has_open) { 88 jQuery(contents[cH]).hide(); 89 } else { 90 has_open = true; 91 jQuery(headers[cH]).addClass('ui-accordion-header-active ui-state-active'); 92 } 93 ; 94 } 95 ; 96 97 headers.off('click'); 98 headers.on( 'click', function () { 99 100 jQuery(this).parent().find('h3.accordion-title').not(jQuery(this)).removeClass('ui-accordion-header-active ui-state-active'); 101 jQuery(this).parent().find('.ui-accordion-content').not(jQuery(this).next()).slideUp(); 102 jQuery(this).next().slideToggle(); 103 jQuery(this).toggleClass('ui-accordion-header-active ui-state-active'); 104 }); 105 } 106 ; 107} 108; 109 110function otw_shortcode_faq(faqs) { 111 112 faqs.find('dl > dt').off('click'); 113 faqs.find('dl > dt').on( 'click', function () { 114 jQuery(this).toggleClass('open-faq').next().slideToggle(350); 115 }); 116} 117; 118 119function otw_shortcode_shadow_overlay(selectors) { 120 121 selectors.on( 'hover', function () { 122 jQuery(this).css({boxShadow: '0 0 20px 0 rgba(0,0,0,0.7) inset'}); 123 }, function () { 124 jQuery(this).css({boxShadow: '0 0 0 0'}); 125 }); 126} 127; 128function otw_shortcode_testimonials(selectors) { 129 130 selectors.find(".testimonials-prev").on( 'click', function () { 131 selectors.find(".testimonials-slide.active").hide().toggleClass('active').otwPrevOrLast().animate({"opacity": "toggle"}).toggleClass('active'); 132 }); 133 selectors.find(".testimonials-next").on( 'click', function () { 134 selectors.find(".testimonials-slide.active").hide().toggleClass('active').otwNextOrFirst().animate({"opacity": "toggle"}).toggleClass('active'); 135 }); 136} 137; 138 139function otw_shortcode_scroll_to_top(selectors) { 140 141 selectors.on( 'click', function () { 142 jQuery('html, body').animate({scrollTop: '0px'}, 700); 143 return false;
144 }); 145}; 146 147function otw_shortcode_sortable_table(selectors) { 148 149 selectors.each( function(){ 150 151 if( ( typeof( this.sortable_inited ) == undefined ) || !this.sortable_inited ){ 152 153 jQuery( this ).footable({ 154 breakpoints: { 155 phone: 480, 156 tablet: 767 157 } 158 }); 159 this.sortable_inited = 1; 160 } 161 } ); 162}; 163 164function otw_shortcode_count_down(selector) { 165 var time = selector.data('time'); 166 var newDate = new Date(time); 167 selector.otw_b_countdown({until: newDate}); 168 169} 170 171jQuery.fn.otwNextOrFirst = function (selector) { 172 var next = this.next(selector); 173 return (next.length) ? next : this.prevAll(selector).last(); 174}; 175 176jQuery.fn.otwPrevOrLast = function (selector) { 177 var prev = this.prev(selector); 178 return (prev.length) ? prev : this.nextAll(selector).last(); 179}; 180 181 182//function animate progress bar 183function animate_progressbar(selector){ 184 if( ( typeof( selector[0].inited ) == undefined ) || !selector[0].inited ){ 185 selector.data("origWidth", selector.width()).width(0).animate({ 186 width: selector.data("origWidth") 187 }, 1200); 188 selector[0].inited = true; 189 } 190} 191function otw_start_animated_image(container) { 192 if( container.length ){ 193 container.delay(1000).waypoint(function () { 194 jQuery(this.element).find('.otw-b-animate-in').addClass('otw-b-animation-start'); 195 }, {offset: 350}); 196 }; 197} 198 199/** 200 * make client slider caroucel 201 * @param {DOM} container 202 * @returns {void} 203 */ 204function otw_start_client_caroucel(container) { 205 var nav = jQuery(container).data('nav'); 206 var autoloop = jQuery(container).data('autoloop'); 207 jQuery(container).owlCarousel({ 208 loop: true, 209 margin: 10, 210 nav: nav, 211 autoplay: autoloop, 212 autoplayTimeout: 3000, 213 autoplayHoverPause: true, 214 navText: ['<i class="general foundicon-left-arrow"></i>', '<i class="general foundicon-right-arrow"></i>'], 215 navElement: 'div', 216 responsiveBaseElement: jQuery(container), 217 responsive: { 218 0: { 219 items: 1 220 }, 221 150: { 222 items: 2 223 }, 224 320: { 225 items: 3 226 }, 227 480: { 228 items: 3 229 }, 230 768: { 231 items: 4 232 }, 233 1000: { 234 items: 5 235 } 236 } 237 }); 238} 239 240function otw_start_client_caroucel_preview(container) { 241 var nav = jQuery(container).data('nav'); 242 var autoloop = jQuery(container).data('autoloop'); 243 244 jQuery(container).owlCarousel({ 245 loop: false, 246 items: 1, 247 margin: 10, 248 nav: nav, 249 autoplay: true, 250 navText: ['<i class="general foundicon-left-arrow"></i>', '<i class="general foundicon-right-arrow"></i>'], 251 }); 252} 253/** 254 * Init the slider for testimonials 255 * @param {DOM} container 256 * @returns {DOM} 257 */ 258function otw_testimonials_start(container) { 259 var nav = jQuery(container).data('nav'); 260 var autoloop = jQuery(container).data('autoloop'); 261 container.owlCarousel({ 262 loop: true, 263 margin: 10, 264 autoplay: autoloop, 265 autoplayTimeout: 2000, 266 smartSpeed: 1000, 267 items: 1, 268 navElement: 'div', 269 nav: nav, 270 navText: ['<i class="general foundicon-left-arrow"></i>', '<i class="general foundicon-right-arrow"></i>'], 271 }); 272 return container; 273} 274 275 276/** 277 * Generate gallety 278 * @param {type} e 279 * @returns {undefined} void 280 */ 281function generateGallery(e) { 282 var g = '.otw-b-gallery'; 283 var a_c = 'otw-b-active'; 284 var t = '.otw-b-gallery-thumbs'; 285 var c = '.otw-b-gallery-content-inner.otw-lightbox'; 286 var c_p = '.otw-b-gallery-content'; 287 var f = jQuery('.otw-b-gallery-thumbs li:first-child'); 288 289 var object = null; 290 if (e === false || e === 'undefined') { 291 object = f; 292 } 293 else { 294 object = e; 295 } 296 297 var src_m = jQuery('a', object).attr('href'); 298 var src_l = jQuery('a', object).attr('data-href'); 299 300 jQuery(object).siblings().removeClass(a_c); 301 jQuery(object).addClass(a_c); 302 jQuery(object).parent().siblings(c_p).find('img').hide().attr('src', src_m).fadeIn(200); 303 jQuery(object).parent().siblings(c_p).children(c).attr('href', src_l); 304 jQuery(c).nivoLightbox(); 305} 306 307function otw_shortcode_category_filter( filter_selector, content_selector ){ 308 309 // Clone portfolio items to get a second collection for Quicksand plugin 310 var portfolioClone = jQuery( content_selector ).clone(); 311
312 // Attempt to call Quicksand on every click event handler 313 jQuery( filter_selector + " a").on( 'click', function(e){ 314 315 jQuery( filter_selector + " li").removeClass("current"); 316 317 // Get the class attribute value of the clicked link 318 var filterClass = jQuery(this).parent().attr("class"); 319 320 if ( filterClass == "all" ) { 321 var filteredPortfolio = portfolioClone.find("li"); 322 } else { 323 var filteredPortfolio = portfolioClone.find("li[data-type~=" + filterClass + "]"); 324 } 325 326 // Call quicksand 327 jQuery( content_selector ).quicksand( filteredPortfolio, { 328 duration: 500 329 }); 330 331 jQuery(this).parent().addClass("current"); 332 333 // Prevent the browser jump to the link anchor 334 e.preventDefault(); 335 }) 336}
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.