1 /*
  2   JWL - The JavaScript Widget Library version 0.8.7
  3   Copyright (c) 2016 - 2020 The Zonebuilder <zone.builder@gmx.com>
  4   http://sourceforge.net/projects/jwl-library/
  5   Licenses: GNU GPL2 or later; GNU LGPLv3 or later (http://sourceforge.net/p/jwl-library/wiki/License/)
  6  */
  7 /**
  8   @fileOverview  JWL.components.playerbar configuration
  9 */
 10 /* jshint browser: true, curly: true, eqeqeq: true, expr: true, funcscope: true, immed: true, latedef: true, loopfunc: true,  
 11   onevar: true, newcap: true, noarg: true, node: true, strict: true, trailing: true, undef: true, unused: vars, wsh: true */
 12 /* globals JUL */
 13 
 14 (function(global, module) {
 15 'use strict';
 16 if (module && module.exports && typeof require === 'function') { require('jul'); }
 17 var jul = new JUL.Instance({nsRoot: module && module.exports ? {JWL: module.exports} : global || null});
 18 var JWL = jul.ns('JWL');
 19 
 20 /* generated by JCS version 1.5.8 */
 21 
 22 /**
 23   General purpose player bar
 24   @namespace  JWL.components.playerbar namespace
 25   @name  JWL.components.playerbar
 26 */
 27 jul.ns('JWL.components.playerbar');
 28 
 29 jul.apply(jul.get('JWL.components.playerbar'), /** @lends JWL.components.playerbar */ {
 30   /**
 31     Component UI
 32     @type  Object
 33   */
 34   ui: {
 35     tag: 'div', cid: '.playerbar', css: 'playerbar', children: [
 36       {tag: 'a', cid: '.playerbar-gotostart', css: 'fa fa-fast-backward', href: '#', title: 'Go to start'},
 37       {tag: 'a', cid: '.playerbar-stepbackward', css: 'fa fa-step-backward', href: '#', title: 'Step backward'},
 38       {tag: 'a', cid: '.playerbar-play', css: 'playerbar-play fa fa-play', href: '#', title: 'Play'},
 39       {tag: 'a', cid: '.playerbar-stepforward', css: 'fa fa-step-forward', href: '#', title: 'Step forward'},
 40       {tag: 'a', cid: '.playerbar-gotoend', css: 'fa fa-fast-forward', href: '#', title: 'Go to end'},
 41       {tag: 'a', cid: '.playerbar-stop', css: 'fa fa-stop', href: '#', title: 'Stop'}
 42     ]
 43   },
 44   /**
 45     Component logic
 46     @type  Object
 47   */
 48   logic: {
 49     '.playerbar': {
 50       listeners: {
 51         pause: function () {
 52           this.showPlay();
 53         },
 54         play: function () {
 55           this.showPlay(true);
 56         },
 57         stop: function () {
 58           this.showPlay();
 59         }
 60       }
 61     },
 62     '.playerbar-gotoend': {
 63       listeners: {
 64         click: function (oEvent) {
 65           oEvent = oEvent || event;  
 66           try { oEvent.preventDefault(); } catch(e) {}
 67           JWL.trigger(this, 'gotoend');
 68           return false;
 69         }
 70       }
 71     },
 72     '.playerbar-gotostart': {
 73       listeners: {
 74         click: function (oEvent) {
 75           oEvent = oEvent || event;  
 76           try { oEvent.preventDefault(); } catch(e) {}
 77           JWL.trigger(this, 'gotostart');
 78           return false;
 79         }
 80       }
 81     },
 82     '.playerbar-play': {
 83       listeners: {
 84         click: function (oEvent) {
 85           oEvent = oEvent || event;  
 86           try { oEvent.preventDefault(); } catch(e) {}
 87           var sClass = this.getAttribute('class');
 88           if (sClass.indexOf('fa-play') > -1) {
 89             JWL.trigger(this, 'play');
 90           }
 91           else {
 92             JWL.trigger(this, 'pause');
 93         }
 94           return false;
 95         }
 96       }
 97     },
 98     '.playerbar-stepbackward': {
 99       listeners: {
100         click: function (oEvent) {
101           oEvent = oEvent || event;  
102           try { oEvent.preventDefault(); } catch(e) {}
103           JWL.trigger(this, 'stepbackward');
104           return false;
105         }
106       }
107     },
108     '.playerbar-stepforward': {
109       listeners: {
110         click: function (oEvent) {
111           oEvent = oEvent || event;  
112           try { oEvent.preventDefault(); } catch(e) {}
113           JWL.trigger(this, 'stepforward');
114           return false;
115         }
116       }
117     },
118     '.playerbar-stop': {
119       listeners: {
120         click: function (oEvent) {
121           oEvent = oEvent || event;  
122           try { oEvent.preventDefault(); } catch(e) {}
123           JWL.trigger(this, 'stop');
124           return false;
125         }
126       }
127     }
128   },
129   /**
130     Component prototype members
131     @type  Object
132   */
133   prototype: {
134     /**
135       Updates the display of the player bar controls
136       @param  {Boolean}  [bPause]  Set it to true to show a paused playing
137     */
138     showPlay: function(bPause) {
139       var oPlay = JWL.get(this).querySelector( '.playerbar-play');
140       var sClass = oPlay.getAttribute('class');
141       oPlay.setAttribute('class', sClass.replace(bPause ? 'fa-play' : 'fa-pause', bPause ? 'fa-pause' : 'fa-play'));
142       oPlay.setAttribute('title', bPause ? 'Pause' : 'Play');
143     }
144   },
145   /**
146     Array of internal/external CSS for registering the custom element
147     @type  Array|String
148   */
149   css: ['lib/faws/css/font-awesome.min.css?v=0.8.5',
150    'lib/jwl/css/playerbar.css?v=0.8.5']
151 });
152 
153 })(typeof global !== 'undefined' ? global : window, typeof module !== 'undefined' ? module : null);
154 
155 /* end JWL.components.playerbar.js */
156