1
0
mirror of https://github.com/owncloud/bookmarks.git synced 2025-02-18 15:54:28 +01:00

Bookmark: Smoother first animation for settings and close on click outside.

Should re fix #51
This commit is contained in:
Brice Maron 2012-11-05 22:53:46 +00:00
parent d7848b2c9e
commit 4b4f5df22f
3 changed files with 18 additions and 11 deletions

View File

@ -3,19 +3,11 @@ var bookmarks_loading = false;
var dialog;
var bookmarks_sorting = 'bookmarks_sorting_recent';
var bookmark_view = 'image';
$(document).ready(function() {
watchUrlField();
$('#bm_import').change(attachSettingEvent);
$('#add_url').on('keydown keyup change click', watchUrlField);
$('#settingsbtn').on('click keydown', function() {
if( $('#bookmark_settings').hasClass('open'))
$('#bookmark_settings').switchClass( "open", "" );
else
$('#bookmark_settings').switchClass( "", "open");
});
$('#settingsbtn').on('click keydown', toggleSettings);
$('#bm_export').click(exportBm);
$(window).resize(function () {
@ -44,6 +36,21 @@ var formatString = (function() {
};
})();
function watchClickInSetting(e){
if($('#bookmark_settings').find($(e.target)).length == 0){
toggleSettings();
}
}
function toggleSettings() {
if( $('#bookmark_settings').hasClass('open')) { //Close
$('#bookmark_settings').switchClass( "open", "" );
$('body').unbind('click');
}
else {
$('#bookmark_settings').switchClass( "", "open");
$('body').bind('click',watchClickInSetting);
}
}
function addFilterTag(event) {
event.preventDefault();
$('#tag_filter input').tagit('createTag', $(this).text());

View File

@ -25,7 +25,7 @@
</ul>
<div id="bookmark_settings">
<div id="bookmark_settings" class="">
<ul class="controls">
<li style="float: right">
<button id="settingsbtn" title="<?php echo $l->t('Settings'); ?>">

View File

@ -30,7 +30,7 @@
<legend><strong><?php echo $l->t('Export & Import');?></strong></legend>
<input type="button" id="bm_export" href="<?php echo OCP\Util::linkTo('bookmarks', 'export.php') ;?>" value="<?php echo $l->t('Export'); ?>" />
<input type="file" id="bm_import" name="bm_import">
<input type="file" id="bm_import" name="bm_import" size="5">
<button type="button" name="bm_import_btn" id="bm_import_submit"><?php echo $l->t('Import'); ?></button>
<div id="upload"></div>