1 2jQuery( function ( $ ) { 3 'use strict'; 4 5 /** 6 * Ajax for achive courses page. 7 */ 8 var _ = $( '.courses__item' ); 9 10 function getCourses( e ) { 11 e.preventDefault(); 12 13 var num = $( '.current' ).text(), 14 sortby = $( '.orderby_current' ).attr( 'data' ), 15 layout = $( '.layout_current' ).attr( 'data' ), 16 postPerpage = $( '.items_per_page' ).val(), 17 type = $( '.type_current' ).children().attr( 'data' ), 18 cat = 'all', 19 currentCat = $( '.cat_current' ), 20 link, 21 $this = $( this ); 22 23 cat = currentCat.data( 'slug' ); 24 25 if ( $this.hasClass( 'items_per_page' ) ) { 26 num = 1; 27 } 28 29 var href = $this.attr( 'href' ); 30 if ( href ) { 31 if ( href.match( /(paged=\d+)/g ) ) { 32 link = href.match( /(paged=\d+)/g )[0].split( '=' )[1]; 33 } 34 else if ( href.match( /(page\/\d)/g ) ) { 35 link = href.match( /(page\/\d+)/g )[0].split( '/' )[1]; 36 } 37 38 num = null === link ? 1 : link; 39 } 40 41 var $siteMain = $( '.site-main' ); 42 if ( $this.hasClass( 'content-list' ) ) { 43 $this.parent().find( '.layout_current' ).removeClass( 'layout_current' ); 44 $this.addClass( 'layout_current' ); 45 layout = 'list'; 46 } 47 if ( $this.hasClass( 'content-grid' ) ) { 48 $this.parent().find( '.layout_current' ).removeClass( 'layout_current' ); 49 $this.addClass( 'layout_current' ); 50 layout = ''; 51 } 52 53 if ( $this.hasClass( 'content-counter' ) ) { 54 $this.parent().find( '.orderby_current' ).removeClass( 'orderby_current' ); 55 $this.addClass( 'orderby_current' ); 56 sortby = 'trendding'; 57 } 58 if ( $this.hasClass( 'content-rating' ) ) { 59 $this.parent().find( '.orderby_current' ).removeClass( 'orderby_current' ); 60 $this.addClass( 'orderby_current' ); 61 sortby = 'rating'; 62 } 63 if ( $this.hasClass( 'content-new' ) ) { 64 $this.parent().find( '.orderby_current' ).removeClass( 'orderby_current' ); 65 $this.addClass( 'orderby_current' ); 66 sortby = ''; 67 } 68 if ( $this.hasClass( 'cat-item' ) ) { 69 $this.parent().find( '.cat_current' ).removeClass( 'cat_current' ); 70 $this.addClass( 'cat_current' ); 71 72 cat = $this.data( 'slug' ); 73 num = 1; 74 } 75 76 if ( $this.hasClass( 'type-item' ) ) { 77 $this.parent().find( '.type_current' ).removeClass( 'type_current' ); 78 $this.addClass( 'type_current' ); 79 type = $this.children().attr( 'data' ); 80 num = 1; 81 } 82 83 _.addClass( 'spinner' ); 84 $.get( 85 EduPro.ajaxUrl, 86 { 87 action: 'get_courses', 88 _wpnonce: EduPro.nonce_course, 89 style: layout, 90 posts_per_page: postPerpage, 91 sort: sortby, 92 paged: num, 93 category: cat, 94 type: type, 95 }, 96 function ( response ) { 97 _.removeClass( 'spinner' ); 98 _.hide(); 99 _.html( response ); 100 _.fadeIn( 500 ); 101 102 if ( $( '.content-grid' ).hasClass( 'layout_current' ) ) { 103 $siteMain.removeClass( 'list-main' ); 104 $siteMain.addClass( 'grid-main' ); 105 }else{ 106 $siteMain.addClass( 'list-main' ); 107 $siteMain.removeClass( 'grid-main' ); 108 } 109 110 _.removeClass( 'list' ); 111 _.removeClass( 'grid' ); 112 _.addClass( $siteMain.find( '.layout_current' ).attr( 'data' ) ); 113 114 var offset = 0; 115 offset = offset + ( $( '#wpadminbar' ).length ? $( '#wpadminbar' ).height() : 0 ); 116 offset = offset + ( $( '.site-header' ).length ? $( '.site-header' ).height() : 0 ); 117 offset = offset + ( $( '.topbar' ).length ? $( '.topbar' ).height() : 0 ); 118 offset = offset + ( $( '.page__banner-top' ).length ? $( '.page__banner-top' ).height() : 0 ); 119 120 $( 'body, html' ).animate( { 121 scrollTop: offset - 100 122 }, 1000 ); 123 } 124 ); 125 } 126 127 $( '.post-type-archive-sfwd-courses .items_per_page' ).on( 'change', getCourses ); 128 $( '.tax-course_category .items_per_page' ).on( 'change', getCourses ); 129 130 var str = '.content-list, .content-grid, .content-counter, .content-rating, .page-numbers, .content-new, .widget__filter-courses .cat-item, .type-item'; 131 $( '.post-type-archive-sfwd-courses' ).on( 'click', str, getCourses ); 132 $( '.tax-course_category' ).on( 'click', str, getCourses ); 133 134 /** 135 * Ajax for achive event page. 136 */ 137 var ev = $( '.events__item' ); 138 139 function getEvents( e ) { 140 e.preventDefault(); 141 var num = $( '.current' ).text(), 142 sortby = $( '.orderby_current' ).attr( 'data' ), 143 layout = $( '.layout_current' ).attr( 'data' ), 144 postPerpage = $( '.items_per_page' ).val(), 145 link; 146 147 148 if ( $( this ).hasClass( 'items_per_page' ) ) { 149 num = 1; 150 } 151 152 if ( $( this ).attr( 'href' ) ) { 153 if ( $( this ).attr( 'href' ).match( /(paged=\d)/g ) ) { 154 link = $( this ).attr( 'href' ).match( /(paged=\d+)/g )[0].split( '=' )[1]; 155 } 156 else if ( $( this ).attr( 'href' ).match( /(page\/\d)/g ) ) { 157 link = $( this ).attr( 'href' ).match( /(page\/\d+)/g )[0].split( '/' )[1]; 158 } 159 160 num = null === link ? 1 : link; 161 } 162 163 var $siteMain = $( '.site-main' ); 164 165 if ( $( this ).hasClass( 'content-list' ) ) { 166 $( this ).parent().find( '.layout_current' ).removeClass( 'layout_current' ); 167 $( this ).addClass( 'layout_current' ); 168 layout = ''; 169 } 170 if ( $( this ).hasClass( 'content-grid' ) ) { 171 $( this ).parent().find( '.layout_current' ).removeClass( 'layout_current' ); 172 $( this ).addClass( 'layout_current' ); 173 layout = 'grid'; 174 } 175 176 if ( $( this ).hasClass( 'content-happening' ) ) { 177 $( this ).parent().find( '.orderby_current' ).removeClass( 'orderby_current' ); 178 $( this ).addClass( 'orderby_current' ); 179 sortby = 'happening'; 180 } 181 if ( $( this ).hasClass( 'content-upcoming' ) ) { 182 $( this ).parent().find( '.orderby_current' ).removeClass( 'orderby_current' ); 183 $( this ).addClass( 'orderby_current' ); 184 sortby = 'upcoming'; 185 } 186 if ( $( this ).hasClass( 'content-all' ) ) { 187 $( this ).parent().find( '.orderby_current' ).removeClass( 'orderby_current' ); 188 $( this ).addClass( 'orderby_current' ); 189 sortby = ''; 190 } 191 if ( $( this ).hasClass( 'content-expired' ) ) { 192 $( this ).parent().find( '.orderby_current' ).removeClass( 'orderby_current' ); 193 $( this ).addClass( 'orderby_current' ); 194 sortby = 'expired'; 195 } 196 197 ev.addClass( 'spinner' ); 198 $.get( 199 EduPro.ajaxUrl, 200 { 201 action: 'get_events', 202 _wpnonce: EduPro.nonce_event, 203 style: layout, 204 posts_per_page: postPerpage, 205 sort: sortby, 206 paged: num, 207 }, 208 function ( response ) { 209 ev.removeClass( 'spinner' ); 210 ev.hide(); 211 ev.html( response ); 212 ev.fadeIn( 500 ); 213 if ( $( '.content-grid' ).hasClass( 'layout_current' ) ) { 214 $siteMain.removeClass( 'list-main' ); 215 $siteMain.addClass( 'grid-main' ); 216 }else{ 217 $siteMain.addClass( 'list-main' ); 218 $siteMain.removeClass( 'grid-main' ); 219 } 220 } 221 ); 222 } 223 224 $( '.post-type-archive-event .items_per_page' ).on( 'change', getEvents ); 225 $( '.tax-event_category .items_per_page' ).on( 'change', getEvents ); 226 var str_even = '.content-list, .content-grid, .content-happening, .content-upcoming, .content-all, .page-numbers, .content-expired'; 227 $( '.post-type-archive-event' ).on( 'click', str_even, getEvents ); 228 $( '.tax-event_category' ).on( 'click', str_even, getEvents ); 229 230 /* Video */ 231 $( '.single__video-thumblist' ).slick( { 232 autoPlay: true, 233 dots: false, 234 arrows: true, 235 vertical: true, 236 slidesToShow: 3, 237 prevArrow: '<div><i class="fa fa-angle-double-up"></i></div>', 238 nextArrow: '<div><i class="fa fa-angle-double-down"></i></div>' 239 } ); 240 241 if ( $( '.single__video-list' ).length > 0 ) { 242 var src_first = $( '.single__video-list:first-child' ).find( 'iframe' ).attr( 'src' ); 243 $( '#player' ).find( 'iframe' ).attr( 'src', src_first ); 244 } 245 $( '.single__video-list .topic__title a' ).on( 'click', function ( e ) { 246 e.preventDefault();
247 var text_link = $( this ).parents( '.thumb-video' ).find( 'iframe' ).attr( 'src' ); 248 $( '#player' ).find( 'iframe' ).attr( 'src', text_link ); 249 } ); 250 251 /* Comment Rating */ 252 $( '.comment-list ul[data-rating="0.0"]' ).hide(); 253 254})
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.