zsxsoft.html 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset=utf-8 />
  5. <title>Test DUOSHUO</title>
  6. <script src="http://zsxsoft.github.io/useragent.js/javascripts/useragent.min.js"></script>
  7. <!-- 关于以上组件,即useragent.js,见http://zsxsoft.github.io/useragent.js/ -->
  8. <!-- 然后设置duoshuoQuery和加载多说,并设置自定义的getUAString -->
  9. <script>
  10. var duoshuoQuery = {
  11. short_name: 'official',
  12. myIds: [1234567],
  13. getUAString: function(local) {
  14. var userAgent = USERAGENT.analyze(local.agent);
  15. return [
  16. '<div class="ds-os">',
  17. '<img src="http://zsxsoft.github.io/useragent.js/img/16/' + userAgent.platform.dir + '/' + userAgent.platform.image + '.png" alt="' + userAgent.platform.name + '" />',
  18. userAgent.platform.full,
  19. '</div>' +
  20. '<div class="ds-br">',
  21. '<img src="http://zsxsoft.github.io/useragent.js/img/16/browser/' + userAgent.browser.image + '.png" alt="' + userAgent.browser.name + '" />',
  22. userAgent.browser.full,
  23. '</div>',
  24. (local.webmaster ? '<div class="ds-webmaster">站长</div>' : '')
  25. ].join("");
  26. },
  27. };
  28. </script>
  29. <!-- 选用不集成ua-parser的版本 -->
  30. <script src="../dist/duoshuo-ua-core.min.js"></script>
  31. <!-- 自定义样式 -->
  32. <style>
  33. #ds-reset .ds-os,
  34. #ds-reset .ds-br,
  35. #ds-reset .ds-webmaster {
  36. display: inline-block;
  37. border-radius: .3em;
  38. margin-left: .5em;
  39. padding: .3em;
  40. border: 1px solid gray;
  41. }
  42. </style>
  43. <script src="http://static.duoshuo.com/embed.js"></script>
  44. </head>
  45. <body>
  46. <div class="ds-thread" data-thread-key="5174f0a16a04594d4800590e"></div>
  47. </body>
  48. </html>