1"use strict"; 2var count = 0; 3 4String.prototype.beginsWith = function (string) { 5 return(this.indexOf(string) === 0); 6}; 7 8String.prototype.endsWith = function(string) { 9var end = this.substring((this.length - string.length), this.length); 10return (end === string); 11}; 12 13function colorToHex(color) { 14 if (color.substr(0, 1) === '#') { 15 return color; 16 } 17 var digits = /(.*?)rgb\((\d+), (\d+), (\d+)\)/.exec(color); 18 19 var red = parseInt(digits[2]); 20 var green = parseInt(digits[3]); 21 var blue = parseInt(digits[4]); 22 23 var rgb = blue | (green << 8) | (red << 16); 24 return digits[1] + '#' + rgb.toString(16); 25}; 26 27function isChecked(element) { 28 var isChecked = false; 29 $.each(element.get(0).attributes, function(index, attr) { 30 var name = attr.nodeName; 31 if(name == "checked") { 32 isChecked = true; 33 } 34 }); 35 return isChecked; 36} 37 38$(document).ready(function(){ 39 $("input[type='radio']").each(function(){ 40 var inputEle = $(this); 41 inputEle.click(setBackgroundColor); 42 }); 43}); 44 45function setBackgroundColor(ev) { 46 var srcElement = $(ev.target); 47 var color = srcElement.attr("onclickColor").toLowerCase(); 48 var oldColor = colorToHex(srcElement.parent().css("background-color")); 49 srcElement.parent().css("background-color",color); 50 if(oldColor != color) { 51 var hasChecked = isChecked(srcElement); 52 if(hasChecked) { 53 count--; 54 } else { 55 count++; 56 } 57 } 58 if(count == 0) { 59 $("input[name='save']").each(function(){ 60 var saveBtn = $(this); 61 saveBtn.css("background-image",""); 62 var text = saveBtn.attr("value"); 63 if(text.endsWith(" !")) { 64 saveBtn.attr("value",text.substr(0,text.length-2)); 65 } 66 }); 67 } else { 68 $("input[name='save']").each(function(){ 69 var saveBtn = $(this); 70 saveBtn.css("background-image","url('/HISinOne/images/icons/submit_active_red.gif')"); 71 var text = saveBtn.attr("value"); 72 if(!text.endsWith(" !")) { 73 saveBtn.attr("value",text + " !"); 74 } 75 }); 76 } 77}
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.