You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
143 lines
4.8 KiB
143 lines
4.8 KiB
<script type="text/javascript">
|
|
//<![CDATA[
|
|
$(document).ready(function() {
|
|
$("#side1").accordion("activate", 1);
|
|
$("#side2").accordion("activate", 1);
|
|
// $('#yoptions').resetForm();
|
|
|
|
var height=document.documentElement.clientHeight - 240;
|
|
$('#ymarks').flexigrid({
|
|
url: '/api/ymarks/get_ymark.json',
|
|
dataType: 'json',
|
|
method: 'GET',
|
|
colModel: [
|
|
{display: 'Hash', name : 'hash', width : 50, sortable : false, align: 'center', hide: true},
|
|
{display: 'Public', name : 'public', width : 25, sortable : true, align: 'center'},
|
|
{display: 'Title', name : 'title', width : 400, sortable : true, align: 'left'},
|
|
{display: 'Tags', name : 'tags', width : 160, sortable : false, align: 'left'},
|
|
{display: 'Folders', name : 'folders', width : 160, sortable : false, align: 'left', hide: false},
|
|
{display: 'Date', name : 'date', width : 100, sortable : true, align: 'left'}
|
|
],
|
|
buttons: [
|
|
{name: 'Add', bclass: 'bookmark', onpress: bm_action},
|
|
{name: 'Crawl', bclass: 'crawl', onpress: bm_action},
|
|
{name: 'Edit', bclass: 'edit', onpress: bm_action},
|
|
{name: 'Delete', bclass: 'delete', onpress: bm_action},
|
|
{separator: true},
|
|
{name: 'RSS', bclass: 'rss', onpress: bm_action},
|
|
{name: 'XBEL', bclass: 'xml', onpress: bm_action},
|
|
{name: 'XML', bclass: 'xml', onpress: bm_action},
|
|
{separator: true},
|
|
{name: 'Add', bclass: 'addTag', onpress: tag_action},
|
|
{name: 'Rename', bclass: 'editTag', onpress: tag_action},
|
|
{separator: true},
|
|
{name: 'Help', bclass: 'help', onpress: bm_action},
|
|
],
|
|
searchitems : [
|
|
{display: 'Tags', name : 'tags'},
|
|
{display: 'Folders', name : 'folders'},
|
|
{display: 'Title', name : 'title'},
|
|
],
|
|
useRp: true,
|
|
rp: 15,
|
|
sortname: "title",
|
|
sortorder: "asc",
|
|
usepager: true,
|
|
striped: true,
|
|
nowrap: false,
|
|
height: height,
|
|
query: ".*",
|
|
qtype: "title",
|
|
title: 'YaCy Bookmarks: ' + HTMLenc(qtag)
|
|
});
|
|
|
|
});
|
|
function bm_action(com,grid) {
|
|
if (com=='XBEL') {
|
|
var qtype = "tags";
|
|
if (qtag.startsWith("/")) qtype = "folders";
|
|
window.document.location.href = '/api/bookmarks/get_bookmarks.xml?display=xbel&qtype='+qtype+'&query='+qtag;
|
|
}
|
|
else if (com=='RSS') {
|
|
window.document.location.href = '/Bookmarks.rss?qtype=tags&query='+qtag;
|
|
}
|
|
else if (com=='XML') {
|
|
window.document.location.href = '/api/bookmarks/get_bookmarks.xml?tag='+qtag;
|
|
}
|
|
else if (com=='Delete') {
|
|
var check = confirm('Delete ' + $('.trSelected',grid).length + ' bookmark(s)?');
|
|
if(check == true) {
|
|
$('.trSelected',grid).each(function(){
|
|
var url = "/api/bookmarks/posts/delete_p.xml?login=&urlhash="+$(this).find('td :first').text();
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: url,
|
|
dataType: 'xml'
|
|
}); // close $.ajax(
|
|
}); //close each(
|
|
loadTagCloud();
|
|
reloadBM();
|
|
}
|
|
}
|
|
else if (com=='Add') {
|
|
$('#bmaddform').resetForm();
|
|
$("#bm_url").blur(function() {
|
|
var url = $("input[name='bm_url']").getValue();
|
|
$.ajax({
|
|
type: "GET",
|
|
url: "/api/util/getpageinfo_p.xml?url="+url,
|
|
dataType: "xml",
|
|
success: function(xml) {
|
|
var title = $(xml).find('title').text();
|
|
$("input[name='bm_title']").setValue(title);
|
|
var desc = $(xml).find('desc').text();
|
|
$("textarea[name='bm_desc']").setValue(desc);
|
|
tags = "";
|
|
$(xml).find('tag').each(function(){
|
|
tags = tags + "," + $(this).attr('name');
|
|
});
|
|
$("input[name='bm_tags']").setValue(tags);
|
|
}
|
|
});
|
|
});
|
|
$("#bmadd").dialog('open');
|
|
}
|
|
else if (com=='Edit') {
|
|
if ($('.trSelected',grid).length > 1) {
|
|
alert("Edit of more than one selected bookmark is currently not supportet!");
|
|
return false;
|
|
}
|
|
$("input[name='bm_url']").setValue($('.trSelected',grid).find('.url').text());
|
|
$("input[name='bm_title']").setValue($('.trSelected',grid).find('h3.linktitle').text().trim());
|
|
$("textarea[name='bm_desc']").setValue($('.trSelected',grid).find('p.desc').text().trim());
|
|
$("input[name='bm_tags']").setValue($('.trSelected',grid).find('p.tags').text().trim().replace(/,\s/g,","));
|
|
$("input[name='bm_path']").setValue($('.trSelected',grid).find('p.folders').text().replace(/,\s/g,","));
|
|
$("select[name='bm_public']").setValue($('.trSelected',grid).find('img').attr('alt'));
|
|
$("#bmadd").dialog('open');
|
|
}
|
|
}
|
|
function tag_action(com,grid) {
|
|
if (com=='Add') {
|
|
flex = grid;
|
|
$('#tagaddform').resetForm();
|
|
$("#tagadd").dialog('open');
|
|
} else {
|
|
$('#tageditform').resetForm();
|
|
$("#tagedit").dialog('open');
|
|
}
|
|
}
|
|
//]]>
|
|
</script>
|
|
|
|
<!-- Display Bookmarks Table -->
|
|
<table id="ymarks" summary="YaCy Bookmarks">
|
|
<tbody>
|
|
</tbody>
|
|
</table>
|
|
|
|
|
|
|
|
|
|
|
|
|