1
|
{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///clappr-playback-rate-plugin.min.js","webpack:///webpack/bootstrap 9b75d8829f070623baa9","webpack:///./src/main.js","webpack:///external \"Clappr\"","webpack:///./src/public/playback-rate-selector.html","webpack:///./src/public/style.scss","webpack:///./~/css-loader/lib/css-base.js"],"names":["root","factory","exports","module","require","define","amd","this","__WEBPACK_EXTERNAL_MODULE_1__","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","_interopRequireDefault","obj","__esModule","default","_classCallCheck","instance","Constructor","TypeError","_inherits","subClass","superClass","prototype","Object","create","constructor","value","enumerable","writable","configurable","setPrototypeOf","__proto__","defineProperty","_createClass","defineProperties","target","props","i","length","descriptor","key","protoProps","staticProps","_get","_x","_x2","_x3","_again","object","property","receiver","Function","desc","getOwnPropertyDescriptor","undefined","getter","get","parent","getPrototypeOf","_clappr","_publicPlaybackRateSelectorHtml","_publicPlaybackRateSelectorHtml2","_publicStyleScss","_publicStyleScss2","DEFAULT_PLAYBACK_RATES","label","DEFAULT_PLAYBACK_RATE","PlaybackRatePlugin","_UICorePlugin","apply","arguments","listenTo","core","mediaControl","Events","MEDIACONTROL_CONTAINERCHANGED","reload","MEDIACONTROL_RENDERED","render","MEDIACONTROL_HIDE","hideContextMenu","MEDIACONTROL_PLAYBACKRATE","updatePlaybackRate","stopListening","unBindEvents","bindEvents","getCurrentContainer","currentPlayback","getCurrentPlayback","tagName","cfg","options","playbackRateConfig","playbackRates","selectedRate","defaultValue","shouldRender","t","template","html","title","getTitle","$el","style","Styler","getStyleFor","baseUrl","append","$","el","updateText","event","rate","dataset","playbackRateSelect","setSelectedRate","toggleContextMenu","stopPropagation","toggle","hide","find","playbackRate","rateValue","removeClass","addClass","_this","forEach","r","buttonElement","text","setActiveListItem","class","name","data-playback-rate-select","click [data-playback-rate-select]","click [data-playback-rate-button]","UICorePlugin","type","push","list","toString","result","item","join","mediaQuery","alreadyImportedModules"],"mappings":"CAAA,SAAAA,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AAeF,EAAK,GACtBA,EAAK,GAAKE,EACDA,IACTF,EAAK,GAAK,IAAMA,EAAK,GAAK,UAAYE,EAAa,KAEpDL,EAAKD,KAAKI,MAINH","file":"clappr-playback-rate-plugin.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"Clappr\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"Clappr\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"PlaybackRatePlugin\"] = factory(require(\"Clappr\"));\n\telse\n\t\troot[\"PlaybackRatePlugin\"] = factory(root[\"Clappr\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_1__) {\nreturn \n\n\n/** WEBPACK FOOTER **\n ** webpack/universalModuleDefinition\n **/","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"Clappr\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"Clappr\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"PlaybackRatePlugin\"] = factory(require(\"Clappr\"));\n\telse\n\t\troot[\"PlaybackRatePlugin\"] = factory(root[\"Clappr\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_1__) {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"<%=baseUrl%>/\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/*!*********************!*\\\n !*** ./src/main.js ***!\n \\*********************/\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';Object.defineProperty(exports,'__esModule',{value:true});var _createClass=(function(){function defineProperties(target,props){for(var i=0;i < props.length;i++) {var descriptor=props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if('value' in descriptor)descriptor.writable = true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};})();var _get=function get(_x,_x2,_x3){var _again=true;_function: while(_again) {var object=_x,property=_x2,receiver=_x3;_again = false;if(object === null)object = Function.prototype;var desc=Object.getOwnPropertyDescriptor(object,property);if(desc === undefined){var parent=Object.getPrototypeOf(object);if(parent === null){return undefined;}else {_x = parent;_x2 = property;_x3 = receiver;_again = true;desc = parent = undefined;continue _function;}}else if('value' in desc){return desc.value;}else {var getter=desc.get;if(getter === undefined){return undefined;}return getter.call(receiver);}}};function _interopRequireDefault(obj){return obj && obj.__esModule?obj:{'default':obj};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError('Cannot call a class as a function');}}function _inherits(subClass,superClass){if(typeof superClass !== 'function' && superClass !== null){throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass);}subClass.prototype = Object.create(superClass && superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__ = superClass;}var _clappr=__webpack_require__(/*! clappr */ 1);var _publicPlaybackRateSelectorHtml=__webpack_require__(/*! ./public/playback-rate-selector.html */ 2);var _publicPlaybackRateSelectorHtml2=_interopRequireDefault(_publicPlaybackRateSelectorHtml);var _publicStyleScss=__webpack_require__(/*! ./public/style.scss */ 3);var _publicStyleScss2=_interopRequireDefault(_publicStyleScss);var DEFAULT_PLAYBACK_RATES=[{value:'0.5',label:'0.5x'},{value:'0.75',label:'0.75x'},{value:'1.0',label:'Normal'},{value:'1.5',label:'1.5x'},{value:'2.0',label:'2x'}];var DEFAULT_PLAYBACK_RATE='1.0';var PlaybackRatePlugin=(function(_UICorePlugin){_inherits(PlaybackRatePlugin,_UICorePlugin);function PlaybackRatePlugin(){_classCallCheck(this,PlaybackRatePlugin);_get(Object.getPrototypeOf(PlaybackRatePlugin.prototype),'constructor',this).apply(this,arguments);}_createClass(PlaybackRatePlugin,[{key:'bindEvents',value:function bindEvents(){this.listenTo(this.core.mediaControl,_clappr.Events.MEDIACONTROL_CONTAINERCHANGED,this.reload);this.listenTo(this.core.mediaControl,_clappr.Events.MEDIACONTROL_RENDERED,this.render);this.listenTo(this.core.mediaControl,_clappr.Events.MEDIACONTROL_HIDE,this.hideContextMenu);this.listenTo(this.core.mediaControl,PlaybackRatePlugin.MEDIACONTROL_PLAYBACKRATE,this.updatePlaybackRate);}},{key:'unBindEvents',value:function unBindEvents(){this.stopListening(this.core.mediaControl,_clappr.Events.MEDIACONTROL_CONTAINERCHANGED);this.stopListening(this.core.mediaControl,_clappr.Events.MEDIACONTROL_RENDERED);this.stopListening(this.core.mediaControl,_clappr.Events.MEDIACONTROL_HIDE);}},{key:'reload',value:function reload(){this.unBindEvents();this.bindEvents();}},{key:'shouldRender',value:function shouldRender(){if(!this.core.getCurrentContainer()){return false;}var currentPlayback=this.core.getCurrentPlayback();if(currentPlayback.tagName != 'video' && currentPlayback.tagName != 'audio'){ //console.warn('PlaybackRatePlugin#shouldRender: Cannot affect rate for playback', currentPlayback);\n\treturn false;}return true;}},{key:'render',value:function render(){ //console.log('PlaybackRatePlugin#render()');\n\tvar cfg=this.core.options.playbackRateConfig || {};if(!this.playbackRates){this.playbackRates = cfg.options || DEFAULT_PLAYBACK_RATES;}if(!this.selectedRate){this.selectedRate = cfg.defaultValue || DEFAULT_PLAYBACK_RATE;}if(this.shouldRender()){var t=(0,_clappr.template)(_publicPlaybackRateSelectorHtml2['default']);var html=t({playbackRates:this.playbackRates,title:this.getTitle()});this.$el.html(html);var style=_clappr.Styler.getStyleFor(_publicStyleScss2['default'],{baseUrl:this.core.options.baseUrl});this.$el.append(style);this.core.mediaControl.$('.media-control-right-panel').append(this.el);this.updateText();}return this;}},{key:'onRateSelect',value:function onRateSelect(event){ //console.log('onRateSelect', event.target);\n\tvar rate=event.target.dataset.playbackRateSelect;this.setSelectedRate(rate);this.toggleContextMenu();event.stopPropagation();return false;}},{key:'onShowMenu',value:function onShowMenu(event){this.toggleContextMenu();}},{key:'toggleContextMenu',value:function toggleContextMenu(){this.$('.playback_rate ul').toggle();}},{key:'hideContextMenu',value:function hideContextMenu(){this.$('.playback_rate ul').hide();}},{key:'updatePlaybackRate',value:function updatePlaybackRate(rate){this.setSelectedRate(rate);}},{key:'setSelectedRate',value:function setSelectedRate(rate){ // Set <video playbackRate=\"...\"\n\tthis.core.$el.find('video').get(0).playbackRate = rate;this.selectedRate = rate;this.updateText();}},{key:'setActiveListItem',value:function setActiveListItem(rateValue){this.$('a').removeClass('active');this.$('a[data-playback-rate-select=\"' + rateValue + '\"]').addClass('active');}},{key:'buttonElement',value:function buttonElement(){return this.$('.playback_rate button');}},{key:'getTitle',value:function getTitle(){var _this=this;var title=this.selectedRate;this.playbackRates.forEach(function(r){if(r.value == _this.selectedRate){title = r.label;}});return title;}},{key:'updateText',value:function updateText(){this.buttonElement().text(this.getTitle());this.setActiveListItem(this.selectedRate);}},{key:'name',get:function get(){return 'playback_rate';}},{key:'template',get:function get(){return (0,_clappr.template)(_publicPlaybackRateSelectorHtml2['default']);}},{key:'attributes',get:function get(){return {'class':this.name,'data-playback-rate-select':''};}},{key:'events',get:function get(){return {'click [data-playback-rate-select]':'onRateSelect','click [data-playback-rate-button]':'onShowMenu'};}}]);return PlaybackRatePlugin;})(_clappr.UICorePlugin);exports['default'] = PlaybackRatePlugin;PlaybackRatePlugin.type = 'core';PlaybackRatePlugin.MEDIACONTROL_PLAYBACKRATE = 'playbackRate';module.exports = exports['default'];\n\n/***/ },\n/* 1 */\n/*!*************************!*\\\n !*** external \"Clappr\" ***!\n \\*************************/\n/***/ function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n/***/ },\n/* 2 */\n/*!************************************************!*\\\n !*** ./src/public/playback-rate-selector.html ***!\n \\************************************************/\n/***/ function(module, exports) {\n\n\tmodule.exports = \"<button data-playback-rate-button>\\n <%= title %>\\n</button>\\n<ul>\\n <% for (var i = 0; i < playbackRates.length; i++) { %>\\n <li><a href=\\\"#\\\" data-playback-rate-select=\\\"<%= playbackRates[i].value %>\\\"><%= playbackRates[i].label %></a></li>\\n <% }; %>\\n</ul>\\n\";\n\n/***/ },\n/* 3 */\n/*!*******************************!*\\\n !*** ./src/public/style.scss ***!\n \\*******************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\texports = module.exports = __webpack_require__(/*! ./../../~/css-loader/lib/css-base.js */ 4)();\n\t// imports\n\t\n\t\n\t// module\n\texports.push([module.id, \".playback_rate[data-playback-rate-select]{float:right;margin-top:5px;position:relative}.playback_rate[data-playback-rate-select] button{background-color:transparent;color:#fff;font-family:Roboto,Open Sans,Arial,sans-serif;-webkit-font-smoothing:antialiased;border:none;font-size:10px;cursor:pointer}.playback_rate[data-playback-rate-select] button:hover{color:#c9c9c9}.playback_rate[data-playback-rate-select] button.changing{-webkit-animation:pulse .5s infinite alternate}.playback_rate[data-playback-rate-select]>ul{display:none;list-style-type:none;position:absolute;bottom:25px;border:1px solid #000;border-radius:4px;background-color:rgba(0,0,0,.7)}.playback_rate[data-playback-rate-select] li{position:relative;font-size:10px}.playback_rate[data-playback-rate-select] li[data-title]{padding:5px}.playback_rate[data-playback-rate-select] li a{color:#aaa;padding:2px 10px 2px 15px;display:block;text-decoration:none}.playback_rate[data-playback-rate-select] li a.active{background-color:#000;font-weight:700;color:#fff}.playback_rate[data-playback-rate-select] li a.active:before{content:'\\\\2713';position:absolute;top:2px;left:4px}.playback_rate[data-playback-rate-select] li a:hover{color:#fff;text-decoration:none}@-webkit-keyframes pulse{0%{color:#fff}50%{color:#ff0101}to{color:#b80000}}\", \"\"]);\n\t\n\t// exports\n\n\n/***/ },\n/* 4 */\n/*!**************************************!*\\\n !*** ./~/css-loader/lib/css-base.js ***!\n \\**************************************/\n/***/ function(module, exports) {\n\n\t/*\r\n\t\tMIT License http://www.opensource.org/licenses/mit-license.php\r\n\t\tAuthor Tobias Koppers @sokra\r\n\t*/ // css base code, injected by the css-loader\n\t\"use strict\";module.exports = function(){var list=[]; // return the list of modules as css string\n\tlist.toString = function toString(){var result=[];for(var i=0;i < this.length;i++) {var item=this[i];if(item[2]){result.push(\"@media \" + item[2] + \"{\" + item[1] + \"}\");}else {result.push(item[1]);}}return result.join(\"\");}; // import a list of modules into the list\n\tlist.i = function(modules,mediaQuery){if(typeof modules === \"string\")modules = [[null,modules,\"\"]];var alreadyImportedModules={};for(var i=0;i < this.length;i++) {var id=this[i][0];if(typeof id === \"number\")alreadyImportedModules[id] = true;}for(i = 0;i < modules.length;i++) {var item=modules[i]; // skip already imported module\n\t// this implementation is not 100% perfect for weird media query combinations\n\t// when a module is imported multiple times with different media queries.\n\t// I hope this will never occur (Hey this way we have smaller bundles)\n\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]){if(mediaQuery && !item[2]){item[2] = mediaQuery;}else if(mediaQuery){item[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";}list.push(item);}}};return list;};\n\n/***/ }\n/******/ ])\n});\n;\n\n\n/** WEBPACK FOOTER **\n ** clappr-playback-rate-plugin.min.js\n **/"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"<%=baseUrl%>/\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 9b75d8829f070623baa9\n **/","import {Events, Styler, UICorePlugin, template} from 'clappr'\nimport pluginHtml from './public/playback-rate-selector.html'\nimport pluginStyle from './public/style.scss'\n\n\nconst DEFAULT_PLAYBACK_RATES = [\n {value: '0.5', label: '0.5x'},\n {value: '0.75', label: '0.75x'},\n {value: '1.0', label: 'Normal'},\n {value: '1.5', label: '1.5x'},\n {value: '2.0', label: '2x'}\n];\n\nconst DEFAULT_PLAYBACK_RATE = '1.0';\n\n\nexport default class PlaybackRatePlugin extends UICorePlugin {\n\n get name() { return 'playback_rate'; }\n get template() { return template(pluginHtml); }\n\n get attributes() {\n return {\n 'class': this.name,\n 'data-playback-rate-select': ''\n }\n }\n\n get events() {\n return {\n 'click [data-playback-rate-select]': 'onRateSelect',\n 'click [data-playback-rate-button]': 'onShowMenu'\n }\n }\n\n bindEvents() {\n this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_CONTAINERCHANGED, this.reload);\n this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_RENDERED, this.render);\n this.listenTo(this.core.mediaControl, Events.MEDIACONTROL_HIDE, this.hideContextMenu);\n this.listenTo(this.core.mediaControl, PlaybackRatePlugin.MEDIACONTROL_PLAYBACKRATE, this.updatePlaybackRate);\n }\n\n unBindEvents() {\n this.stopListening(this.core.mediaControl, Events.MEDIACONTROL_CONTAINERCHANGED);\n this.stopListening(this.core.mediaControl, Events.MEDIACONTROL_RENDERED);\n this.stopListening(this.core.mediaControl, Events.MEDIACONTROL_HIDE);\n }\n\n reload() {\n this.unBindEvents();\n this.bindEvents();\n }\n\n shouldRender() {\n if (!this.core.getCurrentContainer()) {\n return false;\n }\n\n var currentPlayback = this.core.getCurrentPlayback();\n if (currentPlayback.tagName != 'video' && currentPlayback.tagName != 'audio') {\n //console.warn('PlaybackRatePlugin#shouldRender: Cannot affect rate for playback', currentPlayback);\n return false;\n }\n\n return true;\n }\n\n render() {\n //console.log('PlaybackRatePlugin#render()');\n const cfg = this.core.options.playbackRateConfig || {};\n\n if (!this.playbackRates) {\n this.playbackRates = cfg.options || DEFAULT_PLAYBACK_RATES;\n }\n\n if (!this.selectedRate) {\n this.selectedRate = cfg.defaultValue || DEFAULT_PLAYBACK_RATE;\n }\n\n if (this.shouldRender()) {\n var t = template(pluginHtml);\n var html = t({playbackRates: this.playbackRates, title: this.getTitle()});\n this.$el.html(html);\n\n var style = Styler.getStyleFor(pluginStyle, {baseUrl: this.core.options.baseUrl});\n this.$el.append(style);\n\n this.core.mediaControl.$('.media-control-right-panel').append(this.el);\n this.updateText();\n }\n\n return this;\n }\n\n onRateSelect(event) {\n //console.log('onRateSelect', event.target);\n let rate = event.target.dataset.playbackRateSelect;\n this.setSelectedRate(rate);\n this.toggleContextMenu();\n event.stopPropagation();\n return false;\n }\n\n onShowMenu(event) {\n this.toggleContextMenu();\n }\n\n toggleContextMenu() {\n this.$('.playback_rate ul').toggle();\n }\n\n hideContextMenu() {\n this.$('.playback_rate ul').hide();\n }\n\n updatePlaybackRate(rate) {\n this.setSelectedRate(rate);\n }\n\n setSelectedRate(rate) {\n // Set <video playbackRate=\"...\"\n this.core.$el.find('video').get(0).playbackRate = rate;\n this.selectedRate = rate;\n this.updateText();\n }\n\n setActiveListItem(rateValue) {\n this.$(`a`).removeClass('active');\n this.$(`a[data-playback-rate-select=\"${rateValue}\"]`).addClass('active');\n }\n\n buttonElement() {\n return this.$('.playback_rate button');\n }\n\n getTitle() {\n let title = this.selectedRate;\n this.playbackRates.forEach((r) => {\n if (r.value == this.selectedRate) {\n title = r.label;\n }\n });\n return title;\n }\n\n updateText() {\n this.buttonElement().text(this.getTitle());\n this.setActiveListItem(this.selectedRate);\n }\n}\n\nPlaybackRatePlugin.type = 'core';\nPlaybackRatePlugin.MEDIACONTROL_PLAYBACKRATE = 'playbackRate';\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/main.js\n **/","module.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"Clappr\"\n ** module id = 1\n ** module chunks = 0\n **/","module.exports = \"<button data-playback-rate-button>\\n <%= title %>\\n</button>\\n<ul>\\n <% for (var i = 0; i < playbackRates.length; i++) { %>\\n <li><a href=\\\"#\\\" data-playback-rate-select=\\\"<%= playbackRates[i].value %>\\\"><%= playbackRates[i].label %></a></li>\\n <% }; %>\\n</ul>\\n\";\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/public/playback-rate-selector.html\n ** module id = 2\n ** module chunks = 0\n **/","exports = module.exports = require(\"./../../node_modules/css-loader/lib/css-base.js\")();\n// imports\n\n\n// module\nexports.push([module.id, \".playback_rate[data-playback-rate-select]{float:right;margin-top:5px;position:relative}.playback_rate[data-playback-rate-select] button{background-color:transparent;color:#fff;font-family:Roboto,Open Sans,Arial,sans-serif;-webkit-font-smoothing:antialiased;border:none;font-size:10px;cursor:pointer}.playback_rate[data-playback-rate-select] button:hover{color:#c9c9c9}.playback_rate[data-playback-rate-select] button.changing{-webkit-animation:pulse .5s infinite alternate}.playback_rate[data-playback-rate-select]>ul{display:none;list-style-type:none;position:absolute;bottom:25px;border:1px solid #000;border-radius:4px;background-color:rgba(0,0,0,.7)}.playback_rate[data-playback-rate-select] li{position:relative;font-size:10px}.playback_rate[data-playback-rate-select] li[data-title]{padding:5px}.playback_rate[data-playback-rate-select] li a{color:#aaa;padding:2px 10px 2px 15px;display:block;text-decoration:none}.playback_rate[data-playback-rate-select] li a.active{background-color:#000;font-weight:700;color:#fff}.playback_rate[data-playback-rate-select] li a.active:before{content:'\\\\2713';position:absolute;top:2px;left:4px}.playback_rate[data-playback-rate-select] li a:hover{color:#fff;text-decoration:none}@-webkit-keyframes pulse{0%{color:#fff}50%{color:#ff0101}to{color:#b80000}}\", \"\"]);\n\n// exports\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/public/style.scss\n ** module id = 3\n ** module chunks = 0\n **/","/*\r\n\tMIT License http://www.opensource.org/licenses/mit-license.php\r\n\tAuthor Tobias Koppers @sokra\r\n*/\r\n// css base code, injected by the css-loader\r\nmodule.exports = function() {\r\n\tvar list = [];\r\n\r\n\t// return the list of modules as css string\r\n\tlist.toString = function toString() {\r\n\t\tvar result = [];\r\n\t\tfor(var i = 0; i < this.length; i++) {\r\n\t\t\tvar item = this[i];\r\n\t\t\tif(item[2]) {\r\n\t\t\t\tresult.push(\"@media \" + item[2] + \"{\" + item[1] + \"}\");\r\n\t\t\t} else {\r\n\t\t\t\tresult.push(item[1]);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result.join(\"\");\r\n\t};\r\n\r\n\t// import a list of modules into the list\r\n\tlist.i = function(modules, mediaQuery) {\r\n\t\tif(typeof modules === \"string\")\r\n\t\t\tmodules = [[null, modules, \"\"]];\r\n\t\tvar alreadyImportedModules = {};\r\n\t\tfor(var i = 0; i < this.length; i++) {\r\n\t\t\tvar id = this[i][0];\r\n\t\t\tif(typeof id === \"number\")\r\n\t\t\t\talreadyImportedModules[id] = true;\r\n\t\t}\r\n\t\tfor(i = 0; i < modules.length; i++) {\r\n\t\t\tvar item = modules[i];\r\n\t\t\t// skip already imported module\r\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\r\n\t\t\t// when a module is imported multiple times with different media queries.\r\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\r\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\r\n\t\t\t\tif(mediaQuery && !item[2]) {\r\n\t\t\t\t\titem[2] = mediaQuery;\r\n\t\t\t\t} else if(mediaQuery) {\r\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\r\n\t\t\t\t}\r\n\t\t\t\tlist.push(item);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\treturn list;\r\n};\r\n\n\n\n/** WEBPACK FOOTER **\n ** ./~/css-loader/lib/css-base.js\n **/"],"sourceRoot":""}
|