From 06fa3bf3c44b9b94654373c85a02ab7e1c3957d0 Mon Sep 17 00:00:00 2001 From: Hartmut Bohnacker Date: Tue, 30 Jan 2018 15:54:19 +0100 Subject: [PATCH] =?UTF-8?q?Updated=20bundle.js=20=E2=80=93=20PageItemHtml?= =?UTF-8?q?=20was=20missing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bundle.js | 525 +++++++++++++++++++++++++++++++------------------- 1 file changed, 327 insertions(+), 198 deletions(-) diff --git a/lib/bundle.js b/lib/bundle.js index bb400cfc..1387f4ef 100644 --- a/lib/bundle.js +++ b/lib/bundle.js @@ -1,4 +1,37 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o=8.0.0" + }, "author": "Benedikt Groß ", "dependencies": { + "array-swap": "0.0.4", "async": "^1.5.2", "babelify": "^6.2.0", "browserify": "^12.0.1", @@ -50001,7 +50038,7 @@ module.exports={ "lodash": "^4.0.0", "markdown": "^0.5.0", "node-watch": "^0.5.4", - "parallelshell": "^2.0.0", + "parallelshell": "^3.0.2", "react": "^0.14.0-beta3", "react-dom": "^0.14.7", "react-sticky": "^3.0.0" @@ -50009,7 +50046,7 @@ module.exports={ "devDependencies": {} } -},{}],170:[function(require,module,exports){ +},{}],171:[function(require,module,exports){ 'use strict'; window.$ = require('jquery'); @@ -50024,12 +50061,13 @@ console.log("%c * " + packageInfo.name + " " + packageInfo.version + " * ", "bac ReactDOM.render(React.createElement(Application, null), document.getElementById('react-application')); -},{"../package.json":169,"./components/Application.react":171,"jquery":30,"react":165,"react-dom":35}],171:[function(require,module,exports){ +},{"../package.json":170,"./components/Application.react":172,"jquery":31,"react":166,"react-dom":36}],172:[function(require,module,exports){ 'use strict'; var _ = require('lodash'); var async = require('async'); var React = require('react'); +var swap = require('array-swap'); var Header = require('./Header.react'); var Navigation = require('./Navigation.react'); @@ -50039,7 +50077,7 @@ var endsWith = require('../utils/string').endsWith; var startsWith = require('../utils/string').startsWith; var extension = require('../utils/string').extension; -var typesMap = [{ type: 'TITLE', fileName: 'title', extensions: [] }, { type: 'TEXT', fileName: 'text', extensions: [] }, { type: 'CAPTION', extensions: ['txt'] }, { type: 'IMAGE', extensions: ['jpg', 'jpeg', 'gif', 'png', 'svg'] }, { type: 'P5', extensions: ['js'] }, { type: 'VIDEO', extensions: ['mp4'] }, { type: 'VIMEO', extensions: ['vimeo'] }]; +var typesMap = [{ type: 'TITLE', fileName: 'title', extensions: [] }, { type: 'TEXT', fileName: 'text', extensions: [] }, { type: 'CAPTION', extensions: ['txt'] }, { type: 'IMAGE', extensions: ['jpg', 'jpeg', 'gif', 'png', 'svg'] }, { type: 'P5', extensions: ['js'] }, { type: 'HTML', extensions: ['html', 'htm'] }, { type: 'VIDEO', extensions: ['mp4'] }, { type: 'VIMEO', extensions: ['vimeo'] }, { type: 'YOUTUBE', extensions: ['youtube'] }]; var Application = React.createClass({ displayName: 'Application', @@ -50109,7 +50147,7 @@ var Application = React.createClass({ // load content of all pageItems var reqests = _.map(allPageItems, function (pageItem) { var path = './content/' + pageItem.pageName + '/' + pageItem.fileName + '?nocache=' + new Date().getTime(); - var shouldLoadContent = pageItem.type !== 'IMAGE' || pageItem.type !== 'VIDEO' || pageItem.type !== 'VIMEO'; + var shouldLoadContent = pageItem.type !== 'IMAGE' || pageItem.type !== 'VIDEO' || pageItem.type !== 'VIMEO' || pageItem.type !== 'YOUTUBE'; pageItem.path = path; return function (cb) { if (shouldLoadContent) { @@ -50135,7 +50173,6 @@ var Application = React.createClass({ if (mainTextIndex > 0) { pageItems.unshift(pageItems.splice(mainTextIndex, 1)[0]); - console.log(pageItems); } var lastPageItem = []; @@ -50200,16 +50237,9 @@ var Application = React.createClass({ } }); -Array.prototype.swap = function (x, y) { - var b = this[x]; - this[x] = this[y]; - this[y] = b; - return this; -}; - module.exports = Application; -},{"../utils/string":182,"./Collection.react":172,"./Header.react":173,"./Navigation.react":174,"async":1,"lodash":31,"react":165}],172:[function(require,module,exports){ +},{"../utils/string":185,"./Collection.react":173,"./Header.react":174,"./Navigation.react":175,"array-swap":1,"async":2,"lodash":32,"react":166}],173:[function(require,module,exports){ 'use strict'; var _ = require('lodash'); @@ -50219,8 +50249,10 @@ var PageItemText = require('./PageItemText.react'); var PageItemCaption = require('./PageItemCaption.react'); var PageItemImage = require('./PageItemImage.react'); var PageItemP5 = require('./PageItemP5.react'); +var PageItemHtml = require('./PageItemHtml.react'); var PageItemVideo = require('./PageItemVideo.react'); var PageItemVimeo = require('./PageItemVimeo.react'); +var PageItemYouTube = require('./PageItemYouTube.react'); var Collection = React.createClass({ displayName: 'Collection', @@ -50247,17 +50279,32 @@ var Collection = React.createClass({ case 'P5': return React.createElement(PageItemP5, { key: _.uniqueId(), content: item.content }); break; + case 'HTML': + return React.createElement(PageItemHtml, { key: _.uniqueId(), src: item.path }); + break; case 'VIDEO': return React.createElement(PageItemVideo, { key: _.uniqueId(), src: item.path }); break; case 'VIMEO': var vimeoObject = JSON.parse(item.content); - // console.log(vimeoObject); return React.createElement(PageItemVimeo, { key: _.uniqueId(), vimeoId: vimeoObject['id'], width: vimeoObject['width'], - height: vimeoObject['height'] + height: vimeoObject['height'], + autoplay: vimeoObject['autoplay'], + loop: vimeoObject['loop'] + }); + break; + case 'YOUTUBE': + var youtubeObject = JSON.parse(item.content); + return React.createElement(PageItemYouTube, { + key: _.uniqueId(), + youtubeId: youtubeObject['id'], + width: youtubeObject['width'], + height: youtubeObject['height'], + autoplay: youtubeObject['autoplay'], + loop: youtubeObject['loop'] }); break; } @@ -50278,7 +50325,7 @@ var Collection = React.createClass({ module.exports = Collection; -},{"./PageItemCaption.react":175,"./PageItemImage.react":176,"./PageItemP5.react":177,"./PageItemText.react":178,"./PageItemVideo.react":179,"./PageItemVimeo.react":180,"lodash":31,"react":165}],173:[function(require,module,exports){ +},{"./PageItemCaption.react":176,"./PageItemHtml.react":177,"./PageItemImage.react":178,"./PageItemP5.react":179,"./PageItemText.react":180,"./PageItemVideo.react":181,"./PageItemVimeo.react":182,"./PageItemYouTube.react":183,"lodash":32,"react":166}],174:[function(require,module,exports){ 'use strict'; var React = require('react'); @@ -50339,7 +50386,7 @@ var Header = React.createClass({ module.exports = Header; -},{"react":165}],174:[function(require,module,exports){ +},{"react":166}],175:[function(require,module,exports){ 'use strict'; var React = require('react'); @@ -50427,7 +50474,7 @@ var Navigation = React.createClass({ module.exports = Navigation; -},{"classnames":2,"react":165,"react-sticky":36}],175:[function(require,module,exports){ +},{"classnames":3,"react":166,"react-sticky":37}],176:[function(require,module,exports){ 'use strict'; var React = require('react'); @@ -50458,7 +50505,33 @@ var PageItemCaption = React.createClass({ module.exports = PageItemCaption; -},{"../utils/react":181,"react":165}],176:[function(require,module,exports){ +},{"../utils/react":184,"react":166}],177:[function(require,module,exports){ +'use strict'; + +var React = require('react'); + +var PageItemHtml = React.createClass({ + displayName: 'PageItemHtml', + + getDefaultProps: function getDefaultProps() { + return { + src: "" + }; + }, + + render: function render() { + console.log("render PageItemHtml"); + return React.createElement( + 'div', + { className: 'element' }, + React.createElement('iframe', { src: this.props.src, scrolling: 'no', style: { height: 600 + 'px' } }) + ); + } +}); + +module.exports = PageItemHtml; + +},{"react":166}],178:[function(require,module,exports){ 'use strict'; var React = require('react'); @@ -50483,7 +50556,7 @@ var PageItemImage = React.createClass({ module.exports = PageItemImage; -},{"react":165}],177:[function(require,module,exports){ +},{"react":166}],179:[function(require,module,exports){ 'use strict'; var _ = require('lodash'); @@ -50547,7 +50620,7 @@ var PageItemP5 = React.createClass({ module.exports = PageItemP5; -},{"lodash":31,"react":165}],178:[function(require,module,exports){ +},{"lodash":32,"react":166}],180:[function(require,module,exports){ 'use strict'; var React = require('react'); @@ -50578,7 +50651,7 @@ var PageItemText = React.createClass({ module.exports = PageItemText; -},{"../utils/react":181,"react":165}],179:[function(require,module,exports){ +},{"../utils/react":184,"react":166}],181:[function(require,module,exports){ 'use strict'; var _ = require('lodash'); @@ -50609,7 +50682,7 @@ var PageItemVideo = React.createClass({ module.exports = PageItemVideo; -},{"lodash":31,"react":165}],180:[function(require,module,exports){ +},{"lodash":32,"react":166}],182:[function(require,module,exports){ 'use strict'; var _ = require('lodash'); @@ -50638,6 +50711,12 @@ var PageItemVimeo = React.createClass({ createUrl: function createUrl() { var vimeoSrc = 'https://player.vimeo.com/video/' + this.props.vimeoId; + if (this.props.autoplay == 1) { + vimeoSrc = vimeoSrc + '?autoplay=1'; + } + if (this.props.loop == 1) { + vimeoSrc = vimeoSrc + '&loop=1'; + } return vimeoSrc; }, @@ -50652,7 +50731,57 @@ var PageItemVimeo = React.createClass({ module.exports = PageItemVimeo; -},{"lodash":31,"react":165}],181:[function(require,module,exports){ +},{"lodash":32,"react":166}],183:[function(require,module,exports){ +'use strict'; + +var _ = require('lodash'); +var React = require('react'); + +var PageItemYouTube = React.createClass({ + displayName: 'PageItemYouTube', + + getDefaultProps: function getDefaultProps() { + return { + youtubeId: "", + width: 600, + height: 400 + }; + }, + + getLayoutWidth: function getLayoutWidth() { + return 600; + }, + + calcHeight: function calcHeight() { + var layoutHeight = this.getLayoutWidth() * this.props.height / this.props.width; + layoutHeight = Math.ceil(layoutHeight); + return layoutHeight; + }, + + createUrl: function createUrl() { + var youtubeSrc = 'http://www.youtube.com/embed/' + this.props.youtubeId + '?'; + if (this.props.autoplay == 1) { + youtubeSrc = youtubeSrc + 'autoplay=1'; + } + if (this.props.loop == 1) { + youtubeSrc = youtubeSrc + '&loop=1&playlist=' + this.props.youtubeId; + } + + return youtubeSrc; + }, + + render: function render() { + return React.createElement( + 'div', + { className: 'element' }, + React.createElement('iframe', { id: 'ytplayer', type: 'text/html', src: this.createUrl(), width: this.getLayoutWidth(), height: this.calcHeight(), allowFullScreen: true }) + ); + } +}); + +module.exports = PageItemYouTube; + +},{"lodash":32,"react":166}],184:[function(require,module,exports){ "use strict"; var _ = require('lodash'); @@ -50671,7 +50800,7 @@ function markdownToHtml(content) { module.exports.markdownToHtml = markdownToHtml; -},{"lodash":31,"markdown":32,"react":165}],182:[function(require,module,exports){ +},{"lodash":32,"markdown":33,"react":166}],185:[function(require,module,exports){ "use strict"; function endsWith(str, suffix) { @@ -50691,4 +50820,4 @@ module.exports.endsWith = endsWith; module.exports.startsWith = startsWith; module.exports.extension = extension; -},{}]},{},[170]); +},{}]},{},[171]);