Advertisement
Guest User

Untitled

a guest
May 27th, 2015
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. <script type="text/javascript">
  2. jQuery(document).ready(function($) {
  3.  
  4. // Load from storage
  5. var image = localStorage.getItem("image"),
  6. desc = localStorage.getItem("desc"),
  7. social = localStorage.getItem("social");
  8.  
  9. /* Populate. Posts won't always have a desc, image, _and_ social, but
  10. they _always_ will have a social. We hope. */
  11. if (social) {
  12. $("#live").show(1000);
  13. $("#live img").attr('src', image);
  14. $("#live #desc #text").html(desc);
  15. $("#live #desc #social").html(social);
  16. }
  17.  
  18. $('.item').click(function() {
  19.  
  20. localStorage.removeItem("image");
  21. localStorage.removeItem("desc");
  22. localStorage.removeItem("social");
  23.  
  24. var image = $('img', this).attr('src').replace(/\d{3}x\d{3}/i, '670x400.jpg');
  25. desc = $('.description', this).text();
  26. social = $('.social-bar').html();
  27.  
  28. // Set for page refresh
  29. localStorage.setItem("image", image);
  30. localStorage.setItem("desc", desc);
  31. localStorage.setItem("social", social);
  32.  
  33. window.location.reload();
  34. });
  35. });
  36. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement