Permalink
Browse files

Initial commit

  • Loading branch information...
matthewmueller committed Jan 2, 2013
0 parents commit 4745f8a63bb1ecda566994a834f566f18abd335f
Showing with 134 additions and 0 deletions.
  1. +2 −0 .gitignore
  2. 0 History.md
  3. +11 −0 Makefile
  4. +16 −0 Readme.md
  5. +18 −0 component.json
  6. +8 −0 fullscreen.css
  7. +60 −0 index.js
  8. +19 −0 test.html
@@ -0,0 +1,2 @@
+components
+build
No changes.
@@ -0,0 +1,11 @@
+
+build: components index.js fullscreen.css
+ @component build --dev
+
+components: component.json
+ @component install --dev
+
+clean:
+ rm -fr build components template.js
+
+.PHONY: clean
@@ -0,0 +1,16 @@
+
+# fullscreen
+
+ faux fullscreen implementation. cross-browser compatible and less restrictive than actual fullscreen API
+
+## Installation
+
+ $ component install matthewmueller/fullscreen
+
+## API
+
+
+
+## License
+
+ MIT
@@ -0,0 +1,18 @@
+{
+ "name": "fullscreen",
+ "repo": "matthewmueller/fullscreen",
+ "description": "faux fullscreen implementation. cross-browser compatible and less restrictive than actual fullscreen API",
+ "version": "0.0.1",
+ "keywords": [],
+ "dependencies": {
+ "component/emitter": "*",
+ "component/classes": "*",
+ "component/event" : "*"
+ },
+ "development": {},
+ "license": "MIT",
+ "scripts": [
+ "index.js"
+ ],
+ "styles": [ "fullscreen.css" ]
+}
@@ -0,0 +1,8 @@
+.fullscreen {
+ position: absolute;
+ z-index: 9999;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
+}
@@ -0,0 +1,60 @@
+/**
+ * Module dependencies
+ */
+
+var Emitter = require('emitter'),
+ events = require('event'),
+ classes = require('classes');
+
+/**
+ * Expose `Fullscreen`
+ */
+
+module.exports = Fullscreen;
+
+/**
+ * Initialize `Fullscreen`
+ *
+ * @param {DOM Node} el
+ * @api public
+ */
+
+function Fullscreen(el) {
+ if(!(this instanceof Fullscreen)) return new Fullscreen(el);
+ this.el = el;
+}
+
+/**
+ * Mixin `Emitter`
+ */
+
+Emitter(Fullscreen.prototype);
+
+/**
+ * open
+ */
+
+Fullscreen.prototype.open = function() {
+ events.bind(this.el, 'keydown', this.keydown.bind(this));
+ classes(this.el).add('fullscreen');
+ this.emit('open');
+ this.el.focus();
+};
+
+/**
+ * close
+ */
+
+Fullscreen.prototype.close = function() {
+ events.unbind(this.el);
+ classes(this.el).remove('fullscreen');
+ this.emit('close');
+};
+
+/**
+ * Keydown
+ */
+
+Fullscreen.prototype.keydown = function(e) {
+ if (e.keyCode == 27) this.close();
+};
@@ -0,0 +1,19 @@
+<html>
+<head>
+ <title>fullscreen component</title>
+ <link rel="stylesheet" href="../build/build.css">
+</head>
+<body>
+ <h1>fullscreen component</h1>
+ <textarea id="content" cols="30" rows="10"></textarea>
+ <button onclick="fullscreen.open()">Go fullscreen</button>
+ <script src="../build/build.js" type="text/javascript"></script>
+ <script type="text/javascript">
+ var Fullscreen = require('fullscreen'),
+ textarea = document.getElementById('content');
+
+ var fullscreen = Fullscreen(textarea);
+
+ </script>
+</body>
+</html>

0 comments on commit 4745f8a

Please sign in to comment.