div id for head tag java script

brandofamilybrandofamily Registered Users Posts: 2,013 Major grins
I have this code in my head tag (got it from a fellow SMer) no lecture on how it can be disabled please, or that it is not really needed...
<***script language="JavaScript">
<*** if (window.event) 
{ ***var srcEl = event.srcElement ? event.srcElement : event.target; }
  else 
{*** var srcEl = e.srcElement ? e.srcElement : e.target; }
  if (srcEl.tagName.toLowerCase() == 'img') {
  window.alert(rightClickWarning);
  return false; }
  else 
{*** return true; } }

var rightClickWarning = "All images on this site are the sole property of Anthony Brandolino- Brandolino Imaging and subject to protection under copyright and other intellectual proprty law.  All unauthorised use is prohibited.  Refer to the 'All Rights Reserved' link below.";
//-->
<***/script>

Can it be wrapped in a div id, so I can turn it off in selected galleries..?
Happy Easter...

Comments

  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited April 17, 2006
    Anthony,

    Here a method you can use to do it on a gallery basis, I have used two of your galleries. You could also do these on a category or sub-category basis.
    <***script language="JavaScript">
    if (isClass("gallery_1076298") || isClass("gallery_1078359"))
    {
      if (window.event) 
      {var srcEl = event.srcElement ? event.srcElement : event.target; }
       else 
      {var srcEl = e.srcElement ? e.srcElement : e.target; }
       if (srcEl.tagName.toLowerCase() == 'img') {
       window.alert(rightClickWarning);
       return false; }
       else 
      { return true; } }
    }
    
    var rightClickWarning = "All images on this site are the sole property of Anthony Brandolino- Brandolino Imaging and subject to protection under copyright and other intellectual proprty law.  All unauthorised use is prohibited.  Refer to the 'All Rights Reserved' link below.";
    //-->
    <***/script>
    

    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
  • brandofamilybrandofamily Registered Users Posts: 2,013 Major grins
    edited April 17, 2006
    devbobo wrote:
    Anthony,

    Here a method you can use to do it on a gallery basis, I have used two of your galleries. You could also do these on a category or sub-category basis.
    <***script language="JavaScript">
    if (isClass("gallery_1076298") || isClass("gallery_1078359"))
    {
      if (window.event) 
      {var srcEl = event.srcElement ? event.srcElement : event.target; }
       else 
      {var srcEl = e.srcElement ? e.srcElement : e.target; }
       if (srcEl.tagName.toLowerCase() == 'img') {
       window.alert(rightClickWarning);
       return false; }
       else 
      { return true; } }
    }
    
    var rightClickWarning = "All images on this site are the sole property of Anthony Brandolino- Brandolino Imaging and subject to protection under copyright and other intellectual proprty law.  All unauthorised use is prohibited.  Refer to the 'All Rights Reserved' link below.";
    //-->
    <***/script>
    

    Cheers,

    David
    Thanks David. Is there a way to "exclude" only one gallery w/o using the code to "include" all the others? I'm not sure it that makes sense. But basically I want ALL galleries except one to be effected by this code. That's ALOT of galleries. :): I'm sure I could add each gallery to the code and then remember to add each new gallery to that code, but it would be easier to just "exclude" the one I do not want effected....Thanks for the help...

    Is there a way to code using "if not"? Like if it's "not" this gallery then apply this function?
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited April 17, 2006
    yes
    if (!isClass("gallery_1076298"))
    
    David Parry
    SmugMug API Developer
    My Photos
  • brandofamilybrandofamily Registered Users Posts: 2,013 Major grins
    edited April 17, 2006
    devbobo wrote:
    yes
    if (!isClass("gallery_1076298"))
    

    Thanks David...that's what I was looking for....I figured, from my high school/ college days of programing, that there had to be a "not" method. But I do not know CSS or Java very well....mostly only what you all show me...
Sign In or Register to comment.