PageRenderTime 269ms CodeModel.GetById 101ms app.highlight 48ms RepoModel.GetById 113ms app.codeStats 0ms

/flash/MP3FileReferenceLoaderLib/asdoc-output/asdoc.js

http://echo-nest-remix.googlecode.com/
JavaScript | 273 lines | 227 code | 33 blank | 13 comment | 172 complexity | 65cb40f75a8cc558b0d7599d6f24cefc MD5 | raw file
  1////////////////////////////////////////////////////////////////////////////////
  2//
  3//  ADOBE SYSTEMS INCORPORATED
  4//  Copyright 2006-2007 Adobe Systems Incorporated
  5//  All Rights Reserved.
  6//
  7//  NOTICE: Adobe permits you to use, modify, and distribute this file
  8//  in accordance with the terms of the license agreement accompanying it.
  9//
 10////////////////////////////////////////////////////////////////////////////////
 11
 12var ECLIPSE_FRAME_NAME = "ContentViewFrame";
 13var eclipseBuild = false;
 14var liveDocsBaseUrl = "http://livedocs.macromedia.com/flex/2/langref/";
 15
 16function findObject(objId) {
 17	if (document.getElementById)
 18		return document.getElementById(objId);
 19
 20	if (document.all)
 21		return document.all[objId];
 22}
 23
 24function isEclipse() {
 25	return eclipseBuild;
 26//	return (window.name == ECLIPSE_FRAME_NAME) || (parent.name == ECLIPSE_FRAME_NAME) || (parent.parent.name == ECLIPSE_FRAME_NAME);
 27}
 28
 29function configPage() {
 30	if (isEclipse()) {
 31		if (window.name != "classFrame")
 32		{
 33			var localRef = window.location.href.indexOf('?') != -1 ? window.location.href.substring(0, window.location.href.indexOf('?')) : window.location.href;
 34			localRef = localRef.substring(localRef.indexOf("langref/") + 8);
 35			if (window.location.search != "")
 36				localRef += ("#" + window.location.search.substring(1));
 37
 38			window.location.replace(baseRef + "index.html?" + localRef);
 39			return;
 40		}
 41		else
 42		{
 43			setStyle(".eclipseBody", "display", "block");
 44//			var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
 45//			if (isIE == false && window.location.hash != "")
 46			if (window.location.hash != "")
 47				window.location.hash=window.location.hash.substring(1);
 48		}
 49	}
 50	else if (window == top) { // no frames
 51		findObject("titleTable").style.display = "";
 52	}
 53	else { // frames
 54		findObject("titleTable").style.display = "none";
 55	}
 56	showTitle(asdocTitle);
 57}
 58
 59function loadFrames(classFrameURL, classListFrameURL) {
 60	var classListFrame = findObject("classListFrame");
 61	if(classListFrame != null && classListFrameContent!='')
 62		classListFrame.document.location.href=classListFrameContent;
 63 
 64	if (isEclipse()) {
 65		var contentViewFrame = findObject(ECLIPSE_FRAME_NAME);
 66		if (contentViewFrame != null && classFrameURL != '')
 67			contentViewFrame.document.location.href=classFrameURL;
 68	}
 69	else {
 70		var classFrame = findObject("classFrame");
 71		if(classFrame != null && classFrameContent!='')
 72			classFrame.document.location.href=classFrameContent;
 73	}
 74}
 75
 76function showTitle(title) {
 77	if (!isEclipse())
 78		top.document.title = title;
 79}
 80
 81function loadClassListFrame(classListFrameURL) {
 82	if (parent.frames["classListFrame"] != null) {
 83		parent.frames["classListFrame"].location = classListFrameURL;
 84	}
 85	else if (parent.frames["packageFrame"] != null) {
 86		if (parent.frames["packageFrame"].frames["classListFrame"] != null) {
 87			parent.frames["packageFrame"].frames["classListFrame"].location = classListFrameURL;
 88		}
 89	}
 90}
 91
 92function gotoLiveDocs(primaryURL, secondaryURL) {
 93	var url = liveDocsBaseUrl + "index.html?" + primaryURL;
 94	if (secondaryURL != null && secondaryURL != "")
 95		url += ("&" + secondaryURL);
 96	window.open(url, "mm_livedocs", "menubar=1,toolbar=1,status=1,scrollbars=1");
 97}
 98
 99function findTitleTableObject(id)
