|
@@ -335,12 +335,44 @@ $(document).ready(function() {
|
|
|
*/
|
|
|
window.setTimeout(function() {
|
|
|
// Declarations
|
|
|
+ var loopCounter = 0;
|
|
|
var text;
|
|
|
|
|
|
// For every added item
|
|
|
$("li.added_item .expandable").each(function() {
|
|
|
// Declarations
|
|
|
+ text = $(this).text();
|
|
|
|
|
|
+ // For every tag in the database that belongs to the active user
|
|
|
+ for(t in tags) {
|
|
|
+ console.log(loopCounter);
|
|
|
+ // If the current tag exists in the textarea
|
|
|
+ if(text.indexOf(tags[loopCounter]) != -1) {
|
|
|
+ // While loop here if we want to apply the tag for every instance of a given term (j49b3e4a)
|
|
|
+
|
|
|
+ // Apply the tag
|
|
|
+ text = text.replace(tags[loopCounter], "<a class='tag' contenteditable='false'>" + tags[loopCounter] + "</a>");
|
|
|
+ }
|
|
|
+
|
|
|
+ loopCounter++;
|
|
|
+ }
|
|
|
+
|
|
|
+ $(this).html(text);
|
|
|
+ });
|
|
|
+
|
|
|
+ // Show the tag window on tag click
|
|
|
+ showTagWindowOnTagClick();
|
|
|
+ }, 100);
|
|
|
+
|
|
|
+ /*
|
|
|
+ window.setTimeout(function() {
|
|
|
+ // Declarations
|
|
|
+ var text;
|
|
|
+
|
|
|
+ // For every added item
|
|
|
+ // $("li.added_item textarea").each(function() {
|
|
|
+ $("li.added_item div").each(function() {
|
|
|
+ // Declarations
|
|
|
var loopCounter = 0;
|
|
|
|
|
|
// For every tag in the database that belongs to the active user
|
|
@@ -349,7 +381,7 @@ $(document).ready(function() {
|
|
|
|
|
|
// If the current tag exists in the textarea
|
|
|
if(text.indexOf(tags[loopCounter]) != -1) {
|
|
|
- // While loop here if we want to apply the tag for every instance of a given term (j49b3e4a)
|
|
|
+ // While loop here if we want to apply the tag for every instance of a given term
|
|
|
|
|
|
// Apply the tag
|
|
|
text = text.replace(tags[loopCounter], "<a class='tag' contenteditable='false'>" + tags[loopCounter] + "</a>");
|
|
@@ -363,10 +395,10 @@ $(document).ready(function() {
|
|
|
// Show the tag window on tag click
|
|
|
showTagWindowOnTagClick();
|
|
|
}, 100);
|
|
|
+ */
|
|
|
|
|
|
// Populate "Saved Tags"
|
|
|
- loopCounter = 0;
|
|
|
-
|
|
|
+ var loopCounter = 0;
|
|
|
var savedTags = $("div.saved-tags p");
|
|
|
|
|
|
savedTags.html("");
|