Commits

Mike Cannon-Brookes committed bac7060

First commit. Works! shift-x or Tools > Projector Mode to fire it off on any page or blog.

  • Participants

Comments (0)

Files changed (7)

File atlassian-extension.json

+{
+	"key": 			"projector-mode",
+	"name":			"Projector Mode",
+	"description":	"View Confluence pages on a projector!",
+	"version":		"1",
+	
+	"vendor": {	"name": "Mike Cannon-Brookes",
+			     "url": "http://example.com/extension-homepage.html",
+		       "email": "mike@atlassian.com" }
+}

File css/main.css

Empty file added.

File images/projectavatar.png

Added
New image

File images/projector-mode.gif

Added
New image

File images/projector-mode.png

Added
New image

File js/projector-mode/main.js

+/**
+ * The main module
+ *
+ * @context page, blogpost
+ */
+var $ = require('speakeasy/jquery').jQuery;
+var img = require('speakeasy/resources').getImageUrl(module, 'projector-mode.png');
+var projectorMode = false;
+
+function goProjectorMode() {
+	if (!projectorMode) {
+		projectorMode = true;
+		
+		jQuery("#header").css('min-height', 0);
+		jQuery("#header").slideUp(800);
+		jQuery("#navigation").hide();
+		jQuery(".logo").animate( { width: "hide", paddingLeft: "hide", paddingRight: "hide", marginLeft: "hide", marginRight: "hide" }, 800);
+		jQuery("#personal-info-sidebar").animate( { width: "hide", paddingLeft: "hide", paddingRight: "hide", marginLeft: "hide", marginRight: "hide" }, 800);
+		jQuery(".page-metadata, #footer, #labels-section, #children-section, #comments-section").fadeOut(800);
+
+		// hide the sidebar in the doc theme better (re-use JS?)
+		// jQuery("#splitter-sidebar").hide();
+		// jQuery(".vsplitbar").hide();
+
+		increase(jQuery('h1'), 1.8, 2.0);
+		increase(jQuery('h2'), 1.5, 1.5);
+		increase(jQuery('h3'), 1.5, 1.5);
+		increase(jQuery('h4'), 1.5, 1.5);
+		increase(jQuery('h5'), 1.5, 1.5);
+		increase(jQuery('h6'), 1.5, 1.5);
+
+		increase(jQuery('.wiki-content li, .wiki-content p, .wiki-content td, .wiki-content th, .wiki-content .code'), 1.5, 1.5);
+	}
+}
+
+function increase(content, fontFactor, lineFactor) {
+	var curFontSize = content.css('fontSize');
+	var curLineHeight = content.css('line-height');
+	if (content && curFontSize) {
+		var newSize = increaseAttributeValue(curFontSize, fontFactor);
+		content.animate({'fontSize': newSize}, 700);
+   		var newHeight = increaseAttributeValue(curLineHeight, lineFactor)
+		content.animate({'line-height': newHeight}, 600);		
+	}
+}
+
+function increaseAttributeValue(attr, factor) {
+	var num = parseFloat(attr, 10);
+    num *= factor;
+    var stringEnding = attr.slice(-2);
+    return num + stringEnding;
+}
+
+$(document).ready(function() {
+	$('.projector-mode-web-item').click(function() { goProjectorMode(); });
+	AJS.whenIType("shift+x").execute(function() { goProjectorMode(); });
+	console.log(img);
+});

File ui/web-items.json

+[
+    {   "section" : "system.content.action/secondary",
+        "label"   : "Projector Mode",
+        "url"     : "javascript: return false;",
+        "cssName" : "projector-mode-web-item",
+		"tooltip" : "Enter Projector Mode ( type 'shift+x' )",
+		"icon"	  : { 
+			"height" : 16,
+			"width"  : 16,
+			"link"   : "http://kimkelln.com/SlideProjector.gif"
+		},
+        "weight"  : 40}
+]