PageSourceSearch

https://www.cisi.org/cisiweb2/js/common/bootstrap-tabdrop.js?v=636802949420000000

js cisi.org collected 2026-10-01 12:09:20 UTC 3,283 bytes, 117 lines download raw bytes

1/* =========================================================
2 * bootstrap-tabdrop.js 
3 * http://www.eyecon.ro/bootstrap-tabdrop
4 * =========================================================
5 * Copyright 2012 Stefan Petre
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ========================================================= */
19 
20!function( $ ) {
21
22	var WinReszier = (function(){
23		var registered = [];
24		var inited = false;
25		var timer;
26		var resize = function(ev) {
27			clearTimeout(timer);
28			timer = setTimeout(notify, 100);
29		};
30		var notify = function() {
31			for(var i=0, cnt=registered.length; i<cnt; i++) {
32				registered[i].apply();
33			}
34		};
35		return {
36			register: function(fn) {
37				registered.push(fn);
38				if (inited === false) {
39					$(window).bind('resize', resize);
40					inited = true;
41				}
42			},
43			unregister: function(fn) {
44				for(var i=0, cnt=registered.length; i<cnt; i++) {
45					if (registered[i] == fn) {
46						delete registered[i];
47						break;
48					}
49				}
50			}
51		}
52	}());
53
54	var TabDrop = function(element, options) {
55		this.element = $(element);
56		this.dropdown = $('<li class="dropdown hide pull-right tabdrop"><a class="dropdown-toggle" data-toggle="dropdown" href="#">'+options.text+' <b class="caret"></b></a><ul class="dropdown-menu"></ul></li>')
57							.prependTo(this.element);
58		if (this.element.parent().is('.tabs-below')) {
59			this.dropdown.addClass('dropup');
60		}
61		WinReszier.register($.proxy(this.layout, this));
62		this.layout();
63	};
64
65	TabDrop.prototype = {
66		constructor: TabDrop,
67
68		layout: function() {
69			var collection = [];
70			this.dropdown.removeClass('hide');
71			this.element
72				.append(this.dropdown.find('li'))
73				.find('>li')
74				.not('.tabdrop')
75				.each(function(){
76					if(this.offsetTop > 0) {
77						collection.push(this);
78					}
79				});
80			if (collection.length > 0) {
81				collection = $(collection);
82				this.dropdown
83					.find('ul')
84					.empty()
85					.append(collection);
86				if (this.dropdown.find('.active').length == 1) {
87					this.dropdown.addClass('active');
88				} else {
89					this.dropdown.removeClass('active');
90				}
91			} else {
92				this.dropdown.addClass('hide');
93			}
94		}
95	}
96
97	$.fn.tabdrop = function ( option ) {
98		return this.each(function () {
99			var $this = $(this),
100				data = $this.data('tabdrop'),
101				options = typeof option === 'object' && option;
102			if (!data)  {
103				$this.data('tabdrop', (data = new TabDrop(this, $.extend({}, $.fn.tabdrop.defaults,options))));
104			}
105			if (typeof option == 'string') {
106				data[option]();
107			}
108		})
109	};
110
111	$.fn.tabdrop.defaults = {
112		text: '<i class="icon-align-justify"></i>'
113	};
114
115	$.fn.tabdrop.Constructor = TabDrop;
116
117}( window.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.