Advertisement
arsh999cg

Oxygen Exclude all post types except PAGE one-click

Jan 22nd, 2024
803
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         # Oxygen Post Types Exclude
  3. // @description  Oxygen Post Type Exclude Select all except PAGE
  4. // @namespace    http://tampermonkey.net/
  5. // @version      2024-01-20
  6. // @author       Arshad
  7. // @match        https://*/*oxygen_vsb_settings&tab=client_control
  8. // @grant        none
  9. // ==/UserScript==
  10.  
  11. (function () {
  12.     'use strict';
  13.  
  14.     // adds a new button
  15.     let buttonAdded = document.createElement('button');
  16.  
  17.     buttonAdded.textContent = 'Check ! PAGE';
  18.  
  19.     buttonAdded.classList.add('button-added');
  20.  
  21.     document.body.appendChild(buttonAdded);
  22.  
  23.     // Button when clicked, check all the post types except PAGE
  24.     buttonAdded.addEventListener('click', function () {
  25.         let checkBoxes = document.querySelectorAll('[name*="oxygen_vsb_ignore"]');
  26.  
  27.         if (checkBoxes) {
  28.             checkBoxes.forEach(function (element) {
  29.                 if (element.getAttribute('name') !== 'oxygen_vsb_ignore_post_type_page') {
  30.                     element.checked = true;
  31.                 }
  32.             });
  33.         }
  34.     });
  35.  
  36.     // Style of the button according to Oxygen styles.
  37.     let styles = document.createElement('style');
  38.     styles.textContent = `
  39.       .button-added {
  40.       position: fixed;
  41.       bottom: 82px;
  42.       right: 32px;
  43.       z-index: 9999;
  44.       background-color: #241a6c;
  45.       color: #fff;
  46.       padding: 12px 16px;
  47.       border: none;
  48.       border-radius: 6px;
  49.       cursor: pointer;
  50.       }
  51.       `;
  52.  
  53.     // Append the <style> element to the head of the document
  54.     document.head.appendChild(styles);
  55.  
  56. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement