1// Accessibility Navigation 2// require "jquery-cookie.js" 3 4$(function() { 5 var navi = new JoruriAcNavi(); 6}); 7 8/** 9 * navigation class 10 */ 11function JoruriAcNavi() { 12 var self = this; 13 14 // properties 15 this.fontBase = $('.naviFont .base').length ? $('.naviFont .base') : null; 16 this.fontSmall = $('.naviFont .small').length ? $('.naviFont .small') : null; 17 this.fontBig = $('.naviFont .big').length ? $('.naviFont .big') : null; 18 this.fontView = $('.naviFont .view').length ? $('.naviFont .view') : null; 19 this.fontSize = this.fontView ? this.fontView.html() : '100%'; 20 this.themeWhite = $('.naviTheme .white').length ? $('.naviTheme .white') : null; 21 this.themeBlue = $('.naviTheme .blue').length ? $('.naviTheme .blue') : null; 22 this.themeBlack = $('.naviTheme .black').length ? $('.naviTheme .black') : null; 23 this.rubyLink = $('.naviRuby .ruby').length ? $('.naviRuby .ruby') : null; 24 this.talkLink = $('.naviTalk .talk').length ? $('.naviTalk .talk') : null; 25 this.talkPlayer = $('.naviTalk .player').length ? $('.naviTalk .player') : null; 26 this.noticeView = $('#headerBody').length ? $('#headerBody') : null; 27 28 // methods 29 this.changeFont = JoruriAcNavi_changeFont; 30 this.relativeFont = JoruriAcNavi_relativeFont; 31 this.changeTheme = JoruriAcNavi_changeTheme; 32 this.ruby = JoruriAcNavi_ruby; 33 this.talk = JoruriAcNavi_talk; 34 this.notice = JoruriAcNavi_notice; 35 36 // reflect 37 this.changeFont(); 38 this.changeTheme(); 39 this.ruby(); 40 41 // events 42 if (this.fontBase) this.fontBase.mousedown(function() { 43 return self.changeFont('100%'); 44 }); 45 if (this.fontSmall) this.fontSmall.mousedown(function() { 46 return self.changeFont(self.relativeFont('small')); 47 }); 48 if (this.fontBig) this.fontBig.mousedown(function() { 49 return self.changeFont(self.relativeFont('big')); 50 }); 51 if (this.themeWhite) this.themeWhite.mousedown(function() { 52 return self.changeTheme('white'); 53 }); 54 if (this.themeBlue) this.themeBlue.mousedown(function() { 55 return self.changeTheme('blue'); 56 }); 57 if (this.themeBlack) this.themeBlack.mousedown(function() { 58 return self.changeTheme('black'); 59 }); 60 if (this.rubyLink) this.rubyLink.click(function() { 61 $(this).toggleClass('current'); 62 return self.ruby($(this).attr('class').match(/current/) == "current"); 63 }); 64 if (this.talkLink) this.talkLink.click(function() { 65 $(this).toggleClass('current'); 66 return self.talk($(this).attr('class').match(/current/) == "current"); 67 }); 68} 69 70/** 71 * font size 72 */ 73function JoruriAcNavi_relativeFont(mode) { 74 var size = this.fontSize.match(/^[0-9]+/); 75 if (!size || !this.fontSize.match(/%$/)) size = '100'; 76 size = parseInt(size); 77 if (mode == 'small' && size > 60) size -= 20; 78 if (mode == 'big' && size < 200) size += 20; 79 return String(size) + '%'; 80} 81function JoruriAcNavi_changeFont(value) { 82 if (value) { 83 $.cookie('navigation_font_size', value, { path: '/' }); 84 } else { 85 value = $.cookie('navigation_font_size'); 86 if (!value) value = this.fontSize; 87 } 88 if (this.fontView) { 89 this.fontView.html(value); 90 } 91 this.fontSize = value; 92 $('body').css('fontSize', value); 93 return false; 94} 95 96/** 97 * theme 98 */ 99function JoruriAcNavi_changeTheme(value) { 100 if (value) { 101 $.cookie('navigation_theme', value, { path: '/' }); 102 } else { 103 value = $.cookie('navigation_theme'); 104 if (!value) return false; 105 } 106 var links = $('link[rel*=alternate]'); 107 links.each(function() { // reset 108 var title = $(this).attr('title'); 109 this.disabled = true; 110 $('.naviTheme .' + title).removeClass('current'); 111 }); 112 links.each(function() { // current 113 if ($(this).attr('title') == value) { 114 this.disabled = false; 115 $('.naviTheme .' + value).addClass('current'); 116 } 117 }); 118 return false; 119} 120 121/** 122 * ruby 123 */ 124function JoruriAcNavi_ruby(flag) { 125 if (flag == true) { // redirect 126 $.cookie('navigation_ruby', 'on', { path: '/' }); 127 128 if (location.pathname.search(/\/$/i) != -1) { 129 location.href = location.pathname + "index.html.r" + location.search; 130 } else if (location.pathname.search(/\.html\.mp3$/i) != -1) { 131 location.href = location.pathname.replace(/\.html\.mp3$/, ".html.r") + location.search; 132 } else if (location.pathname.search(/\.html$/i) != -1) { 133 location.href = location.pathname.replace(/\.html$/, ".html.r") + location.search; 134 } else if (location.pathname.search(/\.html$/i) != -1) { 135 location.href = location.pathname.replace(/\.html$/, ".html.r") + location.search; 136 } else { 137 location.href = location.href.replace(/#.*/, ''); 138 } 139 } else if (flag == false) { // redirect 140 $.cookie('navigation_ruby', 'off', { path: '/' });
141 if (location.pathname.search(/\.html\.r$/i) != -1) { 142 location.href = location.pathname.replace(/\.html\.r$/, ".html") + location.search; 143 } else { 144 location.reload(); 145 } 146 } else if ($.cookie('navigation_ruby') == "on") { // render: rubied 147 if (location.pathname.search(/\/$/i) != -1) { 148 location.href = location.pathname + "index.html.r" + location.search; 149 } else if (location.pathname.search(/\.html$/i) != -1) { 150 location.href = location.pathname.replace(/\.html/, ".html.r") + location.search; 151 } else { 152 if (this.rubyLink) this.rubyLink.addClass('current'); 153 this.notice(); 154 } 155 } else { // render: not rubied 156 if (this.rubyLink) this.rubyLink.removeClass('current'); 157 } 158 return false; 159} 160 161/** 162 * talk 163 */ 164function JoruriAcNavi_talk(flag) { 165 this.notice(); 166 167 var uri = location.pathname; 168 var now = new Date(); 169 var param = '?' + now.getDay() + now.getHours() + now.getMinutes(); 170 171 if (uri.match(/\/$/)) uri += 'index.html'; 172 uri = uri.replace(/\.html\.r$/, '.html'); 173 uri += '.mp3' + param; 174 175 if (!this.talkPlayer) { 176 location.href = uri; 177 return false; 178 } 179 180 if (this.talkPlayer.html() == '') { // play 181 var html = '<script type="text/javascript" src="/_common/swf/niftyplayer/niftyplayer.js"></script>' + 182 '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + 183 ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"' + 184 ' width="165" height="37" id="niftyPlayer1" align="">' + 185 '<param name=movie value="/_common/swf/niftyplayer/niftyplayer.swf?file=' + uri + '&as=1">' + 186 '<param name=quality value=high>' + 187 '<param name=bgcolor value=#FFFFFF>' + 188 '<embed src="/_common/swf/niftyplayer/niftyplayer.swf?file=' + uri + '&as=1" quality=high bgcolor=#FFFFFF' + 189 ' width="165" height="37" name="niftyPlayer1" align="" type="application/x-shockwave-flash"' + 190 ' swLiveConnect="true" pluginspage="http://www.macromedia.com/go/getflashplayer">' + 191 '</embed>' + 192 '</object>'; 193 this.talkPlayer.html(html); 194 } else { // stop 195 if ($.cookie('navigation_ruby') != 'on') $('#navigationNotice').remove(); 196 this.talkPlayer.html(''); 197 } 198 return false; 199} 200 201/** 202 * notice 203 */ 204function JoruriAcNavi_notice() { 205 var noticeId = 'navigationNotice'; 206 var notice = $('#' + noticeId); 207 if (this.noticeView && !notice.length) { 208 var text = 'ãµãããªã¨èªã¿ä¸ãé³å£°ã¯ï¼äººåï¼å°åï¼ç¨èªçãæ£ç¢ºã«çºé³ãããªãå ´åãããã¾ãã'; 209 this.noticeView.append('<div id="' + noticeId + '">
209' + text + '</div>'); 210 } 211}
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.