Skip to content

Commit 85c05f5

Browse files
author
Laszlo.Moczo
committed
docs(): Add Cookie preferences to footer
1 parent fa3e5f7 commit 85c05f5

File tree

2 files changed

+70
-61
lines changed

2 files changed

+70
-61
lines changed

_includes/footer.html

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
<li><a href="http://www.ibm.com/accessibility/us/en/" target="_blank">Accessibility</a></li>
2727
<li><a href="https://video.ibm.com/copyright-policy?itm_source=footer&amp;itm_medium=onsite&amp;itm_content=Copyright_policy&amp;itm_campaign=copyright_policy_link">Copyright Policy</a></li>
2828
<li><a href="https://video.ibm.com/acceptableusepolicy">Acceptable use policy</a></li>
29+
<li><a href="#" class="js-footer__cookie_preferences">Cookie preferences</a></li>
2930
</ul>
3031

3132
</div>

js/apidocs.js

+69-61
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
// sidenav
22
(function($){
33
if (!$.ustreamDevelopers) { $.ustreamDevelopers = {}; };
4-
4+
55
$.extend( $.easing, {
66
easeInOutExpo: function (x, t, b, c, d) {
7-
if (t==0) return b;
8-
if (t==d) return b+c;
9-
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
10-
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
7+
if (t==0) return b;
8+
if (t==d) return b+c;
9+
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
10+
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
1111
}
12-
});
12+
});
1313

1414
if (!String.prototype.toSlug) {
1515
String.prototype.toSlug = function () {
@@ -24,8 +24,8 @@
2424

2525
$.ustreamDevelopers.egalizeHeights = function(el,settings) {
2626
var base = this;
27-
base.$el = $(el);
28-
base.el = el;
27+
base.$el = $(el);
28+
base.el = el;
2929
base.elemClass = settings.split(" ")[0];
3030
base.elemInnerClass = settings.split(" ")[1];
3131

@@ -36,30 +36,30 @@
3636

3737
base.onResize = function() {
3838
var h = 0;
39-
base.$el.find(base.elemClass).each(function() {
39+
base.$el.find(base.elemClass).each(function() {
4040
var metaHeight = 0;
4141

42-
$(this).find(base.elemInnerClass).children().each(function() {
43-
metaHeight += $(this).height() + parseInt($(this).css('margin-top'))+ parseInt($(this).css('margin-bottom'));
42+
$(this).find(base.elemInnerClass).children().each(function() {
43+
metaHeight += $(this).height() + parseInt($(this).css('margin-top'))+ parseInt($(this).css('margin-bottom'));
4444
});
45-
h = Math.max(h, metaHeight);
46-
});
47-
if ($(window).width() < 560) h = 'auto';
48-
base.$el.find(base.elemClass + " " + base.elemInnerClass).css('height',h);
45+
h = Math.max(h, metaHeight);
46+
});
47+
if ($(window).width() < 560) h = 'auto';
48+
base.$el.find(base.elemClass + " " + base.elemInnerClass).css('height',h);
4949
}
5050
base.init();
5151
};
5252
$.fn.egalizeHeights = function() {
53-
return this.each(function () {
54-
(new $.ustreamDevelopers.egalizeHeights(this,$(this).attr('data-egalize-heights')));
55-
});
56-
};
53+
return this.each(function () {
54+
(new $.ustreamDevelopers.egalizeHeights(this,$(this).attr('data-egalize-heights')));
55+
});
56+
};
5757

5858

5959
$.ustreamDevelopers.stickyContent = function(el) {
6060
var base = this;
61-
base.$el = $(el);
62-
base.el = el;
61+
base.$el = $(el);
62+
base.el = el;
6363
base.$parent = base.$el.parent();
6464

6565
base.init = function () {
@@ -75,8 +75,8 @@
7575
var sidebarOverflow = base.$parent.height() < windowTop-base.$parent.offset().top+base.$el.height()+40;
7676

7777
if (base.$parent.offset().top <= windowTop && !sidebarOverflow) {
78-
base.$el.removeClass('bottom').addClass('fixed');
79-
} else {
78+
base.$el.removeClass('bottom').addClass('fixed');
79+
} else {
8080
base.$el.removeClass('fixed');
8181
if (sidebarOverflow) base.$el.addClass('bottom');
8282
else base.$el.removeClass('bottom');
@@ -89,15 +89,15 @@
8989
base.init();
9090
};
9191
$.fn.stickyContent = function() {
92-
return this.each(function () {
93-
(new $.ustreamDevelopers.stickyContent(this));
94-
});
95-
};
92+
return this.each(function () {
93+
(new $.ustreamDevelopers.stickyContent(this));
94+
});
95+
};
9696

9797
$.ustreamDevelopers.sideNav = function (el) {
9898
var base = this;
99-
base.$el = $(el);
100-
base.el = el;
99+
base.$el = $(el);
100+
base.el = el;
101101

102102
base.init = function () {
103103

@@ -129,16 +129,16 @@
129129
base.sideNavItems = sidenav.find("a");
130130
base.lastId = "";
131131
base.scrollItems = base.sideNavItems.map(function(){
132-
var item = $($(this).attr("href"));
133-
if (item.length) { return item; }
134-
});
135-
132+
var item = $($(this).attr("href"));
133+
if (item.length) { return item; }
134+
});
135+
136136
//bind events
137137
$(window).scroll(base.onScroll);
138138
base.onScroll();
139139
$(window).resize(base.onResize);
140140
base.onResize();
141-
};
141+
};
142142
base.onScroll = function() {
143143
var windowTop = $(window).scrollTop();
144144

@@ -165,19 +165,19 @@
165165
base.init();
166166
}
167167
$.fn.sideNav = function() {
168-
return this.each(function () {
169-
(new $.ustreamDevelopers.sideNav(this));
170-
});
171-
};
168+
return this.each(function () {
169+
(new $.ustreamDevelopers.sideNav(this));
170+
});
171+
};
172172
})(jQuery);
173-
173+
174174

