Skip to content

Commit

Permalink
Fixed Livesearch bug.
Browse files Browse the repository at this point in the history
Deactivated keyboard shortcut support. Never finished it properly, and want to get 1.1 out of the door.
  • Loading branch information
heilemann committed Jun 26, 2010
1 parent 2b02467 commit 630f989
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions js/uncompressed/k2.livesearch.js
Expand Up @@ -4,7 +4,7 @@ function LiveSearch(searchprompt) {
jQuery('body').addClass('livesearch'); jQuery('body').addClass('livesearch');


this.searchPrompt = searchprompt; this.searchPrompt = searchprompt;
this.searchform = jQuery('#searchform'); this.searchForm = jQuery('#searchform');
this.searchField = jQuery('#s'); this.searchField = jQuery('#s');
this.reset = jQuery('#searchreset'); this.reset = jQuery('#searchreset');
this.loading = jQuery('#searchload'); this.loading = jQuery('#searchload');
Expand All @@ -14,7 +14,7 @@ function LiveSearch(searchprompt) {
jQuery('#searchsubmit').addClass('hidden'); jQuery('#searchsubmit').addClass('hidden');


// Inject reset and load containers. // Inject reset and load containers.
this.searchForm.append("<span id="searchreset" title="<?php esc_attr_e('Reset Search', 'k2'); ?>"></span><span id="searchload"></span>") this.searchForm.append("<span id='searchreset'></span><span id='searchload'></span>")


// Inlinize label // Inlinize label
this.searchLabel.empty().text(searchprompt).addClass('overlabel-apply'); this.searchLabel.empty().text(searchprompt).addClass('overlabel-apply');
Expand Down
11 changes: 6 additions & 5 deletions js/uncompressed/k2.rollingarchives.js
Expand Up @@ -68,7 +68,7 @@ function RollingArchives(args) {
jQuery('body').toggleClass('trim') jQuery('body').toggleClass('trim')
}) })


RA.assignHotkeys(); // Setup Keyboard Shortcuts /* RA.assignHotkeys(); // Setup Keyboard Shortcuts */


jQuery('body').addClass('rollingarchives'); // Put the world on notice. jQuery('body').addClass('rollingarchives'); // Put the world on notice.


Expand Down Expand Up @@ -398,8 +398,10 @@ RollingArchives.prototype.scrollTo = function(elements, direction, next) {
// Find the next element below the upper fold // Find the next element below the upper fold
if (RA.nextIndex == undefined) { if (RA.nextIndex == undefined) {
jQuery(elements).each(function(idx) { jQuery(elements).each(function(idx) {
if ( jQuery(this).offset().top - RA.offset > jQuery(window).scrollTop() ) { /* console.log( jQuery(this).offset().top +' - '+ RA.offsetTop +' > '+ jQuery(window).scrollTop() ); */
if ( jQuery(this).offset().top - RA.offsetTop > jQuery(window).scrollTop() ) {
RA.nextIndex = (direction === 1 ? idx -1 : idx); RA.nextIndex = (direction === 1 ? idx -1 : idx);
console.log( 'Next index: '+RA.nextIndex );
return false; return false;
} }
}) })
Expand All @@ -419,12 +421,11 @@ RollingArchives.prototype.scrollTo = function(elements, direction, next) {
} }


// And finally scroll to the element (if the last element in the selection isn't on screen in its entirety). // And finally scroll to the element (if the last element in the selection isn't on screen in its entirety).
/* if ( jQuery(obj+':first').offset().top + jQuery(obj+':last').offset().top + jQuery(obj+':last').height() > jQuery(window).scrollTop() + jQuery(window).height() ) */ /* if ( jQuery(elements+':first').offset().top + jQuery(elements+':last').offset().top + jQuery(elements+':last').height() > jQuery(window).scrollTop() + jQuery(window).height() ) */



// Move .selected class to new element, return its vertical position to variable // Move .selected class to new element, return its vertical position to variable
RA.nextElement = jQuery(elements).eq(RA.nextIndex); RA.nextElement = jQuery(elements).eq(RA.nextIndex);
var nextElementPos = RA.nextElement.offset().top - RA.offset; var nextElementPos = RA.nextElement.offset().top - RA.offsetTop;
var theBrowserWindow = (jQuery.browser.safari) ? jQuery('body') : jQuery('html'); // Browser differences, hurray. var theBrowserWindow = (jQuery.browser.safari) ? jQuery('body') : jQuery('html'); // Browser differences, hurray.


// Scroll to the next element. Then detect if user manually scrolls away, in which case we clear our .selected stuff. // Scroll to the next element. Then detect if user manually scrolls away, in which case we clear our .selected stuff.
Expand Down

0 comments on commit 630f989

Please sign in to comment.