PageSourceSearch

https://franklincountyva.gov/Assets/Scripts/StylesheetManager.js

js franklincountyva.gov collected 2026-10-03 17:35:40 UTC 2,389 bytes, 92 lines download raw bytes

1function StylesheetManagerClass(styleSheetID) {
2	if (styleSheetID == null) {
3		throw 'styleSheetID is required';
4	}
5
6	this.styleSheetID = styleSheetID;
7	this.cssClasses = [];
8}
9
10StylesheetManagerClass.prototype.saveStylesheet = function () {
11	var styleSheet = document.getElementById(this.styleSheetID);
12	if (styleSheet == null) {
13		styleSheet = document.createElement('style');
14		styleSheet.id = this.styleSheetID;
15		styleSheet.setAttribute('type', 'text/css');
16		var head = document.getElementsByTagName('head')[0];
17		head.appendChild(styleSheet);
18	}
19	if (styleSheet.styleSheet) {
20		styleSheet.styleSheet.cssText = this.assembleStyles(); //IE only
21	} else {
22		styleSheet.innerHTML = this.assembleStyles();
23	}
24};
25
26StylesheetManagerClass.prototype.addClass = function (selector) {
27	if (selector == null) {
28		throw 'selector is required';
29	}
30
31	var cssClass = new CssClass(selector);
32	this.cssClasses.push(cssClass);
33	return cssClass;
34};
35
36StylesheetManagerClass.prototype.getOrAddClass = function (selector) {
37	if (selector == null) {
38		throw 'selector is required';
39	}
40
41	for (var i = 0; i < this.cssClasses.length; i++) {
42		if (selector === this.cssClasses[i].selector) {
43			return this.cssClasses[i];
44		}
45	}
46	return this.addClass(selector);
47};
48
49StylesheetManagerClass.prototype.assembleStyles = function () {
50	var styleString = '';
51
52	for (var index = 0; index < this.cssClasses.length; index++) {
53		var cssClass = this.cssClasses[index];
54		styleString += ' ' + cssClass.selector + ' { ';
55		for (var jndex = 0; jndex < cssClass.styles.length; jndex++) {
56			var style = cssClass.styles[jndex];
57			styleString += style.name + ' : ' + style.value + '; ';
58		}
59		styleString += ' } ';
60	}
61
62	return styleString;
63};
64
65function CssClass(selector) {
66	this.selector = selector;
67	this.styles = [];
68}
69
70CssClass.prototype.addStyle = function (name, value) {
71	if (name == null) {
72		throw 'name is required';
73	}
74	if (value == null) {
75		throw 'value is required';
76	}
77	var style = { name: name, value: value };
78	this.styles.push(style);
79	return style;
80};
81
82CssClass.prototype.getOrAddStyle = function (name) {
83	if (name == null) {
84		throw 'name is required';
85	}
86	for (var i = 0; i < this.styles.length; i++) {
87		if (name === this.styles[i].name) {
88			return this.styles[i];
89		}
90	}
91	return this.addStyle(name, '');
92};

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.