Unknown 7 роки тому
батько
коміт
df731640cb
2 змінених файлів з 24 додано та 16 видалено
  1. 1 1
      canvas/index.php
  2. 23 15
      canvas/js/canvas.js

+ 1 - 1
canvas/index.php

@@ -890,7 +890,7 @@
                     </p>
                     <button type="button" class="window-button" id="save-tag">Save Tag</button>&nbsp;
                     <button type="button" class="window-button" id="delete-tag">Delete Tag</button>
-                    <h2 class="similar-tags">Similar tags by other users</h2>
+                    <h2 class="similar-tags">Similar tags in other canvases</h2>
                     <p class='similar-tags-description-none'>No similar tags could be found!</p>
                     <!-- </div> -->
                 </div>

+ 23 - 15
canvas/js/canvas.js

@@ -526,6 +526,9 @@ $(document).ready(function() {
                 
                 // For every added item
                 $("li.added_item .expandable").each(function() {                    
+                    $(this).html($(this).text());
+                    
+                    /*
                     var thisDiv = $(this);                      // Delete the declaration (because it's ugly!)
                     
                     // For every tag in the database that belongs to the active user
@@ -540,10 +543,11 @@ $(document).ready(function() {
                         
                         loopCounter++;
                     }
+                     */
                 });
                 
                 // If no tags have been added, reset text explaining so
-                if(tags.length === 0 || tags === undefined) {
+                if(tags.length === 0) {
                     $("div.saved-tags p").html("You haven't added any tags yet.");
                 }
             },
@@ -579,7 +583,7 @@ $(document).ready(function() {
         console.log(tags.length);
         
         // If no tags have been added, reset text explaining so
-        if(tags.length === 0 || tags === undefined) {
+        if(tags.length === 0) {
             $("div.saved-tags p").html("You haven't added any tags yet.");
         }
          */
@@ -692,11 +696,11 @@ $(document).ready(function() {
     // var textarea = $("div#tag-window textarea#tag-description");
     var textareaHasBeenChanged = false;
     var tag;
-    var tagIsNew = false;
+    // var tagIsNew = false;
     var username = $("input[name='username']").val();
     
     // Check if the tag is new
-    function checkIfTagIsNew() {
+    function hideDeleteTagIfTagIsNew() {
         // Declarations
         var tagToAJAX = tag;
         
@@ -717,10 +721,10 @@ $(document).ready(function() {
                     $("div#tag-window button#delete-tag").css("display", "none");
                     
                     // Hide "Similar tags"
-                    $("div#tag-window h2.similar-tags").css("display", "none");
+                    // $("div#tag-window h2.similar-tags").css("display", "none");
                     
                     // The tag is new
-                    tagIsNew = true;
+                    // tagIsNew = true;
                 }
                 // If the current tag exists in the database
                 else {
@@ -728,7 +732,7 @@ $(document).ready(function() {
                     $("div#tag-window button#delete-tag").css("display", "inline");
                     
                     // Show "Similar tags"
-                    $("div#tag-window h2.similar-tags").css("display", "block");
+                    // $("div#tag-window h2.similar-tags").css("display", "block");
                 }
             },
             error: function(xhr) {
@@ -840,11 +844,8 @@ $(document).ready(function() {
                     // updateTags();
                 }
                 else {
-                    // If the tag isn't a new tag
-                    if(tagIsNew === false) {
-                        // Show the message saying that there are no similar tags to show
-                        $("p.similar-tags-description-none").css("display", "block");
-                    }
+                    // Show the message saying that there are no similar tags to show
+                    $("p.similar-tags-description-none").css("display", "block");
                 }
             },
             error: function(xhr) {
@@ -879,7 +880,7 @@ $(document).ready(function() {
          */
             
         // Check if the tag is new
-        checkIfTagIsNew();
+        hideDeleteTagIfTagIsNew();
         
         // Get the description for the selected tag
         getDescriptionForSelectedTag();
@@ -938,7 +939,7 @@ $(document).ready(function() {
             closeTagWindow();
         }
         
-        tagIsNew = false;
+        // tagIsNew = false;
     });
     
     // If the user clicks on the "Close" button
@@ -1097,6 +1098,11 @@ $(document).ready(function() {
                 textElement.css("-webkit-transform", "scale(1)");
                 textElement.css("transform", "scale(1)");
                 
+                // If no tags have been added, reset text explaining so
+                if(tags.length === 0) {
+                    $("div.saved-tags p").html("You haven't added any tags yet.");
+                }
+                
                 toggleTextElementOnFocus();
             }
         });
@@ -1112,7 +1118,7 @@ $(document).ready(function() {
             if(tagWindowIsOpen === false) {
                 var li = $(this).parent();
                 var textElement;
-                var textElementHTML;
+                // var textElementHTML;
                 var textElementWidth;
                 
                 // Replace div with a textarea
@@ -1123,6 +1129,7 @@ $(document).ready(function() {
                 // Remember the text element
                 textElement = li.find(".expandable");
                 
+                /*
                 // Fix the bug that tags still might appear
                 textElementHTML = textElement.html();
                 
@@ -1132,6 +1139,7 @@ $(document).ready(function() {
                 }
                 
                 textElement.html(textElementHTML);
+                 */
                 
                 // Remember the width of the text element
                 textElementWidth = textElement.width();