Difference between revisions of "MediaWiki:Common.js"
Jump to navigation
Jump to search
Wikipatents (talk | contribs) |
Wikipatents (talk | contribs) |
||
Line 1: | Line 1: | ||
$(function() { | $(function() { | ||
− | var $popup = $('<div>') | + | // Check if the popup has been shown in the last 24 hours |
− | + | var lastShown = localStorage.getItem('patentAlertLastShown'); | |
− | + | var now = new Date().getTime(); | |
− | + | ||
− | + | if (!lastShown || now - lastShown > 24 * 60 * 60 * 1000) { | |
− | + | var $popup = $('<div>') | |
− | + | .css({ | |
− | + | position: 'fixed', | |
− | + | top: '50%', | |
− | + | left: '50%', | |
− | + | transform: 'translate(-50%, -50%)', | |
− | + | backgroundColor: 'rgba(255, 255, 255, 0.95)', | |
− | + | padding: '30px', | |
− | + | borderRadius: '20px', | |
− | + | border: '8px solid #ffbe18', | |
− | + | boxShadow: '0 10px 40px rgba(0,0,0,0.2)', | |
− | + | width: '400px', | |
− | + | maxWidth: '90%', | |
− | + | zIndex: 1000, | |
− | + | fontFamily: 'Arial, sans-serif', | |
− | + | textAlign: 'center' | |
+ | }) | ||
+ | .html('<h2 style="color: #333; font-size: 24px; margin-bottom: 20px;">Patent Application Monitoring</h2>' + | ||
+ | '<p style="color: #555; font-size: 16px; line-height: 1.5; margin-bottom: 25px;">Want to monitor Patent Applications? Submit your custom request and get a free weekly report!</p>' + | ||
+ | '<button id="patentAlertButton">Get Alerts</button>') | ||
+ | .appendTo('body'); | ||
− | + | $('#patentAlertButton').css({ | |
− | + | display: 'inline-block', | |
− | + | padding: '12px 24px', | |
− | + | backgroundColor: '#ffbe18', | |
− | + | color: '#333', | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
border: 'none', | border: 'none', | ||
− | fontSize: ' | + | borderRadius: '25px', |
− | + | fontSize: '18px', | |
− | cursor: 'pointer' | + | fontWeight: 'bold', |
− | }) | + | cursor: 'pointer', |
− | + | transition: 'background-color 0.3s, transform 0.1s', | |
+ | outline: 'none' | ||
+ | }).on('click', function() { | ||
+ | window.open('https://docs.google.com/forms/d/e/1FAIpQLSfvGeHyDW-ND9TqqVhbPOrYsKWsvUgFp9Rl-gfsyZCaLp7fXA/viewform?usp=sf_link', '_blank'); | ||
$popup.fadeOut(300); | $popup.fadeOut(300); | ||
− | }) | + | localStorage.setItem('patentAlertLastShown', now); |
− | .appendTo($popup); | + | }).on('mouseover', function() { |
+ | $(this).css('backgroundColor', '#e5ab16'); | ||
+ | }).on('mouseout', function() { | ||
+ | $(this).css('backgroundColor', '#ffbe18'); | ||
+ | }).on('mousedown', function() { | ||
+ | $(this).css('transform', 'scale(0.95)'); | ||
+ | }).on('mouseup', function() { | ||
+ | $(this).css('transform', 'scale(1)'); | ||
+ | }); | ||
+ | |||
+ | // Add close button | ||
+ | $('<button>') | ||
+ | .text('×') | ||
+ | .css({ | ||
+ | position: 'absolute', | ||
+ | top: '10px', | ||
+ | right: '10px', | ||
+ | background: 'none', | ||
+ | border: 'none', | ||
+ | fontSize: '24px', | ||
+ | color: '#666', | ||
+ | cursor: 'pointer' | ||
+ | }) | ||
+ | .on('click', function() { | ||
+ | $popup.fadeOut(300); | ||
+ | localStorage.setItem('patentAlertLastShown', now); | ||
+ | }) | ||
+ | .appendTo($popup); | ||
− | + | // Show popup with fade-in effect | |
− | + | setTimeout(function() { | |
− | + | $popup.hide().fadeIn(500); | |
− | + | }, 1000); | |
+ | } | ||
}); | }); |
Revision as of 15:39, 8 July 2024
$(function() { // Check if the popup has been shown in the last 24 hours var lastShown = localStorage.getItem('patentAlertLastShown'); var now = new Date().getTime(); if (!lastShown || now - lastShown > 24 * 60 * 60 * 1000) { var $popup = $('<div>') .css({ position: 'fixed', top: '50%', left: '50%', transform: 'translate(-50%, -50%)', backgroundColor: 'rgba(255, 255, 255, 0.95)', padding: '30px', borderRadius: '20px', border: '8px solid #ffbe18', boxShadow: '0 10px 40px rgba(0,0,0,0.2)', width: '400px', maxWidth: '90%', zIndex: 1000, fontFamily: 'Arial, sans-serif', textAlign: 'center' }) .html('<h2 style="color: #333; font-size: 24px; margin-bottom: 20px;">Patent Application Monitoring</h2>' + '<p style="color: #555; font-size: 16px; line-height: 1.5; margin-bottom: 25px;">Want to monitor Patent Applications? Submit your custom request and get a free weekly report!</p>' + '<button id="patentAlertButton">Get Alerts</button>') .appendTo('body'); $('#patentAlertButton').css({ display: 'inline-block', padding: '12px 24px', backgroundColor: '#ffbe18', color: '#333', border: 'none', borderRadius: '25px', fontSize: '18px', fontWeight: 'bold', cursor: 'pointer', transition: 'background-color 0.3s, transform 0.1s', outline: 'none' }).on('click', function() { window.open('https://docs.google.com/forms/d/e/1FAIpQLSfvGeHyDW-ND9TqqVhbPOrYsKWsvUgFp9Rl-gfsyZCaLp7fXA/viewform?usp=sf_link', '_blank'); $popup.fadeOut(300); localStorage.setItem('patentAlertLastShown', now); }).on('mouseover', function() { $(this).css('backgroundColor', '#e5ab16'); }).on('mouseout', function() { $(this).css('backgroundColor', '#ffbe18'); }).on('mousedown', function() { $(this).css('transform', 'scale(0.95)'); }).on('mouseup', function() { $(this).css('transform', 'scale(1)'); }); // Add close button $('<button>') .text('×') .css({ position: 'absolute', top: '10px', right: '10px', background: 'none', border: 'none', fontSize: '24px', color: '#666', cursor: 'pointer' }) .on('click', function() { $popup.fadeOut(300); localStorage.setItem('patentAlertLastShown', now); }) .appendTo($popup); // Show popup with fade-in effect setTimeout(function() { $popup.hide().fadeIn(500); }, 1000); } });