Ignore:
Timestamp:
2019-06-15T15:28:01+12:00 (5 years ago)
Author:
davidb
Message:

Moved two functions from document script to utility script so they are available to other pages as well (e.g. berrybasket tearaway on search and browse pages)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/default/js/utility_scripts.js

    r33016 r33155  
    8787    return url_encoded;
    8888}
     89
     90/***************
     91* MENU SCRIPTS *
     92***************/
     93function moveScroller() {
     94  var move = function() {
     95    var editbar = $("#editBar");
     96    var st = $(window).scrollTop();
     97    var fa = $("#float-anchor").offset().top;
     98    if(st > fa) {
     99     
     100      editbar.css({
     101      position: "fixed",
     102        top: "0px",
     103        width: editbar.data("width"),
     104        //width: "30%"
     105            });
     106    } else {
     107      editbar.data("width", editbar.css("width"));
     108      editbar.css({
     109      position: "relative",
     110        top: "",
     111        width: ""
     112        });
     113    }
     114  };
     115  $(window).scroll(move);
     116  move();
     117}
     118
     119
     120function floatMenu(enabled)
     121{
     122    var menu = $(".tableOfContentsContainer");
     123    if(enabled)
     124    {
     125        menu.data("position", menu.css("position"));
     126        menu.data("width", menu.css("width"));
     127        menu.data("right", menu.css("right"));
     128        menu.data("top", menu.css("top"));
     129        menu.data("max-height", menu.css("max-height"));
     130        menu.data("overflow", menu.css("overflow"));
     131        menu.data("z-index", menu.css("z-index"));
     132       
     133        menu.css("position", "fixed");
     134        menu.css("width", "300px");
     135        menu.css("right", "0px");
     136        menu.css("top", "100px");
     137        menu.css("max-height", "600px");
     138        menu.css("overflow", "auto");
     139        menu.css("z-index", "200");
     140       
     141        $("#unfloatTOCButton").show();
     142    }
     143    else
     144    {
     145        menu.css("position", menu.data("position"));
     146        menu.css("width", menu.data("width"));
     147        menu.css("right", menu.data("right"));
     148        menu.css("top", menu.data("top"));
     149        menu.css("max-height", menu.data("max-height"));
     150        menu.css("overflow", menu.data("overflow"));
     151        menu.css("z-index", menu.data("z-index"));
     152       
     153        $("#unfloatTOCButton").hide();
     154        $("#floatTOCToggle").prop("checked", false);
     155    }
     156   
     157    var url = gs.xsltParams.library_name + "?a=d&ftoc=" + (enabled ? "1" : "0") + "&c=" + gs.cgiParams.c;
     158   
     159    $.ajax(url);
     160}
Note: See TracChangeset for help on using the changeset viewer.