1 ZoomText = (function () { 2 function ZoomText() { 3 this._initialize(); 4 } 5 6 ZoomText.prototype = { 7 8 // -------------------------------------------- 9 // Constants 10 // -------------------------------------------- 11 KEY_CODE_SPACE: 32, 12 KEY_CODE_ENTER: 13, 13 14 // -------------------------------------------- 15 // Properties 16 // -------------------------------------------- 17 18 _zoom: null, 19 _$plusText: null, 20 _$minusText: null, 21 22 // -------------------------------------------- 23 // Initialization 24 // -------------------------------------------- 25 26 _initialize: function () { 27 this._initializeZoomLevel(); 28 this._initializeDom(); 29 this._attachEvents(); 30 }, 31 32 _initializeZoomLevel: function () { 33 this._zoom = 100; 34 var cookies = document.cookie.split(';'); 35 for (var i = 0; i < cookies.length; i++) { 36 var c = cookies[i]; 37 while (c.charAt(0) == ' ') { 38 c = c.substring(1, c.length); 39 } 40 if (c.indexOf("CustomZoom") == 0 && parseFloat(c.substring(11, c.length)) > 100) { 41 this._zoom = parseFloat(c.substring(11, c.length)); 42 this._updateZoom(); 43 } 44 } 45 }, 46 47 _initializeDom: function () { 48 this._$plusText = $('#plusText'); 49 this._$minusText = $('#minusText'); 50 }, 51 52 _attachEvents: function () { 53 this._$plusText.on('click', $.proxy(this._handlePlusButtonClick, this)); 54 this._$plusText.on('keyup', $.proxy(this._handlePlusButtonKeyUp, this)); 55 this._$minusText.on('click', $.proxy(this._handleMinusButtonClick, this)); 56 this._$minusText.on('keyup', $.proxy(this._handleMinusButtonKeyUp, this)); 57 }, 58 59 // -------------------------------------------- 60 // Private Methods 61 // -------------------------------------------- 62 _handlePlusButtonClick: function (event) { 63 this._zoomIn(); 64 }, 65 66 _handlePlusButtonKeyUp: function (event) { 67 event.preventDefault(); 68 if (event.which === this.KEY_CODE_SPACE || event.which === this.KEY_CODE_ENTER) { 69 this._zoomIn(); 70 } 71 }, 72 73 _zoomIn: function () { 74 if (this._zoom < 170) { 75 this._zoom += 10; 76 this._updateZoom(); 77 } 78 }, 79 80 _handleMinusButtonClick: function (event) { 81 this._zoomOut(); 82 }, 83 84 _handleMinusButtonKeyUp: function (event) { 85 event.preventDefault(); 86 if (event.which === this.KEY_CODE_SPACE || event.which === this.KEY_CODE_ENTER) { 87 this._zoomOut(); 88 } 89 }, 90 91 _zoomOut: function () { 92 if (this._zoom > 100) { 93 this._zoom -= 10; 94 this._updateZoom(); 95 } 96 }, 97 98 _updateZoom: function () { 99 $("body").css("transform", "translate(0, " + (((this._zoom / 100) - 1) * 50) + "%) scale(" + (this._zoom / 100) + ")"); 100 document.cookie = "CustomZoom=" + this._zoom + "; path=/"; 101 $("#txtAdjust").html(this._zoom + "%"); 102 $("body").css("overflowX", "hidden"); 103 } 104 }; 105 106 return ZoomText; 107 })();
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.