1 //<script type="text/javascript">
2 /* -- IE kludge as usual! */
3 if (!Array.prototype.indexOf)
5 Array.prototype.indexOf = function(elt /*, from*/)
9 var from = Number(arguments[1]) || 0;
16 for (; from < len; from++)
31 var ua = navigator.userAgent.toLowerCase();
32 return ua.indexOf("msie") > -1;
39 //console.log("loading");
41 this.addEvent(document,'click', function(e) {
42 var ev = e || window.event;
43 var t = ev.target || ev.srcElement;
45 return RooDocsPage.clicked(t);
52 addEvent: function(el, eventName, fn)
55 if (window.addEventListener) {
57 el.addEventListener(eventName, fn, (capture));
60 if (window.attachEvent) {
61 el.attachEvent("on" + eventName, fn);
70 var classAr = t.className.split(' ');
71 //console.log(classAr)
72 if ((t.nodeName == 'a') && (classAr.indexOf('exi') < 0) && (classAr.indexOf('micon') < 0)) {
76 var cls = this.getAttributeNS(t,'roo', 'cls');
79 var member = this.getAttributeNS(t,'roo', 'member');
80 //this.loadClass(target.href, cls, member);
82 if (/^src\//.test(cls)) {
83 cls = cls.replace(/.js$/, ''); // get rid of .js for source links..
87 document.location = "symbols/"+ cls +".html";
96 if (classAr.indexOf('exi') > -1 || classAr.indexOf('micon') > -1) {
99 //console.log(tr.parentNode);
100 while (tr.parentNode) {
101 ///console.log(tr.nodeName);
102 if (tr.nodeName.toUpperCase() =='TR') {
107 if (tr.nodeName.toUpperCase() != 'TR') { // no tr!
110 //console.log(tr.className)
111 if (tr.className.match(/expandable/)) {
113 if (!/expanded/.test(tr.className)) {
115 tr.className += " expanded";
117 this.loadComments(tr);
119 // console.log("ADDED:"+ tr.className);
121 tr.className = tr.className.replace(/ expanded/,'');
122 //console.log("REMOVED:"+ tr.className);
133 getAttributeNS : function(d,ns,name) {
135 // ie uses attribute stuff...
136 var type = typeof d[ns+":"+name];
137 if(type != 'undefined' && type != 'unknown'){
138 return d[ns+":"+name];
143 return d.getAttributeNS(ns, name) || d.getAttribute(ns+":"+name) || d.getAttribute(name) || d[name];
145 loadComments: function(tr)
147 // first look for 'a' tag with id -
148 var a_s = tr.getElementsByTagName('a');
150 if (a_s.length < 2) return;
151 var id = a_s[1].getAttribute('id');
155 // then see if we have a comment-{id}
157 if (document.getElementById('comments-' + id)) {
158 // we already have it... assume it's loaded and does not need refeshing...
162 // then if not create it....
163 var div_s = tr.getElementsByTagName('div');
165 for (var i=0;i<div_s.length;i++) {
167 if (div_s[i].className != "long") {
170 pdiv = div_s[i].parentNode; // parent of the <div class="long"
173 if (!pdiv) { // we dont have a parent to add it to...
177 var cdiv = document.createElement("div");
178 cdiv.className = "comments";
179 var cb = document.createElement("b");
180 cb.appendChild(document.createTextNode("Element Comment / Notes"));
181 cdiv.appendChild(cb);
182 cdiv.appendChild(document.createTextNode(" => "));
183 var cu = document.createElement("u");
184 cu.appendChild(document.createTextNode("[Add Your comment/notes about this element]"));
186 cu.setAttribute("onclick", "parent.CommentDialog.showCommentId = '" + id + "';");
187 cdiv.appendChild(cu);
188 cdiv.appendChild(document.createElement("br"));
189 var ciframe = document.createElement("iframe");
190 ciframe.setAttribute('height', '50');
191 ciframe.setAttribute('frameborder', '50');
192 ciframe.setAttribute('src', '/blog.php/GtkDjsComments/' + id + '.html');
193 ciframe.setAttribute('style', 'border: medium none ; width: 100%;');
194 ciframe.setAttribute('id', 'comments-' + id);
195 cdiv.appendChild(ciframe);
196 pdiv.appendChild(cdiv);
205 this.preview.getEl().on('click', function(e, target)
207 //console.log("click pressed?");
209 if(target = e.getTarget('a:not(.exi)', 3)) {
210 var cls = Ext.fly(target).getAttributeNS('roo', 'cls');
213 var member = Ext.fly(target).getAttributeNS('roo', 'member');
214 //this.loadClass(target.href, cls, member);
216 if (/^src\//.test(cls)) {
217 cls = cls.replace(/.js$/, ''); // get rid of .js for source links..
221 MainBody.loadPage("symbols/"+ cls +".html");
224 if(target.className == 'inner-link'){ // go to #
225 this.getActiveTab().scrollToSection(target.href.split('#')[1]);
228 window.open(target.href);
230 return; // no more...
232 if(target = e.getTarget('.micon', 2)){
235 var tr = Ext.fly(target.parentNode);
236 if(tr.hasClass('expandable')){
237 tr.toggleClass('expanded');