PageSourceSearch

https://www.kyoceradocumentsolutions.com/support_product/js/common.js

js kyoceradocumentsolutions.com collected 2026-10-01 10:40:53 UTC 3,942 bytes, 123 lines download raw bytes

1// 名前空間パターン TYD_GDS_COMMON
2
3var TYD_GDC_COMMON = TYD_GDC_COMMON || {};
4
5(function(ns, $) {
6    'use strict';
7
8    // ------------------------------------------------------------
9    // 共通関数
10    // ------------------------------------------------------------
11
12    // 正規表現のエスケープ
13    function regExpEscape (str) {
14        return str.replace(/[-\/\\^$*+?.()|\[\]{}]/g, '\\$&');
15    };
16    // ダブルクォーテーションのエスケープ
17    function dqEscape (str) {
18        return str.replace(/"/g, '\$&');
19    }
20
21    // Query Stringのパラメータを取得する
22    function getParam(name, url) {
23        if (!url) url = window.location.href;
24        name = name.replace(/[\[\]]/g, "\\$&");
25        var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
26            results = regex.exec(url);
27        if (!results) return null;
28        if (!results[2]) return '';
29        return decodeURIComponent(results[2].replace(/\+/g, " "));
30    }
31
32    // date: 日付オブジェクト
33    // format: 書式フォーマット
34    function formatDate (date, format) {
35        format = format.replace(/yyyy/g, date.getFullYear());
36        format = format.replace(/MM/g, ('0' + (date.getMonth() + 1)).slice(-2));
37        format = format.replace(/dd/g, ('0' + date.getDate()).slice(-2));
38        format = format.replace(/HH/g, ('0' + date.getHours()).slice(-2));
39        format = format.replace(/mm/g, ('0' + date.getMinutes()).slice(-2));
40        format = format.replace(/ss/g, ('0' + date.getSeconds()).slice(-2));
41        format = format.replace(/SSS/g, ('00' + date.getMilliseconds()).slice(-3));
42        return format;
43    };
44
45    function getLang() {
46        var lang = window.location.href.match(/_([^/]*)\.html/)[1];
47        return lang;
48    }
49
50    function formatSize (size, decimal) {
51        //function formatSize (size, decimal = 2) { // IE用に改修
52        //const { target, unit } = getTarget(size);
53        const tmp = getTarget(size);
54        const target = tmp.target;
55        const unit = tmp.unit;
56        const d = Math.pow(10, decimal);
57
58        const newSize = target !== null ? Math.floor((size / target) * d) / d : size;
59
60        return newSize + unit;
61    }
62
63    function getTarget (size) {
64        const kb = 1024
65        const mb = Math.pow(kb, 2)
66        const gb = Math.pow(kb, 3)
67        const tb = Math.pow(kb, 4)
68
69        if (size >= tb) return { target: tb, unit: 'TB' }
70        if (size >= gb) return { target: gb, unit: 'GB' }
71        if (size >= mb) return { target: mb, unit: 'MB' }
72        if (size >= kb) return { target: kb, unit: 'KB' }
73
74        return { target: null, unit: 'byte' }
75    }
76
77    function getFileName() {
78        return window.location.href.match(".+/(.+?)([\?#;].*)?$")[1];
79    }
80
81    // ------------------------------------------------------------
82    // 名前空間 TYD_CHROME_OS の変数・関数 (外部から利用しないが)
83    // ------------------------------------------------------------
84
85    ns.regExpEscape = function (str) {
86        return regExpEscape(str);
87    };
88
89    ns.dqEscape = function (str) {
90        return dqEscape(str);
91    };
92
93    ns.getParam = function (name, url) {
94        return getParam(name, url);
95    };
96
97    ns.formatDate = function (date, format) {
98        return formatDate(date, format);
99    };
100
101    ns.formatSize = function (size, decimal) {
102    //ns.formatSize = function (size, decimal = 2) {    // IE用に改修
103        return formatSize(size, decimal);
104    }
105
106    ns.getLang = function () {
107        return getLang();
108    }
109
110    ns.getFileName = function () {
111        return getFileName();
112    }
113    ns.regionId;
114
115    $(document).on('change', '#select-lang', function(){
116        var lang = $(this).val();
117        var url = 'index_' + lang + '.html' + '?r=' + ns.regionId;
118        console.log(url);
119        location.href = url;
120        return true;
121    });
122
123})(TYD_GDC_COMMON, 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.