Permalink
Browse files

Template skinning update

  • Loading branch information...
1 parent 96e47c4 commit 85ec667ab820082d97b07dc9e53edbc293ff9db1 @davglass davglass committed Oct 7, 2008
View
@@ -315,6 +315,7 @@ def allprop_sort(x, y):
moduleprops = []
+ classList = []
# class API view
#for i in classes:
@@ -337,6 +338,9 @@ def allprop_sort(x, y):
if const.PRIVATE in c: t.access = const.PRIVATE
elif const.PROTECTED in c: t.access = const.PROTECTED
+ desc = ''
+ if const.DESCRIPTION in c:
+ desc = c[const.DESCRIPTION]
#subclasses
@@ -347,6 +351,9 @@ def allprop_sort(x, y):
t.subclasses = subclasses
+ gName = i.replace('YAHOO.widget.', '');
+ gName = gName.replace('YAHOO.util.', '');
+ classInfo = { const.DESCRIPTION: desc, const.NAME: i, const.GUESSEDNAME: gName, const.EXTENDS: [] }
# Properties/fields
@@ -357,7 +364,7 @@ def allprop_sort(x, y):
for propertykey in keys:
prop = c[const.PROPERTIES][propertykey]
if self.showprivate or const.PRIVATE not in prop:
- propdata = {const.NAME: propertykey, const.HOST: i, const.URL:getUrl(i, propertykey, const.PROPERTY)}
+ propdata = {const.NAME: propertykey, const.HOST: i, const.TYPE: 'property', const.URL:getUrl(i, propertykey, const.PROPERTY)}
transferToDict( const.ACCESS, prop, propdata )
if const.PRIVATE in prop: propdata[const.ACCESS] = const.PRIVATE
@@ -385,7 +392,7 @@ def allprop_sort(x, y):
for methodkey in keys:
method = c[const.METHODS][methodkey]
if self.showprivate or const.PRIVATE not in method:
- methoddata = {const.NAME: methodkey, const.HOST: i, const.URL:getUrl(i, methodkey, const.METHOD)}
+ methoddata = {const.NAME: methodkey, const.HOST: i, const.TYPE: 'method', const.URL:getUrl(i, methodkey, const.METHOD)}
transferToDict( const.ACCESS, method, methoddata )
if const.PRIVATE in method: methoddata[const.ACCESS] = const.PRIVATE
@@ -430,7 +437,7 @@ def allprop_sort(x, y):
for eventkey in keys:
event = c[const.EVENTS][eventkey]
if self.showprivate or const.PRIVATE not in event:
- eventdata = {const.NAME: eventkey, const.HOST: i, const.URL:getUrl(i, eventkey, const.EVENT)}
+ eventdata = {const.NAME: eventkey, const.HOST: i, const.TYPE: 'event', const.URL:getUrl(i, eventkey, const.EVENT)}
transferToDict( const.ACCESS, event, eventdata )
if const.PRIVATE in event: eventdata[const.ACCESS] = const.PRIVATE
@@ -478,7 +485,7 @@ def allprop_sort(x, y):
for configkey in keys:
config = c[const.CONFIGS][configkey]
if self.showprivate or const.PRIVATE not in config:
- configdata = {const.NAME: configkey, const.HOST: i, const.URL:getUrl(i, configkey, const.CONFIG)}
+ configdata = {const.NAME: configkey, const.HOST: i, const.TYPE: 'config', const.URL:getUrl(i, configkey, const.CONFIG)}
transferToDict( const.ACCESS, config, configdata )
if const.PRIVATE in config: configdata[const.ACCESS] = const.PRIVATE
@@ -501,7 +508,7 @@ def allprop_sort(x, y):
configs.append(configdata)
# get inherited data
- inherited = t.inherited = {const.PROPERTIES:{}, const.METHODS:{}, const.EVENTS:{}, const.CONFIGS:{}}
+ inherited = t.inherited = {const.PROPERTIES:{}, const.METHODS:{}, const.EVENTS:{}, const.CONFIGS:{}, const.SUPERCLASS: {} }
if const.EXTENDS in c:
supercname = t.extends = unicode(c[const.EXTENDS])
if supercname in classes:
@@ -514,6 +521,16 @@ def allprop_sort(x, y):
if supercname in classes:
superc = classes[supercname]
getPropsFromSuperclass(superc, classes, inherited)
+
+ #Create the superclass chain and attach it to the classInfo Object
+ extends = {}
+ for i in inherited:
+ for a in inherited[i]:
+ extends[a] = a
+
+ inherited[const.SUPERCLASS] = extends
+ classInfo[const.EXTENDS] = inherited
+ classList.append(classInfo)
# Constructor -- technically the parser can take multiple constructors
# but that does't help here
@@ -537,6 +554,14 @@ def allprop_sort(x, y):
params.append(param)
+ # write module splash
+ moduleprops.sort(allprop_sort)
+ t.allprops_raw = moduleprops
+ moduleprops_json = simplejson.dumps(moduleprops)
+ t.allprops = moduleprops_json
+ classList.sort(allprop_sort)
+ t.classList_raw = classList
+ t.classList = simplejson.dumps(classList)
self.write("%s.html" %(self.classname), t)
# clear out class name
@@ -551,6 +576,7 @@ def allprop_sort(x, y):
# write module splash
moduleprops.sort(allprop_sort)
+ t.allprops_raw = moduleprops
moduleprops_json = simplejson.dumps(moduleprops)
t.allprops = moduleprops_json
View
@@ -1,164 +1,59 @@
(function() {
- var Event=YAHOO.util.Event,Dom=YAHOO.util.Dom,oACDS,oAutoComp;
-
- Cookie = {
-
- set: function(key, val, o){
- o = o||{};
- val = encodeURIComponent(val);
- if (o.domain) {
- val += '; domain=' + o.domain;
- }
- if (o.path) {
- val += '; path=' + o.path;
- }
- if (YAHOO.lang.isNumber(o.duration)) {
- var date = new Date();
- date.setTime(date.getTime() + o.duration*24*60*60*1000);
- val += '; expires=' + date.toGMTString();
- }
- if (o.secure) {
- val += '; secure';
- }
- document.cookie = key + '=' + val;
- },
+ var Event=YAHOO.util.Event,
+ Dom=YAHOO.util.Dom,
+ oACDS, oAutoComp,
+ show = {
+ 'private': false,
+ 'protected': false,
+ 'deprecated': false
+ };
- get: function(key){
- var m = document.cookie.match('(?:^|;)\\s*?' + key + '=([^;]*)');
- return (m) ? decodeURIComponent(m[1]) : null;
- },
-
- remove: function(key){
- return this.set(key, "", {duration: -1});
+Event.onAvailable('yui-classopts-form', function() {
+ //Checkboxes are available..
+ var handleClick = function(e) {
+ var id, checked = false;
+ if (YAHOO.lang.isString(e)) {
+ id = e;
+ } else {
+ var tar = Event.getTarget(e);
+ id = tar.id;
}
- }
-
- var showPrivate=(Cookie.get("showPrivate")=="true");
- var showProtected=(Cookie.get("showProtected")=="true");
- var showDeprecated=(Cookie.get("showDeprecated")=="true");
-
- //alert(Cookie.get("showPrivate"));
- //alert(Cookie.get("showProtected"));
- //var s="",style=(YAHOO.lang.ua.ie)?"":"inherit";
- var s="", style;
-
- style=(showPrivate) ? "inherit" : "none";
- s='#doc3 .private { display:' + style + '; }';
-
- style=(showProtected) ? "inherit" : "none";
- s+='\n#doc3 .protected { display:' + style + '; }';
-
- style=(showDeprecated) ? "inherit" : "none";
- s+='\n#doc3 .deprecated { display:' + style + '; }';
-
- if (s.length > 0) {
- var el=document.createElement("style");
- //el.innerHTML=s;
-
- el.setAttribute("type", "text/css");
- if(el.styleSheet) {
- el.styleSheet.cssText = s;
+ var el = Dom.get(id);
+ checked = el.checked;
+
+ var className = id;
+ if (checked) {
+ show[id.replace('show_', '')] = true;
+ Dom.addClass(document.body, className);
+ YAHOO.util.Cookie.setSub('yuidoc', id, 'checked');
} else {
- var txt = document.createTextNode(s);
- el.appendChild(txt);
+ show[id.replace('show_', '')] = false;
+ Dom.removeClass(document.body, className);
+ YAHOO.util.Cookie.setSub('yuidoc', id, '');
}
+ };
- document.getElementsByTagName("head")[0].appendChild(el);
- }
-
- function showHidePrivate(show) {
- showHide("private", show);
- showPrivate=show;
- Cookie.set("showPrivate", show, 2);
- }
-
- function showHideProtected(show) {
- showHide("protected", show);
- showProtected=show;
- Cookie.set("showProtected", show, 2);
- }
-
- function showHideDeprecated(show) {
- showHide("deprecated", show);
- showDeprecated=show;
- Cookie.set("showDeprecated", show, 2);
- }
-
- function showHide(type, show) {
- var className=(show) ? "": "none";
- var els=Dom.getElementsByClassName(type);
-
- // console.log('showhide ' + type + ', ' + els.length);
-
- for (var i=0,l=els.length;i<l;i=i+1) {
- //try {
- Dom.setStyle(els[i], "display", className);
- //} catch(e) {}
+ var checkCookie = function(id) {
+ var value = YAHOO.util.Cookie.getSub('yuidoc', id),
+ el = Dom.get(id);
+ if (value === 'checked') {
+ el.checked = true;
+ } else {
+ el.checked = false;
}
- }
-
- Event.onAvailable("showprivate", function() {
- var el = Dom.get("showprivate");
- if (el) {
-
- if (showPrivate) {
- el.checked=true;
- Cookie.set("showPrivate", true, 2);
- }
-
- // get cookie state, show private if needed
- showHidePrivate(el.checked);
-
-
- // set up handler
- Event.on(el, "click", function(e) {
- showHidePrivate(this.checked);
- });
- }
-
- el = Dom.get("showprotected");
- if (el) {
-
- if (showProtected) {
- el.checked=true;
- Cookie.set("showProtected", true, 2);
- }
-
- // get cookie state, show private if needed
- showHideProtected(el.checked);
-
- // set up handler
- Event.on(el, "click", function(e) {
- showHideProtected(this.checked);
- });
- }
-
- el = Dom.get("showdeprecated");
- if (el) {
-
- if (showDeprecated) {
- el.checked=true;
- Cookie.set("showDeprecated", true, 2);
- }
-
- // get cookie state, show private if needed
- showHideDeprecated(el.checked);
+ };
- // set up handler
- Event.on(el, "click", function(e) {
- showHideDeprecated(this.checked);
- });
- }
- });
+ var els = ['show_deprecated', 'show_protected', 'show_private'];
- var propsort = function(a, b) {
- //return (a.url > b.url) ? 1 : ((a.url < b.url) ? -1 : 0);
- return (a.name.toLowerCase() > b.name.toLowerCase()) ? 1 : ((a.name.toLowerCase() < b.name.toLowerCase()) ? -1 : 0);
+ for (var i = 0; i < els.length; i++) {
+ Event.on(els[i], 'click', handleClick);
+ checkCookie(els[i]);
+ handleClick(els[i]);
}
+
+});
- //var allprops = ALL_YUI_PROPS;
- // allprops.sort(propsort);
-
+//Starting the AutoComplete code
var getResults = function(query) {
var results = [];
if(query && query.length > 0) {
@@ -169,11 +64,11 @@
var prop = ALL_YUI_PROPS[i];
- if (!showProtected && prop.access == "protected") {
+ if (!show['protected'] && prop.access == "protected") {
// skip
- } else if (!showPrivate && prop.access == "private") {
+ } else if (!show['private'] && prop.access == "private") {
// skip
- } else if (!showDeprecated && prop.deprecated) {
+ } else if (!show['deprecated'] && prop.deprecated) {
// skip
} else {
var s = (prop.host + "." + prop.name).toLowerCase();
@@ -196,19 +91,10 @@
if(aResults.length == 0) {
if (query.length > 0) {
oAutoComp.setBody("<div id=\"resultsdefault\">Not found</div>");
- } else {
- //oAutoComp.setBody("<div id=\"resultsdefault\">Start typing to find a property/method/event/config " +
- //" or browse a module by clicking a link on the left.</div>");
- oAutoComp.setBody("<div id=\"resultsdefault\">Start typing to find a property/method/event/config</div>");
}
}
};
- var myOnContainerCollapse = function(sType, aArgs) {
- var oAutoComp = aArgs[0];
- oAutoComp.setBody("<div id=\"resultsdefault\">Start typing to find a property/method/event/config</div>");
- };
-
var myOnItemSelect = function(sType, aArgs) {
var ac = aArgs[0];
var item = aArgs[2];
@@ -224,7 +110,7 @@
// Instantiate AutoComplete
oAutoComp = new YAHOO.widget.AutoComplete('searchinput','searchresults', oACDS);
- oAutoComp.alwaysShowContainer = true;
+ //oAutoComp.alwaysShowContainer = true;
oAutoComp.queryDelay = 0.2;
oAutoComp.maxResultsDisplayed = 200;
oAutoComp.minQueryLength = 0;
@@ -235,7 +121,6 @@
// Subscribe to Custom Events
oAutoComp.dataReturnEvent.subscribe(myOnDataReturn);
- oAutoComp.containerCollapseEvent.subscribe(myOnContainerCollapse);
oAutoComp.itemSelectEvent.subscribe(myOnItemSelect);
// Set initial content in the container
@@ -246,5 +131,15 @@
var validateForm = function() {
return false;
};
+
+ YAHOO.util.Event.onAvailable('classTab', function() {
+ var tabs = new YAHOO.widget.TabView('classTab');
+ });
+ /*
+ YAHOO.util.Event.onAvailable('codeTree', function() {
+ var tree1 = new YAHOO.widget.TreeView('codeTree');
+ tree1.render();
+ });
+ */
})();
Oops, something went wrong.

0 comments on commit 85ec667

Please sign in to comment.