mirror of
https://github.com/maxpozdeev/mytinytodo.git
synced 2026-03-11 08:55:27 +00:00
* no different font sizes in tag cloud, tags sorted by usage (frequent on the top)
This commit is contained in:
parent
157c8ebd33
commit
765991eb68
3 changed files with 22 additions and 25 deletions
|
|
@ -280,8 +280,8 @@ var mytinytodo = window.mytinytodo = _mtt = {
|
|||
if(_mtt.menus.tagcloud) _mtt.menus.tagcloud.close();
|
||||
});
|
||||
|
||||
$('#tagcloudcontent').on('click', '.tag', function(){
|
||||
addFilterTag( $(this).attr('tag'), $(this).attr('tagid'), (event.metaKey || event.ctrlKey ? true : false) );
|
||||
$('#tagcloudcontent').on('click', '.tag', function(event){
|
||||
addFilterTag( this.dataset.tag, this.dataset.tagId, (event.metaKey || event.ctrlKey ? true : false) );
|
||||
if(_mtt.menus.tagcloud) _mtt.menus.tagcloud.close();
|
||||
return false;
|
||||
});
|
||||
|
|
@ -362,7 +362,7 @@ var mytinytodo = window.mytinytodo = _mtt = {
|
|||
});
|
||||
|
||||
$('#alltags').on('click', '.tag', function(){
|
||||
addEditTag($(this).attr('tag'));
|
||||
addEditTag(this.dataset.tag);
|
||||
return false;
|
||||
});
|
||||
|
||||
|
|
@ -1796,9 +1796,9 @@ function toggleEditAllTags(show)
|
|||
function fillEditAllTags()
|
||||
{
|
||||
var a = [];
|
||||
for(var i=tagsList.length-1; i>=0; i--) {
|
||||
a.push('<a href="#" class="tag" tag="'+tagsList[i].tag+'">'+tagsList[i].tag+'</a>');
|
||||
}
|
||||
tagsList.forEach( (item) => {
|
||||
a.push('<a href="#" class="tag" data-tag="' + item.tag +'">' + item.tag + '</a>');
|
||||
});
|
||||
$('#alltags .tags-list').html(a.join(', '));
|
||||
$('#alltags').show();
|
||||
};
|
||||
|
|
@ -1817,12 +1817,12 @@ function addEditTag(tag)
|
|||
function loadTags(listId, callback)
|
||||
{
|
||||
_mtt.db.request('tagCloud', {list:listId}, function(json){
|
||||
if(!parseInt(json.total)) tagsList = [];
|
||||
else tagsList = json.cloud;
|
||||
if (!parseInt(json.total)) tagsList = [];
|
||||
else tagsList = json.items;
|
||||
var cloud = '';
|
||||
$.each(tagsList, function(i,item){
|
||||
tagsList.forEach( item => {
|
||||
// item.tag is escaped with htmlspecialchars()
|
||||
cloud += ' <a href="#" tag="'+item.tag+'" tagid="'+item.id+'" class="tag w'+item.w+'" >'+item.tag+'</a>';
|
||||
cloud += ' <a href="#" class="tag" data-tag="' + item.tag + '" data-tag-id="' + item.id + '">' + item.tag + '</a>';
|
||||
});
|
||||
$('#tagcloudcontent').html(cloud)
|
||||
flag.tagsChanged = false;
|
||||
|
|
|
|||
|
|
@ -739,28 +739,24 @@ h3.page-title a.mtt-back-button {
|
|||
border:1px solid var(--color-border-default);
|
||||
padding:5px;
|
||||
width: 100%;
|
||||
max-width: 450px;
|
||||
max-width: 600px;
|
||||
text-align: center;
|
||||
box-shadow: var(--color-popup-shadow);
|
||||
}
|
||||
#tagcloud.mtt-left-adjusted { margin-left:5px; }
|
||||
#tagcloud.mtt-right-adjusted { margin-right:5px; }
|
||||
#tagcloud.mtt-left-adjusted.mtt-right-adjusted { margin-bottom:5px; }
|
||||
#tagcloud .tag { margin:1px 0px; padding:2px; line-height:140%; color: var(--color-text-default); }
|
||||
#tagcloud .tag {
|
||||
margin: 2px;
|
||||
padding: 2px;
|
||||
line-height:160%;
|
||||
color: var(--color-text-default);
|
||||
white-space: nowrap;
|
||||
}
|
||||
#tagcloud .tag:hover {
|
||||
background-color:var(--color-taglist-text-hover-bg);
|
||||
color: var(--color-taglist-text-hover);
|
||||
}
|
||||
#tagcloud .w0 { font-size:80%; }
|
||||
#tagcloud .w1 { font-size:90%; }
|
||||
#tagcloud .w2 { font-size:100%; }
|
||||
#tagcloud .w3 { font-size:110%; }
|
||||
#tagcloud .w4 { font-size:120%; }
|
||||
#tagcloud .w5 { font-size:130%; }
|
||||
#tagcloud .w6 { font-size:140%; }
|
||||
#tagcloud .w7 { font-size:150%; }
|
||||
#tagcloud .w8 { font-size:160%; }
|
||||
#tagcloud .w9 { font-size:170%; }
|
||||
|
||||
#tagcloudcancel { float:right; }
|
||||
#tagcloudcancel span {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class TagsController extends ApiController {
|
|||
$db = DBConnection::instance();
|
||||
|
||||
$q = $db->dq("SELECT name,tag_id,COUNT(tag_id) AS tags_count FROM {$db->prefix}tag2task INNER JOIN {$db->prefix}tags ON tag_id=id ".
|
||||
"WHERE list_id=$listId GROUP BY (tag_id) ORDER BY tags_count ASC");
|
||||
"WHERE list_id=$listId GROUP BY (tag_id) ORDER BY tags_count DESC");
|
||||
$at = array();
|
||||
$ac = array();
|
||||
while ($r = $q->fetchAssoc()) {
|
||||
|
|
@ -33,7 +33,7 @@ class TagsController extends ApiController {
|
|||
|
||||
$t = array();
|
||||
$t['total'] = 0;
|
||||
$count = sizeof($at);
|
||||
$count = count($at);
|
||||
if (!$count) {
|
||||
$this->response->data = $t;
|
||||
return;
|
||||
|
|
@ -46,9 +46,10 @@ class TagsController extends ApiController {
|
|||
$step = ($qmax - $qmin)/$grades;
|
||||
foreach ($at as $i => $tag)
|
||||
{
|
||||
$t['cloud'][] = array(
|
||||
$t['items'][] = array(
|
||||
'tag' => htmlspecialchars($tag['name']),
|
||||
'id' => (int)$tag['id'],
|
||||
'count' => $ac[$i],
|
||||
'w' => $this->tagWeight($qmin, $ac[$i], $step)
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue