1/****************************************************** 2 ** File Name : medica.js powered by yuga.js 3 ** Creater : miura@MMP 4 ** Summary : custom yuga.js 5 ** Modified : 2008.07.29 6/ ***************************************************** 7/* 8 * yuga.js 0.7.1 - åªé ãªWebå¶ä½ã®ããã®JS 9 * 10 * Copyright (c) 2009 Kyosuke Nakamura (kyosuke.jp) 11 * Licensed under the MIT License: 12 * http://www.opensource.org/licenses/mit-license.php 13 * 14 * Since: 2006-10-30 15 * Modified: 2009-01-27 16 * 17 * jQuery 1.3.1 18 * ThickBox 3.1 19 */ 20 21 22(function($) { 23 24 $(function() { 25 $.yuga.selflink(); 26 $.yuga.rollover(); 27 $.yuga.externalLink(); 28 $.yuga.scroll(); 29 }); 30 31 //--------------------------------------------------------------------- 32 33 $.yuga = { 34 // URIãè§£æãããªãã¸ã§ã¯ããè¿ãfunction 35 Uri: function(path){ 36 var self = this; 37 this.originalPath = path; 38 //絶対ãã¹ãåå¾ 39 this.absolutePath = (function(){ 40 var e = document.createElement('span'); 41 e.innerHTML = '<a href="' + path + '" />'; 42 return e.firstChild.href; 43 })(); 44 //絶対ãã¹ãåè§£ 45 var fields = {'schema' : 2, 'username' : 5, 'password' : 6, 'host' : 7, 'path' : 9, 'query' : 10, 'fragment' : 11}; 46 var r = /^((\w+):)?(\/\/)?((\w+):?(\w+)?@)?([^\/\?:]+):?(\d+)?(\/?[^\?#]+)?\??([^#]+)?#?(\w*)/.exec(this.absolutePath); 47 for (var field in fields) { 48 this[field] = r[fields[field]]; 49 } 50 this.querys = {}; 51 if(this.query){ 52 $.each(self.query.split('&'), function(){ 53 var a = this.split('='); 54 if (a.length == 2) self.querys[a[0]] = a[1]; 55 }); 56 } 57 }, 58 //ç¾å¨ã®ãã¼ã¸ã¨è¦ªãã£ã¬ã¯ããªã¸ã®ãªã³ã¯ 59 selflink: function (options) { 60 var c = $.extend({ 61 selfLinkAreaSelector:'body', 62 selfLinkClass:'current', 63 parentsLinkClass:'parentsLink', 64 postfix: '_cr', 65 changeImgSelf:true, 66 changeImgParents:true 67 }, options); 68 $(c.selfLinkAreaSelector+((c.selfLinkAreaSelector)?' ':'')+'a[href]').each(function(){ 69 var href = new $.yuga.Uri(this.getAttribute('href')); 70 var setImgFlg = false; 71 if ((href.absolutePath == location.href) && !href.fragment) { 72 //åãææ¸ã«ãªã³ã¯ 73 $(this).addClass(c.selfLinkClass); 74 setImgFlg = c.changeImgSelf; 75 } else if (0 <= location.href.search(href.absolutePath)) { 76 //親ãã£ã¬ã¯ããªãªã³ã¯ 77 $(this).addClass(c.parentsLinkClass); 78 setImgFlg = c.changeImgParents; 79 } 80 if (setImgFlg){ 81 //imgè¦ç´ ãå«ã¾ãã¦ãããç¾å¨ç¨ç»åï¼_crï¼ã«è¨å® 82 $(this).find('img').each(function(){ 83 this.originalSrc = $(this).attr('src'); 84 this.current_Src = this.originalSrc.replace(new RegExp('('+c.postfix+')?(\.gif|\.jpg|\.png)$'), c.postfix+"$2"); 85 $(this).attr('src',this.current_Src); 86 }); 87 } 88 }); 89 }, 90 //ãã¼ã«ãªã¼ãã¼ 91 rollover: function(options) { 92 var c = $.extend({ 93 hoverSelector: '.over, .allbtn img', 94 groupSelector: '.btngroup', 95 postfix: '_a' 96 }, options); 97 //ãã¼ã«ãªã¼ãã¼ãããã¼ãã®åæå 98 var rolloverImgs = $(c.hoverSelector).filter(isNotCurrent); 99 rolloverImgs.each(function(){ 100 this.originalSrc = $(this).attr('src'); 101 this.rolloverSrc = this.originalSrc.replace(new RegExp('('+c.postfix+')?(\.gif|\.jpg|\.png)$'), c.postfix+"$2"); 102 this.rolloverImg = new Image; 103 this.rolloverImg.src = this.rolloverSrc; 104 }); 105 //ã°ã«ã¼ãå ã®imgè¦ç´ ãæå®ããã»ã¬ã¯ã¿çæ 106 var groupingImgs = $(c.groupSelector).find('img').filter(isRolloverImg); 107 108 //é常ãã¼ã«ãªã¼ãã¼ 109 rolloverImgs.not(groupingImgs).hover(function(){ 110 $(this).attr('src',this.rolloverSrc); 111 },function(){ 112 $(this).attr('src',this.originalSrc); 113 }); 114 //ã°ã«ã¼ãåããããã¼ã«ãªã¼ãã¼ 115 $(c.groupSelector).hover(function(){ 116 $(this).find('img').filter(isRolloverImg).each(function(){ 117 $(this).attr('src',this.rolloverSrc); 118 }); 119 },function(){ 120 $(this).find('img').filter(isRolloverImg).each(function(){ 121 $(this).attr('src',this.originalSrc); 122 }); 123 }); 124 //ãã£ã«ã¿ç¨function 125 function isNotCurrent(i){ 126 return Boolean(!this.current_Src); 127 } 128 function isRolloverImg(i){ 129 return Boolean(this.rolloverSrc); 130 } 131 132 }, 133 //å¤é¨ãªã³ã¯ã¯å¥ã¦ã¤ã³ãã¦ãè¨å® 134 externalLink: function(options) { 135 var c = $.extend({ 136 windowOpen:true, 137 externalClass: 'externalLink', 138 addIconSrc: '' 139 }, options); 140 var uri = new $.yuga.Uri(location.href); 141 var e = $('a[href^="http://"]').not('a[href^="' + uri.schema + '://' + uri.host + '/' + '"]'); 142 if (c.windowOpen) { 143 e.click(function(){ 144 window.open(this.href, '_blank'); 145 return false;
146 }); 147 } 148 if (c.addIconSrc) e.not(':has(img)').after($('<img src="'+c.addIconSrc+'" class="externalIcon" />')); 149 e.addClass(c.externalClass); 150 }, 151 //ç»åã¸ç´ãªã³ã¯ããã¨thickboxã§è¡¨ç¤º(thickbox.jså©ç¨) 152 thickbox: function() { 153 try { 154 tb_init('a[href$=".jpg"]:not(.thickbox, a[href*="?"]), a[href$=".gif"][href!="?"]:not(.thickbox, a[href*="?"]), a[href$=".png"][href!="?"]:not(.thickbox, a[href*="?"])'); 155 } catch(e) { 156 } 157 }, 158 //ãã¼ã¸å ãªã³ã¯ã¯ããããã¹ã¯ãã¼ã« 159 scroll: function(options) { 160 //ããã¥ã¡ã³ãã®ã¹ã¯ãã¼ã«ãå¶å¾¡ãããªãã¸ã§ã¯ã 161 var scroller = (function() { 162 var c = $.extend({ 163 easing:100, 164 step:30, 165 fps:60, 166 fragment:'' 167 }, options); 168 c.ms = Math.floor(1000/c.fps); 169 var timerId; 170 var param = { 171 stepCount:0, 172 startY:0, 173 endY:0, 174 lastY:0 175 }; 176 //ã¹ã¯ãã¼ã«ä¸ã«å®è¡ãããfunction 177 function move() { 178 if (param.stepCount == c.step) { 179 //ã¹ã¯ãã¼ã«çµäºæ 180 setFragment(param.hrefdata.absolutePath); 181 window.scrollTo(getCurrentX(), param.endY); 182 } else if (param.lastY == getCurrentY()) { 183 //é常ã¹ã¯ãã¼ã«æ 184 param.stepCount++; 185 window.scrollTo(getCurrentX(), getEasingY()); 186 param.lastY = getEasingY(); 187 timerId = setTimeout(move, c.ms); 188 } else { 189 //ãã£ã³ã»ã«çºç 190 if (getCurrentY()+getViewportHeight() == getDocumentHeight()) { 191 //ç»é¢ä¸ã®ããã¹ã¯ãã¼ã«çµäº 192 setFragment(param.hrefdata.absolutePath); 193 } 194 } 195 } 196 function setFragment(path){ 197 location.href = path 198 } 199 function getCurrentY() { 200 return document.body.scrollTop || document.documentElement.scrollTop; 201 } 202 function getCurrentX() { 203 return document.body.scrollLeft || document.documentElement.scrollLeft; 204 } 205 function getDocumentHeight(){ 206 return document.documentElement.scrollHeight || document.body.scrollHeight; 207 } 208 function getViewportHeight(){ 209 return (!$.browser.safari && !$.browser.opera) ? document.documentElement.clientHeight || document.body.clientHeight || document.body.scrollHeight : window.innerHeight; 210 } 211 function getEasingY() { 212 return Math.floor(getEasing(param.startY, param.endY, param.stepCount, c.step, c.easing)); 213 } 214 function getEasing(start, end, stepCount, step, easing) { 215 var s = stepCount / step; 216 return (end - start) * (s + easing / (100 * Math.PI) * Math.sin(Math.PI * s)) + start; 217 } 218 return { 219 set: function(options) { 220 this.stop(); 221 if (options.startY == undefined) options.startY = getCurrentY(); 222 param = $.extend(param, options); 223 param.lastY = param.startY; 224 timerId = setTimeout(move, c.ms); 225 }, 226 stop: function(){ 227 clearTimeout(timerId); 228 param.stepCount = 0; 229 } 230 }; 231 })(); 232 $('a[href^=#], area[href^=#]').not('a[href=#], area[href=#]').each(function(){ 233 this.hrefdata = new $.yuga.Uri(this.getAttribute('href')); 234 }).click(function(){ 235 var target = $('#'+this.hrefdata.fragment); 236 if (target.length == 0) target = $('a[name='+this.hrefdata.fragment+']'); 237 if (target.length) { 238 scroller.set({ 239 endY: target.offset().top, 240 hrefdata: this.hrefdata 241 }); 242 return false; 243 } 244 }); 245 } 246 }; 247})(jQuery); 248 249 250//FontSizeChanger 251$(function(){ 252 var currentstyle = readCookie('fontStyle'); 253 if (currentstyle){ 254 switchFont(currentstyle); 255 }; 256 $("a.sizeL").click(function(){ 257 switchFont("fontL"); 258 return false; 259 }); 260 $("a.sizeM").click(function(){ 261 switchFont("fontM"); 262 return false; 263 }); 264 $("a.sizeS").click(function(){ 265 switchFont("fontS"); 266 return false; 267 }); 268}); 269 270function switchFont(className){ 271 $("body").removeAttr("class").addClass(className); 272 createCookie('fontStyle', className, 365); 273}; 274 275// cookie script http://www.quirksmode.org/js/cookies.html 276function createCookie(name,value,days){ 277 if (days){ 278 var date = new Date(); 279 date.setTime(date.getTime()+(days*24*60*60*1000)); 280 var expires = "; expires="+date.toGMTString(); 281 } 282 else var expires = ""; 283 document.cookie = name+"="+value+expires+"; path=/"; 284} 285 286function readCookie(name){ 287 var nameEQ = name + "="; 288 var ca = document.cookie.split(';'); 289 for(var i=0;i < ca.length;i++) 290 { 291 var c = ca[i]; 292 while (c.charAt(0)==' ') c = c.substring(1,c.length); 293 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); 294 } 295 return null; 296} 297 298$(function(){ 299 300 $("a img").hover(function(){ 301 $(this).css("opacity", "0.5"); 302 $(this).css("filter", "alpha(opacity=40)"); 303 $(this).fadeTo("slow", 1.0); 304 }); 305 306}); 307 308 309
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.