X-Git-Url: http://git.indexdata.com/?p=mkws-moved-to-github.git;a=blobdiff_plain;f=examples%2Fhtdocs%2Fmkws-widget-credo.js;h=e66559e0c6d04413bc34be8cc4a0fec914c72c94;hp=c0e6a7813d9f55551d14aab8ea294eba130537be;hb=8617bd1f65ea0576e2384cf7dc7fff483344fcc7;hpb=e1fb83ba0e792063cd05ae33f8d579a5ffe735a7 diff --git a/examples/htdocs/mkws-widget-credo.js b/examples/htdocs/mkws-widget-credo.js index c0e6a78..e66559e 100644 --- a/examples/htdocs/mkws-widget-credo.js +++ b/examples/htdocs/mkws-widget-credo.js @@ -1,3 +1,14 @@ +// The Google Images database returns links like: +// http://images.google.com/url?q=http://eofdreams.com/fish.html&sa=U&ei=RAB-U9XNDo2Dqga1o4L4Bw&ved=0CC4Q9QEwAA&usg=AFQjCNFhRtn6GMevHbpITZ6kfx6rsHV2ow +// This Handlebars helper avoids a pointless redirect by transforming +// this to the URL of the underling page, in this case +// http://eofdreams.com/fish.html +// +Handlebars.registerHelper('mkws-googleurl', function(obj) { + return mkws.getParameterByName('q', obj[0]); +}); + + // ### This works inefficiently by having multiple teams all run the // same search against different sets of targets. A much better // approach would be run a single search, with all these panels @@ -9,7 +20,7 @@ mkws.registerWidgetType('Credo', function() { this.team.registerTemplate('CredoImage', '\
\ - \ + \ {{#mkws-first md-thumburl}}\ {{../md-title}}\ {{/mkws-first}}\