PageSourceSearch

https://www.npmshops.com/mainssl/uploads/shop/js/us_lmFontSizeCtrl.js?jsvMsgXmlID=39716&r=065748

js npmshops.com collected 2026-10-03 22:58:32 UTC 3,815 bytes, 115 lines download raw bytes

1var us_lmFontSizeCtrl_ = mx => {
2    // 主控制程式
3    
4    var variableNames = window["VarNames_" + mx];
5    var smlRate = parseFloat(window["SmallFRate_" + mx]);
6    var bigRate = parseFloat(window["BigFRate_" + mx]);
7    var fontUnit = window["FontUnit_" + mx];
8
9    variableNames = variableNames.includes(',') ? variableNames.split(',') : variableNames;
10
11    new lmFontCtrl(variableNames, fontUnit, smlRate, bigRate);
12
13}
14
15
16class lmFontCtrl {
17    constructor(fontSizeVariableNames, fontSizeUnit, smallRate, BigRate){
18        this.fontCtrl = {
19            sml: smallRate,
20            mid: 1,
21            big: BigRate
22        };
23        this.fontSizeUnit = fontSizeUnit;
24        this.saveData = {};
25        this.saveDisplay = "";
26        this.variableNames = fontSizeVariableNames;
27        this.animationTargets = [
28            "fixedFontCtrl",
29            "fontBtnContainer",
30            "putAwayBtn"
31        ]
32        this.init();
33    }
34
35    init(){
36        this.initEvent();
37    }
38			
39    initEvent(){
40        $('.fontBox').off().on('click', this.ctrlSize.bind(this));
41        $('.putAwayBtn').off().on('click',this.callBtns.bind(this));
42        this.getSavedSelect();
43        this.getSavedDisplay();
44    }
45
46    ctrlSize(e) {
47        let em = e.currentTarget;
48        let selectSize = $(em).attr('data-val');
49    
50        this.changeFontSize(selectSize);
51    }
52
53    getSavedSelect() {
54        var data = sessionStorage.getItem("fontSize");
55        if(data != "null" && data != null) {
56            this.changeFontSize(data);
57        }
58    }
59
60    getSavedDisplay() {
61        var displayPattern = sessionStorage.getItem("fontSizeDisplay");
62        if (displayPattern === "1" ) {
63            this.callBtns();
64        } else if (displayPattern === "0") {
65        } else if (displayPattern === null || displayPattern === "null") {
66			   if (window.innerWidth > 768) {
67					  this.callBtns();
68			   }        
69        }
70    }
71
72    changeFontSize(value) {
73        let element = document.documentElement;
74        for (let variable of this.variableNames) {
75            if (!this.saveData[variable]) {
76                let currentFontSize = getComputedStyle(element).getPropertyValue(variable).trim();
77                currentFontSize = parseFloat(currentFontSize.split(`${this.fontSizeUnit}`)[0]);
78                this.saveData[variable] = currentFontSize;
79            }
80
81            let newSize = this.saveData[variable] * this.fontCtrl[value];
82
83            sessionStorage.setItem("fontSize", value);
84            
85            // element.style.setProperty(variable, `${newSize}${this.fontSizeUnit}`);
86
87            // 修復在safari中,修改CSS變數會有延遲的問題
88            requestAnimationFrame(() => {
89                element.style.setProperty(variable, `${newSize}${this.fontSizeUnit}`);
90            });
91        }
92    }
93
94    putAwayBtns() {
95        for(let target of this.animationTargets) {
96            $(`.${target}`).addClass('right');
97            $(`.${target}`).removeClass('left');
98            $(`.${target}`).removeClass('default');
99				$(`.${target}`).attr("aria-label","文字大小選擇 目前關閉")
100        }
101        $('.putAwayBtn').off().on('click',this.callBtns.bind(this));
102        sessionStorage.setItem("fontSizeDisplay", "0");
103    }
104
105    callBtns() {
106        for(let target of this.animationTargets) {
107            $(`.${target}`).addClass('left');
108            $(`.${target}`).removeClass('right');
109            $(`.${target}`).removeClass('default');
110				$(`.${target}`).attr("aria-label","文字大小選擇 目前開啟")
111        }
112        $('.putAwayBtn').off().on('click',this.putAwayBtns.bind(this));
113        sessionStorage.setItem("fontSizeDisplay", "1");
114    }
115}

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.