PageSourceSearch

https://mbpg.gov.my/themes/contrib/mbpg23/js/script3.js?v=10.1.0

js mbpg.gov.my collected 2026-10-02 22:08:35 UTC 6,036 bytes, 204 lines download raw bytes

1(function($) {
2  "use strict";
3  $(function() {
4    
5    var mbpg3 = {
6      baseFunction : function() {
7      	$('#main-wrapper #main').removeClass('container-fluid').addClass('container');
8
9      	var totalText = $('#block-mbpg23-pelawatpelawat li.list-group-item').text().split('Total Visitors: <em class="placeholder">');
10        $('#block-mbpg23-pelawatpelawat li.list-group-item').html(totalText[1]);
11
12        $('.floating-links .w3c .img-oku, .floating-links .w3c .w3c-part').hover(function() {
13          $(this).parent().addClass('hover');
14        }, function() {
15          $(this).parent().removeClass('hover');
16        });
17      },
18      kempenSlider : function() {
19      	if ($(window).width() > 768) {
20      		$(".view-program-kempen .view-content").slick({
21	        infinite: true,
22	        centerMode: true,
23	        slidesToShow: 1,
24	        slidesToScroll: 1,
25	        centerPadding: "25%",
26	        autoplay: true,
27    		autoplaySpeed: 3000,
28    		pauseOnFocus: true,
29    		pauseOnHover: true
30	      });
31      	}
32      	
33
34      	if ($(window).width() < 768) {
35          $(".view-program-kempen .view-content").slick({
36	        infinite: true,
37	        centerMode: false,
38	        slidesToShow: 1,
39	        slidesToScroll: 1,
40	        centerPadding: "0",
41	        autoplay: true,
42    		autoplaySpeed: 3000,
43    		pauseOnFocus: true,
44    		pauseOnHover: true
45	      });
46        }
47      },
48      w3cFunction: function() {
49      	var w3cFont = $('.header-w3c-wrapper .ikon-jkt-w3c-font'),
50  			w3cColor = $('.header-w3c-wrapper .ikon-jkt-w3c-color');
51
52		w3cFont.click(function() {
53			var font = ($(this).prop('class')).replace(/ikon-jkt-w3c-font|ikon-w3c|-| /g,'');	
54			switch (font) {
55				case 'small': {
56					w3cLoading(w3cFont,'font',-1);
57	        break;
58				}
59				case 'normal': {
60					w3cLoading(w3cFont,'reset-font');
61	        break;
62				}
63				case 'big': {
64					w3cLoading(w3cFont,'font',+1);
65	        break;
66				}
67			}
68		});
69
70		w3cColor.click(function() {
71          var color = ($(this).prop('class')).replace(/ikon-jkt-w3c-color|ikon-w3c|-| /g,''); 
72          switch (color) {
73            case 'first': {
74              w3cLoading(w3cColor,'color','#1F1360','#FFFFCC');       
75              break;
76            }
77            case 'second': {
78              w3cLoading(w3cColor,'color','#1F1360','#FFB6C1');       
79              break;
80            }
81            case 'third': {
82              w3cLoading(w3cColor,'color','#1F1360','#ADD8E6');       
83              break;
84            }
85            case 'reset': {
86              w3cLoading(w3cColor,'reset-color');       
87              break;
88            }
89          }
90         
91        });
92      },
93      photoGallery: function() {
94      	if ($('body').hasClass('node--type-photo-gallery')) {
95      		$('main#content').addClass('col-md-9');
96      		
97      		$('#image-gallery').lightSlider({
98                gallery:true,
99                item:1,
100                thumbItem:9,
101                slideMargin: 0,
102                speed:1000,
103                auto:true,
104                loop:true,
105                onSliderLoad: function() {
106                    $('#image-gallery').removeClass('cS-hidden');
107                }  
108            });
109      	}
110      },
111      tabFunction: function() {
112        var linkTab = $('.mbpg-tab li a');
113        var contentTab = $('.mbpg-tab-content > div');
114        linkTab.each(function() {
115          $(this).on('click', function() {
116            var tabPos = $(this).parent().index();
117            linkTab.removeClass('active');
118            $(this).addClass('active');
119            contentTab.removeClass('in active show')
120            $(this).parent().parent().next().find('>div').eq(tabPos).addClass('in active show');
121          });
122        });
123      }
124    }
125
126    mbpg3.baseFunction();
127    mbpg3.kempenSlider();
128    mbpg3.w3cFunction();
129    mbpg3.photoGallery();
130    //mbpg3.tabFunction();
131
132    // W3C Function, COLOR & TEXT SIZE
133    function w3cLoading(con,w3c,t,bg) {
134      var place = $('<div id="w3c-loading">Loading...</div>'),
135          posLeft = con.offset().left,
136          posTop = con.offset().top+5;
137
138      place.css({
139        'left' : posLeft,
140        'top' : posTop
141      }).appendTo('body').fadeIn(function() {
142        switch (w3c) {
143          case 'color' : {
144            setColor(t,bg);   
145            break;
146          }
147          case 'font' : {
148            w3cText(t);
149            break;
150          }
151          case 'reset-color' : {
152            setColor('reset');    
153            break;
154          }
155          case 'reset-font' : {
156            w3cText('reset');   
157            break;
158          }
159        }
160        $('#w3c-loading').remove();
161      });
162    }
163
164    function setColor(color,bg) {
165      var storeListOfElements = ["P", "LI", "A", "H1", "H2", "H3", "H4", "H5", "H6", "SPAN", "TD", "TH", "DT", "DD", "DL"];
166      $("*").each(function(i, j) {
167          if (($(this).css("color") != undefined) && (storeListOfElements.indexOf($(this).prop("tagName")) != -1)) {
168            if (color == 'reset') {
169              $(this).css({
170                "color" : "",
171                "background-color" : ""
172              });
173            }
174            else {
175              $(this).css({
176                "color" : color,
177                "background-color" : bg
178              });     
179            }
180          }
181      });
182    }
183
184    function w3cText(x) {
185      var listOfElements = ["P", "LI", "A", "H1", "H2", "H3", "H4", "H5", "H6", "SPAN", "TD", "TH", "DT", "DD", "DL"];
186      $("*").each(function(i, j) {
187        if (($(this).css("font-size") != undefined) && (listOfElements.indexOf($(this).prop("tagName")) != -1)) {
188          if (x == 'reset') {
189            $(this).css("font-size", "");
190          }
191          else {
192            var getSize = $(this).css("font-size");
193            var currentSize = getSize.replace("px", "");
194            if (currentSize >= 9 && currentSize <= 17) {
195                $(this).css("font-size", parseInt(currentSize) + x + "px");
196            }
197          }
198        }
199      });
200    }
201
202  });
203
204})(jQuery);

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.