100{
101	if (isEclipse())
102		return parent.titlebar.document.getElementById(id);
103	else if (top.titlebar)
104		return top.titlebar.document.getElementById(id);
105	else
106		return document.getElementById(id);
107}
108
109function titleBar_setSubTitle(title)
110{
111	if (isEclipse() || top.titlebar)
112		findTitleTableObject("subTitle").childNodes.item(0).data = title;
113}
114
115function titleBar_setSubNav(showConstants,showProperties,showStyles,showEffects,showEvents,showConstructor,showMethods,showExamples,
116				showPackageConstants,showPackageProperties,showPackageFunctions,showInterfaces,showClasses,showPackageUse)
117{
118	if (isEclipse() || top.titlebar)
119	{
120		findTitleTableObject("propertiesLink").style.display = showProperties ? "inline" : "none";
121		findTitleTableObject("propertiesBar").style.display = (showProperties && (showPackageProperties || showConstructor || showMethods || showPackageFunctions || showEvents || showStyles || showEffects || showConstants || showPackageConstants || showInterfaces || showClasses || showPackageUse || showExamples)) ? "inline" : "none";
122
123		findTitleTableObject("packagePropertiesLink").style.display = showPackageProperties ? "inline" : "none";
124		findTitleTableObject("packagePropertiesBar").style.display = (showPackageProperties && (showConstructor || showMethods || showPackageFunctions || showEvents || showStyles || showConstants || showEffects || showPackageConstants || showInterfaces || showClasses || showPackageUse || showExamples)) ? "inline" : "none";
125
126		findTitleTableObject("constructorLink").style.display = showConstructor ? "inline" : "none";
127		findTitleTableObject("constructorBar").style.display = (showConstructor && (showMethods || showPackageFunctions || showEvents || showStyles || showEffects || showConstants || showPackageConstants || showInterfaces || showClasses || showPackageUse || showExamples)) ? "inline" : "none";
128
129		findTitleTableObject("methodsLink").style.display = showMethods ? "inline" : "none";
130		findTitleTableObject("methodsBar").style.display = (showMethods && (showPackageFunctions || showEvents || showStyles || showEffects || showConstants || showPackageConstants || showInterfaces || showClasses || showPackageUse || showExamples)) ? "inline" : "none";
131
132		findTitleTableObject("packageFunctionsLink").style.display = showPackageFunctions ? "inline" : "none";
133		findTitleTableObject("packageFunctionsBar").style.display = (showPackageFunctions && (showEvents || showStyles || showEffects || showConstants || showPackageConstants || showInterfaces || showClasses || showPackageUse || showExamples)) ? "inline" : "none";
134
135		findTitleTableObject("eventsLink").style.display = showEvents ? "inline" : "none";
136		findTitleTableObject("eventsBar").style.display = (showEvents && (showStyles || showEffects || showConstants || showPackageConstants || showInterfaces || showClasses || showPackageUse || showExamples)) ? "inline" : "none";
137
138		findTitleTableObject("stylesLink").style.display = showStyles ? "inline" : "none";
139		findTitleTableObject("stylesBar").style.display = (showStyles && (showEffects || showConstants || showPackageConstants || showInterfaces || showClasses || showPackageUse || showExamples)) ? "inline" : "none";
140
141		findTitleTableObject("effectsLink").style.display = showEffects ? "inline" : "none";
142		findTitleTableObject("effectsBar").style.display = (showEffects && (showConstants || showPackageConstants || showInterfaces || showClasses || showPackageUse || showExamples)) ? "inline" : "none";
143
144		findTitleTableObject("constantsLink").style.display = showConstants ? "inline" : "none";
145		findTitleTableObject("constantsBar").style.display = (showConstants && (showPackageConstants || showInterfaces || showClasses || showPackageUse || showExamples)) ? "inline" : "none";
146
147		findTitleTableObject("packageConstantsLink").style.display = showPackageConstants ? "inline" : "none";
148		findTitleTableObject("packageConstantsBar").style.display = (showPackageConstants && (showInterfaces || showClasses || showPackageUse || showExamples)) ? "inline" : "none";
149
150		findTitleTableObject("interfacesLink").style.display = showInterfaces ? "inline" : "none";
151		findTitleTableObject("interfacesBar").style.display = (showInterfaces && (showClasses || showPackageUse || showExamples)) ? "inline" : "none";
152
153		findTitleTableObject("classesLink").style.display = showClasses ? "inline" : "none";
154		findTitleTableObject("classesBar").style.display = (showClasses && (showPackageUse || showExamples)) ? "inline" : "none";
155
156		findTitleTableObject("packageUseLink").style.display = showPackageUse ? "inline" : "none";
157		findTitleTableObject("packageUseBar").style.display = (showPackageUse && showExamples) ? "inline" : "none";
158
159		findTitleTableObject("examplesLink").style.display = showExamples ? "inline" : "none";
160	}
161}
162
163function titleBar_gotoClassFrameAnchor(anchor)
164{
165	if (isEclipse())
166		parent.classFrame.location = parent.classFrame.location.toString().split('#')[0] + "#" + anchor;
167	else
168		top.classFrame.location = top.classFrame.location.toString().split('#')[0] + "#" + anchor;
169}
170
171function setMXMLOnly() 
172{
173	if (getCookie("showMXML") == "false")
174	{
175		toggleMXMLOnly();
176	}
177}
178function toggleMXMLOnly() 
179{
180	var mxmlDiv = findObject("mxmlSyntax");
181	var mxmlShowLink = findObject("showMxmlLink");
182	var mxmlHideLink = findObject("hideMxmlLink");
183	if (mxmlDiv && mxmlShowLink && mxmlHideLink)
184	{
185		if (mxmlDiv.style.display == "none")
186		{
187			mxmlDiv.style.display = "block";
188			mxmlShowLink.style.display = "none";
189			mxmlHideLink.style.display = "inline";
190			setCookie("showMXML","true", new Date(3000,1,1,1,1), "/", document.location.domain);
191		}
192		else
193		{
194			mxmlDiv.style.display = "none";
195			mxmlShowLink.style.display = "inline";
196			mxmlHideLink.style.display = "none";
197			setCookie("showMXML","false", new Date(3000,1,1,1,1), "/", document.location.domain);
198		}
199	}
200}
201
202function showHideInherited()
203{	
204	setInheritedVisible(getCookie("showInheritedConstant") == "true", "Constant");
205	setInheritedVisible(getCookie("showInheritedProtectedConstant") == "true", "ProtectedConstant");
206	setInheritedVisible(getCookie("showInheritedProperty") == "true", "Property");
207	setInheritedVisible(getCookie("showInheritedProtectedProperty") == "true", "ProtectedProperty");
208	setInheritedVisible(getCookie("showInheritedMethod") == "true", "Method");
209	setInheritedVisible(getCookie("showInheritedProtectedMethod") == "true", "ProtectedMethod");
210	setInheritedVisible(getCookie("showInheritedEvent") == "true", "Event");
211	setInheritedVisible(getCookie("showInheritedStyle") == "true", "Style");
212	setInheritedVisible(getCookie("showInheritedEffect") == "true", "Effect");
213}
214function setInheritedVisible(show, selectorText)
215{
216	if (document.styleSheets[0].cssRules != undefined)
217	{
218		var rules = document.styleSheets[0].cssRules;
219		for (var i = 0; i < rules.length; i++)
220		{
221			if (rules[i].selectorText == ".hideInherited" + selectorText)
222				rules[i].style.display = show ? "" : "none";
223				
224			if (rules[i].selectorText == ".showInherited" + selectorText)
225				rules[i].style.display = show ? "none" : "";
226		}
227	}
228	else
229	{
230		document.styleSheets[0].addRule(".hideInherited" + selectorText, show ? "display:inline" : "display:none");
231		document.styleSheets[0].addRule(".showInherited" + selectorText, show ? "display:none" : "display:inline");
232	}
233	setCookie("showInherited" + selectorText, show ? "true" : "false", new Date(3000,1,1,1,1), "/", document.location.domain);
234	setRowColors(show, selectorText);
235}
236
237function setRowColors(show, selectorText)
238{
239	var rowColor = "#F2F2F2";
240	var table = findObject("summaryTable" + selectorText);
241	if (table != null)
242	{
243		var rowNum = 0;
244		for (var i = 1; i < table.rows.length; i++)
245		{
246			if (table.rows[i].className.indexOf("hideInherited") == -1 || show)
247			{
248				rowNum++;
249				table.rows[i].bgColor = (rowNum % 2 == 0) ? rowColor : "#FFFFFF";
250			}			
251		}
252	}
253}
254
255function setStyle(selectorText, styleName, newValue)
256{
257	if (document.styleSheets[0].cssRules != undefined)
258	{
259		var rules = document.styleSheets[0].cssRules;
260		for (var i = 0; i < rules.length; i++)
261		{
262			if (rules[i].selectorText == selectorText)
263			{
264				rules[i].style[styleName] = newValue;
265				break;
266			}
267		}
268	}
269	else
270	{
271		document.styleSheets[0].addRule(selectorText, styleName + ":" + newValue);
272	}
273}