') // wrap it in a DIV with a role of application
+ .tablesorter({widgets: ["addA11y"]})
+ .wrap("
") // wrap it in a DIV with a role of application
.attr("role", "grid") // add role of grid to the table itself
.attr("aria-readonly", "true") // mark the grid as readonly (because none of the data is editable
.attr("aria-labelledby", "theCaption") // label the table with caption
- .bind( 'keypress keyup keydown', function(e) {
+ .bind( "keypress keyup keydown", function(e) {
var keyCode;
var special = (e.ctrlKey || e.shiftKey || e.metaKey || e.altKey);
- if ( !e.keyCode && 'which' in e && e.which) keyCode = e.which;
- else keyCode = e.keyCode;
+ if ( !e.keyCode && "which" in e && e.which){
+ keyCode = e.which;
+ }
+ else {
+ keyCode = e.keyCode;
+ }
// Whenever a header cell is active, pressing the spacebar or enter
// will trigger the sort
if ( keyCode == 13 || keyCode == 32) {
- if ( $(e.target).hasClass( 'header')) {
- $(e.target).trigger( 'click');
+ if ( $(e.target).hasClass( "header")) {
+ $(e.target).trigger( "click");
}
}
}); // set the table to be labelled by its caption
@@ -79,16 +83,16 @@
$("#contrast-solution tbody th").attr("role", "rowheader").attr("scope", "row");
// add tabindex so tabindex only appears on the sortable headers
- // which is basicaly any TH *with* a class of 'header' (which gets put there by tablesorter)
+ // which is basicaly any TH *with* a class of "header" (which gets put there by tablesorter)
$("#contrast-solution th.header").attr("tabindex", "0");
// assign role of gridcell on all data cells
$("#contrast-solution tbody td").attr("role", "gridcell");
- $('#contrast-solution caption').attr({
- role: 'log',
- 'aria-live': 'assertive',
- 'aria-relevant': 'all',
- 'aria-atomic': 'true'
+ $("#contrast-solution caption").attr({
+ role: "log",
+ "aria-live": "assertive",
+ "aria-relevant": "all",
+ "aria-atomic": "true"
});
});
diff --git a/contrast-finder-webapp/src/main/webapp/Js/30-bootstrap.min.js b/webapp/src/main/webapp/Js/30-bootstrap.min.js
similarity index 100%
rename from contrast-finder-webapp/src/main/webapp/Js/30-bootstrap.min.js
rename to webapp/src/main/webapp/Js/30-bootstrap.min.js
diff --git a/contrast-finder-webapp/src/main/webapp/Js/35-affix.js b/webapp/src/main/webapp/Js/35-affix.js
similarity index 50%
rename from contrast-finder-webapp/src/main/webapp/Js/35-affix.js
rename to webapp/src/main/webapp/Js/35-affix.js
index 4ee58194..a03abdf7 100644
--- a/contrast-finder-webapp/src/main/webapp/Js/35-affix.js
+++ b/webapp/src/main/webapp/Js/35-affix.js
@@ -1,10 +1,10 @@
-$('#old-contrast').affix(
+$("#old-contrast").affix(
{
offset: {
top: function() {
- var header = $('#header').height()
- var setUpForm = $('#set-up-form').height()
- return (this.top = header + setUpForm + 135)
+ var header = $("#header").height();
+ var setUpForm = $("#set-up-form").height();
+ return (this.top = header + setUpForm + 135);
}
}
- })
+ });
diff --git a/contrast-finder-webapp/src/main/webapp/Js/36-sample.color.js b/webapp/src/main/webapp/Js/36-sample.color.js
similarity index 71%
rename from contrast-finder-webapp/src/main/webapp/Js/36-sample.color.js
rename to webapp/src/main/webapp/Js/36-sample.color.js
index 3e173536..cf260c10 100644
--- a/contrast-finder-webapp/src/main/webapp/Js/36-sample.color.js
+++ b/webapp/src/main/webapp/Js/36-sample.color.js
@@ -1,39 +1,42 @@
-$(document).ready(function() {
- // changeColorSample("foreground");
- // changeColorSample("background");
- document.getElementById("foreground-input").onchange = function() {
- changeColorSample("foreground");
- };
- document.getElementById("background-input").onchange = function() {
- changeColorSample("background");
- };
-});
-function changeColorSample(colorPrefix) {
- var input = document.getElementById(colorPrefix + "-input");
- var color = input.value.toLowerCase();
- var sample = document.getElementById(colorPrefix + "-sample");
- color = color.toString().replace(/\s/g,""); // replace ' ', \t, \n, ...
- color = isValidateColor(color.toString());
- if (color !== "false") {
- sample.style.backgroundColor = color;
- sample.classList.add('color-sample');
- sample.classList.add('sample-bordered');
- document.getElementById(colorPrefix + "-sample-invalid").style.display = "none";
- input.classList.remove('error');
- } else {
- sample.style.backgroundColor = "rgba(0,0,0,0)";
- sample.classList.remove('color-sample');
- sample.classList.remove('sample-bordered');
- document.getElementById(colorPrefix + "-sample-invalid").style.display = "inherit";
- input.classList.add('error');
- }
+String.prototype.splice = function(idx, rem, s) {
+ return (this.slice(0, idx) + s + this.slice(idx + Math.abs(rem)));
+};
+
+// only run when the substr() function is broken
+// Microsoft's JScript does not support negative values for the start index.
+// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr
+if ("ab".substr(-1) !== "b") {
+ /**
+ * Get the substring of a string
+ * @param {integer} start where to start the substring
+ * @param {integer} length how many characters to return
+ * @return {string}
+ */
+ String.prototype.substr = (function(substr) {
+ return function(start, length) {
+ // call the original method
+ return substr.call(this,
+ // did we get a negative start, calculate how much it is from the beginning of the string
+ // adjust the start parameter for negative value
+ start < 0 ? this.length + start : start,
+ length);
+ };
+ }(String.prototype.substr));
+}
+
+function setValidColor(str) {
+ var result = str.splice(0, 0, "#");
+ return result;
}
function isValidateColor(str) {
str = str.trim();
- if(str.match(/^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/) !== null){
+ if(str.match(/^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)?$/) !== null){
+ if(str.substr(-1) !== ")"){
+ str = str + ")";
+ }
return str;
}
else if (str.match(/^(\d{1,3}),(\d{1,3}),(\d{1,3})$/) !== null){
@@ -50,8 +53,8 @@ function isValidateColor(str) {
}
else {
// source: https://gist.github.com/bobspace/2712980
- var CssColorNames = ["AliceBlue","AntiqueWhite","Aqua","Aquamarine","Azure","Beige","Bisque","Black","BlanchedAlmond","Blue","BlueViolet","Brown","BurlyWood","CadetBlue","Chartreuse","Chocolate","Coral","CornflowerBlue","Cornsilk","Crimson","Cyan","DarkBlue","DarkCyan","DarkGoldenRod","DarkGray","DarkGrey","DarkGreen","DarkKhaki","DarkMagenta","DarkOliveGreen","Darkorange","DarkOrchid","DarkRed","DarkSalmon","DarkSeaGreen","DarkSlateBlue","DarkSlateGray","DarkSlateGrey","DarkTurquoise","DarkViolet","DeepPink","DeepSkyBlue","DimGray","DimGrey","DodgerBlue","FireBrick","FloralWhite","ForestGreen","Fuchsia","Gainsboro","GhostWhite","Gold","GoldenRod","Gray","Grey","Green","GreenYellow","HoneyDew","HotPink","IndianRed","Indigo","Ivory","Khaki","Lavender","LavenderBlush","LawnGreen","LemonChiffon","LightBlue","LightCoral","LightCyan","LightGoldenRodYellow","LightGray","LightGrey","LightGreen","LightPink","LightSalmon","LightSeaGreen","LightSkyBlue","LightSlateGray","LightSlateGrey","LightSteelBlue","LightYellow","Lime","LimeGreen","Linen","Magenta","Maroon","MediumAquaMarine","MediumBlue","MediumOrchid","MediumPurple","MediumSeaGreen","MediumSlateBlue","MediumSpringGreen","MediumTurquoise","MediumVioletRed","MidnightBlue","MintCream","MistyRose","Moccasin","NavajoWhite","Navy","OldLace","Olive","OliveDrab","Orange","OrangeRed","Orchid","PaleGoldenRod","PaleGreen","PaleTurquoise","PaleVioletRed","PapayaWhip","PeachPuff","Peru","Pink","Plum","PowderBlue","Purple","Red","RosyBrown","RoyalBlue","SaddleBrown","Salmon","SandyBrown","SeaGreen","SeaShell","Sienna","Silver","SkyBlue","SlateBlue","SlateGray","SlateGrey","Snow","SpringGreen","SteelBlue","Tan","Teal","Thistle","Tomato","Turquoise","Violet","Wheat","White",
- "WhiteSmoke","Yellow","YellowGreen"];
+ var CssColorNames = ["AliceBlue","AntiqueWhite","Aqua","Aquamarine","Azure","Beige","Bisque","Black","BlanchedAlmond","Blue","BlueViolet","Brown","BurlyWood","CadetBlue","Chartreuse","Chocolate","Coral","CornflowerBlue","Cornsilk","Crimson","Cyan","DarkBlue","DarkCyan","DarkGoldenRod","DarkGray","DarkGrey","DarkGreen","DarkKhaki","DarkMagenta","DarkOliveGreen","DarkOrange","DarkOrchid","DarkRed","DarkSalmon","DarkSeaGreen","DarkSlateBlue","DarkSlateGray","DarkSlateGrey","DarkTurquoise","DarkViolet","DeepPink","DeepSkyBlue","DimGray","DimGrey","DodgerBlue","FireBrick","FloralWhite","ForestGreen","Fuchsia","Gainsboro","GhostWhite","Gold","GoldenRod","Gray","Grey","Green","GreenYellow","HoneyDew","HotPink","IndianRed","Indigo","Ivory","Khaki","Lavender","LavenderBlush","LawnGreen","LemonChiffon","LightBlue","LightCoral","LightCyan","LightGoldenRodYellow","LightGray","LightGrey","LightGreen","LightPink","LightSalmon","LightSeaGreen","LightSkyBlue","LightSlateGray","LightSlateGrey","LightSteelBlue","LightYellow","Lime","LimeGreen","Linen","Magenta","Maroon","MediumAquaMarine","MediumBlue","MediumOrchid","MediumPurple","MediumSeaGreen","MediumSlateBlue","MediumSpringGreen","MediumTurquoise","MediumVioletRed","MidnightBlue","MintCream","MistyRose","Moccasin","NavajoWhite","Navy","OldLace","Olive","OliveDrab","Orange","OrangeRed","Orchid","PaleGoldenRod","PaleGreen","PaleTurquoise","PaleVioletRed","PapayaWhip","PeachPuff","Peru","Pink","Plum","PowderBlue","Purple","Red","RosyBrown","RoyalBlue","SaddleBrown","Salmon","SandyBrown","SeaGreen","SeaShell","Sienna","Silver","SkyBlue","SlateBlue","SlateGray","SlateGrey","Snow","SpringGreen","SteelBlue","Tan","Teal","Thistle","Tomato","Turquoise","Violet","Wheat","White",
+ "WhiteSmoke","Yellow","YellowGreen","RebeccaPurple"];
var query = str.toLowerCase();
var colorName = "";
CssColorNames.some(function(element, i) {
@@ -63,15 +66,39 @@ function isValidateColor(str) {
if(colorName !== ""){
return colorName;
}
- return "false"
+ return "false";
}
}
-function setValidColor(str) {
- var result = str.splice(0, 0, "#")
- return result;
+function changeColorSample(colorPrefix) {
+ var input = document.getElementById(colorPrefix + "-input");
+ var color = input.value.toLowerCase();
+ var sample = document.getElementById(colorPrefix + "-sample");
+ color = color.toString().replace(/\s/g,""); // replace ' ', \t, \n, ...
+ color = isValidateColor(color.toString());
+ if (color !== "false") {
+ sample.style.backgroundColor = color;
+ sample.classList.add("color-sample");
+ sample.classList.add("sample-bordered");
+ document.getElementById(colorPrefix + "-sample-invalid").style.display = "none";
+ input.classList.remove("error");
+ } else {
+ sample.style.backgroundColor = "rgba(0,0,0,0)";
+ sample.classList.remove("color-sample");
+ sample.classList.remove("sample-bordered");
+ document.getElementById(colorPrefix + "-sample-invalid").style.display = "inherit";
+ input.classList.add("error");
+ }
}
-String.prototype.splice = function(idx, rem, s) {
- return (this.slice(0, idx) + s + this.slice(idx + Math.abs(rem)));
-};
\ No newline at end of file
+
+$(document).ready(function() {
+ // changeColorSample("foreground");
+ // changeColorSample("background");
+ document.getElementById("foreground-input").onchange = function() {
+ changeColorSample("foreground");
+ };
+ document.getElementById("background-input").onchange = function() {
+ changeColorSample("background");
+ };
+});
\ No newline at end of file
diff --git a/contrast-finder-webapp/src/main/webapp/META-INF/context.xml b/webapp/src/main/webapp/META-INF/context.xml
similarity index 100%
rename from contrast-finder-webapp/src/main/webapp/META-INF/context.xml
rename to webapp/src/main/webapp/META-INF/context.xml
diff --git a/contrast-finder-webapp/src/main/webapp/WEB-INF/conf/mvc/cf-beans-controller.xml b/webapp/src/main/webapp/WEB-INF/conf/mvc/cf-beans-controller.xml
similarity index 89%
rename from contrast-finder-webapp/src/main/webapp/WEB-INF/conf/mvc/cf-beans-controller.xml
rename to webapp/src/main/webapp/WEB-INF/conf/mvc/cf-beans-controller.xml
index 014644af..56d2a824 100644
--- a/contrast-finder-webapp/src/main/webapp/WEB-INF/conf/mvc/cf-beans-controller.xml
+++ b/webapp/src/main/webapp/WEB-INF/conf/mvc/cf-beans-controller.xml
@@ -5,7 +5,7 @@
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd">
+ class="org.asqatasun.contrastfinder.webapp.controller.IndexController">
diff --git a/contrast-finder-webapp/src/main/webapp/WEB-INF/conf/mvc/cf-beans-i18n.xml b/webapp/src/main/webapp/WEB-INF/conf/mvc/cf-beans-i18n.xml
similarity index 100%
rename from contrast-finder-webapp/src/main/webapp/WEB-INF/conf/mvc/cf-beans-i18n.xml
rename to webapp/src/main/webapp/WEB-INF/conf/mvc/cf-beans-i18n.xml
diff --git a/contrast-finder-webapp/src/main/webapp/WEB-INF/conf/mvc/cf-beans-locale.xml b/webapp/src/main/webapp/WEB-INF/conf/mvc/cf-beans-locale.xml
similarity index 100%
rename from contrast-finder-webapp/src/main/webapp/WEB-INF/conf/mvc/cf-beans-locale.xml
rename to webapp/src/main/webapp/WEB-INF/conf/mvc/cf-beans-locale.xml
diff --git a/contrast-finder-webapp/src/main/webapp/WEB-INF/conf/mvc/cf-beans-model.xml b/webapp/src/main/webapp/WEB-INF/conf/mvc/cf-beans-model.xml
similarity index 82%
rename from contrast-finder-webapp/src/main/webapp/WEB-INF/conf/mvc/cf-beans-model.xml
rename to webapp/src/main/webapp/WEB-INF/conf/mvc/cf-beans-model.xml
index 33260247..f573e317 100644
--- a/contrast-finder-webapp/src/main/webapp/WEB-INF/conf/mvc/cf-beans-model.xml
+++ b/webapp/src/main/webapp/WEB-INF/conf/mvc/cf-beans-model.xml
@@ -5,10 +5,10 @@
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd">
+ class="org.asqatasun.contrastfinder.factory.ColorFinderHsvFactory"/>
+ class="org.asqatasun.contrastfinder.factory.ColorFinderHsvPsychoFactory">
@@ -17,7 +17,7 @@
+ class="org.asqatasun.contrastfinder.factory.ColorFinderRgbFactory">
@@ -31,7 +31,7 @@
+ class="org.asqatasun.contrastfinder.factory.ColorFinderFactoryImpl">
+ class="org.asqatasun.contrastfinder.hsv.Boundary">
+ class="org.asqatasun.contrastfinder.hsv.Boundary">
+ class="org.asqatasun.contrastfinder.hsv.Boundary">
diff --git a/contrast-finder-webapp/src/main/webapp/WEB-INF/conf/mvc/cf-beans-resolver.xml b/webapp/src/main/webapp/WEB-INF/conf/mvc/cf-beans-resolver.xml
similarity index 100%
rename from contrast-finder-webapp/src/main/webapp/WEB-INF/conf/mvc/cf-beans-resolver.xml
rename to webapp/src/main/webapp/WEB-INF/conf/mvc/cf-beans-resolver.xml
diff --git a/contrast-finder-webapp/src/main/webapp/WEB-INF/contrast-finder-servlet.xml b/webapp/src/main/webapp/WEB-INF/contrast-finder-servlet.xml
similarity index 100%
rename from contrast-finder-webapp/src/main/webapp/WEB-INF/contrast-finder-servlet.xml
rename to webapp/src/main/webapp/WEB-INF/contrast-finder-servlet.xml
diff --git a/contrast-finder-webapp/src/main/webapp/WEB-INF/pages/form.jsp b/webapp/src/main/webapp/WEB-INF/pages/form.jsp
similarity index 100%
rename from contrast-finder-webapp/src/main/webapp/WEB-INF/pages/form.jsp
rename to webapp/src/main/webapp/WEB-INF/pages/form.jsp
diff --git a/contrast-finder-webapp/src/main/webapp/WEB-INF/spring/security.xml b/webapp/src/main/webapp/WEB-INF/spring/security.xml
similarity index 100%
rename from contrast-finder-webapp/src/main/webapp/WEB-INF/spring/security.xml
rename to webapp/src/main/webapp/WEB-INF/spring/security.xml
diff --git a/contrast-finder-webapp/src/main/webapp/WEB-INF/template/cf-message.jspf b/webapp/src/main/webapp/WEB-INF/template/cf-message.jspf
similarity index 100%
rename from contrast-finder-webapp/src/main/webapp/WEB-INF/template/cf-message.jspf
rename to webapp/src/main/webapp/WEB-INF/template/cf-message.jspf
diff --git a/contrast-finder-webapp/src/main/webapp/WEB-INF/template/footer.jspf b/webapp/src/main/webapp/WEB-INF/template/footer.jspf
similarity index 100%
rename from contrast-finder-webapp/src/main/webapp/WEB-INF/template/footer.jspf
rename to webapp/src/main/webapp/WEB-INF/template/footer.jspf
diff --git a/contrast-finder-webapp/src/main/webapp/WEB-INF/template/head.jspf b/webapp/src/main/webapp/WEB-INF/template/head.jspf
similarity index 100%
rename from contrast-finder-webapp/src/main/webapp/WEB-INF/template/head.jspf
rename to webapp/src/main/webapp/WEB-INF/template/head.jspf
diff --git a/contrast-finder-webapp/src/main/webapp/WEB-INF/template/header.jspf b/webapp/src/main/webapp/WEB-INF/template/header.jspf
similarity index 100%
rename from contrast-finder-webapp/src/main/webapp/WEB-INF/template/header.jspf
rename to webapp/src/main/webapp/WEB-INF/template/header.jspf
diff --git a/contrast-finder-webapp/src/main/webapp/WEB-INF/template/template_variables.jspf b/webapp/src/main/webapp/WEB-INF/template/template_variables.jspf
similarity index 99%
rename from contrast-finder-webapp/src/main/webapp/WEB-INF/template/template_variables.jspf
rename to webapp/src/main/webapp/WEB-INF/template/template_variables.jspf
index 70108aef..acfd9d7f 100644
--- a/contrast-finder-webapp/src/main/webapp/WEB-INF/template/template_variables.jspf
+++ b/webapp/src/main/webapp/WEB-INF/template/template_variables.jspf
@@ -2,7 +2,7 @@
<%@ page pageEncoding="UTF-8" %>
<%-- APP version --%>
-
+
<%-- APP Name --%>
diff --git a/contrast-finder-webapp/src/main/webapp/WEB-INF/web.xml b/webapp/src/main/webapp/WEB-INF/web.xml
similarity index 100%
rename from contrast-finder-webapp/src/main/webapp/WEB-INF/web.xml
rename to webapp/src/main/webapp/WEB-INF/web.xml
diff --git a/contrast-finder-webapp/src/main/webapp/default.jsp b/webapp/src/main/webapp/default.jsp
similarity index 100%
rename from contrast-finder-webapp/src/main/webapp/default.jsp
rename to webapp/src/main/webapp/default.jsp