175175
$(document).ready(function() {
176-
177-
//init code highlight
178-
$('pre code').each(function(i, block) {
179-
hljs.highlightBlock(block);
180-
});
176+
177+
//init code highlight
178+
$('pre code').each(function(i, block) {
179+
hljs.highlightBlock(block);
180+
});
181181

182182
//init responsive tables
183183
$('table.responsive').each(function() {
@@ -193,25 +193,33 @@ $(document).ready(function() {
193193

194194
//init stickycontent
195195
if ($('.stickyContent').length > 0) {
196-
$('.stickyContent').stickyContent();
196+
$('.stickyContent').stickyContent();
197197
}
198198

199199
//init sidenav
200200
if ($('article[data-sidenav]').length > 0) {
201-
$('.sidebar .stickyContent').sideNav();
201+
$('.sidebar .stickyContent').sideNav();
202202
}
203-
204-
//init nav toggle button
205-
$('a, nav .nav-toggle').bind('touchstart', function() {
206-
return true;
207-
});
208-
$('nav .nav-toggle').on('click',function() {
209-
$('nav').toggleClass('show');
210-
if ($('nav').hasClass('show')) {
211-
$('nav').css('height', $('nav').height() + $('nav .nav').outerHeight());
212-
} else {
213-
$('nav').removeAttr('style');
214-
}
215-
});
216-
217-
});
203+
204+
//init nav toggle button
205+
$('a, nav .nav-toggle').bind('touchstart', function() {
206+
return true;
207+
});
208+
$('nav .nav-toggle').on('click',function() {
209+
$('nav').toggleClass('show');
210+
if ($('nav').hasClass('show')) {
211+
$('nav').css('height', $('nav').height() + $('nav .nav').outerHeight());
212+
} else {
213+
$('nav').removeAttr('style');
214+
}
215+
});
216+
217+
$('.js-footer__cookie_preferences').on('click', function (e) {
218+
e.preventDefault();
219+
var teconsentLink = document.querySelector('#teconsent > a');
220+
var event = new MouseEvent('click');
221+
if (teconsentLink) {
222+
teconsentLink.dispatchEvent(event);
223+
}
224+
});
225+
});

0 commit comments

Comments
 (0)