summaryrefslogtreecommitdiffstats
path: root/user_guide_src/source/_themes/eldocs/static
diff options
context:
space:
mode:
authorDerek Jones <derek.jones@ellislab.com>2013-07-20 00:34:49 +0200
committerDerek Jones <derek.jones@ellislab.com>2013-07-20 00:34:49 +0200
commit1e617c9b0cab036cff4de14f36ba9a2903462e51 (patch)
treea63e12eb2d76b07d0ff9bc3ae7b7eac056c97dc8 /user_guide_src/source/_themes/eldocs/static
parente7dfb679cf4f1a683d837aaea94b5b5125204779 (diff)
Allowing creation of dynamic local ToC for method / function names
Diffstat (limited to 'user_guide_src/source/_themes/eldocs/static')
-rw-r--r--user_guide_src/source/_themes/eldocs/static/asset/js/method-toc.js44
1 files changed, 44 insertions, 0 deletions
diff --git a/user_guide_src/source/_themes/eldocs/static/asset/js/method-toc.js b/user_guide_src/source/_themes/eldocs/static/asset/js/method-toc.js
new file mode 100644
index 000000000..92024c70a
--- /dev/null
+++ b/user_guide_src/source/_themes/eldocs/static/asset/js/method-toc.js
@@ -0,0 +1,44 @@
+/* modified from http://stackoverflow.com/a/12459801 */
+$(function (){
+ var createList = function(selector){
+
+ var ul = $('<ul>');
+ var selected = $(selector);
+
+ if (selected.length === 0){
+ return;
+ }
+
+ selected.clone().each(function (i,e){
+
+ var p = $(e).children('.descclassname');
+ var n = $(e).children('.descname');
+ var l = $(e).children('.headerlink');
+
+ var a = $('<a>');
+ a.attr('href',l.attr('href')).attr('title', 'Link to this definition');
+
+ a.append(p).append(n);
+
+ var entry = $('<li>').append(a);
+ ul.append(entry);
+ });
+ return ul;
+ }
+
+ var c = $('<div>');
+
+ var ul0 = c.clone().append($('.submodule-index'))
+
+ customIndex = $('.custom-index');
+ customIndex.empty();
+ customIndex.append(ul0);
+
+ var l = createList('dl.method > dt');
+ if (l) {
+ var ul = c.clone()
+ .append('<h3>Methods / Function</h3>')
+ .append(l);
+ }
+ customIndex.append(ul);
+}); \ No newline at end of file