Media: Add global upload progress to the sidebar. see #21390.

git-svn-id: http://core.svn.wordpress.org/trunk@22816 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Daryl Koopersmith
2012-11-22 09:32:21 +00:00
parent 67b5e59b68
commit 1e472d8974
5 changed files with 170 additions and 28 deletions

View File

@@ -191,6 +191,18 @@ window.wp = window.wp || {};
height: height
};
}
},
// Truncates a string by injecting an ellipsis into the middle.
// Useful for filenames.
truncate: function( string, length, replacement ) {
length = length || 30;
replacement = replacement || '…';
if ( string.length <= length )
return string;
return string.substr( 0, length / 2 ) + replacement + string.substr( -1 * length / 2 );
}
});