diff --git a/src/main/webapp/custom_jsps/html/portlet/dockbar/custom_dockbar_view.jspf b/src/main/webapp/custom_jsps/html/portlet/dockbar/custom_dockbar_view.jspf index 3aa0e13..03c04be 100644 --- a/src/main/webapp/custom_jsps/html/portlet/dockbar/custom_dockbar_view.jspf +++ b/src/main/webapp/custom_jsps/html/portlet/dockbar/custom_dockbar_view.jspf @@ -67,6 +67,73 @@ $(this).trigger("enterKey"); } }); + //remove placeholder text on click + $('#searchbox').click(function() { + $('#searchbox').attr("placeholder", ""); + }); + + $('#searchbox-phone').keyup(function(e){ + if(e.keyCode == 13) + { + $(this).trigger("enterKey"); + } + }); + //remove placeholder text on click + $('#searchbox-phone').click(function() { + $('#searchbox-phone').attr("placeholder", ""); + }); + + //search box keyboard handlers + $('#searchbox-phone').bind("enterKey",function(e){ + if ($('#searchbox-phone').val() != "") { + if ($('#searchbox-phone').val().indexOf("#") == 0) { + if ($('#searchbox-phone').val().indexOf(" ") >= 0) { + alert('Sorry, spaces not allowed when searching for topics!'); + return; + } + var base64hashtag = btoa($('#searchbox-phone').val()); + var base64attr = btoa("hashtagIdentificationParameter"); + if (window.location.href.indexOf("<%=mySiteURL%>") >= 0) { + window.location.href = "/group<%=mySiteURL%>?"+base64attr+"="+ base64hashtag; + } + else { + //this is when you are in a VRE and you want to search in that VRE, count the slashes to get where to point + //you always want to point to /group/vrename + var newhref = window.location.href; + if (window.location.href.indexOf("?") >= 0) { + newhref = window.location.href.split("?")[0]; + } + var count = newhref.split("/").length-1; + if (count > 4) + window.location.href = newhref + "/../?"+base64attr+"="+ base64hashtag; + else + window.location.href = newhref + "?"+base64attr+"="+ base64hashtag; + } + + } + else { + var base64hashtag = btoa($('#searchbox-phone').val()); + var base64attr = btoa("elasticSearchIdentificationParameter"); + if (window.location.href.indexOf("<%=mySiteURL%>") >= 0) { + window.location.href = "/group<%=mySiteURL%>?"+base64attr+"="+ base64hashtag; + } + else { + //this is when you are in a VRE and you want to search in that VRE, count the slashes to get where to point + //you always want to point to /group/vrename + var newhref = window.location.href; + if (window.location.href.indexOf("?") >= 0) { + newhref = window.location.href.split("?")[0]; + } + var count = newhref.split("/").length-1; + if (count > 4) + window.location.href = newhref + "/../?"+base64attr+"="+ base64hashtag; + else + window.location.href = newhref + "?"+base64attr+"="+ base64hashtag; + } + } + + } + }); }); @@ -91,7 +158,7 @@ @@ -115,7 +182,7 @@ - +