From ffb9f2e9b124fc3a19e735bae377241ef86538b8 Mon Sep 17 00:00:00 2001 From: Vadim Makeev Date: Sun, 7 Sep 2014 00:24:16 +0200 Subject: [PATCH] Init --- .editorconfig | 13 +++++++ .gitignore | 3 ++ .jscs.json | 35 +++++++++++++++++++ .npmignore | 5 +++ License.md | 21 +++++++++++ Readme.md | 6 ++++ bower.json | 19 ++++++++++ package.json | 29 ++++++++++++++++ plugin.Notes.js | 92 +++++++++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 223 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitignore create mode 100644 .jscs.json create mode 100644 .npmignore create mode 100644 License.md create mode 100644 Readme.md create mode 100644 bower.json create mode 100644 package.json create mode 100644 plugin.Notes.js diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..68bcc42 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,13 @@ +# EditorConfig is awesome: http://EditorConfig.org +root = true + +[*] +indent_style = tab +end_of_line = lf +trim_trailing_whitespace = true +insert_final_newline = true +charset = utf-8 + +[{bower.json,package.json,.travis.yml}] +indent_style = space +indent_size = 2 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0ac92e1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.idea +.DS_Store +node_modules diff --git a/.jscs.json b/.jscs.json new file mode 100644 index 0000000..b841324 --- /dev/null +++ b/.jscs.json @@ -0,0 +1,35 @@ +{ + "requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch"], + "requireSpaceAfterKeywords": ["if", "for", "while", "switch", "try", "catch", "do", "else"], + "requireSpaceBeforeBlockStatements": true, + "requireParenthesesAroundIIFE": true, + "requireSpacesInConditionalExpression": { + "afterTest": true, + "beforeConsequent": true, + "afterConsequent": true, + "beforeAlternate": true + }, + "requireSpacesInFunctionExpression": { + "beforeOpeningCurlyBrace": true, + "beforeOpeningRoundBrace": true + }, + "requireBlocksOnNewline": 1, + "disallowEmptyBlocks": true, + "disallowSpacesInsideArrayBrackets": true, + "requireSpacesInsideObjectBrackets": "allButNested", + "requireCommaBeforeLineBreak": true, + "requireOperatorBeforeLineBreak": ["?", "+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<=", "&&", "||"], + "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], + "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], + "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<=", "&&", "||"], + "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<=", "&&", "||"], + "requireCamelCaseOrUpperCaseIdentifiers": true, + "disallowKeywords": ["with"], + "disallowMultipleLineStrings": true, + "disallowMultipleLineBreaks": true, + "validateLineBreaks": "LF", + "disallowMixedSpacesAndTabs": true, + "disallowTrailingWhitespace": true, + "disallowTrailingComma": true, + "requireCapitalizedConstructors": true +} diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..4f23a2c --- /dev/null +++ b/.npmignore @@ -0,0 +1,5 @@ +* +!License.md +!Readme.md +!plugin.Notes.js +!package.json diff --git a/License.md b/License.md new file mode 100644 index 0000000..0b07174 --- /dev/null +++ b/License.md @@ -0,0 +1,21 @@ +# The MIT License + +Copyright © 2010–2014 Vadim Makeev, http://pepelsbey.net/ + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +--- + +# Лицензия MIT + +Copyright © 2010–2014 Вадим Макеев, http://pepelsbey.net/ + +Данная лицензия разрешает лицам, получившим копию данного программного обеспечения и сопутствующей документации (в дальнейшем именуемыми «Программное Обеспечение»), безвозмездно использовать Программное Обеспечение без ограничений, включая неограниченное право на использование, копирование, изменение, добавление, публикацию, распространение, сублицензирование и/или продажу копий Программного Обеспечения, также как и лицам, которым предоставляется данное Программное Обеспечение, при соблюдении следующих условий: + +Указанное выше уведомление об авторском праве и данные условия должны быть включены во все копии или значимые части данного Программного Обеспечения. + +ДАННОЕ ПРОГРАММНОЕ ОБЕСПЕЧЕНИЕ ПРЕДОСТАВЛЯЕТСЯ «КАК ЕСТЬ», БЕЗ КАКИХ-ЛИБО ГАРАНТИЙ, ЯВНО ВЫРАЖЕННЫХ ИЛИ ПОДРАЗУМЕВАЕМЫХ, ВКЛЮЧАЯ, НО НЕ ОГРАНИЧИВАЯСЬ ГАРАНТИЯМИ ТОВАРНОЙ ПРИГОДНОСТИ, СООТВЕТСТВИЯ ПО ЕГО КОНКРЕТНОМУ НАЗНАЧЕНИЮ И ОТСУТСТВИЯ НАРУШЕНИЙ ПРАВ. НИ В КАКОМ СЛУЧАЕ АВТОРЫ ИЛИ ПРАВООБЛАДАТЕЛИ НЕ НЕСУТ ОТВЕТСТВЕННОСТИ ПО ИСКАМ О ВОЗМЕЩЕНИИ УЩЕРБА, УБЫТКОВ ИЛИ ДРУГИХ ТРЕБОВАНИЙ ПО ДЕЙСТВУЮЩИМ КОНТРАКТАМ, ДЕЛИКТАМ ИЛИ ИНОМУ, ВОЗНИКШИМ ИЗ, ИМЕЮЩИМ ПРИЧИНОЙ ИЛИ СВЯЗАННЫМ С ПРОГРАММНЫМ ОБЕСПЕЧЕНИЕМ ИЛИ ИСПОЛЬЗОВАНИЕМ ПРОГРАММНОГО ОБЕСПЕЧЕНИЯ ИЛИ ИНЫМИ ДЕЙСТВИЯМИ С ПРОГРАММНЫМ ОБЕСПЕЧЕНИЕМ. \ No newline at end of file diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..df4faf7 --- /dev/null +++ b/Readme.md @@ -0,0 +1,6 @@ +# Notes plugin for Shower + +Follow [@shower_me](https://twitter.com/shower_me) for support and updates, [file an issue](https://github.com/shower/shower/issues) in case of any problem. Part of the [Shower](https://github.com/shower/shower/) presentation template, [see wiki](https://github.com/shower/shower/wiki) for more information. + +--- +Licensed under [MIT License](http://en.wikipedia.org/wiki/MIT_License), see [license page](https://github.com/shower/shower/wiki/MIT-License) for details. diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..964152e --- /dev/null +++ b/bower.json @@ -0,0 +1,19 @@ +{ + "name": "shower-notes", + "version": "0.0.1", + "license": "MIT", + "main": "plugin.Notes.js", + "ignore": [ + "*", + "!License.md", + "!Readme.md", + "!plugin.Notes.js", + "!bower.json" + ], + "keywords": [ + "shower", + "presentation", + "plugin", + "notes" + ] +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..8d5fc4b --- /dev/null +++ b/package.json @@ -0,0 +1,29 @@ +{ + "name": "shower-notes", + "description": "Notes plugin for Shower HTML presentation engine", + "version": "0.0.1", + "author": { + "name": "Vadim Makeev", + "url": "http://pepelsbey.com/" + }, + "homepage": "https://github.com/shower/notes", + "repository": { + "type": "git", + "url": "git://github.com/shower/notes.git" + }, + "bugs": { + "url": "http://github.com/shower/shower/issues" + }, + "licenses": [ + { + "type": "MIT", + "url": "https://github.com/shower/shower/wiki/MIT-License" + } + ], + "keywords": [ + "shower", + "presentation", + "plugin", + "notes" + ] +} diff --git a/plugin.Notes.js b/plugin.Notes.js new file mode 100644 index 0000000..cab8d44 --- /dev/null +++ b/plugin.Notes.js @@ -0,0 +1,92 @@ +/** + * @fileOverview + * Presenter notes plugin for shower. + * + * @example + * modules.require(['shower', 'plugin.Notes'], function (shower, Notes) { + * shower.ready(function () { + * var notes = new Notes(shower); + * }); + * }); + */ +modules.define('plugin.Notes', [ + 'util.extend' +], function (provide, extend) { + + /** + * @class + * Presenter notes plugin for shower. + * @name plugin.Notes + * @param {Shower} shower + * @param {Object} [options] Plugin options. + * @param {String} [options.selector = 'footer'] + * @constructor + */ + function Notes (shower, options) { + options = options || {}; + this._shower = shower; + this._notesSelector = options.selector || 'footer'; + + this.init(); + } + + extend(Notes.prototype, /** @lends plugin.Notes.prototype */{ + + init: function () { + this._setupListeners(); + }, + + destroy: function () { + this.clear(); + this._clearListeners(); + this._shower = null; + }, + + show: function () { + this.clear(); + + var shower = this._shower, + slide = shower.player.getCurrentSlide(), + slideLayout = slide.getLayout(), + notes = slideLayout.getElement().querySelector(this._notesSelector); + + if (notes && notes.innerHTML) { + console.info(notes.innerHTML.replace(/\n\s+/g, '\n')); + } + + var currentSlideNumber = shower.player.getCurrentSlideIndex(), + nextSlide = shower.get(currentSlideNumber + 1); + + if (nextSlide) { + console.info('NEXT: ' + nextSlide.getTitle()); + } + }, + + clear: function () { + if (this._shower.container.isSlideMode() && !this._shower.options.debugMode) { + console.clear(); + } + }, + + _setupListeners: function () { + var shower = this._shower; + + this._showerListeners = shower.events.group() + .on('destroy', this.destroy, this); + + this._playerListeners = shower.player.events.group() + .on('activate', this._onSlideActivate, this); + }, + + _clearListeners: function () { + this._showerListeners.offAll(); + this._playerListeners.offAll(); + }, + + _onSlideActivate: function () { + this.show(); + } + }); + + provide(Notes); +}); \ No newline at end of file