/docs/asdoc.js

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