Revert "Towards MKWS-294 (Change names of MKWS classes to be case-insensitive)"
[mkws-moved-to-github.git] / src / mkws-widget-record.js
1 // A widget for one 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 || "Record");
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('Image', function() {
15   mkws.promotionFunction('Records').call(this);
16   if (!this.config.template) this.config.template = 'Image';
17 });
18
19 mkws.registerWidgetType('GoogleImage', function() {
20   mkws.promotionFunction('Image').call(this);
21   if (!this.config.target) this.config.target = 'Google_Images';
22 });
23
24 mkws.registerWidgetType('Lolcat', function() {
25   mkws.promotionFunction('GoogleImage').call(this);
26   if (!this.config.autosearch) this.config.autosearch = 'kitteh';
27 });
28
29 mkws.registerWidgetType('Coverart', function() {
30   mkws.promotionFunction('Image').call(this);
31   if (!this.config.target) this.config.target = 'AmazonBooks';
32 });