X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustdoc%2Fhtml%2Fstatic%2Fmain.js;h=697199e9abf5a34fca3ca8bcb964cb526c31b4f6;hb=dbd29ea96ef77a67496bb44de382140354c23632;hp=21d57a17c6788edd1a25dc1ce156fbd3f9b7795a;hpb=239557de6de72748a5c7604081b202d53f7d9ac9;p=rust.git
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index 21d57a17c67..697199e9abf 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -386,12 +386,16 @@
});
}
+ function escape(content) {
+ return $('
').text(content).html();
+ }
+
function showResults(results) {
var output, shown, query = getQuery();
currentResults = query.id;
- output = 'Results for ' + query.query +
- (query.type ? ' (type: ' + query.type + ')' : '') + '
';
+ output = 'Results for ' + escape(query.query) +
+ (query.type ? ' (type: ' + escape(query.type) + ')' : '') + '
';
output += '';
if (results.length > 0) {
@@ -510,9 +514,9 @@
// `rustdoc::html::item_type::ItemType` type in Rust.
var itemTypes = ["mod",
"struct",
- "enum",
+ "type",
"fn",
- "typedef",
+ "type",
"static",
"trait",
"impl",
@@ -523,7 +527,8 @@
"variant",
"ffi",
"ffs",
- "macro"];
+ "macro",
+ "primitive"];
function itemTypeFromName(typename) {
for (var i = 0; i < itemTypes.length; ++i) {
@@ -642,12 +647,39 @@
}
div.append($('', {'href': '../' + crates[i] + '/index.html',
'class': klass}).text(crates[i]));
- div.append($('
'));
}
sidebar.append(div);
}
}
window.initSearch = initSearch;
-}());
+ window.register_implementors = function(imp) {
+ var list = $('#implementors-list');
+ var libs = Object.getOwnPropertyNames(imp);
+ for (var i = 0; i < libs.length; i++) {
+ if (libs[i] == currentCrate) continue;
+ var structs = imp[libs[i]];
+ for (var j = 0; j < structs.length; j++) {
+ var code = $('').append(structs[j]);
+ $.each(code.find('a'), function(idx, a) {
+ var href = $(a).attr('href');
+ if (!href.startsWith('http')) {
+ $(a).attr('href', rootPath + $(a).attr('href'));
+ }
+ });
+ var li = $('').append(code);
+ list.append(li);
+ }
+ }
+ };
+ if (window.pending_implementors) {
+ window.register_implementors(window.pending_implementors);
+ }
+
+ // See documentation in html/render.rs for what this is doing.
+ var query = getQueryStringParams();
+ if (query['gotosrc']) {
+ window.location = $('#src-' + query['gotosrc']).attr('href');
+ }
+}());