PageSourceSearch

https://furukawayutaka.com/files/15/a010/js/commons.js

js furukawayutaka.com collected 2026-10-02 19:09:40 UTC 1,891 bytes, 66 lines download raw bytes

1var MAIN = MAIN || {},$window;
2
3//改行コード変換
4var nl2br = function(str){
5	return str.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1<br>$2');
6}
7
8//金額カンマセパレート
9function separatePrice(num){
10    return String(num).replace( /(\d)(?=(\d\d\d)+(?!\d))/g, '$1,');
11}
12
13//Base
14$(document).ready(function () {
15	//MAIN
16     MAIN = function () {        
17        this.$scrollTarget = (function () {
18            var html = $('html'), top = html.scrollTop(),
19                elm = $('<div/>').height(10000).prependTo('body'),
20                rs = null;
21            html.scrollTop(10000);
22            rs = !!html.scrollTop();
23            html.scrollTop(top);
24            elm.remove();
25            return $(rs ? 'html' : 'body');
26        })();
27    };
28
29    MAIN.prototype.scrollToTarget = function (target, ease, dur) {
30        var easing = (ease === undefined) ? 'easeOutQuart' : ease,
31            duration = (dur === undefined) ? 1000 : dur,
32            $target = target,
33            pos = $target.offset().top;
34        this.$scrollTarget.stop(true).animate({scrollTop: pos}, duration, easing, function () {
35	        window.location.hash = $target.attr('id');
36        });
37    };
38    
39    MAIN.prototype.getJSON = function (url, callback) {
40		$.ajax({
41	    	"timeout": 10000,
42			type: 'GET',
43			url: url,
44			dataType: 'jsonp',
45			jsonpCallback: 'callback',
46			success: callback
47		});
48	}
49	
50	//Init
51    function init() {
52        $window = $(window);
53        MAIN = new MAIN();
54        $(document).on('click', 'a[href^="#"]', function (e) {
55            e.preventDefault();
56            MAIN.scrollToTarget($($(this).attr('href')), 'easeOutQuart', 500);
57        });
58        
59		$('img.hover').hover(function () {
60			$(this).attr('src', $(this).attr('src').replace('.', '_on.'));
61		},function () {
62			$(this).attr('src', $(this).attr('src').replace('_on.', '.'));
63		});
64    }
65    init();
66});

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.