Browse Source

Bug fix

Modifying an added idea sometimes messed up Saved Tags' alphabetical order
Unknown 7 years ago
parent
commit
dc23bf7d44
2 changed files with 3 additions and 9 deletions
  1. 2 8
      canvas/js/canvas.js
  2. 1 1
      canvas/php/get-tags.php

+ 2 - 8
canvas/js/canvas.js

@@ -398,11 +398,6 @@ $(document).ready(function() {
                     // Assign returnData to the tags variable
                     // Assign returnData to the tags variable
                     tags = returnData;
                     tags = returnData;
                     
                     
-                    // Sort the tags
-                    returnData.sort(function (a, b) { 
-                        return a.toLowerCase().localeCompare(b.toLowerCase())
-                    });
-                    
                     // Update tags on the canvas
                     // Update tags on the canvas
                     updateTags();
                     updateTags();
                 }
                 }
@@ -444,8 +439,8 @@ $(document).ready(function() {
                 );
                 );
                 
                 
                 // Update tags on the canvas
                 // Update tags on the canvas
-                window.setTimeout(updateTags(), 100);
-                // updateTags();
+                // window.setTimeout(updateTags(), 100);
+                updateTags();
                 
                 
                 // Zoom out animation
                 // Zoom out animation
                 li.find("div").addClass("zoom-out");
                 li.find("div").addClass("zoom-out");
@@ -453,7 +448,6 @@ $(document).ready(function() {
                 li.find("div").css("-ms-transform", "scale(1)");
                 li.find("div").css("-ms-transform", "scale(1)");
                 li.find("div").css("-webkit-transform", "scale(1)");
                 li.find("div").css("-webkit-transform", "scale(1)");
                 li.find("div").css("transform", "scale(1)");
                 li.find("div").css("transform", "scale(1)");
-
                 
                 
                 toggleTextElementOnFocus();
                 toggleTextElementOnFocus();
             });
             });

+ 1 - 1
canvas/php/get-tags.php

@@ -9,7 +9,7 @@
         $username = $_POST["username"];
         $username = $_POST["username"];
         
         
         // Declare query
         // Declare query
-        $query = "SELECT tag FROM tags WHERE username = '" . $username . "';";
+        $query = "SELECT tag FROM tags WHERE username = '" . $username . "' ORDER BY tag;";
         
         
         // Run query
         // Run query
         $recordSet = databaseQueryWithReturn($database, $query);
         $recordSet = databaseQueryWithReturn($database, $query);