### Install GSEE using Conda Source: https://gsee.readthedocs.io/en/latest/ Installs the GSEE library using the conda package manager from the conda-forge channel. This is the recommended installation method. ```shell conda install -c conda-forge gsee ``` -------------------------------- ### Install GSEE Development Version Source: https://gsee.readthedocs.io/en/latest/ Installs the latest development version of GSEE directly from its GitHub repository using pip in editable mode. Requires Git and potentially Cython for building extensions. ```shell pip install -e git+https://github.com/renewables-ninja/gsee.git#egg=gsee ``` -------------------------------- ### Install GSEE using Pip Source: https://gsee.readthedocs.io/en/latest/ Installs the GSEE library using the pip package manager. Note that if numpy is not already installed, this may lead to a compiler error when building the climatedata_interface Cython extension. ```shell pip install gsee ``` -------------------------------- ### JW Player Video Setup Source: https://www.marineregions.org/ Configures and initializes the JW Player for embedding a video. It specifies the video file, thumbnail image, dimensions, skin, and logo settings. ```javascript jwplayer.key="4U1ttj2vXmLKZuJ7ICCupj0uy0dA8rdkDkkCqQ=="; var playerInstance = jwplayer("photo_video"); playerInstance.setup({ file: "https://images.vliz.be/thumbs/139974_daniel-pauly---sea-around-us.mp4", image: "https://images.vliz.be/thumbs/139974_daniel-pauly---sea-around-us.jpg?w=150", width: 507, height: 310, title: "Daniel Pauly - Sea Around Us", skin: "glow", base: ".", logo: { hide: true } }); ``` -------------------------------- ### Web Chat Widget Initialization Source: https://www.eppo.go.th/index.php/en/en-energystatistics/electricity-statistic This JavaScript code initializes a web chat widget. It defines an object `onWebChat` with methods to set and get chat configurations, and a self-executing function `w` to asynchronously load the chat client script from a CDN. ```JavaScript var onWebChat={ ar:[], set: function(a,b){ if (typeof onWebChat_==='undefined'){ this.ar.push([a,b]); } else { onWebChat_.set(a,b); } }, get:function(a){ return(onWebChat_.get(a)); }, w:(function(){ var ga=document.createElement('script'); ga.type = 'text/javascript'; ga.async=1; ga.src='//www.onwebchat.com/clientchat/d3907cb09568f5b6ae93bf6fde97a394'; var s=document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga,s); })() } ``` -------------------------------- ### Google Analytics gtag.js Tracker Setup Source: https://caseforsea.org/indonesia/ Configures and initializes the gtag.js tracker for Google Analytics. This snippet sets up event tracking, page view tracking, and handles compatibility with older analytics.js functions, mapping their parameters to the gtag.js format. ```javascript var hookName = name; if (typeof parameters['event_category'] !== 'undefined') { hookName = parameters['event_category'] + ':' + name; } if (typeof MonsterInsightsDualTracker.trackers[hookName] !== 'undefined') { MonsterInsightsDualTracker.trackers[hookName](parameters); } else { __gtagDataLayer('event', name, parameters); } } else { __gtagDataLayer.apply(null, arguments); } } __gtagTracker('js', new Date()); __gtagTracker('set', { 'developer_id.dZGIzZG': true, }); if ( MonsterInsightsLocations.page_location ) { __gtagTracker('set', MonsterInsightsLocations); } __gtagTracker('config', 'G-GTM0Z3DM5S', {"forceSSL":"true","link_attribution":"true"} ); window.gtag = __gtagTracker; (function () { /* https://developers.google.com/analytics/devguides/collection/analyticsjs/ */ /* ga and __gaTracker compatibility shim. */ var noopfn = function () { return null; }; var newtracker = function () { return new Tracker(); }; var Tracker = function () { return null; }; var p = Tracker.prototype; p.get = noopfn; p.set = noopfn; p.send = function () { var args = Array.prototype.slice.call(arguments); args.unshift('send'); __gaTracker.apply(null, args); }; var __gaTracker = function () { var len = arguments.length; if (len === 0) { return; } var f = arguments[len - 1]; if (typeof f !== 'object' || f === null || typeof f.hitCallback !== 'function') { if ('send' === arguments[0]) { var hitConverted, hitObject = false, action; if ('event' === arguments[1]) { if ('undefined' !== typeof arguments[2]) { hitObject = { 'eventAction': arguments[2], 'eventCategory': arguments[3], 'eventLabel': arguments[4], 'value': arguments[5] ? arguments[5] : 1, } } } if ('pageview' === arguments[1]) { if ('undefined' !== typeof arguments[2]) { hitObject = { 'eventAction': 'page_view', 'page_path': arguments[2], } } } if (typeof arguments[2] === 'object') { hitObject = arguments[2]; } if (typeof arguments[5] === 'object') { Object.assign(hitObject, arguments[5]); } if ('undefined' !== typeof arguments[1].hitType) { hitObject = arguments[1]; if ('pageview' === hitObject.hitType) { hitObject.eventAction = 'page_view'; } } if (hitObject) { action = 'timing' === arguments[1].hitType ? 'timing_complete' : hitObject.eventAction; hitConverted = mapArgs(hitObject); __gtagTracker('event', action, hitConverted); } } return; } function mapArgs(args) { var arg, hit = {}; var gaMap = { 'eventCategory': 'event_category', 'eventAction': 'event_action', 'eventLabel': 'event_label', 'eventValue': 'event_value', 'nonInteraction': 'non_interaction', 'timingCategory': 'event_category', 'timingVar': 'name', 'timingValue': 'value', 'timingLabel': 'event_label', 'page': 'page_path', 'location': 'page_location', 'title': 'page_title', 'referrer' : 'page_referrer', }; for (arg in args) { if (!(!args.hasOwnProperty(arg) || !gaMap.hasOwnProperty(arg))) { hit[gaMap[arg]] = args[arg]; } else { hit[arg] = args[arg]; } } return hit; } try { f.hitCallback(); } catch (ex) { } }; __gaTracker.create = newtracker; __gaTracker.getByName = newtracker; __gaTracker.getAll = function () { return []; }; __gaTracker.remove = noopfn; __gaTracker.loaded = true; window['__gaTracker'] = __gaTracker; })(); } else { console.log(""); (function () { function __gtagTracker() { return null; } window['__gtagTracker'] = __gtagTracker; window['gtag'] = __gtagTracker; })(); } ``` -------------------------------- ### Calculate PV System Power Output Source: https://gsee.readthedocs.io/en/latest/ Example of using the `gsee.pv.run_model` function to calculate the power output of a PV system. It requires input data (global horizontal and diffuse fraction irradiance, optional temperature) and system parameters like coordinates, tilt, azimuth, tracking type, and capacity. ```python result = gsee.pv.run_model( data, coords=(22.78, 5.51), # Latitude and longitude tilt=30, # 30 degrees tilt angle azim=180, # facing towards equator, tracking=0, # fixed - no tracking capacity=1000, # 1000 W ) ``` -------------------------------- ### Vertical Tab Initialization Source: https://www.eppo.go.th/index.php/en/en-energystatistics/electricity-statistic Initializes the Easy Responsive Tabs plugin for a vertical tab layout. It configures the tabs to be responsive, fit within their container, and start in an accordion view. It also includes a callback for tab activation. ```javascript jQuery('#parentVerticalTab').easyResponsiveTabs({ type: 'vertical', width: 'auto', fit: true, closed: 'accordion', tabidentify: 'hor_1', activate: function(event) { var $tab = jQuery(this); var $info = jQuery('#nested-tabInfo2'); var $name = jQuery('span', $info); $name.text($tab.text()); $info.show(); } }); ``` -------------------------------- ### Start Clock Timer Source: https://www.eppo.go.th/index.php/en/en-energystatistics/electricity-statistic Initializes a clock function that updates the time every 500ms. It gets the current hour, minute, and second, formats them, and displays them in an element with the ID 'showData'. ```javascript function startTime() { var today = new Date(); var h = today.getHours(); var m = today.getMinutes(); var s = today.getSeconds(); m = checkTime(m); s = checkTime(s); var elem = document.getElementById('showData'); if(typeof elem !== 'undefined' && elem !== null) { document.getElementById('showData').innerHTML = h + ":" + m + ":" + s; } var t = setTimeout(startTime, 500); } function checkTime(i) { if (i < 10) {i = "0" + i}; return i; } startTime(); ``` -------------------------------- ### Initialize Matomo Analytics Source: https://zenodo.org/records/10870602 Sets up the Matomo tracking script, defining the tracker URL and site ID. This code snippet initializes the analytics tracker for the website. ```javascript var _paq = window._paq = window._paq || []; _paq.push(['requireCookieConsent']); (function() { var u="https://webanalytics.web.cern.ch/"; _paq.push(['setTrackerUrl', u+'matomo.php']); _paq.push(['setSiteId', '366']); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); })(); ``` -------------------------------- ### Application Initialization Source: https://gsee.readthedocs.io/en/latest/ Initializes the application with a specified version and base URL. This is likely a JavaScript call used in the frontend of the application. ```JavaScript app.initialize({"version":"1.0.4","url":{"base":" ندارد"}}) ``` -------------------------------- ### Preload Links Configuration and Logic Source: https://caseforsea.org/indonesia/ Configuration object and associated JavaScript logic for preloading links on a website. It defines patterns for excluding URIs, specifies file extensions to consider, and sets parameters like hover delay and rate throttling. The code initializes listeners for user interactions (mouseover, mousedown, touchstart) to trigger preloading actions, aiming to improve perceived performance by fetching resources proactively. ```javascript var RocketPreloadLinksConfig = { "excludeUris": "\/(?:.+\/)?feed(?:\/(?:.+\/?)?)?$" + "|\/(?:.+\/)?embed\/" + "|\/(index.php\/)?(.*)wp-json(\/.*|$)" + "|\/refer\/" + "|\/go\/" + "|\/recommend\/" + "|\/recommends\/", "usesTrailingSlash": "1", "imageExt": "jpg|jpeg|gif|png|tiff|bmp|webp|avif|pdf|doc|docx|xls|xlsx|php", "fileExt": "jpg|jpeg|gif|png|tiff|bmp|webp|avif|pdf|doc|docx|xls|xlsx|php|html|htm", "siteUrl": "https:\/\/caseforsea.org", "onHoverDelay": "100", "rateThrottle": "3" }; (function() { "use strict"; var r = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { return typeof e; } : function(e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e; }; var e = function() { function i(e, t) { for (var n = 0; n < t.length; n++) { var i = t[n]; i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, i.key, i); } } return function(e, t, n) { return t && i(e.prototype, t), n && i(e, n), e; }; }(); function i(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); } var t = function() { function n(e, t) { i(this, n), this.browser = e, this.config = t, this.options = this.browser.options, this.prefetched = new Set, this.eventTime = null, this.threshold = 1111, this.numOnHover = 0; } return e(n, [{ key: "init", value: function() { !this.browser.supportsLinkPrefetch() || this.browser.isDataSaverModeOn() || this.browser.isSlowConnection() || (this.regex = { excludeUris: RegExp(this.config.excludeUris, "i"), images: RegExp(".(" + this.config.imageExt + ")$", "i"), fileExt: RegExp(".(" + this.config.fileExt + ")$", "i") }, this._initListeners(this)); } }, { key: "_initListeners", value: function(e) { -1 < this.config.onHoverDelay && document.addEventListener("mouseover", e.listener.bind(e), e.listenerOptions), document.addEventListener("mousedown", e.listener.bind(e), e.listenerOptions), document.addEventListener("touchstart", e.listener.bind(e), e.listenerOptions); } }, { key: "listener", value: function(e) { var t = e.target.closest("a"), n = this._prepareUrl(t); if (null !== n) switch (e.type) { case "mousedown": case "touchstart": this._addPrefetchLink(n); break; case "mouseover": this._earlyPrefetch(t, n, "mouseout"); } } }, { key: "_earlyPrefetch", value: function(t, e, n) { var i = this, r = setTimeout(function() { if (r = null, 0 === i.numOnHover) setTimeout(function() { return i.numOnHo // ... rest of the code is truncated in the input }, i.config.onHoverDelay); } }]); return n; }(); })(); ``` -------------------------------- ### Get Firefox Version Source: https://journals.plos.org/plosone/article Retrieves the version number of Firefox if the browser is identified as Firefox. This is useful for applying browser-specific workarounds or features. ```javascript var r=0,o=navigator.userAgent.match(/Firefox[\/\s](\d+\.\d+)/);o&&(r=+o[1]),e.exports=r ``` -------------------------------- ### CSS for Auto Sizes Images Source: https://caseforsea.org/indonesia/ A CSS rule that applies `contain-intrinsic-size` to images that have their `sizes` attribute set to 'auto' or starting with 'auto,'. This helps in optimizing image rendering. ```css img:is([sizes="auto" i], [sizes^="auto," i]) { contain-intrinsic-size: 3000px 1500px } ``` -------------------------------- ### Initialize Microsoft Clarity Source: https://atb.nrel.gov/electricity/2024/index This script initializes Microsoft Clarity, a web analytics tool that helps understand user behavior through session recordings and heatmaps. It asynchronously loads the Clarity tracking script. ```javascript (function(c,l,a,r,i,t,y){ c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)}; t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i; y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y); })(window, document, "clarity", "script", "n4s46u4gq2"); ``` -------------------------------- ### Timestamp Generation Utility Source: https://journals.plos.org/plosone/article Generates a high-resolution timestamp, prioritizing 'performance.now()' for accuracy. It also provides a way to get the last recorded timestamp and an offset for time synchronization. ```javascript function r(){return s.exists&&performance.now?Math.round(performance.now()):(i=Math.max((new Date).getTime(),i))-a}function o(){return i}var i=(new Date).getTime(),a=i,s=t(34);e.exports=r,e.exports.offset=a,e.exports.getLastTimestamp=o} ``` -------------------------------- ### Initialize Google Analytics Source: https://rezoning.energydata.info/ This JavaScript code initializes Google Analytics (GA) for the website. It creates a GA object, defines its tracking queue, and asynchronously loads the GA script from Google's servers. The `ga('send', 'pageview')` command tracks the current page view. ```JavaScript (function (i, s, o, g, r, a, m) { i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () { (i[r].q = i[r].q || []).push(arguments) }, i[r].l = 1 * new Date(); a = s.createElement(o), m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m) })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga'); ga('create', 'UA-81901426-1', 'auto'); ga('send', 'pageview'); ``` -------------------------------- ### Welcome Banner Styling Source: https://rezoning.energydata.info/ This CSS defines the styling for the `#welcome-banner` element. It uses flexbox for alignment, sets absolute positioning to cover the viewport, and applies a gradient background, text color, and font properties. It also includes a transition for smooth dismissal effects. ```CSS #welcome-banner { display: flex; align-items: center; justify-content: center; text-align: center; position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 100; color: #fff; background: rgb(2, 0, 36); margin: 0; padding: 1rem; font-family: sans-serif; font-size: 1rem; transition: all 320ms ease-in-out; } #welcome-banner.dismissed { opacity: 0; visibility: hidden; } ``` -------------------------------- ### JSONP Instrumentation Source: https://journals.plos.org/plosone/article Wraps and instruments JSONP requests by hooking into DOM manipulation methods used for script loading. It emits events for the start of JSONP requests and completion/error states, managing callback functions. ```javascript function r(t){ function e(){f.emit("jsonp-end",[],l), t.removeEventListener("load",e,c(!1)), t.removeEventListener("error",n,c(!1))} function n(){f.emit("jsonp-error",[],l), f.emit("jsonp-end",[],l), t.removeEventListener("load",e,c(!1)), t.removeEventListener("error",n,c(!1))} var r=t&&"string"==typeof t.nodeName&&"script"===t.nodeName.toLowerCase(); if(r){ var o="function"==typeof t.addEventListener; if(o){ var a=i(t.src); if(a){ var d=s(a),p="function"==typeof d.parent[d.key]; if(p){ var l={}; u.inPlace(d.parent,[d.key],"cb-",l), t.addEventListener("load",e,c(!1)), t.addEventListener("error",n,c(!1)), f.emit("new-jsonp",[t.src],l) } } } } } function o(){return"addEventListener"in window} function i(t){var e=t.match(d); return e?e[1]:null} function a(t,e){var n=t.match(l),r=n[1],o=n[3]; return o?a(o,e[r]):e[r]} function s(t){var e=t.match(p); return e&&e.length>=3?{key:e[2],parent:a(e[1],window)}:{key:t,parent:window}} var c=t(23),f=t("ee").get("jsonp"),u=t("wrap-function")(f); if(e.exports=f,o()){ var d=/[?&](?:callback|cb)=([^&#]+)/, p=/(.*)\.(.*)/, l=/^(\w+)(\.|$)(.*)$/, h=["appendChild","insertBefore","replaceChild"]; Node&&Node.prototype&&Node.prototype.appendChild?u.inPlace(Node.prototype,h,"dom-"):(u.inPlace(HTMLElement.prototype,h,"dom-"),u.inPlace(HTMLHeadElement.prototype,h,"dom-"),u.inPlace(HTMLBodyElement.prototype,h,"dom-")), f.on("dom-start",function(t){r(t[0])}) } ``` -------------------------------- ### Microsoft Clarity Initialization Source: https://world-nuclear.org/information-library/energy-and-the-environment/mineral-requirements-for-electricity-generation Integrates Microsoft Clarity analytics by asynchronously loading the Clarity tracking script. This enables session recording and heatmaps for user behavior analysis. ```javascript (function(c,l,a,r,i,t,y){ c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)}; t=l.createElement(r); t.async=1; t.src="https://www.clarity.ms/tag/"+i; y=l.getElementsByTagName(r)[0]; y.parentNode.insertBefore(t,y); })(window, document, "clarity", "script", "qml98r7qnh"); ``` -------------------------------- ### DNN Search Skin Object Initialization (Second Instance) Source: https://openstat.psa.gov.ph/ Initializes a second instance of the DNN search skin object, identical to the first. This suggests potential multiple search components on the page, each configured independently. ```javascript $(function() { if (typeof dnn != "undefined" && typeof dnn.searchSkinObject != "undefined") { var searchSkinObject = new dnn.searchSkinObject({ delayTriggerAutoSearch: 400, minCharRequiredTriggerAutoSearch: 2, searchType: 'S', enableWildSearch: true, cultureCode: 'en-US', portalId: -1 }); searchSkinObject.init(); // attach classic search var siteBtn = $('#dnn_dnnSearch_SiteRadioButton'); var webBtn = $('#dnn_dnnSearch_WebRadioButton'); var clickHandler = function() { if (siteBtn.is(':checked')) searchSkinObject.settings.searchType = 'S'; else searchSkinObject.settings.searchType = 'W'; }; siteBtn.on('change', clickHandler); webBtn.on('change', clickHandler); } }); ``` -------------------------------- ### setTimeout and setInterval Instrumentation Source: https://journals.plos.org/plosone/article Instruments `setTimeout`, `setInterval`, and their corresponding `clear` functions. It wraps the callback functions passed to these timers and emits events for timer start and duration, enabling monitoring of scheduled execution. ```javascript function r(t,e,n){t[0]=a(t[0],"fn-",null,n)} function o(t,e,n){this.method=n,this.timerDuration=isNaN(t[1])?0:+t[1], t[0]=a(t[0],"fn-",this,n)} var i=t("ee").get("timer"),a=t("wrap-function")(i),s="setTimeout",c="setInterval",f="clearTimeout",u="-start",d="-"; e.exports=i, a.inPlace(window,[s,"setImmediate"],s+d), a.inPlace(window,[c],c+d), a.inPlace(window,[f,"clearImmediate"],f+d), i.on(c+u,r), i.on(s+u,o) ``` -------------------------------- ### Rocket Preload Links Initialization Source: https://caseforsea.org/indonesia/ Initializes the Rocket Preload Links library, which enhances website performance by prefetching links on hover. It includes browser compatibility checks and configuration options for prefetching behavior. ```javascript var RocketBrowserCompatibilityChecker = (function() { function RocketBrowserCompatibilityChecker(config) { this.config = config; this.isBrowserSupported = false; this.init(); } RocketBrowserCompatibilityChecker.prototype.init = function() { if (this.config.capture === true && this.config.passive === true) { try { window.addEventListener('test', null, Object.defineProperty({}, 'passive', { get: function() { this.isBrowserSupported = true; }.bind(this) })); } catch (e) {} } }; RocketBrowserCompatibilityChecker.prototype.isPassiveSupported = function() { return this.isBrowserSupported; }; return RocketBrowserCompatibilityChecker; })(); var RocketPreloadLinks = (function() { function RocketPreloadLinks(browserChecker, config) { this.browser = browserChecker; this.config = config; this.prefetched = new Set(); this.regex = { fileExt: /\.(?:[a-z0-9]+)$/i, excludeUris: /^(mailto:)|(tel:)|(javascript:)|(data:)|(chrome-extension:)|(resource:)|(about:)$/i, images: /\.(?:png|gif|jpg|jpeg|svg|webp|bmp|ico|tiff)$/i }; this.init(); } RocketPreloadLinks.prototype.init = function() { if (!this.browser.isPassiveSupported()) { return; } this.config.siteUrl = this.config.siteUrl.replace(/\/$/, ''); document.addEventListener('mouseover', this.onMouseOver.bind(this), { passive: true }); document.addEventListener('touchstart', this.onTouchStart.bind(this), { passive: true }); }; RocketPreloadLinks.prototype.onMouseOver = function(event) { var target = event.target; var link = this._getLink(target); if (!link) { return; } this._addPrefetchLink(link); }; RocketPreloadLinks.prototype.onTouchStart = function(event) { var target = event.target; var link = this._getLink(target); if (!link) { return; } this._addPrefetchLink(link); }; RocketPreloadLinks.prototype.onHoverDelay = function(link) { var r; var t = link; if (this.numOnHover > this.config.rateThrottle) return; this.numOnHover++; this._addPrefetchLink(t); }; RocketPreloadLinks.prototype._addPrefetchLink = function(link) { if (this.prefetched.has(link.href)) return; var preparedUrl = this._prepareUrl(link); if (!preparedUrl) return; this.prefetched.add(preparedUrl.href); new Promise(function(resolve, reject) { var n = document.createElement('link'); n.rel = 'prefetch'; n.href = preparedUrl.href; n.onload = resolve; n.onerror = reject; document.head.appendChild(n); }).catch(function() {}); }; RocketPreloadLinks.prototype._prepareUrl = function(link) { if (link === null || typeof link !== 'object' || !('href' in link) || !link.href.match(/^https?:\/\//)) return null; var siteUrl = this.config.siteUrl; var t = link.href.substring(0, siteUrl.length); var n = this._getPathname(link.href, t); var prepared = { original: link.href, protocol: link.protocol, origin: t, pathname: n, href: t + n }; return this._isLinkOk(prepared) ? prepared : null; }; RocketPreloadLinks.prototype._getPathname = function(href, siteUrl) { var n = siteUrl ? href.substring(siteUrl.length) : href; if (!n.startsWith('/')) { n = '/' + n; } return this._shouldAddTrailingSlash(n) ? n + '/' : n; }; RocketPreloadLinks.prototype._shouldAddTrailingSlash = function(pathname) { return this.config.usesTrailingSlash && !pathname.endsWith('/') && !this.regex.fileExt.test(pathname); }; RocketPreloadLinks.prototype._isLinkOk = function(preparedUrl) { return preparedUrl !== null && typeof preparedUrl === 'object' && !this.prefetched.has(preparedUrl.href) && preparedUrl.origin === this.config.siteUrl && !preparedUrl.href.includes('?') && !preparedUrl.href.includes('#') && !this.regex.excludeUris.test(preparedUrl.href) && !this.regex.images.test(preparedUrl.href); }; RocketPreloadLinks.prototype._getLink = function(element) { var link = element.closest('a'); if (!link) { return null; } return link; }; return RocketPreloadLinks; })(); var RocketPreloadLinksConfig = { siteUrl: "https://www.transitionzero.org", onHoverDelay: 50, rateThrottle: 5 }; (function() { var browserChecker = new RocketBrowserCompatibilityChecker({ capture: true, passive: true }); var preloadLinks = new RocketPreloadLinks(browserChecker, RocketPreloadLinksConfig); preloadLinks.init(); })(); ``` -------------------------------- ### Critical Minerals per MW for Electricity Technologies (IEA) Source: https://world-nuclear.org/information-library/energy-and-the-environment/mineral-requirements-for-electricity-generation Details the quantity of critical minerals required per megawatt (MW) of installed capacity for different electricity generation technologies. This metric helps understand the material intensity at the point of deployment. ```text Technology Offshore wind Onshore wind Solar photovoltaics (PV) Nuclear Hydropower Biomass Coal Gas Plant t/MW 15.5 10.1 6.8 5.3 Low Low 2.5 1.2 ``` -------------------------------- ### Qubely Plugin Configuration Source: https://caseforsea.org/indonesia/ Configuration object for the Qubely plugin, including plugin URL, AJAX endpoint, security nonce, and the actual site URL. ```javascript var qubely_urls = { "plugin": "https:\/\/caseforsea.org\/wp-content\/plugins\/qubely\/", "ajax": "https:\/\/caseforsea.org\/wp-admin\/admin-ajax.php", "nonce": "99f5936003", "actual_url": "caseforsea.org" }; ``` -------------------------------- ### Promise Instrumentation Source: https://journals.plos.org/plosone/article Wraps the native Promise API, including the constructor and static methods like `all` and `race`, as well as prototype methods like `then` and `catch`. It instruments promise creation, resolution, rejection, and callback execution for monitoring. ```javascript function r(t){var e=i.context(),n=s(t,"executor-",e,null,!1),r=new f(n); return i.context(r).getCtx=function(){return e},r} var o=t("wrap-function"),i=t("ee").get("promise"),a=t("ee").getOrSetContext,s=o(i),c=t(32),f=NREUM.o.PR; e.exports=i, f&&( window.Promise=r, ["all","race"].forEach(function(t){ var e=f[t]; f[t]=function(n){ function r(t){return function(){i.emit("propagate",[null,!o],a,!1,!1),o=o||!t}} var o=!1; c(n,function(e,n){Promise.resolve(n).then(r("all"===t),r(!1))}); var a=e.apply(f,arguments),s=f.resolve(a); return s } }), ["resolve","reject"].forEach(function(t){ var e=f[t]; f[t]=function(t){ var n=e.apply(f,arguments); return t!==n&&i.emit("propagate",[t,!0],n,!1,!1),n } }), f.prototype["catch"]=function(t){return this.then(null,t)}, f.prototype=Object.create(f.prototype,{ constructor:{value:r} }), c(Object.getOwnPropertyNames(f),function(t,e){ try{r[e]=f[e]}catch(n){}}), o.wrapInPlace(f.prototype,"then",function(t){ return function(){ var e=this,n=o.argsToArray.apply(this,arguments),r=a(e); r.promise=e, n[0]=s(n[0],"cb-",r,null,!1), n[1]=s(n[1],"cb-",r,null,!1); var c=t.apply(this,n); return r.nextPromise=c,i.emit("propagate",[e,!0],c,!1,!1), c } }), i.on("executor-start",function(t){t[0]=s(t[0],"resolve-",this,null,!1),t[1]=s(t[1],"resolve-",this,null,!1)}), i.on("executor-err",function(t,e,n){t[1](n)}), i.on("cb-end",function(t,e,n){i.emit("propagate",[n,!0],this.nextPromise,!1,!1)}), i.on("propagate",function(t,e,n){ this.getCtx&&!e||(this.getCtx=function(){ if(t instanceof Promise)var e=i.context(t); return e&&e.getCtx?e.getCtx():this }) }), r.toString=function(){return""+f} ) ``` -------------------------------- ### Fetch API Instrumentation Source: https://journals.plos.org/plosone/article Wraps the global fetch function and methods on Request and Response prototypes to monitor network requests. It captures request details, response sizes, and emits events for fetch start and end, including success and failure. ```javascript 8:[function(t,e,n){function r(t,e,n){var r=t[e];"function"==typeof r&&(t[e]=function(){var t=i(arguments),e={};o.emit(n+"before-start",[t]),e[m]&&e[m].dt&&(a=e[m].dt);var s=r.apply(this,t);return o.emit(n+"start",[t,a]),s.then(function(t){return o.emit(n+"end",[null,t]),t},function(t){throw o.emit(n+"end",[t]),t})})}var o=t("ee").get("fetch"),i=t(33),a=t(32);e.exports=o;var s=window,c="fetch-",f="fetch-body-",u=["arrayBuffer","blob","json","text","formData"],d=s.Request,p=s.Response,l=s.fetch,h="prototype",m="nr@context";d&&p&&l&&(a(u,function(t,e){r(d[h],e,f),r(p[h],e,f)}),r(s,"fetch",c),o.on(c+"end",function(t,e){var n=this;if(e){var r=e.headers.get("content-length");null!==r&&(n.rxSize=r),o.emit(c+"done",[null,e]),n}else o.emit(c+"done",[t]),n})})},{}] ``` -------------------------------- ### Timeline Component Styling with Swiper.js Source: https://www.dosm.gov.my/portal-main/landingv2 CSS rules for styling a responsive timeline component. This includes global styles, container setup, Swiper container, slide styling, content positioning, active slide transitions, pagination, and navigation buttons. It relies on Google Fonts (Lato, Poppins) and Swiper.js for its functionality. ```css html, body, .container { height: 100%; } body { font-family: 'Lato', sans-serif; font-family: 'Poppins', sans-serif; font-size: 14px; } a { color: #616161; } .container { text-align : center; background-color: #fff; flex-direction: column; } .title { font-size: 38px; color: #616161; font-style: italic; font-weight: 800; } .timeline { width: 100%; background-color: #fff; box-shadow: 0 5px 25px 5px rgba(0, 0, 0, 0.2); } .timeline .swiper-container { height: 600px; width: 100%; position: relative; background:#15818d; } .timeline .swiper-wrapper { transition: 2s cubic-bezier(0.68, -0.4, 0.27, 1.34) 0.2s; } .timeline .swiper-slide { position: relative; color: #fff; overflow: hidden; background-size: cover; background-repeat: no-repeat; background-position: center center; } .timeline .swiper-slide::after { content: ""; position: absolute; z-index: 1; right: -115%; bottom: -10%; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.7); box-shadow: -230px 0 150px 60vw rgba(0, 0, 0, 0.7); border-radius: 100%; } .timeline .swiper-slide-content { position: absolute; text-align: center; width: 80%; max-width: 400px; right: 50%; top: 13%; -webkit-transform: translate(50%, 0); transform: translate(50%, 0); font-size: 12px; z-index: 2; } .timeline .swiper-slide .timeline-year { display: block; font-style: italic; font-size: 42px; margin-bottom: 50px; -webkit-transform: translate3d(20px, 0, 0); transform: translate3d(20px, 0, 0); color: #d4a024; font-weight: 300; opacity: 0; transition: .2s ease .4s; } .timeline .swiper-slide .timeline-title { font-weight: 600; font-size: 38px; margin: 0 0 30px; opacity: 0; -webkit-transform: translate3d(20px, 0, 0); transform: translate3d(20px, 0, 0); transition: .2s ease .5s; } .timeline .swiper-slide .timeline-text { font-weight : 300; line-height: 1.5; opacity: 0; -webkit-transform: translate3d(20px, 0, 0); transform: translate3d(20px, 0, 0); transition: .2s ease .6s; } .timeline .swiper-slide .timeline-link { color : white; text-decoration : none; line-height: 1.5; opacity: 0; -webkit-transform: translate3d(20px, 0, 0); transform: translate3d(20px, 0, 0); transition: .2s ease .7s; } .timeline .swiper-slide .timeline-link:hover{ text-decoration : underline; } .timeline .swiper-slide-active .timeline-year { opacity: 1; -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); transition: .4s ease 1.6s; } .timeline .swiper-slide-active .timeline-title { opacity: 1; -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); transition: .4s ease 1.7s; } .timeline .swiper-slide-active .timeline-text { opacity: 1; -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); transition: .4s ease 1.8s; } .timeline .swiper-slide-active .timeline-link { opacity: 1; -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); transition: .4s ease 1.9s; } .timeline .swiper-pagination { right: 5% !important; height: 100%; display: flex; flex-direction: column; justify-content: center; font-style: italic; font-weight: 300; font-size: 18px; z-index: 1; } .timeline .swiper-pagination::before { content: ""; position: absolute; left: -30px; top: 0; height: 100%; width: 1px; background-color: rgba(255, 255, 255, 0.2); } .timeline .swiper-pagination-bullet { width: auto; height: auto; text-align: left; opacity: 1; background: transparent; color: white; margin: 15px 0 !important; position: relative; } .timeline .swiper-pagination-bullet::before { content: ""; position: absolute; top: 8px; left: -32.5px; width: 6px; height: 6px; border-radius: 100%; background-color: #d4a024; -webkit-transform: scale(0); transform: scale(0); transition: .2s; } .timeline .swiper-pagination-bullet-active { color: #d4a024; } .timeline .swiper-pagination-bullet-active::before { -webkit-transform: scale(1); transform: scale(1); } .timeline .swiper-button-next, .timeline .swiper-button-prev { background-size: 20px 20px; top: 15%; width: 20px; height: 20px; margin-top: 0; z-index: 2; transition: .2s; } .timeline .swiper-button-prev { left: 8%; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M0%2C22L22%2C0l2.1%2C2.1L4.2%2C22l19.9%2C19.9L22%2C44L0%2C22L0%2C22L0%2C22z'%20fill%3D'%23d4a024'%2F%3E%3C%2Fsvg%3E"); } .timeline .swiper-button-prev:hover { -webkit-transform: translateX(-3px); transform: translateX(-3px); } .timeline .swiper-button-next { right: 8%; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D ``` -------------------------------- ### Initialize Google Tag Manager Source: https://rezoning.energydata.info/ This JavaScript snippet initializes Google Tag Manager (GTM) on the page. It asynchronously loads the GTM script, enabling the management of marketing and analytics tags through the GTM interface. The script ensures GTM is loaded correctly by injecting it into the document's head. ```JavaScript (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-MJPB63F'); ``` -------------------------------- ### Qubely Pro Plugin URLs Source: https://caseforsea.org/indonesia/ Configuration object for Qubely Pro plugin, specifying the base URL for plugin assets. ```javascript var qubely_pro_urls = { "plugin": "https:\/\/caseforsea.org\/wp-content\/plugins\/qubely-pro\/" }; ``` -------------------------------- ### Get Media Link for PLOS ONE Article - JavaScript Source: https://journals.plos.org/plosone/article This JavaScript snippet dynamically updates a link to media coverage for a PLOS ONE article. It uses jQuery and a custom `$.getMediaLink` function to fetch a URL and assign it to the 'href' attribute of an element with ID 'tabRelated-link'. It requires jQuery and the `getMediaLink` function to be defined. ```javascript $(document).ready(function() { $.getMediaLink("10.1371/journal.pone.0171844").then(function (url) { $("#tabRelated-link").attr("href", url) } ) }) ```