1/** 2 * custom javascript for our theme Insite Starter 3 */ 4 5jQuery(document).ready(function($) { 6 /** Device State Indicator ============== */ 7 /** See: https://davidwalsh.name/device-state-detection-css-media-queries-javascript */ 8 /** Create the state-indicator element */ 9 var indicator = document.createElement('div'); 10 indicator.className = 'state-indicator'; 11 document.body.appendChild(indicator); 12 13 /** Remove existing body classes if they already exist */ 14 /** We do this before we update the state */ 15 function removeStateClasses() { 16 $('body').removeClass("width-xs width-sm width-md width-lg width-xl landscape portrait"); 17 } 18 19 /** Create a method which returns device width (window width) */ 20 /** Widths are based on Bootstrap breakpoints; function returns a breakpoint designation */ 21 /** CSS media queries in our stylesheet set the z-index of the indicator based on screen width */ 22 /** the z-index values correspond with breakpoint widths as per below */ 23 function getDeviceWidth() { 24 var index = parseInt(window.getComputedStyle(indicator).getPropertyValue('z-index'), 10); 25 26 var widths = { 27 1: 'xxl', 28 2: 'xl', 29 3: 'lg', 30 4: 'md', 31 5: 'sm', 32 6: 'xs' 33 }; 34 35 return widths[index] || 'xxl'; 36 } 37 38 /** Create a method which returns device orientation */ 39 /** CSS media queries in our stylesheet set the css content of the indicator based on orientation */ 40 41 function getDeviceOrientation() { 42 var orientation = window.getComputedStyle( 43 document.querySelector('.state-indicator'), ':before' 44 ).getPropertyValue('content'); 45 46 /** remove quotes from orientation variable literal string */ 47 return orientation.replace(/^"(.+(?="$))"$/, '$1'); 48 } 49 50 /** Announce the state with a custom DOM event */ 51 function addDeviceStateClasses() { 52 var currentDeviceWidth = getDeviceWidth(); 53 var currentDeviceOrientation = getDeviceOrientation(); 54 $('body').addClass("width-" + currentDeviceWidth); 55 $('body').addClass(currentDeviceOrientation); 56 } 57 addDeviceStateClasses(); 58 59 /** Add indicator info */ 60 function addIndicatorInfo() { 61 var widthNow = getDeviceWidth(); 62 var windowWidth = document.body.clientWidth; 63 $('.state-indicator').hover(function() { 64 $(this).attr('data-content', widthNow + ' ' + windowWidth +'px'); 65 }); 66 } 67 addIndicatorInfo(); 68 69 /** device state listener */ 70 var lastDeviceWidth = getDeviceWidth(); 71 var lastDeviceOrientation = getDeviceOrientation(); 72 /** Execute on resize. Utilizes debounce function; see below. */ 73 window.addEventListener('resize', debounce(function() { 74 removeStateClasses(); 75 var orientation = getDeviceOrientation(); 76 if(orientation != lastDeviceOrientation) { 77 /** Save the new orientation as current */ 78 lastDeviceOrientation = orientation; 79 80 } 81 var deviceWidth = getDeviceWidth(); 82 if(deviceWidth != lastDeviceWidth) { 83 /** Save the new width as current */ 84 lastDeviceWidth = deviceWidth; 85 86 } 87 88 /** Announce the state change by a custom DOM event */ 89 /** existing orientation class already removed above */ 90 $('body').addClass(orientation); 91 92 /** Announce the state change by a custom DOM event */ 93 /** existing width class already removed above */ 94 $('body').addClass("width-" + deviceWidth); 95 96 /** Trigger events upon state change: */ 97 /** Functions to fire upon state change go here. Example: */ 98 /** moveFullMenu(); */ 99 scrollawayNav(); 100 addIndicatorInfo(); 101 102 }, 200)); 103 104 /** Now we can check the current state. Usage examples: */ 105 /** if ($('body').hasClass('width-md')) { }; */ 106 /** if ($('body').is('.width-md, .width-sm, .width-xs')) { }; */ 107 108 /** Changes for different device states ========== */ 109 /** Define functions here, and execute initial firing. 110 * Then list them above to fire again on changes. */ 111 112 /** Enable stickHeader to keep the menu icon stuck to the top-right on small screens */ 113 function stickHeader() { 114 if ( $('body').is('.width-sm, .width-xs') ) { 115 $('nav.navbar').addClass('position-sticky'); 116 } else { 117 $('nav.navbar').removeClass('position-sticky'); 118 } 119 } 120 //stickHeader(); 121 122 /** Enable scroll-away to hide nav on scroll down, show on scroll up */ 123 /** 124 * see: https://medium.com/@mariusc23/hide-header-on-scroll-down-show-on-scroll-up-67bbaae9a78c 125 * see: http://jsfiddle.net/mariusc23/s6mLJ/31/ 126 */ 127 function scrollawayNav() { 128 if ( $('body').height() > window.innerHeight ) { 129 /** Hide Header on scroll down */ 130 var didScroll; 131 var lastScrollTop = 0; 132 var delta = 5; 133 var navbarHeight = $('nav.site-nav').outerHeight(); 134 $(window).scroll(function(){ 135 didScroll = true; 136 }); 137 setInterval(function() { 138 if (didScroll) { 139 hasScrolled(); 140 didScroll = false;
141 } 142 }, 250); 143 let hasScrolled = function() { 144 var st = $(this).scrollTop(); 145 /** Make sure they scroll more than delta */ 146 if(Math.abs(lastScrollTop - st) <= delta) 147 return; 148 /** If they scrolled down and are past the navbar, add class .nav-up. 149 This is necessary so you never see what is "behind" the navbar. */ 150 if (st > lastScrollTop && st > navbarHeight){ 151 // Scroll Down 152 $('nav.site-nav').removeClass('nav-down').addClass('nav-up'); 153 } else { 154 // Scroll Up 155 if(st + $(window).height() < $(document).height()) { 156 $('nav.site-nav').removeClass('nav-up').addClass('nav-down'); 157 } 158 } 159 lastScrollTop = st; 160 if ( lastScrollTop == 0 ) { 161 $('nav.site-nav').addClass('at-top'); 162 } else { 163 $('nav.site-nav').removeClass('at-top'); 164 } 165 }; 166 } 167 } 168 scrollawayNav(); 169 170 171 /** END state listener */ 172 173 /** Helper Functions etc ================================= */ 174 175 /** debounce function 176 * Use to fire a function in steps rather than continuosly, as for example 177 * during resize or scrolling. 178 * Returns a function, that, as long as it continues to be invoked, will not 179 * be triggered. The function will be called after it stops being called for 180 * N milliseconds. If 'immediate' is passed, trigger the function on the 181 * leading edge, instead of the trailing. 182 * see: https://davidwalsh.name/javascript-debounce-function 183 */ 184 function debounce(func, wait, immediate) { 185 var timeout; 186 return function() { 187 var context = this, args = arguments; 188 var later = function() { 189 timeout = null; 190 if (!immediate) func.apply(context, args); 191 }; 192 var callNow = immediate && !timeout; 193 clearTimeout(timeout); 194 timeout = setTimeout(later, wait); 195 if (callNow) func.apply(context, args); 196 }; 197 } 198 199 200}); /** end of document ready function */ 201 202jQuery(document).ready(function($) { 203 /** Custom functions for this theme. Define, then fire them here, or at top if they need to re-fire on state change. */ 204 205 /** jQuery console log enqueued jQ version */
206 console.log('jQuery CDN version is '+$().jquery); 207 208/** Add helpers to links 209 * Check whether links are external: 210 * (Only works with elements that have href) 211 * See: https://j11y.io/javascript/extending-jquerys-selector-capabilities/ 212 * (see there for their original code, which we've changed a bit) 213 * (Also has a nice "is visible" example) 214 */ 215/* Extend jQuery to recognize external links based on hostname comparison */ 216$.extend($.expr[':'],{ 217 external: function(a) { 218 if(!a.href) {return false;} 219 let linkHostname = a.hostname.replace(/^www\./, ''); 220 let currentHostname = window.location.hostname.replace(/^www\./, ''); 221 return linkHostname && linkHostname !== currentHostname; 222 } 223}); 224function linkHelpers() { 225 /* Add a class to external links that contain images */ 226 $('#main a:external').has('img').addClass('with-image'); 227 /* Handle external links by adding target, title, rel, and screen-reader notice */ 228 $('#main a:external').each(function(){ 229 var origTitle = ''; 230 if ($(this).attr('title')) {origTitle = '\u2192' + ' ' + $(this).attr('title');} 231 let relVal = $(this).attr('rel') || ''; 232 let relParts = relVal.toLowerCase().split(/\s+/); 233 relParts = [...new Set(relParts.filter(Boolean))]; 234 if (!relParts.includes('noopener')) {relParts.push('noopener');} 235 $(this).attr({ 236 target: '_blank', 237 title: 'Off-site link opens in a new tab or window ' + origTitle, 238 rel: relParts.sort().join(' ') 239 }).append('<span class="sr-only">This off-site link opens in new tab or window.</span>'); 240 }); 241 /* Handle PDF links by adding attributes, screen-reader text, and visual indicator */ 242 $('#main a[href$=".pdf"]').each(function(){ 243 let relVal = $(this).attr('rel') || ''; 244 let relParts = relVal.toLowerCase().split(/\s+/); 245 relParts = [...new Set(relParts.filter(Boolean))]; 246 if (!relParts.includes('noopener')) {relParts.push('noopener');} 247 $(this).addClass('pdf-link').attr({ 248 target: '_blank', 249 title: 'This PDF file opens in a new tab or window.', 250 rel: relParts.sort().join(' ') 251 }).append( 252 '<span class="sr-only">PDF file opens in a new tab or window.</span>' + 253 '<sup class="pdf-indicator" aria-hidden="true">PDF</sup>' 254 ); 255 }); 256 /* Normalize internal links by enforcing https, removing www, and cleaning up attributes */ 257 $('#main a').each(function(){ 258 let href = $(this).attr('href'); 259 if (!href) {return;} 260 let url = new URL(href, window.location.origin); 261 let currentHost = window.location.hostname.replace(/^www\./, ''); 262 let linkHost = url.hostname.replace(/^www\./, ''); 263 /* Ensure exact domain match, or prepend a dot to match actual subdomains only */ 264 if (linkHost === currentHost) { 265 let normalizedHref = href.replace(/^http?:\/\//, 'https://'); 266 normalizedHref = normalizedHref.replace(/^https:\/\/www\./, 'https://'); 267 if (normalizedHref !== href) { 268 $(this).attr('href', normalizedHref); 269 } 270 /* Do not remove target if this is a PDF link */ 271 if (!$(this).hasClass('pdf-link') && $(this).attr('target') === '_blank') { 272 $(this).removeAttr('target'); 273 } 274 let relVal = $(this).attr('rel'); 275 if (relVal) { 276 let relParts = relVal.toLowerCase().split(/\s+/); 277 relParts = relParts.filter(Boolean).filter(val => val !== 'noreferrer'); 278 relParts = [...new Set(relParts)]; 279 if (relParts.length > 0) { 280 let newRel = relParts.sort().join(' '); 281 $(this).attr('rel', newRel); 282 } else { 283 $(this).removeAttr('rel'); 284 } 285 } 286 } 287 }); 288} 289linkHelpers(); 290 291 /** jump to top when menu toggle is clicked */ 292 $('.navbar-toggler').click(function() { 293 $('html, body').animate({ 294 scrollTop: ($('#masthead').offset().top) 295 },500); 296 }); 297 298 /* Phone Mask - set up js formatting of phone input in forms. Utilizes script included at bottom. */ 299 $('input[type="tel"]').usPhoneFormat({ 300 format: '(xxx) xxx-xxxx', 301 }); 302 303 /* Menu experiments: OK2X */ 304 305 306 /* color conversion */ 307 /* our color chart script uses this HSL to RGB converter */ 308 function HSLtoRGB(h,s,l) { 309 // Must be fractions of 1 310 s /= 100; 311 l /= 100; 312 313 let c = (1 - Math.abs(2 * l - 1)) * s, 314 x = c * (1 - Math.abs((h / 60) % 2 - 1)), 315 m = l - c/2, 316 r = 0, 317 g = 0, 318 b = 0; 319 if (0 <= h && h < 60) { 320 r = c; g = x; b = 0; 321 } else if (60 <= h && h < 120) { 322 r = x; g = c; b = 0; 323 } else if (120 <= h && h < 180) { 324 r = 0; g = c; b = x; 325 } else if (180 <= h && h < 240) { 326 r = 0; g = x; b = c; 327 } else if (240 <= h && h < 300) { 328 r = x; g = 0; b = c; 329 } else if (300 <= h && h < 360) { 330 r = c; g = 0; b = x; 331 } 332 r = Math.round((r + m) * 255); 333 g = Math.round((g + m) * 255); 334 b = Math.round((b + m) * 255); 335 336 return "rgb(" + r + "," + g + "," + b + ")"; 337 } 338 339 /* our color chart script uses this HSL to HEX converter */ 340 function HEXfromHSL(h, s, l) { 341 l /= 100; 342 const a = s * Math.min(l, 1 - l) / 100; 343 const f = n => {
344 const k = (n + h / 30) % 12; 345 const color = l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1); 346 return Math.round(255 * color).toString(16).padStart(2, '0'); // convert to Hex and prefix "0" if needed 347 }; 348 return `#${f(0)}${f(8)}${f(4)}`; 349 } 350 351 /* use a JavaScript regular expression to extract the values from an rgb(x, y, z) string and convert them to x, y, z*/ 352 function extractRGBvalues(rgbString) { 353 const regex = /rgb\((\d+),\s*(\d+),\s*(\d+)\)/; 354 const match = rgbString.match(regex); 355 if (match) { 356 const [_, r, g, b] = match; 357 return `${r},${g},${b}`; 358 } 359 return null; 360 } 361 /* example usage */ 362 /** 363 const rgbString = "rgb(255, 100, 50)"; 364 const result = extractRGBvalues(rgbString); 365 console.log(result); // Output: "255, 100, 50" 366 */ 367 368 /* our color chart script uses this function to convert rgb to cmyk */ 369 function rgbToCMYK(r, g, b) { 370 r = Number(r); 371 g = Number(g); 372 b = Number(b); 373 // Ensure the RGB values are numbers and within the valid range 374 if (typeof r !== 'number' || typeof g !== 'number' || typeof b !== 'number' || 375 r < 0 || r > 255 || g < 0 || g >
375 255 || b < 0 || b > 255) { 376 throw new Error('Invalid RGB values. Each value must be a number between 0 and 255.'); 377 } 378 /** if (typeof r !== 'number') { 379 throw new Error('Invalid R value. Each value must be a number between 0 and 255.'); 380 } */ 381 382 // Normalize the RGB values to the range 0-1 383 let rNorm = r / 255; 384 let gNorm = g / 255; 385 let bNorm = b / 255; 386 387 // Calculate the CMY values 388 let c = 1 - rNorm; 389 let m = 1 - gNorm; 390 let y = 1 - bNorm; 391 392 // Calculate the K value 393 let k = Math.min(c, m, y); 394 395 // Calculate the final CMYK values 396 if (k < 1) { 397 c = (c - k) / (1 - k); 398 m = (m - k) / (1 - k); 399 y = (y - k) / (1 - k); 400 } else { 401 c = 0; 402 m = 0; 403 y = 0; 404 } 405 406 // Ensure K is within the range 0-1 407 k = Math.min(Math.max(k, 0), 1); 408 409 // Format the CMYK values as a string 410 return `c: ${Math.round(c * 100)}%, m: ${Math.round(m * 100)}%, y: ${Math.round(y * 100)}%, k: ${Math.round(k * 100)}%`; 411 } 412 413 function rgb2cmyk(r,g,b) { 414 415 var computedC = 0; 416 var computedM = 0; 417 var computedY = 0; 418 var computedK = 0; 419 420 //remove spaces from input RGB values, convert to int 421 var r = parseInt( (''+r).replace(/\s/g,''),10 ); 422 var g = parseInt( (''+g).replace(/\s/g,''),10 ); 423 var b = parseInt( (''+b).replace(/\s/g,''),10 ); 424 425 // make sure the entered values are integers and not strings 426 r = Number(r); 427 g = Number(g); 428 b = Number(b); 429 430 if ( r==null || g==null || b==null || 431 isNaN(r) || isNaN(g)|| isNaN(b) ) 432 { 433 //console.log('Please enter numeric RGB values!'); 434 //return; 435 } 436 if (r<0 || g<0 || b<0 || r>255 || g>255 || b>255) { 437 console.log('RGB values must be in the range 0 to 255.'); 438 return; 439 } 440 441 // BLACK 442 if (r==0 && g==0 && b==0) { 443 computedK = 1; 444 return [0,0,0,1]; 445 } 446 447 computedC = 1 - (r/255); 448 computedM = 1 - (g/255); 449 computedY = 1 - (b/255); 450 451 var minCMY = Math.min(computedC, 452 Math.min(computedM,computedY)); 453 computedC = (computedC - minCMY) / (1 - minCMY) ; 454 computedM = (computedM - minCMY) / (1 - minCMY) ; 455 computedY = (computedY - minCMY) / (1 - minCMY) ; 456 computedK = minCMY; 457 458 //return [computedC,computedM,computedY,computedK]; 459 //return `c: ${Math.round(c * 100)}%, m: ${Math.round(m * 100)}%, y: ${Math.round(y * 100)}%, k: ${Math.round(k * 100)}%`; 460 //return `c:${computedC} m:${computedM} y:${computedY} k:${computedK}`; 461 return `r: ${r} g: ${g} b: ${b}`; 462 } 463 464function hexTOcmyk (hex) { 465 var computedC = 0; 466 var computedM = 0; 467 var computedY = 0; 468 var computedK = 0; 469 470 hex = (hex.charAt(0)=="#") ? hex.substring(1,7) : hex; 471 472 if (hex.length != 6) { 473 alert ('Invalid length of the input hex value!'); 474 return; 475 } 476 if (/[0-9a-f]{6}/i.test(hex) != true) { 477 alert ('Invalid digits in the input hex value!'); 478 return; 479 } 480 481 var r = parseInt(hex.substring(0,2),16); 482 var g = parseInt(hex.substring(2,4),16); 483 var b = parseInt(hex.substring(4,6),16); 484 485 // BLACK 486 if (r==0 && g==0 && b==0) { 487 computedK = 1; 488 return [0,0,0,1]; 489 } 490 491 computedC = 1 - (r/255); 492 computedM = 1 - (g/255); 493 computedY = 1 - (b/255); 494 495 var minCMY = Math.min(computedC,Math.min(computedM,computedY)); 496 497 computedC = (computedC - minCMY) / (1 - minCMY) ; 498 computedM = (computedM - minCMY) / (1 - minCMY) ; 499 computedY = (computedY - minCMY) / (1 - minCMY) ; 500 computedK = minCMY; 501 502 // percentage notation 503 let numC = (computedC * 100).toFixed(2); 504 let numM = (computedM * 100).toFixed(2); 505 let numY = (computedY * 100).toFixed(2); 506 let numK = (computedK * 100).toFixed(2); 507 508 let cStr = String(computedC); 509 let mStr = String(computedM); 510 let yStr = String(computedY); 511 let kStr = String(computedK); 512 let c = ''; 513 let m = ''; 514 let y = ''; 515 let k = ''; 516 517 if (cStr == 1) { 518 c = '100'; 519 } else if (cStr.length > 4) { 520 /* convert to 4 characters in length */ 521 let c4 = cStr.slice(3).substr(0,4); 522 /* add a decimal point after two characters */ 523 c = c4.substr(0,1)+"."+c4.substr(1); 524 } else { 525 c = '00.00'; 526 } 527 528 if (mStr == 1) { 529 m = '100'; 530 } else if (mStr.length > 4) { 531 /* convert to 4 characters in length */ 532 let m4 = mStr.slice(3).substr(0,4); 533 /* add a decimal point after two characters */ 534 m = m4.substr(0,1)+"."+m4.substr(1); 535 } else { 536 m = '00.00'; 537 } 538 539 if (yStr == 1) { 540 y = '100'; 541 } else if (yStr.length > 4) { 542 /* convert to 4 characters in length */ 543 let y4 = yStr.slice(3).substr(0,4); 544 /* add a decimal point after two characters */ 545 y = y4.substr(0,1)+"."+y4.substr(1); 546 } else { 547 y = '00.00'; 548 } 549 550 if (kStr == 1) { 551 k = '100'; 552 } else if (kStr.length > 4) { 553 /* convert to 4 characters in length */ 554 let k4 = kStr.slice(3).substr(0,4); 555 /* add a decimal point after two characters */ 556 k = k4.substr(0,2)+"."+k4.substr(2); 557 } else { 558 k = '00.00'; 559 } 560 561 //return [computedC,computedM,computedY,computedK]; 562/* return `c:${computedC} 563m: ${computedM} 564y: ${computedY} 565k: ${computedK}`; */ 566 //return `${computedC},${computedM},${computedY},${computedK}`; 567/* return `c: ${c}% 568m: ${m}% 569y: ${y}% 570k: ${k}`; */ 571return `c: ${numC}% 572m: ${numM}% 573y: ${numY}% 574k: ${numK}%`; 575} 576/** function shortenedCMYK(c,m,y,k) { 577 if (c.length > 3) { 578 c = c.slice(3); 579 } else { 580 c = '0'; 581 } 582 if (m.length > 3) { 583 m = m.slice(3); 584 } else { 585 m = '0'; 586 } 587 if (y.length > 3) { 588 y = y.slice(3); 589 } else { 590 y = '0'; 591 } 592 if (k.length > 3) { 593 k = k.slice(3); 594 } else { 595 k = '0'; 596 } 597 return `c:${c} m:${m} y:${y} k:${k}`; 598} */ 599 600 601 602 603 /* color chart scripts */ 604 function colorChart() { 605 if ($('body').hasClass('page-color-chart')) { 606 //$('body').append('<template id="holder" class="d-none"><textarea id="all-css"></textarea></template>'); 607 var allCSS = ""; 608 $('div.color-col').each(function(){ 609 var varName = $(this).children('div.spec').children('span.var-name').text(); 610 var hslValue = $(this).data('hsl') 611 var hslCode = 'hsl(' + hslValue + ' / 1)'; 612 var hslStr = hslValue.replaceAll("%", "").replaceAll(" ", ","); 613 var hslArr = hslStr.split(',').map(Number); 614 var h = hslArr[0]; 615 var s = hslArr[1]; 616 var l = hslArr[2]; 617 var rgbCode = HSLtoRGB(h,s,l); 618 //var rgbShort = rgbCode.replace(/^rgb/, ''); 619 //var rgbNumerals = rgbShort.replace('(', ''); 620 //var rgbNumeralsOnly = rgbNumerals.replace(')', ''); 621 var rgbValues = extractRGBvalues(rgbCode); 622 //var cmykValues = rgb2cmyk(rgbValues); 623 var hexValue = HEXfromHSL(h,s,l) 624 var cmykValues = hexTOcmyk(hexValue); 625 //var cmykValues = shortenedCMYK(cmykValues); 626 var hexColor = ""; 627 if ($(this).children('div.spec').children('span.hsl').is(':empty')) { 628 $(this).children('div.spec').children('span.hsl').text(hslCode); 629 } 630 if ($(this).children('div.swatch').attr('style')===undefined) { 631 $(this).children('div.swatch').attr('style', 'background-color:' + hslCode + ';'); 632 } 633 //$(this).children('div.spec').append('<span class="rgb"></span>'); 634 if ( !$(this).children('div.spec').children('span.alt-var-name').length ) { 635 $(this).children('div.spec').append('<span class="alt-var-name"> </span>'); 636 } 637 $(this).children('div.spec').append('<span class="cmyk"></span>'); 638 $(this).children('div.spec').children('span.hex').text(HEXfromHSL(h,s,l)); 639 if ( $(this).children('div.spec').children('span.hex').length ) { 640 hexColor = $(this).children('div.spec').children('span.hex').text(); 641 } 642 if ( $(this).children('div.spec').children('span.hex-provided').length ) { 643 hexColor = $(this).children('div.spec').children('span.hex-provided').text(); 644 } 645 $(this).children('div.spec').children('span.rgb').text('rgb(' + rgbValues + ')'); 646 $(this).children('div.spec').children('span.cmyk').text(cmykValues); 647 648 var cssCode = '--color-'+varName+': '+ hslCode +'; /* '+hexColor+' */'; 649 allCSS += cssCode+'\n'; 650 }); 651 $('body').append('<template id="holder" class="d-none"><textarea id="all-css-area">'+allCSS+'</textarea></template>'); 652 const template = document.getElementById('holder'); 653 const clone = template.content.cloneNode(true); 654 $('button#get-code').click(function(){ 655 //console.log(allCSS); 656 $('#colorchartModal .variables').append(clone);
657 $('button.select-all').click(function() { 658 var $this = $('#all-css-area'); 659 $this.select(); 660 // Work around Chrome's little problem 661 $this.mouseup(function() { 662 // Prevent further mouseup intervention 663 $this.unbind("mouseup"); 664 return false; 665 }); 666 }); 667 return; 668 }); 669 } 670 console.log( rgb2cmyk(0,100,107) ); 671 } 672 colorChart(); 673 674 675 676 /** Plinth */ 677 function plinth() { 678 var dir = $('#colophon div[role="presentation"]').attr('data-inst'); /* passed in footer */ 679 var url = window.location; 680 var base = url.protocol+'//'+url.hostname+'/'; 681 var enter = base+dir+'/wp-login.php'; 682 if ( dir == 'enroute' ) { 683 enter = base+'wp-login.php'; 684 } 685 $('.plinth').click(function() { 686 window.open(enter,'_blank'); 687 }); 688 } 689 plinth(); 690 691}); 692 693/** jQuery Plugins below this point ============================ */ 694/*! 695 * hoverIntent v1.8.0 // 2014.06.29 // jQuery v1.9.1+ 696 * http://cherne.net/brian/resources/jquery.hoverIntent.html 697 * 698 * You may use hoverIntent under the terms of the MIT license. Basically that 699 * means you are free to use hoverIntent as long as this header is left intact. 700 * Copyright 2007, 2014 Brian Cherne 701 * 702 * Basically an improved version of jQuery's hover method. 703 * See author URL for useage details. 704 */ 705(function($){$.fn.hoverIntent=function(handlerIn,handlerOut,selector){var cfg={interval:100,sensitivity:6,timeout:0};if(typeof handlerIn==="object"){cfg=$.extend(cfg,handlerIn)}else{if($.isFunction(handlerOut)){cfg=$.extend(cfg,{over:handlerIn,out:handlerOut,selector:selector})}else{cfg=$.extend(cfg,{over:handlerIn,out:handlerIn,selector:handlerOut})}}var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if(Math.sqrt((pX-cX)*(pX-cX)+(pY-cY)*(pY-cY))<cfg.sensitivity){$(ob).off("mousemove.hoverIntent",track);ob.hoverIntent_s=true;return cfg.over.apply(ob,[ev])}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=false;return cfg.out.apply(ob,[ev])};var handleHover=function(e){var ev=$.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t)}if(e.type==="mouseenter"){pX=ev.pageX;pY=ev.pageY;$(ob).on("mousemove.hoverIntent",track);if(!ob.hoverIntent_s){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}}else{$(ob).off("mousemove.hoverIntent",track);if(ob.hoverIntent_s){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob)},cfg.timeout)}}};return this.on({"mouseenter.hoverIntent":handleHover,"mouseleave.hoverIntent":handleHover},cfg.selector)}})(jQuery); 706/** 707* jquery-input-mask-phone-number 1.0.14 708* Licensed (The MIT License) 709* Copyright Raja Rama Mohan Thavalam <[email protected]> 710* Last Updated On: 22/Aug/2020 IST 12:05 AM 711* see: https://github.com/rajaramtt/jquery-input-mask-phone-number 712* see: https://www.npmjs.com/package/jquery-input-mask-phone-number 713*/ 714!function(h){h.fn.usPhoneFormat=function(e){e=h.extend({format:"xxx-xxx-xxxx",international:!1},e);"xxx-xxx-xxxx"===e.format?(h(this).bind("paste",function(e){e.preventDefault();e=(e=e.originalEvent&&e.originalEvent.clipboardData.getData("Text")).replace(/\D/g,"");if(!h.isNumeric(e))return!1;e=9<e.length?String(e.replace(/(\d{3})(\d{3})(\d{4})/,"$1-$2-$3")):String(e.replace(/(\d{3})(?=\d)/g,"$1-")),h(this).val(e),h(this).val(""),e=e.substring(0,12),h(this).val(e)}),h(this).on("keydown touchend",function(e){var t=(e=e||window.event).which||e.keyCode,i=e.ctrlKey||17===t;if(!(86==t&&i||67==t&&i||88==t&&i))if(65==t&&i)h(this).trigger("paste");else if(!(9==t||8==e.which||0==e.which||96<=e.keyCode&&e.keyCode<=105||48<=e.keyCode&&e.keyCode<=57))return!1;i=this.value.length,t=h(this).val();(3==i&&8!=e.which&&0!=e.which||7==i&&8!=e.which&&0!=e.which)&&h(this).val(t+"-"),h(this).attr("maxlength","12")})):"(xxx) xxx-xxxx"===e.format&&(h(this).on("keydown touchend",function(e){var t=(e=e||window.event).which||e.keyCode,i=e.ctrlKey||17===t;if(!(86==t&&i||67==t&&i||88==t&&i))if(65==t&&i)h(this).trigger("paste");
714else if(!(9==t||8==e.which||0==e.which||96<=e.keyCode&&e.keyCode<=105||48<=e.keyCode&&e.keyCode<=57))return!1;i=this.value.length,t=h(this).val();3==i&&8!=e.which&&0!=e.which?h(this).val("("+t+") "):9==i&&8!=e.which&&0!=e.which&&h(this).val(t+"-"),h(this).attr("maxlength","14")}),h(this).bind("paste",function(e){e.preventDefault();e=(e=e.originalEvent&&e.originalEvent.clipboardData.getData("Text")).replace(/\D/g,"");if(!h.isNumeric(e))return!1;9<e.length?e=String(e.replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3")):6<e.length?e=String(e.replace(/(\d{3})(\d{3})(?=\d)/g,"($1) $2-")):3<e.length&&(e=String(e.replace(/(\d{3})(?=\d)/g,"($1) "))),h(this).val(e),h(this).val(""),e=e.substring(0,14),h(this).val(e)}))}}(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.