You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

43 lines
1000 B

(function() {
'use strict';
Darkroom.Plugin = Plugin;
// Define a plugin object. This is the (abstract) parent class which
// has to be extended for each plugin.
function Plugin(darkroom, options) {
this.darkroom = darkroom;
this.options = Darkroom.Utils.extend(options, this.defaults);
this.initialize();
}
Plugin.prototype = {
defaults: {},
initialize: function() { }
}
// Inspired by Backbone.js extend capability.
Plugin.extend = function(protoProps) {
var parent = this;
var child;
if (protoProps && protoProps.hasOwnProperty('constructor')) {
child = protoProps.constructor;
} else {
child = function(){ return parent.apply(this, arguments); };
}
Darkroom.Utils.extend(child, parent);
var Surrogate = function(){ this.constructor = child; };
Surrogate.prototype = parent.prototype;
child.prototype = new Surrogate;
if (protoProps) Darkroom.Utils.extend(child.prototype, protoProps);
child.__super__ = parent.prototype;
return child;
}
})();