PageSourceSearch

https://www.sitpune.edu.in/index/assets/base/js/app.js

js sitpune.edu.in collected 2026-09-25 04:06:30 UTC 13,691 bytes, 410 lines download raw bytes

1/**
2Core script to handle the entire theme and core functions
3**/
4
5var App = function() {
6
7    // IE mode
8    var isRTL = false;
9    var isIE9 = false;
10    var isIE10 = false;
11    var isIE = false;
12
13    var resizeHandlers = [];
14
15    // initializes main settings
16    var handleInit = function() {
17        isIE9 = !!navigator.userAgent.match(/MSIE 9.0/);
18        isIE10 = !!navigator.userAgent.match(/MSIE 10.0/);        
19        isIE = navigator.userAgent.indexOf("MSIE ") > -1 || navigator.userAgent.indexOf("Trident/") > -1;
20
21        if (isIE10) {
22            $('html').addClass('ie10'); // detect IE10 version
23        }
24
25        if (isIE9) {
26            $('html').addClass('ie9'); // detect IE10 version
27        }
28
29        if (isIE) {
30            $('html').addClass('ie'); // detect IE10 version
31        }
32    };
33
34    // runs callback functions set by Jango.addResponsiveHandler().
35    var _runResizeHandlers = function() {
36        // reinitialize other subscribed elements
37        for (var i = 0; i < resizeHandlers.length; i++) {
38            var each = resizeHandlers[i];
39            each.call();
40        }
41    };
42
43    // handle group element heights
44    var handleHeight = function() {
45       $('[data-auto-height]').each(function() {
46            var parent = $(this);
47            var items = $('[data-height]', parent);
48            var height = 0;
49            var mode = parent.attr('data-mode');
50            var offset = parseInt(parent.attr('data-offset') ? parent.attr('data-offset') : 0);
51
52            items.each(function() {
53                if ($(this).attr('data-height') == "height") {
54                    $(this).css('height', '');
55                } else {
56                    $(this).css('min-height', '');
57                }
58
59                var height_ = (mode == 'base-height' ? $(this).outerHeight() : $(this).outerHeight(true));
60                if (height_ > height) {
61                    height = height_;
62                }
63            });
64
65            height = height + offset;
66
67            items.each(function() {
68                if ($(this).attr('data-height') == "height") {
69                    $(this).css('height', height);
70                } else {
71                    $(this).css('min-height', height);
72                }
73            });
74
75            if(parent.attr('data-related')) {
76                $(parent.attr('data-related')).css('height', parent.height());
77            }
78       });       
79    }
80
81    // handle the layout reinitialization on window resize
82    var handleOnResize = function() {
83        var resize;
84        $(window).resize(function() {
85            if (resize) {
86                clearTimeout(resize);
87            }
88            resize = setTimeout(function() {
89                _runResizeHandlers();
90            }, 50); // wait 50ms until window resize finishes.
91        });
92    };
93
94    // Handles custom checkboxes & radios using jQuery Uniform plugin
95    var handleCheckboxRadios = function() {
96         // Material design ckeckbox and radio effects
97        $('body').on('click', '.c-checkbox > label, .c-radio > label', function() {
98            var the = $(this);
99            // find the first span which is our circle/bubble
100            var el = $(this).children('span:first-child');
101              
102            // add the bubble class (we do this so it doesnt show on page load)
103            el.addClass('inc');
104              
105            // clone it
106            var newone = el.clone(true);  
107              
108            // add the cloned version before our original
109            el.before(newone);  
110              
111            // remove the original so that it is ready to run on next click
112            $("." + el.attr("class") + ":last", the).remove();
113        }); 
114    };
115
116    // Handles Bootstrap Accordions.
117    var handleAccordions = function() {
118        $('body').on('shown.bs.collapse', '.accordion.scrollable', function(e) {
119            Jango.scrollTo($(e.target));
120        });
121    };
122
123
124    // Handles Bootstrap Tabs.
125    var handleTabs = function() {
126        //activate tab if tab id provided in the URL
127        if (encodeURI(location.hash)) {
128            var tabid = encodeURI(location.hash.substr(1));
129            $('a[href="#' + tabid + '"]').parents('.tab-pane:hidden').each(function() {
130                var tabid = $(this).attr("id");
131                $('a[href="#' + tabid + '"]').click();
132            });
133            $('a[href="#' + tabid + '"]').click();
134        }
135    };
136
137    // Handles Bootstrap Modals.
138    var handleModals = function() {
139        // fix stackable modal issue: when 2 or more modals opened, closing one of modal will remove .modal
139-open class. 
140        $('body').on('hide.bs.modal', function() {
141            if ($('.modal:visible').size() > 1 && $('html').hasClass('modal-open') === false) {
142                $('html').addClass('modal-open');
143            } else if ($('.modal:visible').size() <= 1) {
144                $('html').removeClass('modal-open');
145            }
146        });
147
148        // fix page scrollbars issue
149        $('body').on('show.bs.modal', '.modal', function() {
150            if ($(this).hasClass("modal-scroll")) {
151                $('body').addClass("modal-open-noscroll");
152            }
153        });
154
155        // fix page scrollbars issue
156        $('body').on('hide.bs.modal', '.modal', function() {
157            $('body').removeClass("modal-open-noscroll");
158        });
159
160        // remove ajax content and remove cache on modal closed 
161        $('body').on('hidden.bs.modal', '.modal:not(.modal-cached)', function() {
162            $(this).removeData('bs.modal');
163        });
164    };
165
166    // Handles Bootstrap Tooltips.
167    var handleTooltips = function() {
168        // global tooltips
169        $('.tooltips').tooltip();
170    };
171
172    // Handles Bootstrap Dropdowns
173    var handleDropdowns = function() {
174        /*
175          Hold dropdown on click  
176        */
177        $('body').on('click', '.dropdown-menu.hold-on-click', function(e) {
178            e.stopPropagation();
179        });
180    };
181
182    var handleAlerts = function() {
183        $('body').on('click', '[data-close="alert"]', function(e) {
184            $(this).parent('.alert').hide();
185            $(this).closest('.note').hide();
186            e.preventDefault();
187        });
188
189        $('body').on('click', '[data-close="note"]', function(e) {
190            $(this).closest('.note').hide();
191            e.preventDefault();
192        });
193
194        $('body').on('click', '[data-remove="note"]', function(e) {
195            $(this).closest('.note').remove();
196            e.preventDefault();
197        });
198    };
199
200    // Handle Hower Dropdowns
201    var handleDropdownHover = function() {
202        $('[data-hover="dropdown"]').not('.hover-initialized').each(function() {
203            $(this).dropdownHover();
204            $(this).addClass('hover-initialized');
205        });
206    };
207
208    // Handles Bootstrap Popovers
209
210    // last popep popover
211    var lastPopedPopover;
212
213    var handlePopovers = function() {
214        $('.popovers').popover();
215
216        // close last displayed popover
217
218        $(document).on('click.bs.popover.data-api', function(e) {
219            if (lastPopedPopover) {
220                lastPopedPopover.popover('hide');
221            }
222        });
223    };
224
225    // Fix input placeholder issue for IE9 and IE10
226    var handleFixInputPlaceholderForIE = function() {
227        //fix html5 placeholder attribute for ie9 & ie10
228        if (isIE9 || isIE10) {
229            // this is html5 placeholder fix for inputs, inputs with placeholder-no-fix class will be skipped(e.g: we need this for password fields)
230            $('input[placeholder]:not(.placeholder-no-fix), textarea[placeholder]:not(.placeholder-no-fix)').each(function() {
231                var input = $(this);
232
233                if (input.val() === '' && input.attr("placeholder") !== '') {
234                    input.addClass("placeholder").val(input.attr('placeholder'));
235                }
236
237                input.focus(function() {
238                    if (input.val() == input.attr('placeholder')) {
239                        input.val('');
240                    }
241                });
242
243                input.blur(function() {
244                    if (input.val() === '' || input.val() == input.attr('placeholder')) {
245                        input.val(input.attr('placeholder'));
246                    }
247                });
248            });
249        }
250    };
251
252    //* END:CORE HANDLERS *//
253
254    return {
255
256        //main function to initiate the theme
257        init: function() {
258            //IMPORTANT!!!: Do not modify the core handlers call order.
259
260            //Core handlers
261            handleHeight();
262            this.addResizeHandler(handleHeight); // handle auto calculating height on window resize
263
264            handleInit(); // initialize core variables
265            handleOnResize(); // set and handle responsive    
266
267            //UI Component handlers            
268            //handleAnimate(); // handle animate
269            handleCheckboxRadios() // handle checkbox & radios
270            handleAlerts(); //handle closabled alerts
271            handleDropdowns(); // handle dropdowns
272            handleTooltips(); // handle bootstrap tooltips
273            handlePopovers(); // handles bootstrap popovers
274            handleAccordions(); //handles accordions 
275            handleModals(); // handle modals
276
277            // Hacks
278            handleFixInputPlaceholderForIE(); //IE9 & IE10 input placeholder issue fix
279        },
280
281        changeLogo: function(filename) {
282            var path = '../assets/jango/img/layout/logos/' + filename + '.png';
283            $('.c-brand img.c-desktop-logo').attr('src', path);
284        },
285
286        //public function to remember last opened popover that needs to be closed on click
287        setLastPopedPopover: function(el) {
288            lastPopedPopover = el;
289        },
290
291        //public function to add callback a function which will be called on window resize
292        addResizeHandler: function(func) {
293            resizeHandlers.push(func);
294        },
295
296        //public functon to call _runresizeHandlers
297        runResizeHandlers: function() {
298            _runResizeHandlers();
299        },
300
301        // wrJangoer function to scroll(focus) to an element
302        scrollTo: function(el, offeset) {
303            var pos = (el && el.size() > 0) ? el.offset().top : 0;
304
305            if (el) {
306                if ($('body').hasClass('page-header-fixed')) {
307                    pos = pos - $('.page-header').height();
308                }
309                pos = pos + (offeset ? offeset : -1 * el.height());
310            }
311
312            $('html,body').animate({
313                scrollTop: pos
314            }, 'slow');
315        },
316
317        // function to scroll to the top
318        scrollTop: function() {
319            Jango.scrollTo();
320        },
321
322
323        //public function to initialize the fancybox plugin
324        initFancybox: function() {
325            handleFancybox();
326        },
327
328        //public helper function to get actual input value(used in IE9 and IE8 due to placeholder attribute not supported)
329        getActualVal: function(el) {
330            el = $(el);
331            if (el.val() === el.attr("placeholder")) {
332                return "";
333            }
334            return el.val();
335        },
336
337        //public function to get a paremeter by name from URL
338        getURLParameter: function(paramName) {
339            var searchString = window.location.search.substring(1),
340                i, val, params = searchString.split("&");
341
342            for (i = 0; i < params.length; i++) {
343                val = params[i].split("=");
344                if (val[0] == paramName) {
345                    return unescape(val[1]);
346                }
347            }
348            return null;
349        },
350
351        // check for device touch support
352        isTouchDevice: function() {
353            try {
354                document.createEvent("TouchEvent");
355                return true;
356            } catch (e) {
357                return false;
358            }
359        },
360
361        // To get the correct viewport width based on  http://andylangton.co.uk/articles/javascript/get-viewport-size-javascript/
362        getViewPort: function() {
363            var e = window,
364                a = 'inner';
365            if (!('innerWidth' in window)) {
366                a = 'client';
367                e = document.documentElement || document.body;
368            }
369
370            return {
371                width: e[a + 'Width'],
372                height: e[a + 'Height']
373            };
374        },
375
376        // generate unique ID
377        getUniqueID: function(prefix) {
378            return 'prefix_' + Math.floor(Math.random() * (new Date()).getTime());
379        },
380
381        // check IE9 mode
382        isIE: function() {
383            return isIE;
384        },
385
386        // check IE9 mode
387        isIE9: function() {
388            return isIE9;
389        },
390
391        // check IE9 mode
392        isIE10: function() {
393            return isIE10;
394        },
395
396        // responsive breakpoints
397        getBreakpoint: function(size) {
398            // bootstrap responsive breakpoints
399            var sizes = {
400                'xs': 480, // extra small
401                'sm': 768, // small
402                'md': 992, // medium
403                'lg': 1200 // large
404            };
405
406            return sizes[size] ? sizes[size] : 0;
407        }
408    };
409
410}();

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.