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:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script type="text/javascript">
[jQuery](/wiki/#jquery)( function () {
[jQuery](/wiki/#jquery).getJSON( 'http://foo.com/json&callback=?', function ( [js](/wiki/#javascript) ) {
[js](/wiki/#javascript).callback( [js](/wiki/#javascript) );
} );
} );
</script>
http://foo.com/json&callback=? returns a json object like
{
callback: function( [js](/wiki/#javascript) ) {
/* 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
for ( var i = 0; i < l; i ++ ) {
I'd still like to know if I can write a real pbworks plugin though.
js: Programming language of the internets, mostly how I earn a wage.
💬 RE: Anyone written a pbworks plugin? - 13320
⬅️ Arial views of Westenhanger Castle :: RE: Anyone written a pbworks plugin? - 13320 ➡️
Paul Clarkeʼs weblog - I live in Hythe near Folkestone, Kent. Wed and dad to 2, I am a full-stack web developr, and I do mostly js / Node, some ruby, other languages ect ect. I like pubbing, parkrun, restaurants, home automation and other diy jiggery-pokery, history, family tree stuff, Television, squirrels, pirates, lego, and TIME TRAVEL.