Created
November 12, 2019 16:19
-
-
Save Fprince333/0916bee6c8edea341a8bbdc6b109f197 to your computer and use it in GitHub Desktop.
Revisions
-
Fprince333 created this gist
Nov 12, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,419 @@ <style type="text/css">.item-list a { font-family: MarsCentra-Book, sans-serif; font-size: 16px; color: #0000a0; text-decoration: underline; letter-spacing: normal; } .policy-list .item-list { margin-bottom: 60px; } .policy-list .views-field-field-child-policy .item-list { margin-bottom: 0px; } .policy-list .views-field-field-child-policy .item-list ul { margin-bottom: 0px; margin-left: 15px; } .policy-list .views-field-field-child-policy .item-list ul li { border: none; } .image-style-full-width-image { max-height: 670px; object-fit: cover; } @media (max-width: 1200px) { .image-style-full-width-image { max-height: 315px; } .policy-list .item-list h3 { padding-bottom: 10px; } } .policy-list .view-header .block-facet--dropdown { cursor: pointer; width: 245px; background-position: right 16px top 13px; } .policy-list .view-content { column-gap: 50px; } .policy-list .item-list h3 { font-family: MarsCentra-Bold, sans-serif; margin-bottom: 0; } select, select::-ms-expand { pointer-events: none; display: none; } ul.open, ul.closed { list-style-type: none; padding: 0; margin: 0; } ul.open li:not(.default-option) { padding: 0 14px; } ul.open li:not(.facet-item) { border-bottom: 1px solid #00d7b9; } ul.open li a, ul.closed li a { color: #0000a0; font-family: MarsCentra-Bold, sans-serif; font-size: 14px; text-decoration: none; display: flex; } ul.open li:not(.default-option) a, ul.closed li:not(.default-option) a { padding: 10px; } ul.open li:not(.facet-item) a, ul.closed li:not(.facet-item) a { line-height: 38px; padding-left: 14px; margin-right: 28px; } ul.open { display: block !important; } .open li:not(.default-option) a:hover { background-color: #00d7b9; } .block-facet--checkbox, .filter-text { line-height: 40px; } .facets-widget-dropdown { overflow: hidden; } </style> <script> /* * arrive.js * v2.4.1 * https://github.com/uzairfarooq/arrive * MIT licensed * * Copyright (c) 2014-2017 Uzair Farooq */ var Arrive = function(e, t, n) { "use strict"; function r(e, t, n) { l.addMethod(t, n, e.unbindEvent), l.addMethod(t, n, e.unbindEventWithSelectorOrCallback), l.addMethod(t, n, e.unbindEventWithSelectorAndCallback) } function i(e) { e.arrive = f.bindEvent, r(f, e, "unbindArrive"), e.leave = d.bindEvent, r(d, e, "unbindLeave") } if (e.MutationObserver && "undefined" != typeof HTMLElement) { var o = 0, l = function() { var t = HTMLElement.prototype.matches || HTMLElement.prototype.webkitMatchesSelector || HTMLElement.prototype.mozMatchesSelector || HTMLElement.prototype.msMatchesSelector; return { matchesSelector: function(e, n) { return e instanceof HTMLElement && t.call(e, n) }, addMethod: function(e, t, r) { var i = e[t]; e[t] = function() { return r.length == arguments.length ? r.apply(this, arguments) : "function" == typeof i ? i.apply(this, arguments) : n } }, callCallbacks: function(e, t) { t && t.options.onceOnly && 1 == t.firedElems.length && (e = [e[0]]); for (var n, r = 0; n = e[r]; r++) n && n.callback && n.callback.call(n.elem, n.elem); t && t.options.onceOnly && 1 == t.firedElems.length && t.me.unbindEventWithSelectorAndCallback.call(t.target, t.selector, t.callback) }, checkChildNodesRecursively: function(e, t, n, r) { for (var i, o = 0; i = e[o]; o++) n(i, t, r) && r.push({ callback: t.callback, elem: i }), i.childNodes.length > 0 && l.checkChildNodesRecursively(i.childNodes, t, n, r) }, mergeArrays: function(e, t) { var n, r = {}; for (n in e) e.hasOwnProperty(n) && (r[n] = e[n]); for (n in t) t.hasOwnProperty(n) && (r[n] = t[n]); return r }, toElementsArray: function(t) { return n === t || "number" == typeof t.length && t !== e || (t = [t]), t } } }(), c = function() { var e = function() { this._eventsBucket = [], this._beforeAdding = null, this._beforeRemoving = null }; return e.prototype.addEvent = function(e, t, n, r) { var i = { target: e, selector: t, options: n, callback: r, firedElems: [] }; return this._beforeAdding && this._beforeAdding(i), this._eventsBucket.push(i), i }, e.prototype.removeEvent = function(e) { for (var t, n = this._eventsBucket.length - 1; t = this._eventsBucket[n]; n--) if (e(t)) { this._beforeRemoving && this._beforeRemoving(t); var r = this._eventsBucket.splice(n, 1); r && r.length && (r[0].callback = null) } }, e.prototype.beforeAdding = function(e) { this._beforeAdding = e }, e.prototype.beforeRemoving = function(e) { this._beforeRemoving = e }, e }(), a = function(t, r) { var i = new c, o = this, a = { fireOnAttributesModification: !1 }; return i.beforeAdding(function(n) { var i, l = n.target; (l === e.document || l === e) && (l = document.getElementsByTagName("html")[0]), i = new MutationObserver(function(e) { r.call(this, e, n) }); var c = t(n.options); i.observe(l, c), n.observer = i, n.me = o }), i.beforeRemoving(function(e) { e.observer.disconnect() }), this.bindEvent = function(e, t, n) { t = l.mergeArrays(a, t); for (var r = l.toElementsArray(this), o = 0; o < r.length; o++) i.addEvent(r[o], e, t, n) }, this.unbindEvent = function() { var e = l.toElementsArray(this); i.removeEvent(function(t) { for (var r = 0; r < e.length; r++) if (this === n || t.target === e[r]) return !0; return !1 }) }, this.unbindEventWithSelectorOrCallback = function(e) { var t, r = l.toElementsArray(this), o = e; t = "function" == typeof e ? function(e) { for (var t = 0; t < r.length; t++) if ((this === n || e.target === r[t]) && e.callback === o) return !0; return !1 } : function(t) { for (var i = 0; i < r.length; i++) if ((this === n || t.target === r[i]) && t.selector === e) return !0; return !1 }, i.removeEvent(t) }, this.unbindEventWithSelectorAndCallback = function(e, t) { var r = l.toElementsArray(this); i.removeEvent(function(i) { for (var o = 0; o < r.length; o++) if ((this === n || i.target === r[o]) && i.selector === e && i.callback === t) return !0; return !1 }) }, this }, s = function() { function e(e) { var t = { attributes: !1, childList: !0, subtree: !0 }; return e.fireOnAttributesModification && (t.attributes = !0), t } function t(e, t) { e.forEach(function(e) { var n = e.addedNodes, i = e.target, o = []; null !== n && n.length > 0 ? l.checkChildNodesRecursively(n, t, r, o) : "attributes" === e.type && r(i, t, o) && o.push({ callback: t.callback, elem: i }), l.callCallbacks(o, t) }) } function r(e, t) { return l.matchesSelector(e, t.selector) && (e._id === n && (e._id = o++), -1 == t.firedElems.indexOf(e._id)) ? (t.firedElems.push(e._id), !0) : !1 } var i = { fireOnAttributesModification: !1, onceOnly: !1, existing: !1 }; f = new a(e, t); var c = f.bindEvent; return f.bindEvent = function(e, t, r) { n === r ? (r = t, t = i) : t = l.mergeArrays(i, t); var o = l.toElementsArray(this); if (t.existing) { for (var a = [], s = 0; s < o.length; s++) for (var u = o[s].querySelectorAll(e), f = 0; f < u.length; f++) a.push({ callback: r, elem: u[f] }); if (t.onceOnly && a.length) return r.call(a[0].elem, a[0].elem); setTimeout(l.callCallbacks, 1, a) } c.call(this, e, t, r) }, f }, u = function() { function e() { var e = { childList: !0, subtree: !0 }; return e } function t(e, t) { e.forEach(function(e) { var n = e.removedNodes, i = []; null !== n && n.length > 0 && l.checkChildNodesRecursively(n, t, r, i), l.callCallbacks(i, t) }) } function r(e, t) { return l.matchesSelector(e, t.selector) } var i = {}; d = new a(e, t); var o = d.bindEvent; return d.bindEvent = function(e, t, r) { n === r ? (r = t, t = i) : t = l.mergeArrays(i, t), o.call(this, e, t, r) }, d }, f = new s, d = new u; t && i(t.fn), i(HTMLElement.prototype), i(NodeList.prototype), i(HTMLCollection.prototype), i(HTMLDocument.prototype), i(Window.prototype); var h = {}; return r(f, h, "unbindAllArrive"), r(d, h, "unbindAllLeave"), h } }(window, "undefined" == typeof jQuery ? null : jQuery, void 0); </script><script> "use strict"; document.arrive('.js-facets-dropdown', function() { this.parentNode.removeChild(this); $(".js-facets-dropdown-links").addClass("closed"); $(".js-facets-dropdown-links").show() $(".facet-item").hide() if ($(".facet-item").find(".is-active").length) { $(".default-option").hide(); $(".facet-item").find(".is-active").parent().show() $(".facet-item").find(".is-active").find('span').show() } else { $('.default-option').show(); } }) document.addEventListener("DOMContentLoaded", function() { $("#block-facet-blocktopics-policy-practice").on('click', function(e) { if ($('.closed').length && e.target.href) { e.preventDefault(); } if ($('.open').length && e.target.classList.contains("default-option")) { $(".js-facets-dropdown-links").removeClass('open').addClass("closed"); $(".facet-item").hide() $(".policy-list .view-header .block-facet--dropdown").css("background-image", "url(/modules/custom/mars_com/images/arrow-bottom.png)"); $('.policy-list .view-header .block-facet--dropdown').css("border-color", "#0000a0"); if ($(".facet-item").find(".is-active").length) { $(".default-option").hide(); $(".facet-item").find(".is-active").parent().show() $(".facet-item").find(".is-active").find('span').show() } else { $('.default-option').show(); } } else if ($('.open').length && e.target.href) { if (window.location.href.indexOf("?") > -1) { window.location = window.location.href.split("?")[0] } else if (!e.target.href.includes("?")) { e.preventDefault(); $(".js-facets-dropdown-links").removeClass('open').addClass("closed"); $(".facet-item").hide() $(".policy-list .view-header .block-facet--dropdown").css("background-image", "url(/modules/custom/mars_com/images/arrow-bottom.png)"); $('.policy-list .view-header .block-facet--dropdown').css("border-color", "#0000a0"); } } else { if (window.location.href.indexOf("?") > -1 && $('.closed').length) { e.preventDefault(); } $(".js-facets-dropdown-links").removeClass("closed").addClass("open"); $(".default-option").show(); $(".facet-item").show() $(".facet-item__value").show(); $(".policy-list .view-header .block-facet--dropdown").css("background-image", "url(/modules/custom/mars_com/images/arrow-top.png)"); $('.policy-list .view-header .block-facet--dropdown').css("border-color", "#00d7b9"); } }) var governanceAndEthics = $($.parseHTML('<ul><li><div class="views-field views-field-title"><span class="field-content"><a href="/about/policies-and-practices/anti-corruption" hreflang="en">Anti-Corruption</a></span></div><div class="views-field views-field-field-child-policy"><span class="field-content"></span></div></li><li><div class="views-field views-field-title"><span class="field-content"><a href="/legal/ca-supply-chain-act" hreflang="en">CA Supply Chain Transparency Act</a></span></div><div class="views-field views-field-field-child-policy"><span class="field-content"></span></div></li><li><div class="views-field views-field-title"><span class="field-content"><a href="/about/policies-and-practices/data-processing" hreflang="en">Data Processing</a></span></div><div class="views-field views-field-field-child-policy"><span class="field-content"></span></div></li><li><a href="/about/policies-and-practices/human-rights-policy" hreflang="en">Human Rights Policy</a></li><li><div class="views-field views-field-title"><span class="field-content"><a href="/modern-slavery-act" hreflang="en">Modern Slavery Act</a></span></div><div class="views-field views-field-field-child-policy"><span class="field-content"></span></div></li><li><div class="views-field views-field-title"><span class="field-content"><a href="/privacy" hreflang="en">Privacy</a></span></div><div class="views-field views-field-field-child-policy"><span class="field-content"></span></div></li><li><div class="views-field views-field-title"><span class="field-content"><a href="/about/policies-and-practices/public-policy-advocacy" hreflang="en">Public Policy and Advocacy</a></span></div><div class="views-field views-field-field-child-policy"><span class="field-content"></span></div></li><li><div class="views-field views-field-title"><span class="field-content"><a href="/about/policies-and-practices/supplier-code-of-conduct" hreflang="en">Supplier Code of Conduct</a></span></div><div class="views-field views-field-field-child-policy"><span class="field-content"></span></div></li></ul>')); var environment = $($.parseHTML('<li><div class="views-field views-field-title"><span class="field-content"><a href="/about/policies-and-practices/farm-animal-welfare" hreflang="en">Farm Animal Welfare</a></span></div><div class="views-field views-field-field-child-policy"><span class="field-content"><div class="item-list"><ul class="list-group"><li class="list-group-item"><a href="/about/policies-and-practices/cage-free-eggs" hreflang="en">Cage-Free Eggs</a></li></ul></div></span></div></li>')); var antiCorruption = $($.parseHTML('<li><div class="views-field views-field-title"><span class="field-content"><a href="/about/policies-and-practices/anti-corruption" hreflang="en">Anti-Corruption</a></span></div><div class="views-field views-field-field-child-policy"><span class="field-content"></span></div></li>')); var palmOil = $($.parseHTML('<li><a href="/about/policies-and-practices/palm-oil-policy" hreflang="en">Palm Oil</a></li>')); if (window.location.href.indexOf("?") > -1) { var location = window.location.href.split("?")[1]; document.querySelectorAll('.policy-list .view-content')[0].style.columnCount = 1; document.querySelectorAll(".filter-text")[0].scrollIntoView(); switch (location) { case "f%5B0%5D=topics_policy_practice%3A1711": document.querySelectorAll(".item-list")[0].children[1].remove(); $(".item-list").append(governanceAndEthics); break; case "f%5B0%5D=topics_policy_practice%3A1696": $($($($(".item-list")[0]).find("ul")[0]).find("li")[8]).after(environment) break; case "f%5B0%5D=topics_policy_practice%3A211": $($($(".item-list")[0]).find("ul")[0]).prepend(antiCorruption) $($($($(".item-list")[0]).find("ul")[0]).find("li")[7]).after(palmOil) break; default: break; } } }); if ('objectFit' in document.documentElement.style === false) { document.addEventListener('DOMContentLoaded', function() { Array.prototype.forEach.call(document.querySelectorAll('img.image-style-full-width-image'), function(image) { (image.runtimeStyle || image.style).background = "url(\"".concat(image.src, "\") no-repeat 50%/").concat(image.currentStyle ? image.currentStyle['object-fit'] : image.getAttribute('data-object-fit')); image.src = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='".concat(image.width, "' height='").concat(image.height, "'%3E%3C/svg%3E"); }); }); } </script>