Closed #34
Introducing keyboard shortcut. Every page: [Q] - focus search [W] - scroll up [S] - scroll down Post: [A] - next post [D] - previous post [E] - edit post Also, when clicking on post edit, browser is scrolled to the form.
This commit is contained in:
parent
e733da58d2
commit
c662d52d62
4 changed files with 17 additions and 0 deletions
3
init.php
3
init.php
|
@ -49,6 +49,9 @@ foreach ($lines as $line)
|
||||||
download('http://raw.github.com/aehlke/tag-it/master/css/jquery.tagit.css', $libPath . 'tagit' . DS . 'jquery.tagit.css');
|
download('http://raw.github.com/aehlke/tag-it/master/css/jquery.tagit.css', $libPath . 'tagit' . DS . 'jquery.tagit.css');
|
||||||
download('http://raw.github.com/aehlke/tag-it/master/js/tag-it.min.js', $libPath . 'tagit' . DS . 'jquery.tagit.js');
|
download('http://raw.github.com/aehlke/tag-it/master/js/tag-it.min.js', $libPath . 'tagit' . DS . 'jquery.tagit.js');
|
||||||
|
|
||||||
|
//Mousetrap
|
||||||
|
download('https://raw.github.com/ccampbell/mousetrap/master/mousetrap.min.js', $libPath . 'mousetrap' . DS . 'mousetrap.min.js');
|
||||||
|
|
||||||
//fonts
|
//fonts
|
||||||
download('http://googlefontdirectory.googlecode.com/hg/apache/droidsans/DroidSans.ttf', $fontsPath . 'DroidSans.ttf');
|
download('http://googlefontdirectory.googlecode.com/hg/apache/droidsans/DroidSans.ttf', $fontsPath . 'DroidSans.ttf');
|
||||||
download('http://googlefontdirectory.googlecode.com/hg/apache/droidsans/DroidSans-Bold.ttf', $fontsPath . 'DroidSans-Bold.ttf');
|
download('http://googlefontdirectory.googlecode.com/hg/apache/droidsans/DroidSans-Bold.ttf', $fontsPath . 'DroidSans-Bold.ttf');
|
||||||
|
|
|
@ -204,3 +204,10 @@ function getTagItOptions()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$(function()
|
||||||
|
{
|
||||||
|
Mousetrap.bind('q', function() { $('#top-nav input').focus(); return false; });
|
||||||
|
Mousetrap.bind('w', function() { $('body,html').animate({scrollTop: '-=150px'}, 200); });
|
||||||
|
Mousetrap.bind('s', function() { $('body,html').animate({scrollTop: '+=150px'}, 200); });
|
||||||
|
});
|
||||||
|
|
|
@ -22,6 +22,8 @@ $(function()
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var formDom = $('form.edit-post');
|
var formDom = $('form.edit-post');
|
||||||
formDom.show().css('height', formDom.height()).hide().slideDown();
|
formDom.show().css('height', formDom.height()).hide().slideDown();
|
||||||
|
|
||||||
|
$('html, body').animate({ scrollTop: $(formDom).offset().top + 'px' }, 'fast');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -118,4 +120,8 @@ $(function()
|
||||||
|
|
||||||
$.ajax(ajaxData);
|
$.ajax(ajaxData);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Mousetrap.bind('a', function() { window.location = $('#sidebar .left a').attr('href'); });
|
||||||
|
Mousetrap.bind('d', function() { window.location = $('#sidebar .right a').attr('href'); });
|
||||||
|
Mousetrap.bind('e', function() { $('li.edit a').trigger('click'); return false; });
|
||||||
});
|
});
|
||||||
|
|
|
@ -52,6 +52,7 @@ class Bootstrap
|
||||||
[
|
[
|
||||||
'../lib/jquery/jquery.min.js',
|
'../lib/jquery/jquery.min.js',
|
||||||
'../lib/jquery-ui/jquery-ui.min.js',
|
'../lib/jquery-ui/jquery-ui.min.js',
|
||||||
|
'../lib/mousetrap/mousetrap.min.js',
|
||||||
'core.js',
|
'core.js',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue