From c9ac1a8faa12e25600fc898b4a573c778742858f Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Mon, 28 Mar 2016 10:25:44 +0000 Subject: [PATCH] updated theme for responsive home, workspace and messages buttons and search git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portal/liferay62-plugins/social-dockbar-hook@126329 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../portlet/dockbar/custom_dockbar_view.jspf | 71 ++++++++++++++++++- 1 file changed, 69 insertions(+), 2 deletions(-) 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 @@ - +