Skip to content

Commit

Permalink
Highlights tags that are textually similar
Browse files Browse the repository at this point in the history
  • Loading branch information
Tubebaum committed Jul 3, 2012
1 parent 1856b42 commit d4dea9f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
25 changes: 24 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
<script type="text/javascript" src="lib/loadmask/jquery.loadmask.min.js"></script>
<!-- Page Scripts -->
<script type="text/javascript">
//Local copy of the tag list
var tagArray = [];
//are we loading the page or just calling ajax triggerd by user interaction?
var firstload = true;
//Keeps track of the page being viewed
Expand Down Expand Up @@ -56,10 +58,28 @@
$('#addTagsInput').keyup(function(event) {
if(event.which == 13)
addTags();
else
findWords();
});
jQuery('.czntags').chosen({search_contains: true});
}
});

function findWords() {
console.log(tagArray);
var background = $('#tagDiv').css('background-color');
for(var i = 0; i < tagArray.length; ++i) {
if(tagArray[i].search($('#addTagsInput').val()) != -1 && $('#addTagsInput').val() != "") {
console.log($("#tagDiv span"));
//$("#tagDiv span").css("background-color","yellow");
$("#tagDiv span").eq(i).css("background-color","yellow");
}
else {
//$("#tagDiv span").css("background-color", background);
$("#tagDiv span").eq(i).css("background-color", background);
}
}
}

//Responds to the page number index that is clicked
function pagerClicked (pageNumber, search) {
Expand Down Expand Up @@ -92,12 +112,15 @@ function updateTagList() {
}).done(function(msg) {
$('#loadBar').hide();
$('#tagDiv').show();
$('#tagDiv').text(msg);
var tagList = msg.split(', ').sort();
var tags = tagList.join("</span>, <span>");
$('#tagDiv').html("<span>" + tags + "</span>");
if (firstload) {
showEntries();
reloadRemoveTags();
firstload = false;
}
tagArray = msg.replace(/ \([0-9]+\)/gi, "").split(', ').sort();
});
}

Expand Down
1 change: 1 addition & 0 deletions tagCaching.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a:4:{s:9:"education";i:21;s:7:"finance";i:21;s:9:"economics";i:21;s:4:"yale";i:21;}

0 comments on commit d4dea9f

Please sign in to comment.