Changeset 33155


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)

Location:
main/trunk/greenstone3/web/interfaces/default/js
Files:
2 edited

Legend:

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

    r33146 r33155  
    12321232
    12331233
    1234 /***************
    1235 * MENU SCRIPTS *
    1236 ***************/
    1237 function moveScroller() {
    1238   var move = function() {
    1239     var editbar = $("#editBar");
    1240     var st = $(window).scrollTop();
    1241     var fa = $("#float-anchor").offset().top;
    1242     if(st > fa) {
    1243      
    1244       editbar.css({
    1245       position: "fixed",
    1246         top: "0px",
    1247         width: editbar.data("width"),
    1248         //width: "30%"
    1249             });
    1250     } else {
    1251       editbar.data("width", editbar.css("width"));
    1252       editbar.css({
    1253       position: "relative",
    1254         top: "",
    1255         width: ""
    1256         });
    1257     }
    1258   };
    1259   $(window).scroll(move);
    1260   move();
    1261 }
    1262 
    1263 
    1264 function floatMenu(enabled)
    1265 {
    1266     var menu = $(".tableOfContentsContainer");
    1267     if(enabled)
    1268     {
    1269         menu.data("position", menu.css("position"));
    1270         menu.data("width", menu.css("width"));
    1271         menu.data("right", menu.css("right"));
    1272         menu.data("top", menu.css("top"));
    1273         menu.data("max-height", menu.css("max-height"));
    1274         menu.data("overflow", menu.css("overflow"));
    1275         menu.data("z-index", menu.css("z-index"));
    1276        
    1277         menu.css("position", "fixed");
    1278         menu.css("width", "300px");
    1279         menu.css("right", "0px");
    1280         menu.css("top", "100px");
    1281         menu.css("max-height", "600px");
    1282         menu.css("overflow", "auto");
    1283         menu.css("z-index", "200");
    1284        
    1285         $("#unfloatTOCButton").show();
    1286     }
    1287     else
    1288     {
    1289         menu.css("position", menu.data("position"));
    1290         menu.css("width", menu.data("width"));
    1291         menu.css("right", menu.data("right"));
    1292         menu.css("top", menu.data("top"));
    1293         menu.css("max-height", menu.data("max-height"));
    1294         menu.css("overflow", menu.data("overflow"));
    1295         menu.css("z-index", menu.data("z-index"));
    1296        
    1297         $("#unfloatTOCButton").hide();
    1298         $("#floatTOCToggle").prop("checked", false);
    1299     }
    1300    
    1301     var url = gs.xsltParams.library_name + "?a=d&ftoc=" + (enabled ? "1" : "0") + "&c=" + gs.cgiParams.c;
    1302    
    1303     $.ajax(url);
    1304 }
    13051234
    13061235/********************
  • 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.