You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by ts...@apache.org on 2015/05/01 20:08:32 UTC

[36/50] [abbrv] drill git commit: Search page

Search page


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/c4a4fd1e
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/c4a4fd1e
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/c4a4fd1e

Branch: refs/heads/gh-pages
Commit: c4a4fd1e62e492a8932891ac5aaae218edcd0e8b
Parents: a4264b9
Author: Tomer Shiran <ts...@gmail.com>
Authored: Thu Apr 30 16:41:49 2015 -0700
Committer: Tomer Shiran <ts...@gmail.com>
Committed: Thu Apr 30 16:41:49 2015 -0700

----------------------------------------------------------------------
 _includes/menu.html |  1 -
 css/search.css      |  9 +++++++++
 css/style.css       | 26 --------------------------
 js/drill.js         | 21 ++++++++++++++++-----
 js/script.js        | 45 +++++----------------------------------------
 search.html         | 20 ++++++++++++++++++++
 6 files changed, 50 insertions(+), 72 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/c4a4fd1e/_includes/menu.html
----------------------------------------------------------------------
diff --git a/_includes/menu.html b/_includes/menu.html
index 71a7c01..01f111e 100755
--- a/_includes/menu.html
+++ b/_includes/menu.html
@@ -39,7 +39,6 @@
         <i class="fa fa-search"></i>
       </button>
     </form>
-    <form target="_blank" id="search-using-google"></form>
   </li>
   <li class="d">
     <a href="{{ site.baseurl }}/download/">

http://git-wip-us.apache.org/repos/asf/drill/blob/c4a4fd1e/css/search.css
----------------------------------------------------------------------
diff --git a/css/search.css b/css/search.css
new file mode 100644
index 0000000..64d25c8
--- /dev/null
+++ b/css/search.css
@@ -0,0 +1,9 @@
+.int_search {
+  margin:50px auto 0 auto;
+  width:780px;
+  font-family: 'PT Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
+}
+
+.int_search .gsc-control-cse, .int_search .gsc-control-cse .gsc-table-result {
+  font-family: 'PT Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/drill/blob/c4a4fd1e/css/style.css
----------------------------------------------------------------------
diff --git a/css/style.css b/css/style.css
index 8ec44af..63cd695 100755
--- a/css/style.css
+++ b/css/style.css
@@ -247,32 +247,6 @@ a.anchor {
 	background-image:url(../images/familiarity-w.png);
 }
 
-
-#search {
-	background:#145aa8;
-	display:none;
-	left:0px;
-	right:0px;
-	padding:30px;
-	position:fixed;	
-	top:50px;
-	z-index:5;
-}
-
-#search.r {
-	position:absolute;
-	width:779px;	
-}
-
-#search input {
-	background:transparent;
-	border:none;
-	color:#FFF;
-	font-size:34px;
-	font-weight:lighter;
-	width:100%;
-}
-
 #header {
 	background:url(../images/reel-bg.png) no-repeat;
 	background-size:cover;

