Permalink
Browse files

Merge branch 'master' of github.com:jmakeig/qndexes

  • Loading branch information...
2 parents ef017a1 + 6a031e8 commit ef5d48e4b10b055e9a6bf388c0290e857315a935 @grechaw grechaw committed Oct 28, 2011
Showing with 107 additions and 4 deletions.
  1. +4 −0 ui/element-element.xqy
  2. +29 −0 ui/element.xqy
  3. +50 −0 ui/static/app.js
  4. +24 −4 ui/static/browser.css
  5. BIN ui/static/img/magnifier.png
@@ -0,0 +1,4 @@
+(
+ xdmp:set-response-content-type("application/json"),
+ '{"a": "A", "b": "B"}'
+)
View
@@ -0,0 +1,29 @@
+(
+ xdmp:set-response-content-type("application/json"),
+ '{
+ html:{
+ html: 4
+ },
+ Element2:{
+ Element2: 5
+ },
+ Element3:{
+ Element3: 7
+ },
+ Element4:{
+ Element4: 1
+ },
+ Element5:{
+ Element5: 5
+ },
+ Element6:{
+ Element6: 15
+ },
+ Element7:{
+ Element7: 10
+ },
+ Element8:{
+ Element8: 11
+ }
+}'
+)
View
@@ -0,0 +1,50 @@
+$(document).ready(function(evt) {
+ $("#search").submit(function(evt) {
+ getElementElementFrequencies($("#q").val(), function(data) {
+ console.dir(data);
+ });
+ getElementFrequencies($("#q").val(), function(data) {
+ console.dir(data);
+ });
+ evt.preventDefault();
+ });
+});
+
+function getElementFrequencies(query, handler/* function(data) */) {
+ var xhr = new XMLHttpRequest();
+ xhr.onreadystatechange = function() {
+ if(this.readyState === 1) { /* Loading */ }
+ if(this.readyState === 4) {
+ if (this.status >= 200 && this.status < 300) {
+ console.log("success");
+ handler(JSON.parse(this.responseText));
+ } else {
+ console.error(this.responseText);
+ }
+ }
+ }
+ xhr.open("GET", "/element.xqy?q=" + encodeURIComponent(query), true); // + $.serialize({"q": query}), true);
+ xhr.setRequestHeader("Accept", "application/json");
+ xhr.send();
+}
+
+
+function getElementElementFrequencies(query, handler/* function(data) */) {
+ var xhr = new XMLHttpRequest();
+ xhr.onreadystatechange = function() {
+ if(this.readyState === 1) { /* Loading */ }
+ if(this.readyState === 4) {
+ if (this.status >= 200 && this.status < 300) {
+ console.log("success");
+ handler(JSON.parse(this.responseText));
+ } else {
+ console.error(this.responseText);
+ }
+ }
+ }
+ xhr.open("GET", "/element-element.xqy?q=" + encodeURIComponent(query), true); // + $.serialize({"q": query}), true);
+ xhr.setRequestHeader("Accept", "application/json");
+ xhr.send();
+}
+
+
View
@@ -1,22 +1,42 @@
html {
padding: 2em 1em;
+ background: #333;
}
body {
font-family: Helvetica, sans-serif;
font-size: 18px;
+ color: #fff;
+}
+h1, h2, h3, h4, h5, h6 {
+ margin: 0;
+ margin-bottom: 0.1em;
+}
+h2 {
+ font-size: 0.85em;
+ color: #999;
}
form {
-
+ margin: 1em 0;
}
input, button {
display: inline-block;
+ box-sizing: border-box;
+ height: 1.5em;
font-size: 125%;
- padding: 0.25em;
+ border-style: none;
+ padding: 0 0.25em;
}
input#q {
width: 80%;
}
button {
- width: 10%;
-
+ width: 60px;
+ border-style: none;
+ background-image: url("/static/img/magnifier.png");
+ background-repeat: no-repeat;
+ background-position: center center;
+ text-indent: -2000000px;
+ border-top-right-radius: 1em;
+ border-bottom-right-radius: 1em;
+ cursor: pointer;
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ef5d48e

Please sign in to comment.