Skip to content

Commit

Permalink
Updated to 1.3.5
Browse files Browse the repository at this point in the history
- Updated search form
- Improved flexslider compatibly with other plugins
- Other minor JavaScript improvements.
  • Loading branch information
puikinsh committed Oct 15, 2014
1 parent 8457a33 commit 41010bc
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 127 deletions.
10 changes: 2 additions & 8 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,6 @@ function dazzling_widgets_init() {

include(get_template_directory() . "/inc/popular-posts-widget.php");

/**
* adding the dazzling search form (created in extra.php)
*/

add_filter( 'get_search_form', 'dazzling_wpsearch' );


/**
* Enqueue scripts and styles.
Expand All @@ -165,7 +159,7 @@ function dazzling_scripts() {
wp_enqueue_script('dazzling-bootstrapjs', get_template_directory_uri().'/inc/js/bootstrap.min.js', array('jquery') );

if( ( is_home() || is_front_page() ) && of_get_option('dazzling_slider_checkbox') == 1 ) {
wp_enqueue_script( 'flexslider', get_template_directory_uri() . '/inc/js/flexslider.min.js', array('jquery'), '20140222', true );
wp_enqueue_script( 'flexslider', get_template_directory_uri() . '/inc/js/flexslider.min.js', array('jquery'), '2.2.2', true );
}

wp_enqueue_script( 'dazzling-main', get_template_directory_uri() . '/inc/js/main.js', array('jquery') );
Expand All @@ -185,7 +179,7 @@ function dazzling_ie_support_header() {
echo '<script src="' . esc_url( get_template_directory_uri() . '/inc/js/respond.min.js' ) . '"></script>'. "\n";
echo '<![endif]-->'. "\n";
}
add_action( 'wp_head', 'dazzling_ie_support_header', 1 );
add_action( 'wp_head', 'dazzling_ie_support_header', 11 );

/*
* Loads the Options Panel
Expand Down
20 changes: 0 additions & 20 deletions inc/extras.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,26 +112,6 @@ function dazzling_setup_author() {
add_action( 'wp', 'dazzling_setup_author' );


/**
* Search form styling
*/
function dazzling_wpsearch($form) {
$form = '<form method="get" class="form-search" action="' . home_url( '/' ) . '">
<div class="row">
<div class="col-lg-12">
<div class="input-group">
<input type="text" class="form-control search-query" value="' . get_search_query() . '" name="s" id="s" placeholder="'. esc_attr__('Search...','dazzling') .'">
<span class="input-group-btn">
<button type="submit" class="btn btn-default" name="submit" id="searchsubmit" value="Go"><span class="glyphicon glyphicon-search"></span></button>
</span>
</div>
</div>
</div>
</form>';
return $form;
} // don't remove this bracket!


/**
* Password protected post form
*/
Expand Down
File renamed without changes.
41 changes: 24 additions & 17 deletions inc/js/flexslider.js → inc/js/dev/flexslider.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
touch = (( "ontouchstart" in window ) || msGesture || window.DocumentTouch && document instanceof DocumentTouch) && slider.vars.touch,
// depricating this idea, as devices are being released with both of these events
//eventType = (touch) ? "touchend" : "click",
eventType = "click touchend MSPointerUp",
eventType = "click touchend MSPointerUp keyup",
watchedEvent = "",
watchedEventClearTimer,
vertical = slider.vars.direction === "vertical",
Expand Down Expand Up @@ -70,6 +70,7 @@
}
return false;
}());
slider.ensureAnimationEnd = '';
// CONTROLSCONTAINER:
if (slider.vars.controlsContainer !== "") slider.controlsContainer = $(slider.vars.controlsContainer).length > 0 && $(slider.vars.controlsContainer);
// MANUAL:
Expand Down Expand Up @@ -593,7 +594,8 @@
}
},
uniqueID: function($clone) {
$clone.find( '[id]' ).each(function() {
// Append _clone to current level and children elements with id attributes
$clone.filter( '[id]' ).add($clone.find( '[id]' )).each(function() {
var $this = $(this);
$this.attr( 'id', $this.attr( 'id' ) + '_clone' );
});
Expand Down Expand Up @@ -719,10 +721,20 @@
slider.animating = false;
slider.currentSlide = slider.animatingTo;
}

// Unbind previous transitionEnd events and re-bind new transitionEnd event
slider.container.unbind("webkitTransitionEnd transitionend");
slider.container.bind("webkitTransitionEnd transitionend", function() {
clearTimeout(slider.ensureAnimationEnd);
slider.wrapup(dimension);
});

// Insurance for the ever-so-fickle transitionEnd event
clearTimeout(slider.ensureAnimationEnd);
slider.ensureAnimationEnd = setTimeout(function() {
slider.wrapup(dimension);
}, slider.vars.animationSpeed + 100);

} else {
slider.container.animate(slider.args, slider.vars.animationSpeed, slider.vars.easing, function(){
slider.wrapup(dimension);
Expand Down Expand Up @@ -871,9 +883,8 @@
slider.cloneOffset = 1;
// clear out old clones
if (type !== "init") slider.container.find('.clone').remove();
slider.container.append(slider.slides.first().clone().addClass('clone').attr('aria-hidden', 'true')).prepend(slider.slides.last().clone().addClass('clone').attr('aria-hidden', 'true'));
methods.uniqueID( slider.slides.first().clone().addClass('clone') ).appendTo( slider.container );
methods.uniqueID( slider.slides.last().clone().addClass('clone') ).prependTo( slider.container );
slider.container.append(methods.uniqueID(slider.slides.first().clone().addClass('clone')).attr('aria-hidden', 'true'))
.prepend(methods.uniqueID(slider.slides.last().clone().addClass('clone')).attr('aria-hidden', 'true'));
}
slider.newSlides = $(slider.vars.selector, slider);

Expand Down Expand Up @@ -902,7 +913,11 @@
if (type === "init") {
if (!touch) {
//slider.slides.eq(slider.currentSlide).fadeIn(slider.vars.animationSpeed, slider.vars.easing);
slider.slides.css({ "opacity": 0, "display": "block", "zIndex": 1 }).eq(slider.currentSlide).css({"zIndex": 2}).animate({"opacity": 1},slider.vars.animationSpeed,slider.vars.easing);
if (slider.vars.fadeFirstSlide == false) {
slider.slides.css({ "opacity": 0, "display": "block", "zIndex": 1 }).eq(slider.currentSlide).css({"zIndex": 2}).css({"opacity": 1});
} else {
slider.slides.css({ "opacity": 0, "display": "block", "zIndex": 1 }).eq(slider.currentSlide).css({"zIndex": 2}).animate({"opacity": 1},slider.vars.animationSpeed,slider.vars.easing);
}
} else {
slider.slides.css({ "opacity": 0, "display": "block", "webkitTransition": "opacity " + slider.vars.animationSpeed / 1000 + "s ease", "zIndex": 1 }).eq(slider.currentSlide).css({ "opacity": 1, "zIndex": 2});
}
Expand Down Expand Up @@ -1059,6 +1074,7 @@
animationSpeed: 600, //Integer: Set the speed of animations, in milliseconds
initDelay: 0, //{NEW} Integer: Set an initialization delay, in milliseconds
randomize: false, //Boolean: Randomize slide order
fadeFirstSlide: true, //Boolean: Fade in the first slide when animation type is "fade"
thumbCaptions: false, //Boolean: Whether or not to put captions on thumbnails when using the "thumbnails" controlNav.

// Usability features
Expand All @@ -1070,7 +1086,7 @@
video: false, //{NEW} Boolean: If using video in the slider, will prevent CSS3 3D Transforms to avoid graphical glitches

// Primary Controls
controlNav: true, //Boolean: Create navigation for paging control of each clide? Note: Leave true for manualControls usage
controlNav: true, //Boolean: Create navigation for paging control of each slide? Note: Leave true for manualControls usage
directionNav: true, //Boolean: Create navigation for previous/next navigation? (true/false)
prevText: "Previous", //String: Set the text for the "previous" directionNav item
nextText: "Next", //String: Set the text for the "next" directionNav item
Expand Down Expand Up @@ -1138,13 +1154,4 @@
}
}
};
})(jQuery);

