Sha256: dca14825cc8180681c7a5faaada724aa8d9a00b6e42da4fd690dc6beb813d2ca
Contents?: true
Size: 1.13 KB
Versions: 149
Compression:
Stored size: 1.13 KB
Contents
// = require govuk_publishing_components/lib/govspeak/magna-charta window.GOVUK = window.GOVUK || {}; (function (GOVUK, $) { 'use strict' var BarchartEnhancement = function ($element) { this.$element = $element } BarchartEnhancement.prototype.init = function () { var $barchartsOriginal = this.$element.querySelectorAll('.js-barchart-table') var $barcharts = [] for (var j = 0; j < $barchartsOriginal.length; j++) { // this prevents the code from initialising more than once // we'd use :not selectors for $barchartsOriginal but for lack of IE8 support var styles = $barchartsOriginal[j].className if (styles.indexOf('mc-chart') === -1 && styles.indexOf('js-barchart-table-init') === -1) { $barcharts.push($barchartsOriginal[j]) } } for (var i = 0; i < $barcharts.length; i++) { var $table = $barcharts[i] new GOVUK.Modules.MagnaCharta().start($table, { toggleText: 'Change between chart and table' }) $table.className = $table.className + ' js-barchart-table-init' } } GOVUK.GovspeakBarchartEnhancement = BarchartEnhancement }(window.GOVUK, window.jQuery))
Version data entries
149 entries across 149 versions & 1 rubygems