From e17d75185af4f0f4ca377d505b09f338d5650094 Mon Sep 17 00:00:00 2001 From: Luiza Pagliari Date: Thu, 16 Apr 2015 17:38:50 -0300 Subject: [PATCH 1/3] Add parameter 'pageview' (used on ep_page_view plugin) --- README.md | 1 + js/etherpad.js | 2 ++ 2 files changed, 3 insertions(+) diff --git a/README.md b/README.md index 94eacf1..f23485c 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ The Etherpad jQuery Plugin easily allows you to embed and access a pad from Ethe '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] 'rtl' : false // Show text from right to left +'pageview' : false // Display page view when opening the pad (requires ep_page_view plugin) # Copyright diff --git a/js/etherpad.js b/js/etherpad.js index d003ab5..c1862e9 100644 --- a/js/etherpad.js +++ b/js/etherpad.js @@ -14,6 +14,7 @@ 'userColor' : false, 'hideQRCode' : false, 'alwaysShowChat' : false, + 'pageview' : false, 'width' : 100, 'height' : 100, 'border' : 0, @@ -51,6 +52,7 @@ iFrameLink = iFrameLink + '&userColor=' + settings.userColor; iFrameLink = iFrameLink + '&hideQRCode=' + settings.hideQRCode; iFrameLink = iFrameLink + '&alwaysShowChat=' + settings.alwaysShowChat; + iFrameLink = iFrameLink + '&pageview=' + settings.pageview; iFrameLink = iFrameLink + '&rtl=' + settings.rtl; iFrameLink = iFrameLink +'" style="border:' + settings.border; iFrameLink = iFrameLink +'; border-style:' + settings.borderStyle; From 3d2578c28003e96016e7dbf96e90974b8f3195b2 Mon Sep 17 00:00:00 2001 From: Luiza Pagliari Date: Thu, 16 Apr 2015 17:47:01 -0300 Subject: [PATCH 2/3] Missing a comma on README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f23485c..37572bc 100644 --- a/README.md +++ b/README.md @@ -29,12 +29,12 @@ The Etherpad jQuery Plugin easily allows you to embed and access a pad from Ethe 'userColor' : false, // The background color of this authors text in hex format IE #000 'hideQRCode' : false, // Hide QR code 'alwaysShowChat' : false, // Always show the chat on the UI +'pageview' : false, // Display page view when opening the pad (requires ep_page_view plugin) 'width' : 100, // The width of the embedded IFrame '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] 'rtl' : false // Show text from right to left -'pageview' : false // Display page view when opening the pad (requires ep_page_view plugin) # Copyright From 0fa19cd60c2f0c4d715d150c11590f76d177851c Mon Sep 17 00:00:00 2001 From: Luiza Pagliari Date: Fri, 17 Apr 2015 07:22:06 -0300 Subject: [PATCH 3/3] Using a more generic approach to handle plugin parameters. --- README.md | 6 +++++- index.html | 12 ++++++++++-- js/etherpad.js | 9 +++++++-- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 37572bc..548133a 100644 --- a/README.md +++ b/README.md @@ -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});`
+### Sets the pad id, some plugin parameters and puts the pad in the div +`$('#examplePadPlugins').pad({'padId':'test','plugins':{'pageview':'true'}});` +
+ ### Gets the padContents from Example #2 and writes it to the target div "exampleGetContents" `$('#examplePadBasic').pad({'getContents':'exampleGetContents'});` @@ -29,11 +33,11 @@ The Etherpad jQuery Plugin easily allows you to embed and access a pad from Ethe 'userColor' : false, // The background color of this authors text in hex format IE #000 'hideQRCode' : false, // Hide QR code 'alwaysShowChat' : false, // Always show the chat on the UI -'pageview' : false, // Display page view when opening the pad (requires ep_page_view plugin) 'width' : 100, // The width of the embedded IFrame '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 diff --git a/index.html b/index.html index b13b80d..5dde6c2 100644 --- a/index.html +++ b/index.html @@ -19,10 +19,14 @@

Example #1: Sets the pad id and puts the pad in the div

Example #2: Sets the pad id, some more parameters and puts the pad in the div

-
$('#examplePadIntense').pad({'padId':'test','showChat':'true'});
+
$('#examplePadIntense').pad({'padId':'test2','showChat':'true'});
-

Example #3: Gets the padContents from Example #2

+

Example #3: Sets the pad id, some plugin parameters and puts the pad in the div

+
$('#examplePadPlugins').pad({'padId':'test3','plugins':{'pageview':'true'}});
+
+ +

Example #4: Gets the padContents from Example #2

$('#examplePadIntense').pad({'getContents':'exampleGetContents'});
@@ -43,6 +47,7 @@

Available options and parameters

'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 @@ -52,6 +57,9 @@

Available options and parameters

// 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

If you are confused, view the source code for examples

diff --git a/js/etherpad.js b/js/etherpad.js index c1862e9..73d066b 100644 --- a/js/etherpad.js +++ b/js/etherpad.js @@ -14,13 +14,13 @@ 'userColor' : false, 'hideQRCode' : false, 'alwaysShowChat' : false, - 'pageview' : false, 'width' : 100, 'height' : 100, 'border' : 0, 'borderStyle' : 'solid', 'toggleTextOn' : 'Disable Rich-text', 'toggleTextOff' : 'Enable Rich-text', + 'plugins' : {}, 'rtl' : false }; @@ -37,6 +37,11 @@ $.extend( settings, options ); } + var pluginParams = ''; + for(var option in settings.plugins) { + pluginParams += '&' + option + '=' + settings.plugins[option] + } + var iFrameLink = '