PluginProbe
MaxButtons – Create buttons / 6.23
MaxButtons – Create buttons v6.23
6.23 6.24 6.25 6.26 6.26.1 6.27 6.28 6.3 6.4 6.5 6.6 6.7 6.8 6.9 7.0 7.1 7.1.1 7.1.2 7.1.3 7.10 7.11 7.13 7.13.1 7.13.2 7.13.3 All 100 releases
maxbuttons / assets / integrations / shortcake / edit-attribute-field-maxbutton.js

edit-attribute-field-maxbutton.js in MaxButtons – Create buttons 6.23, at assets/integrations/shortcake/edit-attribute-field-maxbutton.js

65 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 ( function( $ ) {
2
3
4 var sui = window.Shortcode_UI;
5 //var construct = sui.utils.shortcodeViewConstructor;
6
7 sui.views.editAttributeFieldMaxButton = sui.views.editAttributeField.extend( {
8
9 updateButton: function(id)
10 {
11 this.setValue(id);
12 var preview = this.$el.find('.button_preview');
13
14 var query = [{
15 counter: 1,
16 nonce: shortcodeUIData.nonces.preview,
17 post_id: $( '#post_ID' ).val(),
18 shortcode: this.shortcode.formatShortcode(),
19 }];
20
21 // provisional
22 wp.ajax.post( 'bulk_do_shortcode', {
23 queries: query,
24 }).done( function( response ) {
25 var button = response[1].response;
26 preview.html(button);
27 })
28
29 },
30
31 render: function ()
32 {
33 var self = this;
34 var maxMedia = window.maxMedia;
35
36 var data = jQuery.extend( {
37 id: 'shortcode-ui-' + this.model.get( 'attr' ) + '-' + this.model.cid,
38 }, this.model.toJSON() );
39
40 maxMedia.setCallback( $.proxy(this.updateButton, this) );
41
42 this.$el.html( this.template( data ) );
43 this.triggerCallbacks();
44
45 $(document).on('mb_media_buttons_open', function ()
46 {
47 $('.media-modal, .media-modal-backdrop').hide();
48
49 });
50
51 $(document).on('modal_close', function ()
52 {
53 $('.media-modal, .media-modal-backdrop').show();
54 });
55
56 this.updateButton( this.model.get( 'value' ) );
57
58 return this;
59 }
60
61 }); // extend
62
63 } )( jQuery );
64
65