// Can also be used with $(document).ready()
jQuery(document).ready(function ($) {
$(window).load(function() {
$('.flexslider').flexslider({
animation: "fade"
});
});
});
})(jQuery);
16 changes: 12 additions & 4 deletions inc/js/functions.js → inc/js/dev/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,23 @@ jQuery(document).ready(function(){

});

// Load flexslider in front page
jQuery(document).ready(function ($) {
$(window).load(function() {
$('.flexslider').flexslider({
animation: "fade"
});
});
});

//skip link focus fix
( function() {
var is_webkit = navigator.userAgent.toLowerCase().indexOf( 'webkit' ) > -1,
is_opera = navigator.userAgent.toLowerCase().indexOf( 'opera' ) > -1,
is_ie = navigator.userAgent.toLowerCase().indexOf( 'msie' ) > -1;

if ( ( is_webkit || is_opera || is_ie ) && 'undefined' !== typeof( document.getElementById ) ) {
var eventMethod = ( window.addEventListener ) ? 'addEventListener' : 'attachEvent';
window[ eventMethod ]( 'hashchange', function() {
if ( ( is_webkit || is_opera || is_ie ) && document.getElementById && window.addEventListener ) {
window.addEventListener( 'hashchange', function() {
var element = document.getElementById( location.hash.substring( 1 ) );

if ( element ) {
Expand All @@ -55,4 +63,4 @@ jQuery(document).ready(function(){
}
}, false );
}
})();
})();
Loading

0 comments on commit 41010bc

Please sign in to comment.