Options

Hidden "Hide Photo" Keyboard Shortcut

2»

Comments

  • Options
    SamirDSamirD Registered Users Posts: 3,474 Major grins
    edited July 14, 2009
    com3 wrote:
    yeah, it's a blast. i don't know how i ever did the 9-5 gigs. haha!
    I wish I had enough funding to do what you do. Maybe I'll just upgrade my equipment and join your group. :D
    Pictures and Videos of the Huntsville Car Scene: www.huntsvillecarscene.com
    Want faster uploading? Vote for FTP!
  • Options
    jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited July 14, 2009
    SamirD wrote:
    And this would need to come from SM. But it would be interesting what can be done with javascript. This would probably do what you want. jfriend?
    This is not coming from SM (I don't work for SM), but here's a script that assigns the "x" key to the delete option. Like we discussed, it gives you nearly the same function as Tools/This Photo/Delete (it will prompt for confirmation), but you can just press a single key to get there.

    I say "nearly" the same function because, when using the shortcut key, I fixed the function so that after deleting an image, it goes to the next image in the gallery rather than reverting back to the first image in the gallery after the delete (which is what Smugmug's Tools menu option does).

    To use this, just paste this code into your bottom javascript. I've tried it on Firefox 3.5, IE7 and Safari 4.0.2 (all on Windows Vista). I think it should work elsewhere too, but it's caveat emptor.
    //----------------------------------------------------------------------------
    //  This is a script to assign the "x" key as a shortcut key 
    // for Tools/This Photo/Delete.
    //----------------------------------------------------------------------------
    // only install this keystroke handler if we're logged in
    if (YD.hasClass(document.body, "loggedIn"))
    {
        YE.onContentReady("smugmug", ConfigureKeyHandlers);
    }
    
    function GetKeyCode(letter)
    {
        return(letter.charCodeAt(0));
    }
    
    function ConfigureKeyHandlers()
    {
        // lowercase x key
        var keyhandler1 = new YAHOO.util.KeyListener(document, {keys:GetKeyCode("X")}, HandleKeyFunc);
        keyhandler1.enable();
        // uppercase x key    
        var keyhandler2 = new YAHOO.util.KeyListener(document, {shift:true, keys:GetKeyCode("X")}, HandleKeyFunc);
        keyhandler2.enable();
        
        function HandleKeyFunc(type, args, obj)
        {
            // find out what object the key was targeted to
            var nodeName = YE.getTarget(args[1]).nodeName.toLowerCase();
            // don't do anything if the key is in an input field or a text area
            if (nodeName == "input" || nodeName == "textarea" || nodeName == "select")
            {
                return;        // do nothing
            }
            // http://jfriend.smugmug.com/photos/tools.mg?ImageID=344290962&ImageKey=h6JjS&tool=delete&url=http%3A%2F%2Fjfriend.smugmug.com%2Fgallery%2F5608869_vwzCG%23344290962_h6JjS
            // find the next image in the view so after deletion, we take the user there
            var nextImageID = null;
            var nextLocation = location.href;        // default to current location
            for (var i = 0; i < imageIDs.length; i++)
            {
                if (imageIDs[i] == ImageID)
                {
                    // fetch the next imageID (if there is one)
                    if ((i + 1) < imageIDs.length)    
                    {
                        nextImageID = imageIDs[i + 1];
                    }
                    // fetch the previous imageID (if there is one)
                    else if (i > 0)
                    {
                        nextImageID = imageIDs[i - 1];
                    }
                    break;
                }
            }
            if (nextImageID)
            {
                // construct the URL for the next image so we don't lose our place in the view after deleting
                var nextImageKey = photoInfo[nextImageID].ImageKey;
                var curLocation = new String;
                curLocation = location.href;
                nextLocation = curLocation.replace(/#.*$/, "#" + nextImageID + "_" + nextImageKey);
            }
            location.href = "/photos/tools.mg?ImageID=" + ImageID + "&ImageKey=" + ImageKey + "&tool=delete&url=" + encodeURIComponent(nextLocation);
        }
    }
    
    
    

    The script requires you to be logged in (since that is when the delete function is enabled) and is only coded to work in the Smugmug view. In some browsers, you may have to click somewhere in the browser window before the shortcut keystroke will work.
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • Options
    AllenAllen Registered Users Posts: 10,011 Major grins
    edited July 14, 2009
    jfriend wrote:
    This is not coming from SM (I don't work for SM), but here's a script that assigns the "x" key to the delete option. Like we discussed, it gives you nearly the same function as Tools/This Photo/Delete (it will prompt for confirmation), but you can just press a single key to get there.
    ..
    Does it know the cntl-x is not the "x" key? Smug is set that "a" opens
    lightbox but cntl-a also opens lightbox. PITA when trying to select all.
    Al - Just a volunteer here having fun
    My Website index | My Blog
  • Options
    jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited July 14, 2009
    Allen wrote:
    Does it know the cntl-x is not the "x" key? Smug is set that "a" opens
    lightbox but cntl-a also opens lightbox. PITA when trying to select all.
    Yes, it knows the difference. It's set to trigger on x or shift-x only and not when those keystrokes are used in any place that allows typing.
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • Options
    AllenAllen Registered Users Posts: 10,011 Major grins
    edited July 14, 2009
    jfriend wrote:
    Yes, it knows the difference. It's set to trigger on x or shift-x only and not when those keystrokes are used in any place that allows typing.
    Why can't Smugmug do the same with their keyboard shortcut keys?
    Al - Just a volunteer here having fun
    My Website index | My Blog
  • Options
    jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited July 14, 2009
    Allen wrote:
    Why can't Smugmug do the same with their keyboard shortcut keys?
    They could. It's just a matter of how it's coded. Their code for that shortcut doesn't even look at the ctrl key state. It does avoid the alt key.
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • Options
    SamirDSamirD Registered Users Posts: 3,474 Major grins
    edited July 14, 2009
    Wow, that's some great code, jfriend!

    I wonder if you know how to feed a html form into a javascript function. I was trying to help someone in this thread: http://www.dgrin.com/showthread.php?t=134755

    I'm not a programmer and I came up with something that saves him time, but I know there's even a better way to do it.
    Pictures and Videos of the Huntsville Car Scene: www.huntsvillecarscene.com
    Want faster uploading? Vote for FTP!
  • Options
    jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited July 14, 2009
    Allen wrote:
    Why can't Smugmug do the same with their keyboard shortcut keys?
    Allen, if you copy this code into your bottom javascript, it will block Smugmug's shortcut keys from firing when the ctrl-key is pressed so that things like Ctrl-A can do their normal job. This hack is specific to Smugmug's current implementation. If they change the way they handle keys, it could stop working in the future, but probably would just harmlessly stop working.
    // ---------------------------------------------------------------------------------------------------------------
    // Code to block some of Smugmugs key accelerators from firing when the Ctrl key is pressed
    // ---------------------------------------------------------------------------------------------------------------
    var oldKeyDownFunc;
    if (typeof(keyDown) == "function")
    {
        oldKeyDownFunc = keyDown;
        keyDown = myKeyDown;
    }
    
    function myKeyDown(e)
    {
        if (!e.ctrlKey)
        {
            return(oldKeyDownFunc(e));
        }
    }
    
    
    
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • Options
    AllenAllen Registered Users Posts: 10,011 Major grins
    edited July 14, 2009
    jfriend wrote:
    ...
    That works great .... however it's only on my site. Many times when checking
    other sites I use cntl-a to highlight everything on a page looking for things like
    hidden text and divs. Text like white on white.

    I really need a script directed at any Smugmug style gallery. Can
    Greasemonkey be used for this?
    Al - Just a volunteer here having fun
    My Website index | My Blog
  • Options
    jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited July 14, 2009
    Allen wrote:
    That works great .... however it's only on my site. Many times when checking
    other sites I use cntl-a to highlight everything on a page looking for things like
    hidden text and divs. Text like white on white.

    I really need a script directed at any Smugmug style gallery. Can
    Greasemonkey be used for this?
    GreaseMonkey can probably be used to do that, but I haven't done any GreaseMonkey stuff in quite awhile so I'm not really sure.
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • Options
    com3com3 Registered Users Posts: 423 Major grins
    edited July 14, 2009
    jfriend wrote:
    This is not coming from SM


    MY. HERO.
  • Options
    SamirDSamirD Registered Users Posts: 3,474 Major grins
    edited November 16, 2009
    Going back to the original topic, I just accidently hit "H" while in the lightbox and saw the "hiding photo" in the upper left corner, but it didn't actually hide the photo from what I can tell. When I hit it again, it displayed "unhiding photo". I have the same gallery open in another window in std smugmug view for checking and it didn't show that the images are hiding/unhiding. ne_nau.gif

    Does this work in lightbox view, or did I discover some sort of bug. headscratch.gif
    Pictures and Videos of the Huntsville Car Scene: www.huntsvillecarscene.com
    Want faster uploading? Vote for FTP!
  • Options
    ps56kps56k Registered Users Posts: 11 Big grins
    edited September 5, 2010
    SamirD wrote: »
    I used to take the time to delete, but when you can just hide it, why not just do that instead? headscratch.gif

    How can I find all the "hidden" photos within a Gallery...

    I tend to hide similar shots and then later decide to delete them.... but now I have to go thru the entire gallery and look for the checkmarked & hidden ones.
  • Options
    SamirDSamirD Registered Users Posts: 3,474 Major grins
    edited September 5, 2010
    ps56k wrote: »
    How can I find all the "hidden" photos within a Gallery...

    I tend to hide similar shots and then later decide to delete them.... but now I have to go thru the entire gallery and look for the checkmarked & hidden ones.
    Check out the hidden image utility here. I think it will do exactly what you want:
    http://smugroom.com/tools/
    Pictures and Videos of the Huntsville Car Scene: www.huntsvillecarscene.com
    Want faster uploading? Vote for FTP!
  • Options
    WinsomeWorksWinsomeWorks Registered Users Posts: 1,935 Major grins
    edited September 6, 2010
    Vote in UserVoice for ability to work with hidden thumbs easier
    SamirD wrote: »
    Check out the hidden image utility here. I think it will do exactly what you want:
    http://smugroom.com/tools/
    Wow, I wish I'd have known about that earlier. Only thing is, I'm trying it right now and it's loading all the thumbs of hidden photos, which takes a long time. I thought it said it was a text (list) version. Also, for PS56k -- Here's a request on UserVoice Forum for making it easier to see & work with hidden image in a gallery: http://feedback.smugmug.com/forums/17723-smugmug/suggestions/289143-clearly-indentify-hidden-photos-and-make-it-easi If you vote for it, maybe it'll happen! Its status at least says "planned". The problem right now is that if you want to do a "Many Photos"> "Delete" you can't see which thumbs are hidden. JFriend does have a nice customization that helps a lot, by putting red Xes in the corner of each hidden thumb. But you can't see the red Xes within the tools. Here's JFriend's customization; it's Customiztion #22 in Post #1 of that thread: http://www.digitalgrin.com/showthread.php?t=135068&page=11
    Anna Lisa Yoder's Images - http://winsomeworks.com ... Handmade Photo Notecards: http://winsomeworks.etsy.com ... Framed/Matted work: http://anna-lisa-yoder.artistwebsites.com/galleries.html ... Scribbles: http://winsomeworks.blogspot.com
    DayBreak, my Folk Music Group (some free mp3s!) http://daybreakfolk.com
  • Options
    darryldarryl Registered Users Posts: 997 Major grins
    edited May 18, 2015
    Do I win for resurrecting the oldest thread today?

    So I *finally* converted my SmugMug site to the new format. Hahah, yes, I was a holdout until now.

    And I find that the H for Hide keyboard shortcut has been killed!? Oh man, let me go back!!

    But seriously. How hard would it be to add this back in? Maybe just in the Organize View? How about a JS hack? Man, what a drag.

    NO, batch select and hide is not a viable workaround. The whole beauty of the Hide shortcut was being able to triage your images in a Large view and quickly hide the ones that are not keepers.

    Yes, there was a Feedback filed or this. No, it is not complete.: http://feedback.smugmug.com/forums/17723-smugmug/suggestions/4251063-improve-hiding-capabilities-of-new-smugmug
Sign In or Register to comment.