diff --git wp-includes/js/media-models.js wp-includes/js/media-models.js
index 34cce0b..f42a78d 100644
|
|
window.wp = window.wp || {}; |
69 | 69 | |
70 | 70 | _.extend( media, { |
71 | 71 | /** |
72 | | * media.template( id ) |
73 | | * |
74 | | * Fetches a template by id. |
75 | | * |
76 | | * @param {string} id A string that corresponds to a DOM element with an id prefixed with "tmpl-". |
77 | | * For example, "attachment" maps to "tmpl-attachment". |
78 | | * @return {function} A function that lazily-compiles the template requested. |
79 | | */ |
80 | | template: _.memoize( function( id ) { |
81 | | var compiled, |
82 | | options = { |
83 | | evaluate: /<#([\s\S]+?)#>/g, |
84 | | interpolate: /\{\{\{([\s\S]+?)\}\}\}/g, |
85 | | escape: /\{\{([^\}]+?)\}\}(?!\})/g, |
86 | | variable: 'data' |
87 | | }; |
88 | | |
89 | | return function( data ) { |
90 | | compiled = compiled || _.template( $( '#tmpl-' + id ).html(), null, options ); |
91 | | return compiled( data ); |
92 | | }; |
93 | | }), |
94 | | |
95 | | /** |
96 | 72 | * media.post( [action], [data] ) |
97 | 73 | * |
98 | 74 | * Sends a POST request to WordPress. |
diff --git wp-includes/js/media-views.js wp-includes/js/media-views.js
index 1434aeb..8a4fdba 100644
|
|
|
1296 | 1296 | */ |
1297 | 1297 | media.view.MediaFrame = media.view.Frame.extend({ |
1298 | 1298 | className: 'media-frame', |
1299 | | template: media.template('media-frame'), |
| 1299 | template: wp.template('media-frame'), |
1300 | 1300 | regions: ['menu','title','content','toolbar','router'], |
1301 | 1301 | |
1302 | 1302 | initialize: function() { |
… |
… |
|
1898 | 1898 | */ |
1899 | 1899 | media.view.Modal = media.View.extend({ |
1900 | 1900 | tagName: 'div', |
1901 | | template: media.template('media-modal'), |
| 1901 | template: wp.template('media-modal'), |
1902 | 1902 | |
1903 | 1903 | attributes: { |
1904 | 1904 | tabindex: 0 |
… |
… |
|
2082 | 2082 | media.view.UploaderWindow = media.View.extend({ |
2083 | 2083 | tagName: 'div', |
2084 | 2084 | className: 'uploader-window', |
2085 | | template: media.template('uploader-window'), |
| 2085 | template: wp.template('uploader-window'), |
2086 | 2086 | |
2087 | 2087 | initialize: function() { |
2088 | 2088 | var uploader; |
… |
… |
|
2150 | 2150 | media.view.UploaderInline = media.View.extend({ |
2151 | 2151 | tagName: 'div', |
2152 | 2152 | className: 'uploader-inline', |
2153 | | template: media.template('uploader-inline'), |
| 2153 | template: wp.template('uploader-inline'), |
2154 | 2154 | |
2155 | 2155 | initialize: function() { |
2156 | 2156 | _.defaults( this.options, { |
… |
… |
|
2222 | 2222 | */ |
2223 | 2223 | media.view.UploaderStatus = media.View.extend({ |
2224 | 2224 | className: 'media-uploader-status', |
2225 | | template: media.template('uploader-status'), |
| 2225 | template: wp.template('uploader-status'), |
2226 | 2226 | |
2227 | 2227 | events: { |
2228 | 2228 | 'click .upload-dismiss-errors': 'dismiss' |
… |
… |
|
2325 | 2325 | |
2326 | 2326 | media.view.UploaderStatusError = media.View.extend({ |
2327 | 2327 | className: 'upload-error', |
2328 | | template: media.template('uploader-status-error') |
| 2328 | template: wp.template('uploader-status-error') |
2329 | 2329 | }); |
2330 | 2330 | |
2331 | 2331 | /** |
… |
… |
|
2828 | 2828 | media.view.Attachment = media.View.extend({ |
2829 | 2829 | tagName: 'li', |
2830 | 2830 | className: 'attachment', |
2831 | | template: media.template('attachment'), |
| 2831 | template: wp.template('attachment'), |
2832 | 2832 | |
2833 | 2833 | events: { |
2834 | 2834 | 'click .attachment-preview': 'toggleSelectionHandler', |
… |
… |
|
3213 | 3213 | tagName: 'ul', |
3214 | 3214 | className: 'attachments', |
3215 | 3215 | |
3216 | | cssTemplate: media.template('attachments-css'), |
| 3216 | cssTemplate: wp.template('attachments-css'), |
3217 | 3217 | |
3218 | 3218 | events: { |
3219 | 3219 | 'scroll': 'scroll' |
… |
… |
|
3769 | 3769 | media.view.Selection = media.View.extend({ |
3770 | 3770 | tagName: 'div', |
3771 | 3771 | className: 'media-selection', |
3772 | | template: media.template('media-selection'), |
| 3772 | template: wp.template('media-selection'), |
3773 | 3773 | |
3774 | 3774 | events: { |
3775 | 3775 | 'click .edit-selection': 'edit', |
… |
… |
|
3974 | 3974 | */ |
3975 | 3975 | media.view.Settings.AttachmentDisplay = media.view.Settings.extend({ |
3976 | 3976 | className: 'attachment-display-settings', |
3977 | | template: media.template('attachment-display-settings'), |
| 3977 | template: wp.template('attachment-display-settings'), |
3978 | 3978 | |
3979 | 3979 | initialize: function() { |
3980 | 3980 | var attachment = this.options.attachment; |
… |
… |
|
4047 | 4047 | */ |
4048 | 4048 | media.view.Settings.Gallery = media.view.Settings.extend({ |
4049 | 4049 | className: 'gallery-settings', |
4050 | | template: media.template('gallery-settings') |
| 4050 | template: wp.template('gallery-settings') |
4051 | 4051 | }); |
4052 | 4052 | |
4053 | 4053 | /** |
… |
… |
|
4056 | 4056 | media.view.Attachment.Details = media.view.Attachment.extend({ |
4057 | 4057 | tagName: 'div', |
4058 | 4058 | className: 'attachment-details', |
4059 | | template: media.template('attachment-details'), |
| 4059 | template: wp.template('attachment-details'), |
4060 | 4060 | |
4061 | 4061 | events: { |
4062 | 4062 | 'change [data-setting]': 'updateSetting', |
… |
… |
|
4283 | 4283 | */ |
4284 | 4284 | media.view.EmbedLink = media.view.Settings.extend({ |
4285 | 4285 | className: 'embed-link-settings', |
4286 | | template: media.template('embed-link-settings') |
| 4286 | template: wp.template('embed-link-settings') |
4287 | 4287 | }); |
4288 | 4288 | |
4289 | 4289 | /** |
… |
… |
|
4291 | 4291 | */ |
4292 | 4292 | media.view.EmbedImage = media.view.Settings.AttachmentDisplay.extend({ |
4293 | 4293 | className: 'embed-image-settings', |
4294 | | template: media.template('embed-image-settings'), |
| 4294 | template: wp.template('embed-image-settings'), |
4295 | 4295 | |
4296 | 4296 | initialize: function() { |
4297 | 4297 | media.view.Settings.AttachmentDisplay.prototype.initialize.apply( this, arguments ); |
diff --git wp-includes/script-loader.php wp-includes/script-loader.php
index cfb865e..f208c09 100644
|
|
function wp_default_scripts( &$scripts ) { |
270 | 270 | $scripts->add( 'json2', "/wp-includes/js/json2$suffix.js", array(), '2011-02-23'); |
271 | 271 | |
272 | 272 | $scripts->add( 'underscore', '/wp-includes/js/underscore.min.js', array(), '1.4.4', 1 ); |
273 | | $scripts->add( 'backbone', '/wp-includes/js/backbone.min.js', array('underscore','jquery'), '0.9.2', 1 ); |
| 273 | $scripts->add( 'template', "/wp-includes/js/template$suffix.js", array('underscore'), '1.0', 1 ); |
| 274 | $scripts->add( 'backbone', '/wp-includes/js/backbone.min.js', array('underscore','jquery', 'template'), '0.9.2', 1 ); |
274 | 275 | |
275 | 276 | $scripts->add( 'imgareaselect', "/wp-includes/js/imgareaselect/jquery.imgareaselect$suffix.js", array('jquery'), '0.9.8', 1 ); |
276 | 277 | |