Ignore:
Timestamp:
Jun 24, 2012, 9:26:25 PM (12 years ago)
Author:
grum
Message:

feature:2664- compatibility with Piwigo 2.4

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/gally/gally-default/js/gallyjs-tpp.js

    r12592 r16016  
    4444      },
    4545      container=null,
     46      initialThumbPos=null,
    4647
    4748  /**
     
    109110                        .bind("mousemove", function () { switchInterface('y', true); } );
    110111    }
    111 
    112 
    113     $("#navThumbPrev").css("top", $("#navThumbPrev").prop("offsetTop")+$("#theHeader").prop("offsetHeight")+$("#theHeaderAlt").prop("offsetHeight")+"px");
    114     $("#navThumbNext").css("top", $("#navThumbNext").prop("offsetTop")+$("#theHeader").prop("offsetHeight")+$("#theHeaderAlt").prop("offsetHeight")+"px");
    115 
    116     $("#theImage").css("top", $("#theImage").prop("offsetTop")+$("#theHeader").prop("offsetHeight")+$("#theHeaderAlt").prop("offsetHeight")+"px");
    117112
    118113    $("#contentid").attr("rows", options.commentRows);
     
    166161    );
    167162
     163    $("#icon_derivatives").click(function()
     164      {
     165        var elt = $("#derivativeSwitchBox");
     166
     167        elt.css("left", Math.min( $(this).position().left + $('#tabRandomButtons').outerWidth(true), $(window).width() - elt.outerWidth(true) - 5))
     168          .css("top", $(this).position().top)
     169          .toggle();
     170          $('#iSimpleTip').css('display', 'none'); // if tip activated, hide it..
     171      }
     172    );
     173    $("#derivativeSwitchBox, #privacyLevelBox").on("mouseleave click", function()
     174      {
     175        $(this).hide();
     176      }
     177    );
     178
     179    $('#iPrivacyLevelLink').click(function ()
     180      {
     181        var elt = $("#privacyLevelBox"),
     182            ePos = $("#privacyLevelLink");
     183
     184        elt.css("left", $(this).position().left)
     185           .css("top", $(this).position().top)
     186           .toggle();
     187      }
     188    );
     189
    168190    $(window).resize( function () { initializeImageMode("resize"); } );
    169191
     
    192214    var thumbWidth=0,
    193215        imgTop=0,
     216        imgPos='',
    194217        cssValues = new Object;
    195218
     
    272295      if($("#navThumbPrev").length>0)
    273296      {
    274         $("#navThumbPrev").css("height", $("#copyright").prop("offsetTop")-$("#navThumbPrev").prop("offsetTop")-options.tabsHidden+"px");
    275       }
    276       if($("#navThumbNext").length>0)
    277       {
    278         $("#navThumbNext").css("height", $("#copyright").prop("offsetTop")-$("#navThumbNext").prop("offsetTop")-options.tabsHidden+"px");
     297        initialThumbPos=$("#navThumbPrev").position().top;
     298      }
     299      else if($("#navThumbNext").length>0)
     300      {
     301        initialThumbPos=$("#navThumbNext").position().top;
     302      }
     303      else
     304      {
     305        initialThumbPos=-1;
    279306      }
    280307    }
     
    311338    }
    312339
    313 
    314 
     340    imgTop=initialThumbPos;
     341    //if position equals -1, mean top calculate it automatically - valid for "#navThumbPrev" & "#navThumbNext"
     342    if(imgTop==-1)
     343    {
     344      imgTop=$("#theImage").prop("offsetTop")+$("#theHeader").prop("offsetHeight")+$("#theHeaderAlt").prop("offsetHeight")+($("#theImgContainer").height()-$("#navThumbPrev").height())/2;
     345    }
     346
     347    $("#navThumbPrev")
     348        .css("top", imgTop)
     349        .css("height", $("#copyright").prop("offsetTop")-$("#navThumbPrev").prop("offsetTop")-options.tabsHidden+"px");
     350
     351    $("#navThumbNext")
     352        .css("top", imgTop)
     353        .css("height", $("#copyright").prop("offsetTop")-$("#navThumbNext").prop("offsetTop")-options.tabsHidden+"px");
     354
     355
     356    $("#theImage").css("top", $("#theImage").prop("offsetTop")+$("#theHeader").prop("offsetHeight")+$("#theHeaderAlt").prop("offsetHeight")+"px");
    315357
    316358    simulateHighRes();
     
    634676  };
    635677
     678  function changeImgSrc(url,typeSave,typeMap,cookiePath)
     679  {
     680    $("#theMainImage")
     681      .removeAttr("width height")
     682      .attr("src", url)
     683      .load(function ()
     684        {
     685          initializeImageMode("resize");
     686        }
     687      );
     688
     689    $('#derivativeSwitchBox .switchCheck').css('visibility','hidden');
     690    $('#derivativeChecked'+typeSave).css('visibility','visible');
     691
     692    document.cookie = 'picture_deriv='+typeSave+';path='+cookiePath;
     693  }
     694
     695  function setPrivacyLevel(rootUrl, id, level)
     696  {
     697    var y = new PwgWS(rootUrl);
     698
     699    y.callService(
     700      "pwg.images.setPrivacyLevel",
     701      {image_id: id, level:level} ,
     702      {
     703        method: "POST",
     704        onFailure: function(num, text) { alert(num + " " + text); },
     705        onSuccess: function(result) {
     706          jQuery('#privacyLevelBox .switchCheck').css('visibility','hidden');
     707          jQuery('#levelCheck'+level).css('visibility','visible');
     708        }
     709      }
     710    );
     711  }
    636712
    637713  this.closeDisplayHigh = function () { closeDisplayHigh(); };
     
    641717  this.getTabsProp = function () { return tabs; };
    642718  this.openDisplayHigh = function (url) { openDisplayHigh(url); };
     719  this.changeImgSrc = function (url,typeSave,typeMap,cookiePath) { changeImgSrc(url,typeSave,typeMap,cookiePath); };
     720  this.setPrivacyLevel = function (rootUrl, id, level) { setPrivacyLevel(rootUrl, id, level); };
    643721
    644722  init();
Note: See TracChangeset for help on using the changeset viewer.