Doing Perchance.org things…

Links

  • 1 Post
  • 134 Comments
Joined 2 years ago
cake
Cake day: June 21st, 2023

help-circle




  • On the edit generator screen, you can click the ‘settings’ on the top right, and you can change the URL. Images are bound to the URL of the page, meaning if you change the URL, then those images are also gone, but you can revert the URL back to get back the images.

    By private gallery do you mean the gallery below the generator (I’m assuming that you are using a generator using the t2i-framework-plugin-v2 based generator like ai-text-to-image-generator), then it isn’t a private gallery, it is the public gallery. If you changed the gallery destination, into a different name (other than public), there might be a case in which other people are also using the same gallery e.g. even if you changed the gallery name into private it wouldn’t be private, it would just be sent to the gallery named private.

    You cannot perma delete images from the gallery by yourself, you need to block and have other people block that specific poster for their images to not display on the public gallery (see this related thread).

    I would recommend using the actual ‘private’ gallery option that saves the data in your local storage. This is enabled with by adding the following on your settings (assuming you are using the t2i-framework):

    settings // This is the main settings list that is passed to `t2i-framework-plugin-v2` to generate the interface.
      ...
      imageButtons
        personality = true
        privateSave = true // Make sure to have this line.
    

    Then you can click the 🛡️💾 to save it locally on your browser.


  • You can have each of the suits into a single list, then control that parent list. E.g.

    Uniform
      https://user.uploads.dev/file/53321b33603b8f9f386fb870db73ad65.png
      [Top] ^[camera.includes("top") && actor != "dryad"]
      [Mid] ^[camera.includes("mid") && actor != "angel"]
      [Low] ^[camera.includes("low") && !["mermaid", "minotaur"].includes(actor)]
      [Rear] ^[camera.includes("rear") && actor != "angel"]
      [TopMidLow] ^[["top", "mid", "low"].some(a => camera.includes(a))]
    
    
    Top
      batman mask ^[specificCostume == "batman"]
      ...
    
    Mid
      batman suit with batman logo on the chest, batman gloves, batman belt ^[specificCostume == "batman"]
      ...
    

  • If you are using HTML inputs, you can easily access their values like checkbox.checked for checkboxes and radio buttons, textinput.value for input values and select dropdowns, in which you can also set their default values for each one natively, unless the function that you’ve made is for ‘resetting’ to default values.

    I would also go with the way that you have a single global object for all of your variables, just for organizing and ease of access.



  • I think I see the idea you have. What is the scope of the variable you are trying to set it to? You currently have it as:

      for (const [key, value] of Object.entries(variablesMapping)) {
        if (this[key] === undefined || this[key] === null) {
          this[key] = value;
        }
      }
    

    You are using this, which refers to the function. It should probably be set into what you have your initial variables, e.g. if you have your variables as properties in a variable called inputs, then it should be:

      for (const [key, value] of Object.entries(variablesMapping)) {
        if (inputs[key] === undefined || inputs[key] === null) {
          inputs[key] = value;
        }
      }
    

    So that if you use it like inputs.charNum, it would be set to the default that you have set with the defining() method.




  • There should be no problem with linking the defaultCommentOptions on JavaScript, it would be on this part of your code on the HTML:

        ...
        let othersChatDiv = document.createElement('div');
        othersChatDiv.id = 'others-chat-container';
        othersChatDiv.style.display = 'none'; // Hide others chat by default
        
        let mainChatOptions = defaultCommentOptions.createClone;
        mainChatOptions.channel = "qine-main-chat";
        mainChatOptions.commentPlaceholderText = "Casual talk, memes, fun — all here!";
        mainChatOptions.onComment = function (comment) {
          // Handle new comments in Main Chat
          console.log("New comment in Main Chat:", comment);
        }
        let mainChatPlugin = commentsPlugin(mainChatOptions);
        ...
    

    The problem is bannedUsersList is not in the generator, so it gives errors. Removing that from the defaultCommentOptions makes it work.



  • Best way I would think is use the default comment options that you have on the Perchance lists:

    defaultCommentOptions // for comments plugin: https://perchance.org/comments-plugin
      width = 100%
      height = 350
      commentPlaceholderText = Leave friendly comments..
      submitButtonText = submit comment
      bannedUsers = [bannedUsersList]
      customEmojis = {import:huge-emoji-list}
      adminFlair = 👑 Creator
      adminPasswordHash = 4b7a8a671d949baf24756f731091d13018de5c2ab4dd2cc1c1612a6643986933
    

    As the base options like so:

    let mainChatOptions = defaultCommentOptions.createClone;
    mainChatOptions.channel = "qine-main-chat";
    mainChatOptions.commentPlaceholderText = "Casual talk, memes, fun — all here!";
    mainChatOptions.onComment = function (comment) {
      // Handle new comments in Main Chat
      console.log("New comment in Main Chat:", comment);
    }
    let mainChatPlugin = commentsPlugin(mainChatOptions);
    




  • So, on your:

    <div class="flex">[output]</div>
    

    You need to enclose the [output] in a div for the Update Rows to work since it looks for the number of div on the .flex container like so:

    <div class="flex"><div>[output]</div></div>
    

    Also, you changed the start of the ‘for loop’ on the update rows with let i = numRows - 1 which would mean it can only update one row since the loop terminates if it exceeds the numRows. Just use the let i = 0.

    If you want to only update the ‘last’ row, you can do:

    function updateLast() {
      let lastRow = [...document.querySelector(".flex").querySelectorAll('div')].at(-1)
      lastRow.innerHTML = output
    }
    

  • So, on the .flex container, every time you add the output on the innerHTML, it would essentially re-run the ‘evaluation’ of the square brackets, which would also update the container - which updates the previous images. Best way is to not alter the InnerHTML by concatenating and use .appendChild instead. Ex:

      function addImageRow() {
        let con = document.createElement('div');
        con.innerHTML = output
        document.querySelector(".flex").appendChild(con);
      }
    

    But since this wouldn’t have any square brackets, you cannot use the regular update() function to reload them. Here’s a function to update them:

    function updateRows() {
        let numRows = document.querySelector(".flex").querySelectorAll('div').length
        document.querySelector(".flex").innerHTML = ''
        for (let i = 0; i < numRows; i++) {
          let con = document.createElement('div');
          con.innerHTML = output
          document.querySelector(".flex").appendChild(con);
        }
      }