1/* 2 * To change this license header, choose License Headers in Project Properties. 3 * To change this template file, choose Tools | Templates 4 * and open the template in the editor. 5 */ 6 7(function ($, Drupal, window, document, undefined) { 8 // To understand behaviors, see https://drupal.org/node/756722#behaviors 9 Drupal.behaviors.ws_textresize = { 10 attach: function (context, settings) { 11 12 var ws_textresize = settings.ws_textresize; 13 var current = ws_textresize.base; 14 if(getCookie('ws_textresize')){ 15 current = getCookie('ws_textresize'); 16 $(ws_textresize.scope).css('font-size', current+'px'); 17 if(getCookie('ws_textresize') < ws_textresize.base){ 18 highlightButton('.resize-less'); 19 } 20 if(getCookie('ws_textresize') > ws_textresize.base){ 21 highlightButton('.resize-more'); 22 } 23 } 24 25 $('.resize-less', '.ws-textresize').on('click', function(){ 26 if(current - ws_textresize.step >= ws_textresize.min){ 27 current = parseInt(current) - parseInt(ws_textresize.step); 28 $(ws_textresize.scope).css('font-size', current+'px'); 29 setCookie('ws_textresize', current, 0); 30 highlightButton('.resize-less'); 31 } 32 }); 33 34 $('.resize-more', '.ws-textresize').on('click', function(){ 35 if(current + ws_textresize.step <= ws_textresize.max){ 36 current = parseInt(current) + parseInt(ws_textresize.step); 37 $(ws_textresize.scope).css('font-size', current+'px'); 38 setCookie('ws_textresize', current, 0); 39 highlightButton('.resize-more'); 40 } 41 }); 42 43 function highlightButton(classname){ 44 $('.link-resize', '.ws-textresize').removeClass('active'); 45 $('.reset-resize', '.ws-textresize').remove(); 46 $('.ws-textresize').removeClass('active'); 47 if(current < ws_textresize.base && current != ws_textresize.base){ 48 $('.resize-less', '.ws-textresize').addClass('active'); 49 $('.ws-textresize').addClass('active'); 50 } 51 if(current > ws_textresize.base && current != ws_textresize.base){ 52 $('.resize-more', '.ws-textresize').addClass('active'); 53 $('.ws-textresize').addClass('active'); 54 } 55 } 56 57 function setCookie(cname, cvalue, exdays) { 58 if(exdays == 0){ 59 document.cookie = cname + "=" + cvalue + ";path=/"; 60 } 61 else{ 62 var d = new Date(); 63 d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); 64 var expires = "expires=" + d.toUTCString(); 65 document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; 66 } 67 } 68 69 function getCookie(cname) { 70 var name = cname + "="; 71 var decodedCookie = decodeURIComponent(document.cookie); 72 var ca = decodedCookie.split(';'); 73 for (var i = 0; i < ca.length; i++) { 74 var c = ca[i]; 75 while (c.charAt(0) == ' ') { 76 c = c.substring(1); 77 } 78 if (c.indexOf(name) == 0) { 79 return c.substring(name.length, c.length); 80 } 81 } 82 return ""; 83 } 84 85 } 86 }; 87})(jQuery, Drupal, this, this.document);
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.