PageSourceSearch

https://www.free-stores24.com/media/js/flatheights.js

js free-stores24.com collected 2026-10-07 14:15:02 UTC 3,558 bytes, 130 lines download raw bytes

1/*
2	jquery.flatheights.js
3	Version: 2007-08-01
4*/
5
6/*
7======================================================================
8	$.changeLetterSize.addHandler(func)
9	文字の大きさが変化した時に実行する処理を追加
10======================================================================
11*/
12
13jQuery.changeLetterSize = {
14	handlers : [],
15	interval : 1000,
16	currentSize: 0
17};
18
19(function($) {
20
21	var self = $.changeLetterSize;
22
23	/* 文字の大きさを確認するためのins要素 */
24	var ins = $('<ins>M</ins>').css({
25		display: 'block',
26		visibility: 'hidden',
27		position: 'absolute',
28		padding: '0',
29		top: '0'
30	});
31
32	/* 文字の大きさが変わったか */
33	var isChanged = function() {
34		ins.appendTo('body');
35		var size = ins[0].offsetHeight;
36		ins.remove();
37		if (self.currentSize == size) return false;
38		self.currentSize = size;
39		return true;
40	};
41
42	/* 文書を読み込んだ時点で
43	   文字の大きさを確認しておく */
44	$(isChanged);
45
46	/* 文字の大きさが変わっていたら、
47	   handlers中の関数を順に実行 */
48	var observer = function() {
49		if (!isChanged()) return;
50		$.each(self.handlers, function(i, handler) {
51			handler();
52		});
53	};
54
55	/* ハンドラを登録し、
56	   最初の登録であれば、定期処理を開始 */
57	self.addHandler = function(func) {
58		self.handlers.push(func);
59		if (self.handlers.length == 1) {
60			setInterval(observer, self.interval);
61		}
62	};
63
64})(jQuery);
65
66/*
67======================================================================
68	$(expr).flatHeights()
69	$(expr)で選択した複数の要素について、それぞれ高さを
70	一番高いものに揃える
71======================================================================
72*/
73
74(function($) {
75
76	/* 対象となる要素群の集合 */
77	var sets = [];
78
79	/* 高さ揃えの処理本体 */
80	var flatHeights = function(set) {
81		var maxHeight = 0;
82		set.each(function(){
83			var height = this.offsetHeight;
84			if (height > maxHeight) maxHeight = height;
85		});
86		set.css('height', maxHeight + 'px');
87	};
88
89	/* 要素群の高さを揃え、setsに追加 */
90	jQuery.fn.flatHeights = function() {
91		if (this.length > 1) {
92			flatHeights(this);
93			sets.push(this);
94		}
95		return this;
96	};
97
98	/* 文字の大きさが変わった時に、
99	   setsに含まれる各要素群に対して高さ揃えを実行 */
100	$.changeLetterSize.addHandler(function() {
101		$.each(sets, function() {
102			this.height('auto');
103			flatHeights(this);
104		});
105	});
106
107})(jQuery);
108
109
110/*
111Copyright (c) 2007, KITAMURA Akatsuki
112
113Permission is hereby granted, free of charge, to any person obtaining a
114copy of this software and associated documentation files (the "Software"),
115to deal in the Software without restriction, including without limitation
116the rights to use, copy, modify, merge, publish, distribute, sublicense,
117and/or sell copies of the Software, and to permit persons to whom the
118Software is furnished to do so, subject to the following conditions:
119
120The above copyright notice and this permission notice shall be included
121in all copies or substantial portions of the Software.
122
123THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
124IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
125FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
126THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
127OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
128ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
129OTHER DEALINGS IN THE SOFTWARE.
130*/

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.