PageRenderTime 32ms CodeModel.GetById 13ms app.highlight 16ms RepoModel.GetById 1ms app.codeStats 0ms

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