User:Manuel de la Fuente/common.js

$(function {

"use strict"; // Inserts the alert var lastVisit = window.localStorage.getItem('spoilerCache2'); // Gets the timestamp of the last visit stored in the cache var thisVisit = Date.now; // Returns the current time in milliseconds var howLong = thisVisit - lastVisit; // Checks how much time has passed since the last visit if (howLong < 2592000000) { // Removes the alert if it's been less than one month since the last visit $('#spoiler-overlay').remove; // Removes the alert

// Actions when clicking yes or no           $('#show-spoilers').click(function  {                localStorage.setItem("spoilerCache2", thisVisit); // Saves the timestamp of this visit            }); }

// Adds button to rehide spoilers to the row of buttons $('#WikiaPageHeader').append('Rehide spoilers'); $('#reset-spoilers').click(function {            localStorage.removeItem('spoilerCache2');            location.reload;        }); });