'use strict';
-Class("UnlimitedPizza").inherits(Widget)({
+const UnlimitedPizza = {
- /**
- * Gets instance, creates it if not available.
- */
- instance : function getInstance(config) {
- if (!this._mainInstance) {
- this._mainInstance = new this(config);
- }
- return this._mainInstance;
+ _loadPepperoni() {
+
+ const pepperoniElement = document.querySelector('[data-application="pepperoni"]');
+
+ new Pepperoni({
+ element: pepperoniElement
+ });
+ },
+
+ _loadGuestbook() {
+
},
- prototype : {
+ _loadGuestbookEntries() {
+
+ }
+};
+
+window.addEventListener('load', UnlimitedPizza._onLoad.bind(UnlimitedPizza));
+
+Class("UnlimitedPizza").inherits(Widget)({
_fb : null,
- _loaded : false,
init : function (config) {
Widget.prototype.init.call(this, config)
this.bind('activate', this._onActivate.bind(this));
},
- _onActivate : function _activate() {
- // If this is the first time activating it... then load
- if (!this._loaded) {
- this._load();
- }
- },
-
/*
* Loads everything.
*/
_load : function _load() {
- // Melty cheese is our header image widget.
- this._loadMeltyCheese();
-
// Pepperoni is our recording widget.
this._loadPepperoni();
this._loadPosts();
},
- _loadMeltyCheese : function () {
- this.element.find('.post-image').each(function (i, headerElement) {
-
- // Create and activate
- this.appendChild(new UnlimitedPizza.MeltyCheese({
- element : $(headerElement),
- name : 'header-' + i
- }));
- this['header-' + i].activate();
- }.bind(this));
- },
-
- _loadPepperoni : function () {
- this.element.find('.pepperoni-widget').each(function (i, widgetElement) {
-
- // Create and activate
- this.appendChild(new UnlimitedPizza.Pepperoni({
- element : $(widgetElement),
- name : 'recorder-' + i
- }));
- this['recorder-' + i].activate();
- }.bind(this));
- },
-
_loadGuestbook : function () {
var form = this.element.find('.guestbook-form form');
form.on('submit', function submitPost(ev) {