-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathSystem.Web.UI.debug.js
More file actions
74 lines (69 loc) · 2.51 KB
/
System.Web.UI.debug.js
File metadata and controls
74 lines (69 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//=============================================================================
// Jocys.com JavaScript.NET Classes (In C# Object Oriented Style)
// Created by Evaldas Jocys <evaldas@jocys.com>
//=============================================================================
/// <reference path="System.debug.js" />
//=============================================================================
// Namespaces
//-----------------------------------------------------------------------------
// <PropertyGroup>
// <RootNamespace>System.Web.UI</RootNamespace>
// <PropertyGroup>
//-----------------------------------------------------------------------------
System.Type.RegisterNamespace("System.Web.UI.Css");
//=============================================================================
System.Web.UI.Css.GetRules = function (context) {
/// <summary>
/// Get CSS rules from all style sheets.
/// </summary>
/// <returns>void</returns>
var doc = context ? context : document;
for (var s = 0; s < doc.styleSheets.length; s++) {
var styleSheet = doc.styleSheets.item(s);
for (var r = 0; r < styleSheet.rules.length; r++) {
var rule = styleSheet.rules.item(r);
doc[rule.selectorText] = rule.style.cssText;
}
}
return {};
};
System.Web.UI.Css.GetCssText = function (selectorText, context) {
/// <summary>
/// Get CSS Text by Selector Text (className).
/// </summary>
/// <returns>void</returns>
var text = "";
var doc = context ? context : document;
for (var s = 0; s < doc.styleSheets.length; s++) {
var styleSheet = doc.styleSheets.item(s);
for (var r = 0; r < styleSheet.rules.length; r++) {
var rule = styleSheet.rules.item(r);
if (rule.selectorText === selectorText) {
text = rule.style.cssText;
break;
}
}
}
return text;
};
System.Web.UI.Css.AddStyleSheet = function (href, context) {
/// <summary>
/// Dynamically add CSS StyleSheet.
/// </summary>
/// <returns>void</returns>
var doc = context ? context : document;
if (doc.createStyleSheet) {
doc.createStyleSheet(href);
} else {
var el = doc.createElement('link');
//var styles = "@import url('"+href+"');";
//el.href='data:text/css,'+escape(styles);
el.href = href;
el.rel = "stylesheet";
el.type = "text/css";
document.getElementsByTagName("head")[0].appendChild(el);
}
};
//==============================================================================
// END
//------------------------------------------------------------------------------