$(document).ready(function(){ $('.blog-pic').hover(function(){ let string_cont = '#' + $(this).attr('id') + 'content'; let string_cont1 = $(string_cont).val(); let content_len = $(string_cont).text().length; if (content_len > 100 && content_len != 0) { let new_content = $(string_cont).text().substring(0,101); new_content += "..."; $(string_cont).text(new_content); } let overview = '#' + $(this).attr('id') + 'overview'; $(document).bind('mousemove', function(e){ $(overview).css({ left: e.pageX + 20, top: e.pageY, }); }); $(overview).show(); }, function() { let overview = '#' + $(this).attr('id') + 'overview'; $(overview).hide(); $(document).unbind('mousemove'); }); $('.blog-pic-cornerstone-test').hover(function(){ let string_cont = '#' + $(this).attr('id') + 'content'; let string_cont1 = $(string_cont).val(); let content_len = $(string_cont).text().length; if (content_len > 100 && content_len != 0) { let new_content = $(string_cont).text().substring(0,101); new_content += "..."; $(string_cont).text(new_content); } let overview = '#' + $(this).attr('id') + 'overview'; let idpic = '#' + $(this).attr('id'); var x = $(idpic).offset().left; var y = $(idpic).offset().top; $(document).bind('mousemove', function(e){ $(overview).css({ left: x, top: e.pageY - y, }); }); $(overview).show(); }, function() { let overview = '#' + $(this).attr('id') + 'overview'; $(overview).hide(); $(document).unbind('mousemove'); }); $('#findBlogButton').click(function() { let redirectLink = '/blog?'; if ($('#timeCategorySelect option:selected').val() !== 'Select Month') { let linkdate = document.getElementById('timeCategorySelect').value.substring(23,30).replace('/','-'); redirectLink += 'month=' + linkdate + '-01' + "&"; } if (document.getElementById('searchInput').value){ let searchTerm = encodeURI(document.getElementById('searchInput').value); redirectLink += 'title=' + searchTerm + '&'; } if ($('#blogCategorySelect option:selected').val() !== 'all'){ redirectLink += 'filterBy=' + $('#blogCategorySelect option:selected').val(); } window.location.href = redirectLink; }); $('.releventPic').hover(function(){ let overview = '#' + $(this).attr('id') + 'overview'; var sectionPosition = $('#eventCalendarSection').offset(); $(document).bind('mousemove', function(e){ $(overview).css({ left: e.pageX + 20, top: e.pageY, }); }); $(overview).show(); }, function() { let overview = '#' + $(this).attr('id') + 'overview'; $(overview).hide(); $(document).unbind('mousemove'); }); $(document).on('keyup',function(e) { if(e.which == 13) { let redirectLink = '/blog?'; if ($('#timeCategorySelect option:selected').val() !== 'Select Month') { let linkdate = document.getElementById('timeCategorySelect').value.substring(23,30).replace('/','-'); redirectLink += 'month=' + linkdate + '-01' + "&"; } if (document.getElementById('searchInput').value){ let searchTerm = encodeURI(document.getElementById('searchInput').value); redirectLink += 'title=' + searchTerm + '&'; } if ($('#blogCategorySelect option:selected').val() !== 'all'){ redirectLink += 'filterBy=' + $('#blogCategorySelect option:selected').val(); } window.location.href = redirectLink; } }); });