diff --git a/cat/index.html_pattern b/cat/index.html_pattern
index 29e7a3d..fee52d5 100644
--- a/cat/index.html_pattern
+++ b/cat/index.html_pattern
@@ -47,7 +47,6 @@
-
diff --git a/cat/js/cat.js b/cat/js/cat.js
index adbd362..b32659f 100644
--- a/cat/js/cat.js
+++ b/cat/js/cat.js
@@ -1,14 +1,21 @@
var pageLimit = 20;
-function secondStepSearch(caller) {
+function secondStepSearch(fragment) {
+
+ var searchQuery = $('body').data('current_fragment');
+ if (typeof(fragment) !== "undefined") {
+ searchQuery = fragment;
+ $('body').data('current_fragment', fragment);
+ }
var fullSearchRequest = {
operation: 'fullSearch',
tmId: currentTmId,
limit: pageLimit,
offset: $('#current-offset').val(),
- pattern:caller.innerHTML
+ pattern:searchQuery
}
+
$.ajax({
url: '/cat/concordia_gate.php',
type: 'post',
@@ -21,17 +28,38 @@ function secondStepSearch(caller) {
}
+function prevPage() {
+ var currentOffset = parseInt($('#current-offset').val());
+ if (currentOffset >= pageLimit) {
+ $('#current-offset').val(currentOffset-pageLimit)
+ secondStepSearch();
+ }
+}
+
+function nextPage() {
+ var currentOffset = parseInt($('#current-offset').val());
+ var currentTotalCount = $('body').data('currentTotalCount');
+ if (currentOffset < currentTotalCount - pageLimit) {
+ $('#current-offset').val(currentOffset+pageLimit)
+ secondStepSearch();
+ }
+}
+
+
function presentFullSearchResults(data) {
var pattern = $('#current-pattern').val();
var offset = parseInt($('#current-offset').val());
var begin = offset+1;
var end = offset + pageLimit;
var totalCount = parseInt(data['result']['totalCount']);
+ $('body').data('currentTotalCount', totalCount);
if (end > totalCount) {
end = totalCount;
}
- var result = 'Showing results '+begin+' - '+end+' of '+totalCount+'
';
+ var result = 'Showing results '+begin+' - '+end+' of '+totalCount+' ';
+ result += ' ';
+ result += '
';
for (j=0;j'+textFragment+'';
+ markedSentence += ''+textFragment+'';
lastInsertedEnd = fragment['matchedPatternEnd'];