Don't show duplicate search clear button if webkit is already showing one
Don't show duplicate search clear button if webkit is already showing one

--- /dev/null
+++ b/js/ext/modernizr.min.js
@@ -1,1 +1,4 @@
-
+/* Modernizr 2.6.2 (Custom Build) | MIT & BSD

+ * Build: http://modernizr.com/download/#-addtest-teststyles

+ */

+;window.Modernizr=function(a,b,c){function u(a){i.cssText=a}function v(a,b){return u(prefixes.join(a+";")+(b||""))}function w(a,b){return typeof a===b}function x(a,b){return!!~(""+a).indexOf(b)}function y(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:w(f,"function")?f.bind(d||b):f}return!1}var d="2.6.2",e={},f=b.documentElement,g="modernizr",h=b.createElement(g),i=h.style,j,k={}.toString,l={},m={},n={},o=[],p=o.slice,q,r=function(a,c,d,e){var h,i,j,k,l=b.createElement("div"),m=b.body,n=m||b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:g+(d+1),l.appendChild(j);return h=["&#173;",'<style id="s',g,'">',a,"</style>"].join(""),l.id=g,(m?l:n).innerHTML+=h,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=f.style.overflow,f.style.overflow="hidden",f.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),f.style.overflow=k),!!i},s={}.hasOwnProperty,t;!w(s,"undefined")&&!w(s.call,"undefined")?t=function(a,b){return s.call(a,b)}:t=function(a,b){return b in a&&w(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=p.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(p.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(p.call(arguments)))};return e});for(var z in l)t(l,z)&&(q=z.toLowerCase(),e[q]=l[z](),o.push((e[q]?"":"no-")+q));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)t(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof enableClasses!="undefined"&&enableClasses&&(f.className+=" "+(b?"":"no-")+a),e[a]=b}return e},u(""),h=j=null,e._version=d,e.testStyles=r,e}(this,this.document);

--- /dev/null
+++ b/js/modules/hassearchreset.js
@@ -1,1 +1,18 @@
+define(['modernizr'], function() {
+	var tested = false;
 
+	return function() {
+		if (!tested) {
+			Modernizr.testStyles(
+				'#modernizr, x::-webkit-search-cancel-button { width: 9px; }',
+				function (elem, rule) {
+					Modernizr.addTest('searchreset', elem.offsetWidth == 9);
+				}
+			);
+			tested = true;
+		}
+
+		return Modernizr.searchreset;
+	};
+});
+

--- a/js/modules/projectsearch.js
+++ b/js/modules/projectsearch.js
@@ -9,8 +9,8 @@
  * @subpackage Javascript
  */
 
-define(["jquery", 'modules/resources'],
-	function($, resources) {
+define(["jquery", 'modules/resources', 'modules/hassearchreset'],
+	function($, resources, hassearchreset) {
 
 		var table = null;
 		var searchPanel = null;
@@ -52,7 +52,9 @@
 				}
 			});
 			if (table.find('tr.projectRow').size() > 0) {
-				searchPanel.find('a.clearSearch').click(clearSearch);
+				if (!hassearchreset()) {
+					searchPanel.find('a.clearSearch').click(clearSearch);
+				}
 				searchPanel.find('input.projectSearchBox').keyup(doSearch).bind('input paste', doSearch);
 			}
 		}
@@ -99,10 +101,12 @@
 			clearTimeout(searchTimer);
 			searchTimer = null;
 
-			if (searchString.length == 0) {
-				searchPanel.find('a.clearSearch').hide();
-			} else {
-				searchPanel.find('a.clearSearch').show();
+			if (!hassearchreset()) {
+				if (searchString.length == 0) {
+					searchPanel.find('a.clearSearch').hide();
+				} else {
+					searchPanel.find('a.clearSearch').show();
+				}
 			}
 
 			var hasMatch = false;

--- a/templates/main.tpl
+++ b/templates/main.tpl
@@ -46,7 +46,8 @@
 			'ext/jquery-1.8.1.min'
 		],
 		d3: 'ext/d3.v2.min',
-		qtip: 'ext/jquery.qtip.min'
+		qtip: 'ext/jquery.qtip.min',
+		modernizr: 'ext/modernizr.min'
 	},
 	config: {
 		'modules/snapshotformats': {

--- a/util/minify.sh
+++ b/util/minify.sh
@@ -34,7 +34,7 @@
 for i in ${JSDIR}/*${JSEXT}; do
 	echo "Minifying ${i}..."
 	JSMODULE="`basename ${i%$JSEXT}`"
-	java -classpath lib/rhino/js.jar:lib/closure/compiler.jar org.mozilla.javascript.tools.shell.Main lib/requirejs/r.js -o name=${JSMODULE} out=${JSDIR}/${JSMODULE}${MINEXT}.tmp baseUrl=${JSDIR} paths.jquery="empty:" paths.qtip="empty:" paths.d3="ext/d3.v2.min" optimize="closure" preserveLicenseComments="false"
+	java -classpath lib/rhino/js.jar:lib/closure/compiler.jar org.mozilla.javascript.tools.shell.Main lib/requirejs/r.js -o name=${JSMODULE} out=${JSDIR}/${JSMODULE}${MINEXT}.tmp baseUrl=${JSDIR} paths.jquery="empty:" paths.qtip="empty:" paths.d3="ext/d3.v2.min" paths.modernizr="ext/modernizr.min" optimize="closure" preserveLicenseComments="false"
 	cat util/jsheader.js ${JSDIR}/${JSMODULE}${MINEXT}.tmp > ${JSDIR}/${JSMODULE}${MINEXT}
 	rm -f ${JSDIR}/${JSMODULE}${MINEXT}.tmp
 done

comments