All I have to say about this update...

Discussion in 'The Spam Zone' started by Always Dance, Apr 30, 2012.

  1. Always Dance Chaser

    Joined:
    Feb 22, 2009
    220
    My text script doesn't work anymore!

    LOOK WHAT YOU'VE DONE TO ME!

    LOOK AT MY SHAME!
     
  2. Makaze Some kind of mercenary

    Joined:
    Jan 22, 2011
    Location:
    The Matinée
    1,207
    You can do it. You just need to edit the class and other information.

    Question, were you able to use JQuery in your script, or were you using tradition JavaScript?
     
  3. Guardian Soul hella sad & hella rad

    Joined:
    Jul 26, 2007
    Gender:
    Male
    794
    THANK GOD!

    I mean

    wut >_>;
     
  4. Always Dance Chaser

    Joined:
    Feb 22, 2009
    220
    Javascript, i don't know JQuery. I'll figure it out eventually. Probably just the box variable changed.
     
  5. Jube Formerly Chuck's

    Joined:
    May 6, 2007
    Gender:
    Male
    Location:
    Guess
    633
    [​IMG]
    WHY CAN'T THE ADD IMAGE TOOL JUST PUT IT IN img FORMAT!?
     
  6. Misty gimme kiss

    Joined:
    Sep 25, 2006
    Gender:
    Cisgender Female
    Location:
    alderaan
    6,590
    Guess we'll just have to learn to survive without orange apostrophes.
     
  7. Droid Hollow Bastion Committee

    Joined:
    Apr 19, 2011
    Gender:
    Female
    Location:
    Atlanta
    434
    745
    [​IMG]
     
  8. reptar REEEEEEEEEEEEEEEEEEEEEEEEEE

    Joined:
    Jan 30, 2007
    Gender:
    Female
    Location:
    czar casm
    896
    Thank god. It looked horrible.
     
  9. Fork These violent delights have violent ends

    Joined:
    Apr 1, 2007
    Location:
    Story Brooke, Maine
    1,537
    So something good did come out of this update c:
     
  10. Makaze Some kind of mercenary

    Joined:
    Jan 22, 2011
    Location:
    The Matinée
    1,207
    I would love to see your script, if I may.

    jQuery is a JavasScript library that makes it cut like a hot knife through butter. For instance, let's say you want to add and then remove a class from an element when a button is clicked once and then twice.

    In JavaScript, you would have to do something like make two buttons, and then make these buttons each have one function: one for removing the class, and one for adding it.

    With jQuery, you can set it to toggle with each click of a single button. Let us say that you want to add the class .myclass to a paragraph with the id #myp. This is how you do that with jQuery:

    Code:
    $("#myp").toggleClass("myclass");
    If you want to make it so that when you click a button with the id #mybutton, it changes the paragraph's class, then you would use the click() function:

    Code:
    $("#mybutton").click(function() {
    $("#myp").toggleClass("myclass");
    });
    Now this isn't the best part. The best part is that you can select multiple elements at once using commas, and you can select classes just as easily as ids. Like this.

    Code:
    $("#myp, #mybutton").toggleClass("redstuff");
    $(".myclass").toggleClass("redstuff");
    Where .redstuff and .myclass are defined in the CSS.

    Also, I lied about that being the best part. You will see what I mean if you play with it.

    If you want to learn more about jQuery, check the jQuery API and play around with it in your Chrome console which can be found by right clicking anywhere on a page and choosing "Inspect Element".
     
  11. Always Dance Chaser

    Joined:
    Feb 22, 2009
    220
    Thanks Makaze, I'll check it out, I've wanted to learn JQuery for a while.

    Also I think I might have fixed it...

    EDIT-nope, didn't fix it. Hm. Well, here is the script, still working on it, commented part used to work before the update.

    I think I really fixed it this time...
     
  12. Makaze Some kind of mercenary

    Joined:
    Jan 22, 2011
    Location:
    The Matinée
    1,207
    You just need to change the id's, I think? It seems to be pretty good other than that. Or you could grab the classes but that would be a little more difficult.
     
  13. Always Dance Chaser

    Joined:
    Feb 22, 2009
    220
    No that's not it, in the console everything is defined exactly the way I want it to be. I honestly have no idea what is going on at this point.
     
  14. Makaze Some kind of mercenary

    Joined:
    Jan 22, 2011
    Location:
    The Matinée
    1,207
    sf.sjdfkdsjffj;dsjf;dsmn.,dvcnz.k;gZNSb n

    I got it working by changing the className. It cannot handle two classes in one getBy function. See below.

    Code:
    // ==UserScript==
    // @name	KHV Autocolor
    // @author	Slaughtermatic
    // @include	http://www.kh-vids.net/*
    //@match http://www.kh-vids.net/*
    
    // @version	1
    // ==/UserScript==
    /*
    var form;
    var btn;
    var box;
    if(document.forms.namedItem("vbform")!= null)
    {   form = document.forms.namedItem("vbform");
        if(form.elements.namedItem("vB_Editor_001_save") != null)
        {
        btn = form.elements.namedItem("vB_Editor_001_save");
        box = form.elements.namedItem("vB_Editor_001_textarea");
        }
        else
        {btn = form.elements.namedItem("qr_submit");
         box = form.elements.namedItem("vB_Editor_QR_textarea");
         }
    }
    
    else
    {
    form = document.forms.namedItem("quick_reply");
    btn = form.elements.namedItem("qr_submit");
    box = form.elements.namedItem("vB_Editor_QR_textarea");
    }
    */
    var box = document.getElementsByClassName("cke_source")[0];
    var btn = document.getElementById("qr_submit");
    var otherbtn = document.getElementById("vB_Editor_001_save");
    function herp(){
     box.value = box.value.replace(/,/g , "[color=#ff8c00],[/color]");
     box.value = box.value.replace(/\./g , "[color=#ff8c00].[/color]");
     box.value = box.value.replace(/\?/g, "[color=#ff8c00]?[/color]");
     box.value = box.value.replace(/!/g, "[color=#ff8c00]![/color]");
     box.value = box.value.replace(/@/g, "[color=#ff8c00]@[/color]");
     box.value = box.value.replace(/#/g, "[color=#ff8c00]#[/color]");
     box.value = box.value.replace(/\$/g, "[color=#ff8c00]$[/color]");
     box.value = box.value.replace(/%/g, "[color=#ff8c00]%[/color]");
     box.value = box.value.replace(/\^/g, "[color=#ff8c00]^[/color]");
     box.value = box.value.replace(/&/g, "[color=#ff8c00]&[/color]");
     box.value = box.value.replace(/\*/g, "[color=#ff8c00]*[/color]");
     box.value = box.value.replace(/\(/g, "[color=#ff8c00]([/color]");
     box.value = box.value.replace(/\)/g, "[color=#ff8c00])[/color]");
     box.value = box.value.replace(/-/g, "[color=#ff8c00]-[/color]");
     box.value = box.value.replace(/_/g, "[color=#ff8c00]_[/color]");
     box.value = box.value.replace(/\+/g, "[color=#ff8c00]+[/color]");
     box.value = box.value.replace(/:/g, "[color=#ff8c00]:[/color]");
     box.value = box.value.replace(/"/g, "[color=#ff8c00]\"[/color]");
     box.value = box.value.replace(/'/g, "[color=#ff8c00]'[/color]");
     box.value = box.value.replace(/</g, "[color=#ff8c00]<[/color]");
     box.value = box.value.replace(/>/g, "[color=#ff8c00]>[/color]");
    box.value = ("[color=#4169e1]" + box.value + "[/color]");
    
    clickedelm = this.value;
    }
    btn.addEventListener("click", herp, true);
    otherbtn.addEventListener("click", herp, true);
     
  15. Always Dance Chaser

    Joined:
    Feb 22, 2009
    220
    First of all, I love you. Second, how in the motherloving hell does that work when the text box is named "cke_source cke_enable_context_menu" and not "cke_source"?
     
  16. Makaze Some kind of mercenary

    Joined:
    Jan 22, 2011
    Location:
    The Matinée
    1,207
    Because those are two separate classes. An object can have multiple classes, which are separated by spaces in the class="" attribute.
     
  17. Amaury Chaser

    Joined:
    Jan 15, 2007
    Gender:
    Male
    Location:
    Ellensburg, WA
    1,694
    Upgrade, not update.
     
  18. Always Dance Chaser

    Joined:
    Feb 22, 2009
    220
    I didn't know that...thank you, Makaze. I'd rep you but I can't.
     
  19. Makaze Some kind of mercenary

    Joined:
    Jan 22, 2011
    Location:
    The Matinée
    1,207
    This is why it is useful to know all of the client-side coding instead of just one language; they all tie together on our end.

    You are welcome. Feel free to ask me to debug things, and I will see if I can help.