diff --git a/css/lightdm-uestibulum.css b/css/lightdm-uestibulum.css index 1d108bf..1f9f81b 100644 --- a/css/lightdm-uestibulum.css +++ b/css/lightdm-uestibulum.css @@ -15,9 +15,9 @@ body { color: white; font-family: Exo2; } -.bg { +#background-image { + opacity: 1; display: block; - opacity: 0; transition: 1s; position: fixed; width: 100%; @@ -25,18 +25,6 @@ body { right: 0; z-index: -1; } -.morning #bg-morning { - opacity: 1; } - -.afternoon #bg-afternoon { - opacity: 1; } - -.evening #bg-evening { - opacity: 1; } - -.night #bg-night { - opacity: 1; } - #ui-container { position: fixed; top: 0; @@ -158,77 +146,4 @@ body { .throb { animation: alternate infinite 2s throb; } -.evening #clock-panel { - border-bottom: 2px solid white; - text-align: right; - position: absolute; - right: 0; - top: 0; } -.evening #login-panel { - position: absolute; - bottom: 2vw; - left: 1vw; } -.evening #session-panel { - position: absolute; - bottom: 0.5vw; - left: 1vw; } - -.morning #clock-panel, .night #clock-panel, .afternoon #clock-panel { - border-top: 2px solid white; - position: absolute; - left: 0; - bottom: 0; } -.morning #login-panel, .night #login-panel, .afternoon #login-panel { - position: absolute; - bottom: 2vw; - left: 20vw; } -.morning #session-panel, .night #session-panel, .afternoon #session-panel { - position: absolute; - bottom: 0.5vw; - left: 20vw; } - -.morning #clock-panel { - text-shadow: 0 0 0.2vw #446688; } -.morning #users:hover #user-display, .morning #sessions:hover #session-display, -.morning #users-list li:hover, .morning #sessions-list li.session:hover { - color: #0088aa; - text-shadow: 0 0 0.5vw black; } -.morning #power-panel { - opacity: 0.7; } - -.afternoon #clock-panel { - text-shadow: 0 0 2vw #448844; } -.afternoon #users:hover #user-display, .afternoon #sessions:hover #session-display, -.afternoon #users-list li:hover, .afternoon #sessions-list li.session:hover { - color: #00aa00; - text-shadow: 0 0 0.5vw black; } - -.evening #clock-panel { - text-shadow: 0 0 2vw #faaa3b; } -.evening #users:hover #user-display, .evening #sessions:hover #session-display, -.evening #users-list li:hover, .evening #sessions-list li.session:hover { - color: orange; - text-shadow: 0 0 0.5vw black; } -.evening #power-panel { - opacity: 0.7; } - -.night #clock-panel { - text-shadow: 0 0 2vw #884488; } -.night #users:hover #user-display, .night #sessions:hover #session-display, -.night #users-list li:hover, .night #sessions-list li.session:hover { - color: #8822bb; - text-shadow: 0 0 0.2vw black; } - -/*.night { - #clock-panel { - - } - - #login-panel { - position: absolute; - bottom: 2vw; - left: 2vw; - } -}*/ - /*# sourceMappingURL=lightdm-uestibulum.css.map */ diff --git a/css/lightdm-uestibulum.css.map b/css/lightdm-uestibulum.css.map index 9389d33..accc661 100644 --- a/css/lightdm-uestibulum.css.map +++ b/css/lightdm-uestibulum.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AAEA,UAGC;EAFC,WAAW,EAAE,IAAI;EACjB,GAAG,EAAE,6CAA6C;AAGpD,CAAE;EAAE,MAAM,EAAE,CAAC;EAAE,OAAO,EAAE,CAAC;;AAEzB,EAAG;EAAE,SAAS,EAAE,KAAK;;AACrB,EAAG;EAAE,SAAS,EAAE,GAAG;;AAMnB,IAAK;EACH,KAAK,EALG,KAAK;EAMb,WAAW,EAAE,IAAI;;AAGnB,GAAI;EACF,OAAO,EAAE,KAAK;EACd,OAAO,EAAE,CAAC;EACV,UAAU,EAAE,EAAE;EAEd,QAAQ,EAAE,KAAK;EACf,KAAK,EAAE,IAAI;EACX,MAAM,EAAE,CAAC;EACT,KAAK,EAAE,CAAC;EACR,OAAO,EAAE,EAAE;;AAGb,oBAAqB;EAAE,OAAO,EAAE,CAAC;;AACjC,wBAAyB;EAAE,OAAO,EAAE,CAAC;;AACrC,oBAAqB;EAAE,OAAO,EAAE,CAAC;;AACjC,gBAAiB;EAAE,OAAO,EAAE,CAAC;;AAE7B,aAAc;EACZ,QAAQ,EAAE,KAAK;EACf,GAAG,EAAE,CAAC;EACN,MAAM,EAAE,CAAC;EACT,IAAI,EAAE,CAAC;EACP,KAAK,EAAE,CAAC;EACR,OAAO,EAAE,CAAC;;AAGZ,YAAa;EACX,UAA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ss index ef9ac79..809c43e 100644 --- a/css/lightdm-uestibulum.scss +++ b/css/lightdm-uestibulum.scss @@ -10,18 +10,14 @@ h1 { font-size: 1.5vw; } h2 { font-size: 1vw; } -$colorFG: white; -$colorBG: black; -$colorAccent: orange; - body { - color: $colorFG; + color: white; font-family: Exo2 } -.bg { +#background-image { + opacity: 1; display: block; - opacity: 0; transition: 1s; position: fixed; @@ -31,11 +27,6 @@ body { z-index: -1; } -.morning #bg-morning { opacity: 1; } -.afternoon #bg-afternoon { opacity: 1; } -.evening #bg-evening { opacity: 1; } -.night #bg-night { opacity: 1; } - #ui-container { position: fixed; top: 0; @@ -100,8 +91,8 @@ body { input[type=password] { background: none; border: none; - border-bottom: 2px solid $colorFG; - color: $colorFG; + border-bottom: 2px solid white; + color: white; font-size: 1vw; margin-top: 0.5em; opacity: 0; @@ -189,99 +180,3 @@ body { } .throb { animation: alternate infinite 2s throb; } - - -.evening { - #clock-panel { - border-bottom: 2px solid $colorFG; - text-align: right; - - position: absolute; - right: 0; - top: 0; - } - - #login-panel { - position: absolute; - bottom: 2vw; - left: 1vw; - } - - #session-panel { - position: absolute; - bottom: 0.5vw; - left: 1vw; - } -} - -.morning, .night, .afternoon { - #clock-panel { - border-top: 2px solid $colorFG; - - position: absolute; - left: 0; - bottom: 0; - } - - #login-panel { - position: absolute; - bottom: 2vw; - left: 20vw; - } - - #session-panel { - position: absolute; - bottom: 0.5vw; - left: 20vw; - } -} - -.morning { - #clock-panel { text-shadow: 0 0 0.2vw #446688; } - #users:hover #user-display, #sessions:hover #session-display, - #users-list li:hover, #sessions-list li.session:hover { - color: #0088aa; - text-shadow: 0 0 0.5vw black; - } - #power-panel { opacity: 0.7; } -} - -.afternoon { - #clock-panel { text-shadow: 0 0 2vw #448844; } - #users:hover #user-display, #sessions:hover #session-display, - #users-list li:hover, #sessions-list li.session:hover { - color: #00aa00; - text-shadow: 0 0 0.5vw black; - } -} - -.evening { - #clock-panel { text-shadow: 0 0 2vw #faaa3b; } - #users:hover #user-display, #sessions:hover #session-display, - #users-list li:hover, #sessions-list li.session:hover { - color: orange; - text-shadow: 0 0 0.5vw black; - } - #power-panel { opacity: 0.7; } -} - -.night { - #clock-panel { text-shadow: 0 0 2vw #884488; } - #users:hover #user-display, #sessions:hover #session-display, - #users-list li:hover, #sessions-list li.session:hover { - color: #8822bb; - text-shadow: 0 0 0.2vw black; - } -} - -/*.night { - #clock-panel { - - } - - #login-panel { - position: absolute; - bottom: 2vw; - left: 2vw; - } -}*/ diff --git a/img/afternoon.jpg b/img/afternoon.jpg deleted file mode 100644 index 1fe4518..0000000 Binary files a/img/afternoon.jpg and /dev/null differ diff --git a/img/evening.jpg b/img/evening.jpg deleted file mode 100755 index 39b32bd..0000000 Binary files a/img/evening.jpg and /dev/null differ diff --git a/img/morning.jpg b/img/morning.jpg deleted file mode 100644 index a58c21d..0000000 Binary files a/img/morning.jpg and /dev/null differ diff --git a/index.html b/index.html index d8052c0..82216c7 100644 --- a/index.html +++ b/index.html @@ -9,10 +9,7 @@ - - - - +
@@ -37,7 +34,7 @@ -
checking credentials +
checking credentials! ...
diff --git a/js/lightdm-mock.js b/js/lightdm-mock.js index 53b8cde..14e0bff 100644 --- a/js/lightdm-mock.js +++ b/js/lightdm-mock.js @@ -96,6 +96,7 @@ if (!('lightdm' in window)) { lightdm.timed_login_user = lightdm.timed_login_delay > 0 ? lightdm.users[0] : null; + lightdm.get_str = function () {}; lightdm.get_string_property = function () {}; lightdm.get_integer_property = function () {}; lightdm.get_boolean_property = function () {}; diff --git a/js/lightdm-uestibulum.js b/js/lightdm-uestibulum.js index bfc297e..01bb7f5 100644 --- a/js/lightdm-uestibulum.js +++ b/js/lightdm-uestibulum.js @@ -1,10 +1,54 @@ (function() { - var U = window.uestibulum = {}; + var U = window.uestibulum = { + config { theme: 'jdb', hidpi: true }, + themes: {} + }; + _.templateSettings = { interpolate: /\{\{(.+?)\}\}/g }; + U.load = function(tag, url) { + return new Promise(function(resolve, reject) { + var element = document.createElement(tag); + var parent = 'body'; + var attr = 'src'; + + element.onload = resolve; + element.onerror = reject; + + switch (tag) { + case 'script': element.async = true; break; + case 'link': + element.type = 'text/css'; + element.rel = 'stylesheet'; + attr = 'href'; + parent = 'head'; + break; + default: + } + + element[attr] = url; + document[parent].appendChild(element); + }); + }; + + U.ImageModel = Backbone.Model.extend({ + defaults: { url: 'img/black.png' } }); + + U.BackgroundView = Backbone.View.extend({ + el: '#background-image', + + initialize: function(options) { + _.bindAll(this, 'render'); + this.imgModel = options.imageModel; + this.imgModel.on('change:url', this.render); + }, + + render: function() { this.$el.attr('src', this.imgModel.get('url')); } + }); + U.ClockView = Backbone.View.extend({ el: '#clock-panel', @@ -73,7 +117,8 @@ authComplete: function() { console.log('authComplete. is_authenticated: ' + lightdm.is_authenticated); if (lightdm.is_authenticated) { - console.log('Logging in: lightdm.login(' + this.user.name, this.sessionView.key); + console.log('Logging in: lightdm.login(' + this.user.name + ',' + + this.sessionView.key + ')'); //lightdm.start_session(this.sessionView.session.key); this.$el.removeClass('checking'); lightdm.login(this.user, this.sessionView.session.key); @@ -92,7 +137,6 @@ render: function() { this.undelegateEvents(); - var greeting = 'Good ' + this.uiView.timePeriod; var $userListEl = this.$el.find('#users-list'); $userListEl.html( @@ -102,9 +146,10 @@ }, this).join('\n')); if (this.user) { - this.$el.find('#greeting').text(greeting); + this.$el.find('#greeting').text(this.uiView.getGreeting()); this.$el.find('#user-display').text(this.getUserName(this.user)); } + this.delegateEvents(); }, @@ -159,6 +204,7 @@ _.bindAll(this, 'render', 'showSessionSelect', 'selectSession'); this.session = lightdm.sessions[0]; + this.render(); }, render: function() { @@ -189,46 +235,52 @@ events: {}, initialize: function(options) { - _.bindAll(this, 'render', 'checkTimePeriod'); + _.bindAll(this, 'render', 'setTheme'); window.autologin_timer_expired = function() {}; if (lightdm.lock_hint) this.$el.addClass('lock-screen'); - this.timePeriod = 'day'; + this.bgImgModel = new U.ImageModel + this.backgroundView = new U.BackgroundView({imageModel: this.bgImgModel}); this.sessionView = new U.SessionView(); this.loginView = new U.LoginView({uiView: this, sessionView: this.sessionView}); this.clockView = new U.ClockView(); this.powerView = new U.PowerView(); - this.render(); + this.setTheme(U.config.theme || 'jdb') + .then(this.render); }, - render: function() { - var prevTimePeriod = this.timePeriod; - this.checkTimePeriod(); + render: function() { this.theme.render(this); }, - if (this.timePeriod != prevTimePeriod) { - this.$el.removeClass(prevTimePeriod); - this.$el.addClass(this.timePeriod); - this.loginView.render(); - this.sessionView.render(); + getGreeting: function() { this.theme.getGreeting(); }, + + setTheme: function(themeName) { + var promise; + var uiView = this; + + if (U.themes[themeName]) promise = Promise.resolve(U.themes[themeName]); + else { + promise = Promise.all([ + U.load('script', 'themes/' + themeName + '/index.js'), + U.load('link', 'themes/' + themeName + '/style.css') ]); } - }, - checkTimePeriod: function() { - var now = new Date(); - if (now.getHours() >= 21 || now.getHours() < 4) this.timePeriod = 'night'; - else if (now.getHours() < 12) this.timePeriod = 'morning'; - else if (now.getHours() < 18) this.timePeriod = 'afternoon'; - else this.timePeriod = 'evening'; + return promise.then(function() { + if (uiView.theme) uiView.theme.unload(uiView); + + uiView.theme = U.themes[themeName]; + uiView.theme.init(uiView); + return uiView.theme; + }); } + }); $(document).ready(function() { U.uiView = new U.UIView(); + console.log('window: ' + Object.getOwnPropertyNames(window).join(', ')); }); - - })(); diff --git a/js/require1k.min.js b/js/require1k.min.js new file mode 100644 index 0000000..d033490 --- /dev/null +++ b/js/require1k.min.js @@ -0,0 +1 @@ +R=function(e,n,v1){function t(e,o,u,a){if(e.g)return o(e.e,e);var c=e.g=e.l,f=new XMLHttpRequest;f.onload=function(i,l){function s(){l--||o(n,e)}200==f.status||e.t?(i=[],(e.t=e.t||f.response).replace(/(?:^|[^\w\$_.])require\s*\(\s*["']([^"']*)["']\s*\)/g,function(e,n){i.push(n)}),l=i.length,i.map(function(o){t(r(e.l,o),s,"."!=o[0]?c+"/../":n,o)}),s()):u?t(e.n=r(u+="../",a),o,u,a):(e.e=f,o(f,e))},e.t?f.onload():(f.open("GET",c,!0),f.send())}function r(e,n,t){if(e.e)throw e.e;return n?(f.href=e,i.href="."!=n[0]?"./node_modules/"+n:n,t=i.href+".js",f.href="",u[t]=u[t]||{l:t}):e.n?r(e.n):(e[c]||(e.f||a("(function(require,"+c+",module){"+e.t+"\n})//# sourceURL="+e.l))(function(n){return r(r(e.l,n))},e[c]={},e),e[c])}function o(e,n){t(e.call?{l:"",t:""+e,f:e}:r("",e),function(t,o){try{e=r(o)}catch(u){t=u}n&&n(t,e)})}var u={},a=eval,c="createElement",f=e[c]("base"),i=e[c]("a");return e.head.appendChild(f),c=e.querySelector("script[data-main]"),c&&o(c.dataset.main),c="exports",o}(document); \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..c041fdc --- /dev/null +++ b/package.json @@ -0,0 +1,23 @@ +{ + "name": "lightdm-uestibulum", + "version": "1.0.0", + "description": "Custom theme for lightdm-webkit2-greeter.", + "main": "js/light-uestibulum.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git.jdb-labs.com:jdb/lightdm-uestibulum.git" + }, + "keywords": [ + "lightdm", + "greeter" + ], + "author": "Jonathan Bernard ", + "license": "MIT", + "dependencies": { + "backbone": "^1.3.3", + "jquery": "^3.1.1" + } +} diff --git a/themes/jdb/img/afternoon.png b/themes/jdb/img/afternoon.png new file mode 100644 index 0000000..967ffc7 Binary files /dev/null and b/themes/jdb/img/afternoon.png differ diff --git a/themes/jdb/img/evening.png b/themes/jdb/img/evening.png new file mode 100644 index 0000000..00c12d5 Binary files /dev/null and b/themes/jdb/img/evening.png differ diff --git a/img/afternoon.png b/themes/jdb/img/hidpi/afternoon.png similarity index 100% rename from img/afternoon.png rename to themes/jdb/img/hidpi/afternoon.png diff --git a/img/evening.png b/themes/jdb/img/hidpi/evening.png similarity index 100% rename from img/evening.png rename to themes/jdb/img/hidpi/evening.png diff --git a/img/morning.png b/themes/jdb/img/hidpi/morning.png similarity index 63% rename from img/morning.png rename to themes/jdb/img/hidpi/morning.png index 4895515..58bea01 100644 Binary files a/img/morning.png and b/themes/jdb/img/hidpi/morning.png differ diff --git a/themes/jdb/img/hidpi/night.gif b/themes/jdb/img/hidpi/night.gif new file mode 120000 index 0000000..b1b1834 --- /dev/null +++ b/themes/jdb/img/hidpi/night.gif @@ -0,0 +1 @@ +../night.gif \ No newline at end of file diff --git a/themes/jdb/img/morning.png b/themes/jdb/img/morning.png new file mode 100644 index 0000000..1265f6a Binary files /dev/null and b/themes/jdb/img/morning.png differ diff --git a/img/night.gif b/themes/jdb/img/night.gif similarity index 100% rename from img/night.gif rename to themes/jdb/img/night.gif diff --git a/themes/jdb/index.js b/themes/jdb/index.js new file mode 100644 index 0000000..c178fc1 --- /dev/null +++ b/themes/jdb/index.js @@ -0,0 +1,52 @@ +(function() { + + var U = window.uestibulum; + + function currentTimePeriod() { + var now = new Date(); + if (now.getHours() >= 21 || now.getHours() < 4) return 'night'; + else if (now.getHours() < 12) return 'morning'; + else if (now.getHours() < 18) return 'afternoon'; + else return 'evening'; + } + + var curTimePeriod; + var hidpi = U.config.hidpi; + + var imagesByName = { + morning: 'morning.png', + afternoon: 'afternoon.png', + evening: 'evening.png', + night: 'night.gif' }; + + var T = { + + name: 'jdb', + + init: function(uiView) { + uiView.$el.addClass('theme-' + uiView.theme.name); + }, + + render: function(uiView, manualTimePeriod) { + var prevTimePeriod = curTimePeriod; + curTimePeriod = manualTimePeriod || currentTimePeriod(); + + if (curTimePeriod != prevTimePeriod) { + uiView.$el.removeClass(prevTimePeriod); + uiView.$el.addClass(curTimePeriod); + uiView.loginView.render(); + uiView.bgImgModel.set('url', 'themes/jdb/img/' + + (hidpi ? 'hidpi/' : '') + imagesByName[curTimePeriod]) + } + }, + + unload: function(uiView) { + uiView.$el.removeClass('theme-' + uiView.theme.name); + uiView.$el.removeClass(curTimePeriod); + }, + + getGreeting: function() { return 'Good ' + curTimePeriod; } + + }; + U.themes['jdb'] = T; +})(); diff --git a/themes/jdb/style.css b/themes/jdb/style.css new file mode 100644 index 0000000..3a4b8dd --- /dev/null +++ b/themes/jdb/style.css @@ -0,0 +1,69 @@ +.theme-jdb { + /*&.night { + #clock-panel { + + } + + #login-panel { + position: absolute; + bottom: 2vw; + left: 2vw; + } + }*/ } + .theme-jdb.evening #clock-panel { + border-bottom: 2px solid white; + text-align: right; + position: absolute; + right: 0; + top: 0; } + .theme-jdb.evening #login-panel { + position: absolute; + bottom: 2vw; + left: 1vw; } + .theme-jdb.evening #session-panel { + position: absolute; + bottom: 0.5vw; + left: 1vw; } + .theme-jdb.morning #clock-panel, .theme-jdb.night #clock-panel, .theme-jdb.afternoon #clock-panel { + border-top: 2px solid white; + position: absolute; + left: 0; + bottom: 0; } + .theme-jdb.morning #login-panel, .theme-jdb.night #login-panel, .theme-jdb.afternoon #login-panel { + position: absolute; + bottom: 2vw; + left: 20vw; } + .theme-jdb.morning #session-panel, .theme-jdb.night #session-panel, .theme-jdb.afternoon #session-panel { + position: absolute; + bottom: 0.5vw; + left: 20vw; } + .theme-jdb.morning #clock-panel { + text-shadow: 0 0 0.2vw #446688; } + .theme-jdb.morning #users:hover #user-display, .theme-jdb.morning #sessions:hover #session-display, + .theme-jdb.morning #users-list li:hover, .theme-jdb.morning #sessions-list li.session:hover { + color: #0088aa; + text-shadow: 0 0 0.5vw black; } + .theme-jdb.morning #power-panel { + opacity: 0.7; } + .theme-jdb.afternoon #clock-panel { + text-shadow: 0 0 2vw #448844; } + .theme-jdb.afternoon #users:hover #user-display, .theme-jdb.afternoon #sessions:hover #session-display, + .theme-jdb.afternoon #users-list li:hover, .theme-jdb.afternoon #sessions-list li.session:hover { + color: #00aa00; + text-shadow: 0 0 0.5vw black; } + .theme-jdb.evening #clock-panel { + text-shadow: 0 0 2vw #faaa3b; } + .theme-jdb.evening #users:hover #user-display, .theme-jdb.evening #sessions:hover #session-display, + .theme-jdb.evening #users-list li:hover, .theme-jdb.evening #sessions-list li.session:hover { + color: orange; + text-shadow: 0 0 0.5vw black; } + .theme-jdb.evening #power-panel { + opacity: 0.7; } + .theme-jdb.night #clock-panel { + text-shadow: 0 0 2vw #884488; } + .theme-jdb.night #users:hover #user-display, .theme-jdb.night #sessions:hover #session-display, + .theme-jdb.night #users-list li:hover, .theme-jdb.night #sessions-list li.session:hover { + color: #8822bb; + text-shadow: 0 0 0.2vw black; } + +/*# sourceMappingURL=style.css.map */ diff --git a/themes/jdb/style.css.map b/themes/jdb/style.css.map new file mode 100644 index 0000000..27012bc --- /dev/null +++ b/themes/jdb/style.css.map @@ -0,0 +1,7 @@ +{ +"version": 3, +"mappings": "AAKA,UAAW;AAqFT;;;;;;;;;;KAUG;EA5FD,+BAAa;IACX,aAAa,EAAE,eAAkB;IACjC,UAAU,EAAE,KAAK;IAEjB,QAAQ,EAAE,QAAQ;IAClB,KAAK,EAAE,CAAC;IACR,GAAG,EAAE,CAAC;EAGR,+BAAa;IACX,QAAQ,EAAE,QAAQ;IAClB,MAAM,EAAE,GAAG;IACX,IAAI,EAAE,GAAG;EAGX,iCAAe;IACb,QAAQ,EAAE,QAAQ;IAClB,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,GAAG;EAKX,iGAAa;IACX,UAAU,EAAE,eAAkB;IAE9B,QAAQ,EAAE,QAAQ;IAClB,IAAI,EAAE,CAAC;IACP,MAAM,EAAE,CAAC;EAGX,iGAAa;IACX,QAAQ,EAAE,QAAQ;IAClB,MAAM,EAAE,GAAG;IACX,IAAI,EAAE,IAAI;EAGZ,uGAAe;IACb,QAAQ,EAAE,QAAQ;IAClB,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,IAAI;EAKZ,+BAAa;IAAE,WAAW,EAAE,iBAAiB;EAC7C;6FACsD;IACpD,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,eAAe;EAE9B,+BAAa;IAAE,OAAO,EAAE,GAAG;EAI3B,iCAAa;IAAE,WAAW,EAAE,eAAe;EAC3C;iGACsD;IACpD,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,eAAe;EAK9B,+BAAa;IAAE,WAAW,EAAE,eAAe;EAC3C;6FACsD;IACpD,KAAK,EAAE,MAAM;IACb,WAAW,EAAE,eAAe;EAE9B,+BAAa;IAAE,OAAO,EAAE,GAAG;EAI3B,6BAAa;IAAE,WAAW,EAAE,eAAe;EAC3C;yFACsD;IACpD,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,eAAe", +"sources": ["style.scss"], +"names": [], +"file": "style.css" +} \ No newline at end of file diff --git a/themes/jdb/style.scss b/themes/jdb/style.scss new file mode 100644 index 0000000..5921bd0 --- /dev/null +++ b/themes/jdb/style.scss @@ -0,0 +1,102 @@ +$colorFG: white; +$colorBG: black; +$colorAccent: orange; + + +.theme-jdb { + + &.evening { + #clock-panel { + border-bottom: 2px solid $colorFG; + text-align: right; + + position: absolute; + right: 0; + top: 0; + } + + #login-panel { + position: absolute; + bottom: 2vw; + left: 1vw; + } + + #session-panel { + position: absolute; + bottom: 0.5vw; + left: 1vw; + } + } + + &.morning, &.night, &.afternoon { + #clock-panel { + border-top: 2px solid $colorFG; + + position: absolute; + left: 0; + bottom: 0; + } + + #login-panel { + position: absolute; + bottom: 2vw; + left: 20vw; + } + + #session-panel { + position: absolute; + bottom: 0.5vw; + left: 20vw; + } + } + + &.morning { + #clock-panel { text-shadow: 0 0 0.2vw #446688; } + #users:hover #user-display, #sessions:hover #session-display, + #users-list li:hover, #sessions-list li.session:hover { + color: #0088aa; + text-shadow: 0 0 0.5vw black; + } + #power-panel { opacity: 0.7; } + } + + &.afternoon { + #clock-panel { text-shadow: 0 0 2vw #448844; } + #users:hover #user-display, #sessions:hover #session-display, + #users-list li:hover, #sessions-list li.session:hover { + color: #00aa00; + text-shadow: 0 0 0.5vw black; + } + } + + &.evening { + #clock-panel { text-shadow: 0 0 2vw #faaa3b; } + #users:hover #user-display, #sessions:hover #session-display, + #users-list li:hover, #sessions-list li.session:hover { + color: orange; + text-shadow: 0 0 0.5vw black; + } + #power-panel { opacity: 0.7; } + } + + &.night { + #clock-panel { text-shadow: 0 0 2vw #884488; } + #users:hover #user-display, #sessions:hover #session-display, + #users-list li:hover, #sessions-list li.session:hover { + color: #8822bb; + text-shadow: 0 0 0.2vw black; + } + } + + /*&.night { + #clock-panel { + + } + + #login-panel { + position: absolute; + bottom: 2vw; + left: 2vw; + } + }*/ +} diff --git a/themes/music/index.js b/themes/music/index.js new file mode 100644 index 0000000..bfd6db7 --- /dev/null +++ b/themes/music/index.js @@ -0,0 +1,78 @@ +(function() { + + var U = window.uestibulum; + + function guessEvent() { + var now = new Date(); + + var day = now.getDay(); + var hour = now.getHours(); + + switch (day) { + // Sunday + case 0: + if (hour >= 8 && hour < 10) return 'rehearsal'; + else if (hour >= 10 && hour < 13) return 'service'; + else if (hour >= 13 && hour < 15) return 'mixing'; + else if (hour >= 15 && hour < 18) return 'rehearsal'; + else if (hour >= 18 && hour < 21) return 'service'; + break; + + // Wednesday + case 3: + if (hour == 18) return 'rehearsal'; + else if (hour >= 19 && hour < 21) return 'service'; + break; + + // Tuesday, Thursday + case 2: case 4: + if (hour >= 19 && hour < 21) return 'rehearsal'; + break; + + // Monday, Friday, Saturday + default: + } + + return 'other'; + } + + var curEvent; + var hidpi = U.config.hidpi; + + var imagesByName = { + mixing: [], + rehearsal: [], + service: [], + other: [] } + + var T = { + + name: 'music', + + init: function(uiView) { + uiView.$el.addClass('theme-' + uiView.theme.name); + }, + + render: function(uiView, manualEvent) { + var prevEvent = curEvent; + curEvent = manualEvent || guessEvent(); + + if (curEvent != prevEvent) { + uiView.$el.removeClass(prevEvent); + uiView.$el.addClass(curEvent); + uiView.loginView.render(); + uiView.bgImgModel.set('url', 'themes/music/img/' + + (hidpi ? 'hidpi/' : '') + imagesByName[curEvent]) + } + }, + + unload: function(uiView) { + uiView.$el.removeClass('theme-' + uiView.theme.name); + uiView.$el.removeClass(curEvent); + }, + + getGreeting: function() { return 'Good ' + curEvent; } + + }; + U.themes['jdb'] = T; +})(); diff --git a/themes/music/style.css b/themes/music/style.css new file mode 100644 index 0000000..329651d --- /dev/null +++ b/themes/music/style.css @@ -0,0 +1,3 @@ + + +/*# sourceMappingURL=style.css.map */ diff --git a/themes/music/style.css.map b/themes/music/style.css.map new file mode 100644 index 0000000..1a13aa0 --- /dev/null +++ b/themes/music/style.css.map @@ -0,0 +1,7 @@ +{ +"version": 3, +"mappings": "", +"sources": [], +"names": [], +"file": "style.css" +} \ No newline at end of file diff --git a/themes/music/style.scss b/themes/music/style.scss new file mode 100644 index 0000000..587d1b3 --- /dev/null +++ b/themes/music/style.scss @@ -0,0 +1,8 @@ +$colorFG: white; +$colorBG: black; +$colorAccent: orange; + + +.theme-music { + +}