PageSourceSearch

https://www.kazki.co.jp/assets/js/jquery.fontsizechange.js

js kazki.co.jp collected 2026-10-05 02:22:44 UTC 2,917 bytes, 126 lines download raw bytes

1(function($){
2
3  $(function(){
4    fontsizeChange();
5    var timer = false;
6    $(window).resize(function() {
7      if (timer !== false) {
8        clearTimeout(timer);
9      }
10      timer = setTimeout(function() {
11        if ($(window).width() <= 768) {
12          var sp = true;
13          fontsizeChange(sp);
14        } else {
15          fontsizeChange();
16        }
17      }, 0);
18    });
19  });
20
21
22  function fontsizeChange(sp){
23
24    var changeArea = $("html");
25    var btnArea = $("#fontSize");
26    var changeBtn = btnArea.find(".changeBtn");
27    var fontSize = [72.5,62.5,52.5];
28    var ovStr = "_ov";
29    var activeClass = "active";
30    var defaultSize = 1;
31    var cookieExpires = 7;
32    var sizeLen = fontSize.length;
33    var useImg = ovStr!="" && changeBtn.is("[src]");
34
35    //現在クッキー確認関数
36    function nowCookie(){
37      return $.cookie("fontsize");
38    }
39
40    //画像切替関数
41    function imgChange(elm1,elm2,str1,str2){
42      elm1.attr("src",elm2.attr("src").replace(new RegExp("^(\.+)"+str1+"(\\.[a-z]+)$"),"$1"+str2+"$2"));
43    }
44
45    //マウスアウト関数
46    function mouseOut(){
47      for(var i=0; i<sizeLen; i++){
48        if(nowCookie()!=fontSize[i]){
49          imgChange(changeBtn.eq(i),changeBtn.eq(i),ovStr,"");
50        }
51      }
52    }
53
54    //フォントサイズ設定関数
55    function sizeChange(){
56      changeArea.css({fontSize:nowCookie()+"%"});
57    }
58
59    //クッキー設定関数
60    function cookieSet(index){
61      $.cookie("fontsize",fontSize[index],{path:'/',expires:cookieExpires});
62    }
63
64    //初期表示
65    if(nowCookie()){
66      for(var i=0; i<sizeLen; i++){
67        if(nowCookie()==fontSize[i]){
68          sizeChange();
69          var elm = changeBtn.eq(i);
70          if(useImg){
71            imgChange(elm,elm,"",ovStr);
72          }
73          elm.addClass(activeClass);
74          break;
75        }
76      }
77    }
78    else {
79      cookieSet(defaultSize);
80      sizeChange();
81      var elm = changeBtn.eq(defaultSize);
82      if(useImg){
83        imgChange(elm,elm,"",ovStr);
84        imgChange($("<img>"),elm,"",ovStr);
85      }
86      elm.addClass(activeClass);
87    }
88
89    //ホバーイベント(画像タイプ)
90    if(useImg){
91      changeBtn.each(function(i){
92        var self = $(this);
93        self.hover(
94        function(){
95          if(nowCookie()!=fontSize[i]){
96            imgChange(self,self,"",ovStr);
97          }
98        },
99        function(){
100          mouseOut();
101        });
102      });
103    }
104
105    //クリックイベント
106    changeBtn.click(function(){
107      var index = changeBtn.index(this);
108      var self = $(this);
109      cookieSet(index);
110      sizeChange();
111      if(useImg){
112        mouseOut();
113      }
114      if(!self.hasClass(activeClass)){
115        changeBtn.not(this).removeClass(activeClass);
116        self.addClass(activeClass);
117      }
118    });
119
120    if(sp == true){
121      changeArea.css({fontSize:""});
122    }
123
124  }
125
126})(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.