MediaWiki:Common.js
Revision as of 17:02, 5 July 2024 by Wikipatents (talk | contribs)
Note: After saving, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
mw.loader.using(['mediawiki.util', 'oojs-ui-core', 'oojs-ui-windows'], function () { $(function () { // Check if the popup has been shown recently var lastShown = localStorage.getItem('patentPopupLastShown'); var now = new Date().getTime(); if (lastShown && now - lastShown < 86400000) { // 24 hours in milliseconds return; // Don't show the popup if it was shown in the last 24 hours } var $popupContent = $('<div>') .append( $('<h2>').text('Patent Application Monitoring'), $('<p>').text('Want to monitor Patent Applications? Submit your custom request and get a free weekly report!'), $('<div>').append( new OO.ui.ButtonWidget({ label: 'Get Alerts', flags: ['progressive', 'primary'] }).$element ) ); var popup = new OO.ui.PopupWidget({ $content: $popupContent, padded: true, width: 300, height: 'auto', head: true, label: 'Patent Monitoring' }); $('body').append(popup.$element); // Show popup after a short delay setTimeout(function () { popup.toggle(true); }, 1000); // Add click event to the CTA button $popupContent.find('.oo-ui-buttonElement-button').on('click', function () { window.open('https://docs.google.com/forms/d/e/1FAIpQLSfvGeHyDW-ND9TqqVhbPOrYsKWsvUgFp9Rl-gfsyZCaLp7fXA/viewform?usp=sf_link', '_blank'); popup.toggle(false); // Remember that we've shown the popup localStorage.setItem('patentPopupLastShown', new Date().getTime()); }); }); });