PageSourceSearch

https://kaneshirotrading.com/js/base.js

js kaneshirotrading.com collected 2026-10-06 18:13:08 UTC 19,171 bytes, 468 lines download raw bytes

1$(document).ready(on_ready);
2function on_ready() {
3    $('#search').defaultVal('search here...');
4    $('#comment').defaultVal('your comment here...');
5    $('#message').defaultVal('your message here...');
6
7    enable_smooth_scroll();
8
9    if (typeof sh_highlightDocument == "function") {
10        sh_highlightDocument();
11    }
12
13    if (typeof _gaq !== 'undefined') {
14        _gaq.push(['_trackEvent', 'Browser Dimensions', 'load', 'width', $(window).width()]);
15        _gaq.push(['_trackEvent', 'Browser Dimensions', 'load', 'height', $(window).height()]);
16    }
17
18    $(window).resize(function () {
19        if ($(this).data('gatimer')) {
20            clearTimeout($(this).data('gatimer'));
21            $(this).data('gatimer', null);
22        }
23
24        $(this).data(
25            'gatimer',
26            setTimeout(
27                function () {
28                    if (typeof _gaq !== 'undefined') {
29                        _gaq.push(['_trackEvent', 'Browser Dimensions', 'resize', 'width', $(window).width()]);
30                        _gaq.push(['_trackEvent', 'Browser Dimensions', 'resize', 'height', $(window).height()]);
31                    }
32                },
33                500
34            )
35        );
36    });
37
38    //$(window).bind('scroll', function () {
39    //    if ($(this).scrollTop() > $('#footerCenter').offset().top - $(window).height() - 60) {
40    //        if ($('#earthMoonLink').hasClass('more')) {
41    //            $('#earthMoonLink').removeClass('more').text('earth').attr({href: '#Earth', title: 'Back to Top'});
42    //        }
43    //
44    //    } else {
45    //        if (!$('#earthMoonLink').hasClass('more')) {
46    //            $('#earthMoonLink').addClass('more').text('moon').attr({href: '#Moon', title: 'Jump to Footer'});
47    //        }
48    //    }
49    //});
50}
51
52
53function LOG(msg) {
54    try {
55        if (console) {
56            console.log(msg);
57        }
58
59    } catch(err) {}
60}
61
62
63
64(function ($) {
65    // Monkey patch jQuery 1.3.1+ css() method to support CSS 'transform'
66    // property uniformly across Webkit/Safari/Chrome, Firefox 3.5+, and IE 9+.
67    // 2009-2011 Zachary Johnson www.zachstronaut.com
68    // Updated 2011.05.04 (May the fourth be with you!)
69    function getTransformProperty(element)
70    {
71        // Try transform first for forward compatibility
72        // In some versions of IE9, it is critical for msTransform to be in
73        // this list before MozTranform.
74        var properties = ['transform', 'WebkitTransform', 'msTransform', 'MozTransform', 'OTransform'];
75        var p;
76        while (p = properties.shift())
77        {
78            if (typeof element.style[p] != 'undefined')
79            {
80                return p;
81            }
82        }
83
84        // Default to transform also
85        return 'transform';
86    }
87
88    var _propsObj = null;
89
90    var proxied = $.fn.css;
91    $.fn.css = function (arg, val)
92    {
93        // Temporary solution for current 1.6.x incompatibility, while
94        // preserving 1.3.x compatibility, until I can rewrite using CSS Hooks
95        if (_propsObj === null)
96        {
97            if (typeof $.cssProps != 'undefined')
98            {
99                _propsObj = $.cssProps;
100            }
101            else if (typeof $.props != 'undefined')
102            {
103                _propsObj = $.props;
104            }
105            else
106            {
107                _propsObj = {}
108            }
109        }
110
111        // Find the correct browser specific property and setup the mapping using
112        // $.props which is used internally by jQuery.attr() when setting CSS
113        // properties via either the css(name, value) or css(properties) method.
114        // The problem with doing this once outside of css() method is that you
115        // need a DOM node to find the right CSS property, and there is some risk
116        // that somebody would call the css() method before body has loaded or any
117        // DOM-is-ready events have fired.
118        if
119        (
120            typeof _propsObj['transform'] == 'undefined'
121            &&
122            (
123                arg == 'transform'
124                ||
125                (
126                    typeof arg == 'object'
127                    && typeof arg['transform'] != 'undefined'
128                )
129            )
130        )
131        {
132            _propsObj['transform'] = getTransformProperty(this.get(0));
133        }
134
135        // We force the property mapping here because jQuery.attr() does
136        // property mapping with jQuery.props when setting a CSS property,
137        // but curCSS() does *not* do property mapping when *getting* a
138        // CSS property.  (It probably should since it manually does it
139        // for 'float' now anyway... but that'd require more testing.)
140        //
141        // But, only do the forced mapping if the correct CSS property
142        // is not 'transform' and is something else.
143        if (_propsObj['transform'] != 'transform')
144        {
145            // Call in form of css('transform' ...)
146            if (arg == 'transform')
147            {
148                arg = _propsObj['transform'];
149
150                // User wants to GET the transform CSS, and in jQuery 1.4.3
151                // calls to css() for transforms return a matrix rather than
152                // the actual string specified by the user... avoid that
153                // behavior and return the string by calling jQuery.style()
154                // directly
155                if (typeof val == 'undefined' && jQuery.style)
156                {
157                    return jQuery.style(this.get(0), arg);
158                }
159            }
160
161            // Call in form of css({'transform': ...})
162            else if
163            (
164                typeof arg == 'object'
165                && typeof arg['transform'] != 'undefined'
166            )
167            {
168                arg[_propsObj['transform']] = arg['transform'];
169                delete arg['transform'];
170            }
171        }
172
173        return proxied.apply(this, arguments);
174    };
175})(jQuery);
176
177
178/*!
179/**
180 * Monkey patch jQuery 1.3.1+ to add support for setting or animating CSS
181 * scale and rotation independently.
182 * https://github.com/zachstronaut/jquery-animate-css-rotate-scale
183 * Released under dual MIT/GPL license just like jQuery.
184 * 2009-2012 Zachary Johnson www.zachstronaut.com
185 */
186(function ($) {
187    // Updated 2010.11.06
188    // Updated 2012.10.13 - Firefox 16 transform style returns a matrix rather than a string of transform functions.  This broke the features of this jQuery patch in Firefox 16.  It should be possible to parse the matrix for both scale and rotate (especially when scale is the same for both the X and Y axis), however the matrix does have disadvantages such as using its own units and also 45deg being indistinguishable from 45+360deg.  To get around these issues, this patch tracks internally the scale, rotation, and rotation units for any elements that are .scale()'ed, .rotate()'ed, or animated.  The major consequences of this are that 1. the scaled/rotated element will blow away any other transform rules applied to the same element (such as skew or translate), and 2. the scaled/rotated element is unaware of any preset scale or rotation initally set by page CSS rules.  You will have to explicitly set the starting scale/rotation value.
189
190    function initData($el) {
191        var _ARS_data = $el.data('_ARS_data');
192        if (!_ARS_data) {
193            _ARS_data = {
194                rotateUnits: 'deg',
195                scale: 1,
196                rotate: 0
197            };
198
199            $el.data('_ARS_data', _ARS_data);
200        }
201
202        return _ARS_data;
203    }
204
205    function setTransform($el, data) {
206        $el.css('transform', 'rotate(' + data.rotate + data.rotateUnits + ') scale(' + data.scale + ',' + data.scale + ')');
207    }
208
209    $.fn.rotate = function (val) {
210        var $self = $(this), m, data = initData($self);
211
212        if (typeof val == 'undefined') {
213            return data.rotate + data.rotateUnits;
214        }
215
216        m = val.toString().match(/^(-?\d+(\.\d+)?)(.+)?$/);
217        if (m) {
218            if (m[3]) {
219                data.rotateUnits = m[3];
220            }
221
222            data.rotate = m[1];
223
224            setTransform($self, data);
225        }
226
227        return this;
228    };
229
230    // Note that scale is unitless.
231    $.fn.scale = function (val) {
232        var $self = $(this), data = initData($self);
233
234        if (typeof val == 'undefined') {
235            return data.scale;
236        }
237
238        data.scale = val;
239
240        setTransform($self, data);
241
242        return this;
243    };
244
245    // fx.cur() must be monkey patched because otherwise it would always
246    // return 0 for current rotate and scale values
247    var curProxied = $.fx.prototype.cur;
248    $.fx.prototype.cur = function () {
249        if (this.prop == 'rotate') {
250            return parseFloat($(this.elem).rotate());
251
252        } else if (this.prop == 'scale') {
253            return parseFloat($(this.elem).scale());
254        }
255
256        return curProxied.apply(this, arguments);
257    };
258
259    $.fx.step.rotate = function (fx) {
260        var data = initData($(fx.elem));
261        $(fx.elem).rotate(fx.now + data.rotateUnits);
262    };
263
264    $.fx.step.scale = function (fx) {
265        $(fx.elem).scale(fx.now);
266    };
267
268    /*
269
270    Starting on line 3905 of jquery-1.3.2.js we have this code:
271
272    // We need to compute starting value
273    if ( unit != "px" ) {
274        self.style[ name ] = (end || 1) + unit;
275        start = ((end || 1) / e.cur(true)) * start;
276        self.style[ name ] = start + unit;
277    }
278
279    This creates a problem where we cannot give units to our custom animation
280    because if we do then this code will execute and because self.style[name]
281    does not exist where name is our custom animation's name then e.cur(true)
282    will likely return zero and create a divide by zero bug which will set
283    start to NaN.
284
285    The following monkey patch for animate() gets around this by storing the
286    units used in the rotation definition and then stripping the units off.
287
288    */
289
290    var animateProxied = $.fn.animate;
291    $.fn.animate = function (prop) {
292        if (typeof prop['rotate'] != 'undefined') {
293            var $self, data, m = prop['rotate'].toString().match(/^(([+-]=)?(-?\d+(\.\d+)?))(.+)?$/);
294            if (m && m[5]) {
295                $self = $(this);
296                data = initData($self);
297                data.rotateUnits = m[5];
298            }
299
300            prop['rotate'] = m[1];
301        }
302
303        return animateProxied.apply(this, arguments);
304    };
305})(jQuery);
306
307
308
309// http://www.learningjquery.com/2007/10/improved-animated-scrolling-script-for-same-page-links
310// major changes by Paul Armstrong and Zachary Johnson
311function enable_smooth_scroll() {
312    function filterPath(string) {
313        return string
314                .replace(/^\//,'')
315                .replace(/(index|default).[a-zA-Z]{3,4}$/,'')
316                .replace(/\/$/,'');
317    }
318
319    var locationPath = filterPath(location.pathname);
320
321    var scrollElement = 'html, body';
322    $('html, body').each(function () {
323        var initScrollTop = $(this).attr('scrollTop');
324        $(this).attr('scrollTop', initScrollTop + 1);
325        if ($(this).attr('scrollTop') == initScrollTop + 1) {
326            scrollElement = this.nodeName.toLowerCase();
327            $(this).attr('scrollTop', initScrollTop);
328            return false;
329        }
330    });
331
332    $('a[href*=#]').each(function() {
333        var thisPath = filterPath(this.pathname) || locationPath;
334        if  (   locationPath == thisPath
335                && (location.hostname == this.hostname || !this.hostname)
336                && this.hash.replace(/#/, '')
337            ) {
338                if ($(this.hash).length) {
339                    $(this).click(function(event) {
340                        var targetOffset = $(this.hash).offset().top;
341                        var target = this.hash;
342                        event.preventDefault();
343                        $(scrollElement).animate({scrollTop: targetOffset}, 500, function() {
344                            location.hash = target;
345                        });
346                    });
347                }
348        }
349    });
350}
351
352
353/**
354 * jQuery Default Value Plugin v1.0
355 * Progressive enhancement technique for inital input field values
356 *
357 * The MIT License
358 *
359 * Copyright (c) 2007 Paul Campbell (pauljamescampbell.co.uk)
360 *
361 * Permission is hereby granted, free of charge, to any person obtaining a copy
362 * of this software and associated documentation files (the "Software"), to deal
363 * in the Software without restriction, including without limitation the rights
364 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
365 * copies of the Software, and to permit persons to whom the Software is
366 * furnished to do so, subject to the following conditions:
367 *
368 * The above copyright notice and this permission notice shall be included in
369 * all copies or substantial portions of the Software.
370 *
371 * Improvements by Zachary Johnson 2009
372 */
373(function($) {
374	$.fn.defaultVal = function() {
375		// Scope
376		var elements = this;
377		var args = arguments;
378		var c = 0;
379
380		return (
381            elements.each(function() {
382				var el = $(this);
383				var value = args[c++];
384
385                if (el.val() == '') {
386                    el.val(value);
387                }
388
389				el.focus(function() {
390					if(el.val() == value) {
391						el.val('');
392					}
393
394					el.blur(function() {
395    					if(el.val() == '') {
396    						el.val(value);
397    					}
398    				});
399				});
400			})
401    	);
402    };
403})(jQuery);
404
405
406/*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
407 * Licensed under the MIT License (LICENSE.txt).
408 */
409(function($) {
410    // backgroundPosition[X,Y] get hooks
411    var $div = $('<div style="background-position: 3px 5px">');
412    $.support.backgroundPosition   = $div.css('backgroundPosition')  === "3px 5px" ? true : false;
413    $.support.backgroundPositionXY = $div.css('backgroundPositionX') === "3px" ? true : false;
414    $div = null;
415
416    var xy = ["X","Y"];
417
418    // helper function to parse out the X and Y values from backgroundPosition
419    function parseBgPos(bgPos) {
420        var parts  = bgPos.split(/\s/),
421            values = {
422                "X": parts[0],
423                "Y": parts[1]
424            };
425        return values;
426    }
427
428    if (!$.support.backgroundPosition && $.support.backgroundPositionXY) {
429        $.cssHooks.backgroundPosition = {
430            get: function( elem, computed, extra ) {
431                return $.map(xy, function( l, i ) {
432                    return $.css(elem, "backgroundPosition" + l);
433                }).join(" ");
434            },
435            set: function( elem, value ) {
436                $.each(xy, function( i, l ) {
437                    var values = parseBgPos(value);
438                    elem.style[ "backgroundPosition" + l ] = values[ l ];
439                });
440            }
441        };
442    }
443
444    if ($.support.backgroundPosition && !$.support.backgroundPositionXY) {
445        $.each(xy, function( i, l ) {
446            $.cssHooks[ "backgroundPosition" + l ] = {
447                get: function( elem, computed, extra ) {
448                    var values = parseBgPos( $.css(elem, "backgroundPosition") );
449                    return values[ l ];
450                },
451                set: function( elem, value ) {
452                    var values = parseBgPos( $.css(elem, "backgroundPosition") ),
453                        isX = l === "X";
454                    elem.style.backgroundPosition = (isX ? value : values[ "X" ]) + " " +
455                                                    (isX ? values[ "Y" ] : value);
456                }
457            };
458            $.fx.step[ "backgroundPosition" + l ] = function( fx ) {
459                $.cssHooks[ "backgroundPosition" + l ].set( fx.elem, fx.now + fx.unit );
460            };
461        });
462    }
463})(jQuery);
464
465
466/* http://jquery.thewikies.com/swfobject/ */
467/* jquery.swfobject.license.txt */
468(function(A){A.flashPlayerVersion=function(){var D,B=null,I=false,H="ShockwaveFlash.ShockwaveFlash";if(!(D=navigator.plugins["Shockwave Flash"])){try{B=new ActiveXObject(H+".7")}catch(G){try{B=new ActiveXObject(H+".6");D=[6,0,21];B.AllowScriptAccess="always"}catch(F){if(D&&D[0]===6){I=true}}if(!I){try{B=new ActiveXObject(H)}catch(E){D="X 0,0,0"}}}if(!I&&B){try{D=B.GetVariable("$version")}catch(C){}}}else{D=D.description}D=D.match(/^[A-Za-z\s]*?(\d+)(\.|,)(\d+)(\s+r|,)(\d+)/);return[D[1]*1,D[3]*1,D[5]*1]}();A.flashExpressInstaller="expressInstall.swf";A.hasFlashPlayer=(A.flashPlayerVersion[0]!==0);A.hasFlashPlayerVersion=function(C){var B=A.flashPlayerVersion;C=(/string|integer/.test(typeof C))?C.toString().split("."):C;return(C)?(B[0]>=(C.major||C[0]||B[0])&&B[1]>=(C.minor||C[1]||B[1])&&B[2]>=(C.release||C[2]||B[2])):(B[0]!==0)};A.flash=function(M){if(!A.hasFlashPlayer){return false}var C=M.swf||"",K=M.params||{},E=document.createElement("body"),B,L,H,D,J,I,G,F;M.height=M.height||180;M.width=M.width||320;if(M.hasVersion&&!A.hasFlashPlayerVersion(M.hasVersion)){A.extend(M,{id:"SWFObjectExprInst",height:Math.max(M.height,137),width:Math.max(M.width,214)});C=M.expressInstaller||A.flashExpressInstaller;K={flashvars:{MMredirectURL:window.location.href,MMplayerType:(A.browser.msie&&A.browser.win)?"ActiveX":"PlugIn",MMdoctitle:document.title.slice(0,47)+" - Flash Player Installation"}}}if(M.flashvars&&typeof K==="object"){A.extend(K,{flashvars:M.flashvars})}for(J in (I=["swf","expressInstall","hasVersion","params","flashvars"])){delete M[I[J]]}B=[];for(J in M){if(typeof M[J]==="object"){L=[];for(I in M[J]){L.push(I.replace(/([A-Z])/,"-$1").toLowerCase()+":"+M[J][I]+";")}M[J]=L.join("")}B.push(J+'="'+M[J]+'"')}M=B.join(" ");if(typeof K==="object"){B=[];for(J in K){if(typeof K[J]==="object"){L=[];for(I in K[J]){if(typeof K[J][I]==="object"){H=[];for(G in K[J][I]){if(typeof K[J][I][G]==="object"){D=[];for(F in K[J][I][G]){D.push(F.replace(/([A-Z])/,"-$1").toLowerCase()+":"+K[J][I][G][F]+";")}K[J][I][G]=D.join("")}H.push(G+"{"+K[J][I][G]+"}")}K[J][I]=H.join("")}L.push(window.escape(I)+"="+window.escape(K[J][I]))}K[J]=L.join("&amp;")}B.push('<PARAM NAME="'+J+'" VALUE="'+K[J]+'">')}K=B.join("")}if(!(/style=/.test(M))){M+=' style="vertical-align:text-top;"'}if(!(/style=(.*?)vertical-align/.test(M))){M=M.replace(/style="/,'style="vertical-align:text-top;')}if(A.browser.msie){M+=' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';K='<PARAM NAME="movie" VALUE="'+C+'">'+K}else{M+=' type="application/x-shockwave-flash" data="'+C+'"'}E.innerHTML="<OBJECT "+M+">"+K+"</OBJECT>";return A(E.firstChild)};A.fn.flash=function(C){if(!A.hasFlashPlayer){return this}var B=0,D;while((D=this.eq(B++))[0]){D.html(A.flash(A.extend({},C)));if(D[0].firstChild.getAttribute("id")==="SWFObjectExprInst"){B=this.length}}return this}}(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.