Skip to content
Browse files

set up directory structure, add in eitherpad to page

  • Loading branch information...
1 parent dca5178 commit f635d634fe57b64d04429dab8717e17972b00ae6 @danburkert danburkert committed
Showing with 76 additions and 1 deletion.
  1. +1 −0 css/style.css
  2. +15 −1 index.html
  3. +50 −0 js/etherpad.js
  4. +10 −0 js/load-pad.js
View
1 css/style.css
@@ -0,0 +1 @@
+/* Empty for now..*/
View
16 index.html
@@ -1 +1,15 @@
-hello world.
+<!doctype html>
+<head>
+ <meta charset="utf-8">
+ <title>Startup or Shutup</title>
+ <link rel="stylesheet" href="css/style.css">
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
+ <script src="js/etherpad.js"></script>
+ <script src="js/load-pad.js"></script>
+
+</head>
+<body>
+ <h1>Startup or Shutup 2012</h1>
+ <h2>Startup Or Shutup is a community for those who want to Get Things Done.</h2>
+ <div id="pad">This is the pad</div>
+</body>
View
50 js/etherpad.js
@@ -0,0 +1,50 @@
+(function( $ ){
+
+ $.fn.pad = function( options ) {
+ var settings = {
+ 'host' : 'http://beta.etherpad.org',
+ 'baseUrl' : '/p/',
+ 'showControls' : false,
+ 'showChat' : false,
+ 'showLineNumbers' : false,
+ 'userName' : 'unnamed',
+ 'useMonospaceFont' : false,
+ 'noColors' : false,
+ 'hideQRCode' : false
+ };
+
+ // This writes a new frame if required
+ if ( !options.getContents )
+ {
+ if ( options )
+ {
+ $.extend( settings, options );
+ }
+ var epframe = this.attr('id');
+ var iFrameLink = '<iframe id="epframe'+epframe+'" src="'+settings.host+settings.baseUrl+settings.padId+'?showControls='+settings.showControls+'&showChat='+settings.showChat+'&showLineNumbers='+settings.showLineNumbers+'&useMonospaceFont='+settings.useMonospaceFont+'&userName=' + settings.userName + '&noColors=' + settings.noColors + '&hideQRCode=' + settings.hideQRCode + '"></iframe>';
+ // console.log(iFrameLink);
+ this.html(iFrameLink);
+ }
+
+ // This reads the etherpad contents if required
+ if ( options.getContents )
+ {
+ // Specify the target Div
+ var targetDiv = options.getContents;
+
+ // Get the frame properties and provide us with an export path
+ var frameID = this.attr('id');
+ var epframe = "epframe"+frameID;
+ var frameUrl = document.getElementById(epframe).src;
+ if (frameUrl.indexOf("?")>-1){
+ frameUrl = frameUrl.substr(0,frameUrl.indexOf("?"));
+ }
+ var contentsUrl = frameUrl + "/export/html";
+
+ // perform an ajax call on contentsUrl and write it to the parent
+ $.get(contentsUrl, function(data) {
+ $('#'+targetDiv).html(data);
+ });
+ }
+ };
+})( jQuery );
View
10 js/load-pad.js
@@ -0,0 +1,10 @@
+$(document).ready(function() {
+ $("#pad").pad({
+ 'padId' : 'kRBXB8P1Ci',
+ 'host' : 'http://notes.avaaz.org',
+ 'baseUrl' : '/'
+ });
+ $("#epframepad").css("width", "800px");
+ $("#epframepad").css("height", "800px");
+
+});

0 comments on commit f635d63

Please sign in to comment.
Something went wrong with that request. Please try again.