├── .gitignore ├── .npmignore ├── .travis.yml ├── .travis ├── govuk_frontend_toolkit_npm_push.enc └── govuk_frontend_toolkit_npm_push.pub ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENCE ├── README.md ├── VERSION.txt ├── images ├── accordion-arrow-2x.png ├── accordion-arrow.png ├── arrow-sprite.png ├── crests │ ├── bis_crest_13px.png │ ├── bis_crest_13px_x2.png │ ├── bis_crest_18px.png │ ├── bis_crest_18px_x2.png │ ├── bis_crest_27px.png │ ├── bis_crest_27px_x2.png │ ├── coastguard_13px.png │ ├── coastguard_13px_x2.png │ ├── coastguard_18px.png │ ├── coastguard_18px_x2.png │ ├── coastguard_27px.png │ ├── coastguard_27px_x2.png │ ├── dit_crest_13px.png │ ├── dit_crest_13px_x2.png │ ├── dit_crest_18px.png │ ├── dit_crest_18px_x2.png │ ├── dit_crest_27px.png │ ├── dit_crest_27px_x2.png │ ├── hmrc_crest_13px.png │ ├── hmrc_crest_13px_x2.png │ ├── hmrc_crest_18px.png │ ├── hmrc_crest_18px_x2.png │ ├── hmrc_crest_27px.png │ ├── hmrc_crest_27px_x2.png │ ├── ho_crest_13px.png │ ├── ho_crest_13px_x2.png │ ├── ho_crest_18px.png │ ├── ho_crest_18px_x2.png │ ├── ho_crest_27px.png │ ├── ho_crest_27px_x2.png │ ├── mod_crest_13px.png │ ├── mod_crest_13px_x2.png │ ├── mod_crest_18px.png │ ├── mod_crest_18px_x2.png │ ├── mod_crest_27px.png │ ├── mod_crest_27px_x2.png │ ├── org_crest_13px.png │ ├── org_crest_13px_x2.png │ ├── org_crest_18px.png │ ├── org_crest_18px_x2.png │ ├── org_crest_27px.png │ ├── org_crest_27px_x2.png │ ├── portcullis_13px.png │ ├── portcullis_13px_x2.png │ ├── portcullis_18px.png │ ├── portcullis_18px_x2.png │ ├── portcullis_27px.png │ ├── portcullis_27px_x2.png │ ├── so_crest_13px.png │ ├── so_crest_13px_x2.png │ ├── so_crest_18px.png │ ├── so_crest_18px_x2.png │ ├── so_crest_27px.png │ ├── so_crest_27px_x2.png │ ├── ukaea_crest_13px.png │ ├── ukaea_crest_13px_x2.png │ ├── ukaea_crest_18px.png │ ├── ukaea_crest_18px_x2.png │ ├── ukaea_crest_27px.png │ ├── ukaea_crest_27px_x2.png │ ├── ukho_13px.png │ ├── ukho_13px_x2.png │ ├── ukho_18px.png │ ├── ukho_18px_x2.png │ ├── ukho_27px.png │ ├── ukho_27px_x2.png │ ├── wales_crest_13px.png │ ├── wales_crest_13px_x2.png │ ├── wales_crest_18px.png │ ├── wales_crest_18px_x2.png │ ├── wales_crest_27px.png │ └── wales_crest_27px_x2.png ├── icon-arrow-left.png ├── icon-calendar-2x.png ├── icon-calendar.png ├── icon-file-download-2x.png ├── icon-file-download.png ├── icon-important-2x.png ├── icon-important.png ├── icon-information-2x.png ├── icon-information.png ├── icon-locator-2x.png ├── icon-locator.png ├── icon-pointer-2x.png ├── icon-pointer-black-2x.png ├── icon-pointer-black.png ├── icon-pointer-indexed.png ├── icon-pointer.png ├── icon-search-2x.png ├── icon-search.png ├── icon-steps │ ├── icon-step-1-2x.png │ ├── icon-step-1.png │ ├── icon-step-10-2x.png │ ├── icon-step-10.png │ ├── icon-step-11-2x.png │ ├── icon-step-11.png │ ├── icon-step-12-2x.png │ ├── icon-step-12.png │ ├── icon-step-13-2x.png │ ├── icon-step-13.png │ ├── icon-step-14-2x.png │ ├── icon-step-14.png │ ├── icon-step-2-2x.png │ ├── icon-step-2.png │ ├── icon-step-3-2x.png │ ├── icon-step-3.png │ ├── icon-step-4-2x.png │ ├── icon-step-4.png │ ├── icon-step-5-2x.png │ ├── icon-step-5.png │ ├── icon-step-6-2x.png │ ├── icon-step-6.png │ ├── icon-step-7-2x.png │ ├── icon-step-7.png │ ├── icon-step-8-2x.png │ ├── icon-step-8.png │ ├── icon-step-9-2x.png │ └── icon-step-9.png ├── player-icon-forward.png ├── player-icon-pause.png ├── player-icon-play.png ├── player-icon-rewind.png ├── player-icon-volume.png ├── separator-2x.png └── separator.png ├── javascripts ├── govuk │ ├── details.polyfill.js │ ├── modules.js │ ├── modules │ │ └── auto-track-event.js │ ├── primary-links.js │ ├── selection-buttons.js │ ├── shim-links-with-button-role.js │ ├── show-hide-content.js │ ├── stick-at-top-when-scrolling.js │ └── stop-scrolling-at-footer.js ├── govuk_toolkit.js ├── stageprompt.js └── vendor │ ├── jquery │ └── jquery.player.min.js │ └── polyfills │ └── bind.js ├── package-lock.json ├── package.json ├── publish.sh └── stylesheets ├── .gitkeep ├── _colours.scss ├── _conditionals.scss ├── _css3.scss ├── _device-pixels.scss ├── _font_stack.scss ├── _grid_layout.scss ├── _helpers.scss ├── _measurements.scss ├── _shims.scss ├── _typography.scss ├── _url-helpers.scss ├── colours ├── _organisation.scss └── _palette.scss └── design-patterns ├── _alpha-beta.scss ├── _breadcrumbs.scss ├── _buttons.scss └── _media-player.scss /.gitignore: -------------------------------------------------------------------------------- 1 | npm-debug.log 2 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | publish.sh 2 | .travis/ 3 | .travis.yml 4 | VERSION.txt 5 | govuk_frontend_toolkit/ 6 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | sudo: false 3 | branches: 4 | only: 5 | - master 6 | before_install: 7 | - openssl aes-256-cbc -K $encrypted_20fd811ec9c2_key -iv $encrypted_20fd811ec9c2_iv 8 | -in .travis/govuk_frontend_toolkit_npm_push.enc -out ~/.ssh/id_rsa -d 9 | - chmod 600 ~/.ssh/id_rsa 10 | - git config --global user.name "GOV.UK Design System CI" 11 | - git config --global user.email "design-system-pipeline@digital.cabinet-office.gov.uk" 12 | - git remote add origin_ssh git@github.com:alphagov/govuk_frontend_toolkit_npm.git 13 | install: 14 | - echo "No dependencies to install" 15 | script: 16 | - "./publish.sh" 17 | deploy: 18 | provider: npm 19 | email: govuk-dev@digital.cabinet-office.gov.uk 20 | api_key: 21 | secure: AJmAfaMVAXD0nAz8nGzIgNwxZckFHNkAnqQjqPBn/t6CaKiqTXuY6fzBKas1xMknzujMgvFqa16NSZJpwekiVWox0i6HycvU+gRP1oau8v7cNAca5jiLepO6HOhzNNlczJrC2G0EEkCUUptegHx8EJJTpH2r9xKC8Vunn0FCSfo= 22 | on: 23 | branch: master 24 | -------------------------------------------------------------------------------- /.travis/govuk_frontend_toolkit_npm_push.enc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/.travis/govuk_frontend_toolkit_npm_push.enc -------------------------------------------------------------------------------- /.travis/govuk_frontend_toolkit_npm_push.pub: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDtFrfc0ti2f/AU35j7s0dMv8gIqEl9YQf7VGWXT8HLS6ghQFrXolk5QN4tn6+iO9onCG1tktfjOChiWZqPxwR7awrGIh5kG4QwcTLEY/74mFdxm/RWF0kU0H3a2TdkJLPiebDkZJeAS9KOlJiTSZYsLaIU6UyTKIAmH/JiJY2bfNHSeRoNDfoWIJj0UlFxWCwmGSGRKaqxHB3L82EaQSeXcsLnTq46/xXcAWfJVMCWlqZVN9R/14seedSMI4Lh7rhm01UTmvedQubbv0ZAk5ro+aLUCQvxVQLRow33f4RpVVz+wpVKZHF1K1dQhugSqjZWAT8PeDKhhIl8xqVn0LYMnOBU6C50Y76DFl//8QLHTq/uUx9beyalr+hxfDgmm6VYUNCQSncxlnTle/uoXmGAG+BmTG1pbRFOw6BlbnX5grT7MCwlXda7t5DXaWI1WPrgB4viUzDAIgJciMluvRIvKgCRkjM/jxH59lGBby68WE2GDXH/37Ds0aULoyGdv1UgYFIziMy29Y7CdqNW+QGhZUsKgT7Kig/RJRBbjWXpPdjn+LYkzwhkIwHVUBNwy614+Wj5DNJJXY7oHPY9FBumH60MQA59McX6g8VMbGGDujlzfhyZgdvAByxgejcyMfpX9lQvlB8EFttyq/XMRxeRmTfKFZQAOF84LnvxAMNrPw== design-system-pipeline@digital.cabinet-office.gov.uk 2 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 9.0.1 2 | 3 | - Remove explicit dependency on ruby-sass. This dependency isn't required or sufficient to integrate with Ruby-on-Rails, expectation is that all consumers of this gem already use sass-rails or sassc-rails. 4 | 5 | # 9.0.0 6 | 7 | - Breaking change: Remove Google Analytics code (migrated to static) 8 | 9 | As this library has been deprecated the code has been [migrated to static](https://github.com/alphagov/static/pull/1795) for use in GOV.UK Publishing. 10 | 11 | Note that any code that explicitly relies upon the analytics code in toolkit will no longer work. If you require this code, do not update from v8.2.0, or make a copy of it in your application. 12 | 13 | # 8.2.0 14 | 15 | - Update MHLCG brand colour 16 | - Disable Google Analytics Ad Features by default 17 | 18 | # 8.1.0 19 | 20 | - Enables cross domain event tracking. Preserves previous cross domain pageview tracking behaviours but adds optional 21 | abilities to send events to linked GA trackers. 22 | 23 | ([PR 472](https://github.com/alphagov/govuk_frontend_toolkit/pull/472)). 24 | 25 | # 8.0.0 26 | 27 | - Breaking change: Add support for Google Analytics Universal in stageprompt.js 28 | 29 | This is a breaking change since while we allow for the old behaviour, Google Analytics Universal is used by the default, which could change behaviour in applications. 30 | 31 | Also ensures that events triggered via GA Universal do not impact bounce-rate calculations, 32 | which mirrors the original implementation. 33 | 34 | ([PR 421](https://github.com/alphagov/govuk_frontend_toolkit/pull/421)). 35 | 36 | - Fix: Add support to show-hide-content.js for form fields with more varied characters: ([PR 403](https://github.com/alphagov/govuk_frontend_toolkit/pull/403)). 37 | 38 | # 7.6.0 39 | 40 | - Strip emails from urls for all GA requests to catch cases when GA generates a new event (e.g. page timings): ([PR 466](https://github.com/alphagov/govuk_frontend_toolkit/pull/466)). 41 | 42 | # 7.5.0 43 | 44 | - Implement optional stripping of dates for arguments passed to GA: ([PR #459](https://github.com/alphagov/govuk_frontend_toolkit/pull/459)) 45 | 46 | # 7.4.2 47 | 48 | - Remove the deprecation warning in javascripts/govuk/selection-buttons.js as it is coupled to a different project which is not always used with this gem. 49 | 50 | # 7.4.1 51 | 52 | - Use a path, not a full url, as the `defaultPathForTrackPageview` because our analytics trackers expect the explicit page param to be a path, not a url ([PR #451](https://github.com/alphagov/govuk_frontend_toolkit/pull/451)). Analytics sent with 7.3.0 and 7.4.0 are broken without this fix. 53 | 54 | # 7.4.0 55 | 56 | - Allow wrapping arguments to analytics as PII safe to tell the analytics code not to attempt to strip PII from the values: ([PR #448](https://github.com/alphagov/govuk_frontend_toolkit/pull/448)) 57 | - Documentation improvements: ([PR #446](https://github.com/alphagov/govuk_frontend_toolkit/pull/446), [PR #447](https://github.com/alphagov/govuk_frontend_toolkit/pull/447)) 58 | 59 | # 7.3.0 60 | 61 | - Strip PII from all arguments passed to GA. Emails are stripped by default, postcodes can also be stripped if configured to do so: ([PR #435](https://github.com/alphagov/govuk_frontend_toolkit/pull/435)). 62 | - Update sass and govuk-lint dependencies: ([PR #444](https://github.com/alphagov/govuk_frontend_toolkit/pull/444)). 63 | 64 | # 7.2.0 65 | 66 | - Add custom dimension on TrackEvent to duplicate the url information that we normally send on a the `event action`. This will be used to join up with a scheduled custom upload called "External Link Status". We can only join uploads on custom dimensions, not on `event actions`, where we normally add the url info. ([PR #436](alphagov/govuk_frontend_toolkit#436) and [PR #439](alphagov/govuk_frontend_toolkit#439)) 67 | 68 | # 7.1.0 69 | 70 | - Promote the details polyfill to Frontend Toolkit from GOV.UK Elements ([PR #426](https://github.com/alphagov/govuk_frontend_toolkit/pull/426)). 71 | 72 | # 7.0.1 73 | 74 | - Volume up and down buttons in the media player were overlapping the current volume percentage on focus. This fix keeps the large button touch area, but adjusts the focus state to be smaller. ([PR #429](https://github.com/alphagov/govuk_frontend_toolkit/pull/429)). 75 | 76 | # 7.0.0 77 | 78 | - Remove multivariate test library ([PR #420](https://github.com/alphagov/govuk_frontend_toolkit/pull/420)). If you need to continue using this library please copy the JavaScript and documentation from version 6.0.4 into your repository. 79 | 80 | # 6.0.4 81 | 82 | - Version bumping related to [govuk_frontend_toolkit_gem PR #15](https://github.com/alphagov/govuk_frontend_toolkit_gem/pull/15) 83 | 84 | # 6.0.3 85 | 86 | - Allow the passing of a [fields object](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference) 87 | to the `trackShare` method in analytics, in line with the Google Analytics 88 | [social interactions API](https://developers.google.com/analytics/devguides/collection/analyticsjs/social-interactions) 89 | - Add documentation for new version releases 90 | 91 | # 6.0.2 92 | 93 | - Increase button focus specificity to avoid being overridden by govuk_template ([PR #409](https://github.com/alphagov/govuk_frontend_toolkit/pull/409)) 94 | 95 | # 6.0.1 96 | 97 | - Fix a Javascript error in IE7 caused by trying to access a character within a string using array notation ([PR #407](https://github.com/alphagov/govuk_frontend_toolkit/pull/407)) 98 | 99 | # 6.0.0 100 | 101 | - Breaking change: configure the GOV.UK Analytics tracker with `govukTrackerUrl` instead of `govukTrackerGifUrl` ([PR #405](https://github.com/alphagov/govuk_frontend_toolkit/pull/405)) 102 | - Fix the sending of the GA Client ID with calls to the GOV.UK Tracker ([PR #404](https://github.com/alphagov/govuk_frontend_toolkit/pull/404)) 103 | - Disable GA ad tracking ([PR #401](https://github.com/alphagov/govuk_frontend_toolkit/pull/401)) 104 | 105 | # 5.2.0 106 | 107 | - Deprecate selection-buttons.js. Add a deprecation warning: Custom radio buttons and checkboxes (released in GOV.UK Elements 3.0.0) no longer require this JavaScript. 108 | 109 | # 5.1.3 110 | 111 | - Add an experimental GOV.UK analytics tracker. Given the URL to a single pixel GIF, it will encode analytics data as query string parameters on the call to the GIF ([PR #387](https://github.com/alphagov/govuk_frontend_toolkit/pull/387)) 112 | 113 | # 5.1.2 114 | 115 | - Update show-hide-content.js to work with new `.multiple-choice` custom radio buttons and checkboxes, released in GOV.UK elements 3.0.0 ([PR #390](https://github.com/alphagov/govuk_frontend_toolkit/pull/390)) 116 | - Fix buttons not having an outer edge when colours are changed via browser settings - add an outline so they look like buttons. ([PR #377](https://github.com/alphagov/govuk_frontend_toolkit/pull/377)) 117 | 118 | # 5.1.1 119 | 120 | - Update the alpha, beta and discovery colours to $govuk-blue to match the updated phase banner ([PR #370](https://github.com/alphagov/govuk_frontend_toolkit/pull/370)) 121 | - Fix radio button show/hide behaviour when used outside a form ([PR #375](https://github.com/alphagov/govuk_frontend_toolkit/pull/375)) 122 | - Fix a "Stick at top when scrolling" component bug related to scroll anchoring in Chrome 56+ ([PR #376](https://github.com/alphagov/govuk_frontend_toolkit/pull/376)) 123 | - Minor travis fixes ([PR #373](https://github.com/alphagov/govuk_frontend_toolkit/pull/373)) 124 | 125 | # 5.1.0 126 | 127 | - Allow custom options when tracking events ([PR #365](https://github.com/alphagov/govuk_frontend_toolkit/pull/365)) 128 | 129 | # 5.0.3 130 | 131 | - Change HMRC and DEFRA text colours for improved contrast ([PR #368](https://github.com/alphagov/govuk_frontend_toolkit/pull/368)) 132 | 133 | # 5.0.2 134 | 135 | - Change colour used in phase tags to govuk-blue ([PR #353](https://github.com/alphagov/govuk_frontend_toolkit/pull/353)) 136 | 137 | # 5.0.1 138 | 139 | - Fix role="button" click shim ([PR #347](https://github.com/alphagov/govuk_frontend_toolkit/pull/347)) 140 | - Make font variables lowercase ([PR #348](https://github.com/alphagov/govuk_frontend_toolkit/pull/348)) 141 | - Update selection button documentation ([PR #350](https://github.com/alphagov/govuk_frontend_toolkit/pull/350)) 142 | 143 | # 5.0.0 144 | 145 | This release includes two breaking changes: 146 | - Removal of external link styles and icons, if you are using the external-link-* mixins you will need to remove them from your codebase ([PR #293](https://github.com/alphagov/govuk_frontend_toolkit/pull/293)) 147 | - Correct spelling of the 'accordion' icon, you will need to check for the incorrect spelling 'accordian' and update if you are using this icon ([PR #345](https://github.com/alphagov/govuk_frontend_toolkit/pull/345)) 148 | And two minor changes: 149 | - Amend GOVUK.StickAtTopWhenScrolling to resize the sticky element and shim when the .js-sticky-resize class is set ([PR #343](https://github.com/alphagov/govuk_frontend_toolkit/pull/343)) 150 | - Allow custom options in GOVUK.analytics.trackPageview ([#332](https://github.com/alphagov/govuk_frontend_toolkit/pull/332)) 151 | 152 | # 4.18.4 153 | 154 | - Lint codebase using standard ([PR #334](https://github.com/alphagov/govuk_frontend_toolkit/pull/334)) 155 | - Add semicolons at the start of IIFE's ([PR #339](https://github.com/alphagov/govuk_frontend_toolkit/pull/339)) 156 | 157 | # 4.18.3 158 | 159 | - For smaller screens (<768px) ensure that the GOVUK.StickAtTopWhenScrolling JS "unsticks" the element which was previously "stuck" (by removing both the class which sets fixed positioning and the shim). ([PR #329](https://github.com/alphagov/govuk_frontend_toolkit/pull/329)) 160 | 161 | # 4.18.2 162 | 163 | - Remove unnecessary print font fallback that causes regression downstream ([PR #328](https://github.com/alphagov/govuk_frontend_toolkit/pull/328)) 164 | - Update tooling to use npm script rather than grunt-shell ([PR #327](https://github.com/alphagov/govuk_frontend_toolkit/pull/327)) 165 | 166 | # 4.18.1 167 | 168 | - Fix error in IE - remove trailing comma from shimLinksWithButtonRole JavaScript ([PR #323](https://github.com/alphagov/govuk_frontend_toolkit/pull/323)). 169 | 170 | # 4.18.0 171 | 172 | - Add GOVUK.ShowHideContent JavaScript to support showing and hiding content, toggled by radio buttons and checkboxes ([PR #315](https://github.com/alphagov/govuk_frontend_toolkit/pull/315)). 173 | 174 | # 4.17.0 175 | 176 | - SelectionButtons will add a class to the label with the type of the child input ([PR #317](https://github.com/alphagov/govuk_frontend_toolkit/pull/317)) 177 | 178 | # 4.16.1 179 | 180 | - Fix anchor-buttons.js to trigger a native click event, also rename to shimLinksWithButtonRole.js to explain what it does 181 | - Add tests for shimLinksWithButtonRole ([PR #310](https://github.com/alphagov/govuk_frontend_toolkit/pull/310)) 182 | 183 | # 4.16.0 184 | 185 | - Add Department for International Trade organisation ([PR #308](https://github.com/alphagov/govuk_frontend_toolkit/pull/308)) 186 | 187 | # 4.15.0 188 | 189 | - Add support for Google Analytics fieldsObject ([PR #298](https://github.com/alphagov/govuk_frontend_toolkit/pull/298)) 190 | - anchor-buttons.js: normalise keyboard behaviour between buttons and links with a button role ([PR #297](https://github.com/alphagov/govuk_frontend_toolkit/pull/297)) 191 | 192 | # 4.14.1 193 | 194 | - Fix tabular number sizing in Firefox ([PR #301](https://github.com/alphagov/govuk_frontend_toolkit/pull/301)) 195 | 196 | # 4.14.0 197 | 198 | - Allow use of multiple GA customDimensionIndex. See [this section](https://github.com/alphagov/govuk_frontend_toolkit/blob/master/docs/javascript.md#using-google-custom-dimensions-with-your-own-statistical-model) of the documentation for more information. 199 | - Configurable duration (in days) for AB Test cookie. See [this section](https://github.com/alphagov/govuk_frontend_toolkit/blob/master/docs/javascript.md#multivariate-test-framework) of the documentation for more information. 200 | - Allow base scripts to run within a module loader. See [this PR](https://github.com/alphagov/govuk_frontend_toolkit/pull/290) for more information. 201 | 202 | # 4.13.0 203 | 204 | - Make headings block-level by default (PR #200). If you are styling elements you want to be inline with heading includes, you’ll need to explicitly make them inline in your CSS. 205 | 206 | # 4.12.0 207 | 208 | - Increase button padding to match padding from GOV.UK elements (PR #275). 209 | If you have UI which depends on the padding set by the button mixin in the frontend toolkit and this is not overridden by button padding set by GOV.UK elements, this change will affect it. 210 | 211 | # 4.11.0 212 | 213 | - Remove the GDS-Logo font-face definition (PR #272) 214 | - Move the @viewport statements to govuk_template (PR #272). If you upgrade to this version of govuk_frontend_toolkit and you’re also using govuk_template you’ll need to upgrade that to at least 0.17.2 to maintain compatibility with desktop IE10 in snap mode. 215 | 216 | # 4.10.0 217 | 218 | - Allow New Transport font stack to be overridden by apps using `$toolkit-font-stack` 219 | and `$toolkit-font-stack-tabular` (PR #230) 220 | 221 | # 4.9.1 222 | 223 | - Fix phase banner alignment (PR #266) 224 | 225 | # 4.9.0 226 | 227 | - Add websafe organisation colours 228 | - Split colours into two files with backwards-compatible colours.scss replacement 229 | 230 | # 4.8.2 231 | 232 | - Add GOV.UK lint to lint scss files (PR #260) 233 | - Remove reference to old colour palette (PR #256) 234 | - Fix link to GOV.UK elements - tabular data 235 | 236 | # 4.8.1 237 | 238 | - Update DEFRA brand colour to new green (PR #249) 239 | 240 | # 4.8.0 241 | 242 | - Pass cohort name to analytics when using multivariate test (PR #251) 243 | 244 | # 4.7.0 245 | 246 | - Add 'mailto' tracking to GOV.UK Analytics (PR #244) 247 | 248 | # 4.6.1 249 | 250 | - Use the Sass variable $light-blue for link active and hover colours (PR #242) 251 | 252 | # 4.6.0 253 | 254 | - Add breadcrumb styles, separator images and documentation (PR #236) 255 | - Add fallback image for the back link (PR #235) 256 | 257 | # 4.5.0 258 | 259 | - Find and auto-start JavaScript modules from markup: `data-module="module-name"`(PR #227) 260 | 261 | # 4.4.0 262 | 263 | - Add helpers partial for functions 264 | - Add px to em function and documentation 265 | 266 | # 4.3.0 267 | 268 | - Allow javascript error tracking to be filtered to avoid noise from plugins 269 | 270 | # 4.2.1 271 | 272 | - Track download links using events not pageviews 273 | 274 | # 4.2.0 275 | 276 | - Add two analytics plugins for download and external link tracking 277 | - Update typography mixins to be mobile first (PR #157) 278 | 279 | # 4.1.1 280 | 281 | - Update Accessible Media Player to remove dependency on $.browser (PR #206) 282 | 283 | # 4.1.0 284 | 285 | - Add support for sending the `page` option to `GOVUK.analytics.trackEvent` (PR #203) 286 | 287 | # 4.0.1 288 | 289 | - Fix: stop multiline text from dropping below phase tag. 290 | 291 | # 4.0.0 292 | 293 | - Remove Google Analytics classic https://github.com/alphagov/govuk_frontend_toolkit/pull/194 294 | - References to google-analytics-classic-tracker.js should be removed 295 | - Rename GOVUK.Tracker to GOVUK.Analytics 296 | - References to GOVUK.Tracker should be updated 297 | 298 | # 3.5.1 299 | 300 | - Changes Analytics API library to accept one, both or neither of the 301 | analytics tracking codes. This means we can start removing classic 302 | tracking codes from apps. 303 | 304 | #3.5.0 305 | 306 | - Adds cross domain tracking to Analytics API library: https://github.com/alphagov/govuk_frontend_toolkit/pull/185 307 | - Adds sass variables for discovery and live phases 308 | 309 | #3.4.2 310 | 311 | - Fix: Before this fix, when a user fell into variant 0 of a multivariate test, 312 | the data wouldn't be reported to Google correctly because of a broken 313 | null check in the code block that opts the user into the Google Content 314 | Experiment. 315 | 316 | # 3.4.1 317 | 318 | - Fix: Make the error colour a darker red for greater contrast and to meet WCAG 2.0 AAAA 319 | (this was meant to go into 3.3.1 but was lost from history) 320 | - Add `$focus-colour` variable (#180) 321 | 322 | # 3.4.0 323 | 324 | - multivariate-test.js: add support for using Google Content Experiments as the reporting 325 | backend for multivariate tests 326 | 327 | # 3.3.1 328 | 329 | - Fix: Make the error colour a darker red for greater contrast and to meet WCAG 2.0 AAAA 330 | 331 | # 3.3.0 332 | 333 | - Add: Analytics - pageview tracking for a print attempt 334 | 335 | # 3.2.1 336 | 337 | - Fix: Analytics - don't run error and print plugins on load 338 | 339 | # 3.2.0 340 | 341 | - Add: Analytics API https://github.com/alphagov/govuk_frontend_toolkit/pull/162 https://github.com/alphagov/govuk_frontend_toolkit/blob/master/docs/analytics.md 342 | 343 | # 3.1.0 344 | 345 | - Fix: outdent to add right margin rather than only left 346 | - Fix: add missing semi-colons in JavaScript files 347 | - Fix: use box-sizing mixin in column mixin to support more browsers 348 | - Add: ability to specify float direction on column mixin 349 | - Add: Sass-lint tests 350 | 351 | # 3.0.1 352 | 353 | - Fix a bug with the npm publishing. npm requires a version change to publish a package. 354 | 355 | # 3.0.0 356 | 357 | - Change publishing method to not use git submodules in govuk_frontend_toolkit_npm. 358 | This is a major version bump because it will move the toolkit from 359 | `./node_modules/govuk_frontend_toolkit/govuk_frontend_toolkit/` 360 | to `./node_modules/govuk_frontend_toolkit/`, which will break relative imports in Sass. 361 | - Fix typo in Sass comment 362 | 363 | # 2.0.1 364 | 365 | - Fix new grid helpers to ensure content using %site-width-container is centred in IE. 366 | 367 | # 2.0.0 368 | 369 | - Add support for selection-button events to be document-level https://github.com/alphagov/govuk_frontend_toolkit/pull/139 370 | - The `GOVUK.selectionButtons` interface is now deprecated. Details are in the [README](https://github.com/alphagov/govuk_frontend_toolkit#deprecated-functionality). 371 | 372 | # 1.7.0 373 | 374 | - Create new grid helpers for creating grid layouts 375 | - The old grid mixins; `@outer-block` and `@inner-block` are now deprecated 376 | 377 | # 1.6.2 378 | 379 | - Reset font family for print stylesheets to fix print errors in browsers and printers 380 | 381 | # 1.6.1 382 | 383 | - Fix visited link colour to be a colour which passes contrast 384 | 385 | # 1.6.0 386 | 387 | - abstraction of the core typography mixins into single core mixin 388 | - reference to composer module added to README 389 | - selection buttons added to manifest for localSpecRunner 390 | - test for sass compilation 391 | - fix for selection buttons 392 | 393 | # 1.5.0 394 | 395 | - polyfill for Function.prototype.bind added 396 | - selection-buttons script added 397 | - local runner added for Jasmine tests 398 | 399 | # 1.4.0 400 | 401 | - New phase banner styles 402 | - Removed trailing commas 403 | - Redrawn important icon 404 | 405 | # 1.3.0 406 | 407 | - Adds weighting to multivariant testing 408 | 409 | # 1.2.0 410 | 411 | - add three quarters variable to measurements 412 | - improvements to CSS3 mixins 413 | - set inner block mixin to use either padding or margin 414 | - increase button padding to match alphagov/static defaults 415 | 416 | # 1.1.0 417 | 418 | Add icons from alphagov/static 419 | 420 | # 1.0.1 421 | 422 | Fix contrast on phase banner 423 | 424 | # 1.0.0 425 | 426 | Considered stable 427 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to the toolkit 2 | 3 | We welcome patches to the toolkit. Please submit any changes 4 | to [the toolkit repository][govuk_frontend_toolkit] and they'll 5 | be included in the npm package when a new version is released. 6 | 7 | You shouldn't need to make any changes this repository to change 8 | the toolkit. 9 | 10 | [govuk_frontend_toolkit]: https://www.npmjs.org/package/govuk_frontend_toolkit 11 | -------------------------------------------------------------------------------- /LICENCE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Crown Copyright (Government Digital Service) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | The GOV.UK Design System launched on 22 June 2018 2 | =============== 3 | 4 | GOV.UK Frontend Toolkit has now been replaced by the GOV.UK Design System. The Toolkit will remain available in case you are currently using it, but is no longer maintained. The Government Digital Service will only carry out major bug fixes and security patches. 5 | 6 | The GOV.UK Design System will be updated to ensure the things it contains meet level AA of WCAG 2.1, but GOV.UK Frontend Toolkit will not. [Read more about accessibility of the GOV.UK Design System](https://design-system.service.gov.uk/accessibility/). 7 | 8 | --- 9 | 10 | # GOV.UK frontend toolkit npm package 11 | 12 | This is an npm package for [the GOV.UK frontend toolkit][toolkit]. 13 | It bundles up the toolkit and publishes [govuk_frontend_toolkit on the npmjs 14 | registry][npmjs] so that you can install it as a dependency in your JavaScript 15 | application. 16 | 17 | ## Installing 18 | 19 | To include the toolkit in your project run: 20 | 21 | ``` 22 | npm install --save govuk_frontend_toolkit 23 | ``` 24 | 25 | This will install the toolkit inside your `node_modules` and will add the 26 | package to your package.json. 27 | 28 | ## Updating this package 29 | 30 | All development of the toolkit should happen [upstream][toolkit] and changes 31 | will then become available in this package. 32 | 33 | When master is changed in the upstream repo Travis will [trigger a build][trigger] 34 | of this repository, which will automatically build and publish the module if the 35 | version in `VERSION.txt` is newer than the version published on NPM registry. 36 | 37 | ## Licence 38 | 39 | [MIT License](LICENCE) 40 | 41 | 42 | [toolkit]: https://github.com/alphagov/govuk_frontend_toolkit 43 | [npmjs]: https://www.npmjs.org/package/govuk_frontend_toolkit 44 | [trigger]: https://github.com/alphagov/govuk_frontend_toolkit/blob/master/trigger.sh 45 | -------------------------------------------------------------------------------- /VERSION.txt: -------------------------------------------------------------------------------- 1 | 9.0.1 2 | -------------------------------------------------------------------------------- /images/accordion-arrow-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/accordion-arrow-2x.png -------------------------------------------------------------------------------- /images/accordion-arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/accordion-arrow.png -------------------------------------------------------------------------------- /images/arrow-sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/arrow-sprite.png -------------------------------------------------------------------------------- /images/crests/bis_crest_13px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/bis_crest_13px.png -------------------------------------------------------------------------------- /images/crests/bis_crest_13px_x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/bis_crest_13px_x2.png -------------------------------------------------------------------------------- /images/crests/bis_crest_18px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/bis_crest_18px.png -------------------------------------------------------------------------------- /images/crests/bis_crest_18px_x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/bis_crest_18px_x2.png -------------------------------------------------------------------------------- /images/crests/bis_crest_27px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/bis_crest_27px.png -------------------------------------------------------------------------------- /images/crests/bis_crest_27px_x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/bis_crest_27px_x2.png -------------------------------------------------------------------------------- /images/crests/coastguard_13px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/coastguard_13px.png -------------------------------------------------------------------------------- /images/crests/coastguard_13px_x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/coastguard_13px_x2.png -------------------------------------------------------------------------------- /images/crests/coastguard_18px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/coastguard_18px.png -------------------------------------------------------------------------------- /images/crests/coastguard_18px_x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/coastguard_18px_x2.png -------------------------------------------------------------------------------- /images/crests/coastguard_27px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/coastguard_27px.png -------------------------------------------------------------------------------- /images/crests/coastguard_27px_x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/coastguard_27px_x2.png -------------------------------------------------------------------------------- /images/crests/dit_crest_13px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/dit_crest_13px.png -------------------------------------------------------------------------------- /images/crests/dit_crest_13px_x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/dit_crest_13px_x2.png -------------------------------------------------------------------------------- /images/crests/dit_crest_18px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/dit_crest_18px.png -------------------------------------------------------------------------------- /images/crests/dit_crest_18px_x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/dit_crest_18px_x2.png -------------------------------------------------------------------------------- /images/crests/dit_crest_27px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/dit_crest_27px.png -------------------------------------------------------------------------------- /images/crests/dit_crest_27px_x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/dit_crest_27px_x2.png -------------------------------------------------------------------------------- /images/crests/hmrc_crest_13px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/hmrc_crest_13px.png -------------------------------------------------------------------------------- /images/crests/hmrc_crest_13px_x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/hmrc_crest_13px_x2.png -------------------------------------------------------------------------------- /images/crests/hmrc_crest_18px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/hmrc_crest_18px.png -------------------------------------------------------------------------------- /images/crests/hmrc_crest_18px_x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/hmrc_crest_18px_x2.png -------------------------------------------------------------------------------- /images/crests/hmrc_crest_27px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/hmrc_crest_27px.png -------------------------------------------------------------------------------- /images/crests/hmrc_crest_27px_x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/hmrc_crest_27px_x2.png -------------------------------------------------------------------------------- /images/crests/ho_crest_13px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/ho_crest_13px.png -------------------------------------------------------------------------------- /images/crests/ho_crest_13px_x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/ho_crest_13px_x2.png -------------------------------------------------------------------------------- /images/crests/ho_crest_18px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/ho_crest_18px.png -------------------------------------------------------------------------------- /images/crests/ho_crest_18px_x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/ho_crest_18px_x2.png -------------------------------------------------------------------------------- /images/crests/ho_crest_27px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/ho_crest_27px.png -------------------------------------------------------------------------------- /images/crests/ho_crest_27px_x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/ho_crest_27px_x2.png -------------------------------------------------------------------------------- /images/crests/mod_crest_13px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/mod_crest_13px.png -------------------------------------------------------------------------------- /images/crests/mod_crest_13px_x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/mod_crest_13px_x2.png -------------------------------------------------------------------------------- /images/crests/mod_crest_18px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/mod_crest_18px.png -------------------------------------------------------------------------------- /images/crests/mod_crest_18px_x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/mod_crest_18px_x2.png -------------------------------------------------------------------------------- /images/crests/mod_crest_27px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/mod_crest_27px.png -------------------------------------------------------------------------------- /images/crests/mod_crest_27px_x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/mod_crest_27px_x2.png -------------------------------------------------------------------------------- /images/crests/org_crest_13px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/org_crest_13px.png -------------------------------------------------------------------------------- /images/crests/org_crest_13px_x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/org_crest_13px_x2.png -------------------------------------------------------------------------------- /images/crests/org_crest_18px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/org_crest_18px.png -------------------------------------------------------------------------------- /images/crests/org_crest_18px_x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/org_crest_18px_x2.png -------------------------------------------------------------------------------- /images/crests/org_crest_27px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/org_crest_27px.png -------------------------------------------------------------------------------- /images/crests/org_crest_27px_x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/org_crest_27px_x2.png -------------------------------------------------------------------------------- /images/crests/portcullis_13px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/portcullis_13px.png -------------------------------------------------------------------------------- /images/crests/portcullis_13px_x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/portcullis_13px_x2.png -------------------------------------------------------------------------------- /images/crests/portcullis_18px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/portcullis_18px.png -------------------------------------------------------------------------------- /images/crests/portcullis_18px_x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/portcullis_18px_x2.png -------------------------------------------------------------------------------- /images/crests/portcullis_27px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/portcullis_27px.png -------------------------------------------------------------------------------- /images/crests/portcullis_27px_x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/portcullis_27px_x2.png -------------------------------------------------------------------------------- /images/crests/so_crest_13px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/so_crest_13px.png -------------------------------------------------------------------------------- /images/crests/so_crest_13px_x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/so_crest_13px_x2.png -------------------------------------------------------------------------------- /images/crests/so_crest_18px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/so_crest_18px.png -------------------------------------------------------------------------------- /images/crests/so_crest_18px_x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/so_crest_18px_x2.png -------------------------------------------------------------------------------- /images/crests/so_crest_27px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/so_crest_27px.png -------------------------------------------------------------------------------- /images/crests/so_crest_27px_x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/so_crest_27px_x2.png -------------------------------------------------------------------------------- /images/crests/ukaea_crest_13px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/ukaea_crest_13px.png -------------------------------------------------------------------------------- /images/crests/ukaea_crest_13px_x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/ukaea_crest_13px_x2.png -------------------------------------------------------------------------------- /images/crests/ukaea_crest_18px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/ukaea_crest_18px.png -------------------------------------------------------------------------------- /images/crests/ukaea_crest_18px_x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/ukaea_crest_18px_x2.png -------------------------------------------------------------------------------- /images/crests/ukaea_crest_27px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/ukaea_crest_27px.png -------------------------------------------------------------------------------- /images/crests/ukaea_crest_27px_x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/ukaea_crest_27px_x2.png -------------------------------------------------------------------------------- /images/crests/ukho_13px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/ukho_13px.png -------------------------------------------------------------------------------- /images/crests/ukho_13px_x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/ukho_13px_x2.png -------------------------------------------------------------------------------- /images/crests/ukho_18px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/ukho_18px.png -------------------------------------------------------------------------------- /images/crests/ukho_18px_x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/ukho_18px_x2.png -------------------------------------------------------------------------------- /images/crests/ukho_27px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/ukho_27px.png -------------------------------------------------------------------------------- /images/crests/ukho_27px_x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/ukho_27px_x2.png -------------------------------------------------------------------------------- /images/crests/wales_crest_13px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/wales_crest_13px.png -------------------------------------------------------------------------------- /images/crests/wales_crest_13px_x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/wales_crest_13px_x2.png -------------------------------------------------------------------------------- /images/crests/wales_crest_18px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/wales_crest_18px.png -------------------------------------------------------------------------------- /images/crests/wales_crest_18px_x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/wales_crest_18px_x2.png -------------------------------------------------------------------------------- /images/crests/wales_crest_27px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/wales_crest_27px.png -------------------------------------------------------------------------------- /images/crests/wales_crest_27px_x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/crests/wales_crest_27px_x2.png -------------------------------------------------------------------------------- /images/icon-arrow-left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-arrow-left.png -------------------------------------------------------------------------------- /images/icon-calendar-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-calendar-2x.png -------------------------------------------------------------------------------- /images/icon-calendar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-calendar.png -------------------------------------------------------------------------------- /images/icon-file-download-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-file-download-2x.png -------------------------------------------------------------------------------- /images/icon-file-download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-file-download.png -------------------------------------------------------------------------------- /images/icon-important-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-important-2x.png -------------------------------------------------------------------------------- /images/icon-important.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-important.png -------------------------------------------------------------------------------- /images/icon-information-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-information-2x.png -------------------------------------------------------------------------------- /images/icon-information.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-information.png -------------------------------------------------------------------------------- /images/icon-locator-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-locator-2x.png -------------------------------------------------------------------------------- /images/icon-locator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-locator.png -------------------------------------------------------------------------------- /images/icon-pointer-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-pointer-2x.png -------------------------------------------------------------------------------- /images/icon-pointer-black-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-pointer-black-2x.png -------------------------------------------------------------------------------- /images/icon-pointer-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-pointer-black.png -------------------------------------------------------------------------------- /images/icon-pointer-indexed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-pointer-indexed.png -------------------------------------------------------------------------------- /images/icon-pointer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-pointer.png -------------------------------------------------------------------------------- /images/icon-search-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-search-2x.png -------------------------------------------------------------------------------- /images/icon-search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-search.png -------------------------------------------------------------------------------- /images/icon-steps/icon-step-1-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-steps/icon-step-1-2x.png -------------------------------------------------------------------------------- /images/icon-steps/icon-step-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-steps/icon-step-1.png -------------------------------------------------------------------------------- /images/icon-steps/icon-step-10-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-steps/icon-step-10-2x.png -------------------------------------------------------------------------------- /images/icon-steps/icon-step-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-steps/icon-step-10.png -------------------------------------------------------------------------------- /images/icon-steps/icon-step-11-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-steps/icon-step-11-2x.png -------------------------------------------------------------------------------- /images/icon-steps/icon-step-11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-steps/icon-step-11.png -------------------------------------------------------------------------------- /images/icon-steps/icon-step-12-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-steps/icon-step-12-2x.png -------------------------------------------------------------------------------- /images/icon-steps/icon-step-12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-steps/icon-step-12.png -------------------------------------------------------------------------------- /images/icon-steps/icon-step-13-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-steps/icon-step-13-2x.png -------------------------------------------------------------------------------- /images/icon-steps/icon-step-13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-steps/icon-step-13.png -------------------------------------------------------------------------------- /images/icon-steps/icon-step-14-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-steps/icon-step-14-2x.png -------------------------------------------------------------------------------- /images/icon-steps/icon-step-14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-steps/icon-step-14.png -------------------------------------------------------------------------------- /images/icon-steps/icon-step-2-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-steps/icon-step-2-2x.png -------------------------------------------------------------------------------- /images/icon-steps/icon-step-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-steps/icon-step-2.png -------------------------------------------------------------------------------- /images/icon-steps/icon-step-3-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-steps/icon-step-3-2x.png -------------------------------------------------------------------------------- /images/icon-steps/icon-step-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-steps/icon-step-3.png -------------------------------------------------------------------------------- /images/icon-steps/icon-step-4-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-steps/icon-step-4-2x.png -------------------------------------------------------------------------------- /images/icon-steps/icon-step-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-steps/icon-step-4.png -------------------------------------------------------------------------------- /images/icon-steps/icon-step-5-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-steps/icon-step-5-2x.png -------------------------------------------------------------------------------- /images/icon-steps/icon-step-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-steps/icon-step-5.png -------------------------------------------------------------------------------- /images/icon-steps/icon-step-6-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-steps/icon-step-6-2x.png -------------------------------------------------------------------------------- /images/icon-steps/icon-step-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-steps/icon-step-6.png -------------------------------------------------------------------------------- /images/icon-steps/icon-step-7-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-steps/icon-step-7-2x.png -------------------------------------------------------------------------------- /images/icon-steps/icon-step-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-steps/icon-step-7.png -------------------------------------------------------------------------------- /images/icon-steps/icon-step-8-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-steps/icon-step-8-2x.png -------------------------------------------------------------------------------- /images/icon-steps/icon-step-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-steps/icon-step-8.png -------------------------------------------------------------------------------- /images/icon-steps/icon-step-9-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-steps/icon-step-9-2x.png -------------------------------------------------------------------------------- /images/icon-steps/icon-step-9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/icon-steps/icon-step-9.png -------------------------------------------------------------------------------- /images/player-icon-forward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/player-icon-forward.png -------------------------------------------------------------------------------- /images/player-icon-pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/player-icon-pause.png -------------------------------------------------------------------------------- /images/player-icon-play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/player-icon-play.png -------------------------------------------------------------------------------- /images/player-icon-rewind.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/player-icon-rewind.png -------------------------------------------------------------------------------- /images/player-icon-volume.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/player-icon-volume.png -------------------------------------------------------------------------------- /images/separator-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/separator-2x.png -------------------------------------------------------------------------------- /images/separator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphagov/govuk_frontend_toolkit_npm/b6071dcaa333ffa73322a6f1c115c0b817580378/images/separator.png -------------------------------------------------------------------------------- /javascripts/govuk/details.polyfill.js: -------------------------------------------------------------------------------- 1 | //
polyfill 2 | // http://caniuse.com/#feat=details 3 | 4 | // FF Support for HTML5's
and 5 | // https://bugzilla.mozilla.org/show_bug.cgi?id=591737 6 | 7 | // http://www.sitepoint.com/fixing-the-details-element/ 8 | 9 | ;(function (global) { 10 | 'use strict' 11 | 12 | var GOVUK = global.GOVUK || {} 13 | 14 | GOVUK.details = { 15 | NATIVE_DETAILS: typeof document.createElement('details').open === 'boolean', 16 | KEY_ENTER: 13, 17 | KEY_SPACE: 32, 18 | 19 | // Create a started flag so we can prevent the initialisation 20 | // function firing from both DOMContentLoaded and window.onload 21 | started: false, 22 | 23 | // Add event construct for modern browsers or IE 24 | // which fires the callback with a pre-converted target reference 25 | addEvent: function (node, type, callback) { 26 | if (node.addEventListener) { 27 | node.addEventListener(type, function (e) { 28 | callback(e, e.target) 29 | }, false) 30 | } else if (node.attachEvent) { 31 | node.attachEvent('on' + type, function (e) { 32 | callback(e, e.srcElement) 33 | }) 34 | } 35 | }, 36 | 37 | removeEvent: function (node, type) { 38 | if (node.removeEventListener) { 39 | node.removeEventListener(type, function (e) { 40 | }, false) 41 | } else if (node.detachEvent) { 42 | node.detachEvent('on' + type, function (e) { 43 | }) 44 | } 45 | }, 46 | 47 | // Cross-browser character code / key pressed 48 | charCode: function (e) { 49 | return (typeof e.which === 'number') ? e.which : e.keyCode 50 | }, 51 | 52 | // Cross-browser preventing default action 53 | preventDefault: function (e) { 54 | if (e.preventDefault) { 55 | e.preventDefault() 56 | } else { 57 | e.returnValue = false 58 | } 59 | }, 60 | 61 | // Handle cross-modal click events 62 | addClickEvent: function (node, callback) { 63 | GOVUK.details.addEvent(node, 'keypress', function (e, target) { 64 | // When the key gets pressed - check if it is enter or space 65 | if (GOVUK.details.charCode(e) === GOVUK.details.KEY_ENTER || GOVUK.details.charCode(e) === GOVUK.details.KEY_SPACE) { 66 | if (target.nodeName.toLowerCase() === 'summary') { 67 | // Prevent space from scrolling the page 68 | // and enter from submitting a form 69 | GOVUK.details.preventDefault(e) 70 | // Click to let the click event do all the necessary action 71 | if (target.click) { 72 | target.click() 73 | } else { 74 | // except Safari 5.1 and under don't support .click() here 75 | callback(e, target) 76 | } 77 | } 78 | } 79 | }) 80 | 81 | // Prevent keyup to prevent clicking twice in Firefox when using space key 82 | GOVUK.details.addEvent(node, 'keyup', function (e, target) { 83 | if (GOVUK.details.charCode(e) === GOVUK.details.KEY_SPACE) { 84 | if (target.nodeName === 'SUMMARY') { 85 | GOVUK.details.preventDefault(e) 86 | } 87 | } 88 | }) 89 | 90 | GOVUK.details.addEvent(node, 'click', function (e, target) { 91 | callback(e, target) 92 | }) 93 | }, 94 | 95 | // Get the nearest ancestor element of a node that matches a given tag name 96 | getAncestor: function (node, match) { 97 | do { 98 | if (!node || node.nodeName.toLowerCase() === match) { 99 | break 100 | } 101 | node = node.parentNode 102 | } while (node) 103 | 104 | return node 105 | }, 106 | 107 | // Initialisation function 108 | addDetailsPolyfill: function (list, container) { 109 | container = container || document.body 110 | // If this has already happened, just return 111 | // else set the flag so it doesn't happen again 112 | if (GOVUK.details.started) { 113 | return 114 | } 115 | GOVUK.details.started = true 116 | // Get the collection of details elements, but if that's empty 117 | // then we don't need to bother with the rest of the scripting 118 | if ((list = container.getElementsByTagName('details')).length === 0) { 119 | return 120 | } 121 | // else iterate through them to apply their initial state 122 | var n = list.length 123 | var i = 0 124 | for (i; i < n; i++) { 125 | var details = list[i] 126 | 127 | // Save shortcuts to the inner summary and content elements 128 | details.__summary = details.getElementsByTagName('summary').item(0) 129 | details.__content = details.getElementsByTagName('div').item(0) 130 | 131 | if (!details.__summary || !details.__content) { 132 | return 133 | } 134 | // If the content doesn't have an ID, assign it one now 135 | // which we'll need for the summary's aria-controls assignment 136 | if (!details.__content.id) { 137 | details.__content.id = 'details-content-' + i 138 | } 139 | 140 | // Add ARIA role="group" to details 141 | details.setAttribute('role', 'group') 142 | 143 | // Add role=button to summary 144 | details.__summary.setAttribute('role', 'button') 145 | 146 | // Add aria-controls 147 | details.__summary.setAttribute('aria-controls', details.__content.id) 148 | 149 | // Set tabIndex so the summary is keyboard accessible for non-native elements 150 | // http://www.saliences.com/browserBugs/tabIndex.html 151 | if (!GOVUK.details.NATIVE_DETAILS) { 152 | details.__summary.tabIndex = 0 153 | } 154 | 155 | // Detect initial open state 156 | var openAttr = details.getAttribute('open') !== null 157 | if (openAttr === true) { 158 | details.__summary.setAttribute('aria-expanded', 'true') 159 | details.__content.setAttribute('aria-hidden', 'false') 160 | } else { 161 | details.__summary.setAttribute('aria-expanded', 'false') 162 | details.__content.setAttribute('aria-hidden', 'true') 163 | if (!GOVUK.details.NATIVE_DETAILS) { 164 | details.__content.style.display = 'none' 165 | } 166 | } 167 | 168 | // Create a circular reference from the summary back to its 169 | // parent details element, for convenience in the click handler 170 | details.__summary.__details = details 171 | 172 | // If this is not a native implementation, create an arrow 173 | // inside the summary 174 | if (!GOVUK.details.NATIVE_DETAILS) { 175 | var twisty = document.createElement('i') 176 | 177 | if (openAttr === true) { 178 | twisty.className = 'arrow arrow-open' 179 | twisty.appendChild(document.createTextNode('\u25bc')) 180 | } else { 181 | twisty.className = 'arrow arrow-closed' 182 | twisty.appendChild(document.createTextNode('\u25ba')) 183 | } 184 | 185 | details.__summary.__twisty = details.__summary.insertBefore(twisty, details.__summary.firstChild) 186 | details.__summary.__twisty.setAttribute('aria-hidden', 'true') 187 | } 188 | } 189 | 190 | // Bind a click event to handle summary elements 191 | GOVUK.details.addClickEvent(container, function (e, summary) { 192 | if (!(summary = GOVUK.details.getAncestor(summary, 'summary'))) { 193 | return true 194 | } 195 | return GOVUK.details.statechange(summary) 196 | }) 197 | }, 198 | 199 | // Define a statechange function that updates aria-expanded and style.display 200 | // Also update the arrow position 201 | statechange: function (summary) { 202 | var expanded = summary.__details.__summary.getAttribute('aria-expanded') === 'true' 203 | var hidden = summary.__details.__content.getAttribute('aria-hidden') === 'true' 204 | 205 | summary.__details.__summary.setAttribute('aria-expanded', (expanded ? 'false' : 'true')) 206 | summary.__details.__content.setAttribute('aria-hidden', (hidden ? 'false' : 'true')) 207 | 208 | if (!GOVUK.details.NATIVE_DETAILS) { 209 | summary.__details.__content.style.display = (expanded ? 'none' : '') 210 | 211 | var hasOpenAttr = summary.__details.getAttribute('open') !== null 212 | if (!hasOpenAttr) { 213 | summary.__details.setAttribute('open', 'open') 214 | } else { 215 | summary.__details.removeAttribute('open') 216 | } 217 | } 218 | 219 | if (summary.__twisty) { 220 | summary.__twisty.firstChild.nodeValue = (expanded ? '\u25ba' : '\u25bc') 221 | summary.__twisty.setAttribute('class', (expanded ? 'arrow arrow-closed' : 'arrow arrow-open')) 222 | } 223 | 224 | return true 225 | }, 226 | 227 | destroy: function (node) { 228 | GOVUK.details.removeEvent(node, 'click') 229 | }, 230 | 231 | // Bind two load events for modern and older browsers 232 | // If the first one fires it will set a flag to block the second one 233 | // but if it's not supported then the second one will fire 234 | init: function ($container) { 235 | GOVUK.details.addEvent(document, 'DOMContentLoaded', GOVUK.details.addDetailsPolyfill) 236 | GOVUK.details.addEvent(window, 'load', GOVUK.details.addDetailsPolyfill) 237 | } 238 | } 239 | global.GOVUK = GOVUK 240 | })(window) 241 | -------------------------------------------------------------------------------- /javascripts/govuk/modules.js: -------------------------------------------------------------------------------- 1 | ;(function (global) { 2 | 'use strict' 3 | 4 | var $ = global.jQuery 5 | var GOVUK = global.GOVUK || {} 6 | GOVUK.Modules = GOVUK.Modules || {} 7 | 8 | GOVUK.modules = { 9 | find: function (container) { 10 | container = container || $('body') 11 | 12 | var modules 13 | var moduleSelector = '[data-module]' 14 | 15 | modules = container.find(moduleSelector) 16 | 17 | // Container could be a module too 18 | if (container.is(moduleSelector)) { 19 | modules = modules.add(container) 20 | } 21 | 22 | return modules 23 | }, 24 | 25 | start: function (container) { 26 | var modules = this.find(container) 27 | 28 | for (var i = 0, l = modules.length; i < l; i++) { 29 | var module 30 | var element = $(modules[i]) 31 | var type = camelCaseAndCapitalise(element.data('module')) 32 | var started = element.data('module-started') 33 | 34 | if (typeof GOVUK.Modules[type] === 'function' && !started) { 35 | module = new GOVUK.Modules[type]() 36 | module.start(element) 37 | element.data('module-started', true) 38 | } 39 | } 40 | 41 | // eg selectable-table to SelectableTable 42 | function camelCaseAndCapitalise (string) { 43 | return capitaliseFirstLetter(camelCase(string)) 44 | } 45 | 46 | // http://stackoverflow.com/questions/6660977/convert-hyphens-to-camel-case-camelcase 47 | function camelCase (string) { 48 | return string.replace(/-([a-z])/g, function (g) { 49 | return g.charAt(1).toUpperCase() 50 | }) 51 | } 52 | 53 | // http://stackoverflow.com/questions/1026069/capitalize-the-first-letter-of-string-in-javascript 54 | function capitaliseFirstLetter (string) { 55 | return string.charAt(0).toUpperCase() + string.slice(1) 56 | } 57 | } 58 | } 59 | 60 | global.GOVUK = GOVUK 61 | })(window) 62 | -------------------------------------------------------------------------------- /javascripts/govuk/modules/auto-track-event.js: -------------------------------------------------------------------------------- 1 | ;(function (global) { 2 | 'use strict' 3 | 4 | var GOVUK = global.GOVUK || {} 5 | GOVUK.Modules = GOVUK.Modules || {} 6 | 7 | GOVUK.Modules.AutoTrackEvent = function () { 8 | this.start = function (element) { 9 | var options = { nonInteraction: 1 } // automatic events shouldn't affect bounce rate 10 | var category = element.data('track-category') 11 | var action = element.data('track-action') 12 | var label = element.data('track-label') 13 | var value = element.data('track-value') 14 | 15 | if (typeof label === 'string') { 16 | options.label = label 17 | } 18 | 19 | if (value || value === 0) { 20 | options.value = value 21 | } 22 | 23 | if (GOVUK.analytics && GOVUK.analytics.trackEvent) { 24 | GOVUK.analytics.trackEvent(category, action, options) 25 | } 26 | } 27 | } 28 | 29 | global.GOVUK = GOVUK 30 | })(window) 31 | -------------------------------------------------------------------------------- /javascripts/govuk/primary-links.js: -------------------------------------------------------------------------------- 1 | ;(function (global) { 2 | 'use strict' 3 | 4 | var $ = global.jQuery 5 | var GOVUK = global.GOVUK || {} 6 | 7 | // Only show the first {n} items in a list, documentation is in the README.md 8 | var PrimaryList = function (el, selector) { 9 | this.$el = $(el) 10 | this.$extraLinks = this.$el.find('li:not(' + selector + ')') 11 | // only hide more than one extra link 12 | if (this.$extraLinks.length > 1) { 13 | this.addToggleLink() 14 | this.hideExtraLinks() 15 | } 16 | } 17 | 18 | PrimaryList.prototype = { 19 | toggleText: function () { 20 | if (this.$extraLinks.length > 1) { 21 | return '+' + this.$extraLinks.length + ' others' 22 | } else { 23 | return '+' + this.$extraLinks.length + ' other' 24 | } 25 | }, 26 | addToggleLink: function () { 27 | this.$toggleLink = $('' + this.toggleText() + '') 28 | this.$toggleLink.click($.proxy(this.toggleLinks, this)) 29 | this.$toggleLink.insertAfter(this.$el) 30 | }, 31 | toggleLinks: function (e) { 32 | e.preventDefault() 33 | this.$toggleLink.remove() 34 | this.showExtraLinks() 35 | }, 36 | hideExtraLinks: function () { 37 | this.$extraLinks.addClass('visuallyhidden') 38 | $(window).trigger('govuk.pageSizeChanged') 39 | }, 40 | showExtraLinks: function () { 41 | this.$extraLinks.removeClass('visuallyhidden') 42 | $(window).trigger('govuk.pageSizeChanged') 43 | } 44 | } 45 | 46 | GOVUK.PrimaryList = PrimaryList 47 | 48 | GOVUK.primaryLinks = { 49 | init: function (selector) { 50 | $(selector).parent().each(function (i, el) { 51 | new GOVUK.PrimaryList(el, selector) // eslint-disable-line no-new 52 | }) 53 | } 54 | } 55 | 56 | global.GOVUK = GOVUK 57 | })(window) 58 | -------------------------------------------------------------------------------- /javascripts/govuk/selection-buttons.js: -------------------------------------------------------------------------------- 1 | // NOTICE 2 | // IF you are using GOV.UK Elements 3.0,0 or above then you do not need to use 3 | // this script anymore as it uses a pure CSS solution. 4 | 5 | ;(function (global) { 6 | 'use strict' 7 | 8 | var $ = global.jQuery 9 | var GOVUK = global.GOVUK || {} 10 | 11 | var SelectionButtons = function (elmsOrSelector, opts) { 12 | this.selectedClass = 'selected' 13 | this.focusedClass = 'focused' 14 | this.radioClass = 'selection-button-radio' 15 | this.checkboxClass = 'selection-button-checkbox' 16 | if (opts !== undefined) { 17 | $.each(opts, function (optionName, optionObj) { 18 | this[optionName] = optionObj 19 | }.bind(this)) 20 | } 21 | if (typeof elmsOrSelector === 'string') { 22 | this.selector = elmsOrSelector 23 | this.setInitialState($(this.selector)) 24 | } else if (elmsOrSelector !== undefined) { 25 | this.$elms = elmsOrSelector 26 | this.setInitialState(this.$elms) 27 | } 28 | this.addEvents() 29 | } 30 | SelectionButtons.prototype.addEvents = function () { 31 | if (typeof this.$elms !== 'undefined') { 32 | this.addElementLevelEvents() 33 | } else { 34 | this.addDocumentLevelEvents() 35 | } 36 | } 37 | SelectionButtons.prototype.setInitialState = function ($elms) { 38 | $elms.each(function (idx, elm) { 39 | var $elm = $(elm) 40 | 41 | var labelClass = $elm.attr('type') === 'radio' ? this.radioClass : this.checkboxClass 42 | $elm.parent('label').addClass(labelClass) 43 | if ($elm.is(':checked')) { 44 | this.markSelected($elm) 45 | } 46 | }.bind(this)) 47 | } 48 | SelectionButtons.prototype.markFocused = function ($elm, state) { 49 | if (state === 'focused') { 50 | $elm.parent('label').addClass(this.focusedClass) 51 | } else { 52 | $elm.parent('label').removeClass(this.focusedClass) 53 | } 54 | } 55 | SelectionButtons.prototype.markSelected = function ($elm) { 56 | var radioName 57 | 58 | if ($elm.attr('type') === 'radio') { 59 | radioName = $elm.attr('name') 60 | $($elm[0].form).find('input[name="' + radioName + '"]') 61 | .parent('label') 62 | .removeClass(this.selectedClass) 63 | $elm.parent('label').addClass(this.selectedClass) 64 | } else { // checkbox 65 | if ($elm.is(':checked')) { 66 | $elm.parent('label').addClass(this.selectedClass) 67 | } else { 68 | $elm.parent('label').removeClass(this.selectedClass) 69 | } 70 | } 71 | } 72 | SelectionButtons.prototype.addElementLevelEvents = function () { 73 | this.clickHandler = this.getClickHandler() 74 | this.focusHandler = this.getFocusHandler({ 'level': 'element' }) 75 | 76 | this.$elms 77 | .on('click', this.clickHandler) 78 | .on('focus blur', this.focusHandler) 79 | } 80 | SelectionButtons.prototype.addDocumentLevelEvents = function () { 81 | this.clickHandler = this.getClickHandler() 82 | this.focusHandler = this.getFocusHandler({ 'level': 'document' }) 83 | 84 | $(document) 85 | .on('click', this.selector, this.clickHandler) 86 | .on('focus blur', this.selector, this.focusHandler) 87 | } 88 | SelectionButtons.prototype.getClickHandler = function () { 89 | return function (e) { 90 | this.markSelected($(e.target)) 91 | }.bind(this) 92 | } 93 | SelectionButtons.prototype.getFocusHandler = function (opts) { 94 | var focusEvent = (opts.level === 'document') ? 'focusin' : 'focus' 95 | 96 | return function (e) { 97 | var state = (e.type === focusEvent) ? 'focused' : 'blurred' 98 | 99 | this.markFocused($(e.target), state) 100 | }.bind(this) 101 | } 102 | SelectionButtons.prototype.destroy = function () { 103 | if (typeof this.selector !== 'undefined') { 104 | $(document) 105 | .off('click', this.selector, this.clickHandler) 106 | .off('focus blur', this.selector, this.focusHandler) 107 | } else { 108 | this.$elms 109 | .off('click', this.clickHandler) 110 | .off('focus blur', this.focusHandler) 111 | } 112 | } 113 | 114 | GOVUK.SelectionButtons = SelectionButtons 115 | global.GOVUK = GOVUK 116 | })(window) 117 | -------------------------------------------------------------------------------- /javascripts/govuk/shim-links-with-button-role.js: -------------------------------------------------------------------------------- 1 | // javascript 'shim' to trigger the click event of element(s) 2 | // when the space key is pressed. 3 | // 4 | // Created since some Assistive Technologies (for example some Screenreaders) 5 | // Will tell a user to press space on a 'button', so this functionality needs to be shimmed 6 | // See https://github.com/alphagov/govuk_elements/pull/272#issuecomment-233028270 7 | // 8 | // Usage instructions: 9 | // GOVUK.shimLinksWithButtonRole.init(); 10 | ;(function (global) { 11 | 'use strict' 12 | 13 | var $ = global.jQuery 14 | var GOVUK = global.GOVUK || {} 15 | 16 | GOVUK.shimLinksWithButtonRole = { 17 | 18 | init: function init () { 19 | // listen to 'document' for keydown event on the any elements that should be buttons. 20 | $(document).on('keydown', '[role="button"]', function (event) { 21 | // if the keyCode (which) is 32 it's a space, let's simulate a click. 22 | if (event.which === 32) { 23 | event.preventDefault() 24 | // trigger the target's click event 25 | event.target.click() 26 | } 27 | }) 28 | } 29 | 30 | } 31 | 32 | // hand back to global 33 | global.GOVUK = GOVUK 34 | })(window) 35 | -------------------------------------------------------------------------------- /javascripts/govuk/show-hide-content.js: -------------------------------------------------------------------------------- 1 | ;(function (global) { 2 | 'use strict' 3 | 4 | var $ = global.jQuery 5 | var GOVUK = global.GOVUK || {} 6 | 7 | function ShowHideContent () { 8 | var self = this 9 | 10 | // Radio and Checkbox selectors 11 | var selectors = { 12 | namespace: 'ShowHideContent', 13 | radio: '[data-target] > input[type="radio"]', 14 | checkbox: '[data-target] > input[type="checkbox"]' 15 | } 16 | 17 | // Adds ARIA attributes to control + associated content 18 | function initToggledContent () { 19 | var $control = $(this) 20 | var $content = getToggledContent($control) 21 | 22 | // Set aria-controls and defaults 23 | if ($content.length) { 24 | $control.attr('aria-controls', $content.attr('id')) 25 | $control.attr('aria-expanded', 'false') 26 | $content.attr('aria-hidden', 'true') 27 | } 28 | } 29 | 30 | // Return toggled content for control 31 | function getToggledContent ($control) { 32 | var id = $control.attr('aria-controls') 33 | 34 | // ARIA attributes aren't set before init 35 | if (!id) { 36 | id = $control.closest('[data-target]').data('target') 37 | } 38 | 39 | // Find show/hide content by id 40 | return $('#' + id) 41 | } 42 | 43 | // Show toggled content for control 44 | function showToggledContent ($control, $content) { 45 | // Show content 46 | if ($content.hasClass('js-hidden')) { 47 | $content.removeClass('js-hidden') 48 | $content.attr('aria-hidden', 'false') 49 | 50 | // If the controlling input, update aria-expanded 51 | if ($control.attr('aria-controls')) { 52 | $control.attr('aria-expanded', 'true') 53 | } 54 | } 55 | } 56 | 57 | // Hide toggled content for control 58 | function hideToggledContent ($control, $content) { 59 | $content = $content || getToggledContent($control) 60 | 61 | // Hide content 62 | if (!$content.hasClass('js-hidden')) { 63 | $content.addClass('js-hidden') 64 | $content.attr('aria-hidden', 'true') 65 | 66 | // If the controlling input, update aria-expanded 67 | if ($control.attr('aria-controls')) { 68 | $control.attr('aria-expanded', 'false') 69 | } 70 | } 71 | } 72 | 73 | // Handle radio show/hide 74 | function handleRadioContent ($control, $content) { 75 | // All radios in this group which control content 76 | var selector = selectors.radio + '[name="' + $control.attr('name') + '"][aria-controls]' 77 | var $form = $control.closest('form') 78 | var $radios = $form.length ? $form.find(selector) : $(selector) 79 | 80 | // Hide content for radios in group 81 | $radios.each(function () { 82 | hideToggledContent($(this)) 83 | }) 84 | 85 | // Select content for this control 86 | if ($control.is('[aria-controls]')) { 87 | showToggledContent($control, $content) 88 | } 89 | } 90 | 91 | // Handle checkbox show/hide 92 | function handleCheckboxContent ($control, $content) { 93 | // Show checkbox content 94 | if ($control.is(':checked')) { 95 | showToggledContent($control, $content) 96 | } else { // Hide checkbox content 97 | hideToggledContent($control, $content) 98 | } 99 | } 100 | 101 | // Set up event handlers etc 102 | function init ($container, elementSelector, eventSelectors, handler) { 103 | $container = $container || $(document.body) 104 | 105 | // Handle control clicks 106 | function deferred () { 107 | var $control = $(this) 108 | handler($control, getToggledContent($control)) 109 | } 110 | 111 | // Prepare ARIA attributes 112 | var $controls = $(elementSelector) 113 | $controls.each(initToggledContent) 114 | 115 | // Handle events 116 | $.each(eventSelectors, function (idx, eventSelector) { 117 | $container.on('click.' + selectors.namespace, eventSelector, deferred) 118 | }) 119 | 120 | // Any already :checked on init? 121 | if ($controls.is(':checked')) { 122 | $controls.filter(':checked').each(deferred) 123 | } 124 | } 125 | 126 | // Get event selectors for all radio groups 127 | function getEventSelectorsForRadioGroups () { 128 | var radioGroups = [] 129 | 130 | // Build an array of radio group selectors 131 | return $(selectors.radio).map(function () { 132 | var groupName = $(this).attr('name') 133 | 134 | if ($.inArray(groupName, radioGroups) === -1) { 135 | radioGroups.push(groupName) 136 | return 'input[type="radio"][name="' + $(this).attr('name') + '"]' 137 | } 138 | return null 139 | }) 140 | } 141 | 142 | // Set up radio show/hide content for container 143 | self.showHideRadioToggledContent = function ($container) { 144 | init($container, selectors.radio, getEventSelectorsForRadioGroups(), handleRadioContent) 145 | } 146 | 147 | // Set up checkbox show/hide content for container 148 | self.showHideCheckboxToggledContent = function ($container) { 149 | init($container, selectors.checkbox, [selectors.checkbox], handleCheckboxContent) 150 | } 151 | 152 | // Remove event handlers 153 | self.destroy = function ($container) { 154 | $container = $container || $(document.body) 155 | $container.off('.' + selectors.namespace) 156 | } 157 | } 158 | 159 | ShowHideContent.prototype.init = function ($container) { 160 | this.showHideRadioToggledContent($container) 161 | this.showHideCheckboxToggledContent($container) 162 | } 163 | 164 | GOVUK.ShowHideContent = ShowHideContent 165 | global.GOVUK = GOVUK 166 | })(window) 167 | -------------------------------------------------------------------------------- /javascripts/govuk/stick-at-top-when-scrolling.js: -------------------------------------------------------------------------------- 1 | ;(function (global) { 2 | 'use strict' 3 | 4 | var $ = global.jQuery 5 | var GOVUK = global.GOVUK || {} 6 | 7 | // Stick elements to top of screen when you scroll past, documentation is in the README.md 8 | var sticky = { 9 | _hasScrolled: false, 10 | _scrollTimeout: false, 11 | _hasResized: false, 12 | _resizeTimeout: false, 13 | 14 | getWindowDimensions: function () { 15 | return { 16 | height: $(global).height(), 17 | width: $(global).width() 18 | } 19 | }, 20 | getWindowPositions: function () { 21 | return { 22 | scrollTop: $(global).scrollTop() 23 | } 24 | }, 25 | getElementOffset: function ($el) { 26 | return $el.offset() 27 | }, 28 | init: function () { 29 | var $els = $('.js-stick-at-top-when-scrolling') 30 | 31 | if ($els.length > 0) { 32 | sticky.$els = $els 33 | 34 | if (sticky._scrollTimeout === false) { 35 | $(global).scroll(sticky.onScroll) 36 | sticky._scrollTimeout = global.setInterval(sticky.checkScroll, 50) 37 | } 38 | 39 | if (sticky._resizeTimeout === false) { 40 | $(global).resize(sticky.onResize) 41 | sticky._resizeTimeout = global.setInterval(sticky.checkResize, 50) 42 | } 43 | } 44 | if (GOVUK.stopScrollingAtFooter) { 45 | $els.each(function (i, el) { 46 | var $img = $(el).find('img') 47 | if ($img.length > 0) { 48 | var image = new global.Image() 49 | image.onload = function () { 50 | GOVUK.stopScrollingAtFooter.addEl($(el), $(el).outerHeight()) 51 | } 52 | image.src = $img.attr('src') 53 | } else { 54 | GOVUK.stopScrollingAtFooter.addEl($(el), $(el).outerHeight()) 55 | } 56 | }) 57 | } 58 | }, 59 | onScroll: function () { 60 | sticky._hasScrolled = true 61 | }, 62 | onResize: function () { 63 | sticky._hasResized = true 64 | }, 65 | checkScroll: function () { 66 | if (sticky._hasScrolled === true) { 67 | sticky._hasScrolled = false 68 | 69 | var windowVerticalPosition = sticky.getWindowPositions().scrollTop 70 | 71 | var windowDimensions = sticky.getWindowDimensions() 72 | 73 | sticky.$els.each(function (i, el) { 74 | var $el = $(el) 75 | var scrolledFrom = $el.data('scrolled-from') 76 | 77 | if (scrolledFrom && windowVerticalPosition < scrolledFrom) { 78 | sticky.release($el) 79 | } else if (windowDimensions.width > 768 && windowVerticalPosition >= sticky.getElementOffset($el).top) { 80 | sticky.stick($el) 81 | } 82 | }) 83 | } 84 | }, 85 | checkResize: function () { 86 | if (sticky._hasResized === true) { 87 | sticky._hasResized = false 88 | 89 | var windowDimensions = sticky.getWindowDimensions() 90 | 91 | sticky.$els.each(function (i, el) { 92 | var $el = $(el) 93 | 94 | var elResize = $el.hasClass('js-sticky-resize') 95 | if (elResize) { 96 | var $shim = $('.shim') 97 | var $elParent = $el.parent('div') 98 | var elParentWidth = $elParent.width() 99 | $shim.css('width', elParentWidth) 100 | $el.css('width', elParentWidth) 101 | } 102 | 103 | if (windowDimensions.width <= 768) { 104 | sticky.release($el) 105 | } 106 | }) 107 | } 108 | }, 109 | stick: function ($el) { 110 | if (!$el.hasClass('content-fixed')) { 111 | $el.data('scrolled-from', sticky.getElementOffset($el).top) 112 | var height = Math.max($el.height(), 1) 113 | var width = $el.width() 114 | $el.before('
 
