/Docs/minko-docs/asdoc.js

https://bitbucket.org/HopeSky/mars_nd2d · JavaScript · 286 lines · 265 code · 8 blank · 13 comment · 213 complexity · 0fcd6c15afc00f2f21f42d14ab5dacdd MD5 · raw file

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