change font size of titles acc to no of chars
This commit is contained in:
parent
eb33e0da95
commit
75b0d7d774
|
@ -12,8 +12,14 @@ $('#listLeft ul li a').live("click", function() {
|
|||
'tab_id': tabId,
|
||||
'object_id': objId
|
||||
}, function(data) {
|
||||
$('#textRight').text(data.title);
|
||||
$('#bottomRight').html(data.html);
|
||||
$('#textRight').text(data.title).formatTitle();
|
||||
var searchTerm = $('.searchListField').val();
|
||||
var html = data.html;
|
||||
if (searchTerm != '') {
|
||||
html = highlightWordsNoCase(html, searchTerm);
|
||||
// html = html.replace(searchTerm, "<span class='highlight'>" + searchTerm + "</span>");
|
||||
}
|
||||
$('#bottomRight').html(html);
|
||||
// console.log(data);
|
||||
});
|
||||
return false;
|
||||
|
@ -29,6 +35,11 @@ $('.toggleNext').live("click", function(e) {
|
|||
}
|
||||
});
|
||||
|
||||
function highlightWordsNoCase(data, word)
|
||||
{
|
||||
var regex = new RegExp("(" + word + ")", "gi");
|
||||
return data.replace(regex, "<span class='searchHighlight'>$1</span>");
|
||||
}
|
||||
|
||||
/* Get a jquery <option> row for a sort field, requires s.operator, s.field_name, s.friendly_name */
|
||||
function getOption(s) {
|
||||
|
@ -98,7 +109,7 @@ $(function() {
|
|||
|
||||
} else {
|
||||
/* end if has_list */
|
||||
$('#textRight').text(data.title);
|
||||
$('#textRight').text(data.title).formatTitle();
|
||||
var $html = getNoListHtml(data.page.items);
|
||||
$('#bottomRight').empty().append($html);
|
||||
}
|
||||
|
@ -106,24 +117,30 @@ $(function() {
|
|||
});
|
||||
|
||||
$('#orderBySelect').change(function(e) {
|
||||
var sortString = $(this).val();
|
||||
doListLoading();
|
||||
$.getJSON("/m/get_list", {
|
||||
'tab_id': $('.innerSelected').attr("data-id"),
|
||||
'sort': sortString
|
||||
}, function(data) {
|
||||
stopListLoading(data);
|
||||
displayList(data.items);
|
||||
});
|
||||
$('.selectMenu').submit();
|
||||
});
|
||||
|
||||
|
||||
$('#searchListIcon').click(function() {
|
||||
var term = $('.searchListField').val();
|
||||
$('.selectMenu').submit();
|
||||
});
|
||||
|
||||
$('.searchListField').keyup(function(e) {
|
||||
e.preventDefault();
|
||||
if (e.keyCode == 13) {
|
||||
$('.selectMenu').submit();
|
||||
}
|
||||
});
|
||||
|
||||
$('.selectMenu').submit(function(e) {
|
||||
e.preventDefault();
|
||||
var sortString = $('#orderBySelect').val();
|
||||
var searchTerm = $('.searchListField').val();
|
||||
doListLoading();
|
||||
$.getJSON("/m/get_list", {
|
||||
'tab_id': $('.innerSelected').attr("data-id"),
|
||||
// 'sort': sortString,
|
||||
'search': term
|
||||
'sort': sortString,
|
||||
'search': searchTerm
|
||||
}, function(data) {
|
||||
stopListLoading(data);
|
||||
displayList(data.items);
|
||||
|
@ -219,3 +236,17 @@ function getNoListItemHtml(item) {
|
|||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
jQuery.fn.formatTitle = function() {
|
||||
var txt = $(this).text();
|
||||
var fontSize;
|
||||
// alert(txt.length);
|
||||
if (txt.length < 35) {
|
||||
fontSize = 50;
|
||||
} else if (txt.length < 60) {
|
||||
fontSize = 35;
|
||||
} else {
|
||||
fontSize = 20;
|
||||
}
|
||||
this.css({'fontSize': fontSize + "px"});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user