Changeset 5629
- Timestamp:
- 06/01/2007 11:52:27 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/upload.js
r4970 r5629 6 6 postID: 0, 7 7 8 toQueryParams: function(qryStrOrig) { 9 var params = new Object(); 10 var qryStr = qryStrOrig; 11 var i = 0; 12 do { 13 params[qryStr.split("=")[0].replace(/&/, "")] = ( qryStr.split("=")[1] ) ? qryStr.split("=")[1].split(/&|$/)[0] : ''; 14 qryStr = ( qryStr.split("=")[1] ) ? qryStr.split(qryStr.split("=")[1].split(/&|$/)[0])[1] : ''; 15 i++; 16 } 17 while(i < (qryStrOrig.split("=").length - 1)); 18 return params; 19 }, 20 21 toQueryString: function(params) { 22 var qryStr = ''; 23 for ( var key in params ) 24 qryStr += key + '=' + params[key] + '&'; 25 return qryStr; 26 }, 27 8 28 initializeVars: function() { 9 29 this.urlData = document.location.href.split('?'); 10 this.params = this. urlData[1].toQueryParams();30 this.params = this.toQueryParams(this.urlData[1]); 11 31 this.postID = this.params['post_id']; 12 32 this.tab = this.params['tab']; … … 15 35 if ( !this.style ) 16 36 this.style = 'default'; 17 var nonceEl = $('nonce-value');37 var nonceEl = jQuery('#nonce-value'); 18 38 if ( nonceEl ) 19 this.nonce = nonceEl.value;39 this.nonce = jQuery(nonceEl).val(); 20 40 if ( this.ID ) { 21 41 this.grabImageData( this.ID ); … … 27 47 if ( this.ID ) 28 48 return; 29 $$('a.file-link').each( function(i) { 30 var id = i.id.split('-').pop(); 31 i.onclick = function(e) { theFileList[ 'inline' == theFileList.style ? 'imageView' : 'editView' ](id, e); } 32 } ); 49 jQuery('a.file-link').each(function() { 50 var id = jQuery(this).attr('id').split('-').pop(); 51 jQuery(this).attr('href','javascript:void(0)').click(function(e) { 52 theFileList[ 'inline' == theFileList.style ? 'imageView' : 'editView' ](id, e); 53 }); 54 }); 33 55 }, 34 56 … … 36 58 if ( id == this.currentImage.ID ) 37 59 return; 38 var thumbEl = $('attachment-thumb-url-' + id);60 var thumbEl = jQuery('#attachment-thumb-url-' + id); 39 61 if ( thumbEl ) { 40 this.currentImage.thumb = ( 0 == id ? '' : thumbEl.value);41 this.currentImage.thumbBase = ( 0 == id ? '' : $('attachment-thumb-url-base-' + id).value);62 this.currentImage.thumb = ( 0 == id ? '' : jQuery(thumbEl).val() ); 63 this.currentImage.thumbBase = ( 0 == id ? '' : jQuery('#attachment-thumb-url-base-' + id).val() ); 42 64 } else { 43 65 this.currentImage.thumb = false; 44 66 } 45 this.currentImage.src = ( 0 == id ? '' : $('attachment-url-' + id).value);46 this.currentImage.srcBase = ( 0 == id ? '' : $('attachment-url-base-' + id).value);47 this.currentImage.page = ( 0 == id ? '' : $('attachment-page-url-' + id).value);48 this.currentImage.title = ( 0 == id ? '' : $('attachment-title-' + id).value);49 this.currentImage.description = ( 0 == id ? '' : $('attachment-description-' + id).value);50 var widthEl = $('attachment-width-' + id);67 this.currentImage.src = ( 0 == id ? '' : jQuery('#attachment-url-' + id).val() ); 68 this.currentImage.srcBase = ( 0 == id ? '' : jQuery('#attachment-url-base-' + id).val() ); 69 this.currentImage.page = ( 0 == id ? '' : jQuery('#attachment-page-url-' + id).val() ); 70 this.currentImage.title = ( 0 == id ? '' : jQuery('#attachment-title-' + id).val() ); 71 this.currentImage.description = ( 0 == id ? '' : jQuery('#attachment-description-' + id).val() ); 72 var widthEl = jQuery('#attachment-width-' + id); 51 73 if ( widthEl ) { 52 this.currentImage.width = ( 0 == id ? '' : widthEl.value);53 this.currentImage.height = ( 0 == id ? '' : $('attachment-height-' + id).value);74 this.currentImage.width = ( 0 == id ? '' : jQuery(widthEl).val() ); 75 this.currentImage.height = ( 0 == id ? '' : jQuery('#attachment-height-' + id).val() ); 54 76 } else { 55 77 this.currentImage.width = false; 56 78 this.currentImage.height = false; 57 79 } 58 this.currentImage.isImage = ( 0 == id ? 0 : $('attachment-is-image-' + id).value);80 this.currentImage.isImage = ( 0 == id ? 0 : jQuery('#attachment-is-image-' + id).val() ); 59 81 this.currentImage.ID = id; 60 82 }, … … 66 88 h += "<div id='upload-file'>" 67 89 if ( this.ID ) { 68 var params = $H(this.params);90 var params = this.params; 69 91 params.ID = ''; 70 92 params.action = ''; 71 h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "'";93 h += "<a href='" + this.urlData[0] + '?' + this.toQueryString(params) + "'"; 72 94 } else { 73 95 h += "<a href='#' onclick='return theFileList.cancelView();'"; … … 109 131 display.push("<br /><label for='display-title'><input type='radio' name='display' id='display-title' value='title' /> " + this.title + "</label>"); 110 132 h += "<tr><th style='padding-bottom:.5em'>" + this.show + "</th><td style='padding-bottom:.5em'>"; 111 $A(display).each( function(i) { h += i; } );133 jQuery(display).each( function() { h += this; } ); 112 134 h += "</td></tr>"; 113 135 } … … 126 148 h += "</div>"; 127 149 128 new Insertion.Top('upload-content', h); 129 var displayEl = $(checked); 130 if ( displayEl ) 131 displayEl.checked = true; 132 133 if (e) Event.stop(e); 150 jQuery(h).prependTo('#upload-content'); 151 jQuery('#' + checked).attr('checked','checked'); 152 if (e) return e.stopPropagation(); 134 153 return false; 135 154 }, … … 145 164 h += "<form id='upload-file' method='post' action='" + action + "'>"; 146 165 if ( this.ID ) { 147 var params = $H(this.params);166 var params = this.params; 148 167 params.ID = ''; 149 168 params.action = ''; 150 h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "'";169 h += "<a href='" + this.urlData[0] + '?' + this.toQueryString(params) + "'"; 151 170 } else { 152 171 h += "<a href='#' onclick='return theFileList.cancelView();'"; … … 189 208 h += "</td></tr></table></form>"; 190 209 191 new Insertion.Top('upload-content', h);192 if (e) Event.stop(e);210 jQuery(h).prependTo('#upload-content'); 211 if (e) e.stopPropagation(); 193 212 return false; 194 213 }, … … 196 215 prepView: function(id) { 197 216 this.cancelView( true ); 198 var filesEl = $('upload-files');217 var filesEl = jQuery('#upload-files'); 199 218 if ( filesEl ) 200 219 filesEl.hide(); 201 var navEl = $('current-tab-nav');220 var navEl = jQuery('#current-tab-nav'); 202 221 if ( navEl ) 203 222 navEl.hide(); … … 207 226 cancelView: function( prep ) { 208 227 if ( !prep ) { 209 var filesEl = $('upload-files');228 var filesEl = jQuery('#upload-files'); 210 229 if ( filesEl ) 211 Element.show(filesEl);212 var navEl = $('current-tab-nav');230 jQuery(filesEl).show(); 231 var navEl = jQuery('#current-tab-nav'); 213 232 if ( navEl ) 214 Element.show(navEl);233 jQuery(navEl).show(); 215 234 } 216 235 if ( !this.ID ) 217 236 this.grabImageData(0); 218 var div = $('upload-file');237 var div = jQuery('#upload-file'); 219 238 if ( div ) 220 Element.remove(div);239 jQuery(div).remove(); 221 240 return false; 222 241 }, … … 228 247 var h = ''; 229 248 230 link = $A(document.forms.uploadoptions.elements.link).detect( function(i) { return i.checked; } ).value;231 displayEl = $A(document.forms.uploadoptions.elements.display).detect( function(i) { return i.checked; } )249 link = jQuery('input[@type=radio][@name="link"][@checked]','#uploadoptions').val(); 250 displayEl = jQuery('input[@type=radio][@name="display"][@checked]','#uploadoptions'); 232 251 if ( displayEl ) 233 display = displayEl.value;252 display = jQuery(displayEl).val(); 234 253 else if ( 1 == this.currentImage.isImage ) 235 254 display = 'full'; … … 260 279 deleteFile: function(id) { 261 280 if ( confirm( this.confirmText.replace(/%title%/g, this.currentImage.title) ) ) { 262 $('action-value').value = 'delete';263 $('upload-file').submit();281 jQuery('#action-value').attr('value','delete'); 282 jQuery('#upload-file').submit(); 264 283 return true; 265 284 } … … 268 287 269 288 }; 270 Object.extend( theFileList, uploadL10n ); 289 290 for ( var property in uploadL10n ) 291 theFileList[property] = uploadL10n[property]; 271 292 theFileList.initializeVars(); 272 293 theFileList.initializeLinks(); -
trunk/wp-includes/script-loader.php
r5577 r5629 73 73 74 74 $this->add( 'jquery', '/wp-includes/js/jquery/jquery.js', false, '1.1.2'); 75 $this->add( 'jquery-form', '/wp-includes/js/jquery/jquery.form.js', array('jquery'), '1.0.3'); 75 76 $this->add( 'interface', '/wp-includes/js/jquery/interface.js', array('jquery'), '1.2'); 76 77 … … 114 115 $this->add( 'admin-users', '/wp-admin/users.js', array('listman'), '4583' ); 115 116 $this->add( 'xfn', '/wp-admin/xfn.js', false, '3517' ); 116 $this->add( 'upload', '/wp-admin/upload.js', array(' prototype'), '20070306' );117 $this->add( 'upload', '/wp-admin/upload.js', array('jquery'), '20070518' ); 117 118 $this->localize( 'upload', 'uploadL10n', array( 118 119 'browseTitle' => attribute_escape(__('Browse your files')),
Note: See TracChangeset
for help on using the changeset viewer.