{"version":3,"sources":["Scripts/main.js","Scripts/social-share.js","Scripts/cookie-consent.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACvIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACjEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"main.js","sourcesContent":["/* global moment _ */\r\nvar getQueryStringParams = function () {\r\n var params = {}; var queryString; var queries; var temp; var i; var l\r\n // Split into key/value pairs\r\n queryString = window.location.search\r\n queryString = queryString.substring(1)\r\n queries = queryString.split('&')\r\n // Convert the array of strings into an object\r\n for (i = 0, l = queries.length; i < l; i++) {\r\n temp = queries[i].split('=')\r\n params[temp[0]] = temp[1]\r\n }\r\n return params\r\n};\r\n\r\n(function ($, baguetteBox) {\r\n $('html').removeClass('no-js').addClass('js')\r\n\r\n $(document).ready(function () {\r\n var win = $(window)\r\n\r\n $('#btnExpandMenu').on('click', function () {\r\n $('body').toggleClass('expanded')\r\n })\r\n\r\n window.lightboxes = baguetteBox.run('.o-lightbox', {\r\n noScrollbars: true,\r\n buttons: true,\r\n fullScreen: false\r\n })\r\n\r\n // Back to top Button\r\n // browser window scroll (in pixels) after which the \"back to top\" link is shown\r\n var offset = 300\r\n // browser window scroll (in pixels) after which the \"back to top\" link opacity is reduced\r\n var offsetOpacity = 1200\r\n // duration of the top scrolling animation (in ms)\r\n var scrolTopDuration = 700\r\n // grab the \"back to top\" link\r\n var $backToTop = $('.cd-top')\r\n\r\n // hide or show the \"back to top\" link\r\n win.scroll(function () {\r\n ($(this).scrollTop() > offset) ? $backToTop.addClass('cd-is-visible') : $backToTop.removeClass('cd-is-visible cd-fade-out')\r\n if ($(this).scrollTop() > offsetOpacity) {\r\n $backToTop.addClass('cd-fade-out')\r\n }\r\n })\r\n\r\n // smooth scroll to top\r\n $backToTop.on('click', function (event) {\r\n event.preventDefault()\r\n $('body,html').animate({\r\n scrollTop: 0\r\n }, scrolTopDuration\r\n )\r\n })\r\n\r\n // with Isotope & jQuery\r\n // init Isotope\r\n //var $grid = $('#newsItemsContainer').isotope({\r\n // layoutMode: 'masonry',\r\n // itemSelector: '.c-art__item',\r\n // percentPosition: true,\r\n // masonry: {\r\n // columnWidth: '.grid-sizer'\r\n // // columnWidth: '50'\r\n // }\r\n //})\r\n var $grid = $('#newsItemsContainer').isotope({\r\n layoutMode: 'fitRows',\r\n itemSelector: '.c-art__item',\r\n percentPosition: true\r\n })\r\n\r\n // layout Isotope after each image loads\r\n $grid.imagesLoaded().progress(function () {\r\n $grid.isotope('layout')\r\n })\r\n\r\n // Load more posts (news articles)\r\n var page = 1; var $btnMore = $('#btnMoreNews')\r\n $btnMore.click(function () {\r\n if ($btnMore.hasClass('c-btn--loading')) {\r\n return false\r\n }\r\n\r\n page++\r\n $btnMore.toggleClass('c-btn--loading')\r\n $btnMore.html('Laster...')\r\n var qsParams = getQueryStringParams()\r\n var year = (qsParams && qsParams.year) ? qsParams.year : moment().format('YYYY')\r\n\r\n $.ajax({\r\n url: '/api/v0/news/',\r\n type: 'GET',\r\n dataType: 'json',\r\n data: { year: year, page: page },\r\n success: function (results) {\r\n if (results && results.length > 0) {\r\n /* eslint no-multi-str: 0 */\r\n var compiled = _.template(' \\\r\n <% _.each(results, function(result) { %> \\\r\n
\\\r\n \" class=\"c-art__item-a\"> \\\r\n \" class=\"c-newslist__item-img\"/> \\\r\n
\\\r\n
\\\r\n
<%= result.topTitle %>
\\\r\n
\\\r\n

<%= result.title %>

\\\r\n

<%= result.introText %>

\\\r\n
\\\r\n
\\\r\n
\\\r\n <% }); %>')\r\n\r\n var $newItems = $(compiled({ results: results }))\r\n\r\n // Adds and lays out newly appended item elements to the end of the layout.\r\n $grid.append($newItems).isotope('appended', $newItems)\r\n\r\n $grid.imagesLoaded().progress(function () {\r\n $grid.isotope('layout')\r\n })\r\n $btnMore.toggleClass('c-btn--loading')\r\n $btnMore.html('Flere nyheter')\r\n } else {\r\n $btnMore.hide()\r\n }\r\n }\r\n })\r\n })\r\n })\r\n})(window.$, window.baguetteBox)\r\n","//Handle sharing\r\nvar FwWebsite = window.FwWebsite || {};\r\n\r\nFwWebsite.Social = {\r\n settings: {\r\n source: 'okologisknorge.no',\r\n siteName: 'Økologisk Norge',\r\n twitterProfile: ''\r\n },\r\n\r\n init: function (options) {\r\n var $ = jQuery,\r\n me = this;\r\n\r\n me.winWidth = 600;\r\n me.winHeight = 580;\r\n me.winTop = screen.height / 2 - me.winHeight / 2;\r\n me.winLeft = screen.width / 2 - me.winWidth / 2;\r\n\r\n FwWebsite.Social.settings = $.extend(FwWebsite.Social.settings, options);\r\n },\r\n\r\n doFacebookShare: function (url, title, intro, image) {\r\n if (FB) {\r\n //Required FB SDK and AppID\r\n FB.ui({\r\n method: 'share',\r\n href: '' + url + '',\r\n caption: '' + title + '',\r\n description: '' + intro + '',\r\n picture: '' + image + ''\r\n }, function (response) { });\r\n } else {\r\n alert('Sharing to facebook requires FB SDK and a registered App.');\r\n }\r\n },\r\n\r\n doTwitterShare: function (url, title, windowTitle) {\r\n if (!windowTitle)\r\n {\r\n windowTitle = 'Del på Twitter';\r\n }\r\n var twitVia = '';\r\n if (FwWebsite.Social.settings.twitterProfile) {\r\n twitVia = '&via=' + FwWebsite.Social.settings.twitterProfile;\r\n }\r\n window.open('https://twitter.com/intent/tweet?url=' + url + '&text=' + title + twitVia, windowTitle, 'top=' + this.winTop + ',left=' + this.winLeft + ',toolbar=0,status=0,width=' + this.winWidth + ',height=' + this.winHeight);\r\n },\r\n\r\n doGooglePlusShare: function (url, windowTitle) {\r\n if (!windowTitle) {\r\n windowTitle = 'Del på Google+';\r\n }\r\n window.open('https://plus.google.com/share?url=' + url, windowTitle, 'top=' + this.winTop + ',left=' + this.winLeft + ',toolbar=0,status=0,width=' + this.winWidth + ',height=' + this.winHeight);\r\n },\r\n\r\n doLinkedinShare: function (url, title, windowTitle) {\r\n if (!windowTitle) {\r\n windowTitle = 'Del på LinkedIn';\r\n }\r\n window.open('http://www.linkedin.com/shareArticle?mini=true&url=' + url + '&title=' + title + '&summary=&source=' + FwWebsite.Social.settings.source, windowTitle, 'top=' + this.winTop + ',left=' + this.winLeft + ',toolbar=0,status=0,width=' + this.winWidth + ',height=' + this.winHeight);\r\n }\r\n};\r\n\r\n//initialize the sharing buttons API\r\nwindow.FwWebsite.Social.init({});","var ctcc_vars = { \"expiry\": \"30\", \"method\": \"1\", \"version\": \"1\" };\r\n\r\n//All the cookie setting stuff\r\nfunction catapultSetCookie(cookieName, cookieValue, nDays) {\r\n var today = new Date();\r\n var expire = new Date();\r\n if (nDays == null || nDays == 0) nDays = 1;\r\n expire.setTime(today.getTime() + 3600000 * 24 * nDays);\r\n document.cookie = cookieName + \"=\" + escape(cookieValue) + \";expires=\" + expire.toGMTString() + \"; path=/\";\r\n}\r\n\r\nfunction catapultReadCookie(cookieName) {\r\n var theCookie = \" \" + document.cookie;\r\n var ind = theCookie.indexOf(\" \" + cookieName + \"=\");\r\n if (ind == -1) ind = theCookie.indexOf(\";\" + cookieName + \"=\");\r\n if (ind == -1 || cookieName == \"\") return \"\";\r\n var ind1 = theCookie.indexOf(\";\", ind + 1);\r\n if (ind1 == -1) ind1 = theCookie.length;\r\n // Returns true if the versions match\r\n return ctcc_vars.version == unescape(theCookie.substring(ind + cookieName.length + 2, ind1));\r\n}\r\n\r\nfunction catapultDeleteCookie(cookieName) {\r\n document.cookie = cookieName + '=;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/';\r\n}\r\n\r\nfunction catapultAcceptCookies() {\r\n catapultSetCookie('catAccCookies', ctcc_vars.version, ctcc_vars.expiry);\r\n jQuery(\"html\").removeClass('has-cookie-bar');\r\n jQuery(\"html\").css(\"margin-top\", \"0\");\r\n jQuery(\"#catapult-cookie-bar\").fadeOut();\r\n}\r\n\r\n// The function called by the timer\r\nfunction ctccCloseNotification() {\r\n catapultAcceptCookies();\r\n}\r\n\r\n// The function called if first page only is specified\r\nfunction ctccFirstPage() {\r\n if (ctcc_vars.method) {\r\n catapultSetCookie('catAccCookies', ctcc_vars.version, ctcc_vars.expiry);\r\n }\r\n}\r\n\r\n$(document).ready(function ($) {\r\n //Cookie law - If the cookie has not been set then show the bar\r\n if (!catapultReadCookie(\"catAccCookies\")) {\r\n $(\"html\").addClass(\"has-cookie-bar\");\r\n $(\"html\").addClass(\"cookie-bar-bottom-bar\");\r\n $(\"html\").addClass(\"cookie-bar-bar\");\r\n }\r\n\r\n $('.x_close').on('click', function () {\r\n catapultAcceptCookies();\r\n });\r\n});"]}