init.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. jQuery( function ( $ ) {
  2. 'use strict';
  3. $( '.comment-reply-link' ).addClass( 'btn btn-primary' );
  4. $( '#commentsubmit' ).addClass( 'btn btn-primary' );
  5. $( '.widget_search input.search-field' ).addClass( 'form-control' );
  6. $( '.widget_search input.search-submit' ).addClass( 'btn btn-default' );
  7. $( '.variations_form .variations .value > select' ).addClass( 'form-control' );
  8. $( '.widget_rss ul' ).addClass( 'media-list' );
  9. $( '.widget_meta ul, .widget_recent_entries ul, .widget_archive ul, .widget_categories ul, .widget_nav_menu ul, .widget_pages ul, .widget_product_categories ul' ).addClass( 'nav flex-column' );
  10. $( '.widget_meta ul li, .widget_recent_entries ul li, .widget_archive ul li, .widget_categories ul li, .widget_nav_menu ul li, .widget_pages ul li, .widget_product_categories ul li' ).addClass( 'nav-item' );
  11. $( '.widget_meta ul li a, .widget_recent_entries ul li a, .widget_archive ul li a, .widget_categories ul li a, .widget_nav_menu ul li a, .widget_pages ul li a, .widget_product_categories ul li a' ).addClass( 'nav-link' );
  12. $( '.widget_recent_comments ul#recentcomments' ).css( 'list-style', 'none').css( 'padding-left', '0' );
  13. $( '.widget_recent_comments ul#recentcomments li' ).css( 'padding', '5px 15px');
  14. $( 'table#wp-calendar' ).addClass( 'table table-striped');
  15. $('.wpcf7-form-control').not(".wpcf7-submit, .wpcf7-acceptance, .wpcf7-file, .wpcf7-radio").addClass('form-control');
  16. $('.wpcf7-submit').addClass('btn btn-primary');
  17. $('.page-scroller').on('click', function (e) {
  18. e.preventDefault();
  19. var target = this.hash;
  20. var $target = $(target);
  21. $('html, body').animate({
  22. 'scrollTop': $target.offset().top
  23. }, 1000, 'swing');
  24. });
  25. $(window).scroll(function(e) {
  26. var scroll = $(window).scrollTop();
  27. if (scroll >= 150) {
  28. $('#masthead').addClass('masthead-hide');
  29. } else {
  30. $('#masthead').removeClass('masthead-hide');
  31. }
  32. });
  33. });
  34. /****** accessibility for keyboard only users. https://git.io/vWdr2 ******/
  35. (function() {
  36. var isIe = /(trident|msie)/i.test( navigator.userAgent );
  37. if ( isIe && document.getElementById && window.addEventListener ) {
  38. window.addEventListener( 'hashchange', function() {
  39. var id = location.hash.substring( 1 ),
  40. element;
  41. if ( ! ( /^[A-z0-9_-]+$/.test( id ) ) ) {
  42. return;
  43. }
  44. element = document.getElementById( id );
  45. if ( element ) {
  46. if ( ! ( /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) ) {
  47. element.tabIndex = -1;
  48. }
  49. element.focus();
  50. }
  51. }, false );
  52. }
  53. })();