http://git-wip-us.apache.org/repos/asf/drill/blob/c4a4fd1e/js/drill.js
----------------------------------------------------------------------
diff --git a/js/drill.js b/js/drill.js
index 8e808db..c3da037 100644
--- a/js/drill.js
+++ b/js/drill.js
@@ -1,3 +1,5 @@
+---
+---
 var Drill = Drill || {};
 
 Drill.Site = {
@@ -6,6 +8,18 @@ Drill.Site = {
     Drill.Site.watchInternalAnchorClicks();
     Drill.Site.watchSearchBarMouseEnter();
     Drill.Site.watchSearchSubmit();
+    Drill.Site.setSearchVal();
+  },
+  
+  getParameterByName : function(name) {
+      name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
+      var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
+          results = regex.exec(location.search);
+      return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
+  },
+  
+  setSearchVal : function() {
+    $("#drill-search-term").val(Drill.Site.getParameterByName('q'));
   },
 
   watchExpandMenuClicks : function(){
@@ -47,11 +61,8 @@ Drill.Site = {
     $("#menu .search-bar #drill-search-form").on("submit", function(e){
       e.preventDefault();
       var search_val = $("#drill-search-term").val();
-      var search_url = "https://www.google.com/webhp?ie=UTF-8#q="+search_val+"%20site%3Adrill.apache.org%20OR%20site%3Aissues.apache.org%2Fjira%2Fbrowse%2FDRILL%20OR%20site%3Amail-archives.apache.org%2Fmod_mbox%2Fdrill-user";
-      var form = $("#menu .search-bar form#search-using-google");
-      form.attr("action",search_url);
-      form.submit();
-      form.attr("action","");
+      var search_url = "{{ site.baseurl }}/search/?q="+search_val;
+      document.location.href = search_url;
     });
   },
 

http://git-wip-us.apache.org/repos/asf/drill/blob/c4a4fd1e/js/script.js
----------------------------------------------------------------------
diff --git a/js/script.js b/js/script.js
index 4cea01b..4657de2 100755
--- a/js/script.js
+++ b/js/script.js
@@ -1,7 +1,5 @@
-// JavaScript Document
-
-
-
+---
+---
 var reelPointer = null;
 $(document).ready(function(e) {
 	
@@ -33,45 +31,14 @@ $(document).ready(function(e) {
 			$(this).addClass("parent");	
 		}
     });
-	
-	$("#menu ul li.parent").mouseenter(function() {
-		closeSearch();
-	});
-	
+
 	$("#header .dots .dot:eq(0)").addClass("sel");
 	
-	$("#menu ul li.l").click(function() {
-		if ($(this).hasClass("open")) {
-			//devo chiudere	
-			closeSearch();
-		} else {
-			//devo aprire
-			$("#search").css({ display: "block", paddingTop: "0px", paddingBottom: "0px", marginTop:"-40px" }).animate({ paddingTop: "30px", paddingBottom: "30px", marginTop: "0px" },400,"easeOutQuint");
-			$("#search input").trigger("focus").select();
-			$(this).addClass("open");
-		}
-	});
-	
-	$("#search input").val("").keypress(function(e) {
-		if(e.keyCode == 13 && $(this).val()) {
-			document.location.href = "https://www.google.com/webhp?ie=UTF-8#q="+$(this).val()+"%20site%3Aincubator.apache.org%2Fdrill%20OR%20site%3Aissues.apache.org%2Fjira%2Fbrowse%2FDRILL%20OR%20site%3Amail-archives.apache.org%2Fmod_mbox%2Fincubator-drill-dev";
-		}
-	});	
-    
 	resized();
 	
 	$(window).scroll(onScroll);
 });
 
-function closeSearch() {
-	var R = ($("#menu ul li.l.open").length) ? true : false;
-	$("#menu ul li.l").removeClass("open");
-	$("#search").stop(false,true,false).animate({ paddingTop: "0px", paddingBottom: "0px", marginTop: "-40px" },400,"easeInQuint",function() {
-		$(this).css({ display: "none" });	
-	});
-	return R;
-}
-
 var reel_currentIndex = 0;
 function resized() {
 	
@@ -90,8 +57,8 @@ function resized() {
 		$(this).find(".tc").css({ top: Math.round(d/2)+"px" });
 	});
 	
-	if (WW < 999) $("#menu, #search").addClass("r");
-	else $("#menu, #search").removeClass("r");
+	if (WW < 999) $("#menu").addClass("r");
+	else $("#menu").removeClass("r");
 	
 	onScroll();
 		
@@ -123,10 +90,8 @@ function onScroll() {
 	var ST = document.body.scrollTop || document.documentElement.scrollTop;
 	if ($("#menu.r").length) {
 		$("#menu.r").css({ top: ST+"px" });	
-		$("#search.r").css({ top: (ST+50)+"px" });	
 	} else {
 		$("#menu").css({ top: "0px" });
-		$("#search").css({ top: "50px" });
 	}
 	
 	if (ST > 400) $("#subhead").addClass("show");	

http://git-wip-us.apache.org/repos/asf/drill/blob/c4a4fd1e/search.html
----------------------------------------------------------------------
diff --git a/search.html b/search.html
new file mode 100644
index 0000000..6ca4915
--- /dev/null
+++ b/search.html
@@ -0,0 +1,20 @@
+---
+layout: default
+title: Search
+---
+<link href="{{ site.baseurl }}/css/search.css" rel="stylesheet" type="text/css">
+
+<script>
+  (function() {
+    var cx = '009783892129588168944:67cuvhvyrtk';
+    var gcse = document.createElement('script');
+    gcse.type = 'text/javascript';
+    gcse.async = true;
+    gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
+        '//cse.google.com/cse.js?cx=' + cx;
+    var s = document.getElementsByTagName('script')[0];
+    s.parentNode.insertBefore(gcse, s);
+  })();
+</script>
+<div class="int_search" align="left"><gcse:searchresults-only></gcse:searchresults-only></div>
+