Need help getting started with a hack...

ruttrutt Registered Users Posts: 6,511 Major grins
I want to reporpose the thumbs-up/down code so that my clients at Boston Ballet can use it to express approval of or veto particular shots. Instead of reporting a vote to smugmug's popularity contest, the vote would instead be reported to a website I can access. Ideally, I'd be able to know who actually voted.

I've raised this issue before because I think it would be a swell way for professionals to interact with their clients. For example, a wedding photographer could use it to cull shots for an online album. I think the possible uses are myriad.

Ideally, smugmug itself could support this capability and the interface could make it clear exactly how the results would be used (for popular or otherwise.) I've made that feature request more than once, so I think that the smugmug team doesn't find it worth doing. So, I'd like to try to do it myself as a JS hack.

The security of the smugmug photorank system is not threatened because (at last as of a few years ago) it worked by presenting the thumbs in a random order. The client reported the votes based on which side was chosen. Only the server could map side to up/down vote because only it know in which order the thumbs were presented. I suppose it might be possible for the client to try to recognize the two kinds of votes and thereby know which kind of vote was being made (and possibly even change it to fake out the system.) So I suppose there is a sense in which the photorank system cannot be made totally secure without more work than it's probably worth. The flip side is that the crack I have just described is also probably a lot more work than it's worth. Ruling the smugmug popularity contests and a couple of dollars will get you a coffee at Starbucks.

So I just want a little help reading the code. An important part of the action seems to be in the function smugPopularVote. Yet I cannot figure out where this is invoked or added to a class's methods. What am I missing? I think I could probably untangle things if I knew this.
If not now, when?

Comments

  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited November 15, 2008
    rutt wrote:
    I want to reporpose the thumbs-up/down code so that my clients at Boston Ballet can use it to express approval of or veto particular shots. Instead of reporting a vote to smugmug's popularity contest, the vote would instead be reported to a website I can access. Ideally, I'd be able to know who actually voted.

    I've raised this issue before because I think it would be a swell way for professionals to interact with their clients. For example, a wedding photographer could use it to cull shots for an online album. I think the possible uses are myriad.

    Ideally, smugmug itself could support this capability and the interface could make it clear exactly how the results would be used (for popular or otherwise.) I've made that feature request more than once, so I think that the smugmug team doesn't find it worth doing. So, I'd like to try to do it myself as a JS hack.

    The security of the smugmug photorank system is not threatened because (at last as of a few years ago) it worked by presenting the thumbs in a random order. The client reported the votes based on which side was chosen. Only the server could map side to up/down vote because only it know in which order the thumbs were presented. I suppose it might be possible for the client to try to recognize the two kinds of votes and thereby know which kind of vote was being made (and possibly even change it to fake out the system.) So I suppose there is a sense in which the photorank system cannot be made totally secure without more work than it's probably worth. The flip side is that the crack I have just described is also probably a lot more work than it's worth. Ruling the smugmug popularity contests and a couple of dollars will get you a coffee at Starbucks.

    So I just want a little help reading the code. An important part of the action seems to be in the function smugPopularVote. Yet I cannot figure out where this is invoked or added to a class's methods. What am I missing? I think I could probably untangle things if I knew this.

    smugPopularVote is invoked via a call like:

    javascript:smugPopularVote('Right','344290698','AaG2k');

    that comes right off the link surrounding the thumbs up/down images in the photo bar. You won't see this in the page source because the photobar is dynamically created via javascript as needed in a function called photoHover.
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • ruttrutt Registered Users Posts: 6,511 Major grins
    edited November 15, 2008
    jfriend wrote:
    smugPopularVote is invoked via a call like:

    javascript:smugPopularVote('Right','344290698','AaG2k');

    that comes right off the link surrounding the thumbs up/down images in the photo bar. You won't see this in the page source because the photobar is dynamically created via javascript as needed in a function called photoHover.

    And how about photoHover itself? I'm having trouble finding its definition in the sources.
    If not now, when?
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited November 15, 2008
    rutt wrote:
    And how about photoHover itself? I'm having trouble finding its definition in the sources.

    function photoHover is in the gallery_ajax javascript file.

    If you're trying to figure out how they do something, you might want to do what I've done. I go into Web Developer (Firefox add-in) and do Tools/Web Developer/Information/View Javascript. That gives you all the javascript files in one browser window. You can search directly in that window and find any function. But, all the source files have been compressed (whitespace removed, many linebreaks removed, etc...). So, I use Collapse All to get just the listing of files, then one by one, I save them all the JS source files to my hard disk. Then, I use this site to reformat the JS files to make them readable again. Then, I paste all the beautified javascript back together into one giant file to make it easy to search everything. That gives me a nice searchable and readable version of all the JS sources. From that you can pretty much figure out how anything works.
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
Sign In or Register to comment.