Request for hack help

RMacRMac Registered Users Posts: 54 Big grins
It was suggested by Andy that I post a request for help here. l
Let me start by saying I am no hacker and don't know html, javascript or css beyond what I've ppicked up in last couple weeks reading through the customizing forum.

I have a new site I want to use as photojournal, or photoblog. Here's the link:

http://rain-turning-to-showers.smugmug.com/gallery/1369407

The site will consist of a single gallery that I will add new images to semi-daily. I want my viewer to see the most recently uploaded image first and then navigate in reverse chronological oreder (back in time) by clicking "<prev".

The way it works now if I sort the gallery, ascendning 1-99 by when the images are uploaded it put's the images in chronological order. But by that doing the first image shown is the oldest image in the gallery, the first image to be uploaded.


If I reverse the order of the gallery to "descending 99-1" it will show the last image uploaded, the most recent image first.

However, the viewer will navigate backwards (chronologically) by clicking "next>" which is confusing chronologically.


I could achieve the desired result by EITHER changing the order images are displayed so the last image in the gallery is displayed first

OR

Reversing the actual function of the "<prev" and "next>" buttons.

SO my question is: Is there any way to reverse the actual functions of the "<prev" and "next> buttons, ie swith the code behind them?

OR

is there a way to have the last image in the gallery sort be the first image displayed?

I hope this is not too confusing. My previous requests for help in the customizing forum can be viewed her:

http://www.dgrin.com/showthread.php?t=32244

and

http://www.dgrin.com/showthread.php?t=32933

So far no one has been able to tell me how or if either of these are possible. Any help is appreciated.

Cheers,
Robbie

