1/** 2 * common.js 3 */ 4 5(function ($) { 6 7 /* default_set 8 --------------------------------------------------*/ 9 var default_set = function () { 10 11 // sp pc judge 12 if (window.ontouchstart === null) { 13 return; 14 } else { 15 $('body').addClass('noT'); 16 } 17 18 // judge 19 var 20 ua = navigator.userAgent.toLowerCase(), 21 ver = navigator.appVersion.toLowerCase(), 22 isIE11 = (ua.indexOf('trident/7') > -1), 23 isMSIE = (ua.indexOf('msie') > -1) && (ua.indexOf('opera') == -1), 24 isEdge = !(ua.indexOf('msie') > -1) && (ua.indexOf('edge') > -1), 25 isIE = isMSIE || isIE11 || isEdge, 26 isChrome = !(ua.indexOf('msie') > -1) && (ua.indexOf('chrome') > -1), 27 isSafari = !(ua.indexOf('msie') > -1) && (ua.indexOf('safari') > -1), 28 isFirefox = !(ua.indexOf('msie') > -1) && (ua.indexOf('firefox') > -1), 29 isiPhone = (ua.indexOf('iphone') > -1), 30 isAndroid = (ua.indexOf('android') > -1) && (ua.indexOf('mobile') > -1); 31 32 if (isIE) { 33 $('body').addClass('IE'); 34 } 35 if (isChrome) { 36 $('body').addClass('Chrome'); 37 } 38 if (isSafari) { 39 $('body').addClass('Safari'); 40 } 41 if (isFirefox) { 42 $('body').addClass('Firefox'); 43 } 44 if (isiPhone) { 45 $('body').addClass('iphone'); 46 } 47 if (isAndroid) { 48 $('body').addClass('android'); 49 } else { 50 $('body').addClass('android_none'); 51 } 52 53 // tel link 54 $('.tel').on('click', function () { 55 if (window.ontouchstart === null) { 56 return; 57 } else { 58 return false; 59 } 60 }); 61 } 62 63 /* spJsReset 64 --------------------------------------------------*/ 65 var spJsReset = function () { 66 $(window).on('resize', function () { 67 var w = $(window).width(); 68 if (w > 1199) { 69 $('body').removeClass('open'); 70 $('#gNav,#sp-close,#overlay').removeAttr('style'); 71 } 72 }); 73 } 74 75 /* smoothscroll 76 --------------------------------------------------*/ 77 var smoothscroll = function () { 78 $('.smooth').on('click', function () { 79 var speed = 500; 80 var href = $(this).attr('href'); 81 var target = $(href == '#' || href == '' ? 'html' : href); 82 var position = target.offset().top; 83 $('html, body').animate({ 84 scrollTop: position 85 }, speed, 'swing'); 86 return false; 87 }); 88 } 89 90 /* spMenu 91 --------------------------------------------------*/ 92 var spMenu = function () { 93 $('#spMenu').on('click', function () { 94 $('body').addClass('open'); 95 $('#overlay').fadeIn(400); 96 }); 97 $('#sp-close').on('click', function () { 98 $('body').removeClass('open'); 99 $('#overlay').fadeOut(400); 100 }); 101 $('#overlay').on('click', function () { 102 $('body').removeClass('open'); 103 $('#overlay').fadeOut(400); 104 }); 105 } 106 107 108 /* fontsize 109 --------------------------------------------------*/ 110 var fontsize = function () { 111 var cookie = $.cookie('fontsize'); 112 if (cookie == 'big') { 113 $('html').addClass('big'); 114 } 115 $('#fontsize a').on('click', function () { 116 $('#fontsize a').removeClass('on'); 117 $(this).addClass('on'); 118 if ($(this).hasClass('f-big')) { 119 $.cookie('fontsize', 'big', { 120 path: '/' 121 }); 122 $('html').addClass('big'); 123 } else { 124 $.removeCookie('fontsize', { 125 path: '/' 126 }); 127 $('html').removeClass('big'); 128 } 129 return false; 130 }); 131 } 132 133 /* pagetop 134 --------------------------------------------------*/ 135 var pagetop = function () { 136 $(window).on('scroll', function () { 137 var 138 sc = $(window).scrollTop(), 139 wh = $(window).height(), 140 pos = $('#footer').offset().top; 141 if (sc > 100) { 142 $('#pagetop').addClass('up'); 143 } else { 144 $('#pagetop').removeClass('up'); 145 } 146 if (sc + wh > pos) { 147 $('#pagetop').addClass('stop'); 148 } else { 149 $('#pagetop').removeClass('stop'); 150 } 151 });
152 } 153 154 /* include header images 155 --------------------------------------------------*/ 156 var includeHeaderImages = function () { 157 $('#header img').each(function (index, el) { 158 var img = $(this).attr('src'); 159 $(this).attr('src', directory + img); 160 }); 161 } 162 163 /* include footer images 164 --------------------------------------------------*/ 165 var includeFooterImages = function () { 166 $('#footer img').each(function (index, el) { 167 var img = $(this).attr('src'); 168 $(this).attr('src', directory + img); 169 }); 170 } 171 172 /* linksHierarchy 173 --------------------------------------------------*/ 174 function linksHierarchy(links) { 175 var links = $(links); 176 links.each(function (index, el) { 177 var 178 href = $(this).attr('href'), 179 linktype = $(this).attr('target'); 180 if (!(linktype == '_blank' || $(this).hasClass('smooth'))) { 181 $(this).attr('href', directory + href); 182 } 183 }); 184 } 185 186 /* inSubBtn 187 --------------------------------------------------*/ 188 /*var inSubBtn = function() { 189 $('.inSubBtn').hover(function() { 190 var ww = $(window).width(); 191 if(ww>940){ 192 $('.inSubMenu',this).stop().slideDown(200); 193 } 194 }, function() { 195 var ww = $(window).width(); 196 if(ww>940){ 197 $('.inSubMenu',this).stop().slideUp(200); 198 } 199 }); 200 $('.inSubBtn > a').on('click', function(){ 201 $(this).toggleClass('on'); 202 $(this).closest('.inSubBtn').find('.inSubMenu').slideToggle(200); 203 return false; 204 }); 205 }*/ 206 207 208 /* spç¨ */ 209 210 /*var inSubBtn = function () { 211 $('.inSubBtn > a').on('click', function () { 212 var ww = $(window).width(); 213 if (ww < 940) { 214 $('.inSubBtn > a').not(this).removeClass('on'); 215 $('.inSubBtn > a').not(this).next().slideUp(200); 216 $(this).toggleClass('on'); 217 $(this).closest('.inSubBtn').find('.inSubMenu').slideToggle(200); 218 return false; 219 } 220 }); 221 }*/ 222 var inSubBtn = function () { 223 $('.inSubBtn > a').on('click', function () { 224 var ww = $(window).width(); 225 if (ww < 767) { 226 $('.inSubBtn > a').not(this).removeClass('on'); 227 $('.inSubBtn > a').not(this).next().slideUp(200); 228 $(this).toggleClass('on'); 229 $(this).closest('.inSubBtn').find('.inSubMenu').slideToggle(200); 230 return false; 231 } 232 }); 233 } 234 235 236 /* include 237 --------------------------------------------------*/ 238 var include = function () { 239 240 if ($('#header-include').length) { 241 $.ajax({
242 type: 'GET', 243 url: directory + 'common/std/html/header2.html', 244 dataType: 'html', 245 success: function (data) { 246 $('#header-include').append(data); 247 spMenu(); 248 fontsize(); 249 includeHeaderImages(); 250 linksHierarchy('#header-include a'); 251 inSubBtn(); 252 } 253 }); 254 } 255 /* 256 if($('#header2-include').length){ 257 $.ajax({ 258 type: 'GET', 259 url: directory + 'common/std/html/header2.html', 260 dataType: 'html', 261 success: function(data) { 262 $('#header2-include').append(data); 263 spMenu(); 264 fontsize(); 265 includeHeaderImages(); 266 linksHierarchy('#header2-include a'); 267 inSubBtn(); 268 } 269 }); 270 } 271 */ 272 if ($('#footer-include').length) { 273 $.ajax({ 274 type: 'GET', 275 url: directory + 'common/std/html/footer.html', 276 dataType: 'html', 277 success: function (data) { 278 $('#footer-include').append(data); 279 includeFooterImages(); 280 pagetop(); 281 smoothscroll(); 282 linksHierarchy('#footer-include a'); 283 } 284 }); 285 } 286 if ($('#search-side-include').length) { 287 $.ajax({
288 type: 'GET', 289 url: directory + 'common/std/html/search_sidemenu.html', 290 dataType: 'html', 291 success: function (data) { 292 $('#search-side-include').append(data); 293 linksHierarchy('#search-side-include a'); 294 } 295 }); 296 } else if ($('#about-side-include').length) { 297 $.ajax({ 298 type: 'GET', 299 url: directory + 'common/std/html/about_sidemenu.html', 300 dataType: 'html', 301 success: function (data) { 302 $('#about-side-include').append(data); 303 linksHierarchy('#about-side-include a'); 304 } 305 }); 306 } else if ($('#scholarship-side-include').length) { 307 $.ajax({ 308 type: 'GET', 309 url: directory + 'common/std/html/scholarship_sidemenu.html', 310 dataType: 'html', 311 success: function (data) { 312 $('#scholarship-side-include').append(data); 313 linksHierarchy('#scholarship-side-include a'); 314 } 315 }); 316 } else if ($('#grant-side-include').length) { 317 $.ajax({
318 type: 'GET', 319 url: directory + 'common/std/html/grant_sidemenu.html', 320 dataType: 'html', 321 success: function (data) { 322 $('#grant-side-include').append(data); 323 linksHierarchy('#grant-side-include a'); 324 } 325 }); 326 } else if ($('#ranking-side-include').length) { 327 $.ajax({ 328 type: 'GET', 329 url: directory + 'common/std/html/ranking_sidemenu.html', 330 dataType: 'html', 331 success: function (data) { 332 $('#ranking-side-include').append(data); 333 linksHierarchy('#ranking-side-include a'); 334 } 335 }); 336 } else if ($('#news-side-include').length) { 337 $.ajax({ 338 type: 'GET', 339 url: directory + 'common/std/html/news_sidemenu.html', 340 dataType: 'html', 341 success: function (data) { 342 $('#news-side-include').append(data); 343 linksHierarchy('#news-side-include a'); 344 } 345 }); 346 } else if ($('#contents-side-include').length) { 347 $.ajax({ 348 type: 'GET', 349 url: directory + 'common/std/html/contents_sidemenu.html', 350 dataType: 'html', 351 success: function (data) { 352 $('#contents-side-include').append(data); 353 linksHierarchy('#contents-side-include a'); 354 } 355 }); 356 } 357 /*$.ajax({ 358 type: 'GET', 359 url: directory + 'common/std/html/contents_sidemenu.html', 360 dataType: 'html', 361 success: function(data) { 362 $('#contents-side-include').append(data); 363 linksHierarchy('#contents-side-include a'); 364 } 365 });*/ 366 } 367 368 var FixedAnime = function () { 369 var headerH = $('#header').outerHeight(true); 370 var scroll = $(window).scrollTop(); 371 if (scroll >= headerH){ 372 $('nav').addClass('fixed'); 373 }else{ 374 $('nav').removeClass('fixed'); 375 } 376 } 377 $(window).scroll(function () { 378 FixedAnime(); 379 }); 380 381 $(window).on('load', function () { 382 FixedAnime(); 383 }); 384 385 386 387 /* dom ready 388 --------------------------------------------------*/ 389 $(function () { 390 391 if ($('.dir-2').length) { 392 directory = '../'; 393 } else if ($('.dir-3').length) { 394 directory = '../../'; 395 } else if ($('.dir-4').length) { 396 directory = '../../../'; 397 } else { 398 directory = ''; 399 } 400 401 default_set(); 402 spJsReset(); 403 spMenu(); 404 smoothscroll(); 405 include(); 406 accordion_menu(); 407 }); 408 409 410})(jQuery); 411 412 413/* darkmode 414--------------------------------------------------*/ 415 416/*$(function(){ 417 var link_style = $('<link>').attr({ 418 'rel': 'stylesheet', 419 'href': '/common/std/css/darkmode.css' 420 }); 421 $('body').append(link_style); 422});*/ 423 424
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.