PageSourceSearch

https://consultapopular.rs.gov.br/matriz_common/versions/2.1.5/the…/js/stylesheet.selector.js?2.1.5.161.6+4

js consultapopular.rs.gov.br collected 2026-09-26 17:39:50 UTC 3,262 bytes, 88 lines download raw bytes

1
2StylesheetSelector = {
3    $enable: $('a[data-action="enable-alternate-style"]'),
4    $disable: $('a[data-action="disable-alternate-style"]')
5};
6
7StylesheetSelector.changeContraste = function (alternate) {
8    if (alternate) {
9        $("link[rel='alternate stylesheet']").prop('disabled', false);
10        $("link[rel='alternate stylesheet']").prop('disabled', true);
11        $("link[rel='alternate stylesheet']").prop('disabled', false);
12        $('html, body').addClass('matriz-contraste-on');
13        $('#logo__secretarias-padrao').addClass("secretaria-contraste-on");
14        $('.wrapper__cabecalho__funcionalidades a.secretaria-vinculada').addClass("secretaria-contraste-on");
15    } else {
16        $("link[rel='alternate stylesheet']").prop('disabled', true);
17        $('html, body').removeClass('matriz-contraste-on');
18        $('#logo__secretarias-padrao').removeClass("secretaria-contraste-on");
19        $('.wrapper__cabecalho__funcionalidades a.secretaria-vinculada').removeClass("secretaria-contraste-on");
20    }
21}
22
23StylesheetSelector.init = function () {
24    this.$enable.on("click", function (e) {        
25        StylesheetSelector.createCookie("style.matriz.alternate", true, 365);
26        StylesheetSelector.changeButtons(true);
27        StylesheetSelector.changeContraste(true);
28        console.log('exibe alto contraste');
29    });
30
31    this.$disable.on("click", function (e) {        
32        StylesheetSelector.createCookie("style.matriz.alternate", false, 365);
33        StylesheetSelector.changeButtons(false);
34        StylesheetSelector.changeContraste(false);
35        console.log('exibe contraste normal');
36    });
37
38    var alternate = StylesheetSelector.readCookie("style.matriz.alternate");
39    alternate = (alternate === 'true');
40    StylesheetSelector.changeButtons(alternate);
41    StylesheetSelector.changeContraste(alternate);
42};
43
44StylesheetSelector.changeButtons = function (active) {
45    var value = "disabled";
46    if (active) {
47        this.$enable.hide();
48        this.$disable.show();
49        value = null;
50    } else {
51        this.$disable.hide();
52        this.$enable.show();
53    }
54};
55
56StylesheetSelector.createCookie = function (name, value, daes) {
57    if (daes) {
58        var date = new Date();
59        date.setTime(date.getTime() + (daes * 24 * 60 * 60 * 1000));
60        var expires = "; expires=" + date.toGMTString();
61    } else
62        expires = "";
63    document.cookie = name + "=" + value + expires + "; path=/";
64};
65
66StylesheetSelector.readCookie = function readCookie(name) {
67    var nameEQ = name + "=";
68    var ca = document.cookie.split(';');
69    for (var i = 0; i < ca.length; i++) {
70        var c = ca[i];
71        while (c.charAt(0) === ' ')
72            c = c.substring(1, c.length);
73        if (c.indexOf(nameEQ) === 0)
74            return c.substring(nameEQ.length, c.length);
75    }
76    return null;
77};
78
79StylesheetSelector.fast = function () {
80    var alternate = StylesheetSelector.readCookie("style.matriz.alternate");
81    alternate = (alternate === 'true');
82    StylesheetSelector.changeContraste(alternate);
83};
84StylesheetSelector.fast();
85
86window.addEventListener("load", function () {
87    StylesheetSelector.init();
88});

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.