无论如何都可以访问stackoverflow的真棒标记系统吗?我想借用Stack的真棒自动建议和标签迷你解释盒为我自己的网站。显然,我可以使用jQuery UI自动建议标签,但我真的想也包括很酷的小标签描述。如果没有,有人可以告诉我所有这些解释/描述来自哪里,以便我可以实现类似的系统?
答案 0 :(得分:15)
第308行:
$.get("/filter/tags", {q: a,newstyle: !0}, "json").done(function(c) {
C["t_" + a] = c;
StackExchange.helpers.removeSpinner();
b(c)
})
这可能会帮助你!
API网址是:
https://stackoverflow.com/filter/tags?q=STRING&newstyle=BOOLEAN
q
- 查询文字。 newstyle
- 是否需要新款式。将使用其他信息(如同义词和摘录)以JSON格式返回新样式的结果。DEMO: http://jsfiddle.net/DerekL/bXXb7/(使用跨域请求jQuery plguin)
例如:
https://stackoverflow.com/filter/tags?q=htm
会给你:
"html|99829\nhtml5|16359\nxhtml|4143\nhtml-parsing|1461\nhtml-lists|1328\nhtml5-video|949"
其中99829
是问题的数量。我花了15分钟看源代码来找出这个api。 -_-“
以新风格加入javascript
可为您提供:here
<子>
[{"Name":"javascript","Synonyms":"classic-javascript|javascript-execution","Count":223223,"Excerpt":"JavaScript is a dynamic language commonly used for scripting in web browsers. It is NOT the same as Java. Use this tag for questions regarding ECMAScript and its dialects/implementations (excluding ActionScript and JScript). If a framework or library, such as jQuery, is used, include that tag as well. Questions that don't include a framework/library tag, such as jQuery, implies that the question requires a pure JavaScript answer."},{"Name":"javascript-events","Synonyms":"javascript-event","Count":5707,"Excerpt":"Creating and handling JavaScript events inline in HTML or through a script."},{"Name":"facebook-javascript-sdk","Synonyms":"","Count":992,"Excerpt":"Facebook's JavaScript SDK provides a rich set of client-side functionality for accessing Facebook's server-side API calls. These include all of the features of the REST API, Graph API, and Dialogs."},{"Name":"javascript-library","Synonyms":"","Count":675,"Excerpt":"A JavaScript library is a library of pre-written JavaScript which allows for easier development of JavaScript-based applications, especially for AJAX and other web-centric technologies."},{"Name":"javascript-framework","Synonyms":"","Count":563,"Excerpt":"A JavaScript framework is a library of pre-written JavaScript which allows for easier development of JavaScript-based applications, especially for AJAX and other web-centric technologies."},{"Name":"unobtrusive-javascript","Synonyms":"","Count":340,"Excerpt":"Unobtrusive JavaScript is a general approach to the use of JavaScript in web pages."}]
子>
你可以从那里得到什么:
javascript
答案 1 :(得分:1)
如果您正在寻找高级逻辑,简而言之,它只是一个快速的自定义自动完成。
每当您键入一个标记(即一个新单词或一个与前一个标记的空格分隔的单词)时,将向服务器发出一个AJAX请求,该JSON对象随后由客户端脚本解释并显示在可用的布局。
比较letter "h"和word "html"的自动完成JSON对象应该可以让您充分了解此特定实现的工作原理(如果出现提示,可以使用任何文本编辑器打开这些对象)。
有点不相关的说明:自动填充响应必须快。根据运行自动填充的数据的复杂程度,您可能会发现how IMDb magic search works有趣。
看到您关于访问标记库的内容的评论,这实际上可能更像是一个元问题。我很难想到使用API的场景,如果有的话,或者只是来自外部资源的标签库对SO有益 - 但是这里的内容是在Creative Commons下提供的,所以你可以能够使用它有适当的归属。这不构成法律意见:)