Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Community Feedback and Ideas

Reply
Developer
Posts: 482
Registered: ‎10-24-2008
My Device: 9300
My Carrier: AT&T

inserting code on forum

I think the insert code option on the forum could use some work. It does box off the code from the rest of the text in a post, but it renders it unreadable while viewing on the forum.

 

Are there any improvements that can be made to this functionality?

_________________________________________
www.jasonmace.com/blackberry
Guru I
Posts: 19,007
Registered: ‎07-29-2008
My Device: Passport, Playbook, 9320BES
My Carrier: Bouygues _ SFR

Re: inserting code on forum

let's take an example. I have the elevators things on the scroll bars but apart from that, it does the job. Can you detail how it could be better?

 

 

var xdxTitle;
var A = document.getElementsByName('title');
xdxTitle = A.item(0).firstChild.nodeValue;

var xdxKbId;
var xx = document.evaluate( '//td', document, null, XPathResult.ANY_TYPE, null );
var thisHeading = xx.iterateNext();   
while (thisHeading) {  
  var e = thisHeading.textContent;
  if (e.match(/^KB/)) xdxKbId = e;
  thisHeading = xx.iterateNext();  
} 

var aList = document.getElementsByTagName('a');
for (var i=0;i<=aList.length-1;i++) {
	if ('javascript&colon;window.print()'== aList[i].getAttribute('href') ) {
		var xD = aList[i].parentNode;
		xD.appendChild(document.createElement('br'));
		xD.appendChild(document.createElement('br'));
		var xF = document.createElement('form');
		var xI = document.createElement('input');
		xI.setAttribute('type','text');
		xI.setAttribute('readonly','readonly');
		xI.setAttribute('onclick','javascript&colon;this.select();');
		xI.setAttribute('value','<a href="http://www.blackberry.com/btsc/'+xdxKbId+'">'+xdxKbId+'</a> '+xdxTitle);
		xF.appendChild(xI);
		xD.appendChild(xF);
	}
}

 

(t's my grease monkey script to add a pastable entry for a KB on BTSC)

 




The search box on top-right of this page is your true friend, and the public Knowledge Base too:
Developer
Posts: 482
Registered: ‎10-24-2008
My Device: 9300
My Carrier: AT&T

Re: inserting code on forum

That looks great Xandrex, but when I copy and paste from one of my IDEs I get results as seen in this thread 

http://supportforums.blackberry.com/t5/Web-Development/Sqlite-Drop-Table-problem/td-p/509632/page/2

_________________________________________
www.jasonmace.com/blackberry
Guru I
Posts: 19,007
Registered: ‎07-29-2008
My Device: Passport, Playbook, 9320BES
My Carrier: Bouygues _ SFR

Re: inserting code on forum

[ Edited ]

 


jmace wrote:

That looks great Xandrex, but when I copy and paste from one of my IDEs I get results as seen in this thread 

http://supportforums.blackberry.com/t5/Web-Development/Sqlite-Drop-Table-problem/td-p/509632/page/2


 

the lines are too long. Replace the tabs by spaces. I did it over there. It's not perfect but better.




The search box on top-right of this page is your true friend, and the public Knowledge Base too:
Developer
Posts: 482
Registered: ‎10-24-2008
My Device: 9300
My Carrier: AT&T

Re: inserting code on forum

Thanks Xandrex, I appreciate the look.

 

I'll just adjust my code spacing next time.

_________________________________________
www.jasonmace.com/blackberry