1
0
mirror of https://github.com/owncloud/bookmarks.git synced 2025-02-20 17:54:25 +01:00

Remove sliding panel feature and old dead code fix #137

This commit is contained in:
Brice Maron 2012-11-05 21:22:42 +00:00
parent 8d69711a08
commit f8e3a0c2e7
5 changed files with 14 additions and 182 deletions

View File

@ -1,29 +0,0 @@
<?php
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('bookmarks');
if(isset($_POST['view'])) {
$view = $_POST['view'];
switch($view){
case 'list':
case 'image';
break;
default:
OCP\JSON::error(array('message'=>'unexspected parameter: ' . $view));
exit;
}
OCP\Config::setUserValue(OCP\USER::getUser(), 'bookmarks', 'currentview', $view);
OCP\JSON::success();
}elseif(isset($_POST['sidebar'])) {
$view = $_POST['sidebar'];
switch($view){
case 'true':
case 'false';
break;
default:
OCP\JSON::error(array('message'=>'unexspected parameter: ' . $view));
exit;
}
OCP\Config::setUserValue(OCP\USER::getUser(), 'bookmarks', 'sidebar', $view);
OCP\JSON::success();
}

View File

@ -18,20 +18,6 @@ input.disabled, input.disabled:hover {
padding-top: 5px;
top: 3.5em !important;
}
.centercontent {
margin-bottom: 1em;
text-align: right;
}
.centercontent span {
border: 1px solid lightgray;
border-right:0;
border-radius: 0.5em 0em 0em 0.5em;
padding: 3px;
}
.centercontent .right_img {
display:none;
}
.bookmarks_headline {
font-size: large;
@ -246,33 +232,6 @@ li:hover em { display : none; }
top: 50%;
}
#view_type {
display:none; /* @TODO: Remove when image view is ready*/
position: absolute;
right: 33.5em;
top: 0;
}
/***** Lis View *****/
.bm_view_img .bookmark_single{
width: 240px;
float: left;
height: 240px;
margin: 1em;
border-radius: 8px 8px 8px 8px;
box-shadow: 0 0 5px rgba(34, 25, 25, 0.5);
}
.bm_view_img .bookmark_single .shot{
text-align:center;
}
.bm_view_img .bookmark_single .shot img{
border: 1px solid black;
width: 228px;
height: 160px
}
.bookmark_desc{
height: 1.5em;
padding-left:1em;

View File

@ -7,8 +7,6 @@ var bookmark_view = 'image';
$(document).ready(function() {
watchUrlField();
$('.centercontent').click(clickSideBar);
$('#view_type input').click(clickSwitchView);
$('#bm_import').change(attachSettingEvent);
$('#add_url').on('keydown keyup change click', watchUrlField);
@ -31,11 +29,6 @@ $(document).ready(function() {
onTagFinishRemoved: filterTagsChanged
}).tagit('option', 'onTagAdded', filterTagsChanged);
getBookmarks();
if(init_sidebar != 'true')
toggleSideBar();
bookmark_view = init_view;
switchView();
});
@ -51,51 +44,6 @@ var formatString = (function() {
};
})();
function clickSideBar() {
$.post(OC.filePath('bookmarks', 'ajax', 'changescreen.php'), {sidebar: $('.right_img').is(':visible')});
toggleSideBar();
}
function toggleSideBar(){
var left_pan_visible = $('.right_img').is(':visible');
anim_duration = 1000;
if( left_pan_visible) { // then show the left panel
$('#rightcontent').animate({'left':'32.5em'},{duration: anim_duration, queue: false });
$('.bookmarks_list').animate({'width': '-=15em'},{duration: anim_duration, queue: false });
$('#leftcontent').animate({'margin-left':'0', 'opacity': 1},{duration: anim_duration, queue: false, complete: function() { $(window).trigger('resize'); }});
$('.right_img').hide();
$('.left_img').show();
} else { // hide the left panel
$('#rightcontent').animate({'left':'15.5em'},{duration: anim_duration, queue: false });
$('.bookmarks_list').animate({'width': '+=15em'},{duration: anim_duration, queue: false });
$('#leftcontent').animate({'margin-left':'-17em', 'opacity': 0.5 },{duration: anim_duration, queue: false, complete: function() { $(window).trigger('resize'); } });
$('.left_img').hide();
$('.right_img').show();
}
}
function clickSwitchView(){
$.post(OC.filePath('bookmarks', 'ajax', 'changescreen.php'), {view:bookmark_view});
switchView();
}
function switchView(){
if(bookmark_view == 'list') { //Then switch to img
$('.bookmarks_list').addClass('bm_view_img');
$('.bookmarks_list').removeClass('bm_view_list');
$('#view_type input.image').hide();
$('#view_type input.list').show();
bookmark_view = 'image';
} else { // Then Image
$('.bookmarks_list').addClass('bm_view_list');
$('.bookmarks_list').removeClass('bm_view_img');
$('#view_type input.list').hide();
$('#view_type input.image').show();
bookmark_view = 'list';
}
filterTagsChanged(); //Refresh the view
}
function addFilterTag(event) {
event.preventDefault();
$('#tag_filter input').tagit('createTag', $(this).text());
@ -229,6 +177,7 @@ function addBookmark(event) {
bookmark.added_date = new Date();
updateBookmarksList(bookmark, 'prepend');
checkEmpty();
watchUrlField();
}
}
});
@ -318,35 +267,22 @@ function updateBookmarksList(bookmark, position) {
bookmark.added_date.setTime(parseInt(bookmark.added)*1000);
}
if(bookmark_view == 'image') { //View in images
service_url = formatString(shot_provider, {url: encodeEntities(bookmark.url), title: bookmark.title, width: 200});
bookmark['service_url'] = service_url;
html = tmpl("img_item_tmpl", bookmark);
html = tmpl("item_tmpl", bookmark);
if(position == "prepend") {
$('.bookmarks_list').prepend(html);
} else {
$('.bookmarks_list').append(html);
$('div[data-id="'+ bookmark.id +'"]').data('record', bookmark);
if(taglist != '') {
$('div[data-id="'+ bookmark.id +'"]').append('<p class="bookmark_tags">' + taglist + '</p>');
}
$('div[data-id="'+ bookmark.id +'"] a.bookmark_tag').bind('click', addFilterTag);
}
else {
html = tmpl("item_tmpl", bookmark);
if(position == "prepend") {
$('.bookmarks_list').prepend(html);
} else {
$('.bookmarks_list').append(html);
}
line = $('div[data-id="'+ bookmark.id +'"]');
line.data('record', bookmark);
if(taglist != '') {
line.append('<p class="bookmark_tags">' + taglist + '</p>');
}
line.find('a.bookmark_tag').bind('click', addFilterTag);
line.find('.bookmark_link').click(recordClick);
line.find('.bookmark_delete').click(delBookmark);
line.find('.bookmark_edit').click(editBookmark);
line = $('div[data-id="'+ bookmark.id +'"]');
line.data('record', bookmark);
if(taglist != '') {
line.append('<p class="bookmark_tags">' + taglist + '</p>');
}
line.find('a.bookmark_tag').bind('click', addFilterTag);
line.find('.bookmark_link').click(recordClick);
line.find('.bookmark_delete').click(delBookmark);
line.find('.bookmark_edit').click(editBookmark);
}
function updateOnBottom() {

View File

@ -66,25 +66,4 @@
</p>
<em><%= nbr %></em>
</li>
</script>
<script type="text/html" id="img_item_tmpl">
<div class="bookmark_single" data-id="<%= id %>" >
<p class="shot"><img src="<%= service_url %>"></p>
<p class="bookmark_actions">
<span class="bookmark_edit">
<img class="svg" src="<?php echo OCP\image_path("", "actions/rename.svg");?>"
title="<?php echo $l->t('Edit');?>">
</span>
<span class="bookmark_delete">
<img class="svg" src="<?php echo OCP\image_path("", "actions/delete.svg");?>"
title="<?php echo $l->t('Delete');?>">
</span>&nbsp;
</p>
<p class="bookmark_title">
<a href="<%= encodeEntities(url)%>" target="_blank" class="bookmark_link"><%= encodeEntities(title)%></a>
</p>
<p class="bookmark_desc"><%= encodeEntities(description)%></p>
<p class="bookmark_url"><a href="<%= encodeEntities(url)%>" target="_blank"
class="bookmark_link"><%= encodeEntities(url)%></a></p>
</div>
</script>

View File

@ -13,16 +13,8 @@
<input type="text" id="add_url" value="" placeholder="<?php echo $l->t('Address'); ?>"/>
<input type="submit" value="<?php echo $l->t('Add bookmark'); ?>" id="bookmark_add_submit" />
</form>
<div id="view_type">
<input type="button" class="list" value="<?php echo $l->t('List')?>" />
<input type="button" class="image" style="display:none" value="<?php echo $l->t('Image')?>" />
</div>
</div>
<div id="leftcontent">
<div class="centercontent">
<span class="left_img"> <?php echo $l->t('Hide')?> &lt;&lt;</span>
<span class="right_img"> <?php echo $l->t('Show')?> &gt;&gt;</span>
</div>
<p id="tag_filter">
<input type="text" placeholder="Filter By tag" value="<?php echo $_['req_tag']; ?>"/>
@ -60,11 +52,6 @@
</div>
<script>
var fullTags = <?php echo $_['tags'];?>;
var init_view = '<?php echo OCP\Config::getUserValue(OCP\USER::getUser(), 'bookmarks', 'currentview', 'text');?>';
var init_sidebar = '<?php echo OCP\Config::getUserValue(OCP\USER::getUser(), 'bookmarks', 'sidebar', 'true');?>';
var shot_provider = '<?php echo OCP\Config::getUserValue(OCP\USER::getUser(),
'bookmarks', 'shot_provider', 'http://screenshots.bookmarkly.com/thumb?url={url}');?>';
//http://api.thumbalizr.com/?width={width}&url={url}
</script>
<script type="text/html" id="edit_dialog_tmpl">