PageSourceSearch

https://www.holcim.com/themes/custom/corporate/components/flipbook/js/default-book-view.js

js holcim.com collected 2026-10-01 08:52:21 UTC 3,202 bytes, 94 lines download raw bytes

1function init(container) {
2  var instance;
3  if(window.jQuery) {
4    var $ = window.jQuery;
5    instance = {
6      floatWnd: container.find('.float-wnd'),
7      binds: {
8        showDropMenu: function(e) {
9          e.preventDefault();
10          var el = $(e.target);
11          while(!el.hasClass('toggle')) {
12            el = $(el[0].parentNode);
13          }
14          var menu = el.find('.menu');
15          if(menu.hasClass('hidden')) {
16            container.find('.ctrl .fnavbar .menu').addClass('hidden');
17            menu.removeClass('hidden');
18            e.stopPropagation();
19          }
20        },
21        hideDropMenu: function() {
22          container.find('.ctrl .fnavbar .menu').addClass('hidden');
23        },
24        pickFloatWnd: function(e) {
25          if(instance.pos) {
26            instance.binds.dropFloatWnd();
27          }
28          else {
29            instance.pos = {
30              x: e.pageX,
31              y: e.pageY
32            };
33          }
34        },
35        moveFloatWnd: function(e) {
36          if(instance.pos) {
37            var dv = {
38              x: e.pageX-instance.pos.x,
39              y: e.pageY-instance.pos.y
40            }, old = {
41              x: parseInt(instance.floatWnd.css('left')),
42              y: parseInt(instance.floatWnd.css('top'))
43            };
44            instance.floatWnd.css('left', old.x+dv.x+'px').css('top', old.y+dv.y+'px');
45            instance.pos = {
46              x: e.pageX,
47              y: e.pageY
48            };
49          }
50        },
51        dropFloatWnd: function() {
52          delete instance.pos;
53        },
54        jsCenter: function() {
55          var ns = container.find('.js-center');
56          for(var i=0; i<ns.length; ++i) {
57            var n = $(ns[i]), parentWidth = $(ns[i].parentNode).width(), width = n.width();
58            n.css('left', 0.5*(parentWidth-width)+'px');
59          }
60        }
61      },
62      appLoaded: function() {
63        instance.binds.jsCenter();
64      },
65      dispose: function() {
66        container.find('.ctrl .fnavbar .fnav .toggle').off('click', instance.binds.showDropMenu);
67        $(container[0].ownerDocument).off('click', instance.binds.hideDropMenu);
68
69        $(container[0].ownerDocument).off('mousemove', instance.binds.moveFloatWnd);
70        $(container[0].ownerDocument).off('mouseup', instance.binds.dropFloatWnd);
71        instance.floatWnd.find('.header').off('mousedown', instance.binds.pickFloatWnd);
72
73        $(container[0].ownerDocument.defaultView).off('resize', instance.binds.jsCenter);
74      }
75    };
76    container.find('.ctrl .fnavbar .fnav .toggle').on('click', instance.binds.showDropMenu);
77    $(container[0].ownerDocument).on('click', instance.binds.hideDropMenu);
78
79    $(container[0].ownerDocument).on('mousemove', instance.binds.moveFloatWnd);
80    $(container[0].ownerDocument).on('mouseup', instance.binds.dropFloatWnd);
81    instance.floatWnd.find('.header').on('mousedown', instance.binds.pickFloatWnd);
82
83    $(container[0].ownerDocument.defaultView).on('resize', instance.binds.jsCenter);
84    instance.binds.jsCenter();
85  }
86  else {
87    instance = {
88      dispose: function() {
89      }
90    };
91    console.error('jQuery is not found');
92  }
93  return instance;
94} init

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.