Hey, hackers!

DavidTODavidTO Registered Users, Retired Mod Posts: 19,160 Major grins
Wondering, is it possible to have a check box hacked into a gallery for when you're logged in only that could turn originals on/off?
Moderator Emeritus
Dgrin FAQ | Me | Workshops

Comments

  • AndyAndy Registered Users Posts: 50,016 Major grins
    edited March 31, 2006
    DavidTO wrote:
    Wondering, is it possible to have a check box hacked into a gallery for when you're logged in only that could turn originals on/off?

    Not a check box but a radio button.
  • DavidTODavidTO Registered Users, Retired Mod Posts: 19,160 Major grins
    edited March 31, 2006
    Andy wrote:
    Not a check box but a radio button.


    right again, Andy!
    Moderator Emeritus
    Dgrin FAQ | Me | Workshops
  • AndyAndy Registered Users Posts: 50,016 Major grins
    edited March 31, 2006
    DavidTO wrote:
    right again, Andy!

    I'm just sayin'
  • rainforest1155rainforest1155 Registered Users Posts: 4,566 Major grins
    edited April 1, 2006
    Andy wrote:
    Not a check box but a radio button.
    Would work great with a check box to as there are only to possible states - on or off...originals on = check, originals off = uncheck.mwink.gif
    The check box would also take fewer space on the screen.

    Sebastian
    Sebastian
    SmugMug Support Hero
  • AndyAndy Registered Users Posts: 50,016 Major grins
    edited April 1, 2006
    Would work great with a check box to as there are only to possible states - on or off...originals on = check, originals off = uncheck.mwink.gif
    The check box would also take fewer space on the screen.

    Sebastian

    :nono my (sarcastic) point to David was it's not a "box" but a "button" lol3.gif
  • rainforest1155rainforest1155 Registered Users Posts: 4,566 Major grins
    edited April 1, 2006
    Andy wrote:
    :nono my (sarcastic) point to David was it's not a "box" but a "button" <img src="https://us.v-cdn.net/6029383/emoji/lol3.gif&quot; border="0" alt="" >
    I've been serious and I thought he meant this which is called a checkbox according to the source code and would work very good for such a script. <img src="https://us.v-cdn.net/6029383/emoji/mwink.gif&quot; border="0" alt="" >
    <FORM action=input_checkbox.htm>
    <*form action="input_checkbox.htm">
        <*input type="checkbox" name="zutat" value="salami"> Salami
        <*input type="checkbox" name="zutat" value="pilze"> Pilze
        <*input type="checkbox" name="zutat" value="sardellen"> Sardellen
    <*/form>
    </FORM>
    

    Sebastian
    Sebastian
    SmugMug Support Hero
  • DavidTODavidTO Registered Users, Retired Mod Posts: 19,160 Major grins
    edited April 1, 2006
    I've been serious and I thought he meant this which is called a checkbox according to the source code and would work very good for such a script. <img src="https://us.v-cdn.net/6029383/emoji/mwink.gif&quot; border="0" alt="" >
    <FORM action=input_checkbox.htm>
    <*form action="input_checkbox.htm">
        <*input type="checkbox" name="zutat" value="salami"> Salami
        <*input type="checkbox" name="zutat" value="pilze"> Pilze
        <*input type="checkbox" name="zutat" value="sardellen"> Sardellen
    <*/form>
    </FORM>
    

    Sebastian


    I dunno if it's the same in the Windows world, but for Macs a check box is only for when there are multiple options, and a radio button is for one single option. On or off.

    Either way, can someone get that working?
    Moderator Emeritus
    Dgrin FAQ | Me | Workshops
  • DavidTODavidTO Registered Users, Retired Mod Posts: 19,160 Major grins
    edited April 1, 2006
    While all you hackers are stewing on my fascinating question, I have another for you.

    Can the code below be modified to *remove* the cart text? Not replace, but remove?
    onload  = redoCart;
    function redoCart() {
       bodyClass = document.getElementsByTagName("body")[0].className;
       if (bodyClass.indexOf("smugmug") != -1 || bodyClass.indexOf("journal") != -1 || bodyClass.indexOf("default") != -1 || bodyClass.indexOf("singleImage") != -1) {
          topCart = document.getElementById("albumNav_top").innerHTML;
          topCart = topCart.replace('this photo','just this photo');
          topCart = topCart.replace('multiple photos','this photo and others');
          document.getElementById("albumNav_top").innerHTML = topCart;
       }
    }
    
    Moderator Emeritus
    Dgrin FAQ | Me | Workshops
  • DavidTODavidTO Registered Users, Retired Mod Posts: 19,160 Major grins
    edited April 1, 2006
    What I'm getting at here is that I want only the mulitple photos cart to show up.

    So that it looks like this:
    Moderator Emeritus
    Dgrin FAQ | Me | Workshops
  • DavidTODavidTO Registered Users, Retired Mod Posts: 19,160 Major grins
    edited April 10, 2006
    DavidTO wrote:
    What I'm getting at here is that I want only the mulitple photos cart to show up.

    So that it looks like this:


    Bump so that Ivar can help me with the JS to rid myself of the "Buy This Photo" text and button and leave me only with the bulk cart that says only "Buy" (see above).

    :D
    Moderator Emeritus
    Dgrin FAQ | Me | Workshops
  • AndyAndy Registered Users Posts: 50,016 Major grins
    edited April 10, 2006
    DavidTO wrote:
    Bump so that Ivar can help me with the JS to rid myself of the "Buy This Photo" text and button and leave me only with the bulk cart that says only "Buy" (see above).

    :D
    Just tried this, this works for smugmug style for sure - didn't test the other styles. Just replace the alternate text with nothing (delete it). Have to further hack this for all viewing styles, and also for cat bottom, I think?
    onload  = redoCart;
    function redoCart() {
       bodyClass = document.getElementsByTagName("body")[0].className;
       if (bodyClass.indexOf("smugmug") != -1 || bodyClass.indexOf("journal") != -1 || bodyClass.indexOf("default") != -1 || bodyClass.indexOf("singleImage") != -1) {
          topCart = document.getElementById("albumNav_top").innerHTML;
          topCart = topCart.replace('this photo','');
          topCart = topCart.replace('multiple photos','');
          document.getElementById("albumNav_top").innerHTML = topCart;
       }
    }
    
  • ivarivar Registered Users Posts: 8,395 Major grins
    edited April 10, 2006
    DavidTO wrote:
    Bump so that Ivar can help me with the JS to rid myself of the "Buy This Photo" text and button and leave me only with the bulk cart that says only "Buy" (see above).

    :D
    Is that good or bad that people start bumping posts specifically for me? :D Have no fear, Ivar is here rolleyes1.gif
    Andy wrote:
    Just tried this, this works for smugmug style for sure - didn't test the other styles. Just replace the alternate text with nothing (delete it). Have to further hack this for all viewing styles, and also for cat bottom, I think?
    onload  = redoCart;
    function redoCart() {
       bodyClass = document.getElementsByTagName("body")[0].className;
       if (bodyClass.indexOf("smugmug") != -1 || bodyClass.indexOf("journal") != -1 || bodyClass.indexOf("default") != -1 || bodyClass.indexOf("singleImage") != -1) {
          topCart = document.getElementById("albumNav_top").innerHTML;
          topCart = topCart.replace('this photo','');
          topCart = topCart.replace('multiple photos','');
          document.getElementById("albumNav_top").innerHTML = topCart;
       }
    }
    
    What you had Andy should work, but make sure you call it with the first line. It can be done easier i think.
    addEvent(window, "load", redoCart);
    function redoCart() {
    topCart = document.getElementById("albumNav_top").innerHTML;
    if (topCart != null) {
          topCart = topCart.replace('this photo','');
          topCart = topCart.replace('multiple photos','');
          document.getElementById("albumNav_top").innerHTML = topCart;
       }
    }
    
  • DavidTODavidTO Registered Users, Retired Mod Posts: 19,160 Major grins
    edited April 10, 2006
    ivar wrote:
    Is that good or bad that people start bumping posts specifically for me? :D Have no fear, Ivar is here rolleyes1.gif
    :D
    What you had Andy should work, but make sure you call it with the first line. It can be done easier i think.


    I tried what Andy had, and had little luck.

    Anyway, I took the code that you gave me, Ivar, and tweaked it some, because in some views I was still left with "photo", so I added a line trying to get that out, and it didn't seem to help. I also wanted to change "view cart" to "cart", and that's hit and miss, too. As you change the viewing style you're just as likely to get it working as not...any more ideas?
    /*changes shopping cart text*/
    addEvent(window, "load", redoCart);
    function redoCart() {
    topCart = document.getElementById("albumNav_top").innerHTML;
    if (topCart != null) {
          topCart = topCart.replace('this photo','');
          topCart = topCart.replace('multiple photos','');
          topCart = topCart.replace('photo','');
          topCart = topCart.replace('photos','');
          topCart = topCart.replace('view cart','cart');
          document.getElementById("albumNav_top").innerHTML = topCart;
       }
    }
    

    I also have this in my CSS:
    /*removes single photo purchase icon */
    .cartbuttons img.cart_add {display: none;}
    

    Thanks for the help, Ivar.
    Moderator Emeritus
    Dgrin FAQ | Me | Workshops
  • ivarivar Registered Users Posts: 8,395 Major grins
    edited April 10, 2006
    DavidTO wrote:
    :D



    I tried what Andy had, and had little luck.

    Anyway, I took the code that you gave me, Ivar, and tweaked it some, because in some views I was still left with "photo", so I added a line trying to get that out, and it didn't seem to help. I also wanted to change "view cart" to "cart", and that's hit and miss, too. As you change the viewing style you're just as likely to get it working as not...any more ideas?
    /*changes shopping cart text*/
    addEvent(window, "load", redoCart);
    function redoCart() {
    topCart = document.getElementById("albumNav_top").innerHTML;
    if (topCart != null) {
          topCart = topCart.replace('this photo','');
          topCart = topCart.replace('multiple photos','');
          topCart = topCart.replace('photo','');
          topCart = topCart.replace('photos','');
          topCart = topCart.replace('view cart','cart');
          document.getElementById("albumNav_top").innerHTML = topCart;
       }
    }
    
    I also have this in my CSS:
    /*removes single photo purchase icon */
    .cartbuttons img.cart_add {display: none;}
    
    Thanks for the help, Ivar.
    I think i know what's going on here, try the following:
    addEvent(window, "load", redoCart);
    function redoCart() 
    {
       for ( i=0; i<2; i++ ) 
       {
          topCart = document.getElementById("albumNav_top").innerHTML;
          if (topCart != null) 
          {
             topCart = topCart.replace('this photo','');
             topCart = topCart.replace('multiple photos','');
             topCart = topCart.replace('photos','');
             topCart = topCart.replace('photo','');
             document.getElementById("albumNav_top").innerHTML = topCart;
          }
       }
    }
    
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited April 13, 2006
    [UPDATED] - minor bug
    ok guys...i rewrote this hack a little different, it works with all styles and does both header and footer cart icons.
    addEvent(window, "load", redoCart);
    function redoCart() {
      oList = getElementsByClass("cartbuttons");
    
      for (var i=0; i < oList.length ; i++)
      {
        aList = oList[i].getElementsByTagName("a");
        for (var j=0; j < aList.length ; j++)
          aList[j].parentNode.removeChild(aList[j]);
    
        bList = getElementsByClass("cart_add", oList[i], "img");
        for (var k=0; k < bList.length ; k++)
          bList[k].parentNode.removeChild(bList[k]);
        oList[i].innerHTML = oList[i].innerHTML.replace(/\|/gi, '&amp;nbsp;&lt;span class="title"&gt;cart:&lt;/span&gt;')
      }
    }
    
    function getElementsByClass(searchClass,node,tag) {
        var classElements = new Array();
        if ( node == null )
            node = document;
        if ( tag == null )
            tag = '*';
        var els = node.getElementsByTagName(tag);
        var elsLen = els.length;
        var pattern = new RegExp("(^| )" + searchClass + "( |$)");
        for (var i = 0, j = 0; i < elsLen; i++) {
            if ( pattern.test(els[i].className) ) {
                classElements[j] = els[i];
                j++;
            }
        }
        return classElements;
    }
    
    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
  • AndyAndy Registered Users Posts: 50,016 Major grins
    edited April 13, 2006
    Thanks David!
  • shfayashfaya Registered Users Posts: 59 Big grins
    edited November 21, 2008
    Sorry i don't get where it goes. I tryed to paste it in few places but there is only some coding getting displayed on the front page.
    www.mirophoto.com
    Miro Slav
    www.mirophoto.com
    smooth photography of...
  • avmanavman Registered Users Posts: 60 Big grins
    edited May 29, 2009
    devbobo wrote:
    [UPDATED] - minor bug
    ok guys...i rewrote this hack a little different, it works with all styles and does both header and footer cart icons.
    addEvent(window, "load", redoCart);
    function redoCart() {
      oList = getElementsByClass("cartbuttons");
    
      for (var i=0; i < oList.length ; i++)
      {
        aList = oList[i].getElementsByTagName("a");
        for (var j=0; j < aList.length ; j++)
          aList[j].parentNode.removeChild(aList[j]);
    
        bList = getElementsByClass("cart_add", oList[i], "img");
        for (var k=0; k < bList.length ; k++)
          bList[k].parentNode.removeChild(bList[k]);
        oList[i].innerHTML = oList[i].innerHTML.replace(/\|/gi, '&amp;nbsp;&lt;span class="title"&gt;cart:&lt;/span&gt;')
      }
    }
    
    function getElementsByClass(searchClass,node,tag) {
        var classElements = new Array();
        if ( node == null )
            node = document;
        if ( tag == null )
            tag = '*';
        var els = node.getElementsByTagName(tag);
        var elsLen = els.length;
        var pattern = new RegExp("(^| )" + searchClass + "( |$)");
        for (var i = 0, j = 0; i < elsLen; i++) {
            if ( pattern.test(els[i].className) ) {
                classElements[j] = els[i];
                j++;
            }
        }
        return classElements;
    }
    
    Cheers,

    David
    Sir;
    very impressive. I am wondering if the text of the cart button can be reworded and text color changed in addition to the background color of the cart buttons? pick any gallery (avman.smugmug.com) and located above the cart button is a banner type button I placed there to draw attention to the the cart buttons. While proudly displaying the slide show I put on my home page, my friend went to click on the "banner" type button and did not receive a response. Then he told me he didn't even see the cart buttons! Please advise if this is doable and where the code above is placed. Thank you!

    Respectfully,

    Tom

    thee avman
    I really don't have anything nifty to say so I will remain quiet and observe!

    Tom

    http://avman.smugmug.com/
Sign In or Register to comment.