For now, use jsnlog-DEV.js
[mkws-moved-to-github.git] / src / mkws-widget-record.js
1 // A widget for a record-list of a single record
2 mkws.registerWidgetType('record', function() {
3   if (!this.config.maxrecs) this.config.maxrecs = 1;
4   var that = this;
5   var team = this.team;
6   team.queue("records").subscribe(function(data) {
7     var template = team.loadTemplate(that.config.template || "details");
8     var targs = mkws.$.extend({}, data.hits[0], that.config.template_vars);
9     that.node.html(template(targs));
10   });
11   that.autosearch();
12 });
13
14 mkws.registerWidgetType('images', function() {
15   mkws.promotionFunction('records').call(this);
16   if (!this.config.template) this.config.template = 'images';
17 });
18
19 mkws.registerWidgetType('google-image', function() {
20   mkws.promotionFunction('images').call(this);
21   if (!this.config.target) this.config.target = 'Google_Images';
22 });
23
24 mkws.registerWidgetType('lolcat', function() {
25   mkws.promotionFunction('google-image').call(this);
26   if (!this.config.autosearch) this.config.autosearch = 'kitteh';
27 });
28
29 mkws.registerWidgetType('cover-art', function() {
30   mkws.promotionFunction('images').call(this);
31   if (!this.config.target) this.config.target = 'AmazonBooks';
32 });