1"use strict"; 2 3/************************************** 4CANON GLOBAL FUNCTIONS 5 6 isHandHeld 7 GetBrowserSize 8 hexToRgb 9 hexToRgbString 10 rgbToHex 11 12***************************************/ 13 14 jQuery.GlobalFunctions = { 15 16 /************************************** 17 isHandHeld 18 ***************************************/ 19 20 isHandHeld: function () { 21 if( /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ) { 22 return true; 23 } else { 24 return false; 25 } 26 }, 27 28 /************************************************************* 29 GetBrowserSize 30 *************************************************************/ 31 32 GetBrowserSize: function () { 33 $ = jQuery; 34 var size = new Array(); 35 36 // Get the dimensions of the viewport 37 size['width'] = $(window).width(); 38 size['height'] = $(window).height(); 39 40 return size; 41 42 }, 43 44 /************************************************************* 45 hexToRgb 46 *************************************************************/ 47 48 hexToRgb: function (hex) { 49 // Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF") 50 var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; 51 hex = hex.replace(shorthandRegex, function(m, r, g, b) { 52 return r + r + g + g + b + b; 53 }); 54 55 var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); 56 return result ? { 57 r: parseInt(result[1], 16), 58 g: parseInt(result[2], 16), 59 b: parseInt(result[3], 16) 60 } : null; 61 }, 62 63 /************************************************************* 64 hexToRgbString 65 *************************************************************/ 66 67 hexToRgbString: function (hex) { 68 $rawRgb = jQuery.GlobalFunctions.hexToRgb(hex); 69 var returnString = "rgb("; 70 returnString = returnString + $rawRgb.r + ","; 71 returnString = returnString + $rawRgb.g + ","; 72 returnString = returnString + $rawRgb.b + ")"; 73 74 return returnString; 75 }, 76 77 /************************************************************* 78 hexOpacityToRgbaString 79 *************************************************************/ 80 81 hexOpacityToRgbaString: function (hex, opacity) { 82 var $rawRgb = jQuery.GlobalFunctions.hexToRgb(hex); 83 var returnString = "rgba("; 84 returnString = returnString + $rawRgb.r + ","; 85 returnString = returnString + $rawRgb.g + ","; 86 returnString = returnString + $rawRgb.b + ","; 87 returnString = returnString + opacity + ")"; 88 89 return returnString; 90 }, 91 92 /************************************************************* 93 rgbToHex 94 *************************************************************/ 95 96 componentToHex: function (c) { 97 var hex = c.toString(16); 98 return hex.length == 1 ? "0" + hex : hex; 99 }, 100 101 rgbToHex: function (r, g, b) { 102 return "#" + jQuery.GlobalFunctions.componentToHex(r) + jQuery.GlobalFunctions.componentToHex(g) + jQuery.GlobalFunctions.componentToHex(b); 103 }, 104 105 106 107 }; // end jquery.insfunctions 108 109
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.