') 115 | $el.css('width', width + 'px').addClass('content-fixed') 116 | } 117 | }, 118 | release: function ($el) { 119 | if ($el.hasClass('content-fixed')) { 120 | $el.data('scrolled-from', false) 121 | $el.removeClass('content-fixed').css('width', '') 122 | $el.siblings('.shim').remove() 123 | } 124 | } 125 | } 126 | GOVUK.stickAtTopWhenScrolling = sticky 127 | global.GOVUK = GOVUK 128 | })(window) 129 | -------------------------------------------------------------------------------- /javascripts/govuk/stop-scrolling-at-footer.js: -------------------------------------------------------------------------------- 1 | // Stop scrolling at footer. 2 | // 3 | // This can be added to elements with `position: fixed` to stop them from 4 | // overflowing on the footer. 5 | // 6 | // Usage: 7 | // 8 | // GOVUK.stopScrollingAtFooter.addEl($(node), $(node).height()); 9 | // 10 | // Height is passed in separatly incase the scrolling element has no height 11 | // itself. 12 | 13 | ;(function (global) { 14 | 'use strict' 15 | 16 | var $ = global.jQuery 17 | var GOVUK = global.GOVUK || {} 18 | 19 | var stopScrollingAtFooter = { 20 | _pollingId: null, 21 | _isPolling: false, 22 | _hasScrollEvt: false, 23 | _els: [], 24 | 25 | addEl: function ($fixedEl, height) { 26 | var fixedOffset 27 | 28 | if (!$fixedEl.length) { return } 29 | 30 | fixedOffset = parseInt($fixedEl.css('top'), 10) 31 | fixedOffset = isNaN(fixedOffset) ? 0 : fixedOffset 32 | 33 | stopScrollingAtFooter.updateFooterTop() 34 | $(global).on('govuk.pageSizeChanged', stopScrollingAtFooter.updateFooterTop) 35 | 36 | var $siblingEl = $('
') 37 | $siblingEl.insertBefore($fixedEl) 38 | var fixedTop = $siblingEl.offset().top - $siblingEl.position().top 39 | $siblingEl.remove() 40 | 41 | var el = { 42 | $fixedEl: $fixedEl, 43 | height: height + fixedOffset, 44 | fixedTop: height + fixedTop, 45 | state: 'fixed' 46 | } 47 | stopScrollingAtFooter._els.push(el) 48 | 49 | stopScrollingAtFooter.initTimeout() 50 | }, 51 | updateFooterTop: function () { 52 | var footer = $('.js-footer:eq(0)') 53 | if (footer.length === 0) { 54 | return 0 55 | } 56 | stopScrollingAtFooter.footerTop = footer.offset().top - 10 57 | }, 58 | initTimeout: function () { 59 | if (stopScrollingAtFooter._hasScrollEvt === false) { 60 | $(window).scroll(stopScrollingAtFooter.onScroll) 61 | stopScrollingAtFooter._hasScrollEvt = true 62 | } 63 | }, 64 | onScroll: function () { 65 | if (stopScrollingAtFooter._isPolling === false) { 66 | stopScrollingAtFooter.startPolling() 67 | } 68 | }, 69 | startPolling: (function () { 70 | if (window.requestAnimationFrame) { 71 | return function () { 72 | var callback = function () { 73 | stopScrollingAtFooter.checkScroll() 74 | if (stopScrollingAtFooter._isPolling === true) { 75 | stopScrollingAtFooter.startPolling() 76 | } 77 | } 78 | stopScrollingAtFooter._pollingId = window.requestAnimationFrame(callback) 79 | stopScrollingAtFooter._isPolling = true 80 | } 81 | } else { 82 | return function () { 83 | stopScrollingAtFooter._pollingId = window.setInterval(stopScrollingAtFooter.checkScroll, 16) 84 | stopScrollingAtFooter._isPolling = true 85 | } 86 | } 87 | }()), 88 | stopPolling: (function () { 89 | if (window.requestAnimationFrame) { 90 | return function () { 91 | window.cancelAnimationFrame(stopScrollingAtFooter._pollingId) 92 | stopScrollingAtFooter._isPolling = false 93 | } 94 | } else { 95 | return function () { 96 | window.clearInterval(stopScrollingAtFooter._pollingId) 97 | stopScrollingAtFooter._isPolling = false 98 | } 99 | } 100 | }()), 101 | checkScroll: function () { 102 | var cachedScrollTop = $(window).scrollTop() 103 | if ((cachedScrollTop < (stopScrollingAtFooter.cachedScrollTop + 2)) && (cachedScrollTop > (stopScrollingAtFooter.cachedScrollTop - 2))) { 104 | stopScrollingAtFooter.stopPolling() 105 | return 106 | } else { 107 | stopScrollingAtFooter.cachedScrollTop = cachedScrollTop 108 | } 109 | 110 | $.each(stopScrollingAtFooter._els, function (i, el) { 111 | var bottomOfEl = cachedScrollTop + el.height 112 | 113 | if (bottomOfEl > stopScrollingAtFooter.footerTop) { 114 | stopScrollingAtFooter.stick(el) 115 | } else { 116 | stopScrollingAtFooter.unstick(el) 117 | } 118 | }) 119 | }, 120 | stick: function (el) { 121 | if (el.state === 'fixed' && el.$fixedEl.css('position') === 'fixed') { 122 | el.$fixedEl.css({ 'position': 'absolute', 'top': stopScrollingAtFooter.footerTop - el.fixedTop }) 123 | el.state = 'absolute' 124 | } 125 | }, 126 | unstick: function (el) { 127 | if (el.state === 'absolute') { 128 | el.$fixedEl.css({ 'position': '', 'top': '' }) 129 | el.state = 'fixed' 130 | } 131 | } 132 | } 133 | 134 | GOVUK.stopScrollingAtFooter = stopScrollingAtFooter 135 | 136 | $(global).load(function () { $(global).trigger('govuk.pageSizeChanged') }) 137 | 138 | global.GOVUK = GOVUK 139 | })(window) 140 | -------------------------------------------------------------------------------- /javascripts/govuk_toolkit.js: -------------------------------------------------------------------------------- 1 | // = require_tree ./govuk 2 | -------------------------------------------------------------------------------- /javascripts/stageprompt.js: -------------------------------------------------------------------------------- 1 | // Stageprompt 2.0.1 2 | // 3 | // See: https://github.com/alphagov/stageprompt 4 | // 5 | // Stageprompt allows user journeys to be described and instrumented 6 | // using data attributes. 7 | // 8 | // Setup (run this on document ready): 9 | // 10 | // GOVUK.performance.stageprompt.setupForGoogleAnalytics(); 11 | // 12 | // Usage: 13 | // 14 | // Sending events on page load: 15 | // 16 | //
17 | // [...] 18 | //
19 | // 20 | // Sending events on click: 21 | // 22 | // See more info... 23 | 24 | ;(function (global) { 25 | 'use strict' 26 | 27 | var $ = global.jQuery 28 | var GOVUK = global.GOVUK || {} 29 | 30 | GOVUK.performance = GOVUK.performance || {} 31 | 32 | GOVUK.performance.stageprompt = (function () { 33 | var setup, setupForGoogleAnalytics, splitAction 34 | 35 | splitAction = function (action) { 36 | var parts = action.split(':') 37 | if (parts.length <= 3) return parts 38 | return [parts.shift(), parts.shift(), parts.join(':')] 39 | } 40 | 41 | setup = function (analyticsCallback) { 42 | var journeyStage = $('[data-journey]').attr('data-journey') 43 | var journeyHelpers = $('[data-journey-click]') 44 | 45 | if (journeyStage) { 46 | analyticsCallback.apply(null, splitAction(journeyStage)) 47 | } 48 | 49 | journeyHelpers.on('click', function (event) { 50 | analyticsCallback.apply(null, splitAction($(this).data('journey-click'))) 51 | }) 52 | } 53 | 54 | setupForGoogleAnalytics = function () { 55 | setup(GOVUK.performance.sendGoogleAnalyticsEvent) 56 | } 57 | 58 | return { 59 | setup: setup, 60 | setupForGoogleAnalytics: setupForGoogleAnalytics 61 | } 62 | }()) 63 | 64 | GOVUK.performance.sendGoogleAnalyticsEvent = function (category, event, label) { 65 | if (global.ga && typeof global.ga === 'function') { 66 | global.ga('send', 'event', category, event, label, { 67 | nonInteraction: true 68 | }) 69 | } else { 70 | global._gaq.push(['_trackEvent', category, event, label, undefined, true]) 71 | } 72 | } 73 | 74 | global.GOVUK = GOVUK 75 | })(window) 76 | -------------------------------------------------------------------------------- /javascripts/vendor/jquery/jquery.player.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The Nomensa accessible media player is a flexible multimedia solution for websites and intranets. 3 | * The core player consists of JavaScript wrapper responsible for generating an accessible HTML toolbar 4 | * for interacting with a media player of your choice. We currently provide support for YouTube (default), 5 | * Vimeo and JWPlayer although it should be possible to integrate the player with almost any media player on 6 | * the web (provided a JavaScript api for the player in question is available). 7 | * 8 | * Copyright (C) 2013 Nomensa Ltd 9 | * 10 | * Version 2.1.2 11 | * 12 | * This program is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 3 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program. If not, see . 24 | **/ 25 | var swfobject=function(){var aq="undefined",aD="object",ab="Shockwave Flash",X="ShockwaveFlash.ShockwaveFlash",aE="application/x-shockwave-flash",ac="SWFObjectExprInst",ax="onreadystatechange",af=window,aL=document,aB=navigator,aa=false,Z=[aN],aG=[],ag=[],al=[],aJ,ad,ap,at,ak=false,aU=false,aH,an,aI=true,ah=function(){var a=typeof aL.getElementById!=aq&&typeof aL.getElementsByTagName!=aq&&typeof aL.createElement!=aq,e=aB.userAgent.toLowerCase(),c=aB.platform.toLowerCase(),h=c?/win/.test(c):/win/.test(e),j=c?/mac/.test(c):/mac/.test(e),g=/webkit/.test(e)?parseFloat(e.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,d=!+"\v1",f=[0,0,0],k=null;if(typeof aB.plugins!=aq&&typeof aB.plugins[ab]==aD){k=aB.plugins[ab].description;if(k&&!(typeof aB.mimeTypes!=aq&&aB.mimeTypes[aE]&&!aB.mimeTypes[aE].enabledPlugin)){aa=true;d=false;k=k.replace(/^.*\s+(\S+\s+\S+$)/,"$1");f[0]=parseInt(k.replace(/^(.*)\..*$/,"$1"),10);f[1]=parseInt(k.replace(/^.*\.(.*)\s.*$/,"$1"),10);f[2]=/[a-zA-Z]/.test(k)?parseInt(k.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0;}}else{if(typeof af.ActiveXObject!=aq){try{var i=new ActiveXObject(X);if(i){k=i.GetVariable("$version");if(k){d=true;k=k.split(" ")[1].split(",");f=[parseInt(k[0],10),parseInt(k[1],10),parseInt(k[2],10)];}}}catch(b){}}}return{w3:a,pv:f,wk:g,ie:d,win:h,mac:j};}(),aK=function(){if(!ah.w3){return;}if((typeof aL.readyState!=aq&&aL.readyState=="complete")||(typeof aL.readyState==aq&&(aL.getElementsByTagName("body")[0]||aL.body))){aP();}if(!ak){if(typeof aL.addEventListener!=aq){aL.addEventListener("DOMContentLoaded",aP,false);}if(ah.ie&&ah.win){aL.attachEvent(ax,function(){if(aL.readyState=="complete"){aL.detachEvent(ax,arguments.callee);aP();}});if(af==top){(function(){if(ak){return;}try{aL.documentElement.doScroll("left");}catch(a){setTimeout(arguments.callee,0);return;}aP();})();}}if(ah.wk){(function(){if(ak){return;}if(!/loaded|complete/.test(aL.readyState)){setTimeout(arguments.callee,0);return;}aP();})();}aC(aP);}}();function aP(){if(ak){return;}try{var b=aL.getElementsByTagName("body")[0].appendChild(ar("span"));b.parentNode.removeChild(b);}catch(a){return;}ak=true;var d=Z.length;for(var c=0;c0){for(var h=0;h0){var i=aS(c);if(i){if(ao(aG[h].swfVersion)&&!(ah.wk&&ah.wk<312)){ay(c,true);if(l){a.success=true;a.ref=av(c);l(a);}}else{if(aG[h].expressInstall&&au()){var e={};e.data=aG[h].expressInstall;e.width=i.getAttribute("width")||"0";e.height=i.getAttribute("height")||"0";if(i.getAttribute("class")){e.styleclass=i.getAttribute("class");}if(i.getAttribute("align")){e.align=i.getAttribute("align");}var f={};var d=i.getElementsByTagName("param");var k=d.length;for(var j=0;j';}}a.outerHTML='"+h+"";ag[ag.length]=e.id;d=aS(e.id);}else{var b=ar(aD);b.setAttribute("type",aE);for(var k in e){if(e[k]!=Object.prototype[k]){if(k.toLowerCase()=="styleclass"){b.setAttribute("class",e[k]);}else{if(k.toLowerCase()!="classid"){b.setAttribute(k,e[k]);}}}}for(var l in g){if(g[l]!=Object.prototype[l]&&l.toLowerCase()!="movie"){aQ(b,l,g[l]);}}a.parentNode.replaceChild(b,a);d=b;}}return d;}function aQ(b,d,c){var a=ar("param");a.setAttribute("name",d);a.setAttribute("value",c);b.appendChild(a);}function aw(a){var b=aS(a);if(b&&b.nodeName=="OBJECT"){if(ah.ie&&ah.win){b.style.display="none";(function(){if(b.readyState==4){aT(a);}else{setTimeout(arguments.callee,10);}})();}else{b.parentNode.removeChild(b);}}}function aT(a){var b=aS(a);if(b){for(var c in b){if(typeof b[c]=="function"){b[c]=null;}}b.parentNode.removeChild(b);}}function aS(a){var c=null;try{c=aL.getElementById(a);}catch(b){}return c;}function ar(a){return aL.createElement(a);}function aM(a,c,b){a.attachEvent(c,b);al[al.length]=[a,c,b];}function ao(a){var b=ah.pv,c=a.split(".");c[0]=parseInt(c[0],10);c[1]=parseInt(c[1],10)||0;c[2]=parseInt(c[2],10)||0;return(b[0]>c[0]||(b[0]==c[0]&&b[1]>c[1])||(b[0]==c[0]&&b[1]==c[1]&&b[2]>=c[2]))?true:false;}function az(b,f,a,c){if(ah.ie&&ah.mac){return;}var e=aL.getElementsByTagName("head")[0];if(!e){return;}var g=(a&&typeof a=="string")?a:"screen";if(c){aH=null;an=null;}if(!aH||an!=g){var d=ar("style");d.setAttribute("type","text/css");d.setAttribute("media",g);aH=e.appendChild(d);if(ah.ie&&ah.win&&typeof aL.styleSheets!=aq&&aL.styleSheets.length>0){aH=aL.styleSheets[aL.styleSheets.length-1];}an=g;}if(ah.ie&&ah.win){if(aH&&typeof aH.addRule==aD){aH.addRule(b,f);}}else{if(aH&&typeof aL.createTextNode!=aq){aH.appendChild(aL.createTextNode(b+" {"+f+"}"));}}}function ay(a,c){if(!aI){return;}var b=c?"visible":"hidden";if(ak&&aS(a)){aS(a).style.visibility=b;}else{az("#"+a,"visibility:"+b);}}function ai(b){var a=/[\\\"<>\.;]/;var c=a.exec(b)!=null;return c&&typeof encodeURIComponent!=aq?encodeURIComponent(b):b;}var aR=function(){if(ah.ie&&ah.win){window.attachEvent("onunload",function(){var a=al.length;for(var b=0;b").attr("id","player-"+this.config.id).addClass("flashReplace").html('This content requires Macromedia Flash Player. You can install or upgrade the Adobe Flash Player here.');var d=$("").addClass("video");var b=this.getURL();setTimeout(function(){swfobject.embedSWF(b,e.attr("id"),g.config.flashWidth,g.config.flashHeight,"9.0.115",null,a,f,h,g.config.swfCallback);if(window.NOMENSA.browser.mozilla&&(parseInt(window.NOMENSA.browser.version,10)>=2)){g.$html.find("object").attr("tabindex","-1");}},0);c.append(d.append(e));return c;},generateVideoPlayer:function(b){if(typeof window.postMessage==="undefined"){return this.generateFlashPlayer(b);}else{var a=$("<"+this.config.flashContainer+" />").attr("id","player-"+this.config.id);var c=$("").addClass("video");b.append(c.append(a));return b;}},getPlayer:function(){return this.player;},is_html5:false,play:function(){this.player.playVideo();this.setSliderTimeout();if(this.config.captionsOn&&this.captions){this.setCaptionTimeout();}},pause:function(){this.player.pauseVideo();this.clearSliderTimeout();if(this.config.captionsOn&&this.captions){this.clearCaptionTimeout();}},ffwd:function(){var b=this.getCurrentTime()+this.config.playerSkip,a=this.getDuration();if(b>a){b=a;}this.seek(b);},rewd:function(){var a=this.getCurrentTime()-this.config.playerSkip;if(a<0){a=0;}this.seek(a);},mute:function(){var a=this.$html.find("button.mute");if(this.player.isMuted()){this.player.unMute();if(a.hasClass("muted")){a.removeClass("muted");}}else{this.player.mute();a.addClass("muted");}},volup:function(){var a=this.player.getVolume();if(a>=100){a=100;}else{a=a+this.config.volumeStep;}this.player.setVolume(a);this.updateVolume(a);},voldwn:function(){var a=this.player.getVolume();if(a<=0){a=0;}else{a=a-this.config.volumeStep;}this.player.setVolume(a);this.updateVolume(a);},getDuration:function(){return this.player.getDuration();},getCurrentTime:function(){return this.player.getCurrentTime();},getBytesLoaded:function(){return this.player.getVideoBytesLoaded();},getBytesTotal:function(){return this.player.getVideoBytesTotal();},seek:function(a){this.player.seekTo(a,true);if(this.config.captionsOn&&this.captions){this.$html.find(".caption").remove();this.clearCaptionTimeout();this.setCaptionTimeout();this.getPreviousCaption();}},cue:function(){this.player.cueVideoById(this.config.media);},toggleCaptions:function(){var a=this;var b=this.$html.find(".captions");if(b.hasClass("captions-off")){b.removeClass("captions-off").addClass("captions-on");a.getPreviousCaption();a.setCaptionTimeout();a.config.captionsOn=true;}else{b.removeClass("captions-on").addClass("captions-off");a.clearCaptionTimeout();a.$html.find(".caption").remove();a.config.captionsOn=false;}}};window.NOMENSA=window.NOMENSA||{};window.NOMENSA.player=window.NOMENSA.player||{};window.NOMENSA.player.MediaplayerDecorator=function(a){var b=a;this.config=b.config;this.player=b.player;this.state=b.state;for(var c in b){if(typeof b[c]==="function"){this[c]=(function(d){return function(){return b[d].apply(this,arguments);};}(c));}}};window.NOMENSA.player.MediaplayerDecorator.prototype.generatePlayerContainer=function(){var a=$("<"+this.config.playerContainer+" />").css(this.config.playerStyles).addClass("player-container");if(window.NOMENSA.browser.msie){a.addClass("player-container-ie player-container-ie-"+window.NOMENSA.browser.version.substring(0,1));}return a;};window.NOMENSA.player.MediaplayerDecorator.prototype.assembleHTML=function(){var a=this.generatePlayerContainer();var c=this.generateVideoPlayer(a);var b=c.append(this.getControls());return b;};window.NOMENSA.player.MediaplayerDecorator.prototype.getURL=function(){return[this.config.url,this.config.id].join("");};window.NOMENSA.player.MediaplayerDecorator.prototype.createButton=function(d,b){var a=0;var e=[d,this.config.id].join("-");var c=$("