diff --git a/js/build/field-attachment.js b/js/build/field-attachment.js deleted file mode 100644 index 87ac2206..00000000 --- a/js/build/field-attachment.js +++ /dev/null @@ -1,438 +0,0 @@ -(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o'); - - if ( 'image' !== attachment.type ) { - - $( '', { - src: attachment.icon, - alt: attachment.title, - } ).appendTo( $thumbnail ); - - $( '
', { - class: 'filename', - html: '
' + attachment.title + '
', - } ).appendTo( $thumbnail ); - - } else { - - $( '', { - src: attachment.sizes.thumbnail.url, - width: attachment.sizes.thumbnail.width, - height: attachment.sizes.thumbnail.height, - alt: attachment.alt, - } ) .appendTo( $thumbnail ) - - } - - $thumbnail.find( 'img' ).wrap( '
' ); - $container.append( $thumbnail ); - $container.toggleClass( 'has-attachment', true ); - - } - - /** - * Remove the attachment. - * Render preview & Update the model. - */ - var removeAttachment = function() { - - model.set( 'value', null ); - - $container.toggleClass( 'has-attachment', false ); - $container.toggleClass( 'has-attachment', false ); - $container.find( '.thumbnail' ).remove(); - } - - // Add initial Attachment if available. - updateAttachment( model.get( 'value' ) ); - - // Remove file when the button is clicked. - $removeButton.click( function(e) { - e.preventDefault(); - removeAttachment(); - }); - - // Open media frame when add button is clicked - $addButton.click( function(e) { - e.preventDefault(); - frame.open(); - } ); - - // Update the attachment when an item is selected. - frame.on( 'select', function() { - - var selection = frame.state().get('selection'); - attachment = selection.first(); - - updateAttachment( attachment.id ); - - frame.close(); - - }); - - } - -} ); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./utils/sui.js":7,"./views/edit-attribute-field.js":8}],4:[function(require,module,exports){ -(function (global){ -var Backbone = (typeof window !== "undefined" ? window.Backbone : typeof global !== "undefined" ? global.Backbone : null); - -/** - * Shortcode Attribute Model. - */ -var InnerContent = Backbone.Model.extend({ - defaults : { - label: shortcodeUIData.strings.insert_content_label, - type: 'textarea', - value: '', - placeholder: '', - }, -}); - -module.exports = InnerContent; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],5:[function(require,module,exports){ -(function (global){ -var Backbone = (typeof window !== "undefined" ? window.Backbone : typeof global !== "undefined" ? global.Backbone : null); - -var ShortcodeAttribute = Backbone.Model.extend({ - defaults: { - attr: '', - label: '', - type: '', - value: '', - description: '', - escape: false, - meta: { - placeholder: '', - } - }, -}); - -module.exports = ShortcodeAttribute; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],6:[function(require,module,exports){ -(function (global){ -var Backbone = (typeof window !== "undefined" ? window.Backbone : typeof global !== "undefined" ? global.Backbone : null); -var ShortcodeAttributes = require('./../collections/shortcode-attributes.js'); -var InnerContent = require('./inner-content.js'); - -Shortcode = Backbone.Model.extend({ - - defaults: { - label: '', - shortcode_tag: '', - attrs: new ShortcodeAttributes, - }, - - /** - * Custom set method. - * Handles setting the attribute collection. - */ - set: function( attributes, options ) { - - if ( attributes.attrs !== undefined && ! ( attributes.attrs instanceof ShortcodeAttributes ) ) { - attributes.attrs = new ShortcodeAttributes( attributes.attrs ); - } - - if ( attributes.inner_content && ! ( attributes.inner_content instanceof InnerContent ) ) { - attributes.inner_content = new InnerContent( attributes.inner_content ); - } - - return Backbone.Model.prototype.set.call(this, attributes, options); - }, - - /** - * Custom toJSON. - * Handles converting the attribute collection to JSON. - */ - toJSON: function( options ) { - options = Backbone.Model.prototype.toJSON.call(this, options); - if ( options.attrs && ( options.attrs instanceof ShortcodeAttributes ) ) { - options.attrs = options.attrs.toJSON(); - } - if ( options.inner_content && ( options.inner_content instanceof InnerContent ) ) { - options.inner_content = options.inner_content.toJSON(); - } - return options; - }, - - /** - * Custom clone - * Make sure we don't clone a reference to attributes. - */ - clone: function() { - var clone = Backbone.Model.prototype.clone.call( this ); - clone.set( 'attrs', clone.get( 'attrs' ).clone() ); - if ( clone.get( 'inner_content' ) ) { - clone.set( 'inner_content', clone.get( 'inner_content' ).clone() ); - } - return clone; - }, - - /** - * Get the shortcode as... a shortcode! - * - * @return string eg [shortcode attr1=value] - */ - formatShortcode: function() { - - var template, shortcodeAttributes, attrs = [], content, self = this; - - this.get( 'attrs' ).each( function( attr ) { - - // Skip empty attributes. - if ( ! attr.get( 'value' ) || attr.get( 'value' ).length < 1 ) { - return; - } - - var type = attr.get( 'type' ); - - // Encode textareas incase HTML - if ( shortcodeUIFieldData[ type ] && shortcodeUIFieldData[ type ].escape ) { - attr.set( 'value', encodeURIComponent( decodeURIComponent( attr.get( 'value' ) ) ) ); - } - - attrs.push( attr.get( 'attr' ) + '="' + attr.get( 'value' ) + '"' ); - - } ); - - if ( this.get( 'inner_content' ) ) { - content = this.get( 'inner_content' ).get( 'value' ); - } - - template = "[{{ shortcode }} {{ attributes }}]" - - if ( content && content.length > 0 ) { - template += "{{ content }}[/{{ shortcode }}]" - } - - template = template.replace( /{{ shortcode }}/g, this.get('shortcode_tag') ); - template = template.replace( /{{ attributes }}/g, attrs.join( ' ' ) ); - template = template.replace( /{{ content }}/g, content ); - - return template; - - } - -}); - -module.exports = Shortcode; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./../collections/shortcode-attributes.js":1,"./inner-content.js":4}],7:[function(require,module,exports){ -var Shortcodes = require('./../collections/shortcodes.js'); - -window.Shortcode_UI = window.Shortcode_UI || { - shortcodes: new Shortcodes, - views: {}, - controllers: {}, -}; - -module.exports = window.Shortcode_UI; - -},{"./../collections/shortcodes.js":2}],8:[function(require,module,exports){ -(function (global){ -var Backbone = (typeof window !== "undefined" ? window.Backbone : typeof global !== "undefined" ? global.Backbone : null), -sui = require('./../utils/sui.js'), -$ = (typeof window !== "undefined" ? window.jQuery : typeof global !== "undefined" ? global.jQuery : null); - -var editAttributeField = Backbone.View.extend( { - - tagName: "div", - - events: { - 'keyup input[type="text"]': 'updateValue', - 'keyup textarea': 'updateValue', - 'change select': 'updateValue', - 'change input[type=checkbox]': 'updateValue', - 'change input[type=radio]': 'updateValue', - 'change input[type=email]': 'updateValue', - 'change input[type=number]': 'updateValue', - 'change input[type=date]': 'updateValue', - 'change input[type=url]': 'updateValue', - }, - - render: function() { - - var data = jQuery.extend( { - id: 'shortcode-ui-' + this.model.get( 'attr' ) + '-' + this.model.cid, - }, this.model.toJSON() ); - - // Handle legacy custom meta. - // Can be removed in 0.4. - if ( data.placeholder ) { - data.meta.placeholder = data.placeholder; - delete data.placeholder; - } - - // Convert meta JSON to attribute string. - var _meta = []; - for ( var key in data.meta ) { - - // Boolean attributes can only require attribute key, not value. - if ( 'boolean' === typeof( data.meta[ key ] ) ) { - - // Only set truthy boolean attributes. - if ( data.meta[ key ] ) { - _meta.push( _.escape( key ) ); - } - - } else { - - _meta.push( _.escape( key ) + '="' + _.escape( data.meta[ key ] ) + '"' ); - - } - - } - - data.meta = _meta.join( ' ' ); - - this.$el.html( this.template( data ) ); - - return this - }, - - /** - * Input Changed Update Callback. - * - * If the input field that has changed is for content or a valid attribute, - * then it should update the model. - */ - updateValue: function( e ) { - - if ( this.model.get( 'attr' ) ) { - var $el = $( this.el ).find( '[name=' + this.model.get( 'attr' ) + ']' ); - } else { - var $el = $( this.el ).find( '[name="inner_content"]' ); - } - - if ( 'radio' === this.model.attributes.type ) { - this.model.set( 'value', $el.filter(':checked').first().val() ); - } else if ( 'checkbox' === this.model.attributes.type ) { - this.model.set( 'value', $el.is( ':checked' ) ); - } else { - this.model.set( 'value', $el.val() ); - } - }, - -} ); - -sui.views.editAttributeField = editAttributeField; -module.exports = editAttributeField; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./../utils/sui.js":7}]},{},[3]); diff --git a/js/build/field-color.js b/js/build/field-color.js deleted file mode 100644 index ba92bf0e..00000000 --- a/js/build/field-color.js +++ /dev/null @@ -1,309 +0,0 @@ -(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 0 ) { - template += "{{ content }}[/{{ shortcode }}]" - } - - template = template.replace( /{{ shortcode }}/g, this.get('shortcode_tag') ); - template = template.replace( /{{ attributes }}/g, attrs.join( ' ' ) ); - template = template.replace( /{{ content }}/g, content ); - - return template; - - } - -}); - -module.exports = Shortcode; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./../collections/shortcode-attributes.js":1,"./inner-content.js":4}],7:[function(require,module,exports){ -var Shortcodes = require('./../collections/shortcodes.js'); - -window.Shortcode_UI = window.Shortcode_UI || { - shortcodes: new Shortcodes, - views: {}, - controllers: {}, -}; - -module.exports = window.Shortcode_UI; - -},{"./../collections/shortcodes.js":2}],8:[function(require,module,exports){ -(function (global){ -var Backbone = (typeof window !== "undefined" ? window.Backbone : typeof global !== "undefined" ? global.Backbone : null), -sui = require('./../utils/sui.js'), -$ = (typeof window !== "undefined" ? window.jQuery : typeof global !== "undefined" ? global.jQuery : null); - -var editAttributeField = Backbone.View.extend( { - - tagName: "div", - - events: { - 'keyup input[type="text"]': 'updateValue', - 'keyup textarea': 'updateValue', - 'change select': 'updateValue', - 'change input[type=checkbox]': 'updateValue', - 'change input[type=radio]': 'updateValue', - 'change input[type=email]': 'updateValue', - 'change input[type=number]': 'updateValue', - 'change input[type=date]': 'updateValue', - 'change input[type=url]': 'updateValue', - }, - - render: function() { - - var data = jQuery.extend( { - id: 'shortcode-ui-' + this.model.get( 'attr' ) + '-' + this.model.cid, - }, this.model.toJSON() ); - - // Handle legacy custom meta. - // Can be removed in 0.4. - if ( data.placeholder ) { - data.meta.placeholder = data.placeholder; - delete data.placeholder; - } - - // Convert meta JSON to attribute string. - var _meta = []; - for ( var key in data.meta ) { - - // Boolean attributes can only require attribute key, not value. - if ( 'boolean' === typeof( data.meta[ key ] ) ) { - - // Only set truthy boolean attributes. - if ( data.meta[ key ] ) { - _meta.push( _.escape( key ) ); - } - - } else { - - _meta.push( _.escape( key ) + '="' + _.escape( data.meta[ key ] ) + '"' ); - - } - - } - - data.meta = _meta.join( ' ' ); - - this.$el.html( this.template( data ) ); - - return this - }, - - /** - * Input Changed Update Callback. - * - * If the input field that has changed is for content or a valid attribute, - * then it should update the model. - */ - updateValue: function( e ) { - - if ( this.model.get( 'attr' ) ) { - var $el = $( this.el ).find( '[name=' + this.model.get( 'attr' ) + ']' ); - } else { - var $el = $( this.el ).find( '[name="inner_content"]' ); - } - - if ( 'radio' === this.model.attributes.type ) { - this.model.set( 'value', $el.filter(':checked').first().val() ); - } else if ( 'checkbox' === this.model.attributes.type ) { - this.model.set( 'value', $el.is( ':checked' ) ); - } else { - this.model.set( 'value', $el.val() ); - } - }, - -} ); - -sui.views.editAttributeField = editAttributeField; -module.exports = editAttributeField; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./../utils/sui.js":7}]},{},[3]);