Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript">
- jQuery(document).ready(function($) {
- // Load from storage
- var image = localStorage.getItem("image"),
- desc = localStorage.getItem("desc"),
- social = localStorage.getItem("social");
- /* Populate. Posts won't always have a desc, image, _and_ social, but
- they _always_ will have a social. We hope. */
- if (social) {
- $("#live").show(1000);
- $("#live img").attr('src', image);
- $("#live #desc #text").html(desc);
- $("#live #desc #social").html(social);
- }
- $('.item').click(function() {
- localStorage.removeItem("image");
- localStorage.removeItem("desc");
- localStorage.removeItem("social");
- var image = $('img', this).attr('src').replace(/\d{3}x\d{3}/i, '670x400.jpg');
- desc = $('.description', this).text();
- social = $('.social-bar').html();
- // Set for page refresh
- localStorage.setItem("image", image);
- localStorage.setItem("desc", desc);
- localStorage.setItem("social", social);
- window.location.reload();
- });
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement