PageSourceSearch

https://www.yomiuri.co.jp/yomidr/wp-content/themes/yomidr/resources/js/fontSize.js

js yomiuri.co.jp collected 2026-09-24 07:59:53 UTC 1,561 bytes, 70 lines download raw bytes

1(function($){
2	
3	$(function(){
4		fontSizeChange();
5	});
6
7	function fontSizeChange(){
8
9		var target = $("html"); // フォントサイズを変更する要素
10		var fontSize = new Array();
11		fontSize = [16, 22];
12
13		var controller = $(".set-font-size li"); // フォントサイズ変更ボタン
14		var activeClass = "active"; // アクティブなボタンに付加するクラス名
15		var defaultSize = 0; // 初期フォントサイズ 0 or 1
16		var cookieExpires = 7; 
17		var number = fontSize.length;
18
19		// クッキーを設定
20		function cookieSet(index){
21			$.cookie("fontsize", fontSize[index], {path:'/', expires:cookieExpires});
22		}
23
24		// 現在のフォントサイズを取得
25		function nowCookie(){
26			return $.cookie("fontsize");
27		}
28
29		// フォントサイズを設定
30		function sizeChange(){
31			target.css({fontSize:nowCookie()+"px"});
32		}
33
34		// 初期表示
35		if( nowCookie() ){
36
37			for( var i=0; i < number; i++ ){
38
39				if( nowCookie() == fontSize[i] ){
40					sizeChange();
41					var elm = controller.eq(i);
42					elm.addClass(activeClass);
43					break;
44				}
45
46			}
47
48		} else {
49			cookieSet(defaultSize);
50			sizeChange();
51			var elm = controller.eq(defaultSize);
52			elm.addClass(activeClass);
53		}
54
55		// クリックイベント
56		controller.click(function(){
57			var index = controller.index(this);
58			var self = $(this);
59			cookieSet(index);
60			sizeChange();
61			if( ! self.hasClass(activeClass) ){
62				controller.not(this).removeClass(activeClass);
63				self.addClass(activeClass);
64			}
65			// autoheight
66			$.fn.autoHeight();
67		});
68	}
69
70})(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.