Difference between revisions of "MediaWiki:Common.js"
Jump to navigation
Jump to search
Wikipatents (talk | contribs) |
Wikipatents (talk | contribs) |
||
Line 8: | Line 8: | ||
gtag('config', 'G-GBTLGTHG7P'); | gtag('config', 'G-GBTLGTHG7P'); | ||
</script> | </script> | ||
+ | (function() { | ||
+ | // Create and append styles | ||
+ | var style = document.createElement('style'); | ||
+ | style.textContent = ` | ||
+ | .patent-popup { | ||
+ | position: fixed; | ||
+ | top: 50%; | ||
+ | left: 50%; | ||
+ | transform: translate(-50%, -50%) scale(0.1); | ||
+ | background-color: #f8f9fa; | ||
+ | padding: 20px; | ||
+ | border-radius: 10px; | ||
+ | box-shadow: 0 5px 30px rgba(0,0,0,0.3); | ||
+ | width: 300px; | ||
+ | opacity: 0; | ||
+ | transition: all 0.3s ease-in-out; | ||
+ | z-index: 1000; | ||
+ | } | ||
+ | .patent-popup.show { | ||
+ | opacity: 1; | ||
+ | transform: translate(-50%, -50%) scale(1); | ||
+ | } | ||
+ | .patent-popup h2 { | ||
+ | margin-top: 0; | ||
+ | color: #333; | ||
+ | } | ||
+ | .patent-popup p { | ||
+ | color: #666; | ||
+ | } | ||
+ | .patent-cta-button { | ||
+ | display: block; | ||
+ | width: 100%; | ||
+ | padding: 10px; | ||
+ | background-color: #007bff; | ||
+ | color: white; | ||
+ | border: none; | ||
+ | border-radius: 5px; | ||
+ | font-size: 16px; | ||
+ | cursor: pointer; | ||
+ | transition: background-color 0.2s; | ||
+ | } | ||
+ | .patent-cta-button:hover { | ||
+ | background-color: #0056b3; | ||
+ | } | ||
+ | `; | ||
+ | document.head.appendChild(style); | ||
+ | |||
+ | // Create popup element | ||
+ | var popup = document.createElement('div'); | ||
+ | popup.className = 'patent-popup'; | ||
+ | popup.innerHTML = ` | ||
+ | <h2>Patent Application Monitoring</h2> | ||
+ | <p>Want to monitor Patent Applications? Submit your custom request and get a free weekly report!</p> | ||
+ | <button class="patent-cta-button">Get Alerts</button> | ||
+ | `; | ||
+ | document.body.appendChild(popup); | ||
+ | |||
+ | // Show popup after a short delay | ||
+ | setTimeout(function() { | ||
+ | popup.classList.add('show'); | ||
+ | }, 1000); | ||
+ | |||
+ | // Add click event to the CTA button | ||
+ | popup.querySelector('.patent-cta-button').addEventListener('click', function() { | ||
+ | window.open('https://docs.google.com/forms/d/e/1FAIpQLSfvGeHyDW-ND9TqqVhbPOrYsKWsvUgFp9Rl-gfsyZCaLp7fXA/viewform?usp=sf_link', '_blank'); | ||
+ | popup.classList.remove('show'); | ||
+ | }); | ||
+ | })(); |
Revision as of 16:42, 5 July 2024
<!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-GBTLGTHG7P"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-GBTLGTHG7P'); </script> (function() { // Create and append styles var style = document.createElement('style'); style.textContent = ` .patent-popup { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.1); background-color: #f8f9fa; padding: 20px; border-radius: 10px; box-shadow: 0 5px 30px rgba(0,0,0,0.3); width: 300px; opacity: 0; transition: all 0.3s ease-in-out; z-index: 1000; } .patent-popup.show { opacity: 1; transform: translate(-50%, -50%) scale(1); } .patent-popup h2 { margin-top: 0; color: #333; } .patent-popup p { color: #666; } .patent-cta-button { display: block; width: 100%; padding: 10px; background-color: #007bff; color: white; border: none; border-radius: 5px; font-size: 16px; cursor: pointer; transition: background-color 0.2s; } .patent-cta-button:hover { background-color: #0056b3; } `; document.head.appendChild(style); // Create popup element var popup = document.createElement('div'); popup.className = 'patent-popup'; popup.innerHTML = ` <h2>Patent Application Monitoring</h2> <p>Want to monitor Patent Applications? Submit your custom request and get a free weekly report!</p> <button class="patent-cta-button">Get Alerts</button> `; document.body.appendChild(popup); // Show popup after a short delay setTimeout(function() { popup.classList.add('show'); }, 1000); // Add click event to the CTA button popup.querySelector('.patent-cta-button').addEventListener('click', function() { window.open('https://docs.google.com/forms/d/e/1FAIpQLSfvGeHyDW-ND9TqqVhbPOrYsKWsvUgFp9Rl-gfsyZCaLp7fXA/viewform?usp=sf_link', '_blank'); popup.classList.remove('show'); }); })();