X-Git-Url: https://git.r.bdr.sh/rbdr/r.bdr.sh/blobdiff_plain/78bae1f1f9a369c6b0c2ba934063d70866c79b74..429a1eb91c032790affd71b85ca670fa280ad17c:/jekyll/js/unlimited_pizza.js?ds=inline diff --git a/jekyll/js/unlimited_pizza.js b/jekyll/js/unlimited_pizza.js index af650ee..7517f64 100644 --- a/jekyll/js/unlimited_pizza.js +++ b/jekyll/js/unlimited_pizza.js @@ -1,20 +1,29 @@ '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) @@ -28,21 +37,11 @@ Class("UnlimitedPizza").inherits(Widget)({ 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(); @@ -51,30 +50,6 @@ Class("UnlimitedPizza").inherits(Widget)({ 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) {