/* How to use the modal wp_optimize.modal.open({ className: 'a-class', // A class name, added to the main modal container events: {}, // An object containing the events added to the modal. See Backbonejs View events syntax. content: function() { return ''; // the Content method returns html or jQuery objects which will be added to the content area of the modal }, ... // Other methods used by the custom events }) */ var wp_optimize = window.wp_optimize || {}; (function($, wp) { 'use strict'; var modal = {}; modal.views = {}; /** * Main modal View */ modal.views.modal = Backbone.View.extend({ tagName: 'div', template: wp.template('wpo-modal'), /** * Extend default values */ preinitialize: function() { this.events = _.extend(this.events || {}, { 'click .wpo-modal--close': 'close' }); this.className = this.className ? 'wpo-modal--container ' + this.className : 'wpo-modal--container '; }, render: function() { this.$el.append(this.template()); this.trigger('rendered'); }, initialize: function() { this.trigger('initialize'); this.render(); this.$content = this.$el.find('.wpo-modal--content'); // Append the content area with the content provided by the child object if ('function' === typeof this.content) { this.$content.append(this.content()); } }, close: function() { $('body').removeClass('wpo-modal-is-opened'); this.remove(); } }); /** * Public method to create and open the modal */ modal.open = function(options) { var view_options = _.extend(options || {}, {}); var modalView = modal.views.modal.extend(view_options); var m = new modalView(); m.$el.appendTo('body'); m.$('.wpo-modal').focus(); $('body').addClass('wpo-modal-is-opened'); return m; } wp_optimize.modal = modal; })(jQuery, window.wp);
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
handlebars | Folder | 0755 |
|
|
jszip | Folder | 0755 |
|
|
serialize-json | Folder | 0755 |
|
|
tablesorter | Folder | 0755 |
|
|
blockUI-3-8-0.min.js | File | 627 B | 0644 |
|
blockUI.js | File | 1.22 KB | 0644 |
|
cache-3-8-0.min.js | File | 7.82 KB | 0644 |
|
cache.js | File | 14.95 KB | 0644 |
|
heartbeat-3-8-0.min.js | File | 2.78 KB | 0644 |
|
heartbeat.js | File | 7.52 KB | 0644 |
|
loadAsync-3-8-0.min.js | File | 304 B | 0644 |
|
loadAsync.js | File | 670 B | 0644 |
|
loadCSS-3-8-0.min.js | File | 818 B | 0644 |
|
loadCSS.js | File | 3.05 KB | 0644 |
|
minify-3-8-0.min.js | File | 11.89 KB | 0644 |
|
minify.js | File | 20.75 KB | 0644 |
|
modal-3-8-0.min.js | File | 922 B | 0644 |
|
modal.js | File | 1.79 KB | 0644 |
|
queue-3-8-0.min.js | File | 617 B | 0644 |
|
queue.js | File | 3.32 KB | 0644 |
|
send-command-3-8-0.min.js | File | 2.58 KB | 0644 |
|
send-command.js | File | 5.88 KB | 0644 |
|
status-3-8-0.min.js | File | 3.52 KB | 0644 |
|
status.js | File | 6.81 KB | 0644 |
|
wpo-images-view-3-8-0.min.js | File | 7.33 KB | 0644 |
|
wpo-images-view.js | File | 15.58 KB | 0644 |
|
wpoadmin-3-8-0.min.js | File | 37.16 KB | 0644 |
|
wpoadmin.js | File | 76.3 KB | 0644 |
|
wposmush-3-8-0.min.js | File | 23.08 KB | 0644 |
|
wposmush.js | File | 45.44 KB | 0644 |
|