It's a work thing!

Home

Anyone written a pbworks plugin?

Mar42010

Can I write plugins or do I just past in some js?

Trying to write a pbworks plugin in javascript. Not really a plugin, but just including a small amount of js in the page as that's all I've figured out how to do so far. Here's my snippet:





http://foo.com/json&callback=? returns a json object like

{

callback: function( js ) {

/* some code here */

},

data: {

/* some data here */

}

}



all should be good, and is to a point. jquery does the getJSON, executes it, my code runs, but also displays lots of extra crap on the page like

function C(Y, X) { var W = 0; try { this._each(function (a) {Y.call(X, a, W++);}); } catch (Z) { if (Z != $break) { throw Z; } } return this; }

function R(Z, Y, X) { var W = - Z, a = [], b = this.toArray(); if (Z < 1) { return b; } while ((W += Z) < b.length) { a.push(b.slice(W, W + Z)); } return a.collect(Y, X); }

function B(Y, X) { Y = Y || Prototype.K; var W = true; this.each(function (a, Z) {W = W && !!Y.call(X, a, Z);if (!W) {throw $break;}}); return W; }


I am cycling through an array in my own data, is all that extra crap appearing because prototype.js or scriptaculous (which pbworks uses) is extending the array prototype or something? Gah...

UPDATE: answered my own questions, changed some

for ( var i in js ) {

to some

var l = js.length;
for ( var i = 0; i < l; i ++ ) {


I'd still like to know if I can write a real pbworks plugin though.

:: :: Comment / reply

RE: Anyone written a pbworks plugin?

Pauly - there are simply no words that could do justice to that post. You are a shoe-in for the blogging Pulitzer.

:: 5 Mar :: :: Comment / reply

It's a work thing!

pbworks is an online collaboration site, a wiki really. I could go a lot more techie here, but I know it's really only you reading it, so I won't.

:: 7 Mar :: :: Comment / reply

Paul Clarke's blog - I live and work near Folkestone. Married to Clare and father to Harry, I am a web dev, and I like javascript, PHP, Folkestone Gerald, pubs, restaurants, history, genealogy, TV, music, popbitch, squirrels, pirates ☠, time travel, stained glass...

Also from the same week

Some more posts from the same week as .

Anyone written a pbworks plugin? Can I write plugins or do I just past in some js? [Thursday 4 March 2010]

RE: Anyone written a pbworks plugin? [Friday 5 March 2010]

It's a work thing! [Sunday 7 March 2010]

BACK, then, from Dublin [Monday 8 March 2010]

Happy birthday Harry 3/4 today [Monday 8 March 2010]

Fareham space squirrels A happy news squirrel story from Fareham [Tuesday 9 March 2010]

Can I play HTML5 Youtube videos in Firefox right now? [Wednesday 10 March 2010]