PageSourceSearch

https://www.legislation.gov.uk/scripts/CentralConfig.js

js legislation.gov.uk collected 2026-09-24 06:54:25 UTC 14,499 bytes, 482 lines download raw bytes

1/*
2 (c)  Crown copyright
3
4 You may use and re-use this code free of charge under the terms of the Open Government Licence v3.0
5
6 http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3
7
8 */
9// JavaScript for Welsh Lnaguage wrapper
10
11var LANG;
12try {
13    LANG = document.location.pathname.substr(1).split('/').shift() === 'cy' ? 'cy' : 'en';
14} catch (e) {
15    LANG = 'en';
16}
17
18var config = {
19    validate: {
20        year: {
21            en: 'YYYY',
22            cy: 'BBBB'   // will change it later after testing    seach.js  line no 40 -48
23        },
24        date: {
25            en: "DD/MM/YYYY", //  serach.js line no 41,42,43
26            cy: "DD/MM/BBBB"
27        },
28        specificYear: {
29            en: 'Any',
30            cy: 'Unrhyw un'
31        },
32        number: {
33            en: "Any",
34            cy: 'Unrhyw un'
35        }
36    },
37    search: {
38        affectingTitle: {
39            //cy: "Mae'r holl ddeddfwriaeth (neu nodwch y teitl)",
40            cy: "Pob deddfwriaeth (neu rhowch y teitl)",
41            en: "All legislation (or insert title)"
42        },
43        affect: {
44            apply: {
45                part1: {
46                    en: " You want to search for changes that affect ",
47                    cy: " Rydych chi eisiau chwilio am newidiadau sy’n effeithio ar "
48                },
49                part2: {
50                    en: " made by ",
51                    cy: " a wnaed gan "
52                },
53                part3: {
54                    en: "all legislation ",
55                    cy: "bob deddfwriaeth "
56                }
57            }
58        },
59        expandCollapse: {
60            message1: {
61                en: "Modify search", // search.js   line no 63
62                cy: "Addasu’r chwiliad"
63            },
64            message2: {
65                en: "Hide search form", // search.js   line no 64
66                cy: "Cuddio ffurflen chwilio"
67            }
68        },
69        newSearch: {
70            message1: {
71                en: "Reset Fields", // search.js   line no 102
72                cy: "Ailosod Meysydd"
73            }
74        },
75        showHide: {
76            selectTypes: {
77                en: "Select types", // search.js   line no 90
78                cy: "Dewis mathau"
79            }
80        },
81        extentCombonation: {
82            en: "Extent combinations this search will include:", // search.js   line no 211
83            cy: "Cyfuniadau graddfa y bydd y chwiliad hwn yn eu cynnwys:"
84        }
85    },
86    pagination: {// minpagination.js  line no 127
87        currPageInfo: {
88            textPage: {
89                en: "Page ",
90                cy: "Tudalen "
91            },
92            textOf: {
93                en: " of ",
94                cy: " o "
95            }
96        }
97
98    },
99    errorBar: {
100        error: {
101            en: "Please check the form fields which are highlighted in red", // common.js line no 115
102            cy: "Gwiriwch feysydd y ffurflen sydd wedi eu hamlygu mewn coch"
103        }
104    },
105    forms: {
106        errormsg1: {
107            en: "Not a valid year", // common.js line no 91
108            cy: "Ddim yn flwyddyn ddilys"
109        },
110        errormsg2: {
111            en: "Not a valid date (dd/mm/yyyy)", // common.js line no 95
112            cy: "Ddim yn ddyddiad dilys (dd/mm/bbbb)"
113        },
114        errormsg3: {
115            en: "Not a valid number", // common.js line no 99
116            cy: "Ddim yn rif dilys"
117        },
118        errormsg4: {
119            en: "didn't match any item", // search/JQuery.ui.comboboxFormLinks.js  line no 40
120            cy: "ddim yn cyfateb ag unrhyw eitem"
121        }
122    },
123    links: {
124        message1: {
125            en: "Collapse all -", // chrome.js Line no 211  (chromelnit.js line no  215, 214, 220)
126            cy: "Cwympo oll –"
127        },
128        message2: {
129            en: "Expand all +", //chrome.js Line no 211  (chromelnit.js line no  215, 214, 220
130            cy: "Ehangu oll +"
131        },
132        message3: {
133            en: "Expand +", // toc ExpandCollapse.js line no 27
134            cy: "Ehangu +"
135        },
136        message4: {
137            en: "Collapse -", // toc ExpandCollapse.js line no 27
138            cy: "Cwympo -"
139        }
140    },
141    statusWarning: {
142        expandCollapseLink: {
143            message1: {
144                en: "View outstanding changes", // chromelnit.js line no  114
145                cy: "Gweld newidiadau sy’n aros"
146            },
147            message2: {
148                en: "status warnings", // chromelnit.js line no  114
149                cy: "rhybuddion statws"
150            },
151            message3: {
152                en: "Close", // chromelnit.js line no  114
153                cy: "Cau"
154            }
155        }
156    },
157    statusWarningSubSections: {
158        expandCollapseLink: {
159            message1: {
160                en: "View changes", // chromelnit.js line no  x
161                cy: "Gweld newidiadau"
162            },
163            message2: {
164                en: "View outstanding changes", // chromelnit.js line no  x
165                cy: "Gweld newidiadau sy’n aros"
166            },
167            message3: {
168                en: "status warnings", // chromelnit.js line no  114
169                cy: "rhybuddion statws"
170            },
171            message4: {
172                en: "Close", // chromelnit.js line no  x
173                cy: "Cau"
174            }
175        }
176    },
177    statusEffectsAppliedSection: {
178        expandCollapseLink: {
179            message1: {
180                en: "More", // chromelnit.js line no  126
181                cy: "Mwy"
182            },
183            message2: {
184                en: "effects to be announced", // chromelnit.js line no  126
185                cy: "effeithiau i’w cyhoeddi"
186            },
187            message3: {
188                en: "Close", // chromelnit.js line no  114
189                cy: "Cau"
190            }
191
192        }
193    },
194    changesAppliedContent: {
195        expandCollapseLink: {
196            message1: {
197                en: "More", // chromelnit.js line no  135
198                cy: "Mwy"
199            },
200            message2: {
201                en: "effects to be announced", // chromelnit.js line no  135
202                cy: "effeithiau i'w cyhoeddi"
203            },
204            message3: {
205                en: "Close", // chromelnit.js line no  135
206                cy: "Cau"
207            }
208
209        }
210    },
211    outstandingRefs: {
212        expandCollapseLink: {
213            show: {
214                en: "View results",
215                cy: "Gweld canlyniadau"
216            },
217            hide: {
218                en: "Close",
219                cy: "Cau"
220            }
221
222        }
223    },
224    outstandingRefsContent: {
225        expandCollapseLink: {
226            show: {
227                en: "Expand", // toc ChromeInit.js line no 173
228                cy: "Ehangu"
229            },
230            hide: {
231                en: "Close",
232                cy: "Cau"
233            }
234
235        }
236    },
237    commencementAppliedContent: {
238        expandCollapseLink: {
239            message1: {
240                en: "More", // chromelnit.js line no  144
241                cy: "Mwy"
242            },
243            message2: {
244                en: "changes to be applied", // chromelnit.js line no  144
245                cy: "newidiadau i'w gweithredu"
246            },
247            message3: {
248                en: "Close", // chromelnit.js line no  144
249                cy: "Cau"
250            }
251        }
252    },
253    quickSearch: {
254        expandCollapseLink: {
255            message1: {
256                en: "Search Legislation", // chromelnit.js line no  151
257                cy: "Chwilio"
258            },
259            message2: {
260                en: "Show", // chromelnit.js line no  151
261                cy: "Dangos"
262            },
263            message3: {
264                en: "Hide", // chromelnit.js line no  151
265                cy: "Cuddio"
266            }
267        }
268    },
269    dcAlternativeLink: {
270        message1: {
271            en: "Show full page title", // chromelnit.js line no  294
272            cy: "Dangos"
273        },
274        message2: {
275            en: "Hide full page title", // chromelnit.js line no  294
276            cy: "Cuddio"
277        }
278    },
279    modalwin: {
280        title: {
281            en: "Large image view", //   showMessageDialog.js  line no 170
282            cy: "Gwedd delwedd mawr"                     //   showMessageDialog.js  line no 170
283        }
284    },
285    viewLegContents: {
286        previous: {
287            en: "Previous match", //  prevousNextTextMatches.js   line no:  12
288            cy: "Canlyniad blaenorol"                   //
289        },
290        next: {
291            en: "Next match", //  prevousNextTextMatches.js   line no:  12
292            cy: "Canlyniad nesaf"
293        },
294        backToSearch: {
295            en: "Back to search results", //  prevousNextTextMatches.js   line no:  16
296            cy: "Yn ôl i’r canlyniadau chwilio"
297        }
298
299    },
300    cookieShowHideTable: {
301        settings: {
302            show: {
303                en: 'Show details of these <span class="accessibleText">settings </span> cookies',
304                cy: 'Dangoswch fanylion y  <span class="accessibleText">cwcis </span> gosodiadau hyn'
305            },
306            hide: {
307                en: 'Hide details of these <span class="accessibleText">settings </span> cookies',
308                cy: 'Cuddiwch fanylion y <span class="accessibleText">cwcis </span> gosodiadau hyn'
309            }
310        },
311        analytics: {
312            show: {
313                en: 'Show details of these <span class="accessibleText">analytics </span> cookies',
314                cy: 'Dangoswch fanylion y <span class="accessibleText">cwcis </span> dadansoddiadau hyn'
315            },
316            hide: {
317                en: 'Hide details of these <span class="accessibleText">analytics </span> cookies',
318                cy: 'Cuddiwch fanylion y <span class="accessibleText">cwcis </span> dadansoddiadau hyn'
319            }
320        },
321        essential: {
322            show: {
323                en: 'Show details of these <span class="accessibleText">
323essential </span> cookies',
324                cy: 'Dangoswch fanylion y <span class="accessibleText">cwcis </span> hanfodol hyn'
325            },
326            hide: {
327                en: 'Hide details of these <span class="accessibleText">essential </span> cookies',
328                cy: 'Cuddiwch fanylion y <span class="accessibleText">cwcis </span> hanfodol hyn'
329            }
330        }
331    },
332    cookieFormSave: {
333        en: 'Save your settings',
334        cy: 'Cadwch eich gosodiadau'
335    },
336    carousel: {
337        play: {
338            en: 'Play',
339            cy: 'Play'
340        },
341        pause: {
342            en: 'Pause',
343            cy: 'Pause'
344        }
345    }
346}
347
348
349/*   this is the configs for "eniw_leg.gov.uk.js"   line no 61 and 62
350 explanatory: {
351 collapseText:{
352 en: "Collapse All Explanatory Notes (ENs)",
353 cy: "Collapse Pob Nodyn Esboniadol (ENs)"
354 },
355
356 expandText:{
357 en: "Expand All Explanatory Notes (ENs)",
358 cy: "Ehangu Pob Nodyn Esboniadol (ENs)"
359 }
360 }
361
362 */
363
364
365/* Fixing CSS isueu by assing new class
366 only work in Welsh version
367 */
368
369
370if (LANG == "cy") {
371
372    $().ready(function () {
373
374        $("#title").addClass("titleCy cy");    // about us page dropdown and input box size fixes
375        $(".title").addClass("title titlecy");
376        $(".type").addClass("typeCy");
377
378        $(".typeCheckBoxDoubleCol").addClass("typeCheckBoxDoubleColCy");  // search Wlesh page css fixing for check boxes
379
380    });
381}
382;
383
384/*!
385 * jQuery Cookie Plugin v1.3.1
386 * https://github.com/carhartl/jquery-cookie
387 *
388 * Copyright 2013 Klaus Hartl
389 * Released under the MIT license
390 */
391$(document).ready(function () {
392
393    (function (factory) {
394        if (typeof define === 'function' && define.amd) {
395            // AMD. Register as anonymous module.
396            define(['jquery'], factory);
397        } else {
398            // Browser globals.
399            factory(jQuery);
400        }
401    }(function ($) {
402
403        var pluses = /\+/g;
404
405        function raw(s) {
406            return s;
407        }
408
409        function decoded(s) {
410            return decodeURIComponent(s.replace(pluses, ' '));
411        }
412
413        function converted(s) {
414            if (s.indexOf('"') === 0) {
415                // This is a quoted cookie as according to RFC2068, unescape
416                s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
417            }
418            try {
419                return config.json ? JSON.parse(s) : s;
420            } catch (er) {
421            }
422        }
423
424        var config = $.cookie = function (key, value, options) {
425
426            // write
427            if (value !== undefined) {
428                options = $.extend({}, config.defaults, options);
429
430                if (typeof options.expires === 'number') {
431                    var days = options.expires, t = options.expires = new Date();
432                    t.setDate(t.getDate() + days);
433                }
434
435                value = config.json ? JSON.stringify(value) : String(value);
436
437                return (document.cookie = [
438                    config.raw ? key : encodeURIComponent(key),
439                    '=',
440                    config.raw ? value : encodeURIComponent(value),
441                    options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
442                    options.path ? '; path=' + options.path : '',
443                    options.domain ? '; domain=' + options.domain : '',
444                    options.secure ? '; secure' : ''
445                ].join(''));
446            }
447
448            // read
449            var decode = config.raw ? raw : decoded;
450            var cookies = document.cookie.split('; ');
451            var result = key ? undefined : {};
452            for (var i = 0, l = cookies.length; i < l; i++) {
453                var parts = cookies[i].split('=');
454                var name = decode(parts.shift());
455                var cookie = decode(parts.join('='));
456
457                if (key && key === name) {
458                    result = converted(cookie);
459                    break;
460                }
461
462                if (!key) {
463                    result[name] = converted(cookie);
464                }
465            }
466
467            return result;
468        };
469
470        config.defaults = {};
471
472        $.removeCookie = function (key, options) {
473            if ($.cookie(key) !== undefined) {
474                $.cookie(key, '', $.extend(options, {expires: -1}));
475                return true;
476            }
477            return false;
478        };
479
480    }));
481
482});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.