Ignore vim swap files.
[mkws-moved-to-github.git] / src / mkws-widget-record.js
index 3d15fbc..13d67c3 100644 (file)
@@ -1,4 +1,32 @@
+// A widget for one record
 mkws.registerWidgetType('Record', function() {
-    mkws.promotionFunction('Records').call(this);
-    this.config.perpage = 1;
+  if (!this.config.maxrecs) this.config.maxrecs = 1;
+  var that = this;
+  var team = this.team;
+  team.queue("records").subscribe(function(data) {
+    var template = team.loadTemplate(that.config.template || "Record");
+    var targs = $.extend({}, data.hits[0], that.config.template_vars);
+    that.node.html(template(targs));
+  });
+  that.autosearch();
+});
+
+mkws.registerWidgetType('Image', function() {
+  mkws.promotionFunction('Records').call(this);
+  if (!this.config.template) this.config.template = 'Image';
+});
+
+mkws.registerWidgetType('GoogleImage', function() {
+  mkws.promotionFunction('Image').call(this);
+  if (!this.config.target) this.config.target = 'Google_Images';
+});
+
+mkws.registerWidgetType('Lolcat', function() {
+  mkws.promotionFunction('GoogleImage').call(this);
+  if (!this.config.autosearch) this.config.autosearch = 'kitteh';
+});
+
+mkws.registerWidgetType('Coverart', function() {
+  mkws.promotionFunction('Image').call(this);
+  if (!this.config.target) this.config.target = 'AmazonBooks';
 });