Comments

  • ivarivar Registered Users Posts: 8,395 Major grins
    edited April 29, 2006
    RMac wrote:
    SO my question is: Is there any way to reverse the actual functions of the "
    buttons, ie swith the code behind them?
    This is not really the most elegant solution, but i guess it works for now. It's not exactly what you asked for, I just reversed the words "Prev" and "Next".
    I guess it will be possible to keep the words, and change the links, but you'll have to ask someone else, because i need to study up on that :D

    Put this in your JavaScript window:
    function isClass(sClass) {
      sClassName = document.body.className;
      re = new RegExp(sClass + "( |$)") 
      if (!sClassName)
        return false;
      return re.test(sClassName);
    }  
    
    
    function changeNextPrev() {
       var temp;
       if (isClass("gallery_1369407")) {
          var objElement = document.getElementById("albumNav_top")
          if (objElement != null) {
             var str = new String(objElement.innerHTML);
             str = str.replace(/[COLOR=Yellow]& lt[/COLOR]; Prev/i, '[COLOR=Yellow]& lt[/COLOR]; Next')
             str = str.replace(/Next [COLOR=Yellow]& gt[/COLOR];/i, 'Prev [COLOR=Yellow]& gt[/COLOR]')
             objElement.innerHTML = str;
          }
       }
    }
    
    and this in your footer, without the stars
    <*script>changeNextPrev();<*/script>
    
    EDIT: Code changed, REMOVE THE SPACES BETWEEN THE YELLOW CHARACTERS IN YOUR JAVASCRIPT BOX
  • RMacRMac Registered Users Posts: 54 Big grins
    edited April 29, 2006
    Thanks Ivar. It ALMOST works. Checking it on Safari here's waht happens.

    When he first / most recent image is displayed,
    <Prev Next> have been reversed to:

    <Next Prev>

    Good so far. But when I click Prev> and go to the previous image it goes to this:

    <Prev Prev>

    Again here's the link:

    http://rain-turning-to-showers.smugmug.com/gallery/1369407

    And again, Thank You for helping try to solve this one.
  • ivarivar Registered Users Posts: 8,395 Major grins
    edited April 29, 2006
    RMac wrote:
    Thanks Ivar. It ALMOST works. Checking it on Safari here's waht happens.

    When he first / most recent image is displayed,

    have been reversed to:

    <next prev="">

    Good so far. But when I click Prev> and go to the previous image it goes to this:




    Again here's the link:

    http://rain-turning-to-showers.smugmug.com/gallery/1369407

    And again, Thank You for helping try to solve this one.
    I don't get to see what you mean (external linking?) but i saw what was happening on your site. I modified the code in the above post, see if that works for you. Don't forget about the new note with that post, remove the spaces after you have copied the text.
    </next>
  • RMacRMac Registered Users Posts: 54 Big grins
    edited April 29, 2006
    ivar wrote:
    I don't get to see what you mean (external linking?) but i saw what was happening on your site. I modified the code in the above post, see if that works for you. Don't forget about the new note with that post, remove the spaces after you have copied the text.
    That's working better. Your solution has gotten me very close. But as you said in your original post not exactly what I was hoping for, almost, but not exactly. In a perfect world I'd want the "prev" on the left and the "next" on the right. Any chance of making it look like:


    <prev next>

    but have them functioning as they are now? IN otherwords reverse their repspective positions?




    Again we are very close to what I'm lookin for. Many thanks for your expertise and work.
    Cheers,
    Robbie</prev>
  • RMacRMac Registered Users Posts: 54 Big grins
    edited May 4, 2006
    Maybe I should try another method?????
    Greetings Hackers,

    Just wondering, can I get rid of the current
    previous next
    buttons and replace them in a navigation bar? Anyone know how I'd go about doing this?
    Thanks again.
    Robbie
  • ivarivar Registered Users Posts: 8,395 Major grins
    edited May 5, 2006
    RMac wrote:
    Greetings Hackers,

    Just wondering, can I get rid of the current
    previous next
    buttons and replace them in a navigation bar? Anyone know how I'd go about doing this?
    Thanks again.
    Robbie
    It won't work in your nav-bar, because the link keeps changing on each click of prev/next..

    How about this; Instead of reversing the code for prev/next, why don't we change it to <newer older=""> or something like "<never" and="" older="">< newer" and "older >"?</never"></newer>
  • RMacRMac Registered Users Posts: 54 Big grins
    edited May 5, 2006
    ivar wrote:
    It won't work in your nav-bar, because the link keeps changing on each click of prev/next..

    How about this; Instead of reversing the code for prev/next, why don't we change it to <newer older=""> or something like "<never ="" and="" older="">< newer" and "older >"?</never></newer>
    Perfect!<img src="https://us.v-cdn.net/6029383/emoji/thumb.gif&quot; border="0" alt="" > , "< newer" and "older >"<newer ="" and="" older=""> would be great. Actually could we just use somthing like this, <<< and >>> ? Thanks again man, I really appreciate it.</newer>
  • RMacRMac Registered Users Posts: 54 Big grins
    edited May 6, 2006
    RMac wrote:
    Perfect!<img src="https://us.v-cdn.net/6029383/emoji/thumb.gif&quot; border="0" alt="" > , "< newer" and "older >"<newer ="" and="" older=""> would be great. Actually could we just use somthing like this, <<< and >>> ? Thanks again man, I really appreciate it.</newer>

    Hey Ivar,
    I mis-understood what you were saying in your last post, so disregard my suggestion of using only the arrow symbols ( <<< and >>>) Changing it to " < newer" and "older > " will be perfect. To do that I assume we go back to before the last couple of changes and simply change the words in the buttons. Is that done in css? Thanks, sorrry I'm so dense.
    Cheers,
    Robbie
  • ivarivar Registered Users Posts: 8,395 Major grins
    edited May 6, 2006
    RMac wrote:
    Hey Ivar,
    I mis-understood what you were saying in your last post, so disregard my suggestion of using only the arrow symbols ( <<< and >>>) Changing it to " < newer" and "older > " will be perfect. To do that I assume we go back to before the last couple of changes and simply change the words in the buttons. Is that done in css? Thanks, sorrry I'm so dense.
    Cheers,
    Robbie
    no css, it's changing the javascript, here is a new version with the older/newer:
    function isClass(sClass) {
      sClassName = document.body.className;
      re = new RegExp(sClass + "( |$)") 
      if (!sClassName)
        return false;
      return re.test(sClassName);
    }  
    
    
    function changeNextPrev() {
       var temp;
       if (isClass("gallery_1369407")) {
          var objElement = document.getElementById("albumNav_top")
          if (objElement != null) {
             var str = new String(objElement.innerHTML);
             str = str.replace(/[COLOR=Yellow]& lt[/COLOR]; Prev/i, '[COLOR=Yellow]& lt[/COLOR]; Newer')
             str = str.replace(/Next [COLOR=Yellow]& gt[/COLOR];/i, 'Older [COLOR=Yellow]& gt[/COLOR]')
             objElement.innerHTML = str;
          }
       }
    }
    
    Replace the old code with this, and remove the spaces between the yellow text.
  • RMacRMac Registered Users Posts: 54 Big grins
    edited May 7, 2006
    Brilliant! Thanks so very much. Now I can get on with the rest of it, the best part, loading pictures.
    Cheers,
    Robbie
Sign In or Register to comment.