Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ The Etherpad jQuery Plugin easily allows you to embed and access a pad from Ethe
`$('#examplePadBasic').pad({'padId':'test','showChat':true});`
<div id="examplePadIntense"></div>

### Sets the pad id, some plugin parameters and puts the pad in the div
`$('#examplePadPlugins').pad({'padId':'test','plugins':{'pageview':'true'}});`
<div id="examplePadPlugins"></div>

### Gets the padContents from Example #2 and writes it to the target div "exampleGetContents"
`$('#examplePadBasic').pad({'getContents':'exampleGetContents'});`

Expand All @@ -33,6 +37,7 @@ The Etherpad jQuery Plugin easily allows you to embed and access a pad from Ethe
'height' : 100, // The height of the embedded IFrame
'border' : 0, // The width of the border (make sure to append px to a numerical value)
'borderStyle' : 'solid', // The CSS style of the border [none, dotted, dashed, solid, double, groove, ridge, inset, outset]
'plugins' : {}, // The options related to the plugins, not to the basic Etherpad configuration
'rtl' : false // Show text from right to left
</pre>

Expand Down
12 changes: 10 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@ <h2>Example #1: Sets the pad id and puts the pad in the div</h2>
<div id="examplePadBasic"></div>

<h2>Example #2: Sets the pad id, some more parameters and puts the pad in the div</h2>
<pre>$('#examplePadIntense').pad({'padId':'test','showChat':'true'});</pre>
<pre>$('#examplePadIntense').pad({'padId':'test2','showChat':'true'});</pre>
<div id="examplePadIntense"></div>

<h2>Example #3: Gets the padContents from Example #2</h2>
<h2>Example #3: Sets the pad id, some plugin parameters and puts the pad in the div</h2>
<pre>$('#examplePadPlugins').pad({'padId':'test3','plugins':{'pageview':'true'}});</pre>
<div id="examplePadPlugins"></div>

<h2>Example #4: Gets the padContents from Example #2</h2>
<pre>$('#examplePadIntense').pad({'getContents':'exampleGetContents'});</pre>
<div id="exampleGetContents"><a id="contents" onClick="$('#examplePadIntense').pad({'getContents':'exampleGetContents'});">Click me to Replace me with the pad contents</a></div>

Expand All @@ -43,6 +47,7 @@ <h2>Available options and parameters</h2>
'height' : 100, // The height of the embedded IFrame
'border' : 0, // The width of the border (make sure to append px to a numerical value)
'borderStyle' : 'solid' // The CSS style of the border [none, dotted, dashed, solid, double, groove, ridge, inset, outset]
'plugins' : {}, // The options related to the plugins, not to the basic Etherpad configuration
'rtl' : false // Show right to left text
</pre>

Expand All @@ -52,6 +57,9 @@ <h2>Available options and parameters</h2>

// A slightly more intense example
$('#examplePadIntense').pad({'padId':'test2','showChat':'true'}); // sets the pad id and puts the pad in the div

// An example with plugin parameters
$('#examplePadPlugins').pad({'padId':'test3','plugins':{'pageview':'true'}}); // sets the pad id, some plugin parameters, and puts the pad in the div
</script>

<h3>If you are confused, view the source code for examples</h3>
Expand Down
7 changes: 7 additions & 0 deletions js/etherpad.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
'borderStyle' : 'solid',
'toggleTextOn' : 'Disable Rich-text',
'toggleTextOff' : 'Enable Rich-text',
'plugins' : {},
'rtl' : false
};

Expand All @@ -36,6 +37,11 @@
$.extend( settings, options );
}

var pluginParams = '';
for(var option in settings.plugins) {
pluginParams += '&' + option + '=' + settings.plugins[option]
}

var iFrameLink = '<iframe id="'+epframeId;
iFrameLink = iFrameLink +'" name="' + epframeId;
iFrameLink = iFrameLink +'" src="' + settings.host+settings.baseUrl+settings.padId;
Expand All @@ -52,6 +58,7 @@
iFrameLink = iFrameLink + '&hideQRCode=' + settings.hideQRCode;
iFrameLink = iFrameLink + '&alwaysShowChat=' + settings.alwaysShowChat;
iFrameLink = iFrameLink + '&rtl=' + settings.rtl;
iFrameLink = iFrameLink + pluginParams;
iFrameLink = iFrameLink +'" style="border:' + settings.border;
iFrameLink = iFrameLink +'; border-style:' + settings.borderStyle;
iFrameLink = iFrameLink +';" width="' + '100%';//settings.width;
Expand Down