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 223 224 /* include 225 --------------------------------------------------*/ 226 var include = function () { 227 228 if ($('#header-include').length) { 229 $.ajax({
230 type: 'GET', 231 url: directory + 'common/std/html/header2.html', 232 dataType: 'html', 233 success: function (data) { 234 $('#header-include').append(data); 235 spMenu(); 236 fontsize(); 237 includeHeaderImages(); 238 linksHierarchy('#header-include a'); 239 inSubBtn(); 240 } 241 }); 242 } 243 /* 244 if($('#header2-include').length){ 245 $.ajax({ 246 type: 'GET', 247 url: directory + 'common/std/html/header2.html', 248 dataType: 'html', 249 success: function(data) { 250 $('#header2-include').append(data); 251 spMenu(); 252 fontsize(); 253 includeHeaderImages(); 254 linksHierarchy('#header2-include a'); 255 inSubBtn(); 256 } 257 }); 258 } 259 */ 260 if ($('#footer-include').length) { 261 $.ajax({ 262 type: 'GET', 263 url: directory + 'common/std/html/footer.html', 264 dataType: 'html', 265 success: function (data) { 266 $('#footer-include').append(data); 267 includeFooterImages(); 268 pagetop(); 269 smoothscroll(); 270 linksHierarchy('#footer-include a'); 271 } 272 }); 273 } 274 if ($('#search-side-include').length) { 275 $.ajax({
276 type: 'GET', 277 url: directory + 'common/std/html/search_sidemenu.html', 278 dataType: 'html', 279 success: function (data) { 280 $('#search-side-include').append(data); 281 linksHierarchy('#search-side-include a'); 282 } 283 }); 284 } else if ($('#fabric-side-include').length) { 285 $.ajax({ 286 type: 'GET', 287 url: directory + 'common/std/html/fabric_sidemenu.html', 288 dataType: 'html', 289 success: function (data) { 290 $('#fabric-side-include').append(data); 291 linksHierarchy('#fabric-side-include a'); 292 } 293 }); 294 } else if ($('#health-side-include').length) { 295 $.ajax({ 296 type: 'GET', 297 url: directory + 'common/std/html/health_sidemenu.html', 298 dataType: 'html', 299 success: function (data) { 300 $('#health-side-include').append(data); 301 linksHierarchy('#health-side-include a'); 302 } 303 }); 304 } else if ($('#benefit-side-include').length) { 305 $.ajax({ 306 type: 'GET', 307 url: directory + 'common/std/html/benefit_sidemenu.html', 308 dataType: 'html', 309 success: function (data) { 310 $('#benefit-side-include').append(data); 311 linksHierarchy('#benefit-side-include a'); 312 } 313 }); 314 } else if ($('#application-side-include').length) { 315 $.ajax({
316 type: 'GET', 317 url: directory + 'common/std/html/application_sidemenu.html', 318 dataType: 'html', 319 success: function (data) { 320 $('#application-side-include').append(data); 321 linksHierarchy('#application-side-include a'); 322 } 323 }); 324 } else if ($('#union-side-include').length) { 325 $.ajax({ 326 type: 'GET', 327 url: directory + 'common/std/html/union_sidemenu.html', 328 dataType: 'html', 329 success: function (data) { 330 $('#union-side-include').append(data); 331 linksHierarchy('#union-side-include a'); 332 } 333 }); 334 } else if ($('#ranking-side-include').length) { 335 $.ajax({ 336 type: 'GET', 337 url: directory + 'common/std/html/ranking_sidemenu.html', 338 dataType: 'html', 339 success: function (data) { 340 $('#ranking-side-include').append(data); 341 linksHierarchy('#ranking-side-include a'); 342 } 343 }); 344 } else if ($('#news-side-include').length) { 345 $.ajax({
346 type: 'GET', 347 url: directory + 'common/std/html/news_sidemenu.html', 348 dataType: 'html', 349 success: function (data) { 350 $('#news-side-include').append(data); 351 linksHierarchy('#news-side-include a'); 352 } 353 }); 354 } else if ($('#contents-side-include').length) { 355 $.ajax({ 356 type: 'GET', 357 url: directory + 'common/std/html/contents_sidemenu.html', 358 dataType: 'html', 359 success: function (data) { 360 $('#contents-side-include').append(data); 361 linksHierarchy('#contents-side-include a'); 362 } 363 }); 364 } 365 /*$.ajax({ 366 type: 'GET', 367 url: directory + 'common/std/html/contents_sidemenu.html', 368 dataType: 'html', 369 success: function(data) { 370 $('#contents-side-include').append(data); 371 linksHierarchy('#contents-side-include a'); 372 } 373 });*/ 374 } 375 376 /* dom ready 377 --------------------------------------------------*/ 378 $(function () { 379 380 if ($('.dir-2').length) { 381 directory = '../'; 382 } else if ($('.dir-3').length) { 383 directory = '../../'; 384 } else if ($('.dir-4').length) { 385 directory = '../../../'; 386 } else { 387 directory = ''; 388 } 389 390 default_set(); 391 spJsReset(); 392 spMenu(); 393 smoothscroll(); 394 include(); 395 }); 396 397})(jQuery); 398 399 400/* darkmode 401--------------------------------------------------*/ 402 403/*$(function(){ 404 var link_style = $('<link>').attr({ 405 'rel': 'stylesheet', 406 'href': '/common/std/css/darkmode.css' 407 }); 408 $('body').append(link_style); 409});*/
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.