Guest User

dalle edit script

a guest
Feb 26th, 2024
614
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         Bing New Edit button
  3. // @namespace    http://tampermonkey.net/
  4. // @version      2024-02-26
  5. // @description  try to take over the world!
  6. // @author       Anon
  7. // @match        https://www.bing.com/images/create/*
  8. // @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  9. // @grant        none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13.     'use strict';
  14.  
  15. const targetClass = "detailMeta";
  16.  
  17. const observer = new MutationObserver(checkForElement);
  18.  
  19. function checkForElement() {
  20.     const element = document.querySelector("#" + targetClass);
  21.     if (element) {
  22.         start();
  23.         observer.disconnect();
  24.     }
  25. }
  26.  
  27. observer.observe(document.body, { childList: true, subtree: true });
  28.  
  29. function start() {
  30.  
  31.     if (
  32.         window.location.href.includes("https://www.bing.com/images/create/")
  33.     ) {
  34.  
  35.         var editButton = document.createElement("a");
  36.         editButton.textContent = "Edit";
  37.         editButton.target = "_blank";
  38.         editButton.classList.add("action");
  39.         editButton.classList.add("share");
  40.         var tempUrl = window.location.href;
  41.         tempUrl = tempUrl + "&edit=1&clientName=BING+CHAT&sappdirectload=1&showselective=1&FORM=SYDBIC";
  42.         editButton.href = tempUrl;
  43.  
  44.  
  45.         var provDiv = document.querySelectorAll(".actn_container>ul>li:first-child")[0];
  46.         if (provDiv) {
  47.             provDiv.innerHTML = "";
  48.             provDiv.appendChild(editButton);
  49.         }
  50.     }
  51.  
  52. }
  53.  
  54. })();
  55.  
Add Comment
Please, Sign In to add comment