PageRenderTime 24ms CodeModel.GetById 12ms RepoModel.GetById 1ms app.codeStats 0ms

/share/spice/word_map/word_map.js

https://gitlab.com/phora/zeroclickinfo-spice
JavaScript | 32 lines | 30 code | 2 blank | 0 comment | 2 complexity | 8993f0dd9145d9766d8219232f08adfd MD5 | raw file
  1. (function(env){
  2. env.ddg_spice_word_map = function(api_result) {
  3. "use strict";
  4. if ( (!api_result) || ("200" !== api_result.result_code)) {
  5. return Spice.failed('word_map');
  6. }
  7. Spice.add({
  8. id: 'word_map',
  9. name: 'Answer',
  10. data: api_result,
  11. meta: {
  12. sourceUrl: 'https://www.twinword.com/?moreLink=' + encodeURIComponent(api_result.encrypt_entry),
  13. sourceName: 'Twinword',
  14. sourceIconUrl: 'http://icons.duckduckgo.com/ip/www.twinword.com.ico'
  15. },
  16. normalize: function(item) {
  17. return {
  18. title: "Related to " + api_result.entry
  19. };
  20. },
  21. templates: {
  22. group: 'text',
  23. options: {
  24. content: Spice.word_map.content,
  25. moreAt: true
  26. }
  27. }
  28. });
  29. }
  30. }(this));