nitdoc: move filtering facilities to its own plugin file
authorAlexandre Terrasa <alexandre@moz-code.org>
Wed, 12 Feb 2014 03:19:47 +0000 (22:19 -0500)
committerAlexandre Terrasa <alexandre@moz-code.org>
Thu, 20 Feb 2014 19:11:58 +0000 (14:11 -0500)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

share/nitdoc/js/nitdoc.js
share/nitdoc/js/plugins/filtering.js [moved from share/nitdoc/js/plugins/ui.js with 87% similarity]

index f064863..dc2e12d 100644 (file)
@@ -14,7 +14,7 @@ require.config({
 define([
        "plugins/folding",
        "plugins/clipboard",
-       "plugins/ui",
+       "plugins/filtering",
        "plugins/quicksearch",
        "plugins/github",
 ], function() {});
similarity index 87%
rename from share/nitdoc/js/plugins/ui.js
rename to share/nitdoc/js/plugins/filtering.js
index 7153da6..27cc8ed 100644 (file)
 */\r
 \r
 /*\r
- * Nitdoc UI module\r
+ * Nitdoc Filtering\r
  *\r
- * Enhance nitdoc usability with JS features\r
+ * Allow user to filter sidebar entries and search page\r
  */\r
 define([\r
        "jquery",\r
+       'jQueryUI',\r
        "plugins/utils"\r
-], function($, utils) {\r
+], function($, UI, Utils) {\r
 \r
-       var UI = {\r
+       var Filtering = {\r
 \r
                // Allow user to filter sidebar box entries by name\r
                enableSidebarTextFilters: function(filterSelector) {\r
@@ -63,7 +64,7 @@ define([
 \r
                // Prealod filters using search query\r
                preloadSidebarTextFilters: function() {\r
-                       var anchor = utils.extractAnchor(document.location.hash);\r
+                       var anchor = Utils.extractAnchor(document.location.hash);\r
                        if(!anchor || anchor.indexOf("q=") == -1) return;\r
 \r
                        var query = anchor.substring(2);\r
@@ -145,7 +146,7 @@ define([
 \r
                // Prealod filter using search query\r
                preloadSearchPageField: function() {\r
-                       var anchor = utils.extractAnchor(document.location.hash);\r
+                       var anchor = Utils.extractAnchor(document.location.hash);\r
                        if(!anchor || anchor.indexOf("q=") == -1) return;\r
 \r
                        var query = anchor.substring(2);\r
@@ -158,7 +159,9 @@ define([
                }\r
        };\r
 \r
-       UI.enableSidebarTextFilters("nav.filterable h3");\r
-       UI.enableSidebarTypeFilters("nav.filterable");\r
-       UI.enableSearchPageField(".content.fullpage h1:contains('Search')");\r
+       Filtering.enableSidebarTextFilters("nav.filterable h3");\r
+       Filtering.enableSidebarTypeFilters("nav.filterable");\r
+       Filtering.enableSearchPageField(".content.fullpage h1:contains('Search')");\r
+\r
+       return Filtering;\r
 });\r