main.js 450 B

1234567891011121314151617181920212223242526272829
  1. $(document).ready(function(){
  2. var _$users = $('div.user');
  3. function init(){
  4. wrapHTML();
  5. getOutImages();
  6. }
  7. function wrapHTML(){
  8. _$users.each(function(){
  9. var $header = $('<header />').append($('h1:first, h2:first', this));
  10. $header.prependTo(this)
  11. });
  12. }
  13. function getOutImages(){
  14. $('div.user img').each(function(){
  15. var cnt = $(this).parent('p').contents();
  16. $(this).parent('p').replaceWith(cnt);
  17. });
  18. }
  19. init